* Etherscan links (#4772) * Port tests * update address links * Signer accountlink isTest
This commit is contained in:
committed by
Arkadiy Paronyan
parent
02be8d869c
commit
260bcfd368
@@ -21,8 +21,8 @@ import etherscan from '~/3rdparty/etherscan';
|
||||
export default class Store {
|
||||
@observable address = null;
|
||||
@observable isLoading = false;
|
||||
@observable isTest = undefined;
|
||||
@observable isTracing = false;
|
||||
@observable netVersion = '0';
|
||||
@observable txHashes = [];
|
||||
|
||||
constructor (api) {
|
||||
@@ -44,8 +44,8 @@ export default class Store {
|
||||
this.isLoading = isLoading;
|
||||
}
|
||||
|
||||
@action setTest = (isTest) => {
|
||||
this.isTest = isTest;
|
||||
@action setNetVersion = (netVersion) => {
|
||||
this.netVersion = netVersion;
|
||||
}
|
||||
|
||||
@action setTracing = (isTracing) => {
|
||||
@@ -55,7 +55,7 @@ export default class Store {
|
||||
@action updateProps = (props) => {
|
||||
transaction(() => {
|
||||
this.setAddress(props.address);
|
||||
this.setTest(props.isTest);
|
||||
this.setNetVersion(props.netVersion);
|
||||
|
||||
// TODO: When tracing is enabled again, adjust to actually set
|
||||
this.setTracing(false && props.traceMode);
|
||||
@@ -65,7 +65,7 @@ export default class Store {
|
||||
}
|
||||
|
||||
getTransactions () {
|
||||
if (this.isTest === undefined) {
|
||||
if (this.netVersion === '0') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export default class Store {
|
||||
}
|
||||
|
||||
fetchEtherscanTransactions () {
|
||||
return etherscan.account.transactions(this.address, 0, this.isTest);
|
||||
return etherscan.account.transactions(this.address, 0, false, this.netVersion);
|
||||
}
|
||||
|
||||
fetchTraceTransactions () {
|
||||
|
||||
@@ -43,7 +43,7 @@ function mockQuery () {
|
||||
sort: 'desc'
|
||||
},
|
||||
reply: [{ hash: '123' }]
|
||||
}], true);
|
||||
}], false, '42');
|
||||
}
|
||||
|
||||
describe('views/Account/Transactions/store', () => {
|
||||
@@ -94,10 +94,10 @@ describe('views/Account/Transactions/store', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('setTest', () => {
|
||||
it('sets the isTest flag', () => {
|
||||
store.setTest(true);
|
||||
expect(store.isTest).to.be.true;
|
||||
describe('setNetVersion', () => {
|
||||
it('sets the netVersion', () => {
|
||||
store.setNetVersion('testing');
|
||||
expect(store.netVersion).to.equal('testing');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -124,7 +124,7 @@ describe('views/Account/Transactions/store', () => {
|
||||
it('retrieves the hashes via etherscan', () => {
|
||||
sinon.spy(store, 'fetchEtherscanTransactions');
|
||||
store.setAddress(ADDRESS);
|
||||
store.setTest(true);
|
||||
store.setNetVersion('42');
|
||||
store.setTracing(false);
|
||||
|
||||
return store.getTransactions().then(() => {
|
||||
@@ -137,7 +137,7 @@ describe('views/Account/Transactions/store', () => {
|
||||
it('retrieves the hashes via tracing', () => {
|
||||
sinon.spy(store, 'fetchTraceTransactions');
|
||||
store.setAddress(ADDRESS);
|
||||
store.setTest(true);
|
||||
store.setNetVersion('42');
|
||||
store.setTracing(true);
|
||||
|
||||
return store.getTransactions().then(() => {
|
||||
@@ -151,7 +151,7 @@ describe('views/Account/Transactions/store', () => {
|
||||
describe('fetchEtherscanTransactions', () => {
|
||||
it('retrieves the transactions', () => {
|
||||
store.setAddress(ADDRESS);
|
||||
store.setTest(true);
|
||||
store.setNetVersion('42');
|
||||
|
||||
return store.fetchEtherscanTransactions().then((transactions) => {
|
||||
expect(transactions).to.deep.equal([{
|
||||
@@ -169,7 +169,7 @@ describe('views/Account/Transactions/store', () => {
|
||||
describe('fetchTraceTransactions', () => {
|
||||
it('retrieves the transactions', () => {
|
||||
store.setAddress(ADDRESS);
|
||||
store.setTest(true);
|
||||
store.setNetVersion('42');
|
||||
|
||||
return store.fetchTraceTransactions().then((transactions) => {
|
||||
expect(transactions).to.deep.equal([
|
||||
|
||||
@@ -32,7 +32,7 @@ class Transactions extends Component {
|
||||
|
||||
static propTypes = {
|
||||
address: PropTypes.string.isRequired,
|
||||
isTest: PropTypes.bool,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
traceMode: PropTypes.bool
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class Transactions extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
const hasChanged = ['isTest', 'address']
|
||||
const hasChanged = ['address', 'netVersion']
|
||||
.map(key => newProps[key] !== this.props[key])
|
||||
.reduce((truth, keyTruth) => truth || keyTruth, false);
|
||||
|
||||
@@ -109,10 +109,10 @@ class Transactions extends Component {
|
||||
}
|
||||
|
||||
function mapStateToProps (state) {
|
||||
const { isTest, traceMode } = state.nodeStatus;
|
||||
const { netVersion, traceMode } = state.nodeStatus;
|
||||
|
||||
return {
|
||||
isTest,
|
||||
netVersion,
|
||||
traceMode
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ function createRedux () {
|
||||
},
|
||||
images: {},
|
||||
nodeStatus: {
|
||||
isTest: false,
|
||||
netVersion: '1',
|
||||
traceMode: false
|
||||
},
|
||||
personal: {
|
||||
|
||||
@@ -84,8 +84,6 @@ class TabBar extends Component {
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
isTest: PropTypes.bool,
|
||||
netChain: PropTypes.string,
|
||||
pending: PropTypes.array,
|
||||
views: PropTypes.array.isRequired
|
||||
};
|
||||
|
||||
@@ -46,8 +46,6 @@ class Application extends Component {
|
||||
static propTypes = {
|
||||
blockNumber: PropTypes.object,
|
||||
children: PropTypes.node,
|
||||
isTest: PropTypes.bool,
|
||||
netChain: PropTypes.string,
|
||||
pending: PropTypes.array
|
||||
}
|
||||
|
||||
@@ -86,17 +84,14 @@ class Application extends Component {
|
||||
}
|
||||
|
||||
renderApp () {
|
||||
const { blockNumber, children, pending, netChain, isTest } = this.props;
|
||||
const { blockNumber, children, pending } = this.props;
|
||||
|
||||
return (
|
||||
<Container
|
||||
upgradeStore={ this.upgradeStore }
|
||||
onCloseFirstRun={ this.store.closeFirstrun }
|
||||
showFirstRun={ this.store.firstrunVisible }>
|
||||
<TabBar
|
||||
netChain={ netChain }
|
||||
isTest={ isTest }
|
||||
pending={ pending } />
|
||||
<TabBar pending={ pending } />
|
||||
<div className={ styles.content }>
|
||||
{ children }
|
||||
</div>
|
||||
@@ -123,15 +118,13 @@ class Application extends Component {
|
||||
}
|
||||
|
||||
function mapStateToProps (state) {
|
||||
const { blockNumber, netChain, isTest } = state.nodeStatus;
|
||||
const { blockNumber } = state.nodeStatus;
|
||||
const { hasAccounts } = state.personal;
|
||||
const { pending } = state.signer;
|
||||
|
||||
return {
|
||||
blockNumber,
|
||||
hasAccounts,
|
||||
isTest,
|
||||
netChain,
|
||||
pending
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export default class Event extends Component {
|
||||
|
||||
static propTypes = {
|
||||
event: PropTypes.object.isRequired,
|
||||
isTest: PropTypes.bool
|
||||
netVersion: PropTypes.string.isRequired
|
||||
}
|
||||
|
||||
state = {
|
||||
@@ -43,11 +43,11 @@ export default class Event extends Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
const { event, isTest } = this.props;
|
||||
const { event, netVersion } = this.props;
|
||||
const { block, transaction } = this.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 values = Object.keys(event.params).map((name, index) => {
|
||||
const param = event.params[name];
|
||||
|
||||
@@ -28,9 +28,9 @@ export default class Events extends Component {
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
isLoading: PropTypes.bool,
|
||||
events: PropTypes.array
|
||||
events: PropTypes.array,
|
||||
netVersion: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@@ -39,7 +39,7 @@ export default class Events extends Component {
|
||||
};
|
||||
|
||||
render () {
|
||||
const { events, isTest, isLoading } = this.props;
|
||||
const { events, isLoading, netVersion } = this.props;
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -67,7 +67,8 @@ export default class Events extends Component {
|
||||
<Event
|
||||
key={ event.key }
|
||||
event={ event }
|
||||
isTest={ isTest } />
|
||||
netVersion={ netVersion }
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -82,7 +83,9 @@ export default class Events extends Component {
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{ list }</tbody>
|
||||
<tbody>
|
||||
{ list }
|
||||
</tbody>
|
||||
</table>
|
||||
</Container>
|
||||
);
|
||||
|
||||
@@ -52,7 +52,7 @@ class Contract extends Component {
|
||||
accountsInfo: PropTypes.object,
|
||||
balances: PropTypes.object,
|
||||
contracts: PropTypes.object,
|
||||
isTest: PropTypes.bool,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
params: PropTypes.object
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ class Contract extends Component {
|
||||
}
|
||||
|
||||
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 account = contracts[params.address];
|
||||
const balance = balances[params.address];
|
||||
@@ -148,9 +148,9 @@ class Contract extends Component {
|
||||
values={ queryValues }
|
||||
/>
|
||||
<Events
|
||||
isTest={ isTest }
|
||||
isLoading={ loadingEvents }
|
||||
events={ allEvents }
|
||||
netVersion={ netVersion }
|
||||
/>
|
||||
{ this.renderDetails(account) }
|
||||
</Page>
|
||||
@@ -484,14 +484,14 @@ class Contract extends Component {
|
||||
function mapStateToProps (state) {
|
||||
const { accounts, accountsInfo, contracts } = state.personal;
|
||||
const { balances } = state.balances;
|
||||
const { isTest } = state.nodeStatus;
|
||||
const { netVersion } = state.nodeStatus;
|
||||
|
||||
return {
|
||||
isTest,
|
||||
accounts,
|
||||
accountsInfo,
|
||||
balances,
|
||||
contracts,
|
||||
balances
|
||||
netVersion
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import styles from './accountLink.css';
|
||||
|
||||
export default class AccountLink extends Component {
|
||||
static propTypes = {
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
address: PropTypes.string.isRequired,
|
||||
className: PropTypes.string,
|
||||
children: PropTypes.node
|
||||
@@ -32,15 +32,15 @@ export default class AccountLink extends Component {
|
||||
};
|
||||
|
||||
componentWillMount () {
|
||||
const { address, isTest } = this.props;
|
||||
const { address, netVersion } = this.props;
|
||||
|
||||
this.updateLink(address, isTest);
|
||||
this.updateLink(address, netVersion);
|
||||
}
|
||||
|
||||
componentWillReceiveProps (nextProps) {
|
||||
const { address, isTest } = nextProps;
|
||||
const { address, netVersion } = nextProps;
|
||||
|
||||
this.updateLink(address, isTest);
|
||||
this.updateLink(address, netVersion);
|
||||
}
|
||||
|
||||
render () {
|
||||
@@ -56,8 +56,8 @@ export default class AccountLink extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
updateLink (address, isTest) {
|
||||
const link = addressLink(address, isTest);
|
||||
updateLink (address, netVersion) {
|
||||
const link = addressLink(address, false, netVersion);
|
||||
|
||||
this.setState({
|
||||
link
|
||||
|
||||
@@ -25,7 +25,7 @@ export default class Account extends Component {
|
||||
static propTypes = {
|
||||
className: PropTypes.string,
|
||||
address: 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
|
||||
};
|
||||
|
||||
@@ -51,13 +51,14 @@ export default class Account extends Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
const { address, isTest, className } = this.props;
|
||||
const { address, netVersion, className } = this.props;
|
||||
|
||||
return (
|
||||
<div className={ `${styles.acc} ${className}` }>
|
||||
<AccountLink
|
||||
address={ address }
|
||||
isTest={ isTest }>
|
||||
netVersion={ netVersion }
|
||||
>
|
||||
<IdentityIcon
|
||||
center
|
||||
address={ address } />
|
||||
@@ -76,14 +77,15 @@ export default class Account extends Component {
|
||||
}
|
||||
|
||||
renderName () {
|
||||
const { address, isTest } = this.props;
|
||||
const { address, netVersion } = this.props;
|
||||
const name = <IdentityName address={ address } empty />;
|
||||
|
||||
if (!name) {
|
||||
return (
|
||||
<AccountLink
|
||||
address={ address }
|
||||
isTest={ isTest }>
|
||||
netVersion={ netVersion }
|
||||
>
|
||||
[{ this.shortAddress(address) }]
|
||||
</AccountLink>
|
||||
);
|
||||
@@ -92,7 +94,8 @@ export default class Account extends Component {
|
||||
return (
|
||||
<AccountLink
|
||||
address={ address }
|
||||
isTest={ isTest } >
|
||||
netVersion={ netVersion }
|
||||
>
|
||||
<span>
|
||||
<span className={ styles.name }>{ name }</span>
|
||||
<span className={ styles.address }>[{ this.tinyAddress(address) }]</span>
|
||||
|
||||
@@ -27,7 +27,7 @@ export default class RequestPending extends Component {
|
||||
gasLimit: PropTypes.object.isRequired,
|
||||
id: PropTypes.object.isRequired,
|
||||
isSending: PropTypes.bool.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
onConfirm: PropTypes.func.isRequired,
|
||||
onReject: PropTypes.func.isRequired,
|
||||
payload: PropTypes.oneOfType([
|
||||
@@ -51,7 +51,7 @@ export default class RequestPending extends Component {
|
||||
};
|
||||
|
||||
render () {
|
||||
const { className, date, focus, gasLimit, id, isSending, isTest, onReject, payload, store } = this.props;
|
||||
const { className, date, focus, gasLimit, id, isSending, netVersion, onReject, payload, store } = this.props;
|
||||
|
||||
if (payload.sign) {
|
||||
const { sign } = payload;
|
||||
@@ -65,7 +65,7 @@ export default class RequestPending extends Component {
|
||||
id={ id }
|
||||
isFinished={ false }
|
||||
isSending={ isSending }
|
||||
isTest={ isTest }
|
||||
netVersion={ netVersion }
|
||||
onConfirm={ this.onConfirm }
|
||||
onReject={ onReject }
|
||||
store={ store } />
|
||||
@@ -82,7 +82,7 @@ export default class RequestPending extends Component {
|
||||
gasLimit={ gasLimit }
|
||||
id={ id }
|
||||
isSending={ isSending }
|
||||
isTest={ isTest }
|
||||
netVersion={ netVersion }
|
||||
onConfirm={ this.onConfirm }
|
||||
onReject={ onReject }
|
||||
store={ store }
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import RequestPending from './';
|
||||
|
||||
const ADDRESS = '0x1234567890123456789012345678901234567890';
|
||||
const TRANSACTION = {
|
||||
from: ADDRESS,
|
||||
gas: new BigNumber(21000),
|
||||
gasPrice: new BigNumber(20000000),
|
||||
value: new BigNumber(1)
|
||||
};
|
||||
const PAYLOAD_SENDTX = {
|
||||
sendTransaction: TRANSACTION
|
||||
};
|
||||
const PAYLOAD_SIGN = {
|
||||
sign: {
|
||||
address: ADDRESS,
|
||||
data: 'testing'
|
||||
}
|
||||
};
|
||||
const PAYLOAD_SIGNTX = {
|
||||
signTransaction: TRANSACTION
|
||||
};
|
||||
|
||||
let component;
|
||||
let onConfirm;
|
||||
let onReject;
|
||||
|
||||
function render (payload) {
|
||||
onConfirm = sinon.stub();
|
||||
onReject = sinon.stub();
|
||||
|
||||
component = shallow(
|
||||
<RequestPending
|
||||
date={ new Date() }
|
||||
gasLimit={ new BigNumber(100000) }
|
||||
id={ new BigNumber(123) }
|
||||
isSending={ false }
|
||||
netVersion='42'
|
||||
onConfirm={ onConfirm }
|
||||
onReject={ onReject }
|
||||
origin={ {} }
|
||||
payload={ payload }
|
||||
store={ {} }
|
||||
/>
|
||||
);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
describe('views/Signer/RequestPending', () => {
|
||||
describe('sendTransaction', () => {
|
||||
beforeEach(() => {
|
||||
render(PAYLOAD_SENDTX);
|
||||
});
|
||||
|
||||
it('renders defaults', () => {
|
||||
expect(component).to.be.ok;
|
||||
});
|
||||
|
||||
it('renders TransactionPending component', () => {
|
||||
expect(component.find('TransactionPending')).to.have.length(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('sign', () => {
|
||||
beforeEach(() => {
|
||||
render(PAYLOAD_SIGN);
|
||||
});
|
||||
|
||||
it('renders defaults', () => {
|
||||
expect(component).to.be.ok;
|
||||
});
|
||||
|
||||
it('renders SignRequest component', () => {
|
||||
expect(component.find('SignRequest')).to.have.length(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('signTransaction', () => {
|
||||
beforeEach(() => {
|
||||
render(PAYLOAD_SIGNTX);
|
||||
});
|
||||
|
||||
it('renders defaults', () => {
|
||||
expect(component).to.be.ok;
|
||||
});
|
||||
|
||||
it('renders TransactionPending component', () => {
|
||||
expect(component.find('TransactionPending')).to.have.length(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -44,8 +44,8 @@ export default class SignRequest extends Component {
|
||||
address: PropTypes.string.isRequired,
|
||||
data: PropTypes.string.isRequired,
|
||||
isFinished: PropTypes.bool.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
store: PropTypes.object.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
|
||||
className: PropTypes.string,
|
||||
focus: PropTypes.bool,
|
||||
@@ -92,7 +92,7 @@ export default class SignRequest extends Component {
|
||||
|
||||
renderDetails () {
|
||||
const { api } = this.context;
|
||||
const { address, isTest, store, data } = this.props;
|
||||
const { address, netVersion, store, data } = this.props;
|
||||
const balance = store.balances[address];
|
||||
|
||||
if (!balance) {
|
||||
@@ -105,7 +105,8 @@ export default class SignRequest extends Component {
|
||||
<Account
|
||||
address={ address }
|
||||
balance={ balance }
|
||||
isTest={ isTest } />
|
||||
netVersion={ netVersion }
|
||||
/>
|
||||
</div>
|
||||
<div className={ styles.info } title={ api.util.sha3(data) }>
|
||||
<p>A request to sign data using your account:</p>
|
||||
|
||||
@@ -31,7 +31,7 @@ export default class TransactionMainDetails extends Component {
|
||||
fromBalance: PropTypes.object,
|
||||
gasStore: PropTypes.object,
|
||||
id: PropTypes.object.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
totalValue: PropTypes.object.isRequired,
|
||||
transaction: PropTypes.object.isRequired,
|
||||
value: PropTypes.object.isRequired
|
||||
@@ -50,7 +50,7 @@ export default class TransactionMainDetails extends Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
const { children, from, fromBalance, gasStore, isTest, transaction } = this.props;
|
||||
const { children, from, fromBalance, gasStore, netVersion, transaction } = this.props;
|
||||
|
||||
return (
|
||||
<div className={ styles.transaction }>
|
||||
@@ -59,7 +59,7 @@ export default class TransactionMainDetails extends Component {
|
||||
<Account
|
||||
address={ from }
|
||||
balance={ fromBalance }
|
||||
isTest={ isTest }
|
||||
netVersion={ netVersion }
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,7 @@ export default class TransactionPending extends Component {
|
||||
gasLimit: PropTypes.object,
|
||||
id: PropTypes.object.isRequired,
|
||||
isSending: PropTypes.bool.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
nonce: PropTypes.number,
|
||||
onConfirm: PropTypes.func.isRequired,
|
||||
onReject: PropTypes.func.isRequired,
|
||||
@@ -87,7 +87,7 @@ export default class TransactionPending extends Component {
|
||||
}
|
||||
|
||||
renderTransaction () {
|
||||
const { className, focus, id, isSending, isTest, store, transaction } = this.props;
|
||||
const { className, focus, id, isSending, netVersion, store, transaction } = this.props;
|
||||
const { totalValue } = this.state;
|
||||
const { from, value } = transaction;
|
||||
|
||||
@@ -101,7 +101,7 @@ export default class TransactionPending extends Component {
|
||||
fromBalance={ fromBalance }
|
||||
gasStore={ this.gasStore }
|
||||
id={ id }
|
||||
isTest={ isTest }
|
||||
netVersion={ netVersion }
|
||||
totalValue={ totalValue }
|
||||
transaction={ transaction }
|
||||
value={ value } />
|
||||
|
||||
@@ -22,18 +22,19 @@ export default class TxHashLink extends Component {
|
||||
static propTypes = {
|
||||
children: PropTypes.node,
|
||||
className: PropTypes.string,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
txHash: PropTypes.string.isRequired
|
||||
}
|
||||
|
||||
render () {
|
||||
const { children, className, isTest, txHash } = this.props;
|
||||
const { children, className, netVersion, txHash } = this.props;
|
||||
|
||||
return (
|
||||
<a
|
||||
className={ className }
|
||||
href={ txLink(txHash, isTest) }
|
||||
target='_blank'>
|
||||
href={ txLink(txHash, false, netVersion) }
|
||||
target='_blank'
|
||||
>
|
||||
{ children || txHash }
|
||||
</a>
|
||||
);
|
||||
|
||||
@@ -38,7 +38,7 @@ class Embedded extends Component {
|
||||
startRejectRequest: PropTypes.func.isRequired
|
||||
}).isRequired,
|
||||
gasLimit: PropTypes.object.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
signer: PropTypes.shape({
|
||||
finished: PropTypes.array.isRequired,
|
||||
pending: PropTypes.array.isRequired
|
||||
@@ -79,7 +79,7 @@ class Embedded extends Component {
|
||||
}
|
||||
|
||||
renderPending = (data, index) => {
|
||||
const { actions, gasLimit, isTest } = this.props;
|
||||
const { actions, gasLimit, netVersion } = this.props;
|
||||
const { date, id, isSending, payload } = data;
|
||||
|
||||
return (
|
||||
@@ -90,7 +90,7 @@ class Embedded extends Component {
|
||||
gasLimit={ gasLimit }
|
||||
id={ id }
|
||||
isSending={ isSending }
|
||||
isTest={ isTest }
|
||||
netVersion={ netVersion }
|
||||
key={ id }
|
||||
onConfirm={ actions.startConfirmRequest }
|
||||
onReject={ actions.startRejectRequest }
|
||||
@@ -106,13 +106,13 @@ class Embedded extends Component {
|
||||
}
|
||||
|
||||
function mapStateToProps (state) {
|
||||
const { gasLimit, isTest } = state.nodeStatus;
|
||||
const { gasLimit, netVersion } = state.nodeStatus;
|
||||
const { actions, signer } = state;
|
||||
|
||||
return {
|
||||
actions,
|
||||
gasLimit,
|
||||
isTest,
|
||||
netVersion,
|
||||
signer
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class RequestsPage extends Component {
|
||||
startRejectRequest: PropTypes.func.isRequired
|
||||
}).isRequired,
|
||||
gasLimit: PropTypes.object.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
signer: PropTypes.shape({
|
||||
pending: PropTypes.array.isRequired,
|
||||
finished: PropTypes.array.isRequired
|
||||
@@ -105,7 +105,7 @@ class RequestsPage extends Component {
|
||||
}
|
||||
|
||||
renderPending = (data, index) => {
|
||||
const { actions, gasLimit, isTest } = this.props;
|
||||
const { actions, gasLimit, netVersion } = this.props;
|
||||
const { date, id, isSending, payload } = data;
|
||||
|
||||
return (
|
||||
@@ -116,7 +116,7 @@ class RequestsPage extends Component {
|
||||
gasLimit={ gasLimit }
|
||||
id={ id }
|
||||
isSending={ isSending }
|
||||
isTest={ isTest }
|
||||
netVersion={ netVersion }
|
||||
key={ id }
|
||||
onConfirm={ actions.startConfirmRequest }
|
||||
onReject={ actions.startRejectRequest }
|
||||
@@ -128,13 +128,13 @@ class RequestsPage extends Component {
|
||||
}
|
||||
|
||||
function mapStateToProps (state) {
|
||||
const { gasLimit, isTest } = state.nodeStatus;
|
||||
const { gasLimit, netVersion } = state.nodeStatus;
|
||||
const { actions, signer } = state;
|
||||
|
||||
return {
|
||||
actions,
|
||||
gasLimit,
|
||||
isTest,
|
||||
netVersion,
|
||||
signer
|
||||
};
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class WalletConfirmations extends Component {
|
||||
static propTypes = {
|
||||
accounts: PropTypes.object.isRequired,
|
||||
address: PropTypes.string.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
owners: PropTypes.array.isRequired,
|
||||
require: PropTypes.object.isRequired,
|
||||
confirmOperation: PropTypes.func.isRequired,
|
||||
@@ -109,7 +109,7 @@ class WalletConfirmation extends Component {
|
||||
accounts: PropTypes.object.isRequired,
|
||||
confirmation: PropTypes.object.isRequired,
|
||||
address: PropTypes.string.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
owners: PropTypes.array.isRequired,
|
||||
require: PropTypes.object.isRequired,
|
||||
confirmOperation: PropTypes.func.isRequired,
|
||||
@@ -320,13 +320,14 @@ class WalletConfirmation extends Component {
|
||||
}
|
||||
|
||||
renderTransactionRow (confirmation, className) {
|
||||
const { address, isTest } = this.props;
|
||||
const { address, netVersion } = this.props;
|
||||
const { operation, transactionHash, blockNumber, value, to, data } = confirmation;
|
||||
|
||||
if (value && to && data) {
|
||||
return (
|
||||
<TxRow
|
||||
className={ className }
|
||||
netVersion={ netVersion }
|
||||
key={ operation }
|
||||
tx={ {
|
||||
hash: transactionHash,
|
||||
@@ -337,7 +338,6 @@ class WalletConfirmation extends Component {
|
||||
input: bytesToHex(data)
|
||||
} }
|
||||
address={ address }
|
||||
isTest={ isTest }
|
||||
historic={ false }
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@ import txListStyles from '~/ui/TxList/txList.css';
|
||||
export default class WalletTransactions extends Component {
|
||||
static propTypes = {
|
||||
address: PropTypes.string.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
transactions: PropTypes.array
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ export default class WalletTransactions extends Component {
|
||||
);
|
||||
}
|
||||
renderTransactions () {
|
||||
const { address, isTest, transactions } = this.props;
|
||||
const { address, netVersion, transactions } = this.props;
|
||||
|
||||
if (!transactions) {
|
||||
return null;
|
||||
@@ -62,6 +62,7 @@ export default class WalletTransactions extends Component {
|
||||
|
||||
return (
|
||||
<TxRow
|
||||
netVersion={ netVersion }
|
||||
key={ `${transactionHash}_${index}` }
|
||||
tx={ {
|
||||
hash: transactionHash,
|
||||
@@ -69,7 +70,6 @@ export default class WalletTransactions extends Component {
|
||||
blockNumber, from, to, value
|
||||
} }
|
||||
address={ address }
|
||||
isTest={ isTest }
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -40,20 +40,23 @@ import styles from './wallet.css';
|
||||
|
||||
class WalletContainer extends Component {
|
||||
static propTypes = {
|
||||
isTest: PropTypes.any
|
||||
netVersion: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
render () {
|
||||
const { isTest, ...others } = this.props;
|
||||
const { netVersion, ...others } = this.props;
|
||||
|
||||
if (isTest !== false && isTest !== true) {
|
||||
if (netVersion === '0') {
|
||||
return (
|
||||
<Loading size={ 4 } />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Wallet isTest={ isTest } { ...others } />
|
||||
<Wallet
|
||||
netVersion={ netVersion }
|
||||
{ ...others }
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -67,7 +70,7 @@ class Wallet extends Component {
|
||||
address: PropTypes.string.isRequired,
|
||||
balance: nullableProptype(PropTypes.object.isRequired),
|
||||
images: PropTypes.object.isRequired,
|
||||
isTest: PropTypes.bool.isRequired,
|
||||
netVersion: PropTypes.string.isRequired,
|
||||
owned: PropTypes.bool.isRequired,
|
||||
setVisibleAccounts: PropTypes.func.isRequired,
|
||||
wallet: PropTypes.object.isRequired,
|
||||
@@ -177,7 +180,7 @@ class Wallet extends Component {
|
||||
}
|
||||
|
||||
renderDetails () {
|
||||
const { address, isTest, wallet } = this.props;
|
||||
const { address, netVersion, wallet } = this.props;
|
||||
const { owners, require, confirmations, transactions } = wallet;
|
||||
|
||||
if (!owners || !require) {
|
||||
@@ -190,19 +193,19 @@ class Wallet extends Component {
|
||||
|
||||
return [
|
||||
<WalletConfirmations
|
||||
netVersion={ netVersion }
|
||||
key='confirmations'
|
||||
owners={ owners }
|
||||
require={ require }
|
||||
confirmations={ confirmations }
|
||||
isTest={ isTest }
|
||||
address={ address }
|
||||
/>,
|
||||
|
||||
<WalletTransactions
|
||||
address={ address }
|
||||
netVersion={ netVersion }
|
||||
key='transactions'
|
||||
transactions={ transactions }
|
||||
address={ address }
|
||||
isTest={ isTest }
|
||||
/>
|
||||
];
|
||||
}
|
||||
@@ -354,7 +357,7 @@ function mapStateToProps (_, initProps) {
|
||||
const { address } = initProps.params;
|
||||
|
||||
return (state) => {
|
||||
const { isTest } = state.nodeStatus;
|
||||
const { netVersion } = state.nodeStatus;
|
||||
const { accountsInfo = {}, accounts = {} } = state.personal;
|
||||
const { balances } = state.balances;
|
||||
const { images } = state;
|
||||
@@ -372,7 +375,7 @@ function mapStateToProps (_, initProps) {
|
||||
address,
|
||||
balance,
|
||||
images,
|
||||
isTest,
|
||||
netVersion,
|
||||
owned,
|
||||
wallet,
|
||||
walletAccount
|
||||
|
||||
Reference in New Issue
Block a user