diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-27 17:55:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-27 17:55:04 +0800 |
commit | f6e97bb284e7fbe1d220ecdfcda91a7e549057ac (patch) | |
tree | 4ae2e66f34aede11878e565b25f0e552ed7810c3 | |
parent | 84bd54ba4025a33f4e311ec66d81d58b45e54d6b (diff) | |
parent | 6c8b99850529cb1403a09327a0088c2d5b43cba7 (diff) | |
download | dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.gz dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.bz2 dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.lz dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.xz dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.zst dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.zip |
Merge pull request #763 from prettymuchbryce/invalid-argument-error
Fix OrderWatcher uncaught Error
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | packages/order-watcher/CHANGELOG.json | 8 | ||||
-rw-r--r-- | packages/order-watcher/package.json | 4 | ||||
-rw-r--r-- | packages/typescript-typings/CHANGELOG.json | 4 | ||||
-rw-r--r-- | packages/typescript-typings/package.json | 2 | ||||
-rw-r--r-- | packages/typescript-typings/types/ethers/index.d.ts | 3 | ||||
-rw-r--r-- | packages/utils/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/utils/package.json | 4 | ||||
-rw-r--r-- | packages/utils/src/abi_decoder.ts | 15 |
9 files changed, 44 insertions, 7 deletions
diff --git a/package.json b/package.json index 9279327c3..a960fd569 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "name": "0x-monorepo", "engines": { - "node" : ">=6.12" + "node": ">=6.12" }, "workspaces": [ "packages/*" diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 4afd4b9b5..00f6ad1b9 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,5 +1,13 @@ [ { + "version": "0.0.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1529397769, "version": "0.0.6", "changes": [ diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 6cee9da16..3335713a3 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-watcher", - "version": "0.0.6", + "version": "0.0.7", "description": "An order watcher daemon that watches for order validity", "keywords": [ "0x", @@ -85,7 +85,7 @@ "@0xproject/order-utils": "^0.0.7", "@0xproject/types": "^0.8.1", "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/utils": "^0.7.3", "@0xproject/web3-wrapper": "^0.7.1", "ethereum-types": "^0.0.1", "bintrees": "^1.0.2", diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json index c76e0d4c0..25ff73274 100644 --- a/packages/typescript-typings/CHANGELOG.json +++ b/packages/typescript-typings/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Improve 'web3-provider-engine' typings", "pr": 768 + }, + { + "note": "Additional error type for `ethers.js`", + "pr": 763 } ] }, diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index f10d35666..3ba7c10ba 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/typescript-typings", - "version": "0.4.1", + "version": "0.4.2", "engines": { "node": ">=6.12" }, diff --git a/packages/typescript-typings/types/ethers/index.d.ts b/packages/typescript-typings/types/ethers/index.d.ts index d40428a9b..f869196e0 100644 --- a/packages/typescript-typings/types/ethers/index.d.ts +++ b/packages/typescript-typings/types/ethers/index.d.ts @@ -31,4 +31,7 @@ declare module 'ethers' { public static getDeployTransaction(bytecode: string, abi: any, ...args: any[]): Partial<TxData>; constructor(address: string, abi: any, provider: any); } + const enum errors { + INVALID_ARGUMENT = 'INVALID_ARGUMENT', + } } diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index ed5558981..c6736dc4d 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "0.7.3", + "changes": [ + { + "note": "Fixes uncaught Error in abi_decoder", + "pr": 763 + } + ] + }, + { "version": "0.7.2", "changes": [ { diff --git a/packages/utils/package.json b/packages/utils/package.json index 06d67566c..f4f39956c 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "0.7.1", + "version": "0.7.3", "engines": { "node": ">=6.12" }, @@ -36,7 +36,7 @@ }, "dependencies": { "ethereum-types": "^0.0.1", - "@0xproject/typescript-typings": "^0.4.1", + "@0xproject/typescript-typings": "^0.4.2", "@types/node": "^8.0.53", "ethereumjs-util": "^5.1.1", "bignumber.js": "~4.1.0", diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index 931cb94b2..d0c1ddc7d 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -32,7 +32,20 @@ export class AbiDecoder { const decodedParams: DecodedLogArgs = {}; let topicsIndex = 1; - const decodedData = ethersInterface.events[event.name].parse(log.data); + let decodedData: any[]; + try { + decodedData = ethersInterface.events[event.name].parse(log.data); + } catch (error) { + if (error.code === ethers.errors.INVALID_ARGUMENT) { + // Because we index events by Method ID, and Method IDs are derived from the method + // name and the input parameters, it's possible that the return value of the event + // does not match our ABI. If that's the case, then ethers will throw an error + // when we try to parse the event. We handle that case here by returning the log rather + // than throwing an error. + return log; + } + throw error; + } let didFailToDecode = false; _.forEach(event.inputs, (param: EventParameter, i: number) => { |