2018-02-24 18:00:00 +00:00
|
|
|
import {
|
|
|
|
ethPlorer,
|
|
|
|
ETHTokenExplorer,
|
|
|
|
SecureWalletName,
|
|
|
|
InsecureWalletName,
|
|
|
|
gasPriceDefaults
|
|
|
|
} from 'config/data';
|
2018-02-12 20:43:07 +00:00
|
|
|
import {
|
|
|
|
ETH_DEFAULT,
|
|
|
|
ETH_TREZOR,
|
|
|
|
ETH_LEDGER,
|
|
|
|
ETC_LEDGER,
|
|
|
|
ETC_TREZOR,
|
|
|
|
ETH_TESTNET,
|
|
|
|
EXP_DEFAULT,
|
2018-04-06 14:02:02 +00:00
|
|
|
UBQ_DEFAULT,
|
|
|
|
POA_DEFAULT,
|
|
|
|
TOMO_DEFAULT,
|
|
|
|
ELLA_DEFAULT
|
2018-02-12 20:43:07 +00:00
|
|
|
} from 'config/dpaths';
|
|
|
|
import { ConfigAction } from 'actions/config';
|
2018-04-05 20:53:36 +00:00
|
|
|
import { BlockExplorerConfig } from 'types/network';
|
|
|
|
import { StaticNetworksState as State } from './types';
|
2018-02-12 20:43:07 +00:00
|
|
|
|
|
|
|
// Must be a website that follows the ethplorer convention of /tx/[hash] and
|
|
|
|
// address/[address] to generate the correct functions.
|
|
|
|
// TODO: put this in utils / libs
|
2018-04-06 14:02:02 +00:00
|
|
|
interface ExplorerConfig {
|
|
|
|
name: string;
|
|
|
|
origin: string;
|
|
|
|
txPath?: string;
|
|
|
|
addressPath?: string;
|
|
|
|
blockPath?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function makeExplorer(expConfig: ExplorerConfig): BlockExplorerConfig {
|
|
|
|
const config: ExplorerConfig = {
|
|
|
|
// Defaults
|
|
|
|
txPath: 'tx',
|
|
|
|
addressPath: 'address',
|
|
|
|
blockPath: 'block',
|
|
|
|
...expConfig
|
|
|
|
};
|
|
|
|
|
2018-02-12 20:43:07 +00:00
|
|
|
return {
|
2018-04-06 14:02:02 +00:00
|
|
|
name: config.origin,
|
|
|
|
origin: config.origin,
|
|
|
|
txUrl: hash => `${config.origin}/${config.txPath}/${hash}`,
|
|
|
|
addressUrl: address => `${config.origin}/${config.addressPath}/${address}`,
|
|
|
|
blockUrl: blockNum => `${config.origin}/${config.blockPath}/${blockNum}`
|
2018-02-12 20:43:07 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-24 18:00:00 +00:00
|
|
|
const testnetDefaultGasPrice = {
|
|
|
|
min: 0.1,
|
|
|
|
max: 40,
|
|
|
|
initial: 4
|
|
|
|
};
|
|
|
|
|
|
|
|
export const INITIAL_STATE: State = {
|
2018-02-12 20:43:07 +00:00
|
|
|
ETH: {
|
|
|
|
name: 'ETH',
|
|
|
|
unit: 'ETH',
|
|
|
|
chainId: 1,
|
|
|
|
isCustom: false,
|
2018-03-01 19:49:07 +00:00
|
|
|
color: '#007896',
|
2018-04-06 14:02:02 +00:00
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Etherscan',
|
|
|
|
origin: 'https://etherscan.io'
|
|
|
|
}),
|
2018-02-12 20:43:07 +00:00
|
|
|
tokenExplorer: {
|
|
|
|
name: ethPlorer,
|
|
|
|
address: ETHTokenExplorer
|
|
|
|
},
|
|
|
|
tokens: require('config/tokens/eth.json'),
|
|
|
|
contracts: require('config/contracts/eth.json'),
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: ETH_TREZOR,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: ETH_LEDGER,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: ETH_DEFAULT
|
2018-02-24 18:00:00 +00:00
|
|
|
},
|
|
|
|
gasPriceSettings: gasPriceDefaults,
|
|
|
|
shouldEstimateGasPrice: true
|
2018-02-12 20:43:07 +00:00
|
|
|
},
|
|
|
|
Ropsten: {
|
|
|
|
name: 'Ropsten',
|
|
|
|
unit: 'ETH',
|
|
|
|
chainId: 3,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#adc101',
|
2018-04-06 14:02:02 +00:00
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Etherscan',
|
|
|
|
origin: 'https://ropsten.etherscan.io'
|
|
|
|
}),
|
2018-02-12 20:43:07 +00:00
|
|
|
tokens: require('config/tokens/ropsten.json'),
|
|
|
|
contracts: require('config/contracts/ropsten.json'),
|
|
|
|
isTestnet: true,
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: ETH_TESTNET,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: ETH_TESTNET,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: ETH_TESTNET
|
2018-02-24 18:00:00 +00:00
|
|
|
},
|
|
|
|
gasPriceSettings: testnetDefaultGasPrice
|
2018-02-12 20:43:07 +00:00
|
|
|
},
|
|
|
|
Kovan: {
|
|
|
|
name: 'Kovan',
|
|
|
|
unit: 'ETH',
|
|
|
|
chainId: 42,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#adc101',
|
2018-04-06 14:02:02 +00:00
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Etherscan',
|
|
|
|
origin: 'https://kovan.etherscan.io'
|
|
|
|
}),
|
2018-02-12 20:43:07 +00:00
|
|
|
tokens: require('config/tokens/ropsten.json'),
|
|
|
|
contracts: require('config/contracts/ropsten.json'),
|
|
|
|
isTestnet: true,
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: ETH_TESTNET,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: ETH_TESTNET,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: ETH_TESTNET
|
2018-02-24 18:00:00 +00:00
|
|
|
},
|
|
|
|
gasPriceSettings: testnetDefaultGasPrice
|
2018-02-12 20:43:07 +00:00
|
|
|
},
|
|
|
|
Rinkeby: {
|
|
|
|
name: 'Rinkeby',
|
|
|
|
unit: 'ETH',
|
|
|
|
chainId: 4,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#adc101',
|
2018-04-06 14:02:02 +00:00
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Etherscan',
|
|
|
|
origin: 'https://rinkeby.etherscan.io'
|
|
|
|
}),
|
2018-02-12 20:43:07 +00:00
|
|
|
tokens: require('config/tokens/rinkeby.json'),
|
|
|
|
contracts: require('config/contracts/rinkeby.json'),
|
|
|
|
isTestnet: true,
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: ETH_TESTNET,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: ETH_TESTNET,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: ETH_TESTNET
|
2018-02-24 18:00:00 +00:00
|
|
|
},
|
|
|
|
gasPriceSettings: testnetDefaultGasPrice
|
2018-02-12 20:43:07 +00:00
|
|
|
},
|
|
|
|
ETC: {
|
|
|
|
name: 'ETC',
|
|
|
|
unit: 'ETC',
|
|
|
|
chainId: 61,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#669073',
|
2018-04-06 14:02:02 +00:00
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'GasTracker',
|
|
|
|
origin: 'https://gastracker.io',
|
|
|
|
addressPath: 'addr'
|
|
|
|
}),
|
2018-02-12 20:43:07 +00:00
|
|
|
tokens: require('config/tokens/etc.json'),
|
|
|
|
contracts: require('config/contracts/etc.json'),
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: ETC_TREZOR,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: ETC_LEDGER,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: ETC_TREZOR
|
2018-02-24 18:00:00 +00:00
|
|
|
},
|
|
|
|
gasPriceSettings: {
|
|
|
|
min: 0.1,
|
|
|
|
max: 10,
|
|
|
|
initial: 1
|
2018-02-12 20:43:07 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
UBQ: {
|
|
|
|
name: 'UBQ',
|
|
|
|
unit: 'UBQ',
|
|
|
|
chainId: 8,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#b37aff',
|
2018-04-06 14:02:02 +00:00
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Ubiqscan',
|
|
|
|
origin: 'https://ubiqscan.io/en'
|
|
|
|
}),
|
2018-02-12 20:43:07 +00:00
|
|
|
tokens: require('config/tokens/ubq.json'),
|
|
|
|
contracts: require('config/contracts/ubq.json'),
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: UBQ_DEFAULT,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: UBQ_DEFAULT,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: UBQ_DEFAULT
|
2018-02-24 18:00:00 +00:00
|
|
|
},
|
|
|
|
gasPriceSettings: {
|
|
|
|
min: 1,
|
|
|
|
max: 60,
|
|
|
|
initial: 20
|
2018-02-12 20:43:07 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
EXP: {
|
|
|
|
name: 'EXP',
|
|
|
|
unit: 'EXP',
|
|
|
|
chainId: 2,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#673ab7',
|
2018-04-06 14:02:02 +00:00
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Gander',
|
|
|
|
origin: 'https://www.gander.tech'
|
|
|
|
}),
|
2018-02-12 20:43:07 +00:00
|
|
|
tokens: require('config/tokens/exp.json'),
|
|
|
|
contracts: require('config/contracts/exp.json'),
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: EXP_DEFAULT,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: EXP_DEFAULT,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: EXP_DEFAULT
|
2018-02-24 18:00:00 +00:00
|
|
|
},
|
|
|
|
gasPriceSettings: {
|
|
|
|
min: 0.1,
|
|
|
|
max: 20,
|
|
|
|
initial: 2
|
2018-02-12 20:43:07 +00:00
|
|
|
}
|
2018-04-06 14:02:02 +00:00
|
|
|
},
|
|
|
|
POA: {
|
|
|
|
name: 'POA',
|
|
|
|
unit: 'POA',
|
|
|
|
chainId: 99,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#6d2eae',
|
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Etherchain Light',
|
|
|
|
origin: 'https://poaexplorer.com',
|
|
|
|
addressPath: 'address/search',
|
|
|
|
blockPath: 'blocks/block'
|
|
|
|
}),
|
|
|
|
tokens: [],
|
|
|
|
contracts: [],
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: POA_DEFAULT,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: POA_DEFAULT,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: POA_DEFAULT
|
|
|
|
},
|
|
|
|
gasPriceSettings: {
|
|
|
|
min: 0.1,
|
|
|
|
max: 10,
|
|
|
|
initial: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
TOMO: {
|
|
|
|
name: 'TOMO',
|
|
|
|
unit: 'TOMO',
|
|
|
|
chainId: 40686,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#6a488d',
|
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Tomochain Explorer',
|
|
|
|
origin: 'https://explorer.tomocoin.io/#'
|
|
|
|
}),
|
|
|
|
tokens: [],
|
|
|
|
contracts: [],
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: TOMO_DEFAULT,
|
|
|
|
[SecureWalletName.LEDGER_NANO_S]: TOMO_DEFAULT,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: TOMO_DEFAULT
|
|
|
|
},
|
|
|
|
gasPriceSettings: {
|
|
|
|
min: 1,
|
|
|
|
max: 60,
|
|
|
|
initial: 20
|
|
|
|
}
|
|
|
|
},
|
|
|
|
ELLA: {
|
|
|
|
name: 'ELLA',
|
|
|
|
unit: 'ELLA',
|
|
|
|
chainId: 64,
|
|
|
|
isCustom: false,
|
|
|
|
color: '#046111',
|
|
|
|
blockExplorer: makeExplorer({
|
|
|
|
name: 'Ellaism Explorer',
|
|
|
|
origin: 'https://explorer.ellaism.org'
|
|
|
|
}),
|
|
|
|
tokens: [],
|
|
|
|
contracts: [],
|
|
|
|
dPathFormats: {
|
|
|
|
[SecureWalletName.TREZOR]: ELLA_DEFAULT,
|
|
|
|
[InsecureWalletName.MNEMONIC_PHRASE]: ELLA_DEFAULT
|
|
|
|
},
|
|
|
|
gasPriceSettings: {
|
|
|
|
min: 1,
|
|
|
|
max: 60,
|
|
|
|
initial: 20
|
|
|
|
}
|
2018-02-12 20:43:07 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const staticNetworks = (state: State = INITIAL_STATE, action: ConfigAction) => {
|
|
|
|
switch (action.type) {
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|