aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/blockchain.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-12-08 05:15:51 +0800
committerFabio Berger <me@fabioberger.com>2017-12-08 05:15:51 +0800
commit139c8c2e783ffbbf22473604419fe3e5b299be0e (patch)
tree8558863db2ce6ab1c435c2afc82ca7453faadb6b /packages/website/ts/blockchain.ts
parent215e33fa6c1ca3c27712f5253daeaebf590f8983 (diff)
parent6c2bf8ed264c8941a0f234f3caceb52e412fda84 (diff)
downloaddexon-sol-tools-139c8c2e783ffbbf22473604419fe3e5b299be0e.tar
dexon-sol-tools-139c8c2e783ffbbf22473604419fe3e5b299be0e.tar.gz
dexon-sol-tools-139c8c2e783ffbbf22473604419fe3e5b299be0e.tar.bz2
dexon-sol-tools-139c8c2e783ffbbf22473604419fe3e5b299be0e.tar.lz
dexon-sol-tools-139c8c2e783ffbbf22473604419fe3e5b299be0e.tar.xz
dexon-sol-tools-139c8c2e783ffbbf22473604419fe3e5b299be0e.tar.zst
dexon-sol-tools-139c8c2e783ffbbf22473604419fe3e5b299be0e.zip
Merge branch 'feature/addSubproviders' into feature/portal-ledger-support
* feature/addSubproviders: Make sure we don't pass empty maker into getOrderHashHex Make sure we always pass in the correct networkId even if no injectedWeb3 found
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r--packages/website/ts/blockchain.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index f11c014fb..809da7d4f 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -628,19 +628,24 @@ export class Blockchain {
// In addition, if the user has an injectedWeb3 instance that is disconnected from a backing
// Ethereum node, this call will throw. We need to handle this case gracefully
const injectedWeb3 = (window as any).web3;
- let networkId: number;
+ let networkIdIfExists: number;
if (!_.isUndefined(injectedWeb3)) {
try {
- networkId = _.parseInt(await promisify(injectedWeb3.version.getNetwork)());
+ networkIdIfExists = _.parseInt(await promisify(injectedWeb3.version.getNetwork)());
} catch (err) {
// Ignore error and proceed with networkId undefined
}
}
- const provider = await Blockchain.getProviderAsync(injectedWeb3, networkId);
- this.zeroEx = new ZeroEx(provider, {
+ const provider = await Blockchain.getProviderAsync(injectedWeb3, networkIdIfExists);
+ const networkId = !_.isUndefined(networkIdIfExists) ? networkIdIfExists :
+ configs.isMainnetEnabled ?
+ constants.MAINNET_NETWORK_ID :
+ constants.TESTNET_NETWORK_ID;
+ const zeroExConfigs = {
networkId,
- });
+ };
+ this.zeroEx = new ZeroEx(provider, zeroExConfigs);
this.updateProviderName(injectedWeb3);
const shouldPollUserAddress = true;
this.web3Wrapper = new Web3Wrapper(this.dispatcher, provider, networkId, shouldPollUserAddress);