aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/utils')
-rw-r--r--packages/utils/CHANGELOG.json45
-rw-r--r--packages/utils/CHANGELOG.md16
-rw-r--r--packages/utils/package.json18
-rw-r--r--packages/utils/src/abi_decoder.ts4
-rw-r--r--packages/utils/src/abi_utils.ts15
-rw-r--r--packages/utils/tsconfig.json3
6 files changed, 84 insertions, 17 deletions
diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json
index 446355007..b4f438966 100644
--- a/packages/utils/CHANGELOG.json
+++ b/packages/utils/CHANGELOG.json
@@ -1,5 +1,50 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Make abi_decoder compatible with ethers ^4.0.0",
+ "pr": 1069
+ }
+ ]
+ },
+ {
+ "timestamp": 1537907159,
+ "version": "1.0.11",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1537875740,
+ "version": "1.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1537541580,
+ "version": "1.0.9",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1536142250,
+ "version": "1.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1535377027,
"version": "1.0.7",
"changes": [
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index f7e877a58..60b6d1b7e 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.11 - _September 25, 2018_
+
+ * Dependencies updated
+
+## v1.0.10 - _September 25, 2018_
+
+ * Dependencies updated
+
+## v1.0.9 - _September 21, 2018_
+
+ * Dependencies updated
+
+## v1.0.8 - _September 5, 2018_
+
+ * Dependencies updated
+
## v1.0.7 - _August 27, 2018_
* Dependencies updated
diff --git a/packages/utils/package.json b/packages/utils/package.json
index c72fb4c83..db265dd8f 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/utils",
- "version": "1.0.7",
+ "version": "1.0.11",
"engines": {
"node": ">=6.12"
},
@@ -8,8 +8,7 @@
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
- "watch_without_deps": "tsc -w",
- "build": "tsc",
+ "build": "tsc -b",
"clean": "shx rm -rf lib",
"lint": "tslint --project .",
"test": "yarn run_mocha",
@@ -28,7 +27,8 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^1.0.6",
+ "@0xproject/tslint-config": "^1.0.7",
+ "@types/detect-node": "2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"chai": "^4.0.1",
@@ -41,15 +41,15 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0xproject/types": "^1.0.1-rc.6",
- "@0xproject/typescript-typings": "^1.0.5",
- "@types/node": "^8.0.53",
+ "@0xproject/types": "^1.1.1",
+ "@0xproject/typescript-typings": "^2.0.2",
+ "@types/node": "*",
"abortcontroller-polyfill": "^1.1.9",
"bignumber.js": "~4.1.0",
"detect-node": "2.0.3",
- "ethereum-types": "^1.0.5",
+ "ethereum-types": "^1.0.8",
"ethereumjs-util": "^5.1.1",
- "ethers": "3.0.22",
+ "ethers": "4.0.0-beta.14",
"isomorphic-fetch": "^2.2.1",
"js-sha3": "^0.7.0",
"lodash": "^4.17.5"
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index 265eb105e..ea8c91d10 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -47,7 +47,7 @@ export class AbiDecoder {
let decodedData: any[];
try {
- decodedData = ethersInterface.events[event.name].parse(log.data);
+ decodedData = ethersInterface.events[event.name].decode(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
@@ -99,7 +99,7 @@ export class AbiDecoder {
const ethersInterface = new ethers.Interface(abiArray);
_.map(abiArray, (abi: AbiDefinition) => {
if (abi.type === AbiType.Event) {
- const topic = ethersInterface.events[abi.name].topics[0];
+ const topic = ethersInterface.events[abi.name].topic;
const numIndexedArgs = _.reduce(abi.inputs, (sum, input) => (input.indexed ? sum + 1 : sum), 0);
this._methodIds[topic] = {
...this._methodIds[topic],
diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts
index c9b70966c..598ea5fcc 100644
--- a/packages/utils/src/abi_utils.ts
+++ b/packages/utils/src/abi_utils.ts
@@ -1,14 +1,19 @@
import { AbiDefinition, AbiType, ContractAbi, DataItem, MethodAbi } from 'ethereum-types';
-import * as ethers from 'ethers';
import * as _ from 'lodash';
import { BigNumber } from './configured_bignumber';
+type ParamName = null | string | NestedParamName;
+interface NestedParamName {
+ name: string | null;
+ names: ParamName[];
+}
+
// Note(albrow): This function is unexported in ethers.js. Copying it here for
// now.
// Source: https://github.com/ethers-io/ethers.js/blob/884593ab76004a808bf8097e9753fb5f8dcc3067/contracts/interface.js#L30
-function parseEthersParams(params: DataItem[]): { names: ethers.ParamName[]; types: string[] } {
- const names: ethers.ParamName[] = [];
+function parseEthersParams(params: DataItem[]): { names: ParamName[]; types: string[] } {
+ const names: ParamName[] = [];
const types: string[] = [];
params.forEach((param: DataItem) => {
@@ -37,7 +42,7 @@ function parseEthersParams(params: DataItem[]): { names: ethers.ParamName[]; typ
// returns true if x is equal to y and false otherwise. Performs some minimal
// type conversion and data massaging for x and y, depending on type. name and
// type should typically be derived from parseEthersParams.
-function isAbiDataEqual(name: ethers.ParamName, type: string, x: any, y: any): boolean {
+function isAbiDataEqual(name: ParamName, type: string, x: any, y: any): boolean {
if (_.isUndefined(x) && _.isUndefined(y)) {
return true;
} else if (_.isUndefined(x) && !_.isUndefined(y)) {
@@ -89,7 +94,7 @@ function isAbiDataEqual(name: ethers.ParamName, type: string, x: any, y: any): b
//
const nestedName = _.isString(name.names[i])
? (name.names[i] as string)
- : ((name.names[i] as ethers.NestedParamName).name as string);
+ : ((name.names[i] as NestedParamName).name as string);
if (!isAbiDataEqual(name.names[i], types[i], x[nestedName], y[nestedName])) {
return false;
}
diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json
index 8b4cd47a2..718e623c7 100644
--- a/packages/utils/tsconfig.json
+++ b/packages/utils/tsconfig.json
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
- "outDir": "lib"
+ "outDir": "lib",
+ "rootDir": "."
},
"include": ["src/**/*", "test/**/*"]
}