Compare commits
142 Commits
@0xproject
...
monorepo@a
Author | SHA1 | Date | |
---|---|---|---|
|
ac14dd2b29 | ||
|
c354129b6f | ||
|
c7e26cd448 | ||
|
a737cfa004 | ||
|
21f6072186 | ||
|
94badedad4 | ||
|
bf3795d2ac | ||
|
bc48bc99c3 | ||
|
51bfd1ca5e | ||
|
9160cd4983 | ||
|
63d79faa85 | ||
|
70e412e375 | ||
|
a51919db0e | ||
|
60971be35a | ||
|
cb99ebf78a | ||
|
6f02a3f40d | ||
|
0591f1d32a | ||
|
1402119c84 | ||
|
a162281529 | ||
|
8c18a8fefc | ||
|
48f6452c3b | ||
|
bd002caadd | ||
|
d6090921a8 | ||
|
78a693e092 | ||
|
3f61d27656 | ||
|
30525d15f4 | ||
|
c429409ed7 | ||
|
2bdaa58d71 | ||
|
75826fd559 | ||
|
0ce6f03ed5 | ||
|
5d73eebf6a | ||
|
13aa98f0f3 | ||
|
4a94f8b1ca | ||
|
f8532b3f51 | ||
|
b244f3e2c0 | ||
|
f33ecfd2fc | ||
|
f15751d800 | ||
|
e5e439adb9 | ||
|
2d8f423cee | ||
|
5905fdb73b | ||
|
4ed9323804 | ||
|
d77c6e13b0 | ||
|
4e10f2c6f2 | ||
|
d3edb9721c | ||
|
1b35a6e3b5 | ||
|
900a8aee76 | ||
|
de9f5d350f | ||
|
e45f0b0eaf | ||
|
2e7b218f40 | ||
|
7fbfd9ccd9 | ||
|
1db5ff617f | ||
|
ac5376a1ca | ||
|
600ffd93a6 | ||
|
22597674d2 | ||
|
adf5acd5c4 | ||
|
055bcb52f8 | ||
|
6174267f69 | ||
|
e8c8d3e722 | ||
|
d20f713fad | ||
|
b40861747b | ||
|
b73df28454 | ||
|
5afc739397 | ||
|
9eecf3683b | ||
|
7570f3db51 | ||
|
977d55c61b | ||
|
fc3acec669 | ||
|
a05530f821 | ||
|
173b36c54c | ||
|
55ca971186 | ||
|
284930eb58 | ||
|
902691e289 | ||
|
0afe55f2ff | ||
|
21910a7129 | ||
|
9c89d1e99b | ||
|
574270d061 | ||
|
9af5e3ba8e | ||
|
2116548eed | ||
|
57fca16d7b | ||
|
a900255820 | ||
|
bd7565ceda | ||
|
880cd6e440 | ||
|
5e1a2bd972 | ||
|
98d06d6d25 | ||
|
9f0dfb1e1a | ||
|
37cb18e1da | ||
|
3e5d427d4e | ||
|
45dc2be083 | ||
|
31f6fc065f | ||
|
b0484eafe3 | ||
|
1b799e98e8 | ||
|
e6840c60c7 | ||
|
f3deabccf4 | ||
|
393f9e5a29 | ||
|
79cf6969f9 | ||
|
3167bfde1a | ||
|
301e491952 | ||
|
5b6c91bb3f | ||
|
6701ec68bd | ||
|
7b259c3f4c | ||
|
ecbdf5f12b | ||
|
30622631ff | ||
|
4bab402e95 | ||
|
91de15d50e | ||
|
d40a670d0b | ||
|
4ade674ada | ||
|
401ef2edef | ||
|
9201273939 | ||
|
5b07669bd0 | ||
|
3c7155afb0 | ||
|
a75981da14 | ||
|
d5f964b58e | ||
|
cbb5a425df | ||
|
800dd5fb4f | ||
|
3dc4eb4421 | ||
|
75664b6651 | ||
|
327b4ba554 | ||
|
50b725c687 | ||
|
72419816a8 | ||
|
9a4e6da02f | ||
|
823b6c4d7d | ||
|
8d122006ba | ||
|
0e45497acb | ||
|
fe7a62ba9a | ||
|
b88a56e6b7 | ||
|
297cbd996d | ||
|
f55234b4a0 | ||
|
f76c88c549 | ||
|
863966787f | ||
|
7ed31d2fba | ||
|
6273339f7c | ||
|
29f2ae605e | ||
|
6450844d7f | ||
|
9834395a48 | ||
|
f429032eef | ||
|
5088b7f23c | ||
|
28246abec3 | ||
|
a1959df911 | ||
|
775d1efd46 | ||
|
849e203812 | ||
|
80ed724f3a | ||
|
5c056b57b7 | ||
|
4779ebfd20 |
@@ -100,6 +100,7 @@ jobs:
|
|||||||
- run: yarn wsrun test:circleci @0xproject/order-watcher
|
- run: yarn wsrun test:circleci @0xproject/order-watcher
|
||||||
- run: yarn wsrun test:circleci @0xproject/sol-compiler
|
- run: yarn wsrun test:circleci @0xproject/sol-compiler
|
||||||
- run: yarn wsrun test:circleci @0xproject/sol-cov
|
- run: yarn wsrun test:circleci @0xproject/sol-cov
|
||||||
|
- run: yarn wsrun test:circleci @0xproject/sol-doc
|
||||||
- run: yarn wsrun test:circleci @0xproject/sra-report
|
- run: yarn wsrun test:circleci @0xproject/sra-report
|
||||||
- run: yarn wsrun test:circleci @0xproject/subproviders
|
- run: yarn wsrun test:circleci @0xproject/subproviders
|
||||||
- run: yarn wsrun test:circleci @0xproject/web3-wrapper
|
- run: yarn wsrun test:circleci @0xproject/web3-wrapper
|
||||||
@@ -152,6 +153,10 @@ jobs:
|
|||||||
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
paths:
|
paths:
|
||||||
- ~/repo/packages/sol-cov/coverage/lcov.info
|
- ~/repo/packages/sol-cov/coverage/lcov.info
|
||||||
|
- save_cache:
|
||||||
|
key: coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
|
paths:
|
||||||
|
- ~/repo/packages/sol-doc/coverage/lcov.info
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
|
key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
paths:
|
paths:
|
||||||
@@ -218,6 +223,9 @@ jobs:
|
|||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
- coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
|
- coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
|
@@ -35,8 +35,7 @@
|
|||||||
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
|
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
|
||||||
"generate_doc": "node ./packages/monorepo-scripts/lib/doc_generate_and_upload.js",
|
"generate_doc": "node ./packages/monorepo-scripts/lib/doc_generate_and_upload.js",
|
||||||
"test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i --shouldUpload false --isStaging true || break -1; done;",
|
"test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i --shouldUpload false --isStaging true || break -1; done;",
|
||||||
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing",
|
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing"
|
||||||
"comment:postinstall": "HACK: For some reason `yarn` is not setting up symlinks properly for order-utils. We temporarily set them manually. Remove this after V2 refactor is complete."
|
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
|
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
|
||||||
@@ -54,8 +53,5 @@
|
|||||||
"source-map-support": "^0.5.6",
|
"source-map-support": "^0.5.6",
|
||||||
"typescript": "3.0.1",
|
"typescript": "3.0.1",
|
||||||
"wsrun": "^2.2.0"
|
"wsrun": "^2.2.0"
|
||||||
},
|
|
||||||
"resolutions": {
|
|
||||||
"ethers": "0xproject/ethers.js#eip-838-reasons"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.7",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.6",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.7 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.6 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.5 - _September 25, 2018_
|
## v1.0.5 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "0x.js",
|
"name": "0x.js",
|
||||||
"version": "1.0.5",
|
"version": "1.0.7",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -41,10 +41,10 @@
|
|||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0xproject/abi-gen": "^1.0.10",
|
"@0xproject/abi-gen": "^1.0.12",
|
||||||
"@0xproject/dev-utils": "^1.0.9",
|
"@0xproject/dev-utils": "^1.0.11",
|
||||||
"@0xproject/migrations": "^1.0.11",
|
"@0xproject/migrations": "^1.0.13",
|
||||||
"@0xproject/monorepo-scripts": "^1.0.9",
|
"@0xproject/monorepo-scripts": "^1.0.10",
|
||||||
"@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",
|
||||||
@@ -73,18 +73,18 @@
|
|||||||
"webpack": "^3.1.0"
|
"webpack": "^3.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/assert": "^1.0.10",
|
"@0xproject/assert": "^1.0.12",
|
||||||
"@0xproject/base-contract": "^2.0.4",
|
"@0xproject/base-contract": "^3.0.0",
|
||||||
"@0xproject/contract-wrappers": "^1.0.5",
|
"@0xproject/contract-wrappers": "^2.0.1",
|
||||||
"@0xproject/order-utils": "^1.0.4",
|
"@0xproject/order-utils": "^1.0.6",
|
||||||
"@0xproject/order-watcher": "^1.0.5",
|
"@0xproject/order-watcher": "^2.1.0",
|
||||||
"@0xproject/subproviders": "^2.0.4",
|
"@0xproject/subproviders": "^2.0.6",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"ethers": "3.0.22",
|
"ethers": "4.0.0-beta.14",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
"web3-provider-engine": "14.0.6"
|
"web3-provider-engine": "14.0.6"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.12",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.11",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.12 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.11 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.10 - _September 25, 2018_
|
## v1.0.10 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/abi-gen",
|
"name": "@0xproject/abi-gen",
|
||||||
"version": "1.0.10",
|
"version": "1.0.12",
|
||||||
"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": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"chalk": "^2.3.0",
|
"chalk": "^2.3.0",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"glob": "^7.1.2",
|
"glob": "^7.1.2",
|
||||||
"handlebars": "^4.0.11",
|
"handlebars": "^4.0.11",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.12",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.11",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.12 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.11 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.10 - _September 25, 2018_
|
## v1.0.10 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/assert",
|
"name": "@0xproject/assert",
|
||||||
"version": "1.0.10",
|
"version": "1.0.12",
|
||||||
"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.5",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
"valid-url": "^1.0.9"
|
"valid-url": "^1.0.9"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.2",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.1",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.2 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.1 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.0 - _September 25, 2018_
|
## v1.0.0 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/asset-buyer",
|
"name": "@0xproject/asset-buyer",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"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.12",
|
||||||
"@0xproject/connect": "^2.0.3",
|
"@0xproject/connect": "^3.0.0",
|
||||||
"@0xproject/contract-wrappers": "^1.0.5",
|
"@0xproject/contract-wrappers": "^2.0.1",
|
||||||
"@0xproject/json-schemas": "^1.0.3",
|
"@0xproject/json-schemas": "^1.0.5",
|
||||||
"@0xproject/order-utils": "^1.0.4",
|
"@0xproject/order-utils": "^1.0.6",
|
||||||
"@0xproject/subproviders": "^2.0.4",
|
"@0xproject/subproviders": "^2.0.6",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"ethereum-types": "^1.0.6",
|
"ethereum-types": "^1.0.9",
|
||||||
"lodash": "^4.17.10"
|
"lodash": "^4.17.10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@@ -1,4 +1,27 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "3.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Change the way we detect BN to work with the newest ethers.js",
|
||||||
|
"pr": 1069
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Add baseContract._throwIfRevertWithReasonCallResult",
|
||||||
|
"pr": 1069
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1538157789
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "2.0.5",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
|
@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v3.0.0 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Change the way we detect BN to work with the newest ethers.js (#1069)
|
||||||
|
* Add baseContract._throwIfRevertWithReasonCallResult (#1069)
|
||||||
|
|
||||||
|
## v2.0.5 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v2.0.4 - _September 25, 2018_
|
## v2.0.4 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/base-contract",
|
"name": "@0xproject/base-contract",
|
||||||
"version": "2.0.4",
|
"version": "3.0.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -40,11 +40,11 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"ethers": "3.0.22",
|
"ethers": "4.0.0-beta.14",
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -20,6 +20,11 @@ export interface EthersInterfaceByFunctionSignature {
|
|||||||
[key: string]: ethers.Interface;
|
[key: string]: ethers.Interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const REVERT_ERROR_SELECTOR = '08c379a0';
|
||||||
|
const REVERT_ERROR_SELECTOR_OFFSET = 2;
|
||||||
|
const REVERT_ERROR_SELECTOR_BYTES_LENGTH = 4;
|
||||||
|
const REVERT_ERROR_SELECTOR_END = REVERT_ERROR_SELECTOR_OFFSET + REVERT_ERROR_SELECTOR_BYTES_LENGTH * 2;
|
||||||
|
|
||||||
export class BaseContract {
|
export class BaseContract {
|
||||||
protected _ethersInterfacesByFunctionSignature: EthersInterfaceByFunctionSignature;
|
protected _ethersInterfacesByFunctionSignature: EthersInterfaceByFunctionSignature;
|
||||||
protected _web3Wrapper: Web3Wrapper;
|
protected _web3Wrapper: Web3Wrapper;
|
||||||
@@ -61,7 +66,7 @@ export class BaseContract {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected static _bnToBigNumber(_type: string, value: any): any {
|
protected static _bnToBigNumber(_type: string, value: any): any {
|
||||||
return _.isObject(value) && value._bn ? new BigNumber(value.toString()) : value;
|
return _.isObject(value) && value._hex ? new BigNumber(value.toString()) : value;
|
||||||
}
|
}
|
||||||
protected static async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>(
|
protected static async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>(
|
||||||
txData: T,
|
txData: T,
|
||||||
@@ -82,15 +87,24 @@ export class BaseContract {
|
|||||||
}
|
}
|
||||||
return txDataWithDefaults;
|
return txDataWithDefaults;
|
||||||
}
|
}
|
||||||
|
protected static _throwIfRevertWithReasonCallResult(rawCallResult: string): void {
|
||||||
|
if (rawCallResult.slice(REVERT_ERROR_SELECTOR_OFFSET, REVERT_ERROR_SELECTOR_END) === REVERT_ERROR_SELECTOR) {
|
||||||
|
const revertReason = ethers.utils.defaultAbiCoder.decode(
|
||||||
|
['string'],
|
||||||
|
ethers.utils.hexDataSlice(rawCallResult, REVERT_ERROR_SELECTOR_BYTES_LENGTH),
|
||||||
|
);
|
||||||
|
throw new Error(revertReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Throws if the given arguments cannot be safely/correctly encoded based on
|
// Throws if the given arguments cannot be safely/correctly encoded based on
|
||||||
// the given inputAbi. An argument may not be considered safely encodeable
|
// the given inputAbi. An argument may not be considered safely encodeable
|
||||||
// if it overflows the corresponding Solidity type, there is a bug in the
|
// if it overflows the corresponding Solidity type, there is a bug in the
|
||||||
// encoder, or the encoder performs unsafe type coercion.
|
// encoder, or the encoder performs unsafe type coercion.
|
||||||
public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): void {
|
public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): void {
|
||||||
const coder = ethers.utils.AbiCoder.defaultCoder;
|
const coder = new ethers.AbiCoder();
|
||||||
const params = abiUtils.parseEthersParams(inputAbi);
|
const params = abiUtils.parseEthersParams(inputAbi);
|
||||||
const rawEncoded = coder.encode(params.names, params.types, args);
|
const rawEncoded = coder.encode(inputAbi, args);
|
||||||
const rawDecoded = coder.decode(params.names, params.types, rawEncoded);
|
const rawDecoded = coder.decode(inputAbi, rawEncoded);
|
||||||
for (let i = 0; i < rawDecoded.length; i++) {
|
for (let i = 0; i < rawDecoded.length; i++) {
|
||||||
const original = args[i];
|
const original = args[i];
|
||||||
const decoded = rawDecoded[i];
|
const decoded = rawDecoded[i];
|
||||||
|
@@ -1,4 +1,23 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "3.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Change /order_config request to a POST instead of GET",
|
||||||
|
"pr": 1091
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1538157789
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "2.0.4",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v3.0.0 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Change /order_config request to a POST instead of GET (#1091)
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/connect",
|
"name": "@0xproject/connect",
|
||||||
"version": "2.0.3",
|
"version": "3.0.0",
|
||||||
"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.12",
|
||||||
"@0xproject/json-schemas": "^1.0.3",
|
"@0xproject/json-schemas": "^1.0.5",
|
||||||
"@0xproject/order-utils": "^1.0.4",
|
"@0xproject/order-utils": "^1.0.6",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"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",
|
||||||
|
@@ -149,7 +149,7 @@ export class HttpClient implements Client {
|
|||||||
params: requestOpts,
|
params: requestOpts,
|
||||||
payload: request,
|
payload: request,
|
||||||
};
|
};
|
||||||
const responseJson = await this._requestAsync('/order_config', HttpRequestType.Get, httpRequestOpts);
|
const responseJson = await this._requestAsync('/order_config', HttpRequestType.Post, httpRequestOpts);
|
||||||
const fees = relayerResponseJsonParsers.parseOrderConfigResponseJson(responseJson);
|
const fees = relayerResponseJsonParsers.parseOrderConfigResponseJson(responseJson);
|
||||||
return fees;
|
return fees;
|
||||||
}
|
}
|
||||||
|
@@ -148,12 +148,12 @@ describe('HttpClient', () => {
|
|||||||
};
|
};
|
||||||
const url = `${relayUrl}/order_config`;
|
const url = `${relayUrl}/order_config`;
|
||||||
it('gets order config', async () => {
|
it('gets order config', async () => {
|
||||||
fetchMock.get(url, orderConfigResponseJSON);
|
fetchMock.post(url, orderConfigResponseJSON);
|
||||||
const fees = await relayerClient.getOrderConfigAsync(request);
|
const fees = await relayerClient.getOrderConfigAsync(request);
|
||||||
expect(fees).to.be.deep.equal(orderConfigResponse);
|
expect(fees).to.be.deep.equal(orderConfigResponse);
|
||||||
});
|
});
|
||||||
it('does not mutate input', async () => {
|
it('does not mutate input', async () => {
|
||||||
fetchMock.get(url, orderConfigResponseJSON);
|
fetchMock.post(url, orderConfigResponseJSON);
|
||||||
const makerAssetAmountBefore = request.makerAssetAmount;
|
const makerAssetAmountBefore = request.makerAssetAmount;
|
||||||
const takerAssetAmountBefore = request.takerAssetAmount;
|
const takerAssetAmountBefore = request.takerAssetAmount;
|
||||||
const expirationTimeSecondsBefore = request.expirationTimeSeconds;
|
const expirationTimeSecondsBefore = request.expirationTimeSeconds;
|
||||||
@@ -163,7 +163,7 @@ describe('HttpClient', () => {
|
|||||||
expect(expirationTimeSecondsBefore).to.be.deep.equal(request.expirationTimeSeconds);
|
expect(expirationTimeSecondsBefore).to.be.deep.equal(request.expirationTimeSeconds);
|
||||||
});
|
});
|
||||||
it('throws an error for invalid JSON response', async () => {
|
it('throws an error for invalid JSON response', async () => {
|
||||||
fetchMock.get(url, { test: 'dummy' });
|
fetchMock.post(url, { test: 'dummy' });
|
||||||
expect(relayerClient.getOrderConfigAsync(request)).to.be.rejected();
|
expect(relayerClient.getOrderConfigAsync(request)).to.be.rejected();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1538157789,
|
||||||
"version": "1.0.5",
|
"version": "2.0.1",
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Dependencies updated"
|
"note": "Dependencies updated"
|
||||||
@@ -9,13 +9,38 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537541580,
|
"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",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1537875740
|
||||||
|
},
|
||||||
|
{
|
||||||
"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",
|
||||||
|
@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v2.0.1 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## 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
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/contract-wrappers",
|
"name": "@0xproject/contract-wrappers",
|
||||||
"version": "1.0.5",
|
"version": "2.0.1",
|
||||||
"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.12",
|
||||||
"@0xproject/dev-utils": "^1.0.9",
|
"@0xproject/dev-utils": "^1.0.11",
|
||||||
"@0xproject/migrations": "^1.0.11",
|
"@0xproject/migrations": "^1.0.13",
|
||||||
"@0xproject/subproviders": "^2.0.4",
|
"@0xproject/subproviders": "^2.0.6",
|
||||||
"@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,19 +72,19 @@
|
|||||||
"web3-provider-engine": "14.0.6"
|
"web3-provider-engine": "14.0.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/assert": "^1.0.10",
|
"@0xproject/assert": "^1.0.12",
|
||||||
"@0xproject/base-contract": "^2.0.4",
|
"@0xproject/base-contract": "^3.0.0",
|
||||||
"@0xproject/fill-scenarios": "^1.0.4",
|
"@0xproject/fill-scenarios": "^1.0.6",
|
||||||
"@0xproject/json-schemas": "^1.0.3",
|
"@0xproject/json-schemas": "^1.0.5",
|
||||||
"@0xproject/order-utils": "^1.0.4",
|
"@0xproject/order-utils": "^1.0.6",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"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": "4.0.0-beta.14",
|
||||||
"js-sha3": "^0.7.0",
|
"js-sha3": "^0.7.0",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
"uuid": "^3.1.0"
|
"uuid": "^3.1.0"
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
122
packages/contract-wrappers/test/revert_validation_test.ts
Normal file
122
packages/contract-wrappers/test/revert_validation_test.ts
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||||
|
import { FillScenarios } from '@0xproject/fill-scenarios';
|
||||||
|
import { runV2MigrationsAsync } from '@0xproject/migrations';
|
||||||
|
import { assetDataUtils } from '@0xproject/order-utils';
|
||||||
|
import { SignedOrder } from '@0xproject/types';
|
||||||
|
import { BigNumber } from '@0xproject/utils';
|
||||||
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
|
import * as chai from 'chai';
|
||||||
|
import 'mocha';
|
||||||
|
|
||||||
|
import { ContractWrappers } from '../src';
|
||||||
|
|
||||||
|
import { chaiSetup } from './utils/chai_setup';
|
||||||
|
import { constants } from './utils/constants';
|
||||||
|
import { tokenUtils } from './utils/token_utils';
|
||||||
|
|
||||||
|
chaiSetup.configure();
|
||||||
|
const expect = chai.expect;
|
||||||
|
|
||||||
|
describe('Revert Validation ExchangeWrapper', () => {
|
||||||
|
let contractWrappers: ContractWrappers;
|
||||||
|
let userAddresses: string[];
|
||||||
|
let zrxTokenAddress: string;
|
||||||
|
let fillScenarios: FillScenarios;
|
||||||
|
let exchangeContractAddress: string;
|
||||||
|
let makerTokenAddress: string;
|
||||||
|
let takerTokenAddress: string;
|
||||||
|
let coinbase: string;
|
||||||
|
let makerAddress: string;
|
||||||
|
let anotherMakerAddress: string;
|
||||||
|
let takerAddress: string;
|
||||||
|
let makerAssetData: string;
|
||||||
|
let takerAssetData: string;
|
||||||
|
let feeRecipient: string;
|
||||||
|
let txHash: string;
|
||||||
|
let blockchainLifecycle: BlockchainLifecycle;
|
||||||
|
let web3Wrapper: Web3Wrapper;
|
||||||
|
const fillableAmount = new BigNumber(5);
|
||||||
|
const takerTokenFillAmount = new BigNumber(5);
|
||||||
|
let signedOrder: SignedOrder;
|
||||||
|
const config = {
|
||||||
|
networkId: constants.TESTRPC_NETWORK_ID,
|
||||||
|
blockPollingIntervalMs: 0,
|
||||||
|
};
|
||||||
|
before(async () => {
|
||||||
|
// vmErrorsOnRPCResponse is useful for quick feedback and testing during development
|
||||||
|
// but is not the default behaviour in production. Here we ensure our failure cases
|
||||||
|
// are handled in an environment which behaves similar to production
|
||||||
|
const provider = web3Factory.getRpcProvider({
|
||||||
|
shouldUseInProcessGanache: true,
|
||||||
|
shouldThrowErrorsOnGanacheRPCResponse: false,
|
||||||
|
});
|
||||||
|
web3Wrapper = new Web3Wrapper(provider);
|
||||||
|
blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
|
const txDefaults = {
|
||||||
|
gas: devConstants.GAS_LIMIT,
|
||||||
|
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||||
|
};
|
||||||
|
const artifactsDir = `src/artifacts`;
|
||||||
|
// Re-deploy the artifacts in this provider, rather than in the default provider exposed in
|
||||||
|
// the beforeAll hook. This is due to the fact that the default provider enabled vmErrorsOnRPCResponse
|
||||||
|
// and we are explicity testing with vmErrorsOnRPCResponse disabled.
|
||||||
|
await runV2MigrationsAsync(provider, artifactsDir, txDefaults);
|
||||||
|
await blockchainLifecycle.startAsync();
|
||||||
|
contractWrappers = new ContractWrappers(provider, config);
|
||||||
|
exchangeContractAddress = contractWrappers.exchange.getContractAddress();
|
||||||
|
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
|
zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
|
||||||
|
fillScenarios = new FillScenarios(
|
||||||
|
provider,
|
||||||
|
userAddresses,
|
||||||
|
zrxTokenAddress,
|
||||||
|
exchangeContractAddress,
|
||||||
|
contractWrappers.erc20Proxy.getContractAddress(),
|
||||||
|
contractWrappers.erc721Proxy.getContractAddress(),
|
||||||
|
);
|
||||||
|
[coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
|
||||||
|
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
|
||||||
|
[makerAssetData, takerAssetData] = [
|
||||||
|
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
|
||||||
|
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
|
||||||
|
];
|
||||||
|
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
|
||||||
|
makerAssetData,
|
||||||
|
takerAssetData,
|
||||||
|
makerAddress,
|
||||||
|
takerAddress,
|
||||||
|
fillableAmount,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
after(async () => {
|
||||||
|
await blockchainLifecycle.revertAsync();
|
||||||
|
});
|
||||||
|
beforeEach(async () => {
|
||||||
|
await blockchainLifecycle.startAsync();
|
||||||
|
});
|
||||||
|
afterEach(async () => {
|
||||||
|
await blockchainLifecycle.revertAsync();
|
||||||
|
});
|
||||||
|
describe('#fillOrderAsync', () => {
|
||||||
|
it('should throw the revert reason when shouldValidate is true and a fill would revert', async () => {
|
||||||
|
// Create a scenario where the fill will revert
|
||||||
|
const makerTokenBalance = await contractWrappers.erc20Token.getBalanceAsync(
|
||||||
|
makerTokenAddress,
|
||||||
|
makerAddress,
|
||||||
|
);
|
||||||
|
// Transfer all of the tokens from maker to create a failure scenario
|
||||||
|
txHash = await contractWrappers.erc20Token.transferAsync(
|
||||||
|
makerTokenAddress,
|
||||||
|
makerAddress,
|
||||||
|
takerAddress,
|
||||||
|
makerTokenBalance,
|
||||||
|
);
|
||||||
|
await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||||
|
expect(
|
||||||
|
contractWrappers.exchange.fillOrderAsync(signedOrder, takerTokenFillAmount, takerAddress, {
|
||||||
|
shouldValidate: true,
|
||||||
|
}),
|
||||||
|
).to.be.rejectedWith('TRANSFER_FAILED');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@@ -1,6 +1,6 @@
|
|||||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||||
import { FillScenarios } from '@0xproject/fill-scenarios';
|
import { FillScenarios } from '@0xproject/fill-scenarios';
|
||||||
import { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils';
|
import { assetDataUtils, generatePseudoRandomSalt, orderHashUtils, signatureUtils } from '@0xproject/order-utils';
|
||||||
import { SignedOrder, SignerType } from '@0xproject/types';
|
import { SignedOrder, SignerType } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
|
@@ -65,10 +65,12 @@ export class {{contractName}}Contract extends BaseContract {
|
|||||||
[{{> params inputs=ctor.inputs}}],
|
[{{> params inputs=ctor.inputs}}],
|
||||||
BaseContract._bigNumberToString,
|
BaseContract._bigNumberToString,
|
||||||
);
|
);
|
||||||
const txData = ethers.Contract.getDeployTransaction(bytecode, abi, {{> params inputs=ctor.inputs}});
|
const iface = new ethers.Interface(abi);
|
||||||
|
const deployInfo = iface.deployFunction;
|
||||||
|
const txData = deployInfo.encode(bytecode, [{{> params inputs=ctor.inputs}}]);
|
||||||
const web3Wrapper = new Web3Wrapper(provider);
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||||
txData,
|
{data: txData},
|
||||||
txDefaults,
|
txDefaults,
|
||||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||||
);
|
);
|
||||||
|
@@ -8,10 +8,8 @@ async callAsync(
|
|||||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
|
BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
|
||||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}}(
|
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}};
|
||||||
{{> params inputs=inputs}}
|
const encodedData = ethersFunction.encode([{{> params inputs=inputs}}]);
|
||||||
) as ethers.CallDescription;
|
|
||||||
const encodedData = ethersFunction.data;
|
|
||||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||||
{
|
{
|
||||||
to: self.address,
|
to: self.address,
|
||||||
@@ -21,7 +19,8 @@ async callAsync(
|
|||||||
self._web3Wrapper.getContractDefaults(),
|
self._web3Wrapper.getContractDefaults(),
|
||||||
);
|
);
|
||||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||||
let resultArray = ethersFunction.parse(rawCallResult);
|
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||||
|
let resultArray = ethersFunction.decode(rawCallResult);
|
||||||
const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs;
|
const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs;
|
||||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||||
|
@@ -12,9 +12,7 @@ public {{this.tsName}} = {
|
|||||||
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
|
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
|
||||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
|
BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
|
||||||
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
|
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
|
||||||
{{> params inputs=inputs}}
|
|
||||||
).data;
|
|
||||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||||
{
|
{
|
||||||
to: self.address,
|
to: self.address,
|
||||||
@@ -37,9 +35,7 @@ public {{this.tsName}} = {
|
|||||||
const self = this as any as {{contractName}}Contract;
|
const self = this as any as {{contractName}}Contract;
|
||||||
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
|
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
|
||||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString);
|
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString);
|
||||||
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
|
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
|
||||||
{{> params inputs=inputs}}
|
|
||||||
).data;
|
|
||||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||||
{
|
{
|
||||||
to: self.address,
|
to: self.address,
|
||||||
@@ -57,9 +53,7 @@ public {{this.tsName}} = {
|
|||||||
const self = this as any as {{contractName}}Contract;
|
const self = this as any as {{contractName}}Contract;
|
||||||
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
|
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
|
||||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString);
|
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString);
|
||||||
const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
|
const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
|
||||||
{{> params inputs=inputs}}
|
|
||||||
).data;
|
|
||||||
return abiEncodedTransactionData;
|
return abiEncodedTransactionData;
|
||||||
},
|
},
|
||||||
{{> callAsync}}
|
{{> callAsync}}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "contracts",
|
"name": "contracts",
|
||||||
"version": "2.1.46",
|
"version": "2.1.48",
|
||||||
"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.12",
|
||||||
"@0xproject/dev-utils": "^1.0.9",
|
"@0xproject/dev-utils": "^1.0.11",
|
||||||
"@0xproject/sol-compiler": "^1.1.4",
|
"@0xproject/sol-compiler": "^1.1.6",
|
||||||
"@0xproject/sol-cov": "^2.1.4",
|
"@0xproject/sol-cov": "^2.1.6",
|
||||||
"@0xproject/subproviders": "^2.0.4",
|
"@0xproject/subproviders": "^2.0.6",
|
||||||
"@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,18 +72,18 @@
|
|||||||
"yargs": "^10.0.3"
|
"yargs": "^10.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/base-contract": "^2.0.4",
|
"@0xproject/base-contract": "^3.0.0",
|
||||||
"@0xproject/order-utils": "^1.0.4",
|
"@0xproject/order-utils": "^1.0.6",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"@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.9",
|
||||||
"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": "4.0.0-beta.14",
|
||||||
"js-combinatorics": "^0.5.3",
|
"js-combinatorics": "^0.5.3",
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.11",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.10",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.11 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.10 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.9 - _September 25, 2018_
|
## v1.0.9 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/dev-utils",
|
"name": "@0xproject/dev-utils",
|
||||||
"version": "1.0.9",
|
"version": "1.0.11",
|
||||||
"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.6",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -14,6 +14,7 @@ import { env, EnvVars } from './env';
|
|||||||
export interface Web3Config {
|
export interface Web3Config {
|
||||||
hasAddresses?: boolean; // default: true
|
hasAddresses?: boolean; // default: true
|
||||||
shouldUseInProcessGanache?: boolean; // default: false
|
shouldUseInProcessGanache?: boolean; // default: false
|
||||||
|
shouldThrowErrorsOnGanacheRPCResponse?: boolean; // default: true
|
||||||
rpcUrl?: string; // default: localhost:8545
|
rpcUrl?: string; // default: localhost:8545
|
||||||
shouldUseFakeGasEstimate?: boolean; // default: true
|
shouldUseFakeGasEstimate?: boolean; // default: true
|
||||||
}
|
}
|
||||||
@@ -41,15 +42,19 @@ export const web3Factory = {
|
|||||||
if (!_.isUndefined(config.rpcUrl)) {
|
if (!_.isUndefined(config.rpcUrl)) {
|
||||||
throw new Error('Cannot use both GanacheSubrovider and RPCSubprovider');
|
throw new Error('Cannot use both GanacheSubrovider and RPCSubprovider');
|
||||||
}
|
}
|
||||||
|
const shouldThrowErrorsOnGanacheRPCResponse =
|
||||||
|
_.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) ||
|
||||||
|
config.shouldThrowErrorsOnGanacheRPCResponse;
|
||||||
provider.addProvider(
|
provider.addProvider(
|
||||||
new GanacheSubprovider({
|
new GanacheSubprovider({
|
||||||
|
vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse,
|
||||||
gasLimit: constants.GAS_LIMIT,
|
gasLimit: constants.GAS_LIMIT,
|
||||||
logger,
|
logger,
|
||||||
verbose: env.parseBoolean(EnvVars.VerboseGanache),
|
verbose: env.parseBoolean(EnvVars.VerboseGanache),
|
||||||
port: 8545,
|
port: 8545,
|
||||||
network_id: 50,
|
network_id: 50,
|
||||||
mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
|
mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
|
||||||
}),
|
} as any), // TODO remove any once types are merged in DefinitelyTyped
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
provider.addProvider(new RPCSubprovider(config.rpcUrl || constants.RPC_URL));
|
provider.addProvider(new RPCSubprovider(config.rpcUrl || constants.RPC_URL));
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.9",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.8",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537541580,
|
"timestamp": 1537541580,
|
||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.9 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.8 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.7 - _September 21, 2018_
|
## v1.0.7 - _September 21, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ethereum-types",
|
"name": "ethereum-types",
|
||||||
"version": "1.0.7",
|
"version": "1.0.9",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
|
@@ -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[];
|
||||||
}
|
}
|
||||||
@@ -324,9 +325,59 @@ export interface ContractNetworkData {
|
|||||||
constructorArgs: string;
|
constructorArgs: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ParamDescription = string;
|
||||||
|
|
||||||
export interface StandardContractOutput {
|
export interface StandardContractOutput {
|
||||||
abi: ContractAbi;
|
abi: ContractAbi;
|
||||||
evm: EvmOutput;
|
evm: EvmOutput;
|
||||||
|
devdoc?: DevdocOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StandardOutput {
|
||||||
|
errors: SolcError[];
|
||||||
|
sources: {
|
||||||
|
[fileName: string]: {
|
||||||
|
id: number;
|
||||||
|
ast?: object;
|
||||||
|
legacyAST?: object;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
contracts: {
|
||||||
|
[fileName: string]: {
|
||||||
|
[contractName: string]: StandardContractOutput;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ErrorType =
|
||||||
|
| 'JSONError'
|
||||||
|
| 'IOError'
|
||||||
|
| 'ParserError'
|
||||||
|
| 'DocstringParsingError'
|
||||||
|
| 'SyntaxError'
|
||||||
|
| 'DeclarationError'
|
||||||
|
| 'TypeError'
|
||||||
|
| 'UnimplementedFeatureError'
|
||||||
|
| 'InternalCompilerError'
|
||||||
|
| 'Exception'
|
||||||
|
| 'CompilerError'
|
||||||
|
| 'FatalError'
|
||||||
|
| 'Warning';
|
||||||
|
export type ErrorSeverity = 'error' | 'warning';
|
||||||
|
|
||||||
|
export interface SolcError {
|
||||||
|
sourceLocation?: SourceLocation;
|
||||||
|
type: ErrorType;
|
||||||
|
component: 'general' | 'ewasm';
|
||||||
|
severity: ErrorSeverity;
|
||||||
|
message: string;
|
||||||
|
formattedMessage?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SourceLocation {
|
||||||
|
file: string;
|
||||||
|
start: number;
|
||||||
|
end: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EvmOutput {
|
export interface EvmOutput {
|
||||||
@@ -339,6 +390,20 @@ export interface EvmBytecodeOutput {
|
|||||||
sourceMap: string;
|
sourceMap: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DevdocOutput {
|
||||||
|
title: string;
|
||||||
|
author: string;
|
||||||
|
methods: {
|
||||||
|
[signature: string]: {
|
||||||
|
details: string;
|
||||||
|
params: {
|
||||||
|
[name: string]: ParamDescription;
|
||||||
|
};
|
||||||
|
return?: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface ContractVersionData {
|
export interface ContractVersionData {
|
||||||
compiler: CompilerOpts;
|
compiler: CompilerOpts;
|
||||||
sources: {
|
sources: {
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.6",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.5",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.6 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.5 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.4 - _September 25, 2018_
|
## v1.0.4 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/fill-scenarios",
|
"name": "@0xproject/fill-scenarios",
|
||||||
"version": "1.0.4",
|
"version": "1.0.6",
|
||||||
"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.12",
|
||||||
"@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,14 +37,14 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/base-contract": "^2.0.4",
|
"@0xproject/base-contract": "^3.0.0",
|
||||||
"@0xproject/order-utils": "^1.0.4",
|
"@0xproject/order-utils": "^1.0.6",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"ethers": "3.0.22",
|
"ethers": "4.0.0-beta.14",
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.5",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.4",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.5 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.4 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.3 - _September 25, 2018_
|
## v1.0.3 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/json-schemas",
|
"name": "@0xproject/json-schemas",
|
||||||
"version": "1.0.3",
|
"version": "1.0.5",
|
||||||
"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": "^3.0.0",
|
||||||
"@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": "^2.0.0",
|
||||||
"@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",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/metacoin",
|
"name": "@0xproject/metacoin",
|
||||||
"version": "0.0.20",
|
"version": "0.0.22",
|
||||||
"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.12",
|
||||||
"@0xproject/base-contract": "^2.0.4",
|
"@0xproject/base-contract": "^3.0.0",
|
||||||
"@0xproject/sol-cov": "^2.1.4",
|
"@0xproject/sol-cov": "^2.1.6",
|
||||||
"@0xproject/subproviders": "^2.0.4",
|
"@0xproject/subproviders": "^2.0.6",
|
||||||
"@0xproject/tslint-config": "^1.0.7",
|
"@0xproject/tslint-config": "^1.0.7",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"@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.9",
|
||||||
"ethers": "3.0.22",
|
"ethers": "4.0.0-beta.14",
|
||||||
"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.11",
|
||||||
"@0xproject/sol-compiler": "^1.1.4",
|
"@0xproject/sol-compiler": "^1.1.6",
|
||||||
"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",
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.13",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.12",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.11",
|
"version": "1.0.11",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.13 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.12 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.11 - _September 25, 2018_
|
## v1.0.11 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/migrations",
|
"name": "@0xproject/migrations",
|
||||||
"version": "1.0.11",
|
"version": "1.0.13",
|
||||||
"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.12",
|
||||||
"@0xproject/dev-utils": "^1.0.9",
|
"@0xproject/dev-utils": "^1.0.11",
|
||||||
"@0xproject/tslint-config": "^1.0.7",
|
"@0xproject/tslint-config": "^1.0.7",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@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,16 +44,16 @@
|
|||||||
"yargs": "^10.0.3"
|
"yargs": "^10.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/base-contract": "^2.0.4",
|
"@0xproject/base-contract": "^3.0.0",
|
||||||
"@0xproject/order-utils": "^1.0.4",
|
"@0xproject/order-utils": "^1.0.6",
|
||||||
"@0xproject/sol-compiler": "^1.1.4",
|
"@0xproject/sol-compiler": "^1.1.6",
|
||||||
"@0xproject/subproviders": "^2.0.4",
|
"@0xproject/subproviders": "^2.0.6",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"@ledgerhq/hw-app-eth": "^4.3.0",
|
"@ledgerhq/hw-app-eth": "^4.3.0",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"ethers": "3.0.22",
|
"ethers": "4.0.0-beta.14",
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "@0xproject/monorepo-scripts",
|
"name": "@0xproject/monorepo-scripts",
|
||||||
"version": "1.0.9",
|
"version": "1.0.10",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import * as _ from 'lodash';
|
||||||
import * as yargs from 'yargs';
|
import * as yargs from 'yargs';
|
||||||
|
|
||||||
import { publishReleaseNotesAsync } from './utils/github_release_utils';
|
import { publishReleaseNotesAsync } from './utils/github_release_utils';
|
||||||
@@ -9,14 +10,25 @@ const args = yargs
|
|||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
demandOption: true,
|
demandOption: true,
|
||||||
})
|
})
|
||||||
.example('$0 --isDryRun true', 'Full usage example').argv;
|
.option('packages', {
|
||||||
|
describe:
|
||||||
|
'Space-separated list of packages to generated release notes for. If not supplied, it does all `Lerna updated` packages.',
|
||||||
|
type: 'string',
|
||||||
|
})
|
||||||
|
.example('$0 --isDryRun true --packages "0x.js @0xproject/web3-wrapper"', 'Full usage example').argv;
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const isDryRun = args.isDryRun;
|
const isDryRun = args.isDryRun;
|
||||||
|
let packages;
|
||||||
|
if (_.isUndefined(args.packages)) {
|
||||||
const shouldIncludePrivate = false;
|
const shouldIncludePrivate = false;
|
||||||
const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
|
packages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
|
||||||
|
} else {
|
||||||
|
const packageNames = args.packages.split(' ');
|
||||||
|
packages = await utils.getPackagesByNameAsync(packageNames);
|
||||||
|
}
|
||||||
|
|
||||||
await publishReleaseNotesAsync(allUpdatedPackages, isDryRun);
|
await publishReleaseNotesAsync(packages, isDryRun);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
})().catch(err => {
|
})().catch(err => {
|
||||||
utils.log(err);
|
utils.log(err);
|
||||||
|
@@ -54,6 +54,13 @@ export const utils = {
|
|||||||
}
|
}
|
||||||
return packages;
|
return packages;
|
||||||
},
|
},
|
||||||
|
async getPackagesByNameAsync(packageNames: string[]): Promise<Package[]> {
|
||||||
|
const allPackages = utils.getPackages(constants.monorepoRootPath);
|
||||||
|
const updatedPackages = _.filter(allPackages, pkg => {
|
||||||
|
return _.includes(packageNames, pkg.packageJson.name);
|
||||||
|
});
|
||||||
|
return updatedPackages;
|
||||||
|
},
|
||||||
async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
|
async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
|
||||||
const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
|
const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
|
||||||
const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name);
|
const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name);
|
||||||
|
@@ -1,4 +1,24 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "1.0.6",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note":
|
||||||
|
"Add signerAddress normalization to `isValidECSignature` to avoid `invalid address recovery` error if caller supplies a checksummed address",
|
||||||
|
"pr": 1096
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1538157789
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.5",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.6 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Add signerAddress normalization to `isValidECSignature` to avoid `invalid address recovery` error if caller supplies a checksummed address (#1096)
|
||||||
|
|
||||||
|
## v1.0.5 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.4 - _September 25, 2018_
|
## v1.0.4 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/order-utils",
|
"name": "@0xproject/order-utils",
|
||||||
"version": "1.0.4",
|
"version": "1.0.6",
|
||||||
"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.11",
|
||||||
"@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,19 +57,19 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/assert": "^1.0.10",
|
"@0xproject/assert": "^1.0.12",
|
||||||
"@0xproject/base-contract": "^2.0.4",
|
"@0xproject/base-contract": "^3.0.0",
|
||||||
"@0xproject/json-schemas": "^1.0.3",
|
"@0xproject/json-schemas": "^1.0.5",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"bn.js": "^4.11.8",
|
"bn.js": "^4.11.8",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"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": "4.0.0-beta.14",
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
@@ -174,6 +174,7 @@ export const signatureUtils = {
|
|||||||
assert.isHexString('data', data);
|
assert.isHexString('data', data);
|
||||||
assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema);
|
assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema);
|
||||||
assert.isETHAddressHex('signerAddress', signerAddress);
|
assert.isETHAddressHex('signerAddress', signerAddress);
|
||||||
|
const normalizedSignerAddress = signerAddress.toLowerCase();
|
||||||
|
|
||||||
const msgHashBuff = ethUtil.toBuffer(data);
|
const msgHashBuff = ethUtil.toBuffer(data);
|
||||||
try {
|
try {
|
||||||
@@ -184,7 +185,8 @@ export const signatureUtils = {
|
|||||||
ethUtil.toBuffer(signature.s),
|
ethUtil.toBuffer(signature.s),
|
||||||
);
|
);
|
||||||
const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey));
|
const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey));
|
||||||
return retrievedAddress === signerAddress;
|
const normalizedRetrievedAddress = retrievedAddress.toLowerCase();
|
||||||
|
return normalizedRetrievedAddress === normalizedSignerAddress;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,21 +1,52 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"version": "2.1.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Export ExpirationWatcher",
|
||||||
|
"pr": 1097
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1538157789
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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",
|
||||||
|
@@ -5,6 +5,16 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v2.1.0 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Export ExpirationWatcher (#1097)
|
||||||
|
|
||||||
|
## 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
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/order-watcher",
|
"name": "@0xproject/order-watcher",
|
||||||
"version": "1.0.5",
|
"version": "2.1.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.12",
|
||||||
"@0xproject/dev-utils": "^1.0.9",
|
"@0xproject/dev-utils": "^1.0.11",
|
||||||
"@0xproject/migrations": "^1.0.11",
|
"@0xproject/migrations": "^1.0.13",
|
||||||
"@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,20 +70,20 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/assert": "^1.0.10",
|
"@0xproject/assert": "^1.0.12",
|
||||||
"@0xproject/base-contract": "^2.0.4",
|
"@0xproject/base-contract": "^3.0.0",
|
||||||
"@0xproject/contract-wrappers": "^1.0.5",
|
"@0xproject/contract-wrappers": "^2.0.1",
|
||||||
"@0xproject/fill-scenarios": "^1.0.4",
|
"@0xproject/fill-scenarios": "^1.0.6",
|
||||||
"@0xproject/json-schemas": "^1.0.3",
|
"@0xproject/json-schemas": "^1.0.5",
|
||||||
"@0xproject/order-utils": "^1.0.4",
|
"@0xproject/order-utils": "^1.0.6",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"bintrees": "^1.0.2",
|
"bintrees": "^1.0.2",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"ethereumjs-blockstream": "5.0.0",
|
"ethereumjs-blockstream": "6.0.0",
|
||||||
"ethers": "3.0.22",
|
"ethers": "4.0.0-beta.14",
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
export { OrderWatcher } from './order_watcher/order_watcher';
|
export { OrderWatcher } from './order_watcher/order_watcher';
|
||||||
|
export { ExpirationWatcher } from './order_watcher/expiration_watcher';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
OrderStateValid,
|
OrderStateValid,
|
||||||
|
@@ -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(
|
||||||
|
@@ -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
|
||||||
}
|
}
|
||||||
|
@@ -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(
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.12",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.11",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.12 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.11 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.10 - _September 25, 2018_
|
## v1.0.10 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#### WARNING: Alpha software. Expect things to break when trying to use.
|
#### WARNING: Alpha software. Expect things to break when trying to use.
|
||||||
|
|
||||||
A full-page React component for rendering beautiful documentation for Solidity and Typescript code generated with [TypeDoc](http://typedoc.org/) or [Doxity](https://github.com/0xproject/doxity).
|
A full-page React component for rendering beautiful documentation for Solidity and Typescript code generated with [TypeDoc](http://typedoc.org/) or [sol-doc](https://github.com/0xProject/0x-monorepo/tree/development/packages/sol-doc).
|
||||||
|
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<img src="https://s3.eu-west-2.amazonaws.com/0x-wiki-images/screenshot.png" style="padding-bottom: 20px; padding-top: 20px;" width="80%" />
|
<img src="https://s3.eu-west-2.amazonaws.com/0x-wiki-images/screenshot.png" style="padding-bottom: 20px; padding-top: 20px;" width="80%" />
|
||||||
@@ -47,7 +47,7 @@ Feel free to contribute to these improvements!
|
|||||||
|
|
||||||
* Allow user to pass in styling for all major elements similar to [Material-UI](http://www.material-ui.com/).
|
* Allow user to pass in styling for all major elements similar to [Material-UI](http://www.material-ui.com/).
|
||||||
* Allow user to define an alternative font and have it change everywhere.
|
* Allow user to define an alternative font and have it change everywhere.
|
||||||
* Add source links to Solidity docs (currently unsupported by Doxity).
|
* Add source links to Solidity docs (currently unsupported by solc, which underlies sol-doc).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/react-docs",
|
"name": "@0xproject/react-docs",
|
||||||
"version": "1.0.10",
|
"version": "1.0.12",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
"description": "React documentation component for rendering TypeDoc & Doxity generated JSON",
|
"description": "React documentation component for rendering TypeDoc & sol-doc generated JSON",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -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.11",
|
||||||
"@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,9 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/react-shared": "^1.0.11",
|
"@0xproject/react-shared": "^1.0.13",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/types": "^1.1.2",
|
||||||
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@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": "*",
|
||||||
|
@@ -2,7 +2,7 @@ import { logUtils } from '@0xproject/utils';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { CustomType } from '../types';
|
import { CustomType } from '@0xproject/types';
|
||||||
|
|
||||||
const STRING_ENUM_CODE_PREFIX = ' strEnum(';
|
const STRING_ENUM_CODE_PREFIX = ' strEnum(';
|
||||||
|
|
||||||
|
@@ -9,24 +9,23 @@ import {
|
|||||||
Styles,
|
Styles,
|
||||||
utils as sharedUtils,
|
utils as sharedUtils,
|
||||||
} from '@0xproject/react-shared';
|
} from '@0xproject/react-shared';
|
||||||
|
import {
|
||||||
|
DocAgnosticFormat,
|
||||||
|
Event,
|
||||||
|
ExternalExportToLink,
|
||||||
|
Property,
|
||||||
|
SolidityMethod,
|
||||||
|
TypeDefinitionByName,
|
||||||
|
TypescriptFunction,
|
||||||
|
TypescriptMethod,
|
||||||
|
} from '@0xproject/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import CircularProgress from 'material-ui/CircularProgress';
|
import CircularProgress from 'material-ui/CircularProgress';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import {
|
import { AddressByContractName, SupportedDocJson } from '../types';
|
||||||
AddressByContractName,
|
|
||||||
DocAgnosticFormat,
|
|
||||||
Event,
|
|
||||||
ExternalExportToLink,
|
|
||||||
Property,
|
|
||||||
SolidityMethod,
|
|
||||||
SupportedDocJson,
|
|
||||||
TypeDefinitionByName,
|
|
||||||
TypescriptFunction,
|
|
||||||
TypescriptMethod,
|
|
||||||
} from '../types';
|
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Badge } from './badge';
|
import { Badge } from './badge';
|
||||||
@@ -330,7 +329,7 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
|
|||||||
return <div>{externalExports}</div>;
|
return <div>{externalExports}</div>;
|
||||||
}
|
}
|
||||||
private _renderNetworkBadgesIfExists(sectionName: string): React.ReactNode {
|
private _renderNetworkBadgesIfExists(sectionName: string): React.ReactNode {
|
||||||
if (this.props.docsInfo.type !== SupportedDocJson.Doxity) {
|
if (this.props.docsInfo.type !== SupportedDocJson.SolDoc) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
|
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
|
||||||
|
import { Event, EventArg } from '@0xproject/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Event, EventArg } from '../types';
|
|
||||||
|
|
||||||
import { Type } from './type';
|
import { Type } from './type';
|
||||||
|
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import { CustomType, TypeDefinitionByName } from '@0xproject/types';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { CustomType, TypeDefinitionByName } from '../types';
|
|
||||||
|
|
||||||
import { Signature } from './signature';
|
import { Signature } from './signature';
|
||||||
import { Type } from './type';
|
import { Type } from './type';
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { AnchorTitle, HeaderSizes } from '@0xproject/react-shared';
|
import { AnchorTitle, HeaderSizes } from '@0xproject/react-shared';
|
||||||
|
import { Property, TypeDefinitionByName } from '@0xproject/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Property, TypeDefinitionByName } from '../types';
|
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Comment } from './comment';
|
import { Comment } from './comment';
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '@0xproject/types';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '../types';
|
|
||||||
|
|
||||||
import { Type } from './type';
|
import { Type } from './type';
|
||||||
|
|
||||||
@@ -134,7 +135,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 +146,8 @@ function renderTypeParameter(
|
|||||||
docsInfo={docsInfo}
|
docsInfo={docsInfo}
|
||||||
isInPopover={isInPopover}
|
isInPopover={isInPopover}
|
||||||
/>
|
/>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
{`>`}
|
{`>`}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
@@ -1,9 +1,15 @@
|
|||||||
import { AnchorTitle, colors, HeaderSizes, Styles } from '@0xproject/react-shared';
|
import { AnchorTitle, colors, HeaderSizes, Styles } from '@0xproject/react-shared';
|
||||||
|
import {
|
||||||
|
Parameter,
|
||||||
|
SolidityMethod,
|
||||||
|
TypeDefinitionByName,
|
||||||
|
TypescriptFunction,
|
||||||
|
TypescriptMethod,
|
||||||
|
} from '@0xproject/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Parameter, SolidityMethod, TypeDefinitionByName, TypescriptFunction, TypescriptMethod } from '../types';
|
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Comment } from './comment';
|
import { Comment } from './comment';
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
import { colors } from '@0xproject/react-shared';
|
import { colors } from '@0xproject/react-shared';
|
||||||
|
import { Source } from '@0xproject/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { Source } from '../types';
|
|
||||||
|
|
||||||
export interface SourceLinkProps {
|
export interface SourceLinkProps {
|
||||||
source: Source;
|
source: Source;
|
||||||
sourceUrl: string;
|
sourceUrl: string;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { colors, constants as sharedConstants, utils as sharedUtils } from '@0xproject/react-shared';
|
import { colors, constants as sharedConstants, utils as sharedUtils } from '@0xproject/react-shared';
|
||||||
|
import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types';
|
||||||
import { errorUtils } from '@0xproject/utils';
|
import { errorUtils } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
@@ -6,7 +7,6 @@ import { Link as ScrollLink } from 'react-scroll';
|
|||||||
import * as ReactTooltip from 'react-tooltip';
|
import * as ReactTooltip from 'react-tooltip';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '../types';
|
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Signature } from './signature';
|
import { Signature } from './signature';
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
|
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
|
||||||
|
import { CustomType, CustomTypeChild, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types';
|
||||||
import { errorUtils } from '@0xproject/utils';
|
import { errorUtils } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { CustomType, CustomTypeChild, KindString, TypeDefinitionByName, TypeDocTypes } from '../types';
|
import { KindString } from '../types';
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Comment } from './comment';
|
import { Comment } from './comment';
|
||||||
|
@@ -1,20 +1,15 @@
|
|||||||
import { MenuSubsectionsBySection } from '@0xproject/react-shared';
|
import { MenuSubsectionsBySection } from '@0xproject/react-shared';
|
||||||
|
import { DocAgnosticFormat, TypeDefinitionByName } from '@0xproject/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ContractsByVersionByNetworkId,
|
ContractsByVersionByNetworkId,
|
||||||
DocAgnosticFormat,
|
|
||||||
DocsInfoConfig,
|
DocsInfoConfig,
|
||||||
DocsMenu,
|
DocsMenu,
|
||||||
DoxityDocObj,
|
|
||||||
GeneratedDocJson,
|
|
||||||
SectionNameToMarkdownByVersion,
|
SectionNameToMarkdownByVersion,
|
||||||
SectionsMap,
|
SectionsMap,
|
||||||
SupportedDocJson,
|
SupportedDocJson,
|
||||||
TypeDefinitionByName,
|
|
||||||
} from './types';
|
} from './types';
|
||||||
import { doxityUtils } from './utils/doxity_utils';
|
|
||||||
import { TypeDocUtils } from './utils/typedoc_utils';
|
|
||||||
|
|
||||||
export class DocsInfo {
|
export class DocsInfo {
|
||||||
public id: string;
|
public id: string;
|
||||||
@@ -95,12 +90,4 @@ export class DocsInfo {
|
|||||||
const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any;
|
const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any;
|
||||||
return typeDefinitionByName;
|
return typeDefinitionByName;
|
||||||
}
|
}
|
||||||
public convertToDocAgnosticFormat(docObj: DoxityDocObj | GeneratedDocJson): DocAgnosticFormat {
|
|
||||||
if (this.type === SupportedDocJson.Doxity) {
|
|
||||||
return doxityUtils.convertToDocAgnosticFormat(docObj as DoxityDocObj);
|
|
||||||
} else {
|
|
||||||
const typeDocUtils = new TypeDocUtils(docObj as GeneratedDocJson, this);
|
|
||||||
return typeDocUtils.convertToDocAgnosticFormat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
export { DocAgnosticFormat, GeneratedDocJson } from '@0xproject/types';
|
||||||
|
|
||||||
// Exported to give users of this library added flexibility if they want to build
|
// Exported to give users of this library added flexibility if they want to build
|
||||||
// a docs page from scratch using the individual components.
|
// a docs page from scratch using the individual components.
|
||||||
export { Badge } from './components/badge';
|
export { Badge } from './components/badge';
|
||||||
@@ -12,17 +14,10 @@ export { Signature } from './components/signature';
|
|||||||
export { SourceLink } from './components/source_link';
|
export { SourceLink } from './components/source_link';
|
||||||
export { TypeDefinition } from './components/type_definition';
|
export { TypeDefinition } from './components/type_definition';
|
||||||
export { Type } from './components/type';
|
export { Type } from './components/type';
|
||||||
|
export { TypeDocUtils } from './utils/typedoc_utils';
|
||||||
|
|
||||||
export { DocsInfo } from './docs_info';
|
export { DocsInfo } from './docs_info';
|
||||||
|
|
||||||
export {
|
export { DocsInfoConfig, DocsMenu, SupportedDocJson } from './types';
|
||||||
DocsInfoConfig,
|
|
||||||
DocAgnosticFormat,
|
|
||||||
DoxityDocObj,
|
|
||||||
DocsMenu,
|
|
||||||
SupportedDocJson,
|
|
||||||
TypeDocNode,
|
|
||||||
GeneratedDocJson,
|
|
||||||
} from './types';
|
|
||||||
|
|
||||||
export { constants } from './utils/constants';
|
export { constants } from './utils/constants';
|
||||||
|
@@ -22,72 +22,6 @@ export interface SectionsMap {
|
|||||||
[sectionName: string]: string;
|
[sectionName: string]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TypeDocType {
|
|
||||||
type: TypeDocTypes;
|
|
||||||
value: string;
|
|
||||||
name: string;
|
|
||||||
types: TypeDocType[];
|
|
||||||
typeArguments?: TypeDocType[];
|
|
||||||
declaration: TypeDocNode;
|
|
||||||
elementType?: TypeDocType;
|
|
||||||
indexSignature?: TypeDocNode;
|
|
||||||
elements?: TupleElement[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TupleElement {
|
|
||||||
type: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeDocFlags {
|
|
||||||
isStatic?: boolean;
|
|
||||||
isOptional?: boolean;
|
|
||||||
isPublic?: boolean;
|
|
||||||
isExported?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeDocGroup {
|
|
||||||
title: string;
|
|
||||||
children: number[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeDocNode {
|
|
||||||
id?: number;
|
|
||||||
name?: string;
|
|
||||||
kind?: string;
|
|
||||||
defaultValue?: string;
|
|
||||||
kindString?: string;
|
|
||||||
type?: TypeDocType;
|
|
||||||
fileName?: string;
|
|
||||||
line?: number;
|
|
||||||
comment?: TypeDocNode;
|
|
||||||
text?: string;
|
|
||||||
shortText?: string;
|
|
||||||
returns?: string;
|
|
||||||
declaration: TypeDocNode;
|
|
||||||
flags?: TypeDocFlags;
|
|
||||||
indexSignature?: TypeDocNode;
|
|
||||||
signatures?: TypeDocNode[];
|
|
||||||
parameters?: TypeDocNode[];
|
|
||||||
typeParameter?: TypeDocNode[];
|
|
||||||
sources?: TypeDocNode[];
|
|
||||||
children?: TypeDocNode[];
|
|
||||||
groups?: TypeDocGroup[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum TypeDocTypes {
|
|
||||||
Intrinsic = 'intrinsic',
|
|
||||||
Reference = 'reference',
|
|
||||||
Array = 'array',
|
|
||||||
StringLiteral = 'stringLiteral',
|
|
||||||
Reflection = 'reflection',
|
|
||||||
Union = 'union',
|
|
||||||
TypeParameter = 'typeParameter',
|
|
||||||
Intersection = 'intersection',
|
|
||||||
Tuple = 'tuple',
|
|
||||||
Unknown = 'unknown',
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exception: We don't make the values uppercase because these KindString's need to
|
// Exception: We don't make the values uppercase because these KindString's need to
|
||||||
// match up those returned by TypeDoc
|
// match up those returned by TypeDoc
|
||||||
export enum KindString {
|
export enum KindString {
|
||||||
@@ -103,141 +37,8 @@ export enum KindString {
|
|||||||
Class = 'Class',
|
Class = 'Class',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DocAgnosticFormat {
|
|
||||||
[sectionName: string]: DocSection;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DocSection {
|
|
||||||
comment: string;
|
|
||||||
constructors: Array<TypescriptMethod | SolidityMethod>;
|
|
||||||
methods: Array<TypescriptMethod | SolidityMethod>;
|
|
||||||
properties: Property[];
|
|
||||||
types: CustomType[];
|
|
||||||
functions: TypescriptFunction[];
|
|
||||||
events?: Event[];
|
|
||||||
externalExportToLink?: ExternalExportToLink;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypescriptMethod extends BaseMethod {
|
|
||||||
source?: Source;
|
|
||||||
isStatic?: boolean;
|
|
||||||
typeParameter?: TypeParameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypescriptFunction extends BaseFunction {
|
|
||||||
source?: Source;
|
|
||||||
typeParameter?: TypeParameter;
|
|
||||||
callPath: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SolidityMethod extends BaseMethod {
|
|
||||||
isConstant?: boolean;
|
|
||||||
isPayable?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Source {
|
|
||||||
fileName: string;
|
|
||||||
line: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Parameter {
|
|
||||||
name: string;
|
|
||||||
comment: string;
|
|
||||||
isOptional: boolean;
|
|
||||||
type: Type;
|
|
||||||
defaultValue?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeParameter {
|
|
||||||
name: string;
|
|
||||||
type: Type;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Type {
|
|
||||||
name: string;
|
|
||||||
typeDocType: TypeDocTypes;
|
|
||||||
value?: string;
|
|
||||||
isExportedClassReference?: boolean;
|
|
||||||
typeArguments?: Type[];
|
|
||||||
elementType?: ElementType;
|
|
||||||
types?: Type[];
|
|
||||||
method?: TypescriptMethod;
|
|
||||||
indexSignature?: IndexSignature;
|
|
||||||
externalLink?: string;
|
|
||||||
tupleElements?: Type[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ElementType {
|
|
||||||
name: string;
|
|
||||||
typeDocType: TypeDocTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IndexSignature {
|
|
||||||
keyName: string;
|
|
||||||
keyType: Type;
|
|
||||||
valueName: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CustomType {
|
|
||||||
name: string;
|
|
||||||
kindString: string;
|
|
||||||
type?: Type;
|
|
||||||
method?: TypescriptMethod;
|
|
||||||
indexSignature?: IndexSignature;
|
|
||||||
defaultValue?: string;
|
|
||||||
comment?: string;
|
|
||||||
children?: CustomTypeChild[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CustomTypeChild {
|
|
||||||
name: string;
|
|
||||||
type?: Type;
|
|
||||||
defaultValue?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Event {
|
|
||||||
name: string;
|
|
||||||
eventArgs: EventArg[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EventArg {
|
|
||||||
isIndexed: boolean;
|
|
||||||
name: string;
|
|
||||||
type: Type;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Property {
|
|
||||||
name: string;
|
|
||||||
type: Type;
|
|
||||||
source?: Source;
|
|
||||||
comment?: string;
|
|
||||||
callPath?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BaseMethod {
|
|
||||||
isConstructor: boolean;
|
|
||||||
name: string;
|
|
||||||
returnComment?: string | undefined;
|
|
||||||
callPath: string;
|
|
||||||
parameters: Parameter[];
|
|
||||||
returnType: Type;
|
|
||||||
comment?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BaseFunction {
|
|
||||||
name: string;
|
|
||||||
returnComment?: string | undefined;
|
|
||||||
parameters: Parameter[];
|
|
||||||
returnType: Type;
|
|
||||||
comment?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeDefinitionByName {
|
|
||||||
[typeName: string]: CustomType;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum SupportedDocJson {
|
export enum SupportedDocJson {
|
||||||
Doxity = 'DOXITY',
|
SolDoc = 'SOL_DOC',
|
||||||
TypeDoc = 'TYPEDOC',
|
TypeDoc = 'TYPEDOC',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,40 +50,6 @@ export interface ContractsByVersionByNetworkId {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DoxityDocObj {
|
|
||||||
[contractName: string]: DoxityContractObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DoxityContractObj {
|
|
||||||
title: string;
|
|
||||||
fileName: string;
|
|
||||||
name: string;
|
|
||||||
abiDocs: DoxityAbiDoc[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DoxityAbiDoc {
|
|
||||||
constant: boolean;
|
|
||||||
inputs: DoxityInput[];
|
|
||||||
name: string;
|
|
||||||
outputs: DoxityOutput[];
|
|
||||||
payable: boolean;
|
|
||||||
type: string;
|
|
||||||
details?: string;
|
|
||||||
return?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DoxityOutput {
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DoxityInput {
|
|
||||||
name: string;
|
|
||||||
type: string;
|
|
||||||
description: string;
|
|
||||||
indexed?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AddressByContractName {
|
export interface AddressByContractName {
|
||||||
[contractName: string]: string;
|
[contractName: string]: string;
|
||||||
}
|
}
|
||||||
@@ -297,28 +64,3 @@ export enum AbiTypes {
|
|||||||
Function = 'function',
|
Function = 'function',
|
||||||
Event = 'event',
|
Event = 'event',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExportNameToTypedocNames {
|
|
||||||
[exportName: string]: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExternalTypeToLink {
|
|
||||||
[externalTypeName: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExternalExportToLink {
|
|
||||||
[externalExport: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Metadata {
|
|
||||||
exportPathToTypedocNames: ExportNameToTypedocNames;
|
|
||||||
exportPathOrder: string[];
|
|
||||||
externalTypeToLink: ExternalTypeToLink;
|
|
||||||
externalExportToLink: ExternalExportToLink;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GeneratedDocJson {
|
|
||||||
version: string;
|
|
||||||
metadata: Metadata;
|
|
||||||
typedocJson: TypeDocNode;
|
|
||||||
}
|
|
||||||
|
@@ -4,7 +4,7 @@ export const constants = {
|
|||||||
TYPES_SECTION_NAME: 'types',
|
TYPES_SECTION_NAME: 'types',
|
||||||
EXTERNAL_EXPORTS_SECTION_NAME: 'external exports',
|
EXTERNAL_EXPORTS_SECTION_NAME: 'external exports',
|
||||||
TYPE_TO_SYNTAX: {
|
TYPE_TO_SYNTAX: {
|
||||||
[SupportedDocJson.Doxity]: 'solidity',
|
[SupportedDocJson.SolDoc]: 'solidity',
|
||||||
[SupportedDocJson.TypeDoc]: 'typescript',
|
[SupportedDocJson.TypeDoc]: 'typescript',
|
||||||
} as { [supportedDocType: string]: string },
|
} as { [supportedDocType: string]: string },
|
||||||
};
|
};
|
||||||
|
@@ -1,176 +0,0 @@
|
|||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
import {
|
|
||||||
AbiTypes,
|
|
||||||
DocAgnosticFormat,
|
|
||||||
DocSection,
|
|
||||||
DoxityAbiDoc,
|
|
||||||
DoxityContractObj,
|
|
||||||
DoxityDocObj,
|
|
||||||
DoxityInput,
|
|
||||||
EventArg,
|
|
||||||
Parameter,
|
|
||||||
Property,
|
|
||||||
SolidityMethod,
|
|
||||||
Type,
|
|
||||||
TypeDocTypes,
|
|
||||||
} from '../types';
|
|
||||||
|
|
||||||
export const doxityUtils = {
|
|
||||||
convertToDocAgnosticFormat(doxityDocObj: DoxityDocObj): DocAgnosticFormat {
|
|
||||||
const docAgnosticFormat: DocAgnosticFormat = {};
|
|
||||||
_.each(doxityDocObj, (doxityContractObj: DoxityContractObj, contractName: string) => {
|
|
||||||
const doxityConstructor = _.find(doxityContractObj.abiDocs, (abiDoc: DoxityAbiDoc) => {
|
|
||||||
return abiDoc.type === AbiTypes.Constructor;
|
|
||||||
});
|
|
||||||
const constructors = [];
|
|
||||||
if (!_.isUndefined(doxityConstructor)) {
|
|
||||||
const constructor = {
|
|
||||||
isConstructor: true,
|
|
||||||
name: doxityContractObj.name,
|
|
||||||
comment: doxityConstructor.details,
|
|
||||||
returnComment: doxityConstructor.return,
|
|
||||||
callPath: '',
|
|
||||||
parameters: doxityUtils._convertParameters(doxityConstructor.inputs),
|
|
||||||
returnType: doxityUtils._convertType(doxityContractObj.name),
|
|
||||||
};
|
|
||||||
constructors.push(constructor);
|
|
||||||
}
|
|
||||||
|
|
||||||
const doxityMethods: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>(
|
|
||||||
doxityContractObj.abiDocs,
|
|
||||||
(abiDoc: DoxityAbiDoc) => {
|
|
||||||
return doxityUtils._isMethod(abiDoc);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
const methods: SolidityMethod[] = _.map<DoxityAbiDoc, SolidityMethod>(
|
|
||||||
doxityMethods,
|
|
||||||
(doxityMethod: DoxityAbiDoc) => {
|
|
||||||
const outputs = !_.isUndefined(doxityMethod.outputs) ? doxityMethod.outputs : [];
|
|
||||||
let returnTypeIfExists: Type;
|
|
||||||
if (outputs.length === 0) {
|
|
||||||
// no-op. It's already undefined
|
|
||||||
} else if (outputs.length === 1) {
|
|
||||||
const outputsType = outputs[0].type;
|
|
||||||
returnTypeIfExists = doxityUtils._convertType(outputsType);
|
|
||||||
} else {
|
|
||||||
const outputsType = `[${_.map(outputs, output => output.type).join(', ')}]`;
|
|
||||||
returnTypeIfExists = doxityUtils._convertType(outputsType);
|
|
||||||
}
|
|
||||||
// For ZRXToken, we want to convert it to zrxToken, rather then simply zRXToken
|
|
||||||
const callPath =
|
|
||||||
contractName !== 'ZRXToken'
|
|
||||||
? `${contractName[0].toLowerCase()}${contractName.slice(1)}.`
|
|
||||||
: `${contractName.slice(0, 3).toLowerCase()}${contractName.slice(3)}.`;
|
|
||||||
const method = {
|
|
||||||
isConstructor: false,
|
|
||||||
isConstant: doxityMethod.constant,
|
|
||||||
isPayable: doxityMethod.payable,
|
|
||||||
name: doxityMethod.name,
|
|
||||||
comment: doxityMethod.details,
|
|
||||||
returnComment: doxityMethod.return,
|
|
||||||
callPath,
|
|
||||||
parameters: doxityUtils._convertParameters(doxityMethod.inputs),
|
|
||||||
returnType: returnTypeIfExists,
|
|
||||||
};
|
|
||||||
return method;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const doxityProperties: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>(
|
|
||||||
doxityContractObj.abiDocs,
|
|
||||||
(abiDoc: DoxityAbiDoc) => {
|
|
||||||
return doxityUtils._isProperty(abiDoc);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
const properties = _.map<DoxityAbiDoc, Property>(doxityProperties, (doxityProperty: DoxityAbiDoc) => {
|
|
||||||
// We assume that none of our functions return more then a single return value
|
|
||||||
let typeName = doxityProperty.outputs[0].type;
|
|
||||||
if (!_.isEmpty(doxityProperty.inputs)) {
|
|
||||||
// Properties never have more then a single input
|
|
||||||
typeName = `(${doxityProperty.inputs[0].type} => ${typeName})`;
|
|
||||||
}
|
|
||||||
const property = {
|
|
||||||
name: doxityProperty.name,
|
|
||||||
type: doxityUtils._convertType(typeName),
|
|
||||||
comment: doxityProperty.details,
|
|
||||||
};
|
|
||||||
return property;
|
|
||||||
});
|
|
||||||
|
|
||||||
const doxityEvents = _.filter(
|
|
||||||
doxityContractObj.abiDocs,
|
|
||||||
(abiDoc: DoxityAbiDoc) => abiDoc.type === AbiTypes.Event,
|
|
||||||
);
|
|
||||||
const events = _.map(doxityEvents, doxityEvent => {
|
|
||||||
const event = {
|
|
||||||
name: doxityEvent.name,
|
|
||||||
eventArgs: doxityUtils._convertEventArgs(doxityEvent.inputs),
|
|
||||||
};
|
|
||||||
return event;
|
|
||||||
});
|
|
||||||
|
|
||||||
const docSection: DocSection = {
|
|
||||||
comment: doxityContractObj.title,
|
|
||||||
constructors,
|
|
||||||
methods,
|
|
||||||
properties,
|
|
||||||
types: [],
|
|
||||||
functions: [],
|
|
||||||
events,
|
|
||||||
};
|
|
||||||
docAgnosticFormat[contractName] = docSection;
|
|
||||||
});
|
|
||||||
return docAgnosticFormat;
|
|
||||||
},
|
|
||||||
_convertParameters(inputs: DoxityInput[]): Parameter[] {
|
|
||||||
const parameters = _.map(inputs, input => {
|
|
||||||
const parameter = {
|
|
||||||
name: input.name,
|
|
||||||
comment: input.description,
|
|
||||||
isOptional: false,
|
|
||||||
type: doxityUtils._convertType(input.type),
|
|
||||||
};
|
|
||||||
return parameter;
|
|
||||||
});
|
|
||||||
return parameters;
|
|
||||||
},
|
|
||||||
_convertType(typeName: string): Type {
|
|
||||||
const type = {
|
|
||||||
name: typeName,
|
|
||||||
typeDocType: TypeDocTypes.Intrinsic,
|
|
||||||
};
|
|
||||||
return type;
|
|
||||||
},
|
|
||||||
_isMethod(abiDoc: DoxityAbiDoc): boolean {
|
|
||||||
if (abiDoc.type !== AbiTypes.Function) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const hasInputs = !_.isEmpty(abiDoc.inputs);
|
|
||||||
const hasNamedOutputIfExists = !hasInputs || !_.isEmpty(abiDoc.inputs[0].name);
|
|
||||||
const isNameAllCaps = abiDoc.name === abiDoc.name.toUpperCase();
|
|
||||||
const isMethod = hasNamedOutputIfExists && !isNameAllCaps;
|
|
||||||
return isMethod;
|
|
||||||
},
|
|
||||||
_isProperty(abiDoc: DoxityAbiDoc): boolean {
|
|
||||||
if (abiDoc.type !== AbiTypes.Function) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const hasInputs = !_.isEmpty(abiDoc.inputs);
|
|
||||||
const hasNamedOutputIfExists = !hasInputs || !_.isEmpty(abiDoc.inputs[0].name);
|
|
||||||
const isNameAllCaps = abiDoc.name === abiDoc.name.toUpperCase();
|
|
||||||
const isProperty = !hasNamedOutputIfExists || isNameAllCaps;
|
|
||||||
return isProperty;
|
|
||||||
},
|
|
||||||
_convertEventArgs(inputs: DoxityInput[]): EventArg[] {
|
|
||||||
const eventArgs = _.map(inputs, input => {
|
|
||||||
const eventArg = {
|
|
||||||
isIndexed: input.indexed,
|
|
||||||
name: input.name,
|
|
||||||
type: doxityUtils._convertType(input.type),
|
|
||||||
};
|
|
||||||
return eventArg;
|
|
||||||
});
|
|
||||||
return eventArgs;
|
|
||||||
},
|
|
||||||
};
|
|
@@ -1,7 +1,3 @@
|
|||||||
import { errorUtils } from '@0xproject/utils';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
|
||||||
import {
|
import {
|
||||||
CustomType,
|
CustomType,
|
||||||
CustomTypeChild,
|
CustomTypeChild,
|
||||||
@@ -11,7 +7,6 @@ import {
|
|||||||
ExternalTypeToLink,
|
ExternalTypeToLink,
|
||||||
GeneratedDocJson,
|
GeneratedDocJson,
|
||||||
IndexSignature,
|
IndexSignature,
|
||||||
KindString,
|
|
||||||
Parameter,
|
Parameter,
|
||||||
Property,
|
Property,
|
||||||
Type,
|
Type,
|
||||||
@@ -21,7 +16,12 @@ import {
|
|||||||
TypeParameter,
|
TypeParameter,
|
||||||
TypescriptFunction,
|
TypescriptFunction,
|
||||||
TypescriptMethod,
|
TypescriptMethod,
|
||||||
} from '../types';
|
} from '@0xproject/types';
|
||||||
|
import { errorUtils } from '@0xproject/utils';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { DocsInfo } from '../docs_info';
|
||||||
|
import { KindString } from '../types';
|
||||||
|
|
||||||
import { constants } from './constants';
|
import { constants } from './constants';
|
||||||
|
|
||||||
@@ -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,
|
||||||
@@ -468,6 +471,8 @@ export class TypeDocUtils {
|
|||||||
methodIfExists = this._convertMethod(entity.declaration, isConstructor, sectionName);
|
methodIfExists = this._convertMethod(entity.declaration, isConstructor, sectionName);
|
||||||
} else if (entity.type === TypeDocTypes.Tuple) {
|
} else if (entity.type === TypeDocTypes.Tuple) {
|
||||||
tupleElementsIfExists = _.map(entity.elements, el => {
|
tupleElementsIfExists = _.map(entity.elements, el => {
|
||||||
|
// the following line is required due to an open tslint issue, https://github.com/palantir/tslint/issues/3540
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
return { name: el.name, typeDocType: el.type as TypeDocTypes };
|
return { name: el.name, typeDocType: el.type as TypeDocTypes };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.13",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.0.12",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.0.11",
|
"version": "1.0.11",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.0.13 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.0.12 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.0.11 - _September 25, 2018_
|
## v1.0.11 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/react-shared",
|
"name": "@0xproject/react-shared",
|
||||||
"version": "1.0.11",
|
"version": "1.0.13",
|
||||||
"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.11",
|
||||||
"@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",
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.1.6",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "1.1.5",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.1.6 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.1.5 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.1.4 - _September 25, 2018_
|
## v1.1.4 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/sol-compiler",
|
"name": "@0xproject/sol-compiler",
|
||||||
"version": "1.1.4",
|
"version": "1.1.6",
|
||||||
"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.11",
|
||||||
"@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.12",
|
||||||
"@0xproject/json-schemas": "^1.0.3",
|
"@0xproject/json-schemas": "^1.0.5",
|
||||||
"@0xproject/sol-resolver": "^1.0.10",
|
"@0xproject/sol-resolver": "^1.0.12",
|
||||||
"@0xproject/types": "^1.1.0",
|
"@0xproject/types": "^1.1.2",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"@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.9",
|
||||||
"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",
|
||||||
|
@@ -10,7 +10,7 @@ import {
|
|||||||
} from '@0xproject/sol-resolver';
|
} from '@0xproject/sol-resolver';
|
||||||
import { fetchAsync, logUtils } from '@0xproject/utils';
|
import { fetchAsync, logUtils } from '@0xproject/utils';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { CompilerOptions, ContractArtifact, ContractVersionData } from 'ethereum-types';
|
import { CompilerOptions, ContractArtifact, ContractVersionData, StandardOutput } from 'ethereum-types';
|
||||||
import * as ethUtil from 'ethereumjs-util';
|
import * as ethUtil from 'ethereumjs-util';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -94,7 +94,7 @@ export class Compiler {
|
|||||||
if (await fsWrapper.doesFileExistAsync(compilerBinFilename)) {
|
if (await fsWrapper.doesFileExistAsync(compilerBinFilename)) {
|
||||||
solcjs = (await fsWrapper.readFileAsync(compilerBinFilename)).toString();
|
solcjs = (await fsWrapper.readFileAsync(compilerBinFilename)).toString();
|
||||||
} else {
|
} else {
|
||||||
logUtils.log(`Downloading ${fullSolcVersion}...`);
|
logUtils.warn(`Downloading ${fullSolcVersion}...`);
|
||||||
const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`;
|
const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`;
|
||||||
const response = await fetchAsync(url);
|
const response = await fetchAsync(url);
|
||||||
const SUCCESS_STATUS = 200;
|
const SUCCESS_STATUS = 200;
|
||||||
@@ -110,6 +110,21 @@ export class Compiler {
|
|||||||
const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
|
const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
|
||||||
return { solcInstance, fullSolcVersion };
|
return { solcInstance, fullSolcVersion };
|
||||||
}
|
}
|
||||||
|
private static _addHexPrefixToContractBytecode(compiledContract: solc.StandardContractOutput): void {
|
||||||
|
if (!_.isUndefined(compiledContract.evm)) {
|
||||||
|
if (!_.isUndefined(compiledContract.evm.bytecode) && !_.isUndefined(compiledContract.evm.bytecode.object)) {
|
||||||
|
compiledContract.evm.bytecode.object = ethUtil.addHexPrefix(compiledContract.evm.bytecode.object);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!_.isUndefined(compiledContract.evm.deployedBytecode) &&
|
||||||
|
!_.isUndefined(compiledContract.evm.deployedBytecode.object)
|
||||||
|
) {
|
||||||
|
compiledContract.evm.deployedBytecode.object = ethUtil.addHexPrefix(
|
||||||
|
compiledContract.evm.deployedBytecode.object,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Instantiates a new instance of the Compiler class.
|
* Instantiates a new instance of the Compiler class.
|
||||||
* @param opts Optional compiler options
|
* @param opts Optional compiler options
|
||||||
@@ -144,22 +159,40 @@ export class Compiler {
|
|||||||
public async compileAsync(): Promise<void> {
|
public async compileAsync(): Promise<void> {
|
||||||
await createDirIfDoesNotExistAsync(this._artifactsDir);
|
await createDirIfDoesNotExistAsync(this._artifactsDir);
|
||||||
await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
|
await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
|
||||||
let contractNamesToCompile: string[] = [];
|
await this._compileContractsAsync(this._getContractNamesToCompile(), true);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compiles Solidity files specified during instantiation, and returns the
|
||||||
|
* compiler output given by solc. Return value is an array of outputs:
|
||||||
|
* Solidity modules are batched together by version required, and each
|
||||||
|
* element of the returned array corresponds to a compiler version, and
|
||||||
|
* each element contains the output for all of the modules compiled with
|
||||||
|
* that version.
|
||||||
|
*/
|
||||||
|
public async getCompilerOutputsAsync(): Promise<StandardOutput[]> {
|
||||||
|
const promisedOutputs = this._compileContractsAsync(this._getContractNamesToCompile(), false);
|
||||||
|
return promisedOutputs;
|
||||||
|
}
|
||||||
|
private _getContractNamesToCompile(): string[] {
|
||||||
|
let contractNamesToCompile;
|
||||||
if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) {
|
if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) {
|
||||||
const allContracts = this._nameResolver.getAll();
|
const allContracts = this._nameResolver.getAll();
|
||||||
contractNamesToCompile = _.map(allContracts, contractSource =>
|
contractNamesToCompile = _.map(allContracts, contractSource =>
|
||||||
path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
|
path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
contractNamesToCompile = this._specifiedContracts;
|
contractNamesToCompile = this._specifiedContracts.map(specifiedContract =>
|
||||||
|
path.basename(specifiedContract, constants.SOLIDITY_FILE_EXTENSION),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
await this._compileContractsAsync(contractNamesToCompile);
|
return contractNamesToCompile;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Compiles contract and saves artifact to artifactsDir.
|
* Compiles contracts, and, if `shouldPersist` is true, saves artifacts to artifactsDir.
|
||||||
* @param fileName Name of contract with '.sol' extension.
|
* @param fileName Name of contract with '.sol' extension.
|
||||||
|
* @return an array of compiler outputs, where each element corresponds to a different version of solc-js.
|
||||||
*/
|
*/
|
||||||
private async _compileContractsAsync(contractNames: string[]): Promise<void> {
|
private async _compileContractsAsync(contractNames: string[], shouldPersist: boolean): Promise<StandardOutput[]> {
|
||||||
// batch input contracts together based on the version of the compiler that they require.
|
// batch input contracts together based on the version of the compiler that they require.
|
||||||
const versionToInputs: VersionToInputs = {};
|
const versionToInputs: VersionToInputs = {};
|
||||||
|
|
||||||
@@ -200,10 +233,12 @@ export class Compiler {
|
|||||||
versionToInputs[solcVersion].contractsToCompile.push(contractSource.path);
|
versionToInputs[solcVersion].contractsToCompile.push(contractSource.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const compilerOutputs: StandardOutput[] = [];
|
||||||
|
|
||||||
const solcVersions = _.keys(versionToInputs);
|
const solcVersions = _.keys(versionToInputs);
|
||||||
for (const solcVersion of solcVersions) {
|
for (const solcVersion of solcVersions) {
|
||||||
const input = versionToInputs[solcVersion];
|
const input = versionToInputs[solcVersion];
|
||||||
logUtils.log(
|
logUtils.warn(
|
||||||
`Compiling ${input.contractsToCompile.length} contracts (${
|
`Compiling ${input.contractsToCompile.length} contracts (${
|
||||||
input.contractsToCompile
|
input.contractsToCompile
|
||||||
}) with Solidity v${solcVersion}...`,
|
}) with Solidity v${solcVersion}...`,
|
||||||
@@ -212,19 +247,35 @@ export class Compiler {
|
|||||||
const { solcInstance, fullSolcVersion } = await Compiler._getSolcAsync(solcVersion);
|
const { solcInstance, fullSolcVersion } = await Compiler._getSolcAsync(solcVersion);
|
||||||
|
|
||||||
const compilerOutput = this._compile(solcInstance, input.standardInput);
|
const compilerOutput = this._compile(solcInstance, input.standardInput);
|
||||||
|
compilerOutputs.push(compilerOutput);
|
||||||
|
|
||||||
for (const contractPath of input.contractsToCompile) {
|
for (const contractPath of input.contractsToCompile) {
|
||||||
await this._verifyAndPersistCompiledContractAsync(
|
const contractName = contractPathToData[contractPath].contractName;
|
||||||
|
|
||||||
|
const compiledContract = compilerOutput.contracts[contractPath][contractName];
|
||||||
|
if (_.isUndefined(compiledContract)) {
|
||||||
|
throw new Error(
|
||||||
|
`Contract ${contractName} not found in ${contractPath}. Please make sure your contract has the same name as it's file name`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Compiler._addHexPrefixToContractBytecode(compiledContract);
|
||||||
|
|
||||||
|
if (shouldPersist) {
|
||||||
|
await this._persistCompiledContractAsync(
|
||||||
contractPath,
|
contractPath,
|
||||||
contractPathToData[contractPath].currentArtifactIfExists,
|
contractPathToData[contractPath].currentArtifactIfExists,
|
||||||
contractPathToData[contractPath].sourceTreeHashHex,
|
contractPathToData[contractPath].sourceTreeHashHex,
|
||||||
contractPathToData[contractPath].contractName,
|
contractName,
|
||||||
fullSolcVersion,
|
fullSolcVersion,
|
||||||
compilerOutput,
|
compilerOutput,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return compilerOutputs;
|
||||||
|
}
|
||||||
private _shouldCompile(contractData: ContractData): boolean {
|
private _shouldCompile(contractData: ContractData): boolean {
|
||||||
if (_.isUndefined(contractData.currentArtifactIfExists)) {
|
if (_.isUndefined(contractData.currentArtifactIfExists)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -236,7 +287,7 @@ export class Compiler {
|
|||||||
return !isUserOnLatestVersion || didCompilerSettingsChange || didSourceChange;
|
return !isUserOnLatestVersion || didCompilerSettingsChange || didSourceChange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async _verifyAndPersistCompiledContractAsync(
|
private async _persistCompiledContractAsync(
|
||||||
contractPath: string,
|
contractPath: string,
|
||||||
currentArtifactIfExists: ContractArtifact | void,
|
currentArtifactIfExists: ContractArtifact | void,
|
||||||
sourceTreeHashHex: string,
|
sourceTreeHashHex: string,
|
||||||
@@ -244,32 +295,13 @@ export class Compiler {
|
|||||||
fullSolcVersion: string,
|
fullSolcVersion: string,
|
||||||
compilerOutput: solc.StandardOutput,
|
compilerOutput: solc.StandardOutput,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const compiledData = compilerOutput.contracts[contractPath][contractName];
|
const compiledContract = compilerOutput.contracts[contractPath][contractName];
|
||||||
if (_.isUndefined(compiledData)) {
|
|
||||||
throw new Error(
|
|
||||||
`Contract ${contractName} not found in ${contractPath}. Please make sure your contract has the same name as it's file name`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!_.isUndefined(compiledData.evm)) {
|
|
||||||
if (!_.isUndefined(compiledData.evm.bytecode) && !_.isUndefined(compiledData.evm.bytecode.object)) {
|
|
||||||
compiledData.evm.bytecode.object = ethUtil.addHexPrefix(compiledData.evm.bytecode.object);
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
!_.isUndefined(compiledData.evm.deployedBytecode) &&
|
|
||||||
!_.isUndefined(compiledData.evm.deployedBytecode.object)
|
|
||||||
) {
|
|
||||||
compiledData.evm.deployedBytecode.object = ethUtil.addHexPrefix(
|
|
||||||
compiledData.evm.deployedBytecode.object,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const sourceCodes = _.mapValues(
|
const sourceCodes = _.mapValues(
|
||||||
compilerOutput.sources,
|
compilerOutput.sources,
|
||||||
(_1, sourceFilePath) => this._resolver.resolve(sourceFilePath).source,
|
(_1, sourceFilePath) => this._resolver.resolve(sourceFilePath).source,
|
||||||
);
|
);
|
||||||
const contractVersion: ContractVersionData = {
|
const contractVersion: ContractVersionData = {
|
||||||
compilerOutput: compiledData,
|
compilerOutput: compiledContract,
|
||||||
sources: compilerOutput.sources,
|
sources: compilerOutput.sources,
|
||||||
sourceCodes,
|
sourceCodes,
|
||||||
sourceTreeHashHex,
|
sourceTreeHashHex,
|
||||||
@@ -299,7 +331,7 @@ export class Compiler {
|
|||||||
const artifactString = utils.stringifyWithFormatting(newArtifact);
|
const artifactString = utils.stringifyWithFormatting(newArtifact);
|
||||||
const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
|
const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
|
||||||
await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
|
await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
|
||||||
logUtils.log(`${contractName} artifact saved!`);
|
logUtils.warn(`${contractName} artifact saved!`);
|
||||||
}
|
}
|
||||||
private _compile(solcInstance: solc.SolcInstance, standardInput: solc.StandardInput): solc.StandardOutput {
|
private _compile(solcInstance: solc.SolcInstance, standardInput: solc.StandardInput): solc.StandardOutput {
|
||||||
const compiled: solc.StandardOutput = JSON.parse(
|
const compiled: solc.StandardOutput = JSON.parse(
|
||||||
@@ -315,13 +347,13 @@ export class Compiler {
|
|||||||
if (!_.isEmpty(errors)) {
|
if (!_.isEmpty(errors)) {
|
||||||
errors.forEach(error => {
|
errors.forEach(error => {
|
||||||
const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
|
const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
|
||||||
logUtils.log(chalk.red(normalizedErrMsg));
|
logUtils.warn(chalk.red(normalizedErrMsg));
|
||||||
});
|
});
|
||||||
throw new Error('Compilation errors encountered');
|
throw new Error('Compilation errors encountered');
|
||||||
} else {
|
} else {
|
||||||
warnings.forEach(warning => {
|
warnings.forEach(warning => {
|
||||||
const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
|
const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
|
||||||
logUtils.log(chalk.yellow(normalizedWarningMsg));
|
logUtils.warn(chalk.yellow(normalizedWarningMsg));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,29 @@
|
|||||||
export { Compiler } from './compiler';
|
export { Compiler } from './compiler';
|
||||||
export {
|
export {
|
||||||
|
AbiDefinition,
|
||||||
CompilerOptions,
|
CompilerOptions,
|
||||||
CompilerSettings,
|
CompilerSettings,
|
||||||
|
DataItem,
|
||||||
|
DevdocOutput,
|
||||||
|
ErrorSeverity,
|
||||||
|
ErrorType,
|
||||||
|
EventAbi,
|
||||||
|
EventParameter,
|
||||||
|
EvmBytecodeOutput,
|
||||||
|
EvmOutput,
|
||||||
|
FallbackAbi,
|
||||||
|
FunctionAbi,
|
||||||
|
MethodAbi,
|
||||||
|
ConstructorAbi,
|
||||||
|
ConstructorStateMutability,
|
||||||
|
ContractAbi,
|
||||||
OutputField,
|
OutputField,
|
||||||
CompilerSettingsMetadata,
|
CompilerSettingsMetadata,
|
||||||
OptimizerSettings,
|
OptimizerSettings,
|
||||||
|
ParamDescription,
|
||||||
|
SolcError,
|
||||||
|
StandardContractOutput,
|
||||||
|
StandardOutput,
|
||||||
|
StateMutability,
|
||||||
|
SourceLocation,
|
||||||
} from 'ethereum-types';
|
} from 'ethereum-types';
|
||||||
|
@@ -26,7 +26,7 @@ export async function getContractArtifactIfExistsAsync(
|
|||||||
contractArtifact = JSON.parse(contractArtifactString);
|
contractArtifact = JSON.parse(contractArtifactString);
|
||||||
return contractArtifact;
|
return contractArtifact;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logUtils.log(`Artifact for ${contractName} does not exist`);
|
logUtils.warn(`Artifact for ${contractName} does not exist`);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ export async function getContractArtifactIfExistsAsync(
|
|||||||
*/
|
*/
|
||||||
export async function createDirIfDoesNotExistAsync(dirPath: string): Promise<void> {
|
export async function createDirIfDoesNotExistAsync(dirPath: string): Promise<void> {
|
||||||
if (!fsWrapper.doesPathExistSync(dirPath)) {
|
if (!fsWrapper.doesPathExistSync(dirPath)) {
|
||||||
logUtils.log(`Creating directory at ${dirPath}...`);
|
logUtils.warn(`Creating directory at ${dirPath}...`);
|
||||||
await fsWrapper.mkdirpAsync(dirPath);
|
await fsWrapper.mkdirpAsync(dirPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "2.1.6",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1537907159,
|
||||||
|
"version": "2.1.5",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1537875740,
|
"timestamp": 1537875740,
|
||||||
"version": "2.1.4",
|
"version": "2.1.4",
|
||||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v2.1.6 - _September 28, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v2.1.5 - _September 25, 2018_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v2.1.4 - _September 25, 2018_
|
## v2.1.4 - _September 25, 2018_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0xproject/sol-cov",
|
"name": "@0xproject/sol-cov",
|
||||||
"version": "2.1.4",
|
"version": "2.1.6",
|
||||||
"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.11",
|
||||||
"@0xproject/sol-compiler": "^1.1.4",
|
"@0xproject/sol-compiler": "^1.1.6",
|
||||||
"@0xproject/subproviders": "^2.0.4",
|
"@0xproject/subproviders": "^2.0.6",
|
||||||
"@0xproject/typescript-typings": "^2.0.1",
|
"@0xproject/typescript-typings": "^3.0.0",
|
||||||
"@0xproject/utils": "^1.0.10",
|
"@0xproject/utils": "^2.0.0",
|
||||||
"@0xproject/web3-wrapper": "^3.0.0",
|
"@0xproject/web3-wrapper": "^3.0.2",
|
||||||
"ethereum-types": "^1.0.7",
|
"ethereum-types": "^1.0.9",
|
||||||
"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",
|
||||||
|
21
packages/sol-doc/CHANGELOG.json
Normal file
21
packages/sol-doc/CHANGELOG.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1538157789,
|
||||||
|
"version": "1.0.1",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "1.0.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note":
|
||||||
|
"Utility to generate documentation for Solidity smart contracts, outputting a format compliant with @0xproject/types.DocAgnosticFormat",
|
||||||
|
"pr": 1004
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user