aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-06-18 19:50:35 +0800
committerGitHub <noreply@github.com>2018-06-18 19:50:35 +0800
commit190eafc30e2e444ed15b76217a6162ec04b33f73 (patch)
treeb20cbad73ff7a069dc0f0ef43ebc0373c714ad02 /packages/utils
parentd4ee0e862297c16f8ee62efccd31f1193052c64e (diff)
parent0c238448fda99c4d7997901d0fe4d72cb06b79cc (diff)
downloaddexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar
dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.gz
dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.bz2
dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.lz
dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.xz
dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.zst
dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.zip
Merge branch 'v2-prototype' into bug/contracts/eip712-191-prefix
Diffstat (limited to 'packages/utils')
-rw-r--r--packages/utils/CHANGELOG.json8
-rw-r--r--packages/utils/package.json2
-rw-r--r--packages/utils/src/abi_decoder.ts3
-rw-r--r--packages/utils/src/abi_utils.ts2
-rw-r--r--packages/utils/src/error_utils.ts5
-rw-r--r--packages/utils/src/index.ts1
-rw-r--r--packages/utils/src/interval_utils.ts2
7 files changed, 16 insertions, 7 deletions
diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json
index 616a17d62..339d73e05 100644
--- a/packages/utils/CHANGELOG.json
+++ b/packages/utils/CHANGELOG.json
@@ -1,5 +1,13 @@
[
{
+ "version": "0.6.3",
+ "changes": [
+ {
+ "note": "Added errorUtils.spawnSwitchErr"
+ }
+ ]
+ },
+ {
"timestamp": 1527009133,
"version": "0.6.2",
"changes": [
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 89daadbec..3828fa9ee 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -8,7 +8,7 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
- "watch": "tsc -w",
+ "watch_without_deps": "tsc -w",
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
"clean": "shx rm -rf lib scripts",
"lint": "tslint --project .",
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index ed3297ee1..931cb94b2 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -29,12 +29,9 @@ export class AbiDecoder {
return log;
}
const ethersInterface = new ethers.Interface([event]);
- const logData = log.data;
const decodedParams: DecodedLogArgs = {};
let topicsIndex = 1;
- const nonIndexedInputs = _.filter(event.inputs, input => !input.indexed);
- const dataTypes = _.map(nonIndexedInputs, input => input.type);
const decodedData = ethersInterface.events[event.name].parse(log.data);
let didFailToDecode = false;
diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts
index b5822425c..413c2f481 100644
--- a/packages/utils/src/abi_utils.ts
+++ b/packages/utils/src/abi_utils.ts
@@ -1,4 +1,4 @@
-import { AbiDefinition, AbiType, ConstructorAbi, ContractAbi, DataItem, MethodAbi } from 'ethereum-types';
+import { AbiDefinition, AbiType, ContractAbi, DataItem, MethodAbi } from 'ethereum-types';
import * as _ from 'lodash';
export const abiUtils = {
diff --git a/packages/utils/src/error_utils.ts b/packages/utils/src/error_utils.ts
new file mode 100644
index 000000000..735d3940b
--- /dev/null
+++ b/packages/utils/src/error_utils.ts
@@ -0,0 +1,5 @@
+export const errorUtils = {
+ spawnSwitchErr(name: string, value: any): Error {
+ return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
+ },
+};
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 709ec93b2..fd102cecb 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -7,3 +7,4 @@ export { AbiDecoder } from './abi_decoder';
export { logUtils } from './log_utils';
export { abiUtils } from './abi_utils';
export { NULL_BYTES } from './constants';
+export { errorUtils } from './error_utils';
diff --git a/packages/utils/src/interval_utils.ts b/packages/utils/src/interval_utils.ts
index 6784d5b35..3d0561cd2 100644
--- a/packages/utils/src/interval_utils.ts
+++ b/packages/utils/src/interval_utils.ts
@@ -1,5 +1,3 @@
-import * as _ from 'lodash';
-
export const intervalUtils = {
setAsyncExcludingInterval(
fn: () => Promise<void>,