aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/contract_wrappers/exchange_wrapper.ts6
-rw-r--r--src/web3_wrapper.ts9
2 files changed, 11 insertions, 4 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts
index 2353c826a..fa4b5904b 100644
--- a/src/contract_wrappers/exchange_wrapper.ts
+++ b/src/contract_wrappers/exchange_wrapper.ts
@@ -297,8 +297,8 @@ export class ExchangeWrapper extends ContractWrapper {
* Must be available via the supplied Web3.Provider passed to 0x.js.
*/
@decorators.contractCallErrorHandler
- public async batchFillOrderAsync(orderFillRequests: OrderFillRequest[],
- shouldCheckTransfer: boolean, takerAddress: string): Promise<void> {
+ public async batchFillOrdersAsync(orderFillRequests: OrderFillRequest[],
+ shouldCheckTransfer: boolean, takerAddress: string): Promise<void> {
assert.doesConformToSchema('orderFillRequests', orderFillRequests, orderFillRequestsSchema);
const exchangeContractAddresses = _.map(
orderFillRequests,
@@ -520,7 +520,7 @@ export class ExchangeWrapper extends ContractWrapper {
* interface.
*/
@decorators.contractCallErrorHandler
- public async batchCancelOrderAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise<void> {
+ public async batchCancelOrdersAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise<void> {
assert.doesConformToSchema('orderCancellationRequests', orderCancellationRequests,
orderCancellationRequestsSchema);
const exchangeContractAddresses = _.map(
diff --git a/src/web3_wrapper.ts b/src/web3_wrapper.ts
index 630f0bef3..61bac45c9 100644
--- a/src/web3_wrapper.ts
+++ b/src/web3_wrapper.ts
@@ -5,11 +5,13 @@ import promisify = require('es6-promisify');
export class Web3Wrapper {
private web3: Web3;
+ private networkIdIfExists?: number;
constructor(provider: Web3.Provider) {
this.web3 = new Web3();
this.web3.setProvider(provider);
}
public setProvider(provider: Web3.Provider) {
+ delete this.networkIdIfExists;
this.web3.setProvider(provider);
}
public isAddress(address: string): boolean {
@@ -27,9 +29,14 @@ export class Web3Wrapper {
return this.web3.currentProvider;
}
public async getNetworkIdIfExistsAsync(): Promise<number|undefined> {
+ if (!_.isUndefined(this.networkIdIfExists)) {
+ return this.networkIdIfExists;
+ }
+
try {
const networkId = await this.getNetworkAsync();
- return Number(networkId);
+ this.networkIdIfExists = Number(networkId);
+ return this.networkIdIfExists;
} catch (err) {
return undefined;
}