aboutsummaryrefslogtreecommitdiffstats
path: root/packages/base-contract
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base-contract')
-rw-r--r--packages/base-contract/CHANGELOG.json9
-rw-r--r--packages/base-contract/package.json2
-rw-r--r--packages/base-contract/src/index.ts8
3 files changed, 14 insertions, 5 deletions
diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json
index 8403d824b..fba072011 100644
--- a/packages/base-contract/CHANGELOG.json
+++ b/packages/base-contract/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Change the way we detect BN to work with the newest ethers.js",
+ "pr": 1069
+ }
+ ]
+ },
+ {
"timestamp": 1537907159,
"version": "2.0.5",
"changes": [
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json
index 3bba0e81b..b4047691c 100644
--- a/packages/base-contract/package.json
+++ b/packages/base-contract/package.json
@@ -44,7 +44,7 @@
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
- "ethers": "3.0.22",
+ "ethers": "^4.0.0-beta.14",
"lodash": "^4.17.5"
},
"publishConfig": {
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index 12f974445..90e576c24 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -61,7 +61,7 @@ export class BaseContract {
}
}
protected static _bnToBigNumber(_type: string, value: any): any {
- return _.isObject(value) && value._bn ? new BigNumber(value.toString()) : value;
+ return _.isObject(value) && value._hex ? new BigNumber(value.toString()) : value;
}
protected static async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>(
txData: T,
@@ -87,10 +87,10 @@ 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 = ethers.utils.AbiCoder.defaultCoder;
+ const coder = new ethers.AbiCoder();
const params = abiUtils.parseEthersParams(inputAbi);
- const rawEncoded = coder.encode(params.names, params.types, args);
- const rawDecoded = coder.decode(params.names, params.types, rawEncoded);
+ const rawEncoded = coder.encode(inputAbi, args);
+ const rawDecoded = coder.decode(inputAbi, rawEncoded);
for (let i = 0; i < rawDecoded.length; i++) {
const original = args[i];
const decoded = rawDecoded[i];