Merge branch 'development' into feature/web3-wrapper

This commit is contained in:
Leonid
2017-12-08 14:46:51 +03:00
committed by GitHub
8 changed files with 22 additions and 23 deletions

View File

@@ -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<string>(injectedWeb3.version.getNetwork)());
networkIdIfExists = _.parseInt(await promisify<string>(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);

View File

@@ -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<HashInputProps, HashInputState> {
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,