Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web3 rework travis #2

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:latest
FROM node:8

COPY . /

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Follow the project progress at: [ETC Block Explorer Development](https://github.
"patch": true,
"patchBlocks": 100,
"bulkSize": 100,
"useRichList": true,
"settings": {
"symbol": "ETC",
"name": "Ethereum Classic",
Expand All @@ -56,11 +57,12 @@ Follow the project progress at: [ETC Block Explorer Development](https://github.
"github": "https://github.com/ethereumclassic",
"github-repo": "https://github.com/ethereumclassic/explorer",
"logo": "/img/explorer-logo.png",
"customCss": "green-haze.min.css",
"copyright": "2019 © Ethereum Classic.",
"poweredbyCustom": false,
"poweredbyEtcImage": "/img/powered-by-etcexplorer-w.png",
"poweredbyEtc": true,
"useRichList": true,
"showRichList": true,
"useFiat": true,
"miners": {
"0xdf7d7e053933b5cc24372f878c90e62dadad5d42": "EtherMine",
Expand Down Expand Up @@ -106,6 +108,7 @@ Follow the project progress at: [ETC Block Explorer Development](https://github.
| `patch` | If set to true and below value is set, sync will iterated through the # of blocks specified. |
| `patchBlocks` | If `patch` is set to true, the amount of block specified will be check from the latest one. |
| `useRichList` | If `useRichList` is set to true, explorer will update account balance for richlist page. |
| `showRichList` | If `showRichList` is set to false, explorer will not show richlist link. It is useful while update or maintain richlist db. |
| `useFiat` | If `useFiat` is set to true, explorer will show price for account & tx page. ( Disable for testnets )|

## Run
Expand Down
4 changes: 3 additions & 1 deletion config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"patch": true,
"patchBlocks": 100,
"bulkSize": 100,
"useRichList": true,
"settings": {
"symbol": "ETC",
"name": "Ethereum Classic",
Expand All @@ -21,12 +22,13 @@
"github": "https://github.com/ethereumclassic",
"github-repo": "https://github.com/ethereumclassic/explorer",
"logo": "/img/explorer-logo.png",
"customCss": "green-haze.min.css",
"copyright": "2019 © Ethereum Classic.",
"poweredbyCustom": false,
"poweredbyEtcImage": "/img/powered-by-etcexplorer-w.png",
"poweredbyEtc": true,
"tokenList": "tokens.json",
"useRichList": true,
"showRichList": true,
"useFiat": true,
"miners": {
"0xdf7d7e053933b5cc24372f878c90e62dadad5d42": "EtherMine",
Expand Down
40 changes: 40 additions & 0 deletions lib/methods/ParityListAccountsMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @file ParityListAccountMethod.js
* @author Samuel Furter <[email protected]>
* @author hackyminer <[email protected]>
* @license LGPL
* @date 2019/10/18
*/

import isFunction from 'lodash/isFunction';
import { AbstractMethod } from 'web3-core-method';

export default class ParityListAccountMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('parity_listAccounts', 3, utils, formatters, moduleInstance);
}

/**
* This method will be executed before the RPC request.
*
* @method beforeExecution
*
* @param {AbstractWeb3Module} moduleInstance - The package where the method is called from.
*/
beforeExecution(moduleInstance) {
// Optional second parameter 'defaultBlock' could also be the callback
if (isFunction(this.parameters[2])) {
this.callback = this.parameters[2];
this.parameters[2] = moduleInstance.defaultBlock;
}

this.parameters[2] = this.formatters.inputDefaultBlockNumberFormatter(this.parameters[2], moduleInstance);
}
}
36 changes: 36 additions & 0 deletions lib/methods/TraceFilterMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @file TraceFilterMethod.js
* @author Samuel Furter <[email protected]>
* @author hackyminer <[email protected]>
* @license LGPL
* @date 2019/10/18
*/

import isFunction from 'lodash/isFunction';
import { AbstractMethod } from 'web3-core-method';

export default class TraceFilterMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('trace_filter', 1, utils, formatters, moduleInstance);
}

/**
* This method will be executed after the RPC request.
*
* @method afterExecution
*
* @param {Array} response
*
* @returns {Array}
*/
afterExecution(response) {
return response;
}
}
49 changes: 49 additions & 0 deletions lib/methods/TraceTransactionMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* @file TraceTransactionMethod.js
* @author Samuel Furter <[email protected]>
* @author hackyminer <[email protected]>
* @license LGPL
* @date 2019/10/18
*/

import isFunction from 'lodash/isFunction';
import { AbstractMethod } from 'web3-core-method';

export default class TraceTransactionMethod extends AbstractMethod {
/**
* @param {Utils} utils
* @param {Object} formatters
* @param {AbstractWeb3Module} moduleInstance
*
* @constructor
*/
constructor(utils, formatters, moduleInstance) {
super('trace_transaction', 1, utils, formatters, moduleInstance);
}

/**
* This method will be executed before the RPC request.
*
* @method beforeExecution
*
* @param {AbstractWeb3Module} moduleInstance - The package where the method is called from.
*/
beforeExecution(moduleInstance) {
if (isFunction(this.parameters[1])) {
this.callback = this.parameters[1];
}
}

/**
* This method will be executed after the RPC request.
*
* @method afterExecution
*
* @param {Array} response
*
* @returns {Array}
*/
afterExecution(response) {
return response;
}
}
206 changes: 206 additions & 0 deletions lib/parity/Parity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
/**
* @file Parity.js
* @author Samuel Furter <[email protected]>
* @author hackyminer <[email protected]>
* @license LGPL
* @date 2019/10/18
*/

import {AbstractWeb3Module} from 'web3-core';

export default class Parity extends AbstractWeb3Module {
/**
* TODO: Add missing documentation for getAccounts, lockAccount and sendTransaction!
* @param {Web3EthereumProvider|HttpProvider|WebsocketProvider|IpcProvider|String} provider
* @param {MethodFactory} methodFactory
* @param {Network} net
* @param {Utils} utils
* @param {Object} formatters
* @param {Object} options
* @param {Net.Socket} nodeNet
*
* @constructor
*/
constructor(provider, methodFactory, net, utils, formatters, options, nodeNet) {
super(provider, options, methodFactory, nodeNet);

this.utils = utils;
this.formatters = formatters;
this.net = net;
}

/**
* Extends setProvider method from AbstractWeb3Module.
*
* @method setProvider
*
* @param {Object|String} provider
* @param {Net} net
*
* @returns {Boolean}
*/
setProvider(provider, net) {
return !!(super.setProvider(provider, net) && this.net.setProvider(provider, net));
}

/**
* Sets the defaultGasPrice property on the current object and the network module
*
* @property defaultGasPrice
*
* @param {String} value
*/
set defaultGasPrice(value) {
super.defaultGasPrice = value;
this.net.defaultGasPrice = value;
}

/**
* Gets the defaultGasPrice property
*
* @property defaultGasPrice
*
* @returns {String|Number} value
*/
get defaultGasPrice() {
return super.defaultGasPrice;
}

/**
* Sets the defaultGas property on the current object and the network module
*
* @property defaultGas
*
* @param {Number} value
*/
set defaultGas(value) {
super.defaultGas = value;
this.net.defaultGas = value;
}

/**
* Gets the defaultGas property
*
* @property defaultGas
*
* @returns {String|Number} value
*/
get defaultGas() {
return super.defaultGas;
}

/**
* Sets the transactionBlockTimeout property on the current object and the network module
*
* @property transactionBlockTimeout
*
* @param {Number} value
*/
set transactionBlockTimeout(value) {
super.transactionBlockTimeout = value;
this.net.transactionBlockTimeout = value;
}

/**
* Gets the transactionBlockTimeout property
*
* @property transactionBlockTimeout
*
* @returns {Number} value
*/
get transactionBlockTimeout() {
return super.transactionBlockTimeout;
}

/**
* Sets the transactionConfirmationBlocks property on the current object and the network module
*
* @property transactionConfirmationBlocks
*
* @param {Number} value
*/
set transactionConfirmationBlocks(value) {
super.transactionConfirmationBlocks = value;
this.net.transactionConfirmationBlocks = value;
}

/**
* Gets the transactionConfirmationBlocks property
*
* @property transactionConfirmationBlocks
*
* @returns {Number} value
*/
get transactionConfirmationBlocks() {
return super.transactionConfirmationBlocks;
}

/**
* Sets the transactionPollingTimeout property on the current object and the network module
*
* @property transactionPollingTimeout
*
* @param {Number} value
*/
set transactionPollingTimeout(value) {
super.transactionPollingTimeout = value;
this.net.transactionPollingTimeout = value;
}

/**
* Gets the transactionPollingTimeout property
*
* @property transactionPollingTimeout
*
* @returns {Number} value
*/
get transactionPollingTimeout() {
return super.transactionPollingTimeout;
}

/**
* Sets the defaultAccount property on the current object and the network module
*
* @property defaultAccount
*
* @param {String} value
*/
set defaultAccount(value) {
super.defaultAccount = value;
this.net.defaultAccount = value;
}

/**
* Gets the defaultAccount property
*
* @property defaultAccount
*
* @returns {String} value
*/
get defaultAccount() {
return super.defaultAccount;
}

/**
* Sets the defaultBlock property on the current object and the network module
*
* @property defaultBlock
*
* @param value
*/
set defaultBlock(value) {
super.defaultBlock = value;
this.net.defaultBlock = value;
}

/**
* Gets the defaultBlock property
*
* @property defaultBlock
*
* @returns {String|Number} value
*/
get defaultBlock() {
return super.defaultBlock;
}
}
Loading