Compare commits

..

118 Commits

Author SHA1 Message Date
Fabio Berger
ac14dd2b29 Publish
- 0x.js@1.0.7
 - @0xproject/abi-gen@1.0.12
 - @0xproject/assert@1.0.12
 - @0xproject/asset-buyer@1.0.2
 - @0xproject/base-contract@3.0.0
 - @0xproject/connect@3.0.0
 - @0xproject/contract-wrappers@2.0.1
 - contracts@2.1.48
 - @0xproject/dev-utils@1.0.11
 - ethereum-types@1.0.9
 - @0xproject/fill-scenarios@1.0.6
 - @0xproject/json-schemas@1.0.5
 - @0xproject/metacoin@0.0.22
 - @0xproject/migrations@1.0.13
 - @0xproject/monorepo-scripts@1.0.10
 - @0xproject/order-utils@1.0.6
 - @0xproject/order-watcher@2.1.0
 - @0xproject/react-docs@1.0.12
 - @0xproject/react-shared@1.0.13
 - @0xproject/sol-compiler@1.1.6
 - @0xproject/sol-cov@2.1.6
 - @0xproject/sol-doc@1.0.1
 - @0xproject/sol-resolver@1.0.12
 - @0xproject/sra-report@1.0.12
 - @0xproject/sra-spec@1.0.5
 - @0xproject/subproviders@2.0.6
 - @0xproject/testnet-faucets@1.0.50
 - @0xproject/types@1.1.2
 - @0xproject/typescript-typings@3.0.0
 - @0xproject/utils@2.0.0
 - @0xproject/web3-wrapper@3.0.2
 - @0xproject/website@0.0.53
2018-09-28 19:16:07 +01:00
Fabio Berger
c354129b6f Updated CHANGELOGS 2018-09-28 19:15:38 +01:00
Fabio Berger
c7e26cd448 Un-nest the interface to fix the doc rendering 2018-09-28 18:59:28 +01:00
Jacob Evans
a737cfa004 Merge pull request #1090 from 0xProject/bug/contract-wrappers/handle-revert-with-reason
[contract-wrappers] Test revert with reason when decoding call result
2018-09-28 00:21:15 +00:00
Jacob Evans
21f6072186 Handle revert with reason when decoding call result
We use in-process ganache which throws on an RPC error. This means all of our tests get a nice revert error thrown when testing against ganache. This is not possible with RPC providers and a revert with reason result is returned. Our callAsync doesn't handle this and attempts to decode the revert with reason error log as a successful log, which results in an error while decoding.

This only works with our fork of ethers https://github.com/ethers-io/ethers.js/pull/188 and will need to be re-worked when updating to Ethers.js 4
2018-09-28 09:59:58 +10:00
Alex Browne
94badedad4 Remove yarn postinstall hack (#1098) 2018-09-27 15:34:01 -07:00
Leonid Logvinov
bf3795d2ac Merge pull request #1097 from 0xProject/feature/export-expiration-watcher
Export ExpirationWatcher from OrderWatcher
2018-09-27 12:53:36 +02:00
Leonid Logvinov
bc48bc99c3 Add PR number 2018-09-27 12:53:05 +02:00
Leonid Logvinov
51bfd1ca5e Export ExpirationWatcher from OrderWatcher 2018-09-27 12:48:48 +02:00
Leonid Logvinov
9160cd4983 Merge pull request #1069 from 0xProject/feature/ts-ethers
Upgrade to TS version of ethers
2018-09-27 12:47:00 +02:00
Leonid Logvinov
63d79faa85 Fix linter errors 2018-09-27 11:51:11 +02:00
Fabio Berger
70e412e375 Merge pull request #1096 from 0xProject/fixIsValidECSignature
Add address normalization to isValidECSignature method
2018-09-27 10:29:18 +01:00
Leonid Logvinov
a51919db0e Remove ethers.js carret as it's a beta version 2018-09-27 11:24:03 +02:00
Leonid Logvinov
60971be35a Throw revert reasons from contract wrappers 2018-09-27 11:21:47 +02:00
Leonid Logvinov
cb99ebf78a Throw revert reasons from contract wrappers 2018-09-27 11:21:39 +02:00
Fabio Berger
6f02a3f40d Fix PR nr 2018-09-27 10:05:04 +01:00
Fabio Berger
0591f1d32a Add address normalization to isValidECSignature method 2018-09-27 10:03:54 +01:00
Fabio Berger
1402119c84 Remove RC version warnings 2018-09-26 22:48:30 +01:00
Francesco Agosti
a162281529 Merge pull request #1094 from 0xProject/feature/website/coinbase-wallet-portal-fixes-and-clay-title
[website] Use coinbase wallet instead of Toshi, fix portal layout, update Clay's title
2018-09-26 18:20:06 +02:00
F. Eugene Aumson
8c18a8fefc Merge pull request #1093 from feuGeneA/sol-doc-fixes
[sol-doc] fixes
2018-09-26 12:16:33 -04:00
fragosti
48f6452c3b remove items-center classname 2018-09-26 17:58:48 +02:00
fragosti
bd002caadd Change clay to Ecosystem Development Lead 2018-09-26 17:56:09 +02:00
fragosti
d6090921a8 Update everything to Coinbase Wallet instead of Toshi 2018-09-26 17:55:40 +02:00
Francesco Agosti
78a693e092 Merge pull request #1088 from 0xProject/fix/website/relayers-column
[website] When number of relayers is less than number of columns, reduce column…
2018-09-26 17:40:12 +02:00
F. Eugene Aumson
3f61d27656 fix: add bin file for sol-doc cli 2018-09-26 11:28:53 -04:00
F. Eugene Aumson
30525d15f4 Merge pull request #1004 from feuGeneA/sol-doc
[ethereum-types, react-docs, sol-compiler, sol-doc, types, typescript-typings, website] Add new Solidity documentation generation utility
2018-09-26 10:15:53 -04:00
Francesco Agosti
c429409ed7 Merge pull request #1091 from 0xProject/feature/sra-spec/order-config-to-post-and-other-bugs
[connect][sra-spec] Update sra-spec and connect to have /order_config be a POST and other small improvements
2018-09-26 15:34:26 +02:00
F. Eugene Aumson
2bdaa58d71 fix: use latest versions of @0xproject packages 2018-09-26 09:22:06 -04:00
F. Eugene Aumson
75826fd559 Merge remote-tracking branch 'upstream/development' into sol-doc 2018-09-26 09:19:02 -04:00
F. Eugene Aumson
0ce6f03ed5 fix: disable tslint max-file-line-count...
before, tslint was saying "ERROR:
/home/gene/0x-monorepo/packages/types/src/index.ts[598, 2]: This file
has 599 lines, which exceeds the maximum of 500 lines allowed. Consider
breaking this file up into smaller parts."

https://github.com/0xProject/0x-monorepo/pull/1004#issuecomment-424704651
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-26 09:14:28 -04:00
Leonid Logvinov
5d73eebf6a Merge branch 'development' into feature/ts-ethers 2018-09-26 14:55:52 +02:00
Fabio Berger
13aa98f0f3 Merge pull request #1092 from 0xProject/addFlagToPublishReleases
Add Flag to publish releases command-line tool
2018-09-26 13:50:08 +01:00
Fabio Berger
4a94f8b1ca Merge branch 'development' into addFlagToPublishReleases
* development:
  Add weijie and rahul
  Change news link
2018-09-26 13:18:20 +01:00
Fabio Berger
f8532b3f51 Typo 2018-09-26 13:15:42 +01:00
Fabio Berger
b244f3e2c0 Merge branch 'development' of github.com:0xProject/0x-monorepo into development
* 'development' of github.com:0xProject/0x-monorepo:
  Add weijie and rahul
  Change news link
2018-09-26 13:14:23 +01:00
Fabio Berger
f33ecfd2fc Support passing in package names into publish_release_notes command-line for when publishing must be done manually 2018-09-26 13:11:12 +01:00
fragosti
f15751d800 Add to changelog 2018-09-26 14:06:53 +02:00
fragosti
e5e439adb9 Change /order_config endpoint to POST 2018-09-26 14:01:51 +02:00
fragosti
2d8f423cee Update examples 2018-09-26 13:57:41 +02:00
fragosti
5905fdb73b Fix erroneous ERC721 proxy id 2018-09-26 13:22:39 +02:00
fragosti
4ed9323804 Fix development flow 2018-09-26 13:19:01 +02:00
Francesco Agosti
d77c6e13b0 Merge pull request #1089 from 0xProject/feature/website/new-hires-sept-v2-announcement
[website] new hires and 0x v2 news link
2018-09-25 23:04:12 +02:00
fragosti
4e10f2c6f2 Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/website/new-hires-sept-v2-announcement 2018-09-25 23:02:33 +02:00
F. Eugene Aumson
d3edb9721c Merge remote-tracking branch 'upstream/development' into sol-doc 2018-09-25 16:34:44 -04:00
F. Eugene Aumson
de9f5d350f fix: call out a HACK in comments
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220010054
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 16:31:40 -04:00
F. Eugene Aumson
e45f0b0eaf fix: update smart contract doc intros
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220009790
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220009909
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 16:31:40 -04:00
F. Eugene Aumson
2e7b218f40 fix: comments
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219990314
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r220007992
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 16:31:40 -04:00
F. Eugene Aumson
7fbfd9ccd9 fix: print error and exit process; don't re-throw
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219979003
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 16:31:40 -04:00
F. Eugene Aumson
1db5ff617f fix: split line for readability
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219978696
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 16:31:40 -04:00
F. Eugene Aumson
ac5376a1ca fix: rename JSON_TABWIDTH to JSON_TAB_WIDTH
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219977842
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 16:31:39 -04:00
F. Eugene Aumson
600ffd93a6 fix: use latest versions of @0xproject packages
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219977747
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 16:31:26 -04:00
fragosti
22597674d2 Add weijie and rahul 2018-09-25 22:29:16 +02:00
fragosti
055bcb52f8 Change news link 2018-09-25 22:04:12 +02:00
F. Eugene Aumson
6174267f69 fix: explain why tslint rule is disabled
https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219976511
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 15:51:32 -04:00
F. Eugene Aumson
e8c8d3e722 fix: rename SupportedDocJson field to SolDoc
from Solidity

https://github.com/0xProject/0x-monorepo/pull/1004#discussion_r219976199
https://github.com/0xProject/0x-monorepo/pull/1004
2018-09-25 15:51:03 -04:00
Brandon Millman
d20f713fad When number of relayers is less than number of columns, reduce column number to number of relayers 2018-09-25 21:08:32 +02:00
F. Eugene Aumson
574270d061 fix: increase mocha timeout value
prior CI runs were failing because of this.
2018-09-24 17:17:28 -04:00
F. Eugene Aumson
9af5e3ba8e fix: add CHANGELOG.json 2018-09-24 17:17:19 -04:00
F. Eugene Aumson
2116548eed Merge remote-tracking branch 'upstream/development' into sol-doc 2018-09-24 13:30:37 -04:00
F. Eugene Aumson
57fca16d7b fix: use contract name for constructor method name
and for its return value
2018-09-24 13:24:03 -04:00
F. Eugene Aumson
a900255820 fix: document indexed event arguments 2018-09-24 13:05:35 -04:00
F. Eugene Aumson
bd7565ceda fix: save v1 contract doc/deploy commands
For posterity, save commands needed to use sol-doc to generate and
deploy documentation objects for v1 contracts.
2018-09-24 12:36:26 -04:00
F. Eugene Aumson
880cd6e440 fix: document return value's type, not its name 2018-09-24 12:29:02 -04:00
F. Eugene Aumson
98d06d6d25 BREAKING CHANGE: document contracts from sol-doc
Change website to accept smart contract documentation in the format
generated by sol-doc rather than that generated by Doxity.
2018-09-22 11:29:27 -04:00
F. Eugene Aumson
9f0dfb1e1a feat: make sol-doc only document what's requested
if a list of contracts-to-document is passed into sol-doc, then the
output should only contain documentation for the contracts requested.

if an empty/undefined list is passed, then it should document all
contracts that were found.
2018-09-22 10:55:46 -04:00
F. Eugene Aumson
37cb18e1da fix: rename variable 2018-09-22 10:21:27 -04:00
F. Eugene Aumson
3e5d427d4e feat: add sol-doc command-line interface
modified sol-compiler to output progress/warning/error/etc messages to
stderr rather than stdout, so that sol-doc can put its output (and
nothing else) to stdout.

for posterity, added sol-doc cli usage as npm scripts to package.json.
2018-09-22 10:14:49 -04:00
Leonid Logvinov
f3deabccf4 Add CHANGELOG entries 2018-09-21 12:10:25 +02:00
Leonid Logvinov
393f9e5a29 Fix the way we detect BN's 2018-09-21 12:05:13 +02:00
Leonid Logvinov
79cf6969f9 Fix linter issue 2018-09-21 11:48:06 +02:00
Leonid Logvinov
3167bfde1a Remove unused import 2018-09-21 11:47:30 +02:00
F. Eugene Aumson
301e491952 Merge remote-tracking branch 'upstream/development' into sol-doc 2018-09-20 12:51:30 -04:00
Leonid Logvinov
5b6c91bb3f Fixes for the breaking changes in ethers 2018-09-19 17:56:23 +02:00
Leonid Logvinov
6701ec68bd Upgrade contract_templates to work with ethers 4.0 2018-09-19 17:56:23 +02:00
Leonid Logvinov
7b259c3f4c Remove types for ethers.js 2018-09-19 17:56:23 +02:00
Leonid Logvinov
ecbdf5f12b Upgrade to TS version of ethers 2018-09-19 17:56:23 +02:00
F. Eugene Aumson
30622631ff use Array.join rather than string concatenation 2018-09-17 19:31:47 -04:00
F. Eugene Aumson
4bab402e95 doc constructors as returning a Reference...
...not an Intrinsic
2018-09-17 19:31:45 -04:00
F. Eugene Aumson
91de15d50e remove stale comments 2018-09-17 19:31:42 -04:00
F. Eugene Aumson
d40a670d0b add newline to delimit interface declaration 2018-09-17 19:31:40 -04:00
F. Eugene Aumson
4ade674ada test multiple return values from a solidity method 2018-09-17 19:31:37 -04:00
F. Eugene Aumson
401ef2edef minorly tweak comments 2018-09-17 19:31:34 -04:00
F. Eugene Aumson
9201273939 add and test support for return comment 2018-09-17 19:31:32 -04:00
F. Eugene Aumson
5b07669bd0 add and test support for fallback functions 2018-09-17 19:31:30 -04:00
F. Eugene Aumson
3c7155afb0 test all the natspec stuff we use in our contracts 2018-09-17 19:31:23 -04:00
F. Eugene Aumson
a75981da14 test w/&w/out devdoc content in contract 2018-09-17 17:49:14 -04:00
F. Eugene Aumson
d5f964b58e test w/&w/out passing in contractsToCompile 2018-09-17 17:49:03 -04:00
F. Eugene Aumson
cbb5a425df Merge branch 'development' into sol-doc 2018-09-11 19:00:11 -04:00
F. Eugene Aumson
800dd5fb4f ammend generated docs with solc's devdoc output 2018-08-31 16:18:17 -04:00
F. Eugene Aumson
3dc4eb4421 rename 2 variables 2018-08-31 15:28:12 -04:00
F. Eugene Aumson
75664b6651 make postinstall symlink hack cross platform 2018-08-31 11:49:14 -04:00
F. Eugene Aumson
327b4ba554 satisfy linter 2018-08-31 11:18:43 -04:00
F. Eugene Aumson
50b725c687 introduce named vars to clarify return statements 2018-08-31 09:33:26 -04:00
F. Eugene Aumson
72419816a8 Merge remote-tracking branch 'upstream/development' into sol-doc 2018-08-31 09:22:05 -04:00
F. Eugene Aumson
9a4e6da02f enable sol-doc tests in circleci 2018-08-31 09:15:41 -04:00
F. Eugene Aumson
823b6c4d7d transform solc's ABI output into doc types 2018-08-31 09:12:27 -04:00
F. Eugene Aumson
8d122006ba move export to top of file 2018-08-30 12:34:27 -04:00
F. Eugene Aumson
0e45497acb rename variables 2018-08-30 12:28:09 -04:00
F. Eugene Aumson
fe7a62ba9a add named var to make if condition more readable 2018-08-30 12:02:46 -04:00
F. Eugene Aumson
b88a56e6b7 reduce proximity b/w instantiation and use of var 2018-08-30 12:02:46 -04:00
F. Eugene Aumson
297cbd996d remove unnecessary class SolidityDocFormat 2018-08-30 12:02:42 -04:00
F. Eugene Aumson
f55234b4a0 comment public interface 2018-08-30 11:30:43 -04:00
F. Eugene Aumson
f76c88c549 remove unused constructor parameter 2018-08-30 11:24:41 -04:00
F. Eugene Aumson
863966787f dev-depend on @0xproject/tslint-config 2018-08-30 10:43:43 -04:00
F. Eugene Aumson
7ed31d2fba correct package.json's privacy specification 2018-08-30 10:43:43 -04:00
F. Eugene Aumson
6273339f7c add named references for returned objects 2018-08-30 10:43:43 -04:00
F. Eugene Aumson
29f2ae605e re-word comment: 'construction' -> 'instantiation' 2018-08-30 10:43:43 -04:00
F. Eugene Aumson
6450844d7f rename method _addHexPrefixes 2018-08-30 10:43:43 -04:00
F. Eugene Aumson
9834395a48 remove mistaken TODO 2018-08-30 10:43:43 -04:00
F. Eugene Aumson
f429032eef move shared doc types from react-docs to @0x/types 2018-08-30 10:43:36 -04:00
F. Eugene Aumson
5088b7f23c hack postinstall to correct types package symlink
yarn is not doing this properly :( even on v1.9.4.
confirmed with @albrow .
2018-08-30 10:08:35 -04:00
F. Eugene Aumson
28246abec3 remove unneeded entries from doc gen config 2018-08-29 15:23:32 -04:00
F. Eugene Aumson
a1959df911 add devdoc support to solc typings, and use it 2018-08-29 08:51:01 -04:00
F. Eugene Aumson
775d1efd46 add package sol-doc 2018-08-29 08:50:55 -04:00
F. Eugene Aumson
849e203812 add interface to return compiler output...
...rather than persisting it to the filesystem.
2018-08-28 14:24:26 -04:00
F. Eugene Aumson
80ed724f3a rename var compiledData to compiledContract 2018-08-28 14:24:26 -04:00
F. Eugene Aumson
5c056b57b7 extract method _getContractNamesToCompile() 2018-08-28 14:24:26 -04:00
F. Eugene Aumson
4779ebfd20 split method 2018-08-28 14:24:26 -04:00
171 changed files with 2364 additions and 993 deletions

View File

@@ -100,6 +100,7 @@ jobs:
- run: yarn wsrun test:circleci @0xproject/order-watcher
- run: yarn wsrun test:circleci @0xproject/sol-compiler
- 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/subproviders
- run: yarn wsrun test:circleci @0xproject/web3-wrapper
@@ -152,6 +153,10 @@ jobs:
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/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:
key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -218,6 +223,9 @@ jobs:
- restore_cache:
keys:
- coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}

View File

@@ -35,8 +35,7 @@
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
"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;",
"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."
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing"
},
"config": {
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
@@ -54,8 +53,5 @@
"source-map-support": "^0.5.6",
"typescript": "3.0.1",
"wsrun": "^2.2.0"
},
"resolutions": {
"ethers": "0xproject/ethers.js#eip-838-reasons"
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,18 @@
[
{
"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",

View File

@@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only.
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

View File

@@ -1,6 +1,6 @@
{
"name": "@0xproject/base-contract",
"version": "2.0.5",
"version": "3.0.0",
"engines": {
"node": ">=6.12"
},
@@ -40,11 +40,11 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"ethereum-types": "^1.0.8",
"ethers": "3.0.22",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"ethereum-types": "^1.0.9",
"ethers": "4.0.0-beta.14",
"lodash": "^4.17.5"
},
"publishConfig": {

View File

@@ -20,6 +20,11 @@ export interface EthersInterfaceByFunctionSignature {
[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 {
protected _ethersInterfacesByFunctionSignature: EthersInterfaceByFunctionSignature;
protected _web3Wrapper: Web3Wrapper;
@@ -61,7 +66,7 @@ export class BaseContract {
}
}
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>>(
txData: T,
@@ -82,15 +87,24 @@ export class BaseContract {
}
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
// the given inputAbi. An argument may not be considered safely encodeable
// if it overflows the corresponding Solidity type, there is a bug in the
// encoder, or the encoder performs unsafe type coercion.
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 rawEncoded = coder.encode(params.names, params.types, args);
const rawDecoded = coder.decode(params.names, params.types, rawEncoded);
const rawEncoded = coder.encode(inputAbi, args);
const rawDecoded = coder.decode(inputAbi, rawEncoded);
for (let i = 0; i < rawDecoded.length; i++) {
const original = args[i];
const decoded = rawDecoded[i];

View File

@@ -1,4 +1,14 @@
[
{
"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",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
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

View File

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

View File

@@ -149,7 +149,7 @@ export class HttpClient implements Client {
params: requestOpts,
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);
return fees;
}

View File

@@ -148,12 +148,12 @@ describe('HttpClient', () => {
};
const url = `${relayUrl}/order_config`;
it('gets order config', async () => {
fetchMock.get(url, orderConfigResponseJSON);
fetchMock.post(url, orderConfigResponseJSON);
const fees = await relayerClient.getOrderConfigAsync(request);
expect(fees).to.be.deep.equal(orderConfigResponse);
});
it('does not mutate input', async () => {
fetchMock.get(url, orderConfigResponseJSON);
fetchMock.post(url, orderConfigResponseJSON);
const makerAssetAmountBefore = request.makerAssetAmount;
const takerAssetAmountBefore = request.takerAssetAmount;
const expirationTimeSecondsBefore = request.expirationTimeSeconds;
@@ -163,7 +163,7 @@ describe('HttpClient', () => {
expect(expirationTimeSecondsBefore).to.be.deep.equal(request.expirationTimeSeconds);
});
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();
});
});

View File

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

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
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)

View File

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

View 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');
});
});
});

View File

@@ -1,6 +1,6 @@
import { BlockchainLifecycle } from '@0xproject/dev-utils';
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 { BigNumber } from '@0xproject/utils';
import 'mocha';

View File

@@ -65,10 +65,12 @@ export class {{contractName}}Contract extends BaseContract {
[{{> params inputs=ctor.inputs}}],
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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
txData,
{data: txData},
txDefaults,
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
);

View File

@@ -8,10 +8,8 @@ async callAsync(
const inputAbi = self._lookupAbi(functionSignature).inputs;
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}}(
{{> params inputs=inputs}}
) as ethers.CallDescription;
const encodedData = ethersFunction.data;
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}};
const encodedData = ethersFunction.encode([{{> params inputs=inputs}}]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -21,7 +19,8 @@ async callAsync(
self._web3Wrapper.getContractDefaults(),
);
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;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));

View File

@@ -12,9 +12,7 @@ public {{this.tsName}} = {
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
{{> params inputs=inputs}}
).data;
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -37,9 +35,7 @@ public {{this.tsName}} = {
const self = this as any as {{contractName}}Contract;
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString);
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
{{> params inputs=inputs}}
).data;
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -57,9 +53,7 @@ public {{this.tsName}} = {
const self = this as any as {{contractName}}Contract;
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString);
const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
{{> params inputs=inputs}}
).data;
const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]);
return abiEncodedTransactionData;
},
{{> callAsync}}

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "contracts",
"version": "2.1.47",
"version": "2.1.48",
"engines": {
"node": ">=6.12"
},
@@ -45,11 +45,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md",
"devDependencies": {
"@0xproject/abi-gen": "^1.0.11",
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/sol-compiler": "^1.1.5",
"@0xproject/sol-cov": "^2.1.5",
"@0xproject/subproviders": "^2.0.5",
"@0xproject/abi-gen": "^1.0.12",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/sol-compiler": "^1.1.6",
"@0xproject/sol-cov": "^2.1.6",
"@0xproject/subproviders": "^2.0.6",
"@0xproject/tslint-config": "^1.0.7",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
@@ -72,18 +72,18 @@
"yargs": "^10.0.3"
},
"dependencies": {
"@0xproject/base-contract": "^2.0.5",
"@0xproject/order-utils": "^1.0.5",
"@0xproject/types": "^1.1.1",
"@0xproject/typescript-typings": "^2.0.2",
"@0xproject/utils": "^1.0.11",
"@0xproject/web3-wrapper": "^3.0.1",
"@0xproject/base-contract": "^3.0.0",
"@0xproject/order-utils": "^1.0.6",
"@0xproject/types": "^1.1.2",
"@0xproject/typescript-typings": "^3.0.0",
"@0xproject/utils": "^2.0.0",
"@0xproject/web3-wrapper": "^3.0.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.0.8",
"ethereum-types": "^1.0.9",
"ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1",
"ethers": "3.0.22",
"ethers": "4.0.0-beta.14",
"js-combinatorics": "^0.5.3",
"lodash": "^4.17.5"
}

View File

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

View File

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

View File

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

View File

@@ -14,6 +14,7 @@ import { env, EnvVars } from './env';
export interface Web3Config {
hasAddresses?: boolean; // default: true
shouldUseInProcessGanache?: boolean; // default: false
shouldThrowErrorsOnGanacheRPCResponse?: boolean; // default: true
rpcUrl?: string; // default: localhost:8545
shouldUseFakeGasEstimate?: boolean; // default: true
}
@@ -41,15 +42,19 @@ export const web3Factory = {
if (!_.isUndefined(config.rpcUrl)) {
throw new Error('Cannot use both GanacheSubrovider and RPCSubprovider');
}
const shouldThrowErrorsOnGanacheRPCResponse =
_.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) ||
config.shouldThrowErrorsOnGanacheRPCResponse;
provider.addProvider(
new GanacheSubprovider({
vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse,
gasLimit: constants.GAS_LIMIT,
logger,
verbose: env.parseBoolean(EnvVars.VerboseGanache),
port: 8545,
network_id: 50,
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 {
provider.addProvider(new RPCSubprovider(config.rpcUrl || constants.RPC_URL));

View File

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

View File

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

View File

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

View File

@@ -325,9 +325,59 @@ export interface ContractNetworkData {
constructorArgs: string;
}
export type ParamDescription = string;
export interface StandardContractOutput {
abi: ContractAbi;
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 {
@@ -340,6 +390,20 @@ export interface EvmBytecodeOutput {
sourceMap: string;
}
export interface DevdocOutput {
title: string;
author: string;
methods: {
[signature: string]: {
details: string;
params: {
[name: string]: ParamDescription;
};
return?: string;
};
};
}
export interface ContractVersionData {
compiler: CompilerOpts;
sources: {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0xproject/monorepo-scripts",
"version": "1.0.9",
"version": "1.0.10",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,3 +1,4 @@
import * as _ from 'lodash';
import * as yargs from 'yargs';
import { publishReleaseNotesAsync } from './utils/github_release_utils';
@@ -9,14 +10,25 @@ const args = yargs
type: 'boolean',
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 () => {
const isDryRun = args.isDryRun;
const shouldIncludePrivate = false;
const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
let packages;
if (_.isUndefined(args.packages)) {
const shouldIncludePrivate = false;
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);
})().catch(err => {
utils.log(err);

View File

@@ -54,6 +54,13 @@ export const utils = {
}
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[]> {
const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name);

View File

@@ -1,4 +1,15 @@
[
{
"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",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
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

View File

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

View File

@@ -174,6 +174,7 @@ export const signatureUtils = {
assert.isHexString('data', data);
assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema);
assert.isETHAddressHex('signerAddress', signerAddress);
const normalizedSignerAddress = signerAddress.toLowerCase();
const msgHashBuff = ethUtil.toBuffer(data);
try {
@@ -184,7 +185,8 @@ export const signatureUtils = {
ethUtil.toBuffer(signature.s),
);
const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey));
return retrievedAddress === signerAddress;
const normalizedRetrievedAddress = retrievedAddress.toLowerCase();
return normalizedRetrievedAddress === normalizedSignerAddress;
} catch (err) {
return false;
}

View File

@@ -1,4 +1,14 @@
[
{
"version": "2.1.0",
"changes": [
{
"note": "Export ExpirationWatcher",
"pr": 1097
}
],
"timestamp": 1538157789
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
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)

View File

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

View File

@@ -1,4 +1,5 @@
export { OrderWatcher } from './order_watcher/order_watcher';
export { ExpirationWatcher } from './order_watcher/expiration_watcher';
export {
OrderStateValid,

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
#### 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;">
<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 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

View File

@@ -1,10 +1,10 @@
{
"name": "@0xproject/react-docs",
"version": "1.0.11",
"version": "1.0.12",
"engines": {
"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",
"types": "lib/index.d.ts",
"scripts": {
@@ -23,7 +23,7 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
"@0xproject/dev-utils": "^1.0.10",
"@0xproject/dev-utils": "^1.0.11",
"@0xproject/tslint-config": "^1.0.7",
"@types/compare-versions": "^3.0.0",
"copyfiles": "^2.0.0",
@@ -33,8 +33,9 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/react-shared": "^1.0.12",
"@0xproject/utils": "^1.0.11",
"@0xproject/react-shared": "^1.0.13",
"@0xproject/types": "^1.1.2",
"@0xproject/utils": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/material-ui": "^0.20.0",
"@types/node": "*",

View File

@@ -2,7 +2,7 @@ import { logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import * as React from 'react';
import { CustomType } from '../types';
import { CustomType } from '@0xproject/types';
const STRING_ENUM_CODE_PREFIX = ' strEnum(';

View File

@@ -9,24 +9,23 @@ import {
Styles,
utils as sharedUtils,
} from '@0xproject/react-shared';
import {
DocAgnosticFormat,
Event,
ExternalExportToLink,
Property,
SolidityMethod,
TypeDefinitionByName,
TypescriptFunction,
TypescriptMethod,
} from '@0xproject/types';
import * as _ from 'lodash';
import CircularProgress from 'material-ui/CircularProgress';
import * as React from 'react';
import * as semver from 'semver';
import { DocsInfo } from '../docs_info';
import {
AddressByContractName,
DocAgnosticFormat,
Event,
ExternalExportToLink,
Property,
SolidityMethod,
SupportedDocJson,
TypeDefinitionByName,
TypescriptFunction,
TypescriptMethod,
} from '../types';
import { AddressByContractName, SupportedDocJson } from '../types';
import { constants } from '../utils/constants';
import { Badge } from './badge';
@@ -330,7 +329,7 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
return <div>{externalExports}</div>;
}
private _renderNetworkBadgesIfExists(sectionName: string): React.ReactNode {
if (this.props.docsInfo.type !== SupportedDocJson.Doxity) {
if (this.props.docsInfo.type !== SupportedDocJson.SolDoc) {
return null;
}

View File

@@ -1,9 +1,9 @@
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
import { Event, EventArg } from '@0xproject/types';
import * as _ from 'lodash';
import * as React from 'react';
import { DocsInfo } from '../docs_info';
import { Event, EventArg } from '../types';
import { Type } from './type';

View File

@@ -1,8 +1,9 @@
import * as _ from 'lodash';
import * as React from 'react';
import { CustomType, TypeDefinitionByName } from '@0xproject/types';
import { DocsInfo } from '../docs_info';
import { CustomType, TypeDefinitionByName } from '../types';
import { Signature } from './signature';
import { Type } from './type';

View File

@@ -1,8 +1,8 @@
import { AnchorTitle, HeaderSizes } from '@0xproject/react-shared';
import { Property, TypeDefinitionByName } from '@0xproject/types';
import * as React from 'react';
import { DocsInfo } from '../docs_info';
import { Property, TypeDefinitionByName } from '../types';
import { constants } from '../utils/constants';
import { Comment } from './comment';

View File

@@ -1,8 +1,9 @@
import * as _ from 'lodash';
import * as React from 'react';
import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '@0xproject/types';
import { DocsInfo } from '../docs_info';
import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '../types';
import { Type } from './type';

View File

@@ -1,9 +1,15 @@
import { AnchorTitle, colors, HeaderSizes, Styles } from '@0xproject/react-shared';
import {
Parameter,
SolidityMethod,
TypeDefinitionByName,
TypescriptFunction,
TypescriptMethod,
} from '@0xproject/types';
import * as _ from 'lodash';
import * as React from 'react';
import { DocsInfo } from '../docs_info';
import { Parameter, SolidityMethod, TypeDefinitionByName, TypescriptFunction, TypescriptMethod } from '../types';
import { constants } from '../utils/constants';
import { Comment } from './comment';

View File

@@ -1,8 +1,7 @@
import { colors } from '@0xproject/react-shared';
import { Source } from '@0xproject/types';
import * as React from 'react';
import { Source } from '../types';
export interface SourceLinkProps {
source: Source;
sourceUrl: string;

View File

@@ -1,4 +1,5 @@
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 * as _ from 'lodash';
import * as React from 'react';
@@ -6,7 +7,6 @@ import { Link as ScrollLink } from 'react-scroll';
import * as ReactTooltip from 'react-tooltip';
import { DocsInfo } from '../docs_info';
import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '../types';
import { constants } from '../utils/constants';
import { Signature } from './signature';

View File

@@ -1,10 +1,11 @@
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
import { CustomType, CustomTypeChild, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types';
import { errorUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import * as React from 'react';
import { DocsInfo } from '../docs_info';
import { CustomType, CustomTypeChild, KindString, TypeDefinitionByName, TypeDocTypes } from '../types';
import { KindString } from '../types';
import { constants } from '../utils/constants';
import { Comment } from './comment';

View File

@@ -1,20 +1,15 @@
import { MenuSubsectionsBySection } from '@0xproject/react-shared';
import { DocAgnosticFormat, TypeDefinitionByName } from '@0xproject/types';
import * as _ from 'lodash';
import {
ContractsByVersionByNetworkId,
DocAgnosticFormat,
DocsInfoConfig,
DocsMenu,
DoxityDocObj,
GeneratedDocJson,
SectionNameToMarkdownByVersion,
SectionsMap,
SupportedDocJson,
TypeDefinitionByName,
} from './types';
import { doxityUtils } from './utils/doxity_utils';
import { TypeDocUtils } from './utils/typedoc_utils';
export class DocsInfo {
public id: string;
@@ -95,12 +90,4 @@ export class DocsInfo {
const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any;
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();
}
}
}

View File

@@ -1,3 +1,5 @@
export { DocAgnosticFormat, GeneratedDocJson } from '@0xproject/types';
// Exported to give users of this library added flexibility if they want to build
// a docs page from scratch using the individual components.
export { Badge } from './components/badge';
@@ -12,17 +14,10 @@ export { Signature } from './components/signature';
export { SourceLink } from './components/source_link';
export { TypeDefinition } from './components/type_definition';
export { Type } from './components/type';
export { TypeDocUtils } from './utils/typedoc_utils';
export { DocsInfo } from './docs_info';
export {
DocsInfoConfig,
DocAgnosticFormat,
DoxityDocObj,
DocsMenu,
SupportedDocJson,
TypeDocNode,
GeneratedDocJson,
} from './types';
export { DocsInfoConfig, DocsMenu, SupportedDocJson } from './types';
export { constants } from './utils/constants';

View File

@@ -22,72 +22,6 @@ export interface SectionsMap {
[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
// match up those returned by TypeDoc
export enum KindString {
@@ -103,141 +37,8 @@ export enum KindString {
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 {
Doxity = 'DOXITY',
SolDoc = 'SOL_DOC',
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 {
[contractName: string]: string;
}
@@ -297,28 +64,3 @@ export enum AbiTypes {
Function = 'function',
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;
}

View File

@@ -4,7 +4,7 @@ export const constants = {
TYPES_SECTION_NAME: 'types',
EXTERNAL_EXPORTS_SECTION_NAME: 'external exports',
TYPE_TO_SYNTAX: {
[SupportedDocJson.Doxity]: 'solidity',
[SupportedDocJson.SolDoc]: 'solidity',
[SupportedDocJson.TypeDoc]: 'typescript',
} as { [supportedDocType: string]: string },
};

View File

@@ -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;
},
};

View File

@@ -1,7 +1,3 @@
import { errorUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import { DocsInfo } from '../docs_info';
import {
CustomType,
CustomTypeChild,
@@ -11,7 +7,6 @@ import {
ExternalTypeToLink,
GeneratedDocJson,
IndexSignature,
KindString,
Parameter,
Property,
Type,
@@ -21,7 +16,12 @@ import {
TypeParameter,
TypescriptFunction,
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';
@@ -471,6 +471,8 @@ export class TypeDocUtils {
methodIfExists = this._convertMethod(entity.declaration, isConstructor, sectionName);
} else if (entity.type === TypeDocTypes.Tuple) {
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 };
});
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ import {
} from '@0xproject/sol-resolver';
import { fetchAsync, logUtils } from '@0xproject/utils';
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 fs from 'fs';
import * as _ from 'lodash';
@@ -94,7 +94,7 @@ export class Compiler {
if (await fsWrapper.doesFileExistAsync(compilerBinFilename)) {
solcjs = (await fsWrapper.readFileAsync(compilerBinFilename)).toString();
} else {
logUtils.log(`Downloading ${fullSolcVersion}...`);
logUtils.warn(`Downloading ${fullSolcVersion}...`);
const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`;
const response = await fetchAsync(url);
const SUCCESS_STATUS = 200;
@@ -110,6 +110,21 @@ export class Compiler {
const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
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.
* @param opts Optional compiler options
@@ -144,22 +159,40 @@ export class Compiler {
public async compileAsync(): Promise<void> {
await createDirIfDoesNotExistAsync(this._artifactsDir);
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) {
const allContracts = this._nameResolver.getAll();
contractNamesToCompile = _.map(allContracts, contractSource =>
path.basename(contractSource.path, constants.SOLIDITY_FILE_EXTENSION),
);
} 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.
* @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.
const versionToInputs: VersionToInputs = {};
@@ -200,10 +233,12 @@ export class Compiler {
versionToInputs[solcVersion].contractsToCompile.push(contractSource.path);
}
const compilerOutputs: StandardOutput[] = [];
const solcVersions = _.keys(versionToInputs);
for (const solcVersion of solcVersions) {
const input = versionToInputs[solcVersion];
logUtils.log(
logUtils.warn(
`Compiling ${input.contractsToCompile.length} contracts (${
input.contractsToCompile
}) with Solidity v${solcVersion}...`,
@@ -212,18 +247,34 @@ export class Compiler {
const { solcInstance, fullSolcVersion } = await Compiler._getSolcAsync(solcVersion);
const compilerOutput = this._compile(solcInstance, input.standardInput);
compilerOutputs.push(compilerOutput);
for (const contractPath of input.contractsToCompile) {
await this._verifyAndPersistCompiledContractAsync(
contractPath,
contractPathToData[contractPath].currentArtifactIfExists,
contractPathToData[contractPath].sourceTreeHashHex,
contractPathToData[contractPath].contractName,
fullSolcVersion,
compilerOutput,
);
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,
contractPathToData[contractPath].currentArtifactIfExists,
contractPathToData[contractPath].sourceTreeHashHex,
contractName,
fullSolcVersion,
compilerOutput,
);
}
}
}
return compilerOutputs;
}
private _shouldCompile(contractData: ContractData): boolean {
if (_.isUndefined(contractData.currentArtifactIfExists)) {
@@ -236,7 +287,7 @@ export class Compiler {
return !isUserOnLatestVersion || didCompilerSettingsChange || didSourceChange;
}
}
private async _verifyAndPersistCompiledContractAsync(
private async _persistCompiledContractAsync(
contractPath: string,
currentArtifactIfExists: ContractArtifact | void,
sourceTreeHashHex: string,
@@ -244,32 +295,13 @@ export class Compiler {
fullSolcVersion: string,
compilerOutput: solc.StandardOutput,
): Promise<void> {
const compiledData = 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 compiledContract = compilerOutput.contracts[contractPath][contractName];
const sourceCodes = _.mapValues(
compilerOutput.sources,
(_1, sourceFilePath) => this._resolver.resolve(sourceFilePath).source,
);
const contractVersion: ContractVersionData = {
compilerOutput: compiledData,
compilerOutput: compiledContract,
sources: compilerOutput.sources,
sourceCodes,
sourceTreeHashHex,
@@ -299,7 +331,7 @@ export class Compiler {
const artifactString = utils.stringifyWithFormatting(newArtifact);
const currentArtifactPath = `${this._artifactsDir}/${contractName}.json`;
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 {
const compiled: solc.StandardOutput = JSON.parse(
@@ -315,13 +347,13 @@ export class Compiler {
if (!_.isEmpty(errors)) {
errors.forEach(error => {
const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
logUtils.log(chalk.red(normalizedErrMsg));
logUtils.warn(chalk.red(normalizedErrMsg));
});
throw new Error('Compilation errors encountered');
} else {
warnings.forEach(warning => {
const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
logUtils.log(chalk.yellow(normalizedWarningMsg));
logUtils.warn(chalk.yellow(normalizedWarningMsg));
});
}
}

View File

@@ -1,8 +1,29 @@
export { Compiler } from './compiler';
export {
AbiDefinition,
CompilerOptions,
CompilerSettings,
DataItem,
DevdocOutput,
ErrorSeverity,
ErrorType,
EventAbi,
EventParameter,
EvmBytecodeOutput,
EvmOutput,
FallbackAbi,
FunctionAbi,
MethodAbi,
ConstructorAbi,
ConstructorStateMutability,
ContractAbi,
OutputField,
CompilerSettingsMetadata,
OptimizerSettings,
ParamDescription,
SolcError,
StandardContractOutput,
StandardOutput,
StateMutability,
SourceLocation,
} from 'ethereum-types';

View File

@@ -26,7 +26,7 @@ export async function getContractArtifactIfExistsAsync(
contractArtifact = JSON.parse(contractArtifactString);
return contractArtifact;
} catch (err) {
logUtils.log(`Artifact for ${contractName} does not exist`);
logUtils.warn(`Artifact for ${contractName} does not exist`);
return undefined;
}
}
@@ -37,7 +37,7 @@ export async function getContractArtifactIfExistsAsync(
*/
export async function createDirIfDoesNotExistAsync(dirPath: string): Promise<void> {
if (!fsWrapper.doesPathExistSync(dirPath)) {
logUtils.log(`Creating directory at ${dirPath}...`);
logUtils.warn(`Creating directory at ${dirPath}...`);
await fsWrapper.mkdirpAsync(dirPath);
}
}

View File

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

View File

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

View File

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

View 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
}
]
}
]

View File

@@ -0,0 +1,14 @@
<!--
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
CHANGELOG
## v1.0.1 - _September 28, 2018_
* Dependencies updated
## v1.0.0 - _Invalid date_
* Utility to generate documentation for Solidity smart contracts, outputting a format compliant with @0xproject/types.DocAgnosticFormat (#1004)

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('../lib/src/cli.js');

View File

View File

@@ -0,0 +1,49 @@
{
"name": "@0xproject/sol-doc",
"version": "1.0.1",
"description": "Solidity documentation generator",
"main": "lib/src/index.js",
"types": "lib/src/index.d.js",
"scripts": {
"build": "tsc",
"test": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --timeout 6000 --exit",
"test:circleci": "yarn test:coverage",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"lint": "tslint --project . --format stylish",
"clean": "shx rm -rf lib",
"generate-v1-protocol-docs": "(cd ../contracts/src/1.0.0; node ../../../../node_modules/.bin/sol-doc --contracts-dir . --contracts Exchange/Exchange_v1.sol TokenRegistry/TokenRegistry.sol TokenTransferProxy/TokenTransferProxy_v1.sol) > v1.0.0.json",
"generate-v2-protocol-docs": "(cd ../contracts/src/2.0.0; node ../../../../node_modules/.bin/sol-doc --contracts-dir . --contracts $(cd protocol; ls -C1 */*.sol */interfaces/*.sol) ) > v2.0.0.json",
"deploy-v2-protocol-docs": "aws --profile 0xproject s3 cp --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json v2.0.0.json s3://staging-doc-jsons/contracts/",
"deploy-v1-protocol-docs": "aws --profile 0xproject s3 cp --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json v1.0.0.json s3://staging-doc-jsons/contracts/"
},
"bin": {
"sol-doc": "bin/sol-doc.js"
},
"repository": "https://github.com/0xProject/0x-monorepo.git",
"author": "F. Eugene Aumson",
"license": "Apache-2.0",
"dependencies": {
"@0xproject/sol-compiler": "^1.1.6",
"@0xproject/types": "^1.1.2",
"@0xproject/utils": "^2.0.0",
"ethereum-types": "^1.0.9",
"lodash": "^4.17.10",
"yargs": "^12.0.2"
},
"devDependencies": {
"@0xproject/tslint-config": "^1.0.7",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.2",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^5.2.0",
"shx": "^0.2.2",
"source-map-support": "^0.5.0",
"tslint": "5.11.0"
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,28 @@
import 'source-map-support/register';
import * as yargs from 'yargs';
import { logUtils } from '@0xproject/utils';
import { generateSolDocAsync } from './solidity_doc_generator';
const JSON_TAB_WIDTH = 4;
(async () => {
const argv = yargs
.option('contracts-dir', {
type: 'string',
description: 'path of contracts directory to compile',
})
.option('contracts', {
type: 'string',
description: 'comma separated list of contracts to compile',
})
.demandOption('contracts-dir')
.array('contracts')
.help().argv;
const doc = await generateSolDocAsync(argv.contractsDir, argv.contracts);
process.stdout.write(JSON.stringify(doc, null, JSON_TAB_WIDTH));
})().catch(err => {
logUtils.warn(err);
process.exit(1);
});

View File

@@ -0,0 +1 @@
export { generateSolDocAsync } from './solidity_doc_generator';

Some files were not shown because too many files have changed in this diff Show More