diff options
author | Fabio Berger <me@fabioberger.com> | 2018-02-07 09:29:10 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-02-07 09:29:10 +0800 |
commit | 518efa8ad2765b3664ad1b5433c56a82cc7c50be (patch) | |
tree | 2fd2f959686a1ced21676b5803cfc9ec4c7f6c8d /packages/website/ts | |
parent | 9deaf612f13728bd9285e9de9d32ad628c426059 (diff) | |
download | dexon-sol-tools-518efa8ad2765b3664ad1b5433c56a82cc7c50be.tar dexon-sol-tools-518efa8ad2765b3664ad1b5433c56a82cc7c50be.tar.gz dexon-sol-tools-518efa8ad2765b3664ad1b5433c56a82cc7c50be.tar.bz2 dexon-sol-tools-518efa8ad2765b3664ad1b5433c56a82cc7c50be.tar.lz dexon-sol-tools-518efa8ad2765b3664ad1b5433c56a82cc7c50be.tar.xz dexon-sol-tools-518efa8ad2765b3664ad1b5433c56a82cc7c50be.tar.zst dexon-sol-tools-518efa8ad2765b3664ad1b5433c56a82cc7c50be.zip |
Move isTestNetwork into utils and also check it from showing ZRX request button
Diffstat (limited to 'packages/website/ts')
-rw-r--r-- | packages/website/ts/components/token_balances.tsx | 11 | ||||
-rw-r--r-- | packages/website/ts/utils/utils.ts | 11 |
2 files changed, 13 insertions, 9 deletions
diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index d91dbd093..301a332ce 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -176,14 +176,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala onTouchTap={this._onDharmaDialogToggle.bind(this, false)} />, ]; - const isTestNetwork = _.includes( - [ - constants.NETWORK_ID_BY_NAME[Networks.Kovan], - constants.NETWORK_ID_BY_NAME[Networks.Rinkeby], - constants.NETWORK_ID_BY_NAME[Networks.Ropsten], - ], - this.props.networkId, - ); + const isTestNetwork = utils.isTestNetwork(this.props.networkId); const isKovanTestNetwork = this.props.networkId === constants.NETWORK_ID_KOVAN; const dharmaButtonColumnStyle = { paddingLeft: 3, @@ -426,7 +419,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala /> )} {token.symbol === ZRX_TOKEN_SYMBOL && - this.props.networkId === constants.NETWORK_ID_KOVAN && ( + utils.isTestNetwork(this.props.networkId) && ( <LifeCycleRaisedButton labelReady="Request" labelLoading="Sending..." diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 7e69b1c5f..a7865d41b 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -282,4 +282,15 @@ export const utils = { isTestRpc(nodeVersion: string): boolean { return _.includes(nodeVersion, 'TestRPC'); }, + isTestNetwork(networkId: number): boolean { + const isTestNetwork = _.includes( + [ + constants.NETWORK_ID_BY_NAME[Networks.Kovan], + constants.NETWORK_ID_BY_NAME[Networks.Rinkeby], + constants.NETWORK_ID_BY_NAME[Networks.Ropsten], + ], + networkId, + ); + return isTestNetwork; + }, }; |