aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-07-02 09:21:16 +0800
committerGitHub <noreply@github.com>2018-07-02 09:21:16 +0800
commitad570b8ae162a213b4b88c417ecd64d4661df18b (patch)
treed9acfb9e2459c4dfcac191061fefebe015ff5771 /packages/utils
parentb9165c03af40983d885af2b18e729f11746de91d (diff)
parentb9b00e10d39c3c84bc72892ef37f1313e904414d (diff)
downloaddexon-sol-tools-ad570b8ae162a213b4b88c417ecd64d4661df18b.tar
dexon-sol-tools-ad570b8ae162a213b4b88c417ecd64d4661df18b.tar.gz
dexon-sol-tools-ad570b8ae162a213b4b88c417ecd64d4661df18b.tar.bz2
dexon-sol-tools-ad570b8ae162a213b4b88c417ecd64d4661df18b.tar.lz
dexon-sol-tools-ad570b8ae162a213b4b88c417ecd64d4661df18b.tar.xz
dexon-sol-tools-ad570b8ae162a213b4b88c417ecd64d4661df18b.tar.zst
dexon-sol-tools-ad570b8ae162a213b4b88c417ecd64d4661df18b.zip
Merge branch 'v2-prototype' into eth-lightwallet-subprovider-final
Diffstat (limited to 'packages/utils')
-rw-r--r--packages/utils/CHANGELOG.json9
-rw-r--r--packages/utils/package.json4
-rw-r--r--packages/utils/src/abi_decoder.ts15
3 files changed, 25 insertions, 3 deletions
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) => {