Etherscan links based on netVersion identifier (#4772)

* Use netVersion to determine external links

* Update additional isTest references
This commit is contained in:
Jaco Greeff 2017-03-06 08:54:59 +01:00 committed by Gav Wood
parent 944dcdc010
commit 0b24a3d7f6
41 changed files with 217 additions and 175 deletions

View File

@ -21,15 +21,15 @@ const PAGE_SIZE = 25;
import util from '../../api/util'; import util from '../../api/util';
import { call } from './call'; import { call } from './call';
function _call (method, params, test) { function _call (method, params, test, netVersion) {
return call('account', method, params, test); return call('account', method, params, test, netVersion);
} }
function balance (address, test = false) { function balance (address, test, netVersion) {
return _call('balance', { return _call('balance', {
address: address, address: address,
tag: 'latest' tag: 'latest'
}, test).then((balance) => { }, test, netVersion).then((balance) => {
// same format as balancemulti below // same format as balancemulti below
return { return {
account: address, account: address,
@ -38,21 +38,21 @@ function balance (address, test = false) {
}); });
} }
function balances (addresses, test = false) { function balances (addresses, test, netVersion) {
return _call('balancemulti', { return _call('balancemulti', {
address: addresses.join(','), address: addresses.join(','),
tag: 'latest' tag: 'latest'
}, test); }, test, netVersion);
} }
function transactions (address, page, test = false) { function transactions (address, page, test, netVersion) {
// page offset from 0 // page offset from 0
return _call('txlist', { return _call('txlist', {
address: address, address: address,
offset: PAGE_SIZE, offset: PAGE_SIZE,
page: (page || 0) + 1, page: (page || 0) + 1,
sort: 'desc' sort: 'desc'
}, test).then((transactions) => { }, test, netVersion).then((transactions) => {
return transactions.map((tx) => { return transactions.map((tx) => {
return { return {
blockNumber: new BigNumber(tx.blockNumber || 0), blockNumber: new BigNumber(tx.blockNumber || 0),
@ -67,9 +67,9 @@ function transactions (address, page, test = false) {
} }
const account = { const account = {
balance: balance, balance,
balances: balances, balances,
transactions: transactions transactions
}; };
export { account }; export { account };

View File

@ -23,14 +23,32 @@ const options = {
} }
}; };
export function call (module, action, _params, test) { export function call (module, action, _params, test, netVersion) {
const host = test ? 'testnet.etherscan.io' : 'api.etherscan.io'; let prefix = 'api.';
switch (netVersion) {
case '2':
case '3':
prefix = 'testnet.';
break;
case '42':
prefix = 'kovan.';
break;
case '0':
default:
if (test) {
prefix = 'testnet.';
}
break;
}
const query = stringify(Object.assign({ const query = stringify(Object.assign({
module, action module, action
}, _params || {})); }, _params || {}));
return fetch(`https://${host}/api?${query}`, options) return fetch(`https://${prefix}etherscan.io/api?${query}`, options)
.then((response) => { .then((response) => {
if (!response.ok) { if (!response.ok) {
throw { code: response.status, message: response.statusText }; // eslint-disable-line throw { code: response.status, message: response.statusText }; // eslint-disable-line

View File

@ -19,8 +19,8 @@ import { stringify } from 'qs';
import { url } from './links'; import { url } from './links';
function mockget (requests, test) { function mockget (requests, test, netVersion) {
let scope = nock(url(test)); let scope = nock(url(test, netVersion));
requests.forEach((request) => { requests.forEach((request) => {
scope = scope scope = scope

View File

@ -14,14 +14,35 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
export const url = (isTestnet = false) => { // NOTE: Keep 'isTestnet' for backwards library compatibility
return `https://${isTestnet ? 'testnet.' : ''}etherscan.io`; export const url = (isTestnet = false, netVersion = '0') => {
let prefix = '';
switch (netVersion) {
case '2':
case '3':
prefix = 'testnet.';
break;
case '42':
prefix = 'kovan.';
break;
case '0':
default:
if (isTestnet) {
prefix = 'testnet.';
}
break;
}
return `https://${prefix}etherscan.io`;
}; };
export const txLink = (hash, isTestnet = false) => { export const txLink = (hash, isTestnet = false, netVersion = '0') => {
return `${url(isTestnet)}/tx/${hash}`; return `${url(isTestnet, netVersion)}/tx/${hash}`;
}; };
export const addressLink = (address, isTestnet = false) => { export const addressLink = (address, isTestnet = false, netVersion = '0') => {
return `${url(isTestnet)}/address/${address}`; return `${url(isTestnet, netVersion)}/address/${address}`;
}; };

View File

@ -32,16 +32,12 @@ const REGISTRY_V1_HASHES = [
'0x64c3ee34851517a9faecd995c102b339f03e564ad6772dc43a26f993238b20ec' // homestead '0x64c3ee34851517a9faecd995c102b339f03e564ad6772dc43a26f993238b20ec' // homestead
]; ];
export const setIsTestnet = (isTestnet) => ({ type: 'set isTestnet', isTestnet }); export const setNetVersion = (netVersion) => ({ type: 'set netVersion', netVersion });
export const fetchIsTestnet = () => (dispatch) => export const fetchIsTestnet = () => (dispatch) =>
api.net.version() api.net.version()
.then((netVersion) => { .then((netVersion) => {
dispatch(setIsTestnet([ dispatch(setNetVersion(netVersion));
'2', // morden
'3', // ropsten
'42' // kovan
].includes(netVersion)));
}) })
.catch((err) => { .catch((err) => {
console.error('could not check if testnet'); console.error('could not check if testnet');

View File

@ -22,8 +22,8 @@ import namesReducer from './Names/reducers.js';
import recordsReducer from './Records/reducers.js'; import recordsReducer from './Records/reducers.js';
import reverseReducer from './Reverse/reducers.js'; import reverseReducer from './Reverse/reducers.js';
const isTestnetReducer = (state = null, action) => const netVersionReducer = (state = null, action) =>
action.type === 'set isTestnet' ? action.isTestnet : state; action.type === 'set netVersion' ? action.netVersion : state;
const contractReducer = (state = null, action) => const contractReducer = (state = null, action) =>
action.type === 'set contract' ? action.contract : state; action.type === 'set contract' ? action.contract : state;
@ -35,7 +35,7 @@ const ownerReducer = (state = null, action) =>
action.type === 'set owner' ? action.owner : state; action.type === 'set owner' ? action.owner : state;
const initialState = { const initialState = {
isTestnet: isTestnetReducer(undefined, { type: '' }), netVersion: netVersionReducer(undefined, { type: '' }),
accounts: accountsReducer(undefined, { type: '' }), accounts: accountsReducer(undefined, { type: '' }),
contacts: contactsReducer(undefined, { type: '' }), contacts: contactsReducer(undefined, { type: '' }),
contract: contractReducer(undefined, { type: '' }), contract: contractReducer(undefined, { type: '' }),
@ -49,7 +49,7 @@ const initialState = {
}; };
export default (state = initialState, action) => ({ export default (state = initialState, action) => ({
isTestnet: isTestnetReducer(state.isTestnet, action), netVersion: netVersionReducer(state.netVersion, action),
accounts: accountsReducer(state.accounts, action), accounts: accountsReducer(state.accounts, action),
contacts: contactsReducer(state.contacts, action), contacts: contactsReducer(state.contacts, action),
contract: contractReducer(state.contract, action), contract: contractReducer(state.contract, action),

View File

@ -28,7 +28,7 @@ class Address extends Component {
static propTypes = { static propTypes = {
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
account: nullableProptype(PropTypes.object.isRequired), account: nullableProptype(PropTypes.object.isRequired),
isTestnet: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
key: PropTypes.string, key: PropTypes.string,
shortenHash: PropTypes.bool shortenHash: PropTypes.bool
}; };
@ -56,7 +56,7 @@ class Address extends Component {
} }
renderCaption () { renderCaption () {
const { address, account, isTestnet, shortenHash } = this.props; const { address, account, netVersion, shortenHash } = this.props;
if (account) { if (account) {
const { name } = account; const { name } = account;
@ -64,7 +64,7 @@ class Address extends Component {
return ( return (
<a <a
className={ styles.link } className={ styles.link }
href={ etherscanUrl(address, isTestnet) } href={ etherscanUrl(address, false, netVersion) }
target='_blank' target='_blank'
> >
<abbr <abbr
@ -103,14 +103,14 @@ function mapStateToProps (initState, initProps) {
}); });
return (state, props) => { return (state, props) => {
const { isTestnet } = state; const { netVersion } = state;
const { address = '' } = props; const { address = '' } = props;
const account = allAccounts[address] || null; const account = allAccounts[address] || null;
return { return {
account, account,
isTestnet netVersion
}; };
}; };
} }

View File

@ -26,7 +26,7 @@ const leading0x = /^0x/;
class Hash extends Component { class Hash extends Component {
static propTypes = { static propTypes = {
hash: PropTypes.string.isRequired, hash: PropTypes.string.isRequired,
isTestnet: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
linked: PropTypes.bool linked: PropTypes.bool
} }
@ -35,7 +35,7 @@ class Hash extends Component {
} }
render () { render () {
const { hash, isTestnet, linked } = this.props; const { hash, netVersion, linked } = this.props;
let shortened = hash.toLowerCase().replace(leading0x, ''); let shortened = hash.toLowerCase().replace(leading0x, '');
@ -47,7 +47,7 @@ class Hash extends Component {
return ( return (
<a <a
className={ styles.link } className={ styles.link }
href={ etherscanUrl(hash, isTestnet) } href={ etherscanUrl(hash, false, netVersion) }
target='_blank' target='_blank'
> >
<abbr title={ hash }>{ shortened }</abbr> <abbr title={ hash }>{ shortened }</abbr>
@ -61,7 +61,7 @@ class Hash extends Component {
export default connect( export default connect(
(state) => ({ // mapStateToProps (state) => ({ // mapStateToProps
isTestnet: state.isTestnet netVersion: state.netVersion
}), }),
null // mapDispatchToProps null // mapDispatchToProps
)(Hash); )(Hash);

View File

@ -14,13 +14,15 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { url as externalUrl } from '~/3rdparty/etherscan/links';
const leading0x = /^0x/; const leading0x = /^0x/;
const etherscanUrl = (hash, isTestnet) => { const etherscanUrl = (hash, isTestnet, netVersion) => {
hash = hash.toLowerCase().replace(leading0x, ''); hash = hash.toLowerCase().replace(leading0x, '');
const type = hash.length === 40 ? 'address' : 'tx'; const type = hash.length === 40 ? 'address' : 'tx';
return `https://${isTestnet ? 'testnet.' : ''}etherscan.io/${type}/0x${hash}`; return `https://${externalUrl(isTestnet, netVersion)}/${type}/0x${hash}`;
}; };
export default etherscanUrl; export default etherscanUrl;

View File

@ -16,6 +16,7 @@
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import { url as etherscanUrl } from '~/3rdparty/etherscan/links';
import * as abis from '~/contracts/abi'; import * as abis from '~/contracts/abi';
import { api } from './parity'; import { api } from './parity';
@ -28,7 +29,7 @@ const subscriptions = {};
let defaultSubscriptionId; let defaultSubscriptionId;
let nextSubscriptionId = 1000; let nextSubscriptionId = 1000;
let isTest = false; let netVersion = '0';
export function subscribeEvents (addresses, callback) { export function subscribeEvents (addresses, callback) {
const subscriptionId = nextSubscriptionId++; const subscriptionId = nextSubscriptionId++;
@ -117,15 +118,16 @@ export function attachInstances () {
return Promise return Promise
.all([ .all([
api.parity.registryAddress(), api.parity.registryAddress(),
api.parity.netChain() api.parity.netChain(),
api.partiy.netVersion()
]) ])
.then(([registryAddress, netChain]) => { .then(([registryAddress, netChain, _netVersion]) => {
const registry = api.newContract(abis.registry, registryAddress).instance; const registry = api.newContract(abis.registry, registryAddress).instance;
isTest = ['kovan', 'morden', 'ropsten', 'testnet'].includes(netChain); netVersion = _netVersion;
console.log(`contract was found at registry=${registryAddress}`); console.log(`contract was found at registry=${registryAddress}`);
console.log(`running on ${netChain}, isTest=${isTest}`); console.log(`running on ${netChain}, network ${netVersion}`);
return Promise return Promise
.all([ .all([
@ -287,5 +289,5 @@ export function loadTokenBalance (tokenAddress, address) {
} }
export function txLink (txHash) { export function txLink (txHash) {
return `https://${isTest ? 'testnet.' : ''}etherscan.io/tx/${txHash}`; return `https://${etherscanUrl(false, netVersion)}/tx/${txHash}`;
} }

View File

@ -84,7 +84,6 @@ class ExecuteContract extends Component {
contract: PropTypes.object.isRequired, contract: PropTypes.object.isRequired,
fromAddress: PropTypes.string, fromAddress: PropTypes.string,
gasLimit: PropTypes.object.isRequired, gasLimit: PropTypes.object.isRequired,
isTest: PropTypes.bool,
onClose: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired,
onFromAddressChange: PropTypes.func.isRequired onFromAddressChange: PropTypes.func.isRequired
} }

View File

@ -302,6 +302,7 @@ export default class Status {
defaultExtraData, defaultExtraData,
netChain, netChain,
netPort, netPort,
netVersion,
rpcSettings, rpcSettings,
isTest, isTest,
enode enode

View File

@ -40,6 +40,7 @@ const initialState = {
max: new BigNumber(0) max: new BigNumber(0)
}, },
netPort: new BigNumber(0), netPort: new BigNumber(0),
netVersion: '0',
rpcSettings: {}, rpcSettings: {},
syncing: true, syncing: true,
isConnected: false, isConnected: false,

View File

@ -34,8 +34,8 @@ class TxHash extends Component {
static propTypes = { static propTypes = {
hash: PropTypes.string.isRequired, hash: PropTypes.string.isRequired,
isTest: PropTypes.bool,
maxConfirmations: PropTypes.number, maxConfirmations: PropTypes.number,
netVersion: PropTypes.string.isRequired,
summary: PropTypes.bool summary: PropTypes.bool
} }
@ -116,10 +116,10 @@ class TxHash extends Component {
} }
render () { render () {
const { hash, isTest, summary } = this.props; const { hash, netVersion, summary } = this.props;
const hashLink = ( const hashLink = (
<a href={ txLink(hash, isTest) } target='_blank'> <a href={ txLink(hash, false, netVersion) } target='_blank'>
<ShortenedHash data={ hash } /> <ShortenedHash data={ hash } />
</a> </a>
); );
@ -255,9 +255,11 @@ class TxHash extends Component {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { isTest } = state.nodeStatus; const { netVersion } = state.nodeStatus;
return { isTest }; return {
netVersion
};
} }
export default connect( export default connect(

View File

@ -69,7 +69,9 @@ function createRedux () {
subscribe: sinon.stub(), subscribe: sinon.stub(),
getState: () => { getState: () => {
return { return {
nodeStatus: { isTest: true } nodeStatus: {
netVersion: '42'
}
}; };
} }
}; };

View File

@ -35,7 +35,7 @@ class TxRow extends Component {
static propTypes = { static propTypes = {
accountAddresses: PropTypes.array.isRequired, accountAddresses: PropTypes.array.isRequired,
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
tx: PropTypes.object.isRequired, tx: PropTypes.object.isRequired,
block: PropTypes.object, block: PropTypes.object,
@ -48,7 +48,7 @@ class TxRow extends Component {
}; };
render () { render () {
const { tx, address, isTest, historic, className } = this.props; const { address, className, historic, netVersion, tx } = this.props;
return ( return (
<tr className={ className || '' }> <tr className={ className || '' }>
@ -60,7 +60,7 @@ class TxRow extends Component {
<div> <div>
<a <a
className={ styles.link } className={ styles.link }
href={ txLink(tx.hash, isTest) } href={ txLink(tx.hash, false, netVersion) }
target='_blank' target='_blank'
> >
{ `${tx.hash.substr(2, 6)}...${tx.hash.slice(-6)}` } { `${tx.hash.substr(2, 6)}...${tx.hash.slice(-6)}` }
@ -156,8 +156,13 @@ function mapStateToProps (initState) {
const { accounts } = initState.personal; const { accounts } = initState.personal;
const accountAddresses = Object.keys(accounts); const accountAddresses = Object.keys(accounts);
return () => { return (state) => {
return { accountAddresses }; const { netVersion } = state.nodeStatus;
return {
accountAddresses,
netVersion
};
}; };
} }
@ -165,4 +170,3 @@ export default connect(
mapStateToProps, mapStateToProps,
null null
)(TxRow); )(TxRow);

View File

@ -30,6 +30,9 @@ const STORE = {
subscribe: sinon.stub(), subscribe: sinon.stub(),
getState: () => { getState: () => {
return { return {
nodeStatus: {
netVersion: '42'
},
personal: { personal: {
accounts: { accounts: {
'0x123': {} '0x123': {}
@ -61,7 +64,7 @@ describe('ui/TxList/TxRow', () => {
value: new BigNumber(1) value: new BigNumber(1)
}; };
expect(render({ address: '0x123', block, isTest: true, tx })).to.be.ok; expect(render({ address: '0x123', block, netVersion: '42', tx })).to.be.ok;
}); });
it('renders an account link', () => { it('renders an account link', () => {
@ -75,7 +78,7 @@ describe('ui/TxList/TxRow', () => {
value: new BigNumber(1) value: new BigNumber(1)
}; };
const element = render({ address: '0x123', block, isTest: true, tx }); const element = render({ address: '0x123', block, netVersion: '42', tx });
expect(element.find('Link').prop('to')).to.equal('/accounts/0x123'); expect(element.find('Link').prop('to')).to.equal('/accounts/0x123');
}); });
@ -91,7 +94,7 @@ describe('ui/TxList/TxRow', () => {
value: new BigNumber(1) value: new BigNumber(1)
}; };
const element = render({ address: '0x123', block, isTest: true, tx }); const element = render({ address: '0x123', block, netVersion: '42', tx });
expect(element.find('Link').prop('to')).to.equal('/addresses/0x456'); expect(element.find('Link').prop('to')).to.equal('/addresses/0x456');
}); });

View File

@ -35,7 +35,7 @@ class TxList extends Component {
PropTypes.array, PropTypes.array,
PropTypes.object PropTypes.object
]).isRequired, ]).isRequired,
isTest: PropTypes.bool.isRequired netVersion: PropTypes.string.isRequired
} }
store = new Store(this.context.api); store = new Store(this.context.api);
@ -63,7 +63,7 @@ class TxList extends Component {
} }
renderRows () { renderRows () {
const { address, isTest } = this.props; const { address, netVersion } = this.props;
return this.store.sortedHashes.map((txhash) => { return this.store.sortedHashes.map((txhash) => {
const tx = this.store.transactions[txhash]; const tx = this.store.transactions[txhash];
@ -76,7 +76,7 @@ class TxList extends Component {
tx={ tx } tx={ tx }
block={ block } block={ block }
address={ address } address={ address }
isTest={ isTest } netVersion={ netVersion }
/> />
); );
}); });
@ -84,10 +84,10 @@ class TxList extends Component {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { isTest } = state.nodeStatus; const { netVersion } = state.nodeStatus;
return { return {
isTest netVersion
}; };
} }

View File

@ -30,7 +30,7 @@ const STORE = {
getState: () => { getState: () => {
return { return {
nodeStatus: { nodeStatus: {
isTest: true netVersion: '42'
} }
}; };
} }

View File

@ -21,8 +21,8 @@ import etherscan from '~/3rdparty/etherscan';
export default class Store { export default class Store {
@observable address = null; @observable address = null;
@observable isLoading = false; @observable isLoading = false;
@observable isTest = undefined;
@observable isTracing = false; @observable isTracing = false;
@observable netVersion = '0';
@observable txHashes = []; @observable txHashes = [];
constructor (api) { constructor (api) {
@ -44,8 +44,8 @@ export default class Store {
this.isLoading = isLoading; this.isLoading = isLoading;
} }
@action setTest = (isTest) => { @action setNetVersion = (netVersion) => {
this.isTest = isTest; this.netVersion = netVersion;
} }
@action setTracing = (isTracing) => { @action setTracing = (isTracing) => {
@ -55,7 +55,7 @@ export default class Store {
@action updateProps = (props) => { @action updateProps = (props) => {
transaction(() => { transaction(() => {
this.setAddress(props.address); this.setAddress(props.address);
this.setTest(props.isTest); this.setNetVersion(props.netVersion);
// TODO: When tracing is enabled again, adjust to actually set // TODO: When tracing is enabled again, adjust to actually set
this.setTracing(false && props.traceMode); this.setTracing(false && props.traceMode);
@ -65,7 +65,7 @@ export default class Store {
} }
getTransactions () { getTransactions () {
if (this.isTest === undefined) { if (this.netVersion === '0') {
return Promise.resolve(); return Promise.resolve();
} }
@ -87,7 +87,7 @@ export default class Store {
} }
fetchEtherscanTransactions () { fetchEtherscanTransactions () {
return etherscan.account.transactions(this.address, 0, this.isTest); return etherscan.account.transactions(this.address, 0, false, this.netVersion);
} }
fetchTraceTransactions () { fetchTraceTransactions () {

View File

@ -43,7 +43,7 @@ function mockQuery () {
sort: 'desc' sort: 'desc'
}, },
reply: [{ hash: '123' }] reply: [{ hash: '123' }]
}], true); }], false, '42');
} }
describe('views/Account/Transactions/store', () => { describe('views/Account/Transactions/store', () => {
@ -94,10 +94,10 @@ describe('views/Account/Transactions/store', () => {
}); });
}); });
describe('setTest', () => { describe('setNetVersion', () => {
it('sets the isTest flag', () => { it('sets the netVersion', () => {
store.setTest(true); store.setNetVersion('testing');
expect(store.isTest).to.be.true; expect(store.netVersion).to.equal('testing');
}); });
}); });
@ -124,7 +124,7 @@ describe('views/Account/Transactions/store', () => {
it('retrieves the hashes via etherscan', () => { it('retrieves the hashes via etherscan', () => {
sinon.spy(store, 'fetchEtherscanTransactions'); sinon.spy(store, 'fetchEtherscanTransactions');
store.setAddress(ADDRESS); store.setAddress(ADDRESS);
store.setTest(true); store.setNetVersion('42');
store.setTracing(false); store.setTracing(false);
return store.getTransactions().then(() => { return store.getTransactions().then(() => {
@ -137,7 +137,7 @@ describe('views/Account/Transactions/store', () => {
it('retrieves the hashes via tracing', () => { it('retrieves the hashes via tracing', () => {
sinon.spy(store, 'fetchTraceTransactions'); sinon.spy(store, 'fetchTraceTransactions');
store.setAddress(ADDRESS); store.setAddress(ADDRESS);
store.setTest(true); store.setNetVersion('42');
store.setTracing(true); store.setTracing(true);
return store.getTransactions().then(() => { return store.getTransactions().then(() => {
@ -151,7 +151,7 @@ describe('views/Account/Transactions/store', () => {
describe('fetchEtherscanTransactions', () => { describe('fetchEtherscanTransactions', () => {
it('retrieves the transactions', () => { it('retrieves the transactions', () => {
store.setAddress(ADDRESS); store.setAddress(ADDRESS);
store.setTest(true); store.setNetVersion('42');
return store.fetchEtherscanTransactions().then((transactions) => { return store.fetchEtherscanTransactions().then((transactions) => {
expect(transactions).to.deep.equal([{ expect(transactions).to.deep.equal([{
@ -169,7 +169,7 @@ describe('views/Account/Transactions/store', () => {
describe('fetchTraceTransactions', () => { describe('fetchTraceTransactions', () => {
it('retrieves the transactions', () => { it('retrieves the transactions', () => {
store.setAddress(ADDRESS); store.setAddress(ADDRESS);
store.setTest(true); store.setNetVersion('42');
return store.fetchTraceTransactions().then((transactions) => { return store.fetchTraceTransactions().then((transactions) => {
expect(transactions).to.deep.equal([ expect(transactions).to.deep.equal([

View File

@ -32,7 +32,7 @@ class Transactions extends Component {
static propTypes = { static propTypes = {
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
isTest: PropTypes.bool, netVersion: PropTypes.string.isRequired,
traceMode: PropTypes.bool traceMode: PropTypes.bool
} }
@ -48,7 +48,7 @@ class Transactions extends Component {
return; return;
} }
const hasChanged = ['isTest', 'address'] const hasChanged = ['address', 'netVersion']
.map(key => newProps[key] !== this.props[key]) .map(key => newProps[key] !== this.props[key])
.reduce((truth, keyTruth) => truth || keyTruth, false); .reduce((truth, keyTruth) => truth || keyTruth, false);
@ -112,10 +112,10 @@ class Transactions extends Component {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { isTest, traceMode } = state.nodeStatus; const { netVersion, traceMode } = state.nodeStatus;
return { return {
isTest, netVersion,
traceMode traceMode
}; };
} }

View File

@ -36,7 +36,7 @@ function createRedux () {
}, },
images: {}, images: {},
nodeStatus: { nodeStatus: {
isTest: false, netVersion: '1',
traceMode: false traceMode: false
}, },
personal: { personal: {

View File

@ -32,8 +32,6 @@ class TabBar extends Component {
}; };
static propTypes = { static propTypes = {
isTest: PropTypes.bool,
netChain: PropTypes.string,
pending: PropTypes.array, pending: PropTypes.array,
views: PropTypes.array.isRequired views: PropTypes.array.isRequired
}; };

View File

@ -46,8 +46,6 @@ class Application extends Component {
static propTypes = { static propTypes = {
blockNumber: PropTypes.object, blockNumber: PropTypes.object,
children: PropTypes.node, children: PropTypes.node,
isTest: PropTypes.bool,
netChain: PropTypes.string,
pending: PropTypes.array pending: PropTypes.array
} }
@ -86,7 +84,7 @@ class Application extends Component {
} }
renderApp () { renderApp () {
const { blockNumber, children, pending, netChain, isTest } = this.props; const { blockNumber, children, pending } = this.props;
return ( return (
<Container <Container
@ -94,11 +92,7 @@ class Application extends Component {
onCloseFirstRun={ this.store.closeFirstrun } onCloseFirstRun={ this.store.closeFirstrun }
showFirstRun={ this.store.firstrunVisible } showFirstRun={ this.store.firstrunVisible }
> >
<TabBar <TabBar pending={ pending } />
netChain={ netChain }
isTest={ isTest }
pending={ pending }
/>
<div className={ styles.content }> <div className={ styles.content }>
{ children } { children }
</div> </div>
@ -125,15 +119,13 @@ class Application extends Component {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { blockNumber, netChain, isTest } = state.nodeStatus; const { blockNumber } = state.nodeStatus;
const { hasAccounts } = state.personal; const { hasAccounts } = state.personal;
const { pending } = state.signer; const { pending } = state.signer;
return { return {
blockNumber, blockNumber,
hasAccounts, hasAccounts,
isTest,
netChain,
pending pending
}; };
} }

View File

@ -32,7 +32,7 @@ export default class Event extends Component {
static propTypes = { static propTypes = {
event: PropTypes.object.isRequired, event: PropTypes.object.isRequired,
isTest: PropTypes.bool netVersion: PropTypes.string.isRequired
} }
state = { state = {
@ -44,11 +44,11 @@ export default class Event extends Component {
} }
render () { render () {
const { event, isTest } = this.props; const { event, netVersion } = this.props;
const { block, transaction } = this.state; const { block, transaction } = this.state;
const classes = `${styles.event} ${styles[event.state]}`; const classes = `${styles.event} ${styles[event.state]}`;
const url = txLink(event.transactionHash, isTest); const url = txLink(event.transactionHash, false, netVersion);
const keys = Object.keys(event.params).join(', '); const keys = Object.keys(event.params).join(', ');
const values = Object.keys(event.params).map((name, index) => { const values = Object.keys(event.params).map((name, index) => {
const param = event.params[name]; const param = event.params[name];

View File

@ -36,9 +36,9 @@ export default class Events extends Component {
}; };
static propTypes = { static propTypes = {
isTest: PropTypes.bool.isRequired,
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
events: PropTypes.array events: PropTypes.array,
netVersion: PropTypes.string.isRequired
}; };
static defaultProps = { static defaultProps = {
@ -47,7 +47,7 @@ export default class Events extends Component {
}; };
render () { render () {
const { events, isTest, isLoading } = this.props; const { events, isLoading, netVersion } = this.props;
if (isLoading) { if (isLoading) {
return ( return (
@ -80,7 +80,7 @@ export default class Events extends Component {
<Event <Event
key={ event.key } key={ event.key }
event={ event } event={ event }
isTest={ isTest } netVersion={ netVersion }
/> />
); );
}); });
@ -96,7 +96,9 @@ export default class Events extends Component {
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody>{ list }</tbody> <tbody>
{ list }
</tbody>
</table> </table>
</Container> </Container>
); );

View File

@ -47,7 +47,7 @@ class Contract extends Component {
accountsInfo: PropTypes.object, accountsInfo: PropTypes.object,
balances: PropTypes.object, balances: PropTypes.object,
contracts: PropTypes.object, contracts: PropTypes.object,
isTest: PropTypes.bool, netVersion: PropTypes.string.isRequired,
params: PropTypes.object params: PropTypes.object
}; };
@ -115,7 +115,7 @@ class Contract extends Component {
} }
render () { render () {
const { accountsInfo, balances, contracts, params, isTest } = this.props; const { accountsInfo, balances, contracts, netVersion, params } = this.props;
const { allEvents, contract, queryValues, loadingEvents } = this.state; const { allEvents, contract, queryValues, loadingEvents } = this.state;
const account = contracts[params.address]; const account = contracts[params.address];
const balance = balances[params.address]; const balance = balances[params.address];
@ -144,9 +144,9 @@ class Contract extends Component {
values={ queryValues } values={ queryValues }
/> />
<Events <Events
isTest={ isTest }
isLoading={ loadingEvents } isLoading={ loadingEvents }
events={ allEvents } events={ allEvents }
netVersion={ netVersion }
/> />
{ this.renderDetails(account) } { this.renderDetails(account) }
</Page> </Page>
@ -518,14 +518,14 @@ class Contract extends Component {
function mapStateToProps (state) { function mapStateToProps (state) {
const { accounts, accountsInfo, contracts } = state.personal; const { accounts, accountsInfo, contracts } = state.personal;
const { balances } = state.balances; const { balances } = state.balances;
const { isTest } = state.nodeStatus; const { netVersion } = state.nodeStatus;
return { return {
isTest,
accounts, accounts,
accountsInfo, accountsInfo,
balances,
contracts, contracts,
balances netVersion
}; };
} }

View File

@ -26,8 +26,7 @@ class AccountLink extends Component {
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
className: PropTypes.string, className: PropTypes.string,
children: PropTypes.node, children: PropTypes.node,
externalLink: PropTypes.string.isRequired, externalLink: PropTypes.string.isRequired
isTest: PropTypes.bool.isRequired
} }
state = { state = {
@ -35,15 +34,15 @@ class AccountLink extends Component {
}; };
componentWillMount () { componentWillMount () {
const { address, externalLink, isTest } = this.props; const { address, externalLink } = this.props;
this.updateLink(address, externalLink, isTest); this.updateLink(address, externalLink);
} }
componentWillReceiveProps (nextProps) { componentWillReceiveProps (nextProps) {
const { address, externalLink, isTest } = nextProps; const { address, externalLink } = nextProps;
this.updateLink(address, externalLink, isTest); this.updateLink(address, externalLink);
} }
render () { render () {
@ -71,7 +70,7 @@ class AccountLink extends Component {
); );
} }
updateLink (address, externalLink, isTest) { updateLink (address, externalLink) {
const { accountAddresses } = this.props; const { accountAddresses } = this.props;
const isAccount = accountAddresses.includes(address); const isAccount = accountAddresses.includes(address);

View File

@ -27,7 +27,7 @@ export default class Account extends Component {
className: PropTypes.string, className: PropTypes.string,
disabled: PropTypes.bool, disabled: PropTypes.bool,
externalLink: PropTypes.string.isRequired, externalLink: PropTypes.string.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
balance: PropTypes.object // eth BigNumber, not required since it mght take time to fetch balance: PropTypes.object // eth BigNumber, not required since it mght take time to fetch
}; };
@ -53,14 +53,14 @@ export default class Account extends Component {
} }
render () { render () {
const { address, disabled, externalLink, isTest, className } = this.props; const { address, className, disabled, externalLink, netVersion } = this.props;
return ( return (
<div className={ `${styles.acc} ${className}` }> <div className={ `${styles.acc} ${className}` }>
<AccountLink <AccountLink
address={ address } address={ address }
externalLink={ externalLink } externalLink={ externalLink }
isTest={ isTest } netVersion={ netVersion }
> >
<IdentityIcon <IdentityIcon
center center
@ -83,7 +83,7 @@ export default class Account extends Component {
} }
renderName () { renderName () {
const { address, externalLink, isTest } = this.props; const { address, externalLink, netVersion } = this.props;
const name = <IdentityName address={ address } empty />; const name = <IdentityName address={ address } empty />;
if (!name) { if (!name) {
@ -91,7 +91,7 @@ export default class Account extends Component {
<AccountLink <AccountLink
address={ address } address={ address }
externalLink={ externalLink } externalLink={ externalLink }
isTest={ isTest } netVersion={ netVersion }
> >
[{ this.shortAddress(address) }] [{ this.shortAddress(address) }]
</AccountLink> </AccountLink>
@ -102,7 +102,7 @@ export default class Account extends Component {
<AccountLink <AccountLink
address={ address } address={ address }
externalLink={ externalLink } externalLink={ externalLink }
isTest={ isTest } netVersion={ netVersion }
> >
<span> <span>
<span className={ styles.name }>{ name }</span> <span className={ styles.name }>{ name }</span>

View File

@ -27,7 +27,7 @@ export default class RequestPending extends Component {
gasLimit: PropTypes.object.isRequired, gasLimit: PropTypes.object.isRequired,
id: PropTypes.object.isRequired, id: PropTypes.object.isRequired,
isSending: PropTypes.bool.isRequired, isSending: PropTypes.bool.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
onConfirm: PropTypes.func.isRequired, onConfirm: PropTypes.func.isRequired,
onReject: PropTypes.func.isRequired, onReject: PropTypes.func.isRequired,
origin: PropTypes.object.isRequired, origin: PropTypes.object.isRequired,
@ -45,7 +45,7 @@ export default class RequestPending extends Component {
}; };
render () { render () {
const { className, date, focus, gasLimit, id, isSending, isTest, onReject, payload, signerstore, origin } = this.props; const { className, date, focus, gasLimit, id, isSending, netVersion, onReject, payload, signerstore, origin } = this.props;
if (payload.sign) { if (payload.sign) {
const { sign } = payload; const { sign } = payload;
@ -59,7 +59,7 @@ export default class RequestPending extends Component {
id={ id } id={ id }
isFinished={ false } isFinished={ false }
isSending={ isSending } isSending={ isSending }
isTest={ isTest } netVersion={ netVersion }
onConfirm={ this.onConfirm } onConfirm={ this.onConfirm }
onReject={ onReject } onReject={ onReject }
origin={ origin } origin={ origin }
@ -79,7 +79,7 @@ export default class RequestPending extends Component {
gasLimit={ gasLimit } gasLimit={ gasLimit }
id={ id } id={ id }
isSending={ isSending } isSending={ isSending }
isTest={ isTest } netVersion={ netVersion }
onConfirm={ this.onConfirm } onConfirm={ this.onConfirm }
onReject={ onReject } onReject={ onReject }
origin={ origin } origin={ origin }

View File

@ -54,8 +54,8 @@ function render (payload) {
date={ new Date() } date={ new Date() }
gasLimit={ new BigNumber(100000) } gasLimit={ new BigNumber(100000) }
id={ new BigNumber(123) } id={ new BigNumber(123) }
isTest={ false }
isSending={ false } isSending={ false }
netVersion='42'
onConfirm={ onConfirm } onConfirm={ onConfirm }
onReject={ onReject } onReject={ onReject }
origin={ {} } origin={ {} }

View File

@ -46,7 +46,7 @@ export default class SignRequest extends Component {
data: PropTypes.string.isRequired, data: PropTypes.string.isRequired,
id: PropTypes.object.isRequired, id: PropTypes.object.isRequired,
isFinished: PropTypes.bool.isRequired, isFinished: PropTypes.bool.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
signerstore: PropTypes.object.isRequired, signerstore: PropTypes.object.isRequired,
className: PropTypes.string, className: PropTypes.string,
@ -106,7 +106,7 @@ export default class SignRequest extends Component {
renderDetails () { renderDetails () {
const { api } = this.context; const { api } = this.context;
const { address, isTest, signerstore, data, origin } = this.props; const { address, data, netVersion, origin, signerstore } = this.props;
const { balances, externalLink } = signerstore; const { balances, externalLink } = signerstore;
const balance = balances[address]; const balance = balances[address];
@ -122,7 +122,7 @@ export default class SignRequest extends Component {
address={ address } address={ address }
balance={ balance } balance={ balance }
externalLink={ externalLink } externalLink={ externalLink }
isTest={ isTest } netVersion={ netVersion }
/> />
<RequestOrigin origin={ origin } /> <RequestOrigin origin={ origin } />
</div> </div>

View File

@ -36,7 +36,7 @@ export default class TransactionMainDetails extends Component {
fromBalance: PropTypes.object, fromBalance: PropTypes.object,
gasStore: PropTypes.object, gasStore: PropTypes.object,
id: PropTypes.object.isRequired, id: PropTypes.object.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
origin: PropTypes.any, origin: PropTypes.any,
totalValue: PropTypes.object.isRequired, totalValue: PropTypes.object.isRequired,
transaction: PropTypes.object.isRequired, transaction: PropTypes.object.isRequired,
@ -63,7 +63,7 @@ export default class TransactionMainDetails extends Component {
} }
render () { render () {
const { children, disabled, externalLink, from, fromBalance, gasStore, isTest, transaction, origin } = this.props; const { children, disabled, externalLink, from, fromBalance, gasStore, netVersion, transaction, origin } = this.props;
return ( return (
<div className={ styles.transaction }> <div className={ styles.transaction }>
@ -74,7 +74,7 @@ export default class TransactionMainDetails extends Component {
balance={ fromBalance } balance={ fromBalance }
disabled={ disabled } disabled={ disabled }
externalLink={ externalLink } externalLink={ externalLink }
isTest={ isTest } netVersion={ netVersion }
/> />
</div> </div>
<RequestOrigin origin={ origin } /> <RequestOrigin origin={ origin } />

View File

@ -43,7 +43,7 @@ class TransactionPending extends Component {
gasLimit: PropTypes.object, gasLimit: PropTypes.object,
id: PropTypes.object.isRequired, id: PropTypes.object.isRequired,
isSending: PropTypes.bool.isRequired, isSending: PropTypes.bool.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
nonce: PropTypes.number, nonce: PropTypes.number,
onConfirm: PropTypes.func.isRequired, onConfirm: PropTypes.func.isRequired,
onReject: PropTypes.func.isRequired, onReject: PropTypes.func.isRequired,
@ -98,7 +98,7 @@ class TransactionPending extends Component {
} }
renderTransaction () { renderTransaction () {
const { accounts, className, focus, id, isSending, isTest, signerstore, transaction, origin } = this.props; const { accounts, className, focus, id, isSending, netVersion, origin, signerstore, transaction } = this.props;
const { totalValue } = this.state; const { totalValue } = this.state;
const { balances, externalLink } = signerstore; const { balances, externalLink } = signerstore;
const { from, value } = transaction; const { from, value } = transaction;
@ -116,7 +116,7 @@ class TransactionPending extends Component {
fromBalance={ fromBalance } fromBalance={ fromBalance }
gasStore={ this.gasStore } gasStore={ this.gasStore }
id={ id } id={ id }
isTest={ isTest } netVersion={ netVersion }
origin={ origin } origin={ origin }
totalValue={ totalValue } totalValue={ totalValue }
transaction={ transaction } transaction={ transaction }

View File

@ -22,17 +22,17 @@ export default class TxHashLink extends Component {
static propTypes = { static propTypes = {
children: PropTypes.node, children: PropTypes.node,
className: PropTypes.string, className: PropTypes.string,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
txHash: PropTypes.string.isRequired txHash: PropTypes.string.isRequired
} }
render () { render () {
const { children, className, isTest, txHash } = this.props; const { children, className, netVersion, txHash } = this.props;
return ( return (
<a <a
className={ className } className={ className }
href={ txLink(txHash, isTest) } href={ txLink(txHash, false, netVersion) }
target='_blank' target='_blank'
> >
{ children || txHash } { children || txHash }

View File

@ -39,7 +39,7 @@ class Embedded extends Component {
}).isRequired, }).isRequired,
externalLink: PropTypes.string, externalLink: PropTypes.string,
gasLimit: PropTypes.object.isRequired, gasLimit: PropTypes.object.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
signer: PropTypes.shape({ signer: PropTypes.shape({
finished: PropTypes.array.isRequired, finished: PropTypes.array.isRequired,
pending: PropTypes.array.isRequired pending: PropTypes.array.isRequired
@ -80,7 +80,7 @@ class Embedded extends Component {
} }
renderPending = (data, index) => { renderPending = (data, index) => {
const { actions, gasLimit, isTest } = this.props; const { actions, gasLimit, netVersion } = this.props;
const { date, id, isSending, payload, origin } = data; const { date, id, isSending, payload, origin } = data;
return ( return (
@ -91,7 +91,7 @@ class Embedded extends Component {
gasLimit={ gasLimit } gasLimit={ gasLimit }
id={ id } id={ id }
isSending={ isSending } isSending={ isSending }
isTest={ isTest } netVersion={ netVersion }
key={ id } key={ id }
onConfirm={ actions.startConfirmRequest } onConfirm={ actions.startConfirmRequest }
onReject={ actions.startRejectRequest } onReject={ actions.startRejectRequest }
@ -108,13 +108,13 @@ class Embedded extends Component {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { gasLimit, isTest } = state.nodeStatus; const { gasLimit, netVersion } = state.nodeStatus;
const { actions, signer } = state; const { actions, signer } = state;
return { return {
actions, actions,
gasLimit, gasLimit,
isTest, netVersion,
signer signer
}; };
} }

View File

@ -40,7 +40,7 @@ class RequestsPage extends Component {
startRejectRequest: PropTypes.func.isRequired startRejectRequest: PropTypes.func.isRequired
}).isRequired, }).isRequired,
gasLimit: PropTypes.object.isRequired, gasLimit: PropTypes.object.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
signer: PropTypes.shape({ signer: PropTypes.shape({
pending: PropTypes.array.isRequired, pending: PropTypes.array.isRequired,
finished: PropTypes.array.isRequired finished: PropTypes.array.isRequired
@ -106,7 +106,7 @@ class RequestsPage extends Component {
} }
renderPending = (data, index) => { renderPending = (data, index) => {
const { actions, gasLimit, isTest } = this.props; const { actions, gasLimit, netVersion } = this.props;
const { date, id, isSending, payload, origin } = data; const { date, id, isSending, payload, origin } = data;
return ( return (
@ -117,7 +117,7 @@ class RequestsPage extends Component {
gasLimit={ gasLimit } gasLimit={ gasLimit }
id={ id } id={ id }
isSending={ isSending } isSending={ isSending }
isTest={ isTest } netVersion={ netVersion }
key={ id } key={ id }
onConfirm={ actions.startConfirmRequest } onConfirm={ actions.startConfirmRequest }
onReject={ actions.startRejectRequest } onReject={ actions.startRejectRequest }
@ -130,13 +130,13 @@ class RequestsPage extends Component {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { gasLimit, isTest } = state.nodeStatus; const { gasLimit, netVersion } = state.nodeStatus;
const { actions, signer } = state; const { actions, signer } = state;
return { return {
actions, actions,
gasLimit, gasLimit,
isTest, netVersion,
signer signer
}; };
} }

View File

@ -37,7 +37,7 @@ class WalletConfirmations extends Component {
static propTypes = { static propTypes = {
accounts: PropTypes.object.isRequired, accounts: PropTypes.object.isRequired,
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
owners: PropTypes.array.isRequired, owners: PropTypes.array.isRequired,
require: PropTypes.object.isRequired, require: PropTypes.object.isRequired,
confirmOperation: PropTypes.func.isRequired, confirmOperation: PropTypes.func.isRequired,
@ -115,7 +115,7 @@ class WalletConfirmation extends Component {
accounts: PropTypes.object.isRequired, accounts: PropTypes.object.isRequired,
confirmation: PropTypes.object.isRequired, confirmation: PropTypes.object.isRequired,
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
owners: PropTypes.array.isRequired, owners: PropTypes.array.isRequired,
require: PropTypes.object.isRequired, require: PropTypes.object.isRequired,
confirmOperation: PropTypes.func.isRequired, confirmOperation: PropTypes.func.isRequired,
@ -353,7 +353,7 @@ class WalletConfirmation extends Component {
} }
renderTransactionRow (confirmation, className) { renderTransactionRow (confirmation, className) {
const { address, isTest } = this.props; const { address, netVersion } = this.props;
const { operation, transactionHash, blockNumber, value, to, data } = confirmation; const { operation, transactionHash, blockNumber, value, to, data } = confirmation;
if (value && to && data) { if (value && to && data) {
@ -362,7 +362,7 @@ class WalletConfirmation extends Component {
address={ address } address={ address }
className={ className } className={ className }
historic={ false } historic={ false }
isTest={ isTest } netVersion={ netVersion }
key={ operation } key={ operation }
tx={ { tx={ {
hash: transactionHash, hash: transactionHash,

View File

@ -26,7 +26,7 @@ import txListStyles from '~/ui/TxList/txList.css';
export default class WalletTransactions extends Component { export default class WalletTransactions extends Component {
static propTypes = { static propTypes = {
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
transactions: PropTypes.array transactions: PropTypes.array
}; };
@ -51,7 +51,7 @@ export default class WalletTransactions extends Component {
); );
} }
renderTransactions () { renderTransactions () {
const { address, isTest, transactions } = this.props; const { address, netVersion, transactions } = this.props;
if (!transactions) { if (!transactions) {
return null; return null;
@ -76,7 +76,7 @@ export default class WalletTransactions extends Component {
return ( return (
<TxRow <TxRow
address={ address } address={ address }
isTest={ isTest } netVersion={ netVersion }
key={ `${transactionHash}_${index}` } key={ `${transactionHash}_${index}` }
tx={ { tx={ {
blockNumber, blockNumber,

View File

@ -37,13 +37,13 @@ import styles from './wallet.css';
class WalletContainer extends Component { class WalletContainer extends Component {
static propTypes = { static propTypes = {
isTest: PropTypes.any netVersion: PropTypes.string.isRequired
}; };
render () { render () {
const { isTest, ...others } = this.props; const { netVersion, ...others } = this.props;
if (isTest !== false && isTest !== true) { if (netVersion === '0') {
return ( return (
<Loading size={ 4 } /> <Loading size={ 4 } />
); );
@ -51,7 +51,7 @@ class WalletContainer extends Component {
return ( return (
<Wallet <Wallet
isTest={ isTest } netVersion={ netVersion }
{ ...others } { ...others }
/> />
); );
@ -66,7 +66,7 @@ class Wallet extends Component {
static propTypes = { static propTypes = {
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
balance: nullableProptype(PropTypes.object.isRequired), balance: nullableProptype(PropTypes.object.isRequired),
isTest: PropTypes.bool.isRequired, netVersion: PropTypes.string.isRequired,
owned: PropTypes.bool.isRequired, owned: PropTypes.bool.isRequired,
setVisibleAccounts: PropTypes.func.isRequired, setVisibleAccounts: PropTypes.func.isRequired,
wallet: PropTypes.object.isRequired, wallet: PropTypes.object.isRequired,
@ -181,7 +181,7 @@ class Wallet extends Component {
} }
renderDetails () { renderDetails () {
const { address, isTest, wallet } = this.props; const { address, netVersion, wallet } = this.props;
const { owners, require, confirmations, transactions } = wallet; const { owners, require, confirmations, transactions } = wallet;
if (!owners || !require) { if (!owners || !require) {
@ -196,7 +196,7 @@ class Wallet extends Component {
<WalletConfirmations <WalletConfirmations
address={ address } address={ address }
confirmations={ confirmations } confirmations={ confirmations }
isTest={ isTest } netVersion={ netVersion }
key='confirmations' key='confirmations'
owners={ owners } owners={ owners }
require={ require } require={ require }
@ -204,7 +204,7 @@ class Wallet extends Component {
<WalletTransactions <WalletTransactions
address={ address } address={ address }
isTest={ isTest } netVersion={ netVersion }
key='transactions' key='transactions'
transactions={ transactions } transactions={ transactions }
/> />
@ -389,7 +389,7 @@ function mapStateToProps (_, initProps) {
const { address } = initProps.params; const { address } = initProps.params;
return (state) => { return (state) => {
const { isTest } = state.nodeStatus; const { netVersion } = state.nodeStatus;
const { accountsInfo = {}, accounts = {} } = state.personal; const { accountsInfo = {}, accounts = {} } = state.personal;
const { balances } = state.balances; const { balances } = state.balances;
const walletAccount = accounts[address] || accountsInfo[address] || null; const walletAccount = accounts[address] || accountsInfo[address] || null;
@ -405,7 +405,7 @@ function mapStateToProps (_, initProps) {
return { return {
address, address,
balance, balance,
isTest, netVersion,
owned, owned,
wallet, wallet,
walletAccount walletAccount