Merge pull request #3524 from ethcore/jg-signer-api-queries
Don't query chain in Signer, use Redux isTest
This commit is contained in:
commit
47f5a6d005
@ -105,7 +105,7 @@ export function attachInstances () {
|
|||||||
])
|
])
|
||||||
.then(([registryAddress, netChain]) => {
|
.then(([registryAddress, netChain]) => {
|
||||||
const registry = api.newContract(abis.registry, registryAddress).instance;
|
const registry = api.newContract(abis.registry, registryAddress).instance;
|
||||||
isTest = netChain === 'morden' || netChain === 'testnet';
|
isTest = ['morden', 'ropsten', 'testnet'].includes(netChain);
|
||||||
|
|
||||||
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}, isTest=${isTest}`);
|
||||||
|
@ -251,7 +251,7 @@ export default class Status {
|
|||||||
.then(([
|
.then(([
|
||||||
clientVersion, defaultExtraData, netChain, netPort, rpcSettings, enode
|
clientVersion, defaultExtraData, netChain, netPort, rpcSettings, enode
|
||||||
]) => {
|
]) => {
|
||||||
const isTest = netChain === 'morden' || netChain === 'testnet';
|
const isTest = netChain === 'morden' || netChain === 'ropsten' || netChain === 'testnet';
|
||||||
|
|
||||||
const longStatus = {
|
const longStatus = {
|
||||||
clientVersion,
|
clientVersion,
|
||||||
|
@ -31,7 +31,7 @@ const initialState = {
|
|||||||
gasLimit: new BigNumber(0),
|
gasLimit: new BigNumber(0),
|
||||||
hashrate: new BigNumber(0),
|
hashrate: new BigNumber(0),
|
||||||
minGasPrice: new BigNumber(0),
|
minGasPrice: new BigNumber(0),
|
||||||
netChain: 'morden',
|
netChain: 'ropsten',
|
||||||
netPeers: {
|
netPeers: {
|
||||||
active: new BigNumber(0),
|
active: new BigNumber(0),
|
||||||
connected: new BigNumber(0),
|
connected: new BigNumber(0),
|
||||||
|
@ -25,7 +25,7 @@ export default class Account extends Component {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
address: PropTypes.string.isRequired,
|
address: PropTypes.string.isRequired,
|
||||||
chain: PropTypes.string.isRequired,
|
isTest: PropTypes.bool.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
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -51,11 +51,13 @@ export default class Account extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { address, chain, className } = this.props;
|
const { address, isTest, className } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ `${styles.acc} ${className}` }>
|
<div className={ `${styles.acc} ${className}` }>
|
||||||
<AccountLink address={ address } chain={ chain }>
|
<AccountLink
|
||||||
|
address={ address }
|
||||||
|
isTest={ isTest }>
|
||||||
<IdentityIcon
|
<IdentityIcon
|
||||||
center
|
center
|
||||||
address={ address } />
|
address={ address } />
|
||||||
@ -74,19 +76,23 @@ export default class Account extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderName () {
|
renderName () {
|
||||||
const { address } = this.props;
|
const { address, isTest } = this.props;
|
||||||
const name = <IdentityName address={ address } empty />;
|
const name = <IdentityName address={ address } empty />;
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return (
|
return (
|
||||||
<AccountLink address={ address } chain={ this.props.chain }>
|
<AccountLink
|
||||||
|
address={ address }
|
||||||
|
isTest={ isTest }>
|
||||||
[{ this.shortAddress(address) }]
|
[{ this.shortAddress(address) }]
|
||||||
</AccountLink>
|
</AccountLink>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AccountLink address={ address } chain={ this.props.chain } >
|
<AccountLink
|
||||||
|
address={ address }
|
||||||
|
isTest={ isTest } >
|
||||||
<span>
|
<span>
|
||||||
<span className={ styles.name }>{ name }</span>
|
<span className={ styles.name }>{ name }</span>
|
||||||
<span className={ styles.address }>[{ this.tinyAddress(address) }]</span>
|
<span className={ styles.address }>[{ this.tinyAddress(address) }]</span>
|
||||||
|
@ -21,7 +21,7 @@ import styles from './AccountLink.css';
|
|||||||
|
|
||||||
export default class AccountLink extends Component {
|
export default class AccountLink extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
chain: PropTypes.string.isRequired,
|
isTest: PropTypes.bool.isRequired,
|
||||||
address: PropTypes.string.isRequired,
|
address: PropTypes.string.isRequired,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
children: PropTypes.node
|
children: PropTypes.node
|
||||||
@ -32,15 +32,15 @@ export default class AccountLink extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
const { address, chain } = this.props;
|
const { address, isTest } = this.props;
|
||||||
|
|
||||||
this.updateLink(address, chain);
|
this.updateLink(address, isTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
const { address, chain } = nextProps;
|
const { address, isTest } = nextProps;
|
||||||
|
|
||||||
this.updateLink(address, chain);
|
this.updateLink(address, isTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
@ -56,8 +56,8 @@ export default class AccountLink extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLink (address, chain) {
|
updateLink (address, isTest) {
|
||||||
const link = addressLink(address, chain === 'morden' || chain === 'testnet');
|
const link = addressLink(address, isTest);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
link
|
link
|
||||||
|
@ -31,14 +31,16 @@ export default class RequestFinishedWeb3 extends Component {
|
|||||||
msg: PropTypes.string,
|
msg: PropTypes.string,
|
||||||
status: PropTypes.string,
|
status: PropTypes.string,
|
||||||
error: PropTypes.string,
|
error: PropTypes.string,
|
||||||
className: PropTypes.string
|
className: PropTypes.string,
|
||||||
|
isTest: PropTypes.bool.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { payload, id, result, msg, status, error, date, className } = this.props;
|
const { payload, id, result, msg, status, error, date, className, isTest } = this.props;
|
||||||
|
|
||||||
if (payload.sign) {
|
if (payload.sign) {
|
||||||
const { sign } = payload;
|
const { sign } = payload;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SignRequest
|
<SignRequest
|
||||||
className={ className }
|
className={ className }
|
||||||
@ -49,12 +51,14 @@ export default class RequestFinishedWeb3 extends Component {
|
|||||||
msg={ msg }
|
msg={ msg }
|
||||||
status={ status }
|
status={ status }
|
||||||
error={ error }
|
error={ error }
|
||||||
|
isTest={ isTest }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.transaction) {
|
if (payload.transaction) {
|
||||||
const { transaction } = payload;
|
const { transaction } = payload;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TransactionFinished
|
<TransactionFinished
|
||||||
className={ className }
|
className={ className }
|
||||||
@ -69,6 +73,7 @@ export default class RequestFinishedWeb3 extends Component {
|
|||||||
date={ date }
|
date={ date }
|
||||||
status={ status }
|
status={ status }
|
||||||
error={ error }
|
error={ error }
|
||||||
|
isTest={ isTest }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ export default class RequestPendingWeb3 extends Component {
|
|||||||
PropTypes.shape({ transaction: PropTypes.object.isRequired }),
|
PropTypes.shape({ transaction: PropTypes.object.isRequired }),
|
||||||
PropTypes.shape({ sign: PropTypes.object.isRequired })
|
PropTypes.shape({ sign: PropTypes.object.isRequired })
|
||||||
]).isRequired,
|
]).isRequired,
|
||||||
className: PropTypes.string
|
className: PropTypes.string,
|
||||||
|
isTest: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
onConfirm = data => {
|
onConfirm = data => {
|
||||||
@ -41,10 +42,11 @@ export default class RequestPendingWeb3 extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { payload, id, className, isSending, date, onReject } = this.props;
|
const { payload, id, className, isSending, date, onReject, isTest } = this.props;
|
||||||
|
|
||||||
if (payload.sign) {
|
if (payload.sign) {
|
||||||
const { sign } = payload;
|
const { sign } = payload;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SignRequest
|
<SignRequest
|
||||||
className={ className }
|
className={ className }
|
||||||
@ -55,12 +57,14 @@ export default class RequestPendingWeb3 extends Component {
|
|||||||
id={ id }
|
id={ id }
|
||||||
address={ sign.address }
|
address={ sign.address }
|
||||||
hash={ sign.hash }
|
hash={ sign.hash }
|
||||||
|
isTest={ isTest }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.transaction) {
|
if (payload.transaction) {
|
||||||
const { transaction } = payload;
|
const { transaction } = payload;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TransactionPending
|
<TransactionPending
|
||||||
className={ className }
|
className={ className }
|
||||||
@ -75,6 +79,7 @@ export default class RequestPendingWeb3 extends Component {
|
|||||||
to={ transaction.to }
|
to={ transaction.to }
|
||||||
value={ transaction.value }
|
value={ transaction.value }
|
||||||
date={ date }
|
date={ date }
|
||||||
|
isTest={ isTest }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -39,24 +39,15 @@ export default class SignRequest extends Component {
|
|||||||
onReject: PropTypes.func,
|
onReject: PropTypes.func,
|
||||||
status: PropTypes.string,
|
status: PropTypes.string,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
chain: nullable(PropTypes.object),
|
isTest: PropTypes.bool.isRequired,
|
||||||
balance: nullable(PropTypes.object)
|
balance: nullable(PropTypes.object)
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
chain: null,
|
|
||||||
balance: null
|
balance: null
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
this.context.api.parity.netChain()
|
|
||||||
.then((chain) => {
|
|
||||||
this.setState({ chain });
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error('could not fetch chain', err);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.context.api.eth.getBalance(this.props.address)
|
this.context.api.eth.getBalance(this.props.address)
|
||||||
.then((balance) => {
|
.then((balance) => {
|
||||||
this.setState({ balance });
|
this.setState({ balance });
|
||||||
@ -68,6 +59,7 @@ export default class SignRequest extends Component {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { className } = this.props;
|
const { className } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ `${styles.container} ${className || ''}` }>
|
<div className={ `${styles.container} ${className || ''}` }>
|
||||||
{ this.renderDetails() }
|
{ this.renderDetails() }
|
||||||
@ -77,15 +69,20 @@ export default class SignRequest extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderDetails () {
|
renderDetails () {
|
||||||
const { address, hash } = this.props;
|
const { address, hash, isTest } = this.props;
|
||||||
const { balance, chain } = this.state;
|
const { balance } = this.state;
|
||||||
|
|
||||||
if (!balance || !chain) return (<div />);
|
if (!balance) {
|
||||||
|
return <div />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.signDetails }>
|
<div className={ styles.signDetails }>
|
||||||
<div className={ styles.address }>
|
<div className={ styles.address }>
|
||||||
<Account address={ address } balance={ balance } chain={ chain } />
|
<Account
|
||||||
|
address={ address }
|
||||||
|
balance={ balance }
|
||||||
|
isTest={ isTest } />
|
||||||
</div>
|
</div>
|
||||||
<div className={ styles.info } title={ hash }>
|
<div className={ styles.info } title={ hash }>
|
||||||
<p>Dapp is requesting to sign arbitrary transaction using this account.</p>
|
<p>Dapp is requesting to sign arbitrary transaction using this account.</p>
|
||||||
@ -100,15 +97,17 @@ export default class SignRequest extends Component {
|
|||||||
|
|
||||||
if (isFinished) {
|
if (isFinished) {
|
||||||
if (status === 'confirmed') {
|
if (status === 'confirmed') {
|
||||||
const { hash } = this.props;
|
const { hash, isTest } = this.props;
|
||||||
const { chain } = this.state;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.actions }>
|
<div className={ styles.actions }>
|
||||||
<span className={ styles.isConfirmed }>Confirmed</span>
|
<span className={ styles.isConfirmed }>Confirmed</span>
|
||||||
<div>
|
<div>
|
||||||
Transaction hash:
|
Transaction hash:
|
||||||
<TxHashLink chain={ chain } txHash={ hash } className={ styles.txHash } />
|
<TxHashLink
|
||||||
|
isTest={ isTest }
|
||||||
|
txHash={ hash }
|
||||||
|
className={ styles.txHash } />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -47,13 +47,12 @@ export default class TransactionFinished extends Component {
|
|||||||
txHash: PropTypes.string, // undefined if transacation is rejected
|
txHash: PropTypes.string, // undefined if transacation is rejected
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
data: PropTypes.string,
|
data: PropTypes.string,
|
||||||
chain: nullable(PropTypes.object),
|
isTest: PropTypes.bool.isRequired,
|
||||||
fromBalance: nullable(PropTypes.object),
|
fromBalance: nullable(PropTypes.object),
|
||||||
toBalance: nullable(PropTypes.object)
|
toBalance: nullable(PropTypes.object)
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
chain: null,
|
|
||||||
fromBalance: null,
|
fromBalance: null,
|
||||||
toBalance: null
|
toBalance: null
|
||||||
};
|
};
|
||||||
@ -64,14 +63,6 @@ export default class TransactionFinished extends Component {
|
|||||||
const totalValue = tUtil.getTotalValue(fee, value);
|
const totalValue = tUtil.getTotalValue(fee, value);
|
||||||
this.setState({ totalValue });
|
this.setState({ totalValue });
|
||||||
|
|
||||||
this.context.api.parity.netChain()
|
|
||||||
.then((chain) => {
|
|
||||||
this.setState({ chain });
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error('could not fetch chain', err);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.fetchBalance(from, 'fromBalance');
|
this.fetchBalance(from, 'fromBalance');
|
||||||
if (to) {
|
if (to) {
|
||||||
this.fetchBalance(to, 'toBalance');
|
this.fetchBalance(to, 'toBalance');
|
||||||
@ -79,8 +70,9 @@ export default class TransactionFinished extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { chain, fromBalance, toBalance } = this.state;
|
const { fromBalance, toBalance } = this.state;
|
||||||
if (!chain || !fromBalance || !toBalance) {
|
|
||||||
|
if (!fromBalance || !toBalance) {
|
||||||
return (
|
return (
|
||||||
<div className={ `${styles.container} ${className}` }>
|
<div className={ `${styles.container} ${className}` }>
|
||||||
<CircularProgress size={ 60 } />
|
<CircularProgress size={ 60 } />
|
||||||
@ -130,16 +122,19 @@ export default class TransactionFinished extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderTxHash () {
|
renderTxHash () {
|
||||||
const { txHash } = this.props;
|
const { txHash, isTest } = this.props;
|
||||||
const { chain } = this.state;
|
|
||||||
if (!txHash || !chain) {
|
if (!txHash) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
Transaction hash:
|
Transaction hash:
|
||||||
<TxHashLink chain={ chain } txHash={ txHash } className={ styles.txHash } />
|
<TxHashLink
|
||||||
|
isTest={ isTest }
|
||||||
|
txHash={ txHash }
|
||||||
|
className={ styles.txHash } />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ export default class TransactionMainDetails extends Component {
|
|||||||
fromBalance: PropTypes.object, // eth BigNumber, not required since it might take time to fetch
|
fromBalance: PropTypes.object, // eth BigNumber, not required since it might take time to fetch
|
||||||
value: PropTypes.object.isRequired, // wei hex
|
value: PropTypes.object.isRequired, // wei hex
|
||||||
totalValue: PropTypes.object.isRequired, // wei BigNumber
|
totalValue: PropTypes.object.isRequired, // wei BigNumber
|
||||||
chain: PropTypes.string.isRequired,
|
isTest: PropTypes.bool.isRequired,
|
||||||
to: PropTypes.string, // undefined if it's a contract
|
to: PropTypes.string, // undefined if it's a contract
|
||||||
toBalance: PropTypes.object, // eth BigNumber - undefined if it's a contract or until it's fetched
|
toBalance: PropTypes.object, // eth BigNumber - undefined if it's a contract or until it's fetched
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
@ -39,11 +39,13 @@ export default class TransactionMainDetails extends Component {
|
|||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
const { value, totalValue } = this.props;
|
const { value, totalValue } = this.props;
|
||||||
|
|
||||||
this.updateDisplayValues(value, totalValue);
|
this.updateDisplayValues(value, totalValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
const { value, totalValue } = nextProps;
|
const { value, totalValue } = nextProps;
|
||||||
|
|
||||||
this.updateDisplayValues(value, totalValue);
|
this.updateDisplayValues(value, totalValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +61,7 @@ export default class TransactionMainDetails extends Component {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { className, children } = this.props;
|
const { className, children } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ className }>
|
<div className={ className }>
|
||||||
{ this.renderTransfer() }
|
{ this.renderTransfer() }
|
||||||
@ -69,7 +72,8 @@ export default class TransactionMainDetails extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderTransfer () {
|
renderTransfer () {
|
||||||
const { from, fromBalance, to, toBalance, chain } = this.props;
|
const { from, fromBalance, to, toBalance, isTest } = this.props;
|
||||||
|
|
||||||
if (!to) {
|
if (!to) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -78,7 +82,10 @@ export default class TransactionMainDetails extends Component {
|
|||||||
<div className={ styles.transaction }>
|
<div className={ styles.transaction }>
|
||||||
<div className={ styles.from }>
|
<div className={ styles.from }>
|
||||||
<div className={ styles.account }>
|
<div className={ styles.account }>
|
||||||
<Account address={ from } balance={ fromBalance } chain={ chain } />
|
<Account
|
||||||
|
address={ from }
|
||||||
|
balance={ fromBalance }
|
||||||
|
isTest={ isTest } />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={ styles.tx }>
|
<div className={ styles.tx }>
|
||||||
@ -88,7 +95,10 @@ export default class TransactionMainDetails extends Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className={ styles.to }>
|
<div className={ styles.to }>
|
||||||
<div className={ styles.account }>
|
<div className={ styles.account }>
|
||||||
<Account address={ to } balance={ toBalance } chain={ chain } />
|
<Account
|
||||||
|
address={ to }
|
||||||
|
balance={ toBalance }
|
||||||
|
isTest={ isTest } />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -96,15 +106,20 @@ export default class TransactionMainDetails extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderContract () {
|
renderContract () {
|
||||||
const { from, fromBalance, to, chain } = this.props;
|
const { from, fromBalance, to, isTest } = this.props;
|
||||||
|
|
||||||
if (to) {
|
if (to) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.transaction }>
|
<div className={ styles.transaction }>
|
||||||
<div className={ styles.from }>
|
<div className={ styles.from }>
|
||||||
<div className={ styles.account }>
|
<div className={ styles.account }>
|
||||||
<Account address={ from } balance={ fromBalance } chain={ chain } />
|
<Account
|
||||||
|
address={ from }
|
||||||
|
balance={ fromBalance }
|
||||||
|
isTest={ isTest } />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={ styles.tx }>
|
<div className={ styles.tx }>
|
||||||
@ -126,6 +141,7 @@ export default class TransactionMainDetails extends Component {
|
|||||||
renderValue () {
|
renderValue () {
|
||||||
const { id } = this.props;
|
const { id } = this.props;
|
||||||
const { valueDisplay, valueDisplayWei } = this.state;
|
const { valueDisplay, valueDisplayWei } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
@ -147,6 +163,7 @@ export default class TransactionMainDetails extends Component {
|
|||||||
renderTotalValue () {
|
renderTotalValue () {
|
||||||
const { id } = this.props;
|
const { id } = this.props;
|
||||||
const { totalValueDisplay, totalValueDisplayWei, feeEth } = this.state;
|
const { totalValueDisplay, totalValueDisplayWei, feeEth } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
@ -164,5 +181,4 @@ export default class TransactionMainDetails extends Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
|
||||||
import CircularProgress from 'material-ui/CircularProgress';
|
|
||||||
import TransactionMainDetails from '../TransactionMainDetails';
|
import TransactionMainDetails from '../TransactionMainDetails';
|
||||||
import TransactionPendingForm from '../TransactionPendingForm';
|
import TransactionPendingForm from '../TransactionPendingForm';
|
||||||
import TransactionSecondaryDetails from '../TransactionSecondaryDetails';
|
import TransactionSecondaryDetails from '../TransactionSecondaryDetails';
|
||||||
@ -43,7 +42,8 @@ export default class TransactionPending extends Component {
|
|||||||
onConfirm: PropTypes.func.isRequired,
|
onConfirm: PropTypes.func.isRequired,
|
||||||
onReject: PropTypes.func.isRequired,
|
onReject: PropTypes.func.isRequired,
|
||||||
isSending: PropTypes.bool.isRequired,
|
isSending: PropTypes.bool.isRequired,
|
||||||
className: PropTypes.string
|
className: PropTypes.string,
|
||||||
|
isTest: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
@ -51,7 +51,6 @@ export default class TransactionPending extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
chain: null,
|
|
||||||
fromBalance: null,
|
fromBalance: null,
|
||||||
toBalance: null
|
toBalance: null
|
||||||
};
|
};
|
||||||
@ -64,28 +63,12 @@ export default class TransactionPending extends Component {
|
|||||||
const gasToDisplay = tUtil.getGasDisplay(gas);
|
const gasToDisplay = tUtil.getGasDisplay(gas);
|
||||||
this.setState({ gasPriceEthmDisplay, totalValue, gasToDisplay });
|
this.setState({ gasPriceEthmDisplay, totalValue, gasToDisplay });
|
||||||
|
|
||||||
this.context.api.parity.netChain()
|
|
||||||
.then((chain) => {
|
|
||||||
this.setState({ chain });
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error('could not fetch chain', err);
|
|
||||||
});
|
|
||||||
|
|
||||||
const { from, to } = this.props;
|
const { from, to } = this.props;
|
||||||
this.fetchBalance(from, 'fromBalance');
|
this.fetchBalance(from, 'fromBalance');
|
||||||
if (to) this.fetchBalance(to, 'toBalance');
|
if (to) this.fetchBalance(to, 'toBalance');
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
if (!this.state.chain) {
|
|
||||||
return (
|
|
||||||
<div className={ `${styles.container} ${className}` }>
|
|
||||||
<CircularProgress size={ 60 } />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const { totalValue, gasPriceEthmDisplay, gasToDisplay } = this.state;
|
const { totalValue, gasPriceEthmDisplay, gasToDisplay } = this.state;
|
||||||
const { className, id, date, data, from } = this.props;
|
const { className, id, date, data, from } = this.props;
|
||||||
|
|
||||||
|
@ -59,10 +59,13 @@ export default class TransactionSecondaryDetails extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderGasPrice () {
|
renderGasPrice () {
|
||||||
if (!this.props.gasPriceEthmDisplay && !this.props.gasToDisplay) return null;
|
if (!this.props.gasPriceEthmDisplay && !this.props.gasToDisplay) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const { id } = this.props;
|
const { id } = this.props;
|
||||||
const { gasPriceEthmDisplay, gasToDisplay } = this.props;
|
const { gasPriceEthmDisplay, gasToDisplay } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-tip
|
data-tip
|
||||||
@ -83,11 +86,14 @@ export default class TransactionSecondaryDetails extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderData () {
|
renderData () {
|
||||||
if (!this.props.data) return null;
|
if (!this.props.data) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const { data, id } = this.props;
|
const { data, id } = this.props;
|
||||||
let dataToDisplay = this.noData() ? 'no data' : tUtil.getShortData(data);
|
let dataToDisplay = this.noData() ? 'no data' : tUtil.getShortData(data);
|
||||||
const noDataClass = this.noData() ? styles.noData : '';
|
const noDataClass = this.noData() ? styles.noData : '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={ `${styles.data} ${noDataClass}` }
|
className={ `${styles.data} ${noDataClass}` }
|
||||||
|
@ -22,17 +22,17 @@ export default class TxHashLink extends Component {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
txHash: PropTypes.string.isRequired,
|
txHash: PropTypes.string.isRequired,
|
||||||
chain: PropTypes.string.isRequired,
|
isTest: PropTypes.bool.isRequired,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
className: PropTypes.string
|
className: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { children, txHash, className, chain } = this.props;
|
const { children, txHash, className, isTest } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={ txLink(txHash, chain === 'morden' || chain === 'testnet') }
|
href={ txLink(txHash, isTest) }
|
||||||
target='_blank'
|
target='_blank'
|
||||||
className={ className }>
|
className={ className }>
|
||||||
{ children || txHash }
|
{ children || txHash }
|
||||||
|
@ -35,7 +35,8 @@ class Embedded extends Component {
|
|||||||
actions: PropTypes.shape({
|
actions: PropTypes.shape({
|
||||||
startConfirmRequest: PropTypes.func.isRequired,
|
startConfirmRequest: PropTypes.func.isRequired,
|
||||||
startRejectRequest: PropTypes.func.isRequired
|
startRejectRequest: PropTypes.func.isRequired
|
||||||
}).isRequired
|
}).isRequired,
|
||||||
|
isTest: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
@ -70,7 +71,7 @@ class Embedded extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderPending = (data) => {
|
renderPending = (data) => {
|
||||||
const { actions } = this.props;
|
const { actions, isTest } = this.props;
|
||||||
const { payload, id, isSending, date } = data;
|
const { payload, id, isSending, date } = data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -83,6 +84,7 @@ class Embedded extends Component {
|
|||||||
id={ id }
|
id={ id }
|
||||||
payload={ payload }
|
payload={ payload }
|
||||||
date={ date }
|
date={ date }
|
||||||
|
isTest={ isTest }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -93,11 +95,13 @@ class Embedded extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
|
const { isTest } = state.nodeStatus;
|
||||||
const { actions, signer } = state;
|
const { actions, signer } = state;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
actions,
|
actions,
|
||||||
signer
|
signer,
|
||||||
|
isTest
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ class RequestsPage extends Component {
|
|||||||
actions: PropTypes.shape({
|
actions: PropTypes.shape({
|
||||||
startConfirmRequest: PropTypes.func.isRequired,
|
startConfirmRequest: PropTypes.func.isRequired,
|
||||||
startRejectRequest: PropTypes.func.isRequired
|
startRejectRequest: PropTypes.func.isRequired
|
||||||
}).isRequired
|
}).isRequired,
|
||||||
|
isTest: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
@ -96,7 +97,7 @@ class RequestsPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderPending = (data) => {
|
renderPending = (data) => {
|
||||||
const { actions } = this.props;
|
const { actions, isTest } = this.props;
|
||||||
const { payload, id, isSending, date } = data;
|
const { payload, id, isSending, date } = data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -109,11 +110,13 @@ class RequestsPage extends Component {
|
|||||||
id={ id }
|
id={ id }
|
||||||
payload={ payload }
|
payload={ payload }
|
||||||
date={ date }
|
date={ date }
|
||||||
|
isTest={ isTest }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderFinished = (data) => {
|
renderFinished = (data) => {
|
||||||
|
const { isTest } = this.props;
|
||||||
const { payload, id, result, msg, status, error, date } = data;
|
const { payload, id, result, msg, status, error, date } = data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -127,6 +130,7 @@ class RequestsPage extends Component {
|
|||||||
error={ error }
|
error={ error }
|
||||||
payload={ payload }
|
payload={ payload }
|
||||||
date={ date }
|
date={ date }
|
||||||
|
isTest={ isTest }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -143,7 +147,14 @@ class RequestsPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
return state;
|
const { isTest } = state.nodeStatus;
|
||||||
|
const { actions, signer } = state;
|
||||||
|
|
||||||
|
return {
|
||||||
|
actions,
|
||||||
|
signer,
|
||||||
|
isTest
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps (dispatch) {
|
function mapDispatchToProps (dispatch) {
|
||||||
|
Loading…
Reference in New Issue
Block a user