aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-10-09 18:55:10 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-10-09 22:01:34 +0800
commit22160df2d2d5aef63c3e2c3f502ac15119b18e07 (patch)
treec217e59fe3cc34108647bfc9f2ed7b6ae9876421 /packages
parent31ee8870b80579caf3762c1178043bb5bb6fe4fb (diff)
downloaddexon-sol-tools-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar
dexon-sol-tools-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.gz
dexon-sol-tools-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.bz2
dexon-sol-tools-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.lz
dexon-sol-tools-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.xz
dexon-sol-tools-22160df2d2d5aef63c3e2c3f502ac15119b18e07.tar.zst
dexon-sol-tools-22160df2d2d5aef63c3e2c3f502ac15119b18e07.zip
Fix ethers build issue
Diffstat (limited to 'packages')
-rw-r--r--packages/base-contract/src/index.ts9
-rw-r--r--packages/contract_templates/contract.handlebars4
-rw-r--r--packages/utils/src/abi_decoder.ts7
3 files changed, 11 insertions, 9 deletions
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index 981e6fca6..7e0428d92 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -12,12 +12,13 @@ import {
TxDataPayable,
} from 'ethereum-types';
import * as ethers from 'ethers';
+import { Interface } from 'ethers/utils/interface';
import * as _ from 'lodash';
import { formatABIDataItem } from './utils';
export interface EthersInterfaceByFunctionSignature {
- [key: string]: ethers.Interface;
+ [key: string]: Interface;
}
const REVERT_ERROR_SELECTOR = '08c379a0';
@@ -101,7 +102,7 @@ export class BaseContract {
// if it overflows the corresponding Solidity type, there is a bug in the
// encoder, or the encoder performs unsafe type coercion.
public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): void {
- const coder = new ethers.AbiCoder();
+ const coder = new ethers.utils.AbiCoder();
const params = abiUtils.parseEthersParams(inputAbi);
const rawEncoded = coder.encode(inputAbi, args);
const rawDecoded = coder.decode(inputAbi, rawEncoded);
@@ -117,7 +118,7 @@ export class BaseContract {
}
}
}
- protected _lookupEthersInterface(functionSignature: string): ethers.Interface {
+ protected _lookupEthersInterface(functionSignature: string): Interface {
const ethersInterface = this._ethersInterfacesByFunctionSignature[functionSignature];
if (_.isUndefined(ethersInterface)) {
throw new Error(`Failed to lookup method with function signature '${functionSignature}'`);
@@ -154,7 +155,7 @@ export class BaseContract {
this._ethersInterfacesByFunctionSignature = {};
_.each(methodAbis, methodAbi => {
const functionSignature = abiUtils.getFunctionSignature(methodAbi);
- this._ethersInterfacesByFunctionSignature[functionSignature] = new ethers.Interface([methodAbi]);
+ this._ethersInterfacesByFunctionSignature[functionSignature] = new Interface([methodAbi]);
});
}
}
diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars
index 9ae39f44f..de48779d3 100644
--- a/packages/contract_templates/contract.handlebars
+++ b/packages/contract_templates/contract.handlebars
@@ -5,7 +5,7 @@ import { BaseContract } from '@0xproject/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
-import * as ethers from 'ethers';
+import { Interface } from 'ethers/utils/interface';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
@@ -65,7 +65,7 @@ export class {{contractName}}Contract extends BaseContract {
[{{> params inputs=ctor.inputs}}],
BaseContract._bigNumberToString,
);
- const iface = new ethers.Interface(abi);
+ const iface = new Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, [{{> params inputs=ctor.inputs}}]);
const web3Wrapper = new Web3Wrapper(provider);
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index ea8c91d10..836037f30 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -9,7 +9,8 @@ import {
RawLog,
SolidityTypes,
} from 'ethereum-types';
-import * as ethers from 'ethers';
+import { ethers } from 'ethers';
+import { Interface } from 'ethers/utils/interface';
import * as _ from 'lodash';
import { addressUtils } from './address_utils';
@@ -41,7 +42,7 @@ export class AbiDecoder {
return log;
}
const event = this._methodIds[methodId][numIndexedArgs];
- const ethersInterface = new ethers.Interface([event]);
+ const ethersInterface = new Interface([event]);
const decodedParams: DecodedLogArgs = {};
let topicsIndex = 1;
@@ -96,7 +97,7 @@ export class AbiDecoder {
if (_.isUndefined(abiArray)) {
return;
}
- const ethersInterface = new ethers.Interface(abiArray);
+ const ethersInterface = new Interface(abiArray);
_.map(abiArray, (abi: AbiDefinition) => {
if (abi.type === AbiType.Event) {
const topic = ethersInterface.events[abi.name].topic;