From 1eaefac12b4911a0a54a7b822be61a9c35d1452e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 7 Dec 2017 14:51:40 -0600 Subject: Make sure we always pass in the correct networkId even if no injectedWeb3 found --- packages/website/ts/blockchain.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'packages/website/ts') diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 31d725a41..aea4f863c 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -621,19 +621,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); -- cgit From f1ecdcf6029debbd2183511080b302a4fccc6703 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 7 Dec 2017 14:53:14 -0600 Subject: Make sure we don't pass empty maker into getOrderHashHex --- packages/website/ts/components/inputs/hash_input.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/website/ts') diff --git a/packages/website/ts/components/inputs/hash_input.tsx b/packages/website/ts/components/inputs/hash_input.tsx index 7fadc3c15..25e7b5009 100644 --- a/packages/website/ts/components/inputs/hash_input.tsx +++ b/packages/website/ts/components/inputs/hash_input.tsx @@ -1,4 +1,5 @@ import {Order, ZeroEx} from '0x.js'; +import * as _ from 'lodash'; import * as React from 'react'; import ReactTooltip = require('react-tooltip'); import {Blockchain} from 'ts/blockchain'; @@ -49,7 +50,7 @@ export class HashInput extends React.Component { exchangeContractAddress, expirationUnixTimestampSec: hashData.orderExpiryTimestamp, feeRecipient: hashData.feeRecipientAddress, - maker: hashData.orderMakerAddress, + maker: _.isEmpty(hashData.orderMakerAddress) ? constants.NULL_ADDRESS : hashData.orderMakerAddress, makerFee: hashData.makerFee, makerTokenAddress: hashData.depositTokenContractAddr, makerTokenAmount: hashData.depositAmount, -- cgit