Compare commits

...

24 Commits

Author SHA1 Message Date
Fabio Berger
1b35a6e3b5 Publish
- 0x.js@1.0.6
 - @0xproject/abi-gen@1.0.11
 - @0xproject/assert@1.0.11
 - @0xproject/asset-buyer@1.0.1
 - @0xproject/base-contract@2.0.5
 - @0xproject/connect@2.0.4
 - @0xproject/contract-wrappers@2.0.0
 - contracts@2.1.47
 - @0xproject/dev-utils@1.0.10
 - ethereum-types@1.0.8
 - @0xproject/fill-scenarios@1.0.5
 - @0xproject/json-schemas@1.0.4
 - @0xproject/metacoin@0.0.21
 - @0xproject/migrations@1.0.12
 - @0xproject/order-utils@1.0.5
 - @0xproject/order-watcher@2.0.0
 - @0xproject/react-docs@1.0.11
 - @0xproject/react-shared@1.0.12
 - @0xproject/sol-compiler@1.1.5
 - @0xproject/sol-cov@2.1.5
 - @0xproject/sol-resolver@1.0.11
 - @0xproject/sra-report@1.0.11
 - @0xproject/sra-spec@1.0.4
 - @0xproject/subproviders@2.0.5
 - @0xproject/testnet-faucets@1.0.49
 - @0xproject/types@1.1.1
 - @0xproject/typescript-typings@2.0.2
 - @0xproject/utils@1.0.11
 - @0xproject/web3-wrapper@3.0.1
 - @0xproject/website@0.0.52
2018-09-25 21:34:14 +01:00
Fabio Berger
900a8aee76 Updated CHANGELOGS 2018-09-25 21:33:55 +01:00
Fabio Berger
adf5acd5c4 Update yarn.lock 2018-09-25 21:23:06 +01:00
Fabio Berger
b40861747b Properly render function generic types that don't extend another type 2018-09-25 17:34:22 +01:00
Fabio Berger
b73df28454 Merge pull request #1087 from 0xProject/addTxHashToOrderState
Add transactionHash to OrderState and emit it from OrderWatcher
2018-09-25 16:37:24 +01:00
Fabio Berger
5afc739397 Add changelog entry 2018-09-25 16:37:08 +01:00
Fabio Berger
9eecf3683b Add transactionHash to OrderState and emit it from OrderWatcher subscription 2018-09-25 16:10:13 +01:00
Fabio Berger
7570f3db51 Merge pull request #1080 from 0xProject/upgradeBlockstream
Fix dropped events issue in Order-watcher and Contract-wrappers subscriptions
2018-09-25 14:59:37 +01:00
Fabio Berger
977d55c61b merge development 2018-09-25 13:07:14 +01:00
Fabio Berger
fc3acec669 Fix lint issues 2018-09-25 12:32:20 +01:00
Fabio Berger
a05530f821 Fix prettier 2018-09-25 12:06:37 +01:00
Fabio Berger
173b36c54c Fix prettier 2018-09-25 12:06:28 +01:00
Fabio Berger
55ca971186 Decode logs received from blockstream 2018-09-25 12:05:44 +01:00
Fabio Berger
284930eb58 Add missing type 2018-09-25 11:30:27 +01:00
Fabio Berger
902691e289 Update changelogs 2018-09-25 11:29:36 +01:00
Fabio Berger
0afe55f2ff Refactor blockstream integration to use the proper callback method interface 2018-09-25 11:20:09 +01:00
Fabio Berger
21910a7129 Add entry about newly exposed method 2018-09-25 11:02:49 +01:00
Fabio Berger
9c89d1e99b Expose method to send raw JSON RPC payloads 2018-09-25 10:45:11 +01:00
Fabio Berger
5e1a2bd972 Merge development 2018-09-24 15:53:34 +01:00
Fabio Berger
45dc2be083 Fix prettier 2018-09-21 14:53:25 +01:00
Fabio Berger
31f6fc065f Add changelog entries 2018-09-21 14:24:50 +01:00
Fabio Berger
b0484eafe3 Upgrade blockstream to version that supports fetching logs by blockHash, fixing reliability issues 2018-09-21 13:46:10 +01:00
Fabio Berger
1b799e98e8 Add blockHash to FilterObject now that EIP234 is supported 2018-09-21 13:45:06 +01:00
Fabio Berger
e6840c60c7 Add assertion that one cannot specify both blockHash & fromBlock/toBlock to getLogsAsync 2018-09-21 13:43:06 +01:00
95 changed files with 825 additions and 348 deletions

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.5", "version": "1.0.5",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.6 - _September 25, 2018_
* Dependencies updated
## v1.0.5 - _September 25, 2018_ ## v1.0.5 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "0x.js", "name": "0x.js",
"version": "1.0.5", "version": "1.0.6",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -41,9 +41,9 @@
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"devDependencies": { "devDependencies": {
"@0xproject/abi-gen": "^1.0.10", "@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/migrations": "^1.0.11", "@0xproject/migrations": "^1.0.12",
"@0xproject/monorepo-scripts": "^1.0.9", "@0xproject/monorepo-scripts": "^1.0.9",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
@@ -73,17 +73,17 @@
"webpack": "^3.1.0" "webpack": "^3.1.0"
}, },
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/base-contract": "^2.0.4", "@0xproject/base-contract": "^2.0.5",
"@0xproject/contract-wrappers": "^1.0.5", "@0xproject/contract-wrappers": "^2.0.0",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/order-watcher": "^1.0.5", "@0xproject/order-watcher": "^2.0.0",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethers": "3.0.22", "ethers": "3.0.22",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"web3-provider-engine": "14.0.6" "web3-provider-engine": "14.0.6"

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.10", "version": "1.0.10",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.11 - _September 25, 2018_
* Dependencies updated
## v1.0.10 - _September 25, 2018_ ## v1.0.10 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/abi-gen", "name": "@0xproject/abi-gen",
"version": "1.0.10", "version": "1.0.11",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -30,10 +30,10 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": { "dependencies": {
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"chalk": "^2.3.0", "chalk": "^2.3.0",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"glob": "^7.1.2", "glob": "^7.1.2",
"handlebars": "^4.0.11", "handlebars": "^4.0.11",
"lodash": "^4.17.5", "lodash": "^4.17.5",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.10", "version": "1.0.10",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.11 - _September 25, 2018_
* Dependencies updated
## v1.0.10 - _September 25, 2018_ ## v1.0.10 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/assert", "name": "@0xproject/assert",
"version": "1.0.10", "version": "1.0.11",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -44,9 +44,9 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"valid-url": "^1.0.9" "valid-url": "^1.0.9"
}, },

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.0", "version": "1.0.0",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.1 - _September 25, 2018_
* Dependencies updated
## v1.0.0 - _September 25, 2018_ ## v1.0.0 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/asset-buyer", "name": "@0xproject/asset-buyer",
"version": "1.0.0", "version": "1.0.1",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -36,17 +36,17 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/connect": "^2.0.3", "@0xproject/connect": "^2.0.4",
"@0xproject/contract-wrappers": "^1.0.5", "@0xproject/contract-wrappers": "^2.0.0",
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.6", "ethereum-types": "^1.0.8",
"lodash": "^4.17.10" "lodash": "^4.17.10"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "2.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "2.0.4", "version": "2.0.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v2.0.5 - _September 25, 2018_
* Dependencies updated
## v2.0.4 - _September 25, 2018_ ## v2.0.4 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/base-contract", "name": "@0xproject/base-contract",
"version": "2.0.4", "version": "2.0.5",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -40,10 +40,10 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethers": "3.0.22", "ethers": "3.0.22",
"lodash": "^4.17.5" "lodash": "^4.17.5"
}, },

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "2.0.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"version": "2.0.3", "version": "2.0.3",
"changes": [ "changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v2.0.4 - _September 25, 2018_
* Dependencies updated
## v2.0.3 - _September 25, 2018_ ## v2.0.3 - _September 25, 2018_
* Import SRA-related types from @0xproject/types (#1085) * Import SRA-related types from @0xproject/types (#1085)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/connect", "name": "@0xproject/connect",
"version": "2.0.3", "version": "2.0.4",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -43,12 +43,12 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"query-string": "^5.0.1", "query-string": "^5.0.1",
"sinon": "^4.0.0", "sinon": "^4.0.0",

View File

@@ -1,21 +1,37 @@
[ [
{ {
"timestamp": 1537875740, "version": "2.0.0",
"changes": [
{
"note":
"Fixes dropped events in subscriptions by fetching logs by blockHash instead of blockNumber. Support for fetching by blockHash was added in Geth > v1.8.13 and Parity > v2.1.0. Infura works too.",
"pr": 1080
},
{
"note":
"Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it",
"pr": 1080
}
],
"timestamp": 1537907159
},
{
"version": "1.0.5", "version": "1.0.5",
"changes": [ "changes": [
{ {
"note": "Dependencies updated" "note": "Dependencies updated"
} }
] ],
"timestamp": 1537875740
}, },
{ {
"timestamp": 1537541580,
"version": "1.0.4", "version": "1.0.4",
"changes": [ "changes": [
{ {
"note": "Dependencies updated" "note": "Dependencies updated"
} }
] ],
"timestamp": 1537541580
}, },
{ {
"version": "1.0.3", "version": "1.0.3",

View File

@@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v2.0.0 - _September 25, 2018_
* Fixes dropped events in subscriptions by fetching logs by blockHash instead of blockNumber. Support for fetching by blockHash was added in Geth > v1.8.13 and Parity > v2.1.0. Infura works too. (#1080)
* Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it (#1080)
## v1.0.5 - _September 25, 2018_ ## v1.0.5 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/contract-wrappers", "name": "@0xproject/contract-wrappers",
"version": "1.0.5", "version": "2.0.0",
"description": "Smart TS wrappers for 0x smart contracts", "description": "Smart TS wrappers for 0x smart contracts",
"keywords": [ "keywords": [
"0xproject", "0xproject",
@@ -41,10 +41,10 @@
"node": ">=6.0.0" "node": ">=6.0.0"
}, },
"devDependencies": { "devDependencies": {
"@0xproject/abi-gen": "^1.0.10", "@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/migrations": "^1.0.11", "@0xproject/migrations": "^1.0.12",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42", "@types/mocha": "^2.2.42",
@@ -72,17 +72,17 @@
"web3-provider-engine": "14.0.6" "web3-provider-engine": "14.0.6"
}, },
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/base-contract": "^2.0.4", "@0xproject/base-contract": "^2.0.5",
"@0xproject/fill-scenarios": "^1.0.4", "@0xproject/fill-scenarios": "^1.0.5",
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-blockstream": "5.0.0", "ethereumjs-blockstream": "6.0.0",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"ethers": "3.0.22", "ethers": "3.0.22",
"js-sha3": "^0.7.0", "js-sha3": "^0.7.0",

View File

@@ -1,14 +1,14 @@
import { AbiDecoder, intervalUtils, logUtils } from '@0xproject/utils'; import { AbiDecoder, intervalUtils, logUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { marshaller, Web3Wrapper } from '@0xproject/web3-wrapper';
import { import {
BlockParamLiteral, BlockParamLiteral,
BlockWithoutTransactionData,
ContractAbi, ContractAbi,
ContractArtifact, ContractArtifact,
FilterObject, FilterObject,
LogEntry, LogEntry,
LogWithDecodedArgs, LogWithDecodedArgs,
RawLog, RawLog,
RawLogEntry,
} from 'ethereum-types'; } from 'ethereum-types';
import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream';
import * as _ from 'lodash'; import * as _ from 'lodash';
@@ -158,7 +158,8 @@ export abstract class ContractWrapper {
return addressIfExists; return addressIfExists;
} }
} }
private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, log: LogEntry): void { private _onLogStateChanged<ArgsType extends ContractEventArgs>(isRemoved: boolean, rawLog: RawLogEntry): void {
const log: LogEntry = marshaller.unmarshalLog(rawLog);
_.forEach(this._filters, (filter: FilterObject, filterToken: string) => { _.forEach(this._filters, (filter: FilterObject, filterToken: string) => {
if (filterUtils.matchesFilter(log, filter)) { if (filterUtils.matchesFilter(log, filter)) {
const decodedLog = this._tryToDecodeLogOrNoop(log) as LogWithDecodedArgs<ArgsType>; const decodedLog = this._tryToDecodeLogOrNoop(log) as LogWithDecodedArgs<ArgsType>;
@@ -175,8 +176,8 @@ export abstract class ContractWrapper {
throw new Error(ContractWrappersError.SubscriptionAlreadyPresent); throw new Error(ContractWrappersError.SubscriptionAlreadyPresent);
} }
this._blockAndLogStreamerIfExists = new BlockAndLogStreamer( this._blockAndLogStreamerIfExists = new BlockAndLogStreamer(
this._getBlockOrNullAsync.bind(this), this._blockstreamGetBlockOrNullAsync.bind(this),
this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper), this._blockstreamGetLogsAsync.bind(this),
ContractWrapper._onBlockAndLogStreamerError.bind(this, isVerbose), ContractWrapper._onBlockAndLogStreamerError.bind(this, isVerbose),
); );
const catchAllLogFilter = {}; const catchAllLogFilter = {};
@@ -196,12 +197,30 @@ export abstract class ContractWrapper {
); );
} }
// This method only exists in order to comply with the expected interface of Blockstream's constructor // This method only exists in order to comply with the expected interface of Blockstream's constructor
private async _getBlockOrNullAsync(): Promise<BlockWithoutTransactionData | null> { private async _blockstreamGetBlockOrNullAsync(hash: string): Promise<Block | null> {
const blockIfExists = await this._web3Wrapper.getBlockIfExistsAsync.bind(this._web3Wrapper); const shouldIncludeTransactionData = false;
if (_.isUndefined(blockIfExists)) { const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({
return null; method: 'eth_getBlockByHash',
params: [hash, shouldIncludeTransactionData],
});
return blockOrNull;
} }
return blockIfExists; // This method only exists in order to comply with the expected interface of Blockstream's constructor
private async _blockstreamGetLatestBlockOrNullAsync(): Promise<Block | null> {
const shouldIncludeTransactionData = false;
const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({
method: 'eth_getBlockByNumber',
params: [BlockParamLiteral.Latest, shouldIncludeTransactionData],
});
return blockOrNull;
}
// This method only exists in order to comply with the expected interface of Blockstream's constructor
private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise<RawLogEntry[]> {
const logs = await this._web3Wrapper.sendRawPayloadAsync<RawLogEntry[]>({
method: 'eth_getLogs',
params: [filterOptions],
});
return logs as RawLogEntry[];
} }
// HACK: This should be a package-scoped method (which doesn't exist in TS) // HACK: This should be a package-scoped method (which doesn't exist in TS)
// We don't want this method available in the public interface for all classes // We don't want this method available in the public interface for all classes
@@ -221,14 +240,14 @@ export abstract class ContractWrapper {
delete this._blockAndLogStreamerIfExists; delete this._blockAndLogStreamerIfExists;
} }
private async _reconcileBlockAsync(): Promise<void> { private async _reconcileBlockAsync(): Promise<void> {
const latestBlockIfExists = await this._web3Wrapper.getBlockIfExistsAsync(BlockParamLiteral.Latest); const latestBlockOrNull = await this._blockstreamGetLatestBlockOrNullAsync();
if (_.isUndefined(latestBlockIfExists)) { if (_.isNull(latestBlockOrNull)) {
return; // noop return; // noop
} }
// We need to coerce to Block type cause Web3.Block includes types for mempool blocks // We need to coerce to Block type cause Web3.Block includes types for mempool blocks
if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { if (!_.isUndefined(this._blockAndLogStreamerIfExists)) {
// If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined
await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockIfExists as any) as Block); await this._blockAndLogStreamerIfExists.reconcileNewBlock(latestBlockOrNull);
} }
} }
} }

View File

@@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"name": "contracts", "name": "contracts",
"version": "2.1.46", "version": "2.1.47",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -45,11 +45,11 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md",
"devDependencies": { "devDependencies": {
"@0xproject/abi-gen": "^1.0.10", "@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/sol-compiler": "^1.1.4", "@0xproject/sol-compiler": "^1.1.5",
"@0xproject/sol-cov": "^2.1.4", "@0xproject/sol-cov": "^2.1.5",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@types/bn.js": "^4.11.0", "@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0", "@types/ethereumjs-abi": "^0.6.0",
@@ -72,15 +72,15 @@
"yargs": "^10.0.3" "yargs": "^10.0.3"
}, },
"dependencies": { "dependencies": {
"@0xproject/base-contract": "^2.0.4", "@0xproject/base-contract": "^2.0.5",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"@types/js-combinatorics": "^0.5.29", "@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8", "bn.js": "^4.11.8",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-abi": "0.6.5", "ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"ethers": "3.0.22", "ethers": "3.0.22",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.9", "version": "1.0.9",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.10 - _September 25, 2018_
* Dependencies updated
## v1.0.9 - _September 25, 2018_ ## v1.0.9 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/dev-utils", "name": "@0xproject/dev-utils",
"version": "1.0.9", "version": "1.0.10",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -42,12 +42,12 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"lodash": "^4.17.5" "lodash": "^4.17.5"
}, },
"publishConfig": { "publishConfig": {

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537541580, "timestamp": 1537541580,
"version": "1.0.7", "version": "1.0.7",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.8 - _September 25, 2018_
* Dependencies updated
## v1.0.7 - _September 21, 2018_ ## v1.0.7 - _September 21, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "ethereum-types", "name": "ethereum-types",
"version": "1.0.7", "version": "1.0.8",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },

View File

@@ -181,6 +181,7 @@ export interface CallData extends CallTxDataBase {
export interface FilterObject { export interface FilterObject {
fromBlock?: number | string; fromBlock?: number | string;
toBlock?: number | string; toBlock?: number | string;
blockHash?: string;
address?: string; address?: string;
topics?: LogTopic[]; topics?: LogTopic[];
} }

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.4", "version": "1.0.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.5 - _September 25, 2018_
* Dependencies updated
## v1.0.4 - _September 25, 2018_ ## v1.0.4 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/fill-scenarios", "name": "@0xproject/fill-scenarios",
"version": "1.0.4", "version": "1.0.5",
"description": "0x order fill scenario generator", "description": "0x order fill scenario generator",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
@@ -26,7 +26,7 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md",
"devDependencies": { "devDependencies": {
"@0xproject/abi-gen": "^1.0.10", "@0xproject/abi-gen": "^1.0.11",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
"copyfiles": "^2.0.0", "copyfiles": "^2.0.0",
@@ -37,13 +37,13 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/base-contract": "^2.0.4", "@0xproject/base-contract": "^2.0.5",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethers": "3.0.22", "ethers": "3.0.22",
"lodash": "^4.17.5" "lodash": "^4.17.5"
}, },

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.3", "version": "1.0.3",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.4 - _September 25, 2018_
* Dependencies updated
## v1.0.3 - _September 25, 2018_ ## v1.0.3 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/json-schemas", "name": "@0xproject/json-schemas",
"version": "1.0.3", "version": "1.0.4",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -38,14 +38,14 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md",
"dependencies": { "dependencies": {
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@types/node": "*", "@types/node": "*",
"jsonschema": "^1.2.0", "jsonschema": "^1.2.0",
"lodash.values": "^4.3.0" "lodash.values": "^4.3.0"
}, },
"devDependencies": { "devDependencies": {
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@types/lodash.foreach": "^4.5.3", "@types/lodash.foreach": "^4.5.3",
"@types/lodash.values": "^4.3.3", "@types/lodash.values": "^4.3.3",
"@types/mocha": "^2.2.42", "@types/mocha": "^2.2.42",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/metacoin", "name": "@0xproject/metacoin",
"version": "0.0.20", "version": "0.0.21",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -28,25 +28,25 @@
"author": "", "author": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@0xproject/abi-gen": "^1.0.10", "@0xproject/abi-gen": "^1.0.11",
"@0xproject/base-contract": "^2.0.4", "@0xproject/base-contract": "^2.0.5",
"@0xproject/sol-cov": "^2.1.4", "@0xproject/sol-cov": "^2.1.5",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"@types/mocha": "^5.2.2", "@types/mocha": "^5.2.2",
"copyfiles": "^2.0.0", "copyfiles": "^2.0.0",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethers": "3.0.22", "ethers": "3.0.22",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"run-s": "^0.0.0" "run-s": "^0.0.0"
}, },
"devDependencies": { "devDependencies": {
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/sol-compiler": "^1.1.4", "@0xproject/sol-compiler": "^1.1.5",
"chai": "^4.0.1", "chai": "^4.0.1",
"chai-as-promised": "^7.1.0", "chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1", "chai-bignumber": "^2.0.1",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.11", "version": "1.0.11",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.12 - _September 25, 2018_
* Dependencies updated
## v1.0.11 - _September 25, 2018_ ## v1.0.11 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/migrations", "name": "@0xproject/migrations",
"version": "1.0.11", "version": "1.0.12",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -30,10 +30,10 @@
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"devDependencies": { "devDependencies": {
"@0xproject/abi-gen": "^1.0.10", "@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@types/yargs": "^10.0.0", "@types/yargs": "^10.0.0",
"copyfiles": "^2.0.0", "copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0", "make-promises-safe": "^1.1.0",
@@ -44,15 +44,15 @@
"yargs": "^10.0.3" "yargs": "^10.0.3"
}, },
"dependencies": { "dependencies": {
"@0xproject/base-contract": "^2.0.4", "@0xproject/base-contract": "^2.0.5",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/sol-compiler": "^1.1.4", "@0xproject/sol-compiler": "^1.1.5",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-app-eth": "^4.3.0",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethers": "3.0.22", "ethers": "3.0.22",
"lodash": "^4.17.5" "lodash": "^4.17.5"
}, },

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.4", "version": "1.0.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.5 - _September 25, 2018_
* Dependencies updated
## v1.0.4 - _September 25, 2018_ ## v1.0.4 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/order-utils", "name": "@0xproject/order-utils",
"version": "1.0.4", "version": "1.0.5",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -38,7 +38,7 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md",
"devDependencies": { "devDependencies": {
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@types/bn.js": "^4.11.0", "@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
@@ -57,16 +57,16 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/base-contract": "^2.0.4", "@0xproject/base-contract": "^2.0.5",
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"@types/node": "*", "@types/node": "*",
"bn.js": "^4.11.8", "bn.js": "^4.11.8",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-abi": "0.6.5", "ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"ethers": "3.0.22", "ethers": "3.0.22",

View File

@@ -114,7 +114,7 @@ export class OrderStateUtils {
* @return State relevant to the signedOrder, as well as whether the signedOrder is "valid". * @return State relevant to the signedOrder, as well as whether the signedOrder is "valid".
* Validity is defined as a non-zero amount of the order can still be filled. * Validity is defined as a non-zero amount of the order can still be filled.
*/ */
public async getOpenOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> { public async getOpenOrderStateAsync(signedOrder: SignedOrder, transactionHash?: string): Promise<OrderState> {
const orderRelevantState = await this.getOpenOrderRelevantStateAsync(signedOrder); const orderRelevantState = await this.getOpenOrderRelevantStateAsync(signedOrder);
const orderHash = orderHashUtils.getOrderHashHex(signedOrder); const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash); const isOrderCancelled = await this._orderFilledCancelledFetcher.isOrderCancelledAsync(orderHash);
@@ -134,6 +134,7 @@ export class OrderStateUtils {
isValid: true, isValid: true,
orderHash, orderHash,
orderRelevantState, orderRelevantState,
transactionHash,
}; };
return orderState; return orderState;
} else { } else {
@@ -141,6 +142,7 @@ export class OrderStateUtils {
isValid: false, isValid: false,
orderHash, orderHash,
error: orderValidationResult.error, error: orderValidationResult.error,
transactionHash,
}; };
return orderState; return orderState;
} }

View File

@@ -120,5 +120,25 @@ describe('OrderStateUtils', () => {
const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder); const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder);
expect(orderState.isValid).to.eq(false); expect(orderState.isValid).to.eq(false);
}); });
it('should include the transactionHash in orderState if supplied in method invocation', async () => {
const makerAssetAmount = new BigNumber(10);
const takerAssetAmount = new BigNumber(10000000000000000);
const takerBalance = takerAssetAmount;
const orderFilledAmount = new BigNumber(0);
const mockBalanceFetcher = buildMockBalanceFetcher(takerBalance);
const mockOrderFilledFetcher = buildMockOrderFilledFetcher(orderFilledAmount);
const [signedOrder] = testOrderFactory.generateTestSignedOrders(
{
makerAssetAmount,
takerAssetAmount,
},
1,
);
const orderStateUtils = new OrderStateUtils(mockBalanceFetcher, mockOrderFilledFetcher);
const transactionHash = '0xdeadbeef';
const orderState = await orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash);
expect(orderState.transactionHash).to.eq(transactionHash);
});
}); });
}); });

View File

@@ -1,21 +1,42 @@
[ [
{ {
"timestamp": 1537875740, "version": "2.0.0",
"changes": [
{
"note":
"Fixes dropped events issue by fetching logs by blockHash instead of blockNumber. Support for fetching by blockHash was added in Geth > v1.8.13 and Parity > v2.1.0. Infura works too.",
"pr": 1080
},
{
"note":
"Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it",
"pr": 1080
},
{
"note":
"Add `transactionHash` to `OrderState` emitted by `OrderWatcher` subscriptions if the order's state change originated from a transaction.",
"pr": 1087
}
],
"timestamp": 1537907159
},
{
"version": "1.0.5", "version": "1.0.5",
"changes": [ "changes": [
{ {
"note": "Dependencies updated" "note": "Dependencies updated"
} }
] ],
"timestamp": 1537875740
}, },
{ {
"timestamp": 1537541580,
"version": "1.0.4", "version": "1.0.4",
"changes": [ "changes": [
{ {
"note": "Dependencies updated" "note": "Dependencies updated"
} }
] ],
"timestamp": 1537541580
}, },
{ {
"version": "1.0.3", "version": "1.0.3",

View File

@@ -5,6 +5,12 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v2.0.0 - _September 25, 2018_
* Fixes dropped events issue by fetching logs by blockHash instead of blockNumber. Support for fetching by blockHash was added in Geth > v1.8.13 and Parity > v2.1.0. Infura works too. (#1080)
* Fix misunderstanding about blockstream interface callbacks and pass the raw JSON RPC responses to it (#1080)
* Add `transactionHash` to `OrderState` emitted by `OrderWatcher` subscriptions if the order's state change originated from a transaction. (#1087)
## v1.0.5 - _September 25, 2018_ ## v1.0.5 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/order-watcher", "name": "@0xproject/order-watcher",
"version": "1.0.5", "version": "2.0.0",
"description": "An order watcher daemon that watches for order validity", "description": "An order watcher daemon that watches for order validity",
"keywords": [ "keywords": [
"0x", "0x",
@@ -42,9 +42,9 @@
"node": ">=6.0.0" "node": ">=6.0.0"
}, },
"devDependencies": { "devDependencies": {
"@0xproject/abi-gen": "^1.0.10", "@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/migrations": "^1.0.11", "@0xproject/migrations": "^1.0.12",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@types/bintrees": "^1.0.2", "@types/bintrees": "^1.0.2",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
@@ -70,19 +70,19 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/base-contract": "^2.0.4", "@0xproject/base-contract": "^2.0.5",
"@0xproject/contract-wrappers": "^1.0.5", "@0xproject/contract-wrappers": "^2.0.0",
"@0xproject/fill-scenarios": "^1.0.4", "@0xproject/fill-scenarios": "^1.0.5",
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"bintrees": "^1.0.2", "bintrees": "^1.0.2",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-blockstream": "5.0.0", "ethereumjs-blockstream": "6.0.0",
"ethers": "3.0.22", "ethers": "3.0.22",
"lodash": "^4.17.5" "lodash": "^4.17.5"
}, },

View File

@@ -1,6 +1,6 @@
import { intervalUtils, logUtils } from '@0xproject/utils'; import { intervalUtils, logUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { marshaller, Web3Wrapper } from '@0xproject/web3-wrapper';
import { BlockParamLiteral, BlockWithoutTransactionData, LogEntry, Provider } from 'ethereum-types'; import { BlockParamLiteral, FilterObject, LogEntry, Provider, RawLogEntry } from 'ethereum-types';
import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream';
import * as _ from 'lodash'; import * as _ from 'lodash';
@@ -20,7 +20,6 @@ enum LogEventState {
*/ */
export class EventWatcher { export class EventWatcher {
private readonly _web3Wrapper: Web3Wrapper; private readonly _web3Wrapper: Web3Wrapper;
private readonly _stateLayer: BlockParamLiteral;
private readonly _isVerbose: boolean; private readonly _isVerbose: boolean;
private _blockAndLogStreamerIfExists: BlockAndLogStreamer<Block, Log> | undefined; private _blockAndLogStreamerIfExists: BlockAndLogStreamer<Block, Log> | undefined;
private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer; private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer;
@@ -35,7 +34,6 @@ export class EventWatcher {
) { ) {
this._isVerbose = isVerbose; this._isVerbose = isVerbose;
this._web3Wrapper = new Web3Wrapper(provider); this._web3Wrapper = new Web3Wrapper(provider);
this._stateLayer = stateLayer;
this._pollingIntervalMs = _.isUndefined(pollingIntervalIfExistsMs) this._pollingIntervalMs = _.isUndefined(pollingIntervalIfExistsMs)
? DEFAULT_EVENT_POLLING_INTERVAL_MS ? DEFAULT_EVENT_POLLING_INTERVAL_MS
: pollingIntervalIfExistsMs; : pollingIntervalIfExistsMs;
@@ -62,8 +60,8 @@ export class EventWatcher {
throw new Error(OrderWatcherError.SubscriptionAlreadyPresent); throw new Error(OrderWatcherError.SubscriptionAlreadyPresent);
} }
this._blockAndLogStreamerIfExists = new BlockAndLogStreamer( this._blockAndLogStreamerIfExists = new BlockAndLogStreamer(
this._getBlockOrNullAsync.bind(this), this._blockstreamGetBlockOrNullAsync.bind(this),
this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper), this._blockstreamGetLogsAsync.bind(this),
this._onBlockAndLogStreamerError.bind(this), this._onBlockAndLogStreamerError.bind(this),
); );
const catchAllLogFilter = {}; const catchAllLogFilter = {};
@@ -83,12 +81,30 @@ export class EventWatcher {
); );
} }
// This method only exists in order to comply with the expected interface of Blockstream's constructor // This method only exists in order to comply with the expected interface of Blockstream's constructor
private async _getBlockOrNullAsync(): Promise<BlockWithoutTransactionData | null> { private async _blockstreamGetBlockOrNullAsync(hash: string): Promise<Block | null> {
const blockIfExists = await this._web3Wrapper.getBlockIfExistsAsync.bind(this._web3Wrapper); const shouldIncludeTransactionData = false;
if (_.isUndefined(blockIfExists)) { const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({
return null; method: 'eth_getBlockByHash',
params: [hash, shouldIncludeTransactionData],
});
return blockOrNull;
} }
return blockIfExists; // This method only exists in order to comply with the expected interface of Blockstream's constructor
private async _blockstreamGetLatestBlockOrNullAsync(): Promise<Block | null> {
const shouldIncludeTransactionData = false;
const blockOrNull = await this._web3Wrapper.sendRawPayloadAsync<Block | null>({
method: 'eth_getBlockByNumber',
params: [BlockParamLiteral.Latest, shouldIncludeTransactionData],
});
return blockOrNull;
}
// This method only exists in order to comply with the expected interface of Blockstream's constructor
private async _blockstreamGetLogsAsync(filterOptions: FilterObject): Promise<RawLogEntry[]> {
const logs = await this._web3Wrapper.sendRawPayloadAsync<RawLogEntry[]>({
method: 'eth_getLogs',
params: [filterOptions],
});
return logs as RawLogEntry[];
} }
private _stopBlockAndLogStream(): void { private _stopBlockAndLogStream(): void {
if (_.isUndefined(this._blockAndLogStreamerIfExists)) { if (_.isUndefined(this._blockAndLogStreamerIfExists)) {
@@ -103,19 +119,20 @@ export class EventWatcher {
private async _onLogStateChangedAsync( private async _onLogStateChangedAsync(
callback: EventWatcherCallback, callback: EventWatcherCallback,
isRemoved: boolean, isRemoved: boolean,
log: LogEntry, rawLog: RawLogEntry,
): Promise<void> { ): Promise<void> {
const log: LogEntry = marshaller.unmarshalLog(rawLog);
await this._emitDifferencesAsync(log, isRemoved ? LogEventState.Removed : LogEventState.Added, callback); await this._emitDifferencesAsync(log, isRemoved ? LogEventState.Removed : LogEventState.Added, callback);
} }
private async _reconcileBlockAsync(): Promise<void> { private async _reconcileBlockAsync(): Promise<void> {
const latestBlockIfExists = await this._web3Wrapper.getBlockIfExistsAsync(this._stateLayer); const latestBlockOrNull = await this._blockstreamGetLatestBlockOrNullAsync();
if (_.isUndefined(latestBlockIfExists)) { if (_.isNull(latestBlockOrNull)) {
return; // noop return; // noop
} }
// We need to coerce to Block type cause Web3.Block includes types for mempool blocks // We need to coerce to Block type cause Web3.Block includes types for mempool blocks
if (!_.isUndefined(this._blockAndLogStreamerIfExists)) { if (!_.isUndefined(this._blockAndLogStreamerIfExists)) {
// If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined
await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlockIfExists as any) as Block); await this._blockAndLogStreamerIfExists.reconcileNewBlock(latestBlockOrNull);
} }
} }
private async _emitDifferencesAsync( private async _emitDifferencesAsync(

View File

@@ -275,6 +275,7 @@ export class OrderWatcher {
return; // noop return; // noop
} }
const decodedLog = (maybeDecodedLog as any) as LogWithDecodedArgs<ContractEventArgs>; const decodedLog = (maybeDecodedLog as any) as LogWithDecodedArgs<ContractEventArgs>;
const transactionHash = decodedLog.transactionHash;
switch (decodedLog.event) { switch (decodedLog.event) {
case ERC20TokenEvents.Approval: case ERC20TokenEvents.Approval:
case ERC721TokenEvents.Approval: { case ERC721TokenEvents.Approval: {
@@ -290,7 +291,7 @@ export class OrderWatcher {
args._owner, args._owner,
tokenAssetData, tokenAssetData,
); );
await this._emitRevalidateOrdersAsync(orderHashes); await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break; break;
} else { } else {
// ERC721 // ERC721
@@ -303,7 +304,7 @@ export class OrderWatcher {
args._owner, args._owner,
tokenAssetData, tokenAssetData,
); );
await this._emitRevalidateOrdersAsync(orderHashes); await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break; break;
} }
} }
@@ -322,7 +323,7 @@ export class OrderWatcher {
args._from, args._from,
tokenAssetData, tokenAssetData,
); );
await this._emitRevalidateOrdersAsync(orderHashes); await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break; break;
} else { } else {
// ERC721 // ERC721
@@ -336,7 +337,7 @@ export class OrderWatcher {
args._from, args._from,
tokenAssetData, tokenAssetData,
); );
await this._emitRevalidateOrdersAsync(orderHashes); await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break; break;
} }
} }
@@ -350,7 +351,7 @@ export class OrderWatcher {
args._owner, args._owner,
tokenAddress, tokenAddress,
); );
await this._emitRevalidateOrdersAsync(orderHashes); await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break; break;
} }
case WETH9Events.Deposit: { case WETH9Events.Deposit: {
@@ -363,7 +364,7 @@ export class OrderWatcher {
args._owner, args._owner,
tokenAssetData, tokenAssetData,
); );
await this._emitRevalidateOrdersAsync(orderHashes); await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break; break;
} }
case WETH9Events.Withdrawal: { case WETH9Events.Withdrawal: {
@@ -376,7 +377,7 @@ export class OrderWatcher {
args._owner, args._owner,
tokenAssetData, tokenAssetData,
); );
await this._emitRevalidateOrdersAsync(orderHashes); await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break; break;
} }
case ExchangeEvents.Fill: { case ExchangeEvents.Fill: {
@@ -387,7 +388,7 @@ export class OrderWatcher {
const orderHash = args.orderHash; const orderHash = args.orderHash;
const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]); const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]);
if (isOrderWatched) { if (isOrderWatched) {
await this._emitRevalidateOrdersAsync([orderHash]); await this._emitRevalidateOrdersAsync([orderHash], transactionHash);
} }
break; break;
} }
@@ -399,7 +400,7 @@ export class OrderWatcher {
const orderHash = args.orderHash; const orderHash = args.orderHash;
const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]); const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]);
if (isOrderWatched) { if (isOrderWatched) {
await this._emitRevalidateOrdersAsync([orderHash]); await this._emitRevalidateOrdersAsync([orderHash], transactionHash);
} }
break; break;
} }
@@ -410,7 +411,7 @@ export class OrderWatcher {
this._orderFilledCancelledLazyStore.deleteAllIsCancelled(); this._orderFilledCancelledLazyStore.deleteAllIsCancelled();
// Revalidate orders // Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByMaker(args.makerAddress); const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByMaker(args.makerAddress);
await this._emitRevalidateOrdersAsync(orderHashes); await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break; break;
} }
@@ -418,12 +419,12 @@ export class OrderWatcher {
throw errorUtils.spawnSwitchErr('decodedLog.event', decodedLog.event); throw errorUtils.spawnSwitchErr('decodedLog.event', decodedLog.event);
} }
} }
private async _emitRevalidateOrdersAsync(orderHashes: string[]): Promise<void> { private async _emitRevalidateOrdersAsync(orderHashes: string[], transactionHash?: string): Promise<void> {
for (const orderHash of orderHashes) { for (const orderHash of orderHashes) {
const signedOrder = this._orderByOrderHash[orderHash]; const signedOrder = this._orderByOrderHash[orderHash];
// Most of these calls will never reach the network because the data is fetched from stores // Most of these calls will never reach the network because the data is fetched from stores
// and only updated when cache is invalidated // and only updated when cache is invalidated
const orderState = await this._orderStateUtils.getOpenOrderStateAsync(signedOrder); const orderState = await this._orderStateUtils.getOpenOrderStateAsync(signedOrder, transactionHash);
if (_.isUndefined(this._callbackIfExists)) { if (_.isUndefined(this._callbackIfExists)) {
break; // Unsubscribe was called break; // Unsubscribe was called
} }

View File

@@ -250,6 +250,32 @@ describe('OrderWatcher', () => {
await contractWrappers.exchange.fillOrderAsync(signedOrder, fillableAmount, takerAddress); await contractWrappers.exchange.fillOrderAsync(signedOrder, fillableAmount, takerAddress);
})().catch(done); })().catch(done);
}); });
it('should include transactionHash in emitted orderStateInvalid when watched order fully filled', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerAssetData,
takerAssetData,
makerAddress,
takerAddress,
fillableAmount,
);
await orderWatcher.addOrderAsync(signedOrder);
let transactionHash: string;
const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.transactionHash).to.be.equal(transactionHash);
});
orderWatcher.subscribe(callback);
transactionHash = await contractWrappers.exchange.fillOrderAsync(
signedOrder,
fillableAmount,
takerAddress,
);
})().catch(done);
});
it('should emit orderStateValid when watched order partially filled', (done: DoneCallback) => { it('should emit orderStateValid when watched order partially filled', (done: DoneCallback) => {
(async () => { (async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync( signedOrder = await fillScenarios.createFillableSignedOrderAsync(

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.10", "version": "1.0.10",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.11 - _September 25, 2018_
* Dependencies updated
## v1.0.10 - _September 25, 2018_ ## v1.0.10 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/react-docs", "name": "@0xproject/react-docs",
"version": "1.0.10", "version": "1.0.11",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -23,7 +23,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git" "url": "https://github.com/0xProject/0x-monorepo.git"
}, },
"devDependencies": { "devDependencies": {
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@types/compare-versions": "^3.0.0", "@types/compare-versions": "^3.0.0",
"copyfiles": "^2.0.0", "copyfiles": "^2.0.0",
@@ -33,8 +33,8 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/react-shared": "^1.0.11", "@0xproject/react-shared": "^1.0.12",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@types/lodash": "4.14.104", "@types/lodash": "4.14.104",
"@types/material-ui": "^0.20.0", "@types/material-ui": "^0.20.0",
"@types/node": "*", "@types/node": "*",

View File

@@ -134,7 +134,10 @@ function renderTypeParameter(
): React.ReactNode { ): React.ReactNode {
const typeParam = ( const typeParam = (
<span> <span>
{`<${typeParameter.name} extends `} {`<${typeParameter.name}`}
{!_.isUndefined(typeParameter.type) && (
<span>
{' extends '}
<Type <Type
type={typeParameter.type} type={typeParameter.type}
sectionName={sectionName} sectionName={sectionName}
@@ -142,6 +145,8 @@ function renderTypeParameter(
docsInfo={docsInfo} docsInfo={docsInfo}
isInPopover={isInPopover} isInPopover={isInPopover}
/> />
</span>
)}
{`>`} {`>`}
</span> </span>
); );

View File

@@ -150,7 +150,7 @@ export interface Parameter {
export interface TypeParameter { export interface TypeParameter {
name: string; name: string;
type: Type; type?: Type;
} }
export interface Type { export interface Type {

View File

@@ -419,7 +419,10 @@ export class TypeDocUtils {
return func; return func;
} }
private _convertTypeParameter(entity: TypeDocNode, sectionName: string): TypeParameter { private _convertTypeParameter(entity: TypeDocNode, sectionName: string): TypeParameter {
const type = this._convertType(entity.type, sectionName); let type;
if (!_.isUndefined(entity.type)) {
type = this._convertType(entity.type, sectionName);
}
const parameter = { const parameter = {
name: entity.name, name: entity.name,
type, type,

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.11", "version": "1.0.11",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.12 - _September 25, 2018_
* Dependencies updated
## v1.0.11 - _September 25, 2018_ ## v1.0.11 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/react-shared", "name": "@0xproject/react-shared",
"version": "1.0.11", "version": "1.0.12",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -24,7 +24,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git" "url": "https://github.com/0xProject/0x-monorepo.git"
}, },
"devDependencies": { "devDependencies": {
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"copyfiles": "^2.0.0", "copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0", "make-promises-safe": "^1.1.0",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.1.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.1.4", "version": "1.1.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.1.5 - _September 25, 2018_
* Dependencies updated
## v1.1.4 - _September 25, 2018_ ## v1.1.4 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/sol-compiler", "name": "@0xproject/sol-compiler",
"version": "1.1.4", "version": "1.1.5",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -41,7 +41,7 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md",
"devDependencies": { "devDependencies": {
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",
"@types/mkdirp": "^0.5.2", "@types/mkdirp": "^0.5.2",
"@types/require-from-string": "^1.2.0", "@types/require-from-string": "^1.2.0",
@@ -64,16 +64,16 @@
"zeppelin-solidity": "1.8.0" "zeppelin-solidity": "1.8.0"
}, },
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/sol-resolver": "^1.0.10", "@0xproject/sol-resolver": "^1.0.11",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"@types/yargs": "^11.0.0", "@types/yargs": "^11.0.0",
"chalk": "^2.3.0", "chalk": "^2.3.0",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "2.1.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "2.1.4", "version": "2.1.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v2.1.5 - _September 25, 2018_
* Dependencies updated
## v2.1.4 - _September 25, 2018_ ## v2.1.4 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/sol-cov", "name": "@0xproject/sol-cov",
"version": "2.1.4", "version": "2.1.5",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -41,13 +41,13 @@
}, },
"homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md",
"dependencies": { "dependencies": {
"@0xproject/dev-utils": "^1.0.9", "@0xproject/dev-utils": "^1.0.10",
"@0xproject/sol-compiler": "^1.1.4", "@0xproject/sol-compiler": "^1.1.5",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"glob": "^7.1.2", "glob": "^7.1.2",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.10", "version": "1.0.10",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.11 - _September 25, 2018_
* Dependencies updated
## v1.0.10 - _September 25, 2018_ ## v1.0.10 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/sol-resolver", "name": "@0xproject/sol-resolver",
"version": "1.0.10", "version": "1.0.11",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -30,8 +30,8 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"lodash": "^4.17.5" "lodash": "^4.17.5"
}, },
"publishConfig": { "publishConfig": {

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.10", "version": "1.0.10",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.11 - _September 25, 2018_
* Dependencies updated
## v1.0.10 - _September 25, 2018_ ## v1.0.10 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/sra-report", "name": "@0xproject/sra-report",
"version": "1.0.10", "version": "1.0.11",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -33,13 +33,13 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md",
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/connect": "1.0.4", "@0xproject/connect": "1.0.4",
"@0xproject/json-schemas": "^0.8.3", "@0xproject/json-schemas": "^0.8.3",
"@0xproject/order-utils": "^0.0.9", "@0xproject/order-utils": "^0.0.9",
"@0xproject/types": "^0.8.2", "@0xproject/types": "^0.8.2",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"chalk": "^2.3.0", "chalk": "^2.3.0",
"lodash": "^4.17.5", "lodash": "^4.17.5",
"newman": "^3.9.3", "newman": "^3.9.3",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.3", "version": "1.0.3",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.4 - _September 25, 2018_
* Dependencies updated
## v1.0.3 - _September 25, 2018_ ## v1.0.3 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/sra-spec", "name": "@0xproject/sra-spec",
"version": "1.0.3", "version": "1.0.4",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -34,7 +34,7 @@
}, },
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md", "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md",
"dependencies": { "dependencies": {
"@0xproject/json-schemas": "^1.0.3" "@0xproject/json-schemas": "^1.0.4"
}, },
"devDependencies": { "devDependencies": {
"@0xproject/tslint-config": "^1.0.7", "@0xproject/tslint-config": "^1.0.7",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "2.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "2.0.4", "version": "2.0.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v2.0.5 - _September 25, 2018_
* Dependencies updated
## v2.0.4 - _September 25, 2018_ ## v2.0.4 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/subproviders", "name": "@0xproject/subproviders",
"version": "2.0.4", "version": "2.0.5",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -28,11 +28,11 @@
} }
}, },
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-app-eth": "^4.3.0",
"@ledgerhq/hw-transport-u2f": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0",
"@types/eth-lightwallet": "^3.0.0", "@types/eth-lightwallet": "^3.0.0",
@@ -41,7 +41,7 @@
"bip39": "^2.5.0", "bip39": "^2.5.0",
"bn.js": "^4.11.8", "bn.js": "^4.11.8",
"eth-lightwallet": "^3.0.1", "eth-lightwallet": "^3.0.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-tx": "^1.3.5", "ethereumjs-tx": "^1.3.5",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"ganache-core": "0xProject/ganache-core#monorepo-dep", "ganache-core": "0xProject/ganache-core#monorepo-dep",

View File

@@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"name": "@0xproject/testnet-faucets", "name": "@0xproject/testnet-faucets",
"version": "1.0.48", "version": "1.0.49",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -17,13 +17,13 @@
"author": "Fabio Berger", "author": "Fabio Berger",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"0x.js": "^1.0.5", "0x.js": "^1.0.6",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"body-parser": "^1.17.1", "body-parser": "^1.17.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-tx": "^1.3.5", "ethereumjs-tx": "^1.3.5",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"express": "^4.15.2", "express": "^4.15.2",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.1.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"version": "1.1.0", "version": "1.1.0",
"changes": [ "changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.1.1 - _September 25, 2018_
* Dependencies updated
## v1.1.0 - _September 25, 2018_ ## v1.1.0 - _September 25, 2018_
* Add ObjectMap type (#1037) * Add ObjectMap type (#1037)

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/types", "name": "@0xproject/types",
"version": "1.1.0", "version": "1.1.1",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -32,7 +32,7 @@
"dependencies": { "dependencies": {
"@types/node": "*", "@types/node": "*",
"bignumber.js": "~4.1.0", "bignumber.js": "~4.1.0",
"ethereum-types": "^1.0.7" "ethereum-types": "^1.0.8"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@@ -111,12 +111,14 @@ export interface OrderStateValid {
isValid: true; isValid: true;
orderHash: string; orderHash: string;
orderRelevantState: OrderRelevantState; orderRelevantState: OrderRelevantState;
transactionHash?: string;
} }
export interface OrderStateInvalid { export interface OrderStateInvalid {
isValid: false; isValid: false;
orderHash: string; orderHash: string;
error: ExchangeContractErrs; error: ExchangeContractErrs;
transactionHash?: string;
} }
export type OrderState = OrderStateValid | OrderStateInvalid; export type OrderState = OrderStateValid | OrderStateInvalid;

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "2.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537541580, "timestamp": 1537541580,
"version": "2.0.1", "version": "2.0.1",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v2.0.2 - _September 25, 2018_
* Dependencies updated
## v2.0.1 - _September 21, 2018_ ## v2.0.1 - _September 21, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/typescript-typings", "name": "@0xproject/typescript-typings",
"version": "2.0.1", "version": "2.0.2",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -26,7 +26,7 @@
"@types/bn.js": "^4.11.0", "@types/bn.js": "^4.11.0",
"@types/react": "*", "@types/react": "*",
"bignumber.js": "~4.1.0", "bignumber.js": "~4.1.0",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"popper.js": "1.14.3" "popper.js": "1.14.3"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "1.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"timestamp": 1537875740, "timestamp": 1537875740,
"version": "1.0.10", "version": "1.0.10",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v1.0.11 - _September 25, 2018_
* Dependencies updated
## v1.0.10 - _September 25, 2018_ ## v1.0.10 - _September 25, 2018_
* Dependencies updated * Dependencies updated

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/utils", "name": "@0xproject/utils",
"version": "1.0.10", "version": "1.0.11",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -41,13 +41,13 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@types/node": "*", "@types/node": "*",
"abortcontroller-polyfill": "^1.1.9", "abortcontroller-polyfill": "^1.1.9",
"bignumber.js": "~4.1.0", "bignumber.js": "~4.1.0",
"detect-node": "2.0.3", "detect-node": "2.0.3",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"ethers": "3.0.22", "ethers": "3.0.22",
"isomorphic-fetch": "^2.2.1", "isomorphic-fetch": "^2.2.1",

View File

@@ -1,4 +1,13 @@
[ [
{
"timestamp": 1537907159,
"version": "3.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{ {
"version": "3.0.0", "version": "3.0.0",
"changes": [ "changes": [
@@ -6,6 +15,11 @@
"note": "note":
"Rename `getBlockAsync` to `getBlockIfExistsAsync` and rather then throw if the requested block wasn't found, return undefined.", "Rename `getBlockAsync` to `getBlockIfExistsAsync` and rather then throw if the requested block wasn't found, return undefined.",
"pr": 1082 "pr": 1082
},
{
"note":
"Expose `sendRawPayloadAsync` so one can easily extend `Web3Wrapper` with their own custom JSON RPC calls",
"pr": 1080
} }
], ],
"timestamp": 1537875740 "timestamp": 1537875740

View File

@@ -5,9 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG CHANGELOG
## v3.0.1 - _September 25, 2018_
* Dependencies updated
## v3.0.0 - _September 25, 2018_ ## v3.0.0 - _September 25, 2018_
* Rename `getBlockAsync` to `getBlockIfExistsAsync` and rather then throw if the requested block wasn't found, return undefined. (#1082) * Rename `getBlockAsync` to `getBlockIfExistsAsync` and rather then throw if the requested block wasn't found, return undefined. (#1082)
* Expose `sendRawPayloadAsync` so one can easily extend `Web3Wrapper` with their own custom JSON RPC calls (#1080)
## v2.0.3 - _September 21, 2018_ ## v2.0.3 - _September 21, 2018_

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/web3-wrapper", "name": "@0xproject/web3-wrapper",
"version": "3.0.0", "version": "3.0.1",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -53,11 +53,11 @@
"typescript": "3.0.1" "typescript": "3.0.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/assert": "^1.0.10", "@0xproject/assert": "^1.0.11",
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"ethers": "3.0.22", "ethers": "3.0.22",
"lodash": "^4.17.5" "lodash": "^4.17.5"

View File

@@ -193,7 +193,7 @@ export class Web3Wrapper {
* @returns Ethereum node's version string * @returns Ethereum node's version string
*/ */
public async getNodeVersionAsync(): Promise<string> { public async getNodeVersionAsync(): Promise<string> {
const nodeVersion = await this._sendRawPayloadAsync<string>({ method: 'web3_clientVersion' }); const nodeVersion = await this.sendRawPayloadAsync<string>({ method: 'web3_clientVersion' });
return nodeVersion; return nodeVersion;
} }
/** /**
@@ -201,7 +201,7 @@ export class Web3Wrapper {
* @returns The network id * @returns The network id
*/ */
public async getNetworkIdAsync(): Promise<number> { public async getNetworkIdAsync(): Promise<number> {
const networkIdStr = await this._sendRawPayloadAsync<string>({ method: 'net_version' }); const networkIdStr = await this.sendRawPayloadAsync<string>({ method: 'net_version' });
const networkId = _.parseInt(networkIdStr); const networkId = _.parseInt(networkIdStr);
return networkId; return networkId;
} }
@@ -212,7 +212,7 @@ export class Web3Wrapper {
*/ */
public async getTransactionReceiptAsync(txHash: string): Promise<TransactionReceipt> { public async getTransactionReceiptAsync(txHash: string): Promise<TransactionReceipt> {
assert.isHexString('txHash', txHash); assert.isHexString('txHash', txHash);
const transactionReceipt = await this._sendRawPayloadAsync<TransactionReceipt>({ const transactionReceipt = await this.sendRawPayloadAsync<TransactionReceipt>({
method: 'eth_getTransactionReceipt', method: 'eth_getTransactionReceipt',
params: [txHash], params: [txHash],
}); });
@@ -228,7 +228,7 @@ export class Web3Wrapper {
*/ */
public async getTransactionByHashAsync(txHash: string): Promise<Transaction> { public async getTransactionByHashAsync(txHash: string): Promise<Transaction> {
assert.isHexString('txHash', txHash); assert.isHexString('txHash', txHash);
const transaction = await this._sendRawPayloadAsync<Transaction>({ const transaction = await this.sendRawPayloadAsync<Transaction>({
method: 'eth_getTransactionByHash', method: 'eth_getTransactionByHash',
params: [txHash], params: [txHash],
}); });
@@ -247,7 +247,7 @@ export class Web3Wrapper {
} }
const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock);
const encodedOwner = marshaller.marshalAddress(owner); const encodedOwner = marshaller.marshalAddress(owner);
const balanceInWei = await this._sendRawPayloadAsync<string>({ const balanceInWei = await this.sendRawPayloadAsync<string>({
method: 'eth_getBalance', method: 'eth_getBalance',
params: [encodedOwner, marshalledDefaultBlock], params: [encodedOwner, marshalledDefaultBlock],
}); });
@@ -279,7 +279,7 @@ export class Web3Wrapper {
} }
const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock);
const encodedAddress = marshaller.marshalAddress(address); const encodedAddress = marshaller.marshalAddress(address);
const code = await this._sendRawPayloadAsync<string>({ const code = await this.sendRawPayloadAsync<string>({
method: 'eth_getCode', method: 'eth_getCode',
params: [encodedAddress, marshalledDefaultBlock], params: [encodedAddress, marshalledDefaultBlock],
}); });
@@ -293,7 +293,7 @@ export class Web3Wrapper {
*/ */
public async getTransactionTraceAsync(txHash: string, traceParams: TraceParams): Promise<TransactionTrace> { public async getTransactionTraceAsync(txHash: string, traceParams: TraceParams): Promise<TransactionTrace> {
assert.isHexString('txHash', txHash); assert.isHexString('txHash', txHash);
const trace = await this._sendRawPayloadAsync<TransactionTrace>({ const trace = await this.sendRawPayloadAsync<TransactionTrace>({
method: 'debug_traceTransaction', method: 'debug_traceTransaction',
params: [txHash, traceParams], params: [txHash, traceParams],
}); });
@@ -308,7 +308,7 @@ export class Web3Wrapper {
public async signMessageAsync(address: string, message: string): Promise<string> { public async signMessageAsync(address: string, message: string): Promise<string> {
assert.isETHAddressHex('address', address); assert.isETHAddressHex('address', address);
assert.isString('message', message); // TODO: Should this be stricter? Hex string? assert.isString('message', message); // TODO: Should this be stricter? Hex string?
const signData = await this._sendRawPayloadAsync<string>({ const signData = await this.sendRawPayloadAsync<string>({
method: 'eth_sign', method: 'eth_sign',
params: [address, message], params: [address, message],
}); });
@@ -319,7 +319,7 @@ export class Web3Wrapper {
* @returns Block number * @returns Block number
*/ */
public async getBlockNumberAsync(): Promise<number> { public async getBlockNumberAsync(): Promise<number> {
const blockNumberHex = await this._sendRawPayloadAsync<string>({ const blockNumberHex = await this.sendRawPayloadAsync<string>({
method: 'eth_blockNumber', method: 'eth_blockNumber',
params: [], params: [],
}); });
@@ -339,7 +339,7 @@ export class Web3Wrapper {
const encodedBlockParam = marshaller.marshalBlockParam(blockParam); const encodedBlockParam = marshaller.marshalBlockParam(blockParam);
const method = utils.isHexStrict(blockParam) ? 'eth_getBlockByHash' : 'eth_getBlockByNumber'; const method = utils.isHexStrict(blockParam) ? 'eth_getBlockByHash' : 'eth_getBlockByNumber';
const shouldIncludeTransactionData = false; const shouldIncludeTransactionData = false;
const blockWithoutTransactionDataWithHexValuesOrNull = await this._sendRawPayloadAsync< const blockWithoutTransactionDataWithHexValuesOrNull = await this.sendRawPayloadAsync<
BlockWithoutTransactionDataRPC BlockWithoutTransactionDataRPC
>({ >({
method, method,
@@ -366,7 +366,7 @@ export class Web3Wrapper {
} }
const method = utils.isHexStrict(blockParam) ? 'eth_getBlockByHash' : 'eth_getBlockByNumber'; const method = utils.isHexStrict(blockParam) ? 'eth_getBlockByHash' : 'eth_getBlockByNumber';
const shouldIncludeTransactionData = true; const shouldIncludeTransactionData = true;
const blockWithTransactionDataWithHexValues = await this._sendRawPayloadAsync<BlockWithTransactionDataRPC>({ const blockWithTransactionDataWithHexValues = await this.sendRawPayloadAsync<BlockWithTransactionDataRPC>({
method, method,
params: [encodedBlockParam, shouldIncludeTransactionData], params: [encodedBlockParam, shouldIncludeTransactionData],
}); });
@@ -393,7 +393,7 @@ export class Web3Wrapper {
* @returns Available user addresses * @returns Available user addresses
*/ */
public async getAvailableAddressesAsync(): Promise<string[]> { public async getAvailableAddressesAsync(): Promise<string[]> {
const addresses = await this._sendRawPayloadAsync<string>({ const addresses = await this.sendRawPayloadAsync<string>({
method: 'eth_accounts', method: 'eth_accounts',
params: [], params: [],
}); });
@@ -405,7 +405,7 @@ export class Web3Wrapper {
* @returns The snapshot id. This can be used to revert to this snapshot * @returns The snapshot id. This can be used to revert to this snapshot
*/ */
public async takeSnapshotAsync(): Promise<number> { public async takeSnapshotAsync(): Promise<number> {
const snapshotId = Number(await this._sendRawPayloadAsync<string>({ method: 'evm_snapshot', params: [] })); const snapshotId = Number(await this.sendRawPayloadAsync<string>({ method: 'evm_snapshot', params: [] }));
return snapshotId; return snapshotId;
} }
/** /**
@@ -415,14 +415,14 @@ export class Web3Wrapper {
*/ */
public async revertSnapshotAsync(snapshotId: number): Promise<boolean> { public async revertSnapshotAsync(snapshotId: number): Promise<boolean> {
assert.isNumber('snapshotId', snapshotId); assert.isNumber('snapshotId', snapshotId);
const didRevert = await this._sendRawPayloadAsync<boolean>({ method: 'evm_revert', params: [snapshotId] }); const didRevert = await this.sendRawPayloadAsync<boolean>({ method: 'evm_revert', params: [snapshotId] });
return didRevert; return didRevert;
} }
/** /**
* Mine a block on a TestRPC/Ganache local node * Mine a block on a TestRPC/Ganache local node
*/ */
public async mineBlockAsync(): Promise<void> { public async mineBlockAsync(): Promise<void> {
await this._sendRawPayloadAsync<string>({ method: 'evm_mine', params: [] }); await this.sendRawPayloadAsync<string>({ method: 'evm_mine', params: [] });
} }
/** /**
* Increase the next blocks timestamp on TestRPC/Ganache or Geth local node. * Increase the next blocks timestamp on TestRPC/Ganache or Geth local node.
@@ -434,9 +434,9 @@ export class Web3Wrapper {
// Detect Geth vs. Ganache and use appropriate endpoint. // Detect Geth vs. Ganache and use appropriate endpoint.
const version = await this.getNodeVersionAsync(); const version = await this.getNodeVersionAsync();
if (_.includes(version, uniqueVersionIds.geth)) { if (_.includes(version, uniqueVersionIds.geth)) {
return this._sendRawPayloadAsync<number>({ method: 'debug_increaseTime', params: [timeDelta] }); return this.sendRawPayloadAsync<number>({ method: 'debug_increaseTime', params: [timeDelta] });
} else if (_.includes(version, uniqueVersionIds.ganache)) { } else if (_.includes(version, uniqueVersionIds.ganache)) {
return this._sendRawPayloadAsync<number>({ method: 'evm_increaseTime', params: [timeDelta] }); return this.sendRawPayloadAsync<number>({ method: 'evm_increaseTime', params: [timeDelta] });
} else { } else {
throw new Error(`Unknown client version: ${version}`); throw new Error(`Unknown client version: ${version}`);
} }
@@ -447,6 +447,12 @@ export class Web3Wrapper {
* @returns The corresponding log entries * @returns The corresponding log entries
*/ */
public async getLogsAsync(filter: FilterObject): Promise<LogEntry[]> { public async getLogsAsync(filter: FilterObject): Promise<LogEntry[]> {
if (!_.isUndefined(filter.blockHash) && (!_.isUndefined(filter.fromBlock) || !_.isUndefined(filter.toBlock))) {
throw new Error(
`Cannot specify 'blockHash' as well as 'fromBlock'/'toBlock' in the filter supplied to 'getLogsAsync'`,
);
}
let fromBlock = filter.fromBlock; let fromBlock = filter.fromBlock;
if (_.isNumber(fromBlock)) { if (_.isNumber(fromBlock)) {
fromBlock = utils.numberToHex(fromBlock); fromBlock = utils.numberToHex(fromBlock);
@@ -464,7 +470,7 @@ export class Web3Wrapper {
method: 'eth_getLogs', method: 'eth_getLogs',
params: [serializedFilter], params: [serializedFilter],
}; };
const rawLogs = await this._sendRawPayloadAsync<RawLogEntry[]>(payload); const rawLogs = await this.sendRawPayloadAsync<RawLogEntry[]>(payload);
const formattedLogs = _.map(rawLogs, marshaller.unmarshalLog.bind(marshaller)); const formattedLogs = _.map(rawLogs, marshaller.unmarshalLog.bind(marshaller));
return formattedLogs; return formattedLogs;
} }
@@ -480,7 +486,7 @@ export class Web3Wrapper {
schemas.jsNumber, schemas.jsNumber,
]); ]);
const txDataHex = marshaller.marshalTxData(txData); const txDataHex = marshaller.marshalTxData(txData);
const gasHex = await this._sendRawPayloadAsync<string>({ method: 'eth_estimateGas', params: [txDataHex] }); const gasHex = await this.sendRawPayloadAsync<string>({ method: 'eth_estimateGas', params: [txDataHex] });
const gas = utils.convertHexToNumber(gasHex); const gas = utils.convertHexToNumber(gasHex);
return gas; return gas;
} }
@@ -501,7 +507,7 @@ export class Web3Wrapper {
} }
const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock); const marshalledDefaultBlock = marshaller.marshalBlockParam(defaultBlock);
const callDataHex = marshaller.marshalCallData(callData); const callDataHex = marshaller.marshalCallData(callData);
const rawCallResult = await this._sendRawPayloadAsync<string>({ const rawCallResult = await this.sendRawPayloadAsync<string>({
method: 'eth_call', method: 'eth_call',
params: [callDataHex, marshalledDefaultBlock], params: [callDataHex, marshalledDefaultBlock],
}); });
@@ -522,7 +528,7 @@ export class Web3Wrapper {
schemas.jsNumber, schemas.jsNumber,
]); ]);
const txDataHex = marshaller.marshalTxData(txData); const txDataHex = marshaller.marshalTxData(txData);
const txHash = await this._sendRawPayloadAsync<string>({ method: 'eth_sendTransaction', params: [txDataHex] }); const txHash = await this.sendRawPayloadAsync<string>({ method: 'eth_sendTransaction', params: [txDataHex] });
return txHash; return txHash;
} }
/** /**
@@ -632,7 +638,24 @@ export class Web3Wrapper {
*/ */
public async setHeadAsync(blockNumber: number): Promise<void> { public async setHeadAsync(blockNumber: number): Promise<void> {
assert.isNumber('blockNumber', blockNumber); assert.isNumber('blockNumber', blockNumber);
await this._sendRawPayloadAsync<void>({ method: 'debug_setHead', params: [utils.numberToHex(blockNumber)] }); await this.sendRawPayloadAsync<void>({ method: 'debug_setHead', params: [utils.numberToHex(blockNumber)] });
}
/**
* Sends a raw Ethereum JSON RPC payload and returns the response's `result` key
* @param payload A partial JSON RPC payload. No need to include version, id, params (if none needed)
* @return The contents nested under the result key of the response body
*/
public async sendRawPayloadAsync<A>(payload: Partial<JSONRPCRequestPayload>): Promise<A> {
const sendAsync = this._provider.sendAsync.bind(this._provider);
const payloadWithDefaults = {
id: this._jsonRpcRequestId++,
params: [],
jsonrpc: '2.0',
...payload,
};
const response = await promisify<JSONRPCResponsePayload>(sendAsync)(payloadWithDefaults);
const result = response.result;
return result;
} }
/** /**
* Returns either NodeType.Geth or NodeType.Ganache depending on the type of * Returns either NodeType.Geth or NodeType.Ganache depending on the type of
@@ -648,16 +671,4 @@ export class Web3Wrapper {
throw new Error(`Unknown client version: ${version}`); throw new Error(`Unknown client version: ${version}`);
} }
} }
private async _sendRawPayloadAsync<A>(payload: Partial<JSONRPCRequestPayload>): Promise<A> {
const sendAsync = this._provider.sendAsync.bind(this._provider);
const payloadWithDefaults = {
id: this._jsonRpcRequestId++,
params: [],
jsonrpc: '2.0',
...payload,
};
const response = await promisify<JSONRPCResponsePayload>(sendAsync)(payloadWithDefaults);
const result = response.result;
return result;
}
} // tslint:disable-line:max-file-line-count } // tslint:disable-line:max-file-line-count

View File

@@ -1,6 +1,6 @@
{ {
"name": "@0xproject/website", "name": "@0xproject/website",
"version": "0.0.51", "version": "0.0.52",
"engines": { "engines": {
"node": ">=6.12" "node": ">=6.12"
}, },
@@ -19,22 +19,22 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"0x.js": "^0.38.6", "0x.js": "^0.38.6",
"@0xproject/contract-wrappers": "^1.0.5", "@0xproject/contract-wrappers": "^2.0.0",
"@0xproject/json-schemas": "^1.0.3", "@0xproject/json-schemas": "^1.0.4",
"@0xproject/order-utils": "^1.0.4", "@0xproject/order-utils": "^1.0.5",
"@0xproject/react-docs": "^1.0.10", "@0xproject/react-docs": "^1.0.11",
"@0xproject/react-shared": "^1.0.11", "@0xproject/react-shared": "^1.0.12",
"@0xproject/subproviders": "^2.0.4", "@0xproject/subproviders": "^2.0.5",
"@0xproject/types": "^1.1.0", "@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.1", "@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.10", "@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.0", "@0xproject/web3-wrapper": "^3.0.1",
"accounting": "^0.4.1", "accounting": "^0.4.1",
"basscss": "^8.0.3", "basscss": "^8.0.3",
"blockies": "^0.0.2", "blockies": "^0.0.2",
"bowser": "^1.9.3", "bowser": "^1.9.3",
"deep-equal": "^1.0.1", "deep-equal": "^1.0.1",
"ethereum-types": "^1.0.7", "ethereum-types": "^1.0.8",
"ethereumjs-util": "^5.1.1", "ethereumjs-util": "^5.1.1",
"find-versions": "^2.0.0", "find-versions": "^2.0.0",
"jsonschema": "^1.2.0", "jsonschema": "^1.2.0",

View File

@@ -1356,9 +1356,9 @@ aes-js@3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d"
aes-js@^3.1.1: aes-js@^0.2.3:
version "3.1.1" version "0.2.4"
resolved "https://registry.npmjs.org/aes-js/-/aes-js-3.1.1.tgz#89fd1f94ae51b4c72d62466adc1a7323ff52f072" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-0.2.4.tgz#94b881ab717286d015fa219e08fb66709dda5a3d"
ajv-keywords@^2.1.0: ajv-keywords@^2.1.0:
version "2.1.1" version "2.1.1"
@@ -2424,6 +2424,10 @@ balanced-match@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
base-x@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac"
base-x@^3.0.2: base-x@^3.0.2:
version "3.0.4" version "3.0.4"
resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77"
@@ -2835,7 +2839,7 @@ browserslist@^2.1.2:
caniuse-lite "^1.0.30000792" caniuse-lite "^1.0.30000792"
electron-to-chromium "^1.3.30" electron-to-chromium "^1.3.30"
bs58@=4.0.1, bs58@^4.0.0: bs58@=4.0.1:
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a"
dependencies: dependencies:
@@ -2845,13 +2849,18 @@ bs58@^2.0.1:
version "2.0.1" version "2.0.1"
resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d"
bs58check@^2.1.2: bs58@^3.1.0:
version "2.1.2" version "3.1.0"
resolved "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" resolved "https://registry.yarnpkg.com/bs58/-/bs58-3.1.0.tgz#d4c26388bf4804cac714141b1945aa47e5eb248e"
dependencies: dependencies:
bs58 "^4.0.0" base-x "^1.1.0"
bs58check@^1.0.8:
version "1.3.4"
resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-1.3.4.tgz#c52540073749117714fa042c3047eb8f9151cbf8"
dependencies:
bs58 "^3.1.0"
create-hash "^1.1.0" create-hash "^1.1.0"
safe-buffer "^5.1.2"
btoa@1.1.2: btoa@1.1.2:
version "1.1.2" version "1.1.2"
@@ -5203,6 +5212,14 @@ ethereumjs-blockstream@5.0.0:
source-map-support "0.5.6" source-map-support "0.5.6"
uuid "3.2.1" uuid "3.2.1"
ethereumjs-blockstream@6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/ethereumjs-blockstream/-/ethereumjs-blockstream-6.0.0.tgz#79d726d1f358935eb65195e91d40344c31e87eff"
dependencies:
immutable "3.8.2"
source-map-support "0.5.6"
uuid "3.2.1"
ethereumjs-tx@0xProject/ethereumjs-tx#fake-tx-include-signature-by-default: ethereumjs-tx@0xProject/ethereumjs-tx#fake-tx-include-signature-by-default:
version "1.3.4" version "1.3.4"
resolved "https://codeload.github.com/0xProject/ethereumjs-tx/tar.gz/29d1153889c389591f74b2401da8a0c6ad40f9a7" resolved "https://codeload.github.com/0xProject/ethereumjs-tx/tar.gz/29d1153889c389591f74b2401da8a0c6ad40f9a7"
@@ -5229,7 +5246,7 @@ ethereumjs-util@5.1.5, ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumj
safe-buffer "^5.1.1" safe-buffer "^5.1.1"
secp256k1 "^3.0.1" secp256k1 "^3.0.1"
ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0: ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0:
version "4.5.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6"
dependencies: dependencies:
@@ -5283,18 +5300,17 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@^2.1.0, ethereumjs-vm@^2.3.4:
rustbn.js "~0.1.1" rustbn.js "~0.1.1"
safe-buffer "^5.1.1" safe-buffer "^5.1.1"
ethereumjs-wallet@~0.6.0: ethereumjs-wallet@0.6.0:
version "0.6.2" version "0.6.0"
resolved "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.2.tgz#67244b6af3e8113b53d709124b25477b64aeccda" resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb"
dependencies: dependencies:
aes-js "^3.1.1" aes-js "^0.2.3"
bs58check "^2.1.2" bs58check "^1.0.8"
ethereumjs-util "^5.2.0" ethereumjs-util "^4.4.0"
hdkey "^1.0.0" hdkey "^0.7.0"
safe-buffer "^5.1.2"
scrypt.js "^0.2.0" scrypt.js "^0.2.0"
utf8 "^3.0.0" utf8 "^2.1.1"
uuid "^3.3.2" uuid "^2.0.1"
ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22: ethers@0xproject/ethers.js#eip-838-reasons, ethers@3.0.22:
version "3.0.18" version "3.0.18"
@@ -6053,7 +6069,7 @@ ganache-core@0xProject/ganache-core#monorepo-dep:
ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default" ethereumjs-tx "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default"
ethereumjs-util "^5.2.0" ethereumjs-util "^5.2.0"
ethereumjs-vm "2.3.5" ethereumjs-vm "2.3.5"
ethereumjs-wallet "~0.6.0" ethereumjs-wallet "0.6.0"
fake-merkle-patricia-tree "~1.0.1" fake-merkle-patricia-tree "~1.0.1"
heap "~0.2.6" heap "~0.2.6"
js-scrypt "^0.2.0" js-scrypt "^0.2.0"
@@ -6735,21 +6751,13 @@ hawk@~6.0.2:
hoek "4.x.x" hoek "4.x.x"
sntp "2.x.x" sntp "2.x.x"
hdkey@^0.7.1: hdkey@^0.7.0, hdkey@^0.7.1:
version "0.7.1" version "0.7.1"
resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-0.7.1.tgz#caee4be81aa77921e909b8d228dd0f29acaee632" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-0.7.1.tgz#caee4be81aa77921e909b8d228dd0f29acaee632"
dependencies: dependencies:
coinstring "^2.0.0" coinstring "^2.0.0"
secp256k1 "^3.0.1" secp256k1 "^3.0.1"
hdkey@^1.0.0:
version "1.1.0"
resolved "https://registry.npmjs.org/hdkey/-/hdkey-1.1.0.tgz#e74e7b01d2c47f797fa65d1d839adb7a44639f29"
dependencies:
coinstring "^2.0.0"
safe-buffer "^5.1.1"
secp256k1 "^3.0.1"
he@1.1.1: he@1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
@@ -14242,10 +14250,6 @@ utf8@^2.1.1:
version "2.1.2" version "2.1.2"
resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96"
utf8@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1"
util-deprecate@~1.0.1: util-deprecate@~1.0.1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"