aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--packages/0x.js/CHANGELOG.md3
-rw-r--r--packages/0x.js/package.json20
-rw-r--r--packages/0x.js/src/contract_wrappers/contract_wrapper.ts3
-rw-r--r--packages/0x.js/src/contract_wrappers/exchange_wrapper.ts3
-rw-r--r--packages/0x.js/src/index.ts10
-rw-r--r--packages/0x.js/src/order_watcher/event_watcher.ts4
-rw-r--r--packages/0x.js/src/order_watcher/order_state_watcher.ts3
-rw-r--r--packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts2
-rw-r--r--packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts2
-rw-r--r--packages/0x.js/src/types.ts14
-rw-r--r--packages/0x.js/src/utils/exchange_transfer_simulator.ts3
-rw-r--r--packages/0x.js/test/exchange_transfer_simulator_test.ts3
-rw-r--r--packages/0x.js/test/exchange_wrapper_test.ts3
-rw-r--r--packages/0x.js/test/order_validation_test.ts3
-rw-r--r--packages/abi-gen/package.json8
-rw-r--r--packages/assert/package.json8
-rw-r--r--packages/connect/package.json12
-rw-r--r--packages/contracts/package.json20
-rw-r--r--packages/deployer/package.json8
-rw-r--r--packages/dev-utils/package.json8
-rw-r--r--packages/json-schemas/package.json6
-rw-r--r--packages/monorepo-scripts/package.json4
-rw-r--r--packages/subproviders/CHANGELOG.md7
-rw-r--r--packages/subproviders/README.md2
-rw-r--r--packages/subproviders/package.json13
-rw-r--r--packages/subproviders/src/globals.d.ts20
-rw-r--r--packages/subproviders/src/index.ts3
-rw-r--r--packages/subproviders/src/subproviders/injected_web3.ts11
-rw-r--r--packages/subproviders/src/subproviders/ledger.ts2
-rw-r--r--packages/subproviders/src/subproviders/nonce_tracker.ts103
-rw-r--r--packages/subproviders/src/subproviders/redundant_rpc.ts1
-rw-r--r--packages/subproviders/src/types.ts8
-rw-r--r--packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts151
-rw-r--r--packages/testnet-faucets/Dockerfile5
-rw-r--r--packages/testnet-faucets/package.json11
-rw-r--r--packages/testnet-faucets/src/ts/global.d.ts15
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts4
-rw-r--r--packages/tslint-config/package.json2
-rw-r--r--packages/types/CHANGELOG.md2
-rw-r--r--packages/types/package.json6
-rw-r--r--packages/types/src/index.ts10
-rw-r--r--packages/utils/CHANGELOG.md8
-rw-r--r--packages/utils/package.json8
-rw-r--r--packages/utils/src/abi_decoder.ts23
-rw-r--r--packages/web3-typescript-typings/package.json2
-rw-r--r--packages/web3-wrapper/package.json10
-rw-r--r--packages/website/package.json10
-rw-r--r--packages/website/ts/blockchain.ts2
-rw-r--r--yarn.lock9
50 files changed, 474 insertions, 126 deletions
diff --git a/package.json b/package.json
index 290b56444..4bc8dc0f8 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,7 @@
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic"
},
"devDependencies": {
- "@0xproject/utils": "^0.2.0",
+ "@0xproject/utils": "^0.3.0",
"async-child-process": "^1.1.1",
"ethereumjs-testrpc": "^6.0.3",
"lerna": "^2.5.1",
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index 06b11cba8..54c06444a 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -1,8 +1,9 @@
# CHANGELOG
-## v0.x.0 - _TBD, 2018_
+## v0.32.0 - _February 5, 2018_
* Add `zeroEx.etherToken.getContractAddressIfExists` (#350)
+ * Fixed the bug causing order watcher to throw if there is an event with the same signature but different indexed fields (#366)
## v0.31.1 - _February 1, 2018_
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index a967cea16..013b4ae6e 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -1,6 +1,6 @@
{
"name": "0x.js",
- "version": "0.31.1",
+ "version": "0.32.0",
"description": "A javascript library for interacting with the 0x protocol",
"keywords": [
"0x.js",
@@ -42,9 +42,9 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0xproject/abi-gen": "^0.1.6",
- "@0xproject/dev-utils": "^0.0.9",
- "@0xproject/tslint-config": "^0.4.6",
+ "@0xproject/abi-gen": "^0.1.7",
+ "@0xproject/dev-utils": "^0.0.10",
+ "@0xproject/tslint-config": "^0.4.7",
"@types/bintrees": "^1.0.2",
"@types/jsonschema": "^1.1.1",
"@types/lodash": "^4.14.86",
@@ -76,15 +76,15 @@
"typedoc": "~0.8.0",
"typescript": "2.7.1",
"web3-provider-engine": "^13.0.1",
- "web3-typescript-typings": "^0.9.8",
+ "web3-typescript-typings": "^0.9.9",
"webpack": "^3.1.0"
},
"dependencies": {
- "@0xproject/assert": "^0.0.15",
- "@0xproject/json-schemas": "^0.7.7",
- "@0xproject/types": "^0.1.8",
- "@0xproject/utils": "^0.2.4",
- "@0xproject/web3-wrapper": "^0.1.9",
+ "@0xproject/assert": "^0.0.16",
+ "@0xproject/json-schemas": "^0.7.8",
+ "@0xproject/types": "^0.1.9",
+ "@0xproject/utils": "^0.3.0",
+ "@0xproject/web3-wrapper": "^0.1.10",
"bintrees": "^1.0.2",
"bn.js": "^4.11.8",
"ethereumjs-abi": "^0.6.4",
diff --git a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
index d913e8d9b..b313273b5 100644
--- a/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/contract_wrapper.ts
@@ -1,4 +1,4 @@
-import { LogWithDecodedArgs, RawLog } from '@0xproject/types';
+import { BlockParamLiteral, LogWithDecodedArgs, RawLog } from '@0xproject/types';
import { AbiDecoder, intervalUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { Block, BlockAndLogStreamer } from 'ethereumjs-blockstream';
@@ -7,7 +7,6 @@ import * as Web3 from 'web3';
import {
Artifact,
- BlockParamLiteral,
BlockRange,
ContractEventArgs,
ContractEvents,
diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
index 63c0d073a..e0c85505c 100644
--- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts
@@ -1,5 +1,5 @@
import { schemas } from '@0xproject/json-schemas';
-import { DecodedLogArgs, LogWithDecodedArgs } from '@0xproject/types';
+import { BlockParamLiteral, DecodedLogArgs, LogWithDecodedArgs } from '@0xproject/types';
import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
@@ -7,7 +7,6 @@ import * as Web3 from 'web3';
import { artifacts } from '../artifacts';
import {
- BlockParamLiteral,
BlockRange,
ECSignature,
EventCallback,
diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts
index 41e67e177..c3c8854da 100644
--- a/packages/0x.js/src/index.ts
+++ b/packages/0x.js/src/index.ts
@@ -2,7 +2,6 @@ export { ZeroEx } from './0x';
export {
Order,
- BlockParamLiteral,
SignedOrder,
ECSignature,
ZeroExError,
@@ -14,7 +13,6 @@ export {
TokenEvents,
IndexedFilterValues,
BlockRange,
- BlockParam,
OrderCancellationRequest,
OrderFillRequest,
LogErrorContractEventArgs,
@@ -44,6 +42,12 @@ export {
OrderState,
} from './types';
-export { ContractEventArg, LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
+export {
+ BlockParamLiteral,
+ BlockParam,
+ ContractEventArg,
+ LogWithDecodedArgs,
+ TransactionReceiptWithDecodedLogs,
+} from '@0xproject/types';
export { TransactionReceipt } from '@0xproject/types';
diff --git a/packages/0x.js/src/order_watcher/event_watcher.ts b/packages/0x.js/src/order_watcher/event_watcher.ts
index 5d05bfb60..e67b93251 100644
--- a/packages/0x.js/src/order_watcher/event_watcher.ts
+++ b/packages/0x.js/src/order_watcher/event_watcher.ts
@@ -3,7 +3,9 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as Web3 from 'web3';
-import { BlockParamLiteral, EventWatcherCallback, ZeroExError } from '../types';
+import { BlockParamLiteral } from '@0xproject/types';
+
+import { EventWatcherCallback, ZeroExError } from '../types';
import { assert } from '../utils/assert';
const DEFAULT_EVENT_POLLING_INTERVAL_MS = 200;
diff --git a/packages/0x.js/src/order_watcher/order_state_watcher.ts b/packages/0x.js/src/order_watcher/order_state_watcher.ts
index 1ad1a90b1..a9b3eba68 100644
--- a/packages/0x.js/src/order_watcher/order_state_watcher.ts
+++ b/packages/0x.js/src/order_watcher/order_state_watcher.ts
@@ -1,5 +1,5 @@
import { schemas } from '@0xproject/json-schemas';
-import { LogWithDecodedArgs } from '@0xproject/types';
+import { BlockParamLiteral, LogWithDecodedArgs } from '@0xproject/types';
import { AbiDecoder, intervalUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
@@ -11,7 +11,6 @@ import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allow
import { OrderFilledCancelledLazyStore } from '../stores/order_filled_cancelled_lazy_store';
import {
ApprovalContractEventArgs,
- BlockParamLiteral,
ContractEventArgs,
DepositContractEventArgs,
EtherTokenEvents,
diff --git a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts b/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts
index 33feea105..ede1319fe 100644
--- a/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts
+++ b/packages/0x.js/src/stores/balance_proxy_allowance_lazy_store.ts
@@ -1,8 +1,8 @@
+import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
-import { BlockParamLiteral } from '../types';
/**
* Copy on read store for balances/proxyAllowances of tokens/accounts
diff --git a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts
index e22364c09..0a0d93406 100644
--- a/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts
+++ b/packages/0x.js/src/stores/order_filled_cancelled_lazy_store.ts
@@ -1,8 +1,8 @@
+import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
-import { BlockParamLiteral } from '../types';
/**
* Copy on read store for filled/cancelled taker amounts
diff --git a/packages/0x.js/src/types.ts b/packages/0x.js/src/types.ts
index a0deb91c9..a2d1b9eb4 100644
--- a/packages/0x.js/src/types.ts
+++ b/packages/0x.js/src/types.ts
@@ -1,5 +1,7 @@
-import { ContractEventArg, LogWithDecodedArgs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
+
+import { BlockParam, BlockParamLiteral, ContractEventArg, LogWithDecodedArgs } from '@0xproject/types';
+
import * as Web3 from 'web3';
export enum ZeroExError {
@@ -219,16 +221,6 @@ export interface IndexedFilterValues {
[index: string]: ContractEventArg;
}
-// Earliest is omitted by design. It is simply an alias for the `0` constant and
-// is thus not very helpful. Moreover, this type is used in places that only accept
-// `latest` or `pending`.
-export enum BlockParamLiteral {
- Latest = 'latest',
- Pending = 'pending',
-}
-
-export type BlockParam = BlockParamLiteral | number;
-
export interface BlockRange {
fromBlock: BlockParam;
toBlock: BlockParam;
diff --git a/packages/0x.js/src/utils/exchange_transfer_simulator.ts b/packages/0x.js/src/utils/exchange_transfer_simulator.ts
index 662cd210c..9a920c643 100644
--- a/packages/0x.js/src/utils/exchange_transfer_simulator.ts
+++ b/packages/0x.js/src/utils/exchange_transfer_simulator.ts
@@ -1,9 +1,10 @@
+import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store';
-import { BlockParamLiteral, ExchangeContractErrs, TradeSide, TransferType } from '../types';
+import { ExchangeContractErrs, TradeSide, TransferType } from '../types';
enum FailureReason {
Balance = 'balance',
diff --git a/packages/0x.js/test/exchange_transfer_simulator_test.ts b/packages/0x.js/test/exchange_transfer_simulator_test.ts
index e85a1640f..ba0ee9059 100644
--- a/packages/0x.js/test/exchange_transfer_simulator_test.ts
+++ b/packages/0x.js/test/exchange_transfer_simulator_test.ts
@@ -1,9 +1,10 @@
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
+import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import { ExchangeContractErrs, Token, ZeroEx } from '../src';
-import { BlockParamLiteral, TradeSide, TransferType } from '../src/types';
+import { TradeSide, TransferType } from '../src/types';
import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator';
import { chaiSetup } from './utils/chai_setup';
diff --git a/packages/0x.js/test/exchange_wrapper_test.ts b/packages/0x.js/test/exchange_wrapper_test.ts
index 044298601..325426438 100644
--- a/packages/0x.js/test/exchange_wrapper_test.ts
+++ b/packages/0x.js/test/exchange_wrapper_test.ts
@@ -1,4 +1,5 @@
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
+import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
@@ -18,7 +19,7 @@ import {
Token,
ZeroEx,
} from '../src';
-import { BlockParamLiteral, DoneCallback } from '../src/types';
+import { DoneCallback } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
diff --git a/packages/0x.js/test/order_validation_test.ts b/packages/0x.js/test/order_validation_test.ts
index 934e2e51f..b3dc42396 100644
--- a/packages/0x.js/test/order_validation_test.ts
+++ b/packages/0x.js/test/order_validation_test.ts
@@ -1,11 +1,12 @@
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
+import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as Sinon from 'sinon';
import * as Web3 from 'web3';
import { ExchangeContractErrs, SignedOrder, Token, ZeroEx, ZeroExError } from '../src';
-import { BlockParamLiteral, TradeSide, TransferType } from '../src/types';
+import { TradeSide, TransferType } from '../src/types';
import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator';
import { OrderValidationUtils } from '../src/utils/order_validation_utils';
diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json
index e6173e182..10bd7e712 100644
--- a/packages/abi-gen/package.json
+++ b/packages/abi-gen/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/abi-gen",
- "version": "0.1.6",
+ "version": "0.1.7",
"description": "Generate contract wrappers from ABI and handlebars templates",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -23,7 +23,7 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/abi-gen/README.md",
"dependencies": {
- "@0xproject/utils": "^0.2.4",
+ "@0xproject/utils": "^0.3.0",
"chalk": "^2.3.0",
"glob": "^7.1.2",
"handlebars": "^4.0.11",
@@ -34,7 +34,7 @@
"yargs": "^10.0.3"
},
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
+ "@0xproject/tslint-config": "^0.4.7",
"@types/glob": "^5.0.33",
"@types/handlebars": "^4.0.36",
"@types/mkdirp": "^0.5.1",
@@ -44,6 +44,6 @@
"shx": "^0.2.2",
"tslint": "5.8.0",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8"
+ "web3-typescript-typings": "^0.9.9"
}
}
diff --git a/packages/assert/package.json b/packages/assert/package.json
index dbee56d8b..b8da740d6 100644
--- a/packages/assert/package.json
+++ b/packages/assert/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/assert",
- "version": "0.0.15",
+ "version": "0.0.16",
"description": "Provides a standard way of performing type and schema validation across 0x projects",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
@@ -24,7 +24,7 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/assert/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
+ "@0xproject/tslint-config": "^0.4.7",
"@types/lodash": "^4.14.86",
"@types/mocha": "^2.2.42",
"@types/valid-url": "^1.0.2",
@@ -38,8 +38,8 @@
"typescript": "2.7.1"
},
"dependencies": {
- "@0xproject/json-schemas": "^0.7.7",
- "@0xproject/utils": "^0.2.4",
+ "@0xproject/json-schemas": "^0.7.8",
+ "@0xproject/utils": "^0.3.0",
"lodash": "^4.17.4",
"valid-url": "^1.0.9"
}
diff --git a/packages/connect/package.json b/packages/connect/package.json
index d1f54f000..d892e2d04 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/connect",
- "version": "0.5.4",
+ "version": "0.5.5",
"description": "A javascript library for interacting with the standard relayer api",
"keywords": [
"connect",
@@ -37,16 +37,16 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/connect/README.md",
"dependencies": {
- "@0xproject/assert": "^0.0.15",
- "@0xproject/json-schemas": "^0.7.7",
- "@0xproject/utils": "^0.2.4",
+ "@0xproject/assert": "^0.0.16",
+ "@0xproject/json-schemas": "^0.7.8",
+ "@0xproject/utils": "^0.3.0",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.17.4",
"query-string": "^5.0.1",
"websocket": "^1.0.25"
},
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
+ "@0xproject/tslint-config": "^0.4.7",
"@types/fetch-mock": "^5.12.1",
"@types/lodash": "^4.14.86",
"@types/mocha": "^2.2.42",
@@ -65,6 +65,6 @@
"tslint": "5.8.0",
"typedoc": "~0.8.0",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8"
+ "web3-typescript-typings": "^0.9.9"
}
}
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index d5e352c5d..894a3e0a4 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "contracts",
- "version": "2.1.8",
+ "version": "2.1.9",
"description": "Smart contract components of 0x protocol",
"main": "index.js",
"directories": {
@@ -32,9 +32,9 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/contracts/README.md",
"devDependencies": {
- "@0xproject/dev-utils": "^0.0.9",
- "@0xproject/tslint-config": "^0.4.6",
- "@0xproject/types": "^0.1.8",
+ "@0xproject/dev-utils": "^0.0.10",
+ "@0xproject/tslint-config": "^0.4.7",
+ "@0xproject/types": "^0.1.9",
"@types/bluebird": "^3.5.3",
"@types/lodash": "^4.14.86",
"@types/node": "^8.0.53",
@@ -54,15 +54,15 @@
"types-bn": "^0.0.1",
"types-ethereumjs-util": "0xproject/types-ethereumjs-util",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8",
+ "web3-typescript-typings": "^0.9.9",
"yargs": "^10.0.3"
},
"dependencies": {
- "0x.js": "^0.31.1",
- "@0xproject/deployer": "^0.0.5",
- "@0xproject/json-schemas": "^0.7.7",
- "@0xproject/utils": "^0.2.4",
- "@0xproject/web3-wrapper": "^0.1.9",
+ "0x.js": "^0.32.0",
+ "@0xproject/deployer": "^0.0.6",
+ "@0xproject/json-schemas": "^0.7.8",
+ "@0xproject/utils": "^0.3.0",
+ "@0xproject/web3-wrapper": "^0.1.10",
"bluebird": "^3.5.0",
"bn.js": "^4.11.8",
"ethereumjs-abi": "^0.6.4",
diff --git a/packages/deployer/package.json b/packages/deployer/package.json
index 1a9495d24..49e0ec26a 100644
--- a/packages/deployer/package.json
+++ b/packages/deployer/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/deployer",
- "version": "0.0.5",
+ "version": "0.0.6",
"description": "Smart contract deployer of 0x protocol",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
@@ -31,11 +31,11 @@
"copyfiles": "^1.2.0",
"types-bn": "^0.0.1",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8"
+ "web3-typescript-typings": "^0.9.9"
},
"dependencies": {
- "@0xproject/utils": "^0.2.4",
- "@0xproject/web3-wrapper": "^0.1.9",
+ "@0xproject/utils": "^0.3.0",
+ "@0xproject/web3-wrapper": "^0.1.10",
"lodash": "^4.17.4",
"solc": "^0.4.18",
"web3": "^0.20.0",
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index 0c292c01f..51b33b7da 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/dev-utils",
- "version": "0.0.9",
+ "version": "0.0.10",
"description": "0x dev TS utils",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -20,8 +20,8 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/dev-utils/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
- "@0xproject/types": "^0.1.8",
+ "@0xproject/tslint-config": "^0.4.7",
+ "@0xproject/types": "^0.1.9",
"@types/lodash": "^4.14.86",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
@@ -31,7 +31,7 @@
"typescript": "2.7.1"
},
"dependencies": {
- "@0xproject/utils": "^0.2.4",
+ "@0xproject/utils": "^0.3.0",
"ethereumjs-util": "^5.1.2",
"lodash": "^4.17.4",
"request-promise-native": "^1.0.5",
diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json
index f7a291ec2..02a8c1994 100644
--- a/packages/json-schemas/package.json
+++ b/packages/json-schemas/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/json-schemas",
- "version": "0.7.7",
+ "version": "0.7.8",
"description": "0x-related json schemas",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
@@ -28,8 +28,8 @@
"lodash.values": "^4.3.0"
},
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
- "@0xproject/utils": "^0.2.4",
+ "@0xproject/tslint-config": "^0.4.7",
+ "@0xproject/utils": "^0.3.0",
"@types/lodash.foreach": "^4.5.3",
"@types/lodash.values": "^4.3.3",
"@types/mocha": "^2.2.42",
diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json
index 2ac81f2d3..cbc3daad2 100644
--- a/packages/monorepo-scripts/package.json
+++ b/packages/monorepo-scripts/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/monorepo-scripts",
- "version": "0.1.8",
+ "version": "0.1.9",
"private": true,
"description": "Helper scripts for the monorepo",
"scripts": {
@@ -20,7 +20,7 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/monorepo-scripts/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
+ "@0xproject/tslint-config": "^0.4.7",
"@types/glob": "^5.0.33",
"@types/node": "^8.0.53",
"shx": "^0.2.2",
diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md
index 0469150c0..908272406 100644
--- a/packages/subproviders/CHANGELOG.md
+++ b/packages/subproviders/CHANGELOG.md
@@ -1,6 +1,11 @@
# CHANGELOG
-## v0.4.0 - _January 28, 2017_
+## v0.4.1 - _Febuary 2, 2018_
+
+ * Added NonceTrackerSubprovider (#355)
+ * InjectedWeb3Subprovider accepts a Provider in the constructor, previously it was a Web3 object (#363)
+
+## v0.3.5 - _January 28, 2018_
* Return a transaction hash from `_sendTransactionAsync` (#303)
diff --git a/packages/subproviders/README.md b/packages/subproviders/README.md
index 78643ad55..0d8f85910 100644
--- a/packages/subproviders/README.md
+++ b/packages/subproviders/README.md
@@ -2,6 +2,8 @@
A few useful web3 subproviders including a LedgerSubprovider useful for adding Ledger Nano S support.
+We have written up a [Wiki](https://0xproject.com/wiki#Web3-Provider-Examples) article detailing some use cases of this subprovider package.
+
## Installation
```
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index 18ba247ea..7934ecb66 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/subproviders",
- "version": "0.3.5",
+ "version": "0.3.6",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"license": "Apache-2.0",
@@ -18,8 +18,8 @@
"test:integration": "run-s clean build run_mocha_integration"
},
"dependencies": {
- "@0xproject/assert": "^0.0.15",
- "@0xproject/utils": "^0.2.4",
+ "@0xproject/assert": "^0.0.16",
+ "@0xproject/utils": "^0.3.0",
"bn.js": "^4.11.8",
"es6-promisify": "^5.0.0",
"ethereumjs-tx": "^1.3.3",
@@ -32,8 +32,9 @@
"web3-provider-engine": "^13.0.1"
},
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
- "@0xproject/utils": "^0.2.4",
+ "@0xproject/tslint-config": "^0.4.7",
+ "@0xproject/types": "^0.1.9",
+ "@0xproject/utils": "^0.3.0",
"@types/lodash": "^4.14.86",
"@types/mocha": "^2.2.42",
"@types/node": "^8.0.53",
@@ -50,7 +51,7 @@
"types-bn": "^0.0.1",
"types-ethereumjs-util": "0xproject/types-ethereumjs-util",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8",
+ "web3-typescript-typings": "^0.9.9",
"webpack": "^3.1.0"
}
}
diff --git a/packages/subproviders/src/globals.d.ts b/packages/subproviders/src/globals.d.ts
index 53457fa24..6f344dcd3 100644
--- a/packages/subproviders/src/globals.d.ts
+++ b/packages/subproviders/src/globals.d.ts
@@ -13,7 +13,9 @@ declare module 'ethereumjs-tx' {
public r: Buffer;
public s: Buffer;
public v: Buffer;
+ public nonce: Buffer;
public serialize(): Buffer;
+ public getSenderAddress(): Buffer;
constructor(txParams: any);
}
export = EthereumTx;
@@ -97,6 +99,24 @@ declare module 'web3-provider-engine' {
}
export = Web3ProviderEngine;
}
+declare module 'web3-provider-engine/util/rpc-cache-utils' {
+ class ProviderEngineRpcUtils {
+ public static blockTagForPayload(payload: any): string | null;
+ }
+ export = ProviderEngineRpcUtils;
+}
+declare module 'web3-provider-engine/subproviders/fixture' {
+ import * as Web3 from 'web3';
+ class FixtureSubprovider {
+ constructor(staticResponses: any);
+ public handleRequest(
+ payload: Web3.JSONRPCRequestPayload,
+ next: () => void,
+ end: (err: Error | null, data?: any) => void,
+ ): void;
+ }
+ export = FixtureSubprovider;
+}
// hdkey declarations
declare module 'hdkey' {
diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts
index 720c4362f..67d52ee25 100644
--- a/packages/subproviders/src/index.ts
+++ b/packages/subproviders/src/index.ts
@@ -9,7 +9,8 @@ import { LedgerEthereumClient } from './types';
export { InjectedWeb3Subprovider } from './subproviders/injected_web3';
export { RedundantRPCSubprovider } from './subproviders/redundant_rpc';
export { LedgerSubprovider } from './subproviders/ledger';
-export { ECSignature, LedgerWalletSubprovider, LedgerCommunicationClient } from './types';
+export { NonceTrackerSubprovider } from './subproviders/nonce_tracker';
+export { ECSignature, LedgerWalletSubprovider, LedgerCommunicationClient, NonceSubproviderErrors } from './types';
/**
* A factory method for creating a LedgerEthereumClient usable in a browser context.
diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts
index bd29acb22..0d70180c4 100644
--- a/packages/subproviders/src/subproviders/injected_web3.ts
+++ b/packages/subproviders/src/subproviders/injected_web3.ts
@@ -1,17 +1,16 @@
import * as _ from 'lodash';
import Web3 = require('web3');
-import Web3ProviderEngine = require('web3-provider-engine');
/*
* This class implements the web3-provider-engine subprovider interface and forwards
* requests involving user accounts (getAccounts, sendTransaction, etc...) to the injected
- * web3 instance in their browser.
+ * provider instance in their browser.
* Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
*/
export class InjectedWeb3Subprovider {
private _injectedWeb3: Web3;
- constructor(injectedWeb3: Web3) {
- this._injectedWeb3 = injectedWeb3;
+ constructor(subprovider: Web3.Provider) {
+ this._injectedWeb3 = new Web3(subprovider);
}
public handleRequest(
payload: Web3.JSONRPCRequestPayload,
@@ -42,8 +41,10 @@ export class InjectedWeb3Subprovider {
}
}
// Required to implement this method despite not needing it for this subprovider
+ // The engine argument type should be Web3ProviderEngine, but we've decided to keep it as type any
+ // to remove the provider engine depdency given this method is a noop
// tslint:disable-next-line:prefer-function-over-method
- public setEngine(engine: Web3ProviderEngine) {
+ public setEngine(engine: any) {
// noop
}
}
diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts
index 7267a793e..5966a88bb 100644
--- a/packages/subproviders/src/subproviders/ledger.ts
+++ b/packages/subproviders/src/subproviders/ledger.ts
@@ -60,6 +60,8 @@ export class LedgerSubprovider extends Subprovider {
public setPathIndex(pathIndex: number) {
this._derivationPathIndex = pathIndex;
}
+ // Required to implement this public interface which doesn't conform to our linting rule.
+ // tslint:disable-next-line:async-suffix
public async handleRequest(
payload: Web3.JSONRPCRequestPayload,
next: () => void,
diff --git a/packages/subproviders/src/subproviders/nonce_tracker.ts b/packages/subproviders/src/subproviders/nonce_tracker.ts
new file mode 100644
index 000000000..d967d40f2
--- /dev/null
+++ b/packages/subproviders/src/subproviders/nonce_tracker.ts
@@ -0,0 +1,103 @@
+import * as _ from 'lodash';
+
+import EthereumTx = require('ethereumjs-tx');
+import ethUtil = require('ethereumjs-util');
+import providerEngineUtils = require('web3-provider-engine/util/rpc-cache-utils');
+
+import { BlockParamLiteral } from '@0xproject/types';
+
+import { ErrorCallback, JSONRPCPayload, NonceSubproviderErrors, OptionalNextCallback } from '../types';
+
+import { Subprovider } from './subprovider';
+
+// We do not export this since this is not our error, and we do not throw this error
+const NONCE_TOO_LOW_ERROR_MESSAGE = 'Transaction nonce is too low';
+/*
+ This class is heavily inspiried by the Web3ProviderEngine NonceSubprovider
+ We have added the additional feature of clearing any nonce balues when an error message
+ describes a nonce value being too low.
+*/
+export class NonceTrackerSubprovider extends Subprovider {
+ private _nonceCache: { [address: string]: string } = {};
+ private static _reconstructTransaction(payload: JSONRPCPayload): EthereumTx {
+ const raw = payload.params[0];
+ if (_.isUndefined(raw)) {
+ throw new Error(NonceSubproviderErrors.EmptyParametersFound);
+ }
+ const rawData = ethUtil.toBuffer(raw);
+ const transaction = new EthereumTx(rawData);
+ return transaction;
+ }
+ private static _determineAddress(payload: JSONRPCPayload): string {
+ let address: string;
+ switch (payload.method) {
+ case 'eth_getTransactionCount':
+ address = payload.params[0].toLowerCase();
+ return address;
+ case 'eth_sendRawTransaction':
+ const transaction = NonceTrackerSubprovider._reconstructTransaction(payload);
+ const addressRaw = transaction
+ .getSenderAddress()
+ .toString('hex')
+ .toLowerCase();
+ address = `0x${addressRaw}`;
+ return address;
+ default:
+ throw new Error(NonceSubproviderErrors.CannotDetermineAddressFromPayload);
+ }
+ }
+ // Required to implement this public interface which doesn't conform to our linting rule.
+ // tslint:disable-next-line:async-suffix
+ public async handleRequest(payload: JSONRPCPayload, next: OptionalNextCallback, end: ErrorCallback): Promise<void> {
+ switch (payload.method) {
+ case 'eth_getTransactionCount':
+ const requestDefaultBlock = providerEngineUtils.blockTagForPayload(payload);
+ if (requestDefaultBlock === BlockParamLiteral.Pending) {
+ const address = NonceTrackerSubprovider._determineAddress(payload);
+ const cachedResult = this._nonceCache[address];
+ if (!_.isUndefined(cachedResult)) {
+ return end(null, cachedResult);
+ } else {
+ return next((requestError: Error | null, requestResult: any, cb: any) => {
+ if (_.isNull(requestError)) {
+ this._nonceCache[address] = requestResult as string;
+ }
+ cb();
+ });
+ }
+ } else {
+ return next();
+ }
+ case 'eth_sendRawTransaction':
+ return next((sendTransactionError: Error | null, txResult: any, cb: any) => {
+ if (_.isNull(sendTransactionError)) {
+ this._handleSuccessfulTransaction(payload);
+ } else {
+ this._handleSendTransactionError(payload, sendTransactionError);
+ }
+ cb();
+ });
+ default:
+ return next();
+ }
+ }
+ private _handleSuccessfulTransaction(payload: JSONRPCPayload): void {
+ const address = NonceTrackerSubprovider._determineAddress(payload);
+ const transaction = NonceTrackerSubprovider._reconstructTransaction(payload);
+ // Increment the nonce from the previous successfully submitted transaction
+ let nonce = ethUtil.bufferToInt(transaction.nonce);
+ nonce++;
+ let nextHexNonce = nonce.toString(16);
+ if (nextHexNonce.length % 2) {
+ nextHexNonce = `0${nextHexNonce}`;
+ }
+ const nextPrefixedHexNonce = `0x${nextHexNonce}`;
+ this._nonceCache[address] = nextPrefixedHexNonce;
+ }
+ private _handleSendTransactionError(payload: JSONRPCPayload, err: Error): void {
+ const address = NonceTrackerSubprovider._determineAddress(payload);
+ if (this._nonceCache[address] && _.includes(err.message, NONCE_TOO_LOW_ERROR_MESSAGE)) {
+ delete this._nonceCache[address];
+ }
+ }
+}
diff --git a/packages/subproviders/src/subproviders/redundant_rpc.ts b/packages/subproviders/src/subproviders/redundant_rpc.ts
index a3cb463a8..5a94f93d7 100644
--- a/packages/subproviders/src/subproviders/redundant_rpc.ts
+++ b/packages/subproviders/src/subproviders/redundant_rpc.ts
@@ -35,6 +35,7 @@ export class RedundantRPCSubprovider extends Subprovider {
});
});
}
+ // Required to implement this public interface which doesn't conform to our linting rule.
// tslint:disable-next-line:async-suffix
public async handleRequest(
payload: JSONRPCPayload,
diff --git a/packages/subproviders/src/types.ts b/packages/subproviders/src/types.ts
index 3db8be943..65b7f6c8f 100644
--- a/packages/subproviders/src/types.ts
+++ b/packages/subproviders/src/types.ts
@@ -112,3 +112,11 @@ export enum LedgerSubproviderErrors {
SenderInvalidOrNotSupplied = 'SENDER_INVALID_OR_NOT_SUPPLIED',
MultipleOpenConnectionsDisallowed = 'MULTIPLE_OPEN_CONNECTIONS_DISALLOWED',
}
+
+export enum NonceSubproviderErrors {
+ EmptyParametersFound = 'EMPTY_PARAMETERS_FOUND',
+ CannotDetermineAddressFromPayload = 'CANNOT_DETERMINE_ADDRESS_FROM_PAYLOAD',
+}
+
+export type OptionalNextCallback = (callback?: (err: Error | null, result: any, cb: any) => void) => void;
+export type ErrorCallback = (err: Error | null, data?: any) => void;
diff --git a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts
new file mode 100644
index 000000000..e98d9023c
--- /dev/null
+++ b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts
@@ -0,0 +1,151 @@
+import * as chai from 'chai';
+import * as _ from 'lodash';
+import Web3ProviderEngine = require('web3-provider-engine');
+import FixtureSubprovider = require('web3-provider-engine/subproviders/fixture');
+
+import promisify = require('es6-promisify');
+import EthereumTx = require('ethereumjs-tx');
+
+import { NonceTrackerSubprovider } from '../../src';
+import { chaiSetup } from '../chai_setup';
+
+const expect = chai.expect;
+chaiSetup.configure();
+
+describe('NonceTrackerSubprovider', () => {
+ let provider: Web3ProviderEngine;
+ const getTransactionCountPayload = {
+ jsonrpc: '2.0',
+ method: 'eth_getTransactionCount',
+ params: ['0x0', 'pending'],
+ id: 1,
+ };
+ const sendTransactionPayload = {
+ jsonrpc: '2.0',
+ method: 'eth_sendRawTransaction',
+ params: [],
+ id: 1,
+ };
+ const txParams = [
+ '0x',
+ '0x09184e72a000',
+ '0x2710',
+ '0x0000000000000000000000000000000000000000',
+ '0x',
+ '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
+ '0x1c',
+ '0x5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab',
+ '0x5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13',
+ ];
+ function createFixtureSubprovider() {
+ let isFirstGetTransactionCount = true;
+ const fixedBlockNumberAndTransactionCountProvider = new FixtureSubprovider({
+ eth_getBlockByNumber: '0x01',
+ eth_getTransactionCount: (data: any, next: any, end: any) => {
+ // For testing caching we return different results on the second call
+ if (isFirstGetTransactionCount) {
+ isFirstGetTransactionCount = false;
+ end(null, '0x00');
+ } else {
+ end(null, '0x99');
+ }
+ },
+ });
+ return fixedBlockNumberAndTransactionCountProvider;
+ }
+ it('successfully caches the transaction count', async () => {
+ provider = new Web3ProviderEngine();
+ const nonceTrackerSubprovider = new NonceTrackerSubprovider();
+ provider.addProvider(nonceTrackerSubprovider);
+ provider.addProvider(createFixtureSubprovider());
+ provider.start();
+
+ const payload = { ...getTransactionCountPayload, params: ['0x0', 'pending'] };
+
+ const response = await promisify(provider.sendAsync, provider)(payload);
+ expect(response.result).to.be.eq('0x00');
+ const secondResponse = await promisify(provider.sendAsync, provider)(payload);
+ expect(secondResponse.result).to.be.eq('0x00');
+ });
+ it('does not cache the result for latest transaction count', async () => {
+ provider = new Web3ProviderEngine();
+ const nonceTrackerSubprovider = new NonceTrackerSubprovider();
+ provider.addProvider(nonceTrackerSubprovider);
+ provider.addProvider(createFixtureSubprovider());
+ provider.start();
+
+ const payload = { ...getTransactionCountPayload, params: ['0x0', 'latest'] };
+
+ const response = await promisify(provider.sendAsync, provider)(payload);
+ expect(response.result).to.be.eq('0x00');
+ const secondResponse = await promisify(provider.sendAsync, provider)(payload);
+ expect(secondResponse.result).to.be.eq('0x99');
+ });
+ it('clears the cache on a Nonce Too Low Error', async () => {
+ provider = new Web3ProviderEngine();
+ const nonceTrackerSubprovider = new NonceTrackerSubprovider();
+ provider.addProvider(nonceTrackerSubprovider);
+ provider.addProvider(createFixtureSubprovider());
+ provider.addProvider(
+ new FixtureSubprovider({
+ eth_sendRawTransaction: (data: any, next: any, end: any) => {
+ end(new Error('Transaction nonce is too low'));
+ },
+ }),
+ );
+ provider.start();
+
+ const noncePayload = {
+ ...getTransactionCountPayload,
+ params: ['0x1f36f546477cda21bf2296c50976f2740247906f', 'pending'],
+ };
+ const transaction = new EthereumTx(txParams);
+ const txPayload = {
+ ...sendTransactionPayload,
+ params: [transaction.serialize()],
+ };
+
+ const response = await promisify(provider.sendAsync, provider)(noncePayload);
+ expect(response.result).to.be.eq('0x00');
+ const secondResponse = await promisify(provider.sendAsync, provider)(noncePayload);
+ expect(secondResponse.result).to.be.eq('0x00');
+ try {
+ await promisify(provider.sendAsync, provider)(txPayload);
+ } catch (err) {
+ const thirdResponse = await promisify(provider.sendAsync, provider)(noncePayload);
+ expect(thirdResponse.result).to.be.eq('0x99');
+ }
+ });
+ it('increments the used nonce when a transaction successfully submits', async () => {
+ provider = new Web3ProviderEngine();
+ const nonceTrackerSubprovider = new NonceTrackerSubprovider();
+ provider.addProvider(nonceTrackerSubprovider);
+ provider.addProvider(createFixtureSubprovider());
+ provider.addProvider(
+ new FixtureSubprovider({
+ eth_sendRawTransaction: (data: any, next: any, end: any) => {
+ end(null);
+ },
+ }),
+ );
+ provider.start();
+
+ const noncePayload = {
+ ...getTransactionCountPayload,
+ params: ['0x1f36f546477cda21bf2296c50976f2740247906f', 'pending'],
+ };
+ const transaction = new EthereumTx(txParams);
+ const txPayload = {
+ ...sendTransactionPayload,
+ params: [transaction.serialize()],
+ };
+
+ const response = await promisify(provider.sendAsync, provider)(noncePayload);
+ expect(response.result).to.be.eq('0x00');
+ const secondResponse = await promisify(provider.sendAsync, provider)(noncePayload);
+ expect(secondResponse.result).to.be.eq('0x00');
+ await promisify(provider.sendAsync, provider)(txPayload);
+ const thirdResponse = await promisify(provider.sendAsync, provider)(noncePayload);
+ expect(thirdResponse.result).to.be.eq('0x01');
+ });
+});
diff --git a/packages/testnet-faucets/Dockerfile b/packages/testnet-faucets/Dockerfile
index 6d6ddc192..bd1dcc4a4 100644
--- a/packages/testnet-faucets/Dockerfile
+++ b/packages/testnet-faucets/Dockerfile
@@ -2,6 +2,11 @@ FROM node
WORKDIR /src
+# Ledger Provider (in the Subproviders package) requires node-hid at dependency install time
+# which compiles and expects certain USB developer library packages to be present
+RUN apt-get -qq update && apt-get install -y libhidapi-dev libusb-1.0-0-dev
+# Our fork of ledgerco disables requiring node-hid at run time if CIRCLECI is set to true
+ENV CIRCLECI=true
COPY package.json .
RUN npm i
RUN npm install forever -g
diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json
index c6e7faf02..7c61d123f 100644
--- a/packages/testnet-faucets/package.json
+++ b/packages/testnet-faucets/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0xproject/testnet-faucets",
- "version": "1.0.9",
+ "version": "1.0.10",
"description": "A faucet micro-service that dispenses test ERC20 tokens or Ether",
"main": "server.js",
"scripts": {
@@ -15,8 +15,9 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "0x.js": "^0.31.1",
- "@0xproject/utils": "^0.2.4",
+ "0x.js": "^0.32.0",
+ "@0xproject/utils": "^0.3.0",
+ "@0xproject/subproviders": "^0.3.5",
"body-parser": "^1.17.1",
"ethereumjs-tx": "^1.3.3",
"express": "^4.15.2",
@@ -26,7 +27,7 @@
"web3-provider-engine": "^13.0.1"
},
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
+ "@0xproject/tslint-config": "^0.4.7",
"@types/body-parser": "^1.16.1",
"@types/express": "^4.0.35",
"@types/lodash": "^4.14.86",
@@ -37,7 +38,7 @@
"source-map-loader": "^0.1.6",
"tslint": "5.8.0",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8",
+ "web3-typescript-typings": "^0.9.9",
"webpack": "^3.1.0",
"webpack-node-externals": "^1.6.0"
}
diff --git a/packages/testnet-faucets/src/ts/global.d.ts b/packages/testnet-faucets/src/ts/global.d.ts
index 97cd35680..41a2f3a8a 100644
--- a/packages/testnet-faucets/src/ts/global.d.ts
+++ b/packages/testnet-faucets/src/ts/global.d.ts
@@ -1,5 +1,4 @@
declare module 'rollbar';
-declare module 'web3-provider-engine';
declare module 'web3-provider-engine/subproviders/rpc';
declare module 'web3-provider-engine/subproviders/nonce-tracker';
declare module 'web3-provider-engine/subproviders/hooked-wallet';
@@ -24,3 +23,17 @@ declare module 'ethereumjs-tx' {
}
export = EthereumTx;
}
+
+/* tslint:disable */
+declare module 'web3-provider-engine' {
+ class Web3ProviderEngine {
+ public on(event: string, handler: () => void): void;
+ public send(payload: any): void;
+ public sendAsync(payload: any, callback: (error: any, response: any) => void): void;
+ public addProvider(provider: any): void;
+ public start(): void;
+ public stop(): void;
+ }
+ export = Web3ProviderEngine;
+}
+/* tslint:enable */
diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts
index bf5b3e81e..121112fd3 100644
--- a/packages/testnet-faucets/src/ts/handler.ts
+++ b/packages/testnet-faucets/src/ts/handler.ts
@@ -1,9 +1,9 @@
+import { NonceTrackerSubprovider } from '@0xproject/subproviders';
import { addressUtils } from '@0xproject/utils';
import * as express from 'express';
import * as _ from 'lodash';
import ProviderEngine = require('web3-provider-engine');
import HookedWalletSubprovider = require('web3-provider-engine/subproviders/hooked-wallet');
-import NonceSubprovider = require('web3-provider-engine/subproviders/nonce-tracker');
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
import { EtherRequestQueue } from './ether_request_queue';
@@ -96,7 +96,7 @@ export class Handler {
// tslint:disable-next-line:prefer-function-over-method
private _createProviderEngine(rpcUrl: string) {
const engine = new ProviderEngine();
- engine.addProvider(new NonceSubprovider());
+ engine.addProvider(new NonceTrackerSubprovider());
engine.addProvider(new HookedWalletSubprovider(idManagement));
engine.addProvider(
new RpcSubprovider({
diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json
index c2a8b0692..d48f17954 100644
--- a/packages/tslint-config/package.json
+++ b/packages/tslint-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/tslint-config",
- "version": "0.4.6",
+ "version": "0.4.7",
"description": "Lint rules related to 0xProject for TSLint",
"main": "tslint.json",
"scripts": {
diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md
index 899482c4c..e75d0ddcb 100644
--- a/packages/types/CHANGELOG.md
+++ b/packages/types/CHANGELOG.md
@@ -1,3 +1,5 @@
# CHANGELOG
## vx.x.x
+
+ * Added BlockLiteralParam and BlockParam, refactored out of 0x.js types. (#355)
diff --git a/packages/types/package.json b/packages/types/package.json
index 1fc8d52b9..6d8e93cfd 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/types",
- "version": "0.1.8",
+ "version": "0.1.9",
"description": "0x types",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -20,11 +20,11 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/types/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
+ "@0xproject/tslint-config": "^0.4.7",
"shx": "^0.2.2",
"tslint": "5.8.0",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8"
+ "web3-typescript-typings": "^0.9.9"
},
"dependencies": {
"bignumber.js": "~4.1.0",
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 7b53b52c4..cb17936f7 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -56,3 +56,13 @@ export enum SolidityTypes {
export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt {
logs: Array<LogWithDecodedArgs<DecodedLogArgs> | Web3.LogEntry>;
}
+
+// Earliest is omitted by design. It is simply an alias for the `0` constant and
+// is thus not very helpful. Moreover, this type is used in places that only accept
+// `latest` or `pending`.
+export enum BlockParamLiteral {
+ Latest = 'latest',
+ Pending = 'pending',
+}
+
+export type BlockParam = BlockParamLiteral | number;
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index efee30dd1..b94e2ccee 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -1,6 +1,10 @@
# CHANGELOG
+## v0.3.0 - _February 5, 2018_
+
+ * Fix a bug related to event signature collisions (argument indexes aren't included in event signatures) in the abi_decoder. The decoder used to throw on unknown events with identical signatures as a known event (except indexes). (#366)
+
## v0.2.0 - _January 17, 2018_
-* Add `onError` parameter to `intervalUtils.setAsyncExcludingInterval` (#312)
-* Add `intervalUtils.setInterval` (#312)
+ * Add `onError` parameter to `intervalUtils.setAsyncExcludingInterval` (#312)
+ * Add `intervalUtils.setInterval` (#312)
diff --git a/packages/utils/package.json b/packages/utils/package.json
index e276d5e5a..2a434d79a 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/utils",
- "version": "0.2.4",
+ "version": "0.3.0",
"description": "0x TS utils",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -20,14 +20,14 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/utils/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
- "@0xproject/types": "^0.1.8",
+ "@0xproject/tslint-config": "^0.4.7",
+ "@0xproject/types": "^0.1.9",
"@types/lodash": "^4.14.86",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8"
+ "web3-typescript-typings": "^0.9.9"
},
"dependencies": {
"bignumber.js": "~4.1.0",
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index f96ee2edb..368973b1b 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -18,7 +18,7 @@ export class AbiDecoder {
return `0x${formatted}`;
}
constructor(abiArrays: Web3.AbiDefinition[][]) {
- _.map(abiArrays, this._addABI.bind(this));
+ _.forEach(abiArrays, this._addABI.bind(this));
}
// This method can only decode logs from the 0x & ERC20 smart contracts
public tryToDecodeLogOrNoop<ArgsType>(log: Web3.LogEntry): LogWithDecodedArgs<ArgsType> | RawLog {
@@ -36,9 +36,14 @@ export class AbiDecoder {
const dataTypes = _.map(nonIndexedInputs, input => input.type);
const decodedData = SolidityCoder.decodeParams(dataTypes, logData.slice('0x'.length));
- _.map(event.inputs, (param: Web3.EventParameter) => {
+ let failedToDecode = false;
+ _.forEach(event.inputs, (param: Web3.EventParameter) => {
// Indexed parameters are stored in topics. Non-indexed ones in decodedData
let value: BigNumber | string = param.indexed ? log.topics[topicsIndex++] : decodedData[dataIndex++];
+ if (_.isUndefined(value)) {
+ failedToDecode = true;
+ return;
+ }
if (param.type === SolidityTypes.Address) {
value = AbiDecoder._padZeros(new BigNumber(value).toString(16));
} else if (
@@ -51,11 +56,15 @@ export class AbiDecoder {
decodedParams[param.name] = value;
});
- return {
- ...log,
- event: event.name,
- args: decodedParams,
- };
+ if (failedToDecode) {
+ return log;
+ } else {
+ return {
+ ...log,
+ event: event.name,
+ args: decodedParams,
+ };
+ }
}
private _addABI(abiArray: Web3.AbiDefinition[]): void {
_.map(abiArray, (abi: Web3.AbiDefinition) => {
diff --git a/packages/web3-typescript-typings/package.json b/packages/web3-typescript-typings/package.json
index 651694e08..6f7106b56 100644
--- a/packages/web3-typescript-typings/package.json
+++ b/packages/web3-typescript-typings/package.json
@@ -1,6 +1,6 @@
{
"name": "web3-typescript-typings",
- "version": "0.9.8",
+ "version": "0.9.9",
"description": "Typescript type definitions for web3",
"main": "index.d.ts",
"types": "index.d.ts",
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index baae437a7..33d2fde20 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/web3-wrapper",
- "version": "0.1.9",
+ "version": "0.1.10",
"description": "Wraps around web3 and gives a nicer interface",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -20,17 +20,17 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/web3-wrapper/README.md",
"devDependencies": {
- "@0xproject/tslint-config": "^0.4.6",
- "@0xproject/types": "^0.1.8",
+ "@0xproject/tslint-config": "^0.4.7",
+ "@0xproject/types": "^0.1.9",
"@types/lodash": "^4.14.86",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8"
+ "web3-typescript-typings": "^0.9.9"
},
"dependencies": {
- "@0xproject/utils": "^0.2.4",
+ "@0xproject/utils": "^0.3.0",
"lodash": "^4.17.4",
"web3": "^0.20.0"
}
diff --git a/packages/website/package.json b/packages/website/package.json
index ad9fc3055..f7d0ab978 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -1,6 +1,6 @@
{
"name": "@0xproject/website",
- "version": "0.0.11",
+ "version": "0.0.12",
"private": true,
"description": "Website and 0x portal dapp",
"scripts": {
@@ -18,9 +18,9 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "0x.js": "^0.31.1",
- "@0xproject/subproviders": "^0.3.5",
- "@0xproject/utils": "^0.2.4",
+ "0x.js": "^0.32.0",
+ "@0xproject/subproviders": "^0.3.6",
+ "@0xproject/utils": "^0.3.0",
"accounting": "^0.4.1",
"basscss": "^8.0.3",
"blockies": "^0.0.2",
@@ -98,7 +98,7 @@
"style-loader": "0.13.x",
"tslint": "5.8.0",
"typescript": "2.7.1",
- "web3-typescript-typings": "^0.9.8",
+ "web3-typescript-typings": "^0.9.9",
"webpack": "^3.1.0",
"webpack-dev-middleware": "^1.10.0",
"webpack-dev-server": "^2.5.0"
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 71995e2cd..099efb405 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -100,7 +100,7 @@ export class Blockchain {
// We catch all requests involving a users account and send it to the injectedWeb3
// instance. All other requests go to the public hosted node.
provider = new ProviderEngine();
- provider.addProvider(new InjectedWeb3Subprovider(injectedWeb3));
+ provider.addProvider(new InjectedWeb3Subprovider(injectedWeb3.currentProvider));
provider.addProvider(new FilterSubprovider());
provider.addProvider(new RedundantRPCSubprovider(publicNodeUrlsIfExistsForNetworkId));
provider.start();
diff --git a/yarn.lock b/yarn.lock
index 7b9ea57c4..c0a67e9d8 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,6 +2,15 @@
# yarn lockfile v1
+"@0xproject/utils@^0.2.0":
+ version "0.2.4"
+ resolved "https://registry.yarnpkg.com/@0xproject/utils/-/utils-0.2.4.tgz#d84d0737f47730e5724a76797d30e716b587a0cf"
+ dependencies:
+ bignumber.js "~4.1.0"
+ js-sha3 "^0.7.0"
+ lodash "^4.17.4"
+ web3 "^0.20.0"
+
"@types/accounting@^0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@types/accounting/-/accounting-0.4.1.tgz#865d9f5694fd7c438fba34eb4bc82eec6f34cdd5"