Compare commits
22 Commits
@0xproject
...
@0xproject
Author | SHA1 | Date | |
---|---|---|---|
|
6ba6bec105 | ||
|
d95b1e2db4 | ||
|
c1d6c7ff66 | ||
|
6e12794765 | ||
|
0f4b05e374 | ||
|
695b697cdf | ||
|
3aea0e3b2f | ||
|
c0e92d511e | ||
|
51f2a20b2a | ||
|
333a23f222 | ||
|
3bf3f479f5 | ||
|
6241d06f27 | ||
|
9e81d3c87b | ||
|
a9b2838c5f | ||
|
fbc39614c0 | ||
|
b2d6ac8dba | ||
|
b090b7b1f2 | ||
|
ba0696a0d7 | ||
|
b57850a225 | ||
|
4d9029bb0e | ||
|
bc49dde4d5 | ||
|
afe07b2926 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -79,6 +79,7 @@ packages/contracts/src/artifacts
|
||||
# generated contract wrappers
|
||||
packages/0x.js/src/contract_wrappers/generated/
|
||||
packages/contracts/src/contract_wrappers/generated/
|
||||
packages/metacoin/src/contract_wrappers
|
||||
|
||||
# solc-bin in deployer
|
||||
packages/deployer/solc_bin/
|
||||
|
@@ -56,6 +56,11 @@ Dedicated documentation pages:
|
||||
* [0x.js Library](https://0xproject.com/docs/0xjs)
|
||||
* [0x Connect](https://0xproject.com/docs/connect)
|
||||
* [Smart contracts](https://0xproject.com/docs/contracts)
|
||||
* [Subproviders](https://0xproject.com/docs/subproviders)
|
||||
* [Deployer](https://0xproject.com/docs/deployer)
|
||||
* [Web3-wrapper](https://0xproject.com/docs/web3-wrapper)
|
||||
* [JSON-schemas](https://0xproject.com/docs/json-schemas)
|
||||
* [Sol-cov](https://0xproject.com/docs/sol-cov)
|
||||
* [Standard Relayer API](https://github.com/0xProject/standard-relayer-api/blob/master/README.md)
|
||||
|
||||
Most of the packages require additional typings for external dependencies.
|
||||
@@ -90,14 +95,14 @@ yarn install
|
||||
Build all packages. You need to do this before working on any given package. Although these packages
|
||||
as independent, when run from within the monorepo, they are internally symlinked, to make development
|
||||
easier. You can change several packages and run the changes without publishing them first to NPM. When
|
||||
running `rebuild`, Lerna will figure out the dependency order of all the packages, and built them in
|
||||
running `rebuild`, Lerna will figure out the dependency order of all the packages, and build them in
|
||||
this order.
|
||||
|
||||
```bash
|
||||
yarn lerna:rebuild
|
||||
```
|
||||
|
||||
Continuously rebuild on change
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
|
@@ -1,4 +1,15 @@
|
||||
[
|
||||
{
|
||||
"version": "0.35.0",
|
||||
"changes": [
|
||||
{
|
||||
"note":
|
||||
"Removed `ZeroExError.TransactionMiningTimeout` and moved it to '@0xproject/web3_wrapper' `Web3WrapperErrors.TransactionMiningTimeout`",
|
||||
"pr": 485
|
||||
}
|
||||
],
|
||||
"timestamp": 1522673609
|
||||
},
|
||||
{
|
||||
"version": "0.34.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.35.0 - _April 2, 2018_
|
||||
|
||||
* Removed `ZeroExError.TransactionMiningTimeout` and moved it to '@0xproject/web3_wrapper' `Web3WrapperErrors.TransactionMiningTimeout` (#485)
|
||||
|
||||
## v0.34.0 - _April 2, 2018_
|
||||
|
||||
* Fix the bug causing `zeroEx.exchange.fillOrdersUpToAsync` validation to fail if there were some extra orders passed (#470)
|
||||
@@ -12,16 +16,16 @@ CHANGELOG
|
||||
* Add `zeroEx.createOrderStateWatcher` to allow creating arbitrary number of OrderStateWatchers (#488)
|
||||
* Added `stateLayer` setting to `OrderStateWatcherConfig` so OrderStateWatcher can be set to monitor different blockchain state layers (#488)
|
||||
|
||||
## v0.33.2 - _March 18, 2018_
|
||||
## v0.33.2 - _March 17, 2018_
|
||||
|
||||
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
|
||||
* Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456)
|
||||
|
||||
## v0.33.1 - _March 8, 2018_
|
||||
## v0.33.1 - _March 7, 2018_
|
||||
|
||||
* Add missing EthersJs typescript typings as dependency
|
||||
|
||||
## v0.33.0 - _March 4, 2018_
|
||||
## v0.33.0 - _March 3, 2018_
|
||||
|
||||
* Validate and lowercase all addresses in public methods (#373)
|
||||
* Improve validation to force passing contract addresses on private networks (#385)
|
||||
@@ -29,54 +33,54 @@ CHANGELOG
|
||||
* Rename all public `_unsubscribeAll` methods to `unsubscribeAll` (#415)
|
||||
* Move web3 typings from devDep to dep since cannot use this package without it (#429)
|
||||
|
||||
## v0.32.2 - _February 9, 2018_
|
||||
## v0.32.2 - _February 8, 2018_
|
||||
|
||||
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
|
||||
|
||||
## v0.32.1 - _February 7, 2018_
|
||||
## v0.32.1 - _February 6, 2018_
|
||||
|
||||
* Reorganized `BlockParamLiteral` export into `@0xproject/types` package (#355)
|
||||
* Now using `abi-gen` package to generate ContractEventArgs types (#371)
|
||||
|
||||
## v0.32.0 - _February 5, 2018_
|
||||
## v0.32.0 - _February 4, 2018_
|
||||
|
||||
* Add `zeroEx.etherToken.getContractAddressIfExists` (#350)
|
||||
* Fixed the bug causing order watcher to throw if there is an event with the same signature but different indexed fields (#366)
|
||||
|
||||
## v0.31.1 - _February 1, 2018_
|
||||
## v0.31.1 - _January 31, 2018_
|
||||
|
||||
* Fix the bug causing order watcher to throw if makerToken === zrx (#357)
|
||||
|
||||
## v0.31.0 - _January 30, 2018_
|
||||
## v0.31.0 - _January 29, 2018_
|
||||
|
||||
* Add the `shouldAddPersonalMessagePrefix` parameter to `signOrderHashAsync` so that the caller can decide on whether to add the personalMessage prefix before relaying the request to the signer. Parity Signer, Ledger and TestRPC add the prefix themselves, Metamask expects it to have already been added. (#349)
|
||||
|
||||
## v0.30.2 - _January 29, 2018_
|
||||
## v0.30.2 - _January 28, 2018_
|
||||
|
||||
* Add Rinkeby testnet addresses to artifacts (#337)
|
||||
* Move @0xproject/types to dependencies from devDependencies fixing missing type errors
|
||||
|
||||
## v0.30.1 - _January 24, 2018_
|
||||
## v0.30.1 - _January 23, 2018_
|
||||
|
||||
* Fix a bug allowing negative fill values (#212)
|
||||
* Fix a bug that made it impossible to pass a custom ZRX address (#341)
|
||||
|
||||
## v0.30.0 - _January 17, 2018_
|
||||
## v0.30.0 - _January 16, 2018_
|
||||
|
||||
* Add an error parameter to the order watcher callback (#312)
|
||||
* Fix a bug making it impossible to catch some errors from awaitTransactionMinedAsync (#312)
|
||||
* Fix a bug in fillOrdersUpTo validation making it impossible to fill up to if user doesn't have enough balance to fully fill all the orders (#321)
|
||||
|
||||
## v0.29.1 - _January 11, 2018_
|
||||
## v0.29.1 - _January 10, 2018_
|
||||
|
||||
* Fixed bignumber config issue #301 (#305)
|
||||
|
||||
## v0.29.0 - _December 28, 2017_
|
||||
## v0.29.0 - _December 27, 2017_
|
||||
|
||||
* Assert baseUnit amount supplied to `toUnitAmount` is integer amount. (#287)
|
||||
* `toBaseUnitAmount` throws if amount supplied has too many decimals (#287)
|
||||
|
||||
## v0.28.0 - _December 20, 2017_
|
||||
## v0.28.0 - _December 19, 2017_
|
||||
|
||||
* Add `etherTokenAddress` arg to `depositAsync` and `withdrawAsync` methods on `zeroEx.etherToken` (#267)
|
||||
* Removed accidentally included `unsubscribeAll` method from `zeroEx.proxy`, `zeroEx.etherToken` and `zeroEx.tokenRegistry` (#267)
|
||||
@@ -88,11 +92,11 @@ CHANGELOG
|
||||
* Support `Deposit` and `Withdraw` events on etherToken (#277)
|
||||
* Improve the error message when taker is not a string (#278)
|
||||
|
||||
## v0.27.1 - _November 28, 2017_
|
||||
## v0.27.1 - _November 27, 2017_
|
||||
|
||||
* Export `TransactionOpts` type
|
||||
|
||||
## v0.27.0 - _November 28, 2017_
|
||||
## v0.27.0 - _November 27, 2017_
|
||||
|
||||
* Make `ZeroExConfig` required parameter of `ZeroEx` constructor (#233)
|
||||
* Add a required property `networkId` to `ZeroExConfig` (#233)
|
||||
@@ -104,65 +108,65 @@ CHANGELOG
|
||||
* All transaction sending methods now call `estimateGas` if no gas amount was supplied (#235)
|
||||
* Modify order validation methods to validate against the `latest` block, not against the `pending` block (#236)
|
||||
|
||||
## v0.26.0 - _November 21, 2017_
|
||||
## v0.26.0 - _November 20, 2017_
|
||||
|
||||
* Add post-formatter for logs converting `blockNumber`, `logIndex`, `transactionIndex` from hexes to numbers (#231)
|
||||
* Remove support for Async callback types when used in Subscribe functions (#222)
|
||||
* In OrderWatcher subscribe to ZRX Token Transfer and Approval events when maker token is different (#225)
|
||||
|
||||
## v0.25.1 - _November 13, 2017_
|
||||
## v0.25.1 - _November 12, 2017_
|
||||
|
||||
* Standardise on Cancelled over Canceled (#217)
|
||||
* Add missing `DecodedLogEvent` type to exported types (#205)
|
||||
* Normalized the transactionReceipt status to be `null|0|1`, 1 meaning transaction execution successful, 0 unsuccessful and `null` if it is a pre-byzantinium transaction. (#200)
|
||||
|
||||
## v0.23.0 - _November 12, 2017_
|
||||
## v0.23.0 - _November 11, 2017_
|
||||
|
||||
* Fixed unhandled promise rejection error in subscribe methods (#209)
|
||||
* Subscribe callbacks now receive an error object as their first argument
|
||||
|
||||
## v0.22.6 - _November 10, 2017_
|
||||
## v0.22.6 - _November 9, 2017_
|
||||
|
||||
* Add a timeout parameter to transaction awaiting (#206)
|
||||
|
||||
## v0.22.5 - _November 7, 2017_
|
||||
## v0.22.5 - _November 6, 2017_
|
||||
|
||||
* Re-publish v0.22.4 to fix publishing issue
|
||||
|
||||
## v0.22.4 - _October 25, 2017_
|
||||
## v0.22.4 - _October 24, 2017_
|
||||
|
||||
* Upgraded bignumber.js to a new version that ships with native typings
|
||||
|
||||
## v0.22.3 - _October 25, 2017_
|
||||
## v0.22.3 - _October 24, 2017_
|
||||
|
||||
* Fixed an issue with new version of testrpc and unlimited proxy allowance (#199)
|
||||
|
||||
## v0.22.2 - _October 24, 2017_
|
||||
## v0.22.2 - _October 23, 2017_
|
||||
|
||||
* Fixed rounding of maker fill amount and incorrect validation of partial fees (#197)
|
||||
|
||||
## v0.22.0 - _October 16, 2017_
|
||||
## v0.22.0 - _October 15, 2017_
|
||||
|
||||
* Started using `OrderFillRequest` interface instead of `OrderFillOrKillRequest` interface for `zeroEx.exchange.batchFillOrKill` (#187)
|
||||
* Removed `OrderFillOrKillRequest` (#187)
|
||||
|
||||
## v0.21.4 - _October 13, 2017_
|
||||
## v0.21.4 - _October 12, 2017_
|
||||
|
||||
* Made 0x.js more type-safe by making `getLogsAsync` and `subscribe/subscribeAsync` generics parametrized with arg type (#194)
|
||||
|
||||
## v0.21.3 - _October 12, 2017_
|
||||
## v0.21.3 - _October 11, 2017_
|
||||
|
||||
* Fixed a bug causing order fills to throw `INSUFFICIENT_TAKER_ALLOWANCE` (#193)
|
||||
|
||||
## v0.21.2 - _October 11, 2017_
|
||||
## v0.21.2 - _October 10, 2017_
|
||||
|
||||
* Exported `ContractEventArg` as a public type (#190)
|
||||
|
||||
## v0.21.1 - _October 11, 2017_
|
||||
## v0.21.1 - _October 10, 2017_
|
||||
|
||||
* Fixed a bug in subscriptions (#189)
|
||||
|
||||
## v0.21.0 - _October 10, 2017_
|
||||
## v0.21.0 - _October 9, 2017_
|
||||
|
||||
* Complete rewrite of subscription logic (#182)
|
||||
* Subscriptions no longer return historical logs. If you want them - use `getLogsAsync`
|
||||
@@ -177,27 +181,27 @@ CHANGELOG
|
||||
* Renamed `zeroEx.token.stopWatchingAllEventsAsync` to `zeroEx.token.unsubscribeAll`
|
||||
* Fixed the batch fills validation by emulating all balance & proxy allowance changes (#185)
|
||||
|
||||
## v0.20.0 - _October 5, 2017_
|
||||
## v0.20.0 - _October 4, 2017_
|
||||
|
||||
* Add `zeroEx.token.getLogsAsync` (#178)
|
||||
* Add `zeroEx.exchange.getLogsAsync` (#178)
|
||||
* Fixed fees validation when one of the tokens transferred is ZRX (#181)
|
||||
|
||||
## v0.19.0 - _September 29, 2017_
|
||||
## v0.19.0 - _September 28, 2017_
|
||||
|
||||
* Made order validation optional (#172)
|
||||
* Added Ropsten testnet support (#173)
|
||||
* Fixed a bug causing awaitTransactionMinedAsync to DDos backend nodes (#175)
|
||||
|
||||
## v0.18.0 - _September 26, 2017_
|
||||
## v0.18.0 - _September 25, 2017_
|
||||
|
||||
* Added `zeroEx.exchange.validateOrderFillableOrThrowAsync` to simplify orderbook pruning (#170)
|
||||
|
||||
## v0.17.0 - _September 26, 2017_
|
||||
## v0.17.0 - _September 25, 2017_
|
||||
|
||||
* Made `zeroEx.exchange.getZRXTokenAddressAsync` public (#171)
|
||||
|
||||
## v0.16.0 - _September 20, 2017_
|
||||
## v0.16.0 - _September 19, 2017_
|
||||
|
||||
* Added the ability to specify custom contract addresses to be used with 0x.js (#165)
|
||||
* ZeroExConfig.exchangeContractAddress
|
||||
@@ -205,48 +209,48 @@ CHANGELOG
|
||||
* ZeroExConfig.etherTokenContractAddress
|
||||
* Added `zeroEx.tokenRegistry.getContractAddressAsync` (#165)
|
||||
|
||||
## v0.15.0 - _September 8, 2017_
|
||||
## v0.15.0 - _September 7, 2017_
|
||||
|
||||
* Added the ability to specify a historical `blockNumber` at which to query the blockchain's state when calling a token or exchange method (#161)
|
||||
|
||||
## v0.14.2 - _September 7, 2017_
|
||||
## v0.14.2 - _September 6, 2017_
|
||||
|
||||
* Fixed an issue with bignumber.js types not found (#160)
|
||||
|
||||
## v0.14.1 - _September 7, 2017_
|
||||
## v0.14.1 - _September 6, 2017_
|
||||
|
||||
* Fixed an issue with Artifact type not found (#159)
|
||||
|
||||
## v0.14.0 - _September 6, 2017_
|
||||
## v0.14.0 - _September 5, 2017_
|
||||
|
||||
* Added `zeroEx.exchange.throwLogErrorsAsErrors` method to public interface (#157)
|
||||
* Fixed an issue with overlapping async intervals in `zeroEx.awaitTransactionMinedAsync` (#157)
|
||||
* Fixed an issue with log decoder returning `BigNumber`s as `strings` (#157)
|
||||
|
||||
## v0.13.0 - _September 6, 2017_
|
||||
## v0.13.0 - _September 5, 2017_
|
||||
|
||||
* Made all the functions submitting transactions to the network to immediately return transaction hash (#151)
|
||||
* Added `zeroEx.awaitTransactionMinedAsync` (#151)
|
||||
* Added `TransactionReceiptWithDecodedLogs`, `LogWithDecodedArgs`, `DecodedLogArgs` to public types (#151)
|
||||
* Added signature validation to `validateFillOrderThrowIfInvalidAsync` (#152)
|
||||
|
||||
## v0.12.1 - _September 2, 2017_
|
||||
## v0.12.1 - _September 1, 2017_
|
||||
|
||||
* Added the support for web3@1.x.x provider (#142)
|
||||
* Added the optional `zeroExConfig` parameter to the constructor of `ZeroEx` (#139)
|
||||
* Added the ability to specify `gasPrice` when instantiating `ZeroEx` (#139)
|
||||
|
||||
## v0.11.0 - _August 24, 2017_
|
||||
## v0.11.0 - _August 23, 2017_
|
||||
|
||||
* Added `zeroEx.token.setUnlimitedProxyAllowanceAsync` (#137)
|
||||
* Added `zeroEx.token.setUnlimitedAllowanceAsync` (#137)
|
||||
* Added `zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS` (#137)
|
||||
|
||||
## v0.10.4 - _August 24, 2017_
|
||||
## v0.10.4 - _August 23, 2017_
|
||||
|
||||
* Fixed a bug where checksummed addresses were being pulled from artifacts and not lower-cased. (#135)
|
||||
|
||||
## v0.10.1 - _August 24, 2017_
|
||||
## v0.10.1 - _August 23, 2017_
|
||||
|
||||
* Added `zeroEx.exchange.validateFillOrderThrowIfInvalidAsync` (#128)
|
||||
* Added `zeroEx.exchange.validateFillOrKillOrderThrowIfInvalidAsync` (#128)
|
||||
@@ -261,20 +265,20 @@ CHANGELOG
|
||||
* Added clear error message when checksummed address is passed to a public method (#124)
|
||||
* Fixes the description of `shouldThrowOnInsufficientBalanceOrAllowance` in docs (#127)
|
||||
|
||||
## v0.9.3 - _August 22, 2017_
|
||||
## v0.9.3 - _August 21, 2017_
|
||||
|
||||
* Update contract artifacts to include latest Kovan and Mainnet deploys (#118)
|
||||
|
||||
## v0.9.2 - _August 21, 2017_
|
||||
## v0.9.2 - _August 20, 2017_
|
||||
|
||||
* *This version was unpublished because of a publishing issue.*
|
||||
* Update contract artifacts to include latest Kovan and Mainnet deploys (#118)
|
||||
|
||||
## v0.9.1 - _August 16, 2017_
|
||||
## v0.9.1 - _August 15, 2017_
|
||||
|
||||
* Fixed the bug causing `zeroEx.token.getBalanceAsync()` to fail if no addresses available (#120)
|
||||
|
||||
## v0.9.0 - _July 26, 2017_
|
||||
## v0.9.0 - _July 25, 2017_
|
||||
|
||||
* Migrated to the new version of smart contracts (#101)
|
||||
* Removed the ability to call methods on multiple authorized Exchange smart contracts (#106)
|
||||
@@ -285,7 +289,7 @@ CHANGELOG
|
||||
* Updated to typescript v2.4 (#104)
|
||||
* Fixed an issue with incorrect balance/allowance validation when ZRX is one of the tokens traded (#109)
|
||||
|
||||
## v0.8.0 - _July 4, 2017_
|
||||
## v0.8.0 - _July 3, 2017_
|
||||
|
||||
* Added the ability to call methods on different authorized versions of the Exchange smart contract (#82)
|
||||
* Updated contract artifacts to reflect latest changes to the smart contracts (0xproject/contracts#59)
|
||||
@@ -298,35 +302,35 @@ CHANGELOG
|
||||
* `zeroEx.tokenRegistry.invalidateContractInstance`
|
||||
* Fixed the bug where `zeroEx.setProviderAsync` didn't invalidate etherToken contract's instance
|
||||
|
||||
## v0.7.1 - _June 26, 2017_
|
||||
## v0.7.1 - _June 25, 2017_
|
||||
|
||||
* Added the ability to convert Ether to wrapped Ether tokens and back via `zeroEx.etherToken.depostAsync` and `zeroEx.etherToken.withdrawAsync` (#81)
|
||||
|
||||
## v0.7.0 - _June 22, 2017_
|
||||
## v0.7.0 - _June 21, 2017_
|
||||
|
||||
* Added Kovan smart contract artifacts (#78)
|
||||
* Started returning fillAmount from `fillOrderAsync` and `fillUpToAsync` (#72)
|
||||
* Started returning cancelledAmount from `cancelOrderAsync` (#72)
|
||||
* Renamed type `LogCancelArgs` to `LogCancelContractEventArgs` and `LogFillArgs` to `LogFillContractEventArgs`
|
||||
|
||||
## v0.6.2 - _June 21, 2017_
|
||||
## v0.6.2 - _June 20, 2017_
|
||||
|
||||
* Reduced bundle size
|
||||
* Improved documentation
|
||||
|
||||
## v0.6.1 - _June 19, 2017_
|
||||
## v0.6.1 - _June 18, 2017_
|
||||
|
||||
* Improved documentation
|
||||
|
||||
## v0.6.0 - _June 19, 2017_
|
||||
## v0.6.0 - _June 18, 2017_
|
||||
|
||||
* Made `ZeroEx` class accept `Web3Provider` instance instead of `Web3` instance
|
||||
* Added types for contract event arguments
|
||||
|
||||
## v0.5.2 - _June 15, 2017_
|
||||
## v0.5.2 - _June 14, 2017_
|
||||
|
||||
* Fixed the bug in `postpublish` script that caused that only unminified UMD bundle was uploaded to release page
|
||||
|
||||
## v0.5.1 - _June 15, 2017_
|
||||
## v0.5.1 - _June 14, 2017_
|
||||
|
||||
* Added `postpublish` script to publish to Github Releases with assets.
|
||||
|
@@ -27,6 +27,7 @@
|
||||
"build:commonjs": "tsc && copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"test:commonjs": "run-s build:commonjs run_mocha",
|
||||
"run_mocha": "mocha lib/test/**/*_test.js --timeout 10000 --bail --exit",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
|
||||
@@ -90,7 +91,6 @@
|
||||
"truffle-hdwallet-provider": "^0.0.3",
|
||||
"tslint": "5.8.0",
|
||||
"typedoc": "0xProject/typedoc",
|
||||
"types-bn": "^0.0.1",
|
||||
"typescript": "2.7.1",
|
||||
"web3-provider-engine": "^13.0.1",
|
||||
"webpack": "^3.1.0"
|
||||
|
@@ -58,7 +58,6 @@ export class ZeroEx {
|
||||
*/
|
||||
public proxy: TokenTransferProxyWrapper;
|
||||
private _web3Wrapper: Web3Wrapper;
|
||||
private _abiDecoder: AbiDecoder;
|
||||
/**
|
||||
* Verifies that the elliptic curve signature `signature` was generated
|
||||
* by signing `data` with the private key corresponding to the `signerAddress` address.
|
||||
@@ -167,21 +166,22 @@ export class ZeroEx {
|
||||
]);
|
||||
const artifactJSONs = _.values(artifacts);
|
||||
const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
|
||||
this._abiDecoder = new AbiDecoder(abiArrays);
|
||||
const defaults = {
|
||||
gasPrice: config.gasPrice,
|
||||
};
|
||||
this._web3Wrapper = new Web3Wrapper(provider, defaults);
|
||||
_.forEach(abiArrays, abi => {
|
||||
this._web3Wrapper.abiDecoder.addABI(abi);
|
||||
});
|
||||
this.proxy = new TokenTransferProxyWrapper(
|
||||
this._web3Wrapper,
|
||||
config.networkId,
|
||||
config.tokenTransferProxyContractAddress,
|
||||
);
|
||||
this.token = new TokenWrapper(this._web3Wrapper, config.networkId, this._abiDecoder, this.proxy);
|
||||
this.token = new TokenWrapper(this._web3Wrapper, config.networkId, this.proxy);
|
||||
this.exchange = new ExchangeWrapper(
|
||||
this._web3Wrapper,
|
||||
config.networkId,
|
||||
this._abiDecoder,
|
||||
this.token,
|
||||
config.exchangeContractAddress,
|
||||
config.zrxContractAddress,
|
||||
@@ -191,7 +191,7 @@ export class ZeroEx {
|
||||
config.networkId,
|
||||
config.tokenRegistryContractAddress,
|
||||
);
|
||||
this.etherToken = new EtherTokenWrapper(this._web3Wrapper, config.networkId, this._abiDecoder, this.token);
|
||||
this.etherToken = new EtherTokenWrapper(this._web3Wrapper, config.networkId, this.token);
|
||||
}
|
||||
/**
|
||||
* Sets a new web3 provider for 0x.js. Updating the provider will stop all
|
||||
@@ -285,44 +285,12 @@ export class ZeroEx {
|
||||
pollingIntervalMs = 1000,
|
||||
timeoutMs?: number,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
let timeoutExceeded = false;
|
||||
if (timeoutMs) {
|
||||
setTimeout(() => (timeoutExceeded = true), timeoutMs);
|
||||
}
|
||||
|
||||
const txReceiptPromise = new Promise(
|
||||
(resolve: (receipt: TransactionReceiptWithDecodedLogs) => void, reject) => {
|
||||
const intervalId = intervalUtils.setAsyncExcludingInterval(
|
||||
async () => {
|
||||
if (timeoutExceeded) {
|
||||
intervalUtils.clearAsyncExcludingInterval(intervalId);
|
||||
return reject(ZeroExError.TransactionMiningTimeout);
|
||||
}
|
||||
|
||||
const transactionReceipt = await this._web3Wrapper.getTransactionReceiptAsync(txHash);
|
||||
if (!_.isNull(transactionReceipt)) {
|
||||
intervalUtils.clearAsyncExcludingInterval(intervalId);
|
||||
const logsWithDecodedArgs = _.map(
|
||||
transactionReceipt.logs,
|
||||
this._abiDecoder.tryToDecodeLogOrNoop.bind(this._abiDecoder),
|
||||
);
|
||||
const transactionReceiptWithDecodedLogArgs: TransactionReceiptWithDecodedLogs = {
|
||||
...transactionReceipt,
|
||||
logs: logsWithDecodedArgs,
|
||||
};
|
||||
resolve(transactionReceiptWithDecodedLogArgs);
|
||||
}
|
||||
},
|
||||
pollingIntervalMs,
|
||||
(err: Error) => {
|
||||
intervalUtils.clearAsyncExcludingInterval(intervalId);
|
||||
reject(err);
|
||||
},
|
||||
);
|
||||
},
|
||||
const transactionReceiptWithDecodedLogs = await this._web3Wrapper.awaitTransactionMinedAsync(
|
||||
txHash,
|
||||
pollingIntervalMs,
|
||||
timeoutMs,
|
||||
);
|
||||
const txReceipt = await txReceiptPromise;
|
||||
return txReceipt;
|
||||
return transactionReceiptWithDecodedLogs;
|
||||
}
|
||||
/**
|
||||
* Instantiates and returns a new OrderStateWatcher instance.
|
||||
@@ -331,7 +299,7 @@ export class ZeroEx {
|
||||
* @return An instance of the 0x.js OrderStateWatcher class.
|
||||
*/
|
||||
public createOrderStateWatcher(config?: OrderStateWatcherConfig) {
|
||||
return new OrderStateWatcher(this._web3Wrapper, this._abiDecoder, this.token, this.exchange, config);
|
||||
return new OrderStateWatcher(this._web3Wrapper, this.token, this.exchange, config);
|
||||
}
|
||||
/*
|
||||
* HACK: `TokenWrapper` needs a token transfer proxy address. `TokenTransferProxy` address is fetched from
|
||||
|
@@ -32,7 +32,6 @@ const CONTRACT_NAME_TO_NOT_FOUND_ERROR: {
|
||||
export class ContractWrapper {
|
||||
protected _web3Wrapper: Web3Wrapper;
|
||||
protected _networkId: number;
|
||||
private _abiDecoder?: AbiDecoder;
|
||||
private _blockAndLogStreamerIfExists?: BlockAndLogStreamer;
|
||||
private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer;
|
||||
private _filters: { [filterToken: string]: FilterObject };
|
||||
@@ -41,10 +40,9 @@ export class ContractWrapper {
|
||||
};
|
||||
private _onLogAddedSubscriptionToken: string | undefined;
|
||||
private _onLogRemovedSubscriptionToken: string | undefined;
|
||||
constructor(web3Wrapper: Web3Wrapper, networkId: number, abiDecoder?: AbiDecoder) {
|
||||
constructor(web3Wrapper: Web3Wrapper, networkId: number) {
|
||||
this._web3Wrapper = web3Wrapper;
|
||||
this._networkId = networkId;
|
||||
this._abiDecoder = abiDecoder;
|
||||
this._filters = {};
|
||||
this._filterCallbacks = {};
|
||||
this._blockAndLogStreamerIfExists = undefined;
|
||||
@@ -102,10 +100,10 @@ export class ContractWrapper {
|
||||
protected _tryToDecodeLogOrNoop<ArgsType extends ContractEventArgs>(
|
||||
log: LogEntry,
|
||||
): LogWithDecodedArgs<ArgsType> | RawLog {
|
||||
if (_.isUndefined(this._abiDecoder)) {
|
||||
if (_.isUndefined(this._web3Wrapper.abiDecoder)) {
|
||||
throw new Error(InternalZeroExError.NoAbiDecoder);
|
||||
}
|
||||
const logWithDecodedArgs = this._abiDecoder.tryToDecodeLogOrNoop(log);
|
||||
const logWithDecodedArgs = this._web3Wrapper.abiDecoder.tryToDecodeLogOrNoop(log);
|
||||
return logWithDecodedArgs;
|
||||
}
|
||||
protected async _getContractAbiAndAddressFromArtifactsAsync(
|
||||
|
@@ -21,8 +21,8 @@ export class EtherTokenWrapper extends ContractWrapper {
|
||||
[address: string]: EtherTokenContract;
|
||||
} = {};
|
||||
private _tokenWrapper: TokenWrapper;
|
||||
constructor(web3Wrapper: Web3Wrapper, networkId: number, abiDecoder: AbiDecoder, tokenWrapper: TokenWrapper) {
|
||||
super(web3Wrapper, networkId, abiDecoder);
|
||||
constructor(web3Wrapper: Web3Wrapper, networkId: number, tokenWrapper: TokenWrapper) {
|
||||
super(web3Wrapper, networkId);
|
||||
this._tokenWrapper = tokenWrapper;
|
||||
}
|
||||
/**
|
||||
|
@@ -87,12 +87,11 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
constructor(
|
||||
web3Wrapper: Web3Wrapper,
|
||||
networkId: number,
|
||||
abiDecoder: AbiDecoder,
|
||||
tokenWrapper: TokenWrapper,
|
||||
contractAddressIfExists?: string,
|
||||
zrxContractAddressIfExists?: string,
|
||||
) {
|
||||
super(web3Wrapper, networkId, abiDecoder);
|
||||
super(web3Wrapper, networkId);
|
||||
this._tokenWrapper = tokenWrapper;
|
||||
this._orderValidationUtils = new OrderValidationUtils(this);
|
||||
this._contractAddressIfExists = contractAddressIfExists;
|
||||
|
@@ -22,13 +22,8 @@ export class TokenWrapper extends ContractWrapper {
|
||||
public UNLIMITED_ALLOWANCE_IN_BASE_UNITS = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
||||
private _tokenContractsByAddress: { [address: string]: TokenContract };
|
||||
private _tokenTransferProxyWrapper: TokenTransferProxyWrapper;
|
||||
constructor(
|
||||
web3Wrapper: Web3Wrapper,
|
||||
networkId: number,
|
||||
abiDecoder: AbiDecoder,
|
||||
tokenTransferProxyWrapper: TokenTransferProxyWrapper,
|
||||
) {
|
||||
super(web3Wrapper, networkId, abiDecoder);
|
||||
constructor(web3Wrapper: Web3Wrapper, networkId: number, tokenTransferProxyWrapper: TokenTransferProxyWrapper) {
|
||||
super(web3Wrapper, networkId);
|
||||
this._tokenContractsByAddress = {};
|
||||
this._tokenTransferProxyWrapper = tokenTransferProxyWrapper;
|
||||
}
|
||||
|
36
packages/0x.js/src/globals.d.ts
vendored
36
packages/0x.js/src/globals.d.ts
vendored
@@ -1,50 +1,14 @@
|
||||
declare module 'web3_beta';
|
||||
declare module 'chai-bignumber';
|
||||
declare module 'dirty-chai';
|
||||
declare module 'request-promise-native';
|
||||
declare module 'web3-provider-engine';
|
||||
declare module 'web3-provider-engine/subproviders/rpc';
|
||||
declare module 'publish-release';
|
||||
|
||||
// semver-sort declarations
|
||||
declare module 'semver-sort' {
|
||||
const desc: (versions: string[]) => string[];
|
||||
}
|
||||
|
||||
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
|
||||
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise
|
||||
// disallow `namespace`, we disable tslint for the following.
|
||||
/* tslint:disable */
|
||||
declare namespace Chai {
|
||||
interface Assertion {
|
||||
bignumber: Assertion;
|
||||
// HACK: In order to comply with chai-as-promised we make eventually a `PromisedAssertion` not an `Assertion`
|
||||
eventually: PromisedAssertion;
|
||||
}
|
||||
}
|
||||
/* tslint:enable */
|
||||
|
||||
declare module '*.json' {
|
||||
const json: any;
|
||||
/* tslint:disable */
|
||||
export default json;
|
||||
/* tslint:enable */
|
||||
}
|
||||
|
||||
declare module 'ethereumjs-abi' {
|
||||
const soliditySHA3: (argTypes: string[], args: any[]) => Buffer;
|
||||
}
|
||||
|
||||
// truffle-hdwallet-provider declarations
|
||||
declare module 'truffle-hdwallet-provider' {
|
||||
import { JSONRPCRequestPayload, JSONRPCResponsePayload } from '@0xproject/types';
|
||||
import * as Web3 from 'web3';
|
||||
class HDWalletProvider implements Web3.Provider {
|
||||
constructor(mnemonic: string, rpcUrl: string);
|
||||
public sendAsync(
|
||||
payload: JSONRPCRequestPayload,
|
||||
callback: (err: Error, result: JSONRPCResponsePayload) => void,
|
||||
): void;
|
||||
}
|
||||
export = HDWalletProvider;
|
||||
}
|
||||
|
23
packages/0x.js/src/globalsAugment.d.ts
vendored
23
packages/0x.js/src/globalsAugment.d.ts
vendored
@@ -1,23 +0,0 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
|
||||
// HACK: This module overrides the Chai namespace so that we can use BigNumber types inside.
|
||||
// Source: https://github.com/Microsoft/TypeScript/issues/7352#issuecomment-191547232
|
||||
declare global {
|
||||
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
|
||||
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise
|
||||
// disallow `namespace`, we disable tslint for the following.
|
||||
/* tslint:disable */
|
||||
namespace Chai {
|
||||
interface NumberComparer {
|
||||
(value: number | BigNumber, message?: string): Assertion;
|
||||
}
|
||||
interface NumericComparison {
|
||||
greaterThan: NumberComparer;
|
||||
}
|
||||
}
|
||||
/* tslint:enable */
|
||||
interface DecodedLogArg {
|
||||
name: string;
|
||||
value: string | BigNumber;
|
||||
}
|
||||
}
|
@@ -69,7 +69,6 @@ export class OrderStateWatcher {
|
||||
private _callbackIfExists?: OnOrderStateChangeCallback;
|
||||
private _eventWatcher: EventWatcher;
|
||||
private _web3Wrapper: Web3Wrapper;
|
||||
private _abiDecoder: AbiDecoder;
|
||||
private _expirationWatcher: ExpirationWatcher;
|
||||
private _orderStateUtils: OrderStateUtils;
|
||||
private _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore;
|
||||
@@ -78,12 +77,10 @@ export class OrderStateWatcher {
|
||||
private _cleanupJobIntervalIdIfExists?: NodeJS.Timer;
|
||||
constructor(
|
||||
web3Wrapper: Web3Wrapper,
|
||||
abiDecoder: AbiDecoder,
|
||||
token: TokenWrapper,
|
||||
exchange: ExchangeWrapper,
|
||||
config?: OrderStateWatcherConfig,
|
||||
) {
|
||||
this._abiDecoder = abiDecoder;
|
||||
this._web3Wrapper = web3Wrapper;
|
||||
const pollingIntervalIfExistsMs = _.isUndefined(config) ? undefined : config.eventPollingIntervalMs;
|
||||
const stateLayer =
|
||||
@@ -230,7 +227,7 @@ export class OrderStateWatcher {
|
||||
return;
|
||||
}
|
||||
const log = logIfExists as LogEvent; // At this moment we are sure that no error occured and log is defined.
|
||||
const maybeDecodedLog = this._abiDecoder.tryToDecodeLogOrNoop<ContractEventArgs>(log);
|
||||
const maybeDecodedLog = this._web3Wrapper.abiDecoder.tryToDecodeLogOrNoop<ContractEventArgs>(log);
|
||||
const isLogDecoded = !_.isUndefined(((maybeDecodedLog as any) as LogWithDecodedArgs<ContractEventArgs>).event);
|
||||
if (!isLogDecoded) {
|
||||
return; // noop
|
||||
|
@@ -38,7 +38,6 @@ export enum ZeroExError {
|
||||
NoNetworkId = 'NO_NETWORK_ID',
|
||||
SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
|
||||
SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT',
|
||||
TransactionMiningTimeout = 'TRANSACTION_MINING_TIMEOUT',
|
||||
}
|
||||
|
||||
export enum InternalZeroExError {
|
||||
|
@@ -1,13 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"noImplicitThis": false
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*",
|
||||
"./test/**/*",
|
||||
"../../node_modules/types-bn/index.d.ts",
|
||||
"../../node_modules/types-ethereumjs-util/index.d.ts"
|
||||
]
|
||||
"include": ["./src/**/*", "./test/**/*"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.2.9",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.2.8",
|
||||
@@ -6,7 +15,8 @@
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
],
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.2.5",
|
||||
|
@@ -5,30 +5,34 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.2.9 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.2.8 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.2.5 - _March 18, 2018_
|
||||
## v0.2.5 - _March 17, 2018_
|
||||
|
||||
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
|
||||
|
||||
## v0.2.4 - _March 4, 2018_
|
||||
## v0.2.4 - _March 3, 2018_
|
||||
|
||||
* Add a `backend` parameter that allows you to specify the Ethereum library you use in your templates (`web3` or `ethers`). Ethers auto-converts small ints to numbers whereas Web3 doesn't. Defaults to `web3` (#413)
|
||||
* Add support for [tuple types](https://solidity.readthedocs.io/en/develop/abi-spec.html#handling-tuple-types) (#413)
|
||||
* Add `hasReturnValue` to context data (#413)
|
||||
|
||||
## v0.2.1 - _February 9, 2018_
|
||||
## v0.2.1 - _February 8, 2018_
|
||||
|
||||
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
|
||||
|
||||
## v0.2.0 - _February 7, 2018_
|
||||
## v0.2.0 - _February 6, 2018_
|
||||
|
||||
* Added CLI options for explicit specifying location of partials and main template (#346)
|
||||
* Added CLI option to specify networkId, adding support for the JSON artifact format found in @0xproject/contracts (#388)
|
||||
|
||||
## v0.1.0 - _January 11, 2018_
|
||||
## v0.1.0 - _January 10, 2018_
|
||||
|
||||
* Fixed array typings with union types (#295)
|
||||
* Add event ABIs to context data passed to templates (#302)
|
||||
|
@@ -8,7 +8,8 @@
|
||||
"build:watch": "tsc -w",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts"
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"bin": {
|
||||
"abi-gen": "lib/index.js"
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.2.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.2.4",
|
||||
@@ -6,7 +15,8 @@
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
],
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.2.0",
|
||||
|
@@ -5,24 +5,28 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.2.5 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.2.4 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.2.0 - _March 8, 2018_
|
||||
## v0.2.0 - _March 7, 2018_
|
||||
|
||||
* Rename `isHttpUrl` to `isWebUri` (#412)
|
||||
|
||||
## v0.1.0 - _March 4, 2018_
|
||||
## v0.1.0 - _March 3, 2018_
|
||||
|
||||
* Remove isETHAddressHex checksum address check and assume address will be lowercased (#373)
|
||||
* Add an optional parameter `subSchemas` to `doesConformToSchema` method (#385)
|
||||
|
||||
## v0.0.18 - _February 9, 2017_
|
||||
## v0.0.18 - _February 8, 2017_
|
||||
|
||||
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
|
||||
|
||||
## v0.0.4 - _November 14, 2017_
|
||||
## v0.0.4 - _November 13, 2017_
|
||||
|
||||
* Re-publish Assert previously published under NPM package @0xproject/0x-assert
|
||||
* Added assertion isValidBaseUnitAmount which checks both that the value is a valid bigNumber and that it does not contain decimals.
|
||||
|
@@ -14,7 +14,8 @@
|
||||
"test": "run-s clean build run_mocha",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"test:circleci": "yarn test:coverage"
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
|
2
packages/assert/src/globals.d.ts
vendored
2
packages/assert/src/globals.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
declare module 'dirty-chai';
|
||||
|
||||
declare module '*.json' {
|
||||
const json: any;
|
||||
/* tslint:disable */
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add tests for traversing ABI tree",
|
||||
"pr": 485
|
||||
},
|
||||
{
|
||||
"note": "Fix ABI tuples traversing",
|
||||
"pr": 485
|
||||
},
|
||||
{
|
||||
"note": "Fix ABI arrays traversing",
|
||||
"pr": 485
|
||||
}
|
||||
],
|
||||
"timestamp": 1522673609
|
||||
},
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.0.6",
|
||||
@@ -6,7 +24,8 @@
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
],
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.0.2",
|
||||
|
@@ -5,10 +5,16 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.1.0 - _April 2, 2018_
|
||||
|
||||
* Add tests for traversing ABI tree (#485)
|
||||
* Fix ABI tuples traversing (#485)
|
||||
* Fix ABI arrays traversing (#485)
|
||||
|
||||
## v0.0.6 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.2 - _March 4, 2018_
|
||||
## v0.0.2 - _March 3, 2018_
|
||||
|
||||
* Initial release
|
||||
|
0
packages/base-contract/coverage/.gitkeep
Normal file
0
packages/base-contract/coverage/.gitkeep
Normal file
@@ -2,13 +2,19 @@
|
||||
"name": "@0xproject/base-contract",
|
||||
"version": "0.0.6",
|
||||
"description": "0x Base TS contract",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"main": "lib/src/index.js",
|
||||
"types": "lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"build:watch": "tsc -w",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"lint": "tslint --project . 'src/**/*.ts'"
|
||||
"test": "run-s clean build run_mocha",
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"run_mocha": "mocha lib/test/**/*_test.js --bail --exit",
|
||||
"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 .",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -26,10 +32,13 @@
|
||||
"copyfiles": "^1.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"chai": "^4.0.1",
|
||||
"mocha": "^4.0.1",
|
||||
"tslint": "5.8.0",
|
||||
"typescript": "2.7.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0xproject/utils": "^0.4.3",
|
||||
"@0xproject/types": "^0.4.2",
|
||||
"@0xproject/typescript-typings": "^0.0.2",
|
||||
"@0xproject/web3-wrapper": "^0.4.0",
|
||||
|
@@ -1,40 +1,31 @@
|
||||
import { ContractAbi, DataItem, TxData, TxDataPayable } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as ethersContracts from 'ethers-contracts';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { formatABIDataItem } from './utils';
|
||||
|
||||
export class BaseContract {
|
||||
protected _ethersInterface: ethersContracts.Interface;
|
||||
protected _web3Wrapper: Web3Wrapper;
|
||||
public abi: ContractAbi;
|
||||
public address: string;
|
||||
protected static _transformABIData(
|
||||
protected static _formatABIDataItemList(
|
||||
abis: DataItem[],
|
||||
values: any[],
|
||||
transformation: (type: string, value: any) => any,
|
||||
formatter: (type: string, value: any) => any,
|
||||
): any {
|
||||
return _.map(values, (value: any, i: number) =>
|
||||
BaseContract._transformTypedData(abis[i].type, value, transformation),
|
||||
);
|
||||
return _.map(values, (value: any, i: number) => formatABIDataItem(abis[i], value, formatter));
|
||||
}
|
||||
protected static _lowercaseAddress(type: string, value: string): string {
|
||||
return type === 'address' ? value.toLowerCase() : value;
|
||||
}
|
||||
protected static _bigNumberToString(type: string, value: string): string {
|
||||
return _.isObject(value) && (value as any).isBigNumber ? value.toString() : value;
|
||||
protected static _bigNumberToString(type: string, value: any): any {
|
||||
return _.isObject(value) && value.isBigNumber ? value.toString() : value;
|
||||
}
|
||||
private static _transformTypedData(
|
||||
type: string,
|
||||
values: any,
|
||||
transformation: (type: string, value: any) => any,
|
||||
): any {
|
||||
const trailingArrayRegex = /\[\d*\]$/;
|
||||
if (type.match(trailingArrayRegex)) {
|
||||
const arrayItemType = type.replace(trailingArrayRegex, '');
|
||||
return _.map(values, value => this._transformTypedData(arrayItemType, value, transformation));
|
||||
} else {
|
||||
return transformation(type, values);
|
||||
}
|
||||
protected static _bnToBigNumber(type: string, value: any): any {
|
||||
return _.isObject(value) && value._bn ? new BigNumber(value.toString()) : value;
|
||||
}
|
||||
protected async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>(
|
||||
txData: T,
|
||||
|
25
packages/base-contract/src/utils.ts
Normal file
25
packages/base-contract/src/utils.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { DataItem } from '@0xproject/types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
// tslint:disable-next-line:completed-docs
|
||||
export function formatABIDataItem(abi: DataItem, value: any, formatter: (type: string, value: any) => any): any {
|
||||
const trailingArrayRegex = /\[\d*\]$/;
|
||||
if (abi.type.match(trailingArrayRegex)) {
|
||||
const arrayItemType = abi.type.replace(trailingArrayRegex, '');
|
||||
return _.map(value, val => {
|
||||
const arrayItemAbi = {
|
||||
...abi,
|
||||
type: arrayItemType,
|
||||
};
|
||||
return formatABIDataItem(arrayItemAbi, val, formatter);
|
||||
});
|
||||
} else if (abi.type === 'tuple') {
|
||||
const formattedTuple: { [componentName: string]: DataItem } = {};
|
||||
_.forEach(abi.components, componentABI => {
|
||||
formattedTuple[componentABI.name] = formatABIDataItem(componentABI, value[componentABI.name], formatter);
|
||||
});
|
||||
return formattedTuple;
|
||||
} else {
|
||||
return formatter(abi.type, value);
|
||||
}
|
||||
}
|
108
packages/base-contract/test/utils_test.ts
Normal file
108
packages/base-contract/test/utils_test.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as chai from 'chai';
|
||||
import 'mocha';
|
||||
|
||||
import { formatABIDataItem } from '../src/utils';
|
||||
|
||||
const { expect } = chai;
|
||||
|
||||
describe('Utils tests', () => {
|
||||
describe('#formatABIDataItem', () => {
|
||||
it('correctly handles arrays', () => {
|
||||
const calls: Array<{ type: string; value: any }> = [];
|
||||
const abi = {
|
||||
name: 'values',
|
||||
type: 'uint256[]',
|
||||
};
|
||||
const val = [1, 2, 3];
|
||||
const formatted = formatABIDataItem(abi, val, (type: string, value: any) => {
|
||||
calls.push({ type, value });
|
||||
return value; // no-op
|
||||
});
|
||||
expect(formatted).to.be.deep.equal(val);
|
||||
expect(calls).to.be.deep.equal([
|
||||
{ type: 'uint256', value: 1 },
|
||||
{ type: 'uint256', value: 2 },
|
||||
{ type: 'uint256', value: 3 },
|
||||
]);
|
||||
});
|
||||
it('correctly handles tuples', () => {
|
||||
const calls: Array<{ type: string; value: any }> = [];
|
||||
const abi = {
|
||||
components: [
|
||||
{
|
||||
name: 'to',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'amount',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
name: 'data',
|
||||
type: 'tuple',
|
||||
};
|
||||
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||
const val = { to: ZERO_ADDRESS, amount: new BigNumber(1) };
|
||||
const formatted = formatABIDataItem(abi, val, (type: string, value: any) => {
|
||||
calls.push({ type, value });
|
||||
return value; // no-op
|
||||
});
|
||||
expect(formatted).to.be.deep.equal(val);
|
||||
expect(calls).to.be.deep.equal([
|
||||
{
|
||||
type: 'address',
|
||||
value: val.to,
|
||||
},
|
||||
{
|
||||
type: 'uint256',
|
||||
value: val.amount,
|
||||
},
|
||||
]);
|
||||
});
|
||||
it('correctly handles nested arrays of tuples', () => {
|
||||
const calls: Array<{ type: string; value: any }> = [];
|
||||
const abi = {
|
||||
components: [
|
||||
{
|
||||
name: 'to',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'amount',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
name: 'data',
|
||||
type: 'tuple[2][]',
|
||||
};
|
||||
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||
const val = [
|
||||
[{ to: ZERO_ADDRESS, amount: new BigNumber(1) }, { to: ZERO_ADDRESS, amount: new BigNumber(2) }],
|
||||
];
|
||||
const formatted = formatABIDataItem(abi, val, (type: string, value: any) => {
|
||||
calls.push({ type, value });
|
||||
return value; // no-op
|
||||
});
|
||||
expect(formatted).to.be.deep.equal(val);
|
||||
expect(calls).to.be.deep.equal([
|
||||
{
|
||||
type: 'address',
|
||||
value: val[0][0].to,
|
||||
},
|
||||
{
|
||||
type: 'uint256',
|
||||
value: val[0][0].amount,
|
||||
},
|
||||
{
|
||||
type: 'address',
|
||||
value: val[0][1].to,
|
||||
},
|
||||
{
|
||||
type: 'uint256',
|
||||
value: val[0][1].amount,
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
@@ -3,5 +3,5 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src/**/*"]
|
||||
"include": ["src/**/*", "test/**/*"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.6.8",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.6.7",
|
||||
@@ -6,7 +15,8 @@
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
],
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.6.4",
|
||||
|
@@ -5,48 +5,52 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.6.8 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.6.7 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.6.4 - _March 18, 2018_
|
||||
## v0.6.4 - _March 17, 2018_
|
||||
|
||||
* Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456)
|
||||
|
||||
## v0.6.2 - _February 16, 2018_
|
||||
## v0.6.2 - _February 15, 2018_
|
||||
|
||||
* Fix JSON parse empty response (#407)
|
||||
|
||||
## v0.6.0 - _February 16, 2018_
|
||||
## v0.6.0 - _February 15, 2018_
|
||||
|
||||
* Add pagination options to HttpClient methods (#393)
|
||||
* Add heartbeat configuration to WebSocketOrderbookChannel constructor (#406)
|
||||
|
||||
## v0.5.7 - _February 9, 2018_
|
||||
## v0.5.7 - _February 8, 2018_
|
||||
|
||||
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
|
||||
|
||||
## v0.5.0 - _January 17, 2018_
|
||||
## v0.5.0 - _January 16, 2018_
|
||||
|
||||
* Sanitize api endpoint url and remove trailing slashes (#318)
|
||||
* Improve error message text in HttpClient (#318)
|
||||
* Stop appending '/v0' to api endpoint url in HttpClient (#318)
|
||||
|
||||
## v0.4.0 - _January 11, 2018_
|
||||
## v0.4.0 - _January 10, 2018_
|
||||
|
||||
* Prevent getFeesAsync method on HttpClient from mutating input (#296)
|
||||
|
||||
## v0.3.0 - _December 8, 2017_
|
||||
## v0.3.0 - _December 7, 2017_
|
||||
|
||||
* Expose WebSocketOrderbookChannel and associated types to public interface (#251)
|
||||
* Remove tokenA and tokenB fields from OrdersRequest (#256)
|
||||
|
||||
## v0.2.0 - _November 29, 2017_
|
||||
## v0.2.0 - _November 28, 2017_
|
||||
|
||||
* Add SignedOrder and TokenTradeInfo to the public interface
|
||||
* Add ECSignature and Order to the public interface
|
||||
* Remove dependency on 0x.js
|
||||
|
||||
## v0.1.0 - _November 22, 2017_
|
||||
## v0.1.0 - _November 21, 2017_
|
||||
|
||||
* Provide a HttpClient class for interacting with standard relayer api compliant HTTP urls
|
||||
|
@@ -22,6 +22,7 @@
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
|
||||
|
1
packages/connect/src/globals.d.ts
vendored
1
packages/connect/src/globals.d.ts
vendored
@@ -1,5 +1,4 @@
|
||||
declare module 'async-child-process';
|
||||
declare module 'dirty-chai';
|
||||
|
||||
declare module '*.json' {
|
||||
const value: any;
|
||||
|
@@ -10,7 +10,6 @@ import { BigNumber, classUtils, promisify } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as ethersContracts from 'ethers-contracts';
|
||||
import * as _ from 'lodash';
|
||||
import * as Web3 from 'web3';
|
||||
|
||||
{{#if events}}
|
||||
export type {{contractName}}ContractEventArgs =
|
||||
|
@@ -4,9 +4,9 @@ async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{{> return_type outputs=outputs}}> {
|
||||
const self = this as {{contractName}}Contract;
|
||||
const self = this as any as {{contractName}}Contract;
|
||||
const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
|
||||
[{{> params inputs=inputs}}] = BaseContract._transformABIData(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||
const encodedData = self._ethersInterface.functions.{{this.name}}(
|
||||
{{> params inputs=inputs}}
|
||||
).data;
|
||||
@@ -19,7 +19,8 @@ async callAsync(
|
||||
const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs;
|
||||
const outputParamsTypes = _.map(outputAbi, 'type');
|
||||
let resultArray = ethersContracts.Interface.decodeParams(outputParamsTypes, rawCallResult) as any;
|
||||
resultArray = BaseContract._transformABIData(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray{{#singleReturnValue}}[0]{{/singleReturnValue}};
|
||||
},
|
||||
{{/hasReturnValue}}
|
||||
|
@@ -8,9 +8,9 @@ public {{this.name}} = {
|
||||
txData: Partial<TxData> = {},
|
||||
{{/this.payable}}
|
||||
): Promise<string> {
|
||||
const self = this as {{contractName}}Contract;
|
||||
const self = this as any as {{contractName}}Contract;
|
||||
const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
|
||||
[{{> params inputs=inputs}}] = BaseContract._transformABIData(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||
const encodedData = self._ethersInterface.functions.{{this.name}}(
|
||||
{{> params inputs=inputs}}
|
||||
).data
|
||||
@@ -31,9 +31,9 @@ public {{this.name}} = {
|
||||
{{> typed_params inputs=inputs}}
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as {{contractName}}Contract;
|
||||
const self = this as any as {{contractName}}Contract;
|
||||
const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
|
||||
[{{> params inputs=inputs}}] = BaseContract._transformABIData(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(this));
|
||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(this));
|
||||
const encodedData = self._ethersInterface.functions.{{this.name}}(
|
||||
{{> params inputs=inputs}}
|
||||
).data
|
||||
@@ -49,9 +49,9 @@ public {{this.name}} = {
|
||||
getABIEncodedTransactionData(
|
||||
{{> typed_params inputs=inputs}}
|
||||
): string {
|
||||
const self = this as {{contractName}}Contract;
|
||||
const self = this as any as {{contractName}}Contract;
|
||||
const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
|
||||
[{{> params inputs=inputs}}] = BaseContract._transformABIData(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||
const abiEncodedTransactionData = self._ethersInterface.functions.{{this.name}}(
|
||||
{{> params inputs=inputs}}
|
||||
).data
|
||||
|
29
packages/contracts/globals.d.ts
vendored
29
packages/contracts/globals.d.ts
vendored
@@ -1,35 +1,6 @@
|
||||
declare module 'chai-bignumber';
|
||||
declare module 'dirty-chai';
|
||||
|
||||
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
|
||||
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise
|
||||
// disallow `namespace`, we disable tslint for the following.
|
||||
/* tslint:disable */
|
||||
declare namespace Chai {
|
||||
interface Assertion {
|
||||
bignumber: Assertion;
|
||||
}
|
||||
}
|
||||
/* tslint:enable */
|
||||
|
||||
declare module '*.json' {
|
||||
const json: any;
|
||||
/* tslint:disable */
|
||||
export default json;
|
||||
/* tslint:enable */
|
||||
}
|
||||
|
||||
declare module 'solc' {
|
||||
export function compile(sources: any, optimizerEnabled: number, findImports: (importPath: string) => any): any;
|
||||
export function setupMethods(solcBin: any): any;
|
||||
}
|
||||
|
||||
declare module 'web3-eth-abi' {
|
||||
export function encodeParameters(typesArray: string[], parameters: any[]): string;
|
||||
}
|
||||
|
||||
declare module 'ethereumjs-abi' {
|
||||
const soliditySHA3: (argTypes: string[], args: any[]) => Buffer;
|
||||
const soliditySHA256: (argTypes: string[], args: any[]) => Buffer;
|
||||
const methodID: (name: string, types: string[]) => Buffer;
|
||||
}
|
||||
|
19
packages/contracts/globalsAugment.d.ts
vendored
19
packages/contracts/globalsAugment.d.ts
vendored
@@ -1,19 +0,0 @@
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
|
||||
// HACK: This module overrides the Chai namespace so that we can use BigNumber types inside.
|
||||
// Source: https://github.com/Microsoft/TypeScript/issues/7352#issuecomment-191547232
|
||||
declare global {
|
||||
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
|
||||
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise
|
||||
// disallow `namespace`, we disable tslint for the following.
|
||||
/* tslint:disable */
|
||||
namespace Chai {
|
||||
interface NumberComparer {
|
||||
(value: number | BigNumber, message?: string): Assertion;
|
||||
}
|
||||
interface NumericComparison {
|
||||
greaterThan: NumberComparer;
|
||||
}
|
||||
}
|
||||
/* tslint:enable */
|
||||
}
|
@@ -59,8 +59,6 @@
|
||||
"shx": "^0.2.2",
|
||||
"solc": "^0.4.18",
|
||||
"tslint": "5.8.0",
|
||||
"types-bn": "^0.0.1",
|
||||
"types-ethereumjs-util": "0xProject/types-ethereumjs-util",
|
||||
"typescript": "2.7.1",
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
|
@@ -4,17 +4,8 @@
|
||||
"outDir": "lib",
|
||||
"baseUrl": ".",
|
||||
"declaration": false,
|
||||
"noImplicitThis": false,
|
||||
"allowJs": true
|
||||
},
|
||||
"include": [
|
||||
"../../node_modules/types-ethereumjs-util/index.d.ts",
|
||||
"../../node_modules/types-bn/index.d.ts",
|
||||
"./globals.d.ts",
|
||||
"./src/**/*",
|
||||
"./util/**/*",
|
||||
"./test/**/*",
|
||||
"./migrations/**/*"
|
||||
],
|
||||
"include": ["./globals.d.ts", "./src/**/*", "./util/**/*", "./test/**/*", "./migrations/**/*"],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
}
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "0.3.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Don't try to write contract artifact if an error occured",
|
||||
"pr": 485
|
||||
}
|
||||
],
|
||||
"timestamp": 1522673609
|
||||
},
|
||||
{
|
||||
"version": "0.3.4",
|
||||
"changes": [
|
||||
@@ -7,7 +17,8 @@
|
||||
"pr": 491
|
||||
}
|
||||
],
|
||||
"timestamp": 1522658513
|
||||
"timestamp": 1522658513,
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.3.1",
|
||||
|
@@ -5,15 +5,19 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.3.5 - _April 2, 2018_
|
||||
|
||||
* Don't try to write contract artifact if an error occured (#485)
|
||||
|
||||
## v0.3.4 - _April 2, 2018_
|
||||
|
||||
* Create solc_bin directory if does not exist before attempting to compile (#491)
|
||||
|
||||
## v0.3.1 - _March 18, 2018_
|
||||
## v0.3.1 - _March 17, 2018_
|
||||
|
||||
* Add TS types for `yargs`
|
||||
|
||||
## v0.3.0 - _March 18, 2018_
|
||||
## v0.3.0 - _March 17, 2018_
|
||||
|
||||
* Add support for Solidity 0.4.20 and 0.4.21
|
||||
* Replace `jsonrpcPort` config with `jsonrpcUrl` (#426)
|
||||
@@ -26,15 +30,15 @@ CHANGELOG
|
||||
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
|
||||
* Add `#!/usr/bin/env node` pragma above `cli.ts` script to fix command-line error.
|
||||
|
||||
## v0.2.0 - _March 4, 2018_
|
||||
## v0.2.0 - _March 3, 2018_
|
||||
|
||||
* Check dependencies when determining if contracts should be recompiled (#408)
|
||||
* Improve an error message for when deployer is supplied with an incorrect number of constructor arguments (#419)
|
||||
|
||||
## v0.1.0 - _February 16, 2018_
|
||||
## v0.1.0 - _February 15, 2018_
|
||||
|
||||
* Add the ability to pass in specific contracts to compile in CLI (#400)
|
||||
|
||||
## v0.0.8 - _February 9, 2018_
|
||||
## v0.0.8 - _February 8, 2018_
|
||||
|
||||
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
|
||||
|
@@ -17,6 +17,7 @@
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
|
||||
},
|
||||
|
0
packages/deployer/solc_bin/.gitkeep
Normal file
0
packages/deployer/solc_bin/.gitkeep
Normal file
@@ -45,7 +45,6 @@ export class Compiler {
|
||||
private _artifactsDir: string;
|
||||
// This get's set in the beggining of `compileAsync` function. It's not called from a constructor, but it's the only public method of that class and could as well be.
|
||||
private _contractSources!: ContractSources;
|
||||
private _solcErrors: Set<string> = new Set();
|
||||
private _specifiedContracts: Set<string> = new Set();
|
||||
private _contractSourceData: ContractSourceData = {};
|
||||
/**
|
||||
@@ -114,9 +113,6 @@ export class Compiler {
|
||||
for (const fileName of fileNames) {
|
||||
await this._compileContractAsync(fileName);
|
||||
}
|
||||
this._solcErrors.forEach(errMsg => {
|
||||
logUtils.log(errMsg);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Compiles contract and saves artifact to artifactsDir.
|
||||
@@ -179,10 +175,23 @@ export class Compiler {
|
||||
);
|
||||
|
||||
if (!_.isUndefined(compiled.errors)) {
|
||||
_.forEach(compiled.errors, errMsg => {
|
||||
const normalizedErrMsg = getNormalizedErrMsg(errMsg);
|
||||
this._solcErrors.add(normalizedErrMsg);
|
||||
});
|
||||
const SOLIDITY_WARNING_PREFIX = 'Warning';
|
||||
const isError = (errorOrWarning: string) => !errorOrWarning.includes(SOLIDITY_WARNING_PREFIX);
|
||||
const isWarning = (errorOrWarning: string) => errorOrWarning.includes(SOLIDITY_WARNING_PREFIX);
|
||||
const errors = _.filter(compiled.errors, isError);
|
||||
const warnings = _.filter(compiled.errors, isWarning);
|
||||
if (!_.isEmpty(errors)) {
|
||||
errors.forEach(errMsg => {
|
||||
const normalizedErrMsg = getNormalizedErrMsg(errMsg);
|
||||
logUtils.log(normalizedErrMsg);
|
||||
});
|
||||
process.exit(1);
|
||||
} else {
|
||||
warnings.forEach(errMsg => {
|
||||
const normalizedErrMsg = getNormalizedErrMsg(errMsg);
|
||||
logUtils.log(normalizedErrMsg);
|
||||
});
|
||||
}
|
||||
}
|
||||
const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
|
||||
const contractIdentifier = `${fileName}:${contractName}`;
|
||||
|
46
packages/deployer/src/globals.d.ts
vendored
46
packages/deployer/src/globals.d.ts
vendored
@@ -1,49 +1,3 @@
|
||||
declare module 'dirty-chai';
|
||||
|
||||
// tslint:disable:completed-docs
|
||||
declare module 'solc' {
|
||||
export interface ContractCompilationResult {
|
||||
srcmap: string;
|
||||
srcmapRuntime: string;
|
||||
bytecode: string;
|
||||
runtimeBytecode: string;
|
||||
interface: string;
|
||||
}
|
||||
export interface CompilationResult {
|
||||
errors: string[];
|
||||
contracts: {
|
||||
[contractIdentifier: string]: ContractCompilationResult;
|
||||
};
|
||||
sources: {
|
||||
[sourceName: string]: {
|
||||
AST: any;
|
||||
};
|
||||
};
|
||||
sourceList: string[];
|
||||
}
|
||||
export interface ImportContents {
|
||||
contents: string;
|
||||
}
|
||||
export interface InputSources {
|
||||
sources: {
|
||||
[fileName: string]: string;
|
||||
};
|
||||
}
|
||||
export interface SolcInstance {
|
||||
compile(
|
||||
sources: InputSources,
|
||||
optimizerEnabled: number,
|
||||
findImports: (importPath: string) => ImportContents,
|
||||
): CompilationResult;
|
||||
}
|
||||
export function loadRemoteVersion(versionName: string, cb: (err: Error | null, res?: SolcInstance) => void): void;
|
||||
export function setupMethods(solcBin: any): SolcInstance;
|
||||
}
|
||||
|
||||
declare module 'web3-eth-abi' {
|
||||
export function encodeParameters(typesArray: string[], parameters: any[]): string;
|
||||
}
|
||||
|
||||
declare module '*.json' {
|
||||
const json: any;
|
||||
/* tslint:disable */
|
||||
|
@@ -5,7 +5,7 @@ export const constants = {
|
||||
jsonrpcUrl: 'http://localhost:8545',
|
||||
optimizerEnabled: false,
|
||||
gasPrice: new BigNumber(20000000000),
|
||||
timeoutMs: 20000,
|
||||
timeoutMs: 30000,
|
||||
zrxTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
|
||||
tokenTransferProxyAddress: '0x8da0d80f5007ef1e431dd2127178d224e32c2ef4',
|
||||
specifiedContracts: '*',
|
||||
|
@@ -4,10 +4,5 @@
|
||||
"outDir": "lib",
|
||||
"strictFunctionTypes": false
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*",
|
||||
"./test/**/*",
|
||||
"../../node_modules/types-bn/index.d.ts",
|
||||
"../../node_modules/types-ethereumjs-util/index.d.ts"
|
||||
]
|
||||
"include": ["./src/**/*", "./test/**/*"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.3.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.3.3",
|
||||
@@ -6,7 +15,8 @@
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
],
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.3.1",
|
||||
|
@@ -5,29 +5,33 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.3.4 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.3 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.1 - _March 18, 2018_
|
||||
## v0.3.1 - _March 17, 2018_
|
||||
|
||||
* Reduce npm package size by adding an `.npmignore` file.
|
||||
* Move `@0xproject/web3_wrapper` to dependencies from devDependencies.
|
||||
|
||||
## v0.3.0 - _March 18, 2018_
|
||||
## v0.3.0 - _March 17, 2018_
|
||||
|
||||
* Add coverage subprovider if SOLIDITY_COVERAGE env variable is true (#426)
|
||||
* Refactor `BlockchainLifecycle` to work with in-process ganache (#426)
|
||||
* Remove `RPC` class and move it's logic to `Web3Wrapper` (#426)
|
||||
|
||||
## v0.2.0 - _February 16, 2018_
|
||||
## v0.2.0 - _February 15, 2018_
|
||||
|
||||
* Remove subproviders (#392)
|
||||
|
||||
## v0.0.12 - _February 9, 2018_
|
||||
## v0.0.12 - _February 8, 2018_
|
||||
|
||||
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
|
||||
|
||||
## v0.0.11 - _February 7, 2018_
|
||||
## v0.0.11 - _February 6, 2018_
|
||||
|
||||
* Updated `types-ethereumjs-util` dev dependency (#352)
|
||||
|
@@ -13,7 +13,8 @@
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'"
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -36,8 +37,6 @@
|
||||
"nyc": "^11.0.1",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.8.0",
|
||||
"types-bn": "^0.0.1",
|
||||
"types-ethereumjs-util": "0xProject/types-ethereumjs-util",
|
||||
"typescript": "2.7.1"
|
||||
},
|
||||
"dependencies": {
|
||||
|
1
packages/dev-utils/src/globals.d.ts
vendored
1
packages/dev-utils/src/globals.d.ts
vendored
@@ -1,4 +1,3 @@
|
||||
declare module 'web3-provider-engine';
|
||||
declare module 'web3-provider-engine/subproviders/rpc';
|
||||
|
||||
declare module '*.json' {
|
||||
|
@@ -3,10 +3,5 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*",
|
||||
"./test/**/*",
|
||||
"../../node_modules/types-bn/index.d.ts",
|
||||
"../../node_modules/types-ethereumjs-util/index.d.ts"
|
||||
]
|
||||
"include": ["./src/**/*", "./test/**/*"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.7.19",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.7.18",
|
||||
@@ -6,7 +15,8 @@
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
],
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.7.13",
|
||||
|
@@ -5,18 +5,22 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.7.19 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.7.18 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.7.13 - _February 9, 2018_
|
||||
## v0.7.13 - _February 8, 2018_
|
||||
|
||||
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
|
||||
|
||||
## v0.7.0 - _December 20, 2017_
|
||||
## v0.7.0 - _December 19, 2017_
|
||||
|
||||
* Rename `subscriptionOptsSchema` to `blockRangeSchema` (#272)
|
||||
|
||||
## v0.6.7 - _November 14, 2017_
|
||||
## v0.6.7 - _November 13, 2017_
|
||||
|
||||
* Re-publish JSON-schema previously published under NPM package 0x-json-schemas
|
||||
|
@@ -14,6 +14,7 @@
|
||||
"run_mocha": "mocha lib/test/**/*_test.js",
|
||||
"clean": "shx rm -rf lib test_temp scripts",
|
||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
|
||||
|
2
packages/json-schemas/src/globals.d.ts
vendored
2
packages/json-schemas/src/globals.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
declare module 'dirty-chai';
|
||||
|
||||
declare module '*.json' {
|
||||
const json: any;
|
||||
/* tslint:disable */
|
||||
|
98
packages/metacoin/artifacts/Metacoin.json
Normal file
98
packages/metacoin/artifacts/Metacoin.json
Normal file
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"contract_name": "Metacoin",
|
||||
"networks": {
|
||||
"50": {
|
||||
"solc_version": "0.4.21",
|
||||
"keccak256": "0x2c3aa2e9dbef58abf57cecc148464d0852a83d7f30bbd2066f2a13b8bd3b1dd0",
|
||||
"source_tree_hash": "0x2c3aa2e9dbef58abf57cecc148464d0852a83d7f30bbd2066f2a13b8bd3b1dd0",
|
||||
"optimizer_enabled": false,
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balances",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferData",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
}
|
||||
],
|
||||
"bytecode":
|
||||
"0x6060604052341561000f57600080fd5b6127106000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610406806100636000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806327e235e3146100515780632bd14bb914610087575b600080fd5b341561005c57600080fd5b610071600461006c9036906102b9565b6100bd565b60405161007e9190610344565b60405180910390f35b341561009257600080fd5b6100a760046100a29036906102e2565b6100d5565b6040516100b49190610329565b60405180910390f35b60006020528060005260406000206000915090505481565b600081602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561012a5760009050610240565b81602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160200151600080846000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84602001516040516102339190610344565b60405180910390a3600190505b919050565b600061025182356103a2565b905092915050565b60006040828403121561026b57600080fd5b610275604061035f565b9050600061028584828501610245565b6000830152506020610299848285016102a5565b60208301525092915050565b60006102b182356103c2565b905092915050565b6000602082840312156102cb57600080fd5b60006102d984828501610245565b91505092915050565b6000604082840312156102f457600080fd5b600061030284828501610259565b91505092915050565b6103148161038c565b82525050565b61032381610398565b82525050565b600060208201905061033e600083018461030b565b92915050565b6000602082019050610359600083018461031a565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561038257600080fd5b8060405250919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008190509190505600a265627a7a72305820d15828219194e8ddaa624e10f9c8823c05268d79753b4c60ef401fb4fe5f09dc6c6578706572696d656e74616cf50037",
|
||||
"runtime_bytecode":
|
||||
"0x60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806327e235e3146100515780632bd14bb914610087575b600080fd5b341561005c57600080fd5b610071600461006c9036906102b9565b6100bd565b60405161007e9190610344565b60405180910390f35b341561009257600080fd5b6100a760046100a29036906102e2565b6100d5565b6040516100b49190610329565b60405180910390f35b60006020528060005260406000206000915090505481565b600081602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561012a5760009050610240565b81602001516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160200151600080846000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84602001516040516102339190610344565b60405180910390a3600190505b919050565b600061025182356103a2565b905092915050565b60006040828403121561026b57600080fd5b610275604061035f565b9050600061028584828501610245565b6000830152506020610299848285016102a5565b60208301525092915050565b60006102b182356103c2565b905092915050565b6000602082840312156102cb57600080fd5b60006102d984828501610245565b91505092915050565b6000604082840312156102f457600080fd5b600061030284828501610259565b91505092915050565b6103148161038c565b82525050565b61032381610398565b82525050565b600060208201905061033e600083018461030b565b92915050565b6000602082019050610359600083018461031a565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561038257600080fd5b8060405250919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008190509190505600a265627a7a72305820d15828219194e8ddaa624e10f9c8823c05268d79753b4c60ef401fb4fe5f09dc6c6578706572696d656e74616cf50037",
|
||||
"updated_at": 1522318279735,
|
||||
"source_map": "60:662:0:-;;;290:72;;;;;;;;350:5;327:8;:20;336:10;327:20;;;;;;;;;;;;;;;:28;;;;60:662;;;;;;",
|
||||
"source_map_runtime":
|
||||
"60:662:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;84:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;368:352;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;84:41;;;;;;;;;;;;;;;;;:::o;368:352::-;429:12;480;:19;;;457:8;:20;466:10;457:20;;;;;;;;;;;;;;;;:42;453:60;;;508:5;501:12;;;;453:60;547:12;:19;;;523:8;:20;532:10;523:20;;;;;;;;;;;;;;;;:43;;;;;;;;;;;605:12;:19;;;576:8;:25;585:12;:15;;;576:25;;;;;;;;;;;;;;;;:48;;;;;;;;;;;655:12;:15;;;634:58;;643:10;634:58;;;672:12;:19;;;634:58;;;;;;;;;;;;;;;709:4;702:11;;368:352;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;;63:55;;57:66;;;;;165:469;;282:4;270:9;265:3;261:19;257:30;254:2;;;300:1;297;290:12;254:2;318:20;333:4;318:20;;;309:29;;386:1;417:49;462:3;453:6;442:9;438:22;417:49;;;411:3;404:5;400:15;393:74;348:130;530:2;563:49;608:3;599:6;588:9;584:22;563:49;;;556:4;549:5;545:16;538:75;488:136;248:386;;;;;641:118;;708:46;746:6;733:20;708:46;;;699:55;;693:66;;;;;766:241;;870:2;858:9;849:7;845:23;841:32;838:2;;;886:1;883;876:12;838:2;921:1;938:53;983:7;974:6;963:9;959:22;938:53;;;928:63;;900:97;832:175;;;;;1014:297;;1146:2;1134:9;1125:7;1121:23;1117:32;1114:2;;;1162:1;1159;1152:12;1114:2;1197:1;1214:81;1287:7;1278:6;1267:9;1263:22;1214:81;;;1204:91;;1176:125;1108:203;;;;;1318:101;1385:28;1407:5;1385:28;;;1380:3;1373:41;1367:52;;;1426:110;1499:31;1524:5;1499:31;;;1494:3;1487:44;1481:55;;;1543:181;;1645:2;1634:9;1630:18;1622:26;;1659:55;1711:1;1700:9;1696:17;1687:6;1659:55;;;1616:108;;;;;1731:193;;1839:2;1828:9;1824:18;1816:26;;1853:61;1911:1;1900:9;1896:17;1887:6;1853:61;;;1810:114;;;;;1931:256;;1993:2;1987:9;1977:19;;2031:4;2023:6;2019:17;2130:6;2118:10;2115:22;2094:18;2082:10;2079:34;2076:62;2073:2;;;2151:1;2148;2141:12;2073:2;2171:10;2167:2;2160:22;1971:216;;;;;2194:92;;2274:5;2267:13;2260:21;2249:32;;2243:43;;;;2293:79;;2362:5;2351:16;;2345:27;;;;2379:128;;2459:42;2452:5;2448:54;2437:65;;2431:76;;;;2514:79;;2583:5;2572:16;;2566:27;;;",
|
||||
"sources": ["Metacoin.sol"]
|
||||
}
|
||||
}
|
||||
}
|
25
packages/metacoin/contracts/Metacoin.sol
Normal file
25
packages/metacoin/contracts/Metacoin.sol
Normal file
@@ -0,0 +1,25 @@
|
||||
pragma solidity ^0.4.21;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract Metacoin {
|
||||
mapping (address => uint) public balances;
|
||||
|
||||
event Transfer(address indexed _from, address indexed _to, uint256 _value);
|
||||
|
||||
struct TransferData {
|
||||
address to;
|
||||
uint256 amount;
|
||||
}
|
||||
|
||||
function Metacoin() public {
|
||||
balances[msg.sender] = 10000;
|
||||
}
|
||||
|
||||
function transfer(TransferData transferData) public returns (bool success) {
|
||||
if (balances[msg.sender] < transferData.amount) return false;
|
||||
balances[msg.sender] -= transferData.amount;
|
||||
balances[transferData.to] += transferData.amount;
|
||||
Transfer(msg.sender, transferData.to, transferData.amount);
|
||||
return true;
|
||||
}
|
||||
}
|
0
packages/metacoin/coverage/.gitkeep
Normal file
0
packages/metacoin/coverage/.gitkeep
Normal file
50
packages/metacoin/package.json
Normal file
50
packages/metacoin/package.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "@0xproject/metacoin",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"description": "Example solidity project using 0x dev tools",
|
||||
"scripts": {
|
||||
"build:watch": "tsc -w",
|
||||
"lint": "tslint --project .",
|
||||
"clean": "shx rm -rf lib",
|
||||
"prebuild": "run-s clean generate_contract_wrappers copy_artifacts",
|
||||
"copy_artifacts": "copyfiles './artifacts/**/*' './contracts/**/*' ./lib",
|
||||
"build": "tsc",
|
||||
"test": "run-s build run_mocha",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"run_mocha": "mocha 'lib/test/**/*.js'",
|
||||
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'artifacts/Metacoin.json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers --backend ethers && prettier --write 'src/contract_wrappers/**.ts'",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"compile": "node ../deployer/lib/src/cli.js compile --contracts Metacoin --contracts-dir contracts --artifacts-dir artifacts"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@0xproject/abi-gen": "^0.2.7",
|
||||
"@0xproject/base-contract": "^0.0.6",
|
||||
"@0xproject/deployer": "^0.3.3",
|
||||
"@0xproject/types": "^0.4.1",
|
||||
"@0xproject/tslint-config": "^0.4.12",
|
||||
"@0xproject/sol-cov": "^0.0.5",
|
||||
"@0xproject/subproviders": "^0.8.2",
|
||||
"@0xproject/web3-wrapper": "^0.4.0",
|
||||
"@0xproject/utils": "^0.4.3",
|
||||
"ethers-contracts": "^2.2.1",
|
||||
"lodash": "^4.17.4",
|
||||
"web3-provider-engine": "^13.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/dev-utils": "^0.3.2",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.8.0",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^2.0.1",
|
||||
"typescript": "2.7.1"
|
||||
}
|
||||
}
|
10
packages/metacoin/test/global_hooks.ts
Normal file
10
packages/metacoin/test/global_hooks.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { env, EnvVars } from '@0xproject/dev-utils';
|
||||
|
||||
import { coverage } from './utils/coverage';
|
||||
|
||||
after('generate coverage report', async () => {
|
||||
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
await coverageSubprovider.writeCoverageAsync();
|
||||
}
|
||||
});
|
62
packages/metacoin/test/metacoin_test.ts
Normal file
62
packages/metacoin/test/metacoin_test.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
|
||||
import { LogWithDecodedArgs } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as chai from 'chai';
|
||||
|
||||
import { MetacoinContract, TransferContractEventArgs } from '../src/contract_wrappers/metacoin';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
import { deployer } from './utils/deployer';
|
||||
import { web3Wrapper } from './utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const { expect } = chai;
|
||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||
|
||||
describe('Metacoin', () => {
|
||||
let metacoin: MetacoinContract;
|
||||
const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
||||
const INITIAL_BALANCE = new BigNumber(10000);
|
||||
before(async () => {
|
||||
const metacoinInstance = await deployer.deployAsync('Metacoin');
|
||||
web3Wrapper.abiDecoder.addABI(metacoinInstance.abi);
|
||||
metacoin = new MetacoinContract(web3Wrapper, metacoinInstance.abi, metacoinInstance.address);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
});
|
||||
afterEach(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
describe('#constructor', () => {
|
||||
it(`should initialy give ${INITIAL_BALANCE} tokens to the creator`, async () => {
|
||||
const balance = await metacoin.balances.callAsync(ownerAddress);
|
||||
expect(balance).to.be.bignumber.equal(INITIAL_BALANCE);
|
||||
});
|
||||
});
|
||||
describe('#transfer', () => {
|
||||
it(`should successfully transfer tokens`, async () => {
|
||||
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
||||
const amount = INITIAL_BALANCE.div(2);
|
||||
const oldBalance = await metacoin.balances.callAsync(ZERO_ADDRESS);
|
||||
expect(oldBalance).to.be.bignumber.equal(0);
|
||||
const txHash = await metacoin.transfer.sendTransactionAsync(
|
||||
{
|
||||
to: ZERO_ADDRESS,
|
||||
amount,
|
||||
},
|
||||
{ from: devConstants.TESTRPC_FIRST_ADDRESS },
|
||||
);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(txHash);
|
||||
const transferLogs = txReceipt.logs[0] as LogWithDecodedArgs<TransferContractEventArgs>;
|
||||
expect(transferLogs.args).to.be.deep.equal({
|
||||
_to: ZERO_ADDRESS,
|
||||
_from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
_value: amount,
|
||||
});
|
||||
const newBalance = await metacoin.balances.callAsync(ZERO_ADDRESS);
|
||||
expect(newBalance).to.be.bignumber.equal(amount);
|
||||
});
|
||||
});
|
||||
});
|
13
packages/metacoin/test/utils/chai_setup.ts
Normal file
13
packages/metacoin/test/utils/chai_setup.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import * as chai from 'chai';
|
||||
import chaiAsPromised = require('chai-as-promised');
|
||||
import ChaiBigNumber = require('chai-bignumber');
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
|
||||
export const chaiSetup = {
|
||||
configure() {
|
||||
chai.config.includeStack = true;
|
||||
chai.use(ChaiBigNumber());
|
||||
chai.use(dirtyChai);
|
||||
chai.use(chaiAsPromised);
|
||||
},
|
||||
};
|
9
packages/metacoin/test/utils/config.ts
Normal file
9
packages/metacoin/test/utils/config.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import * as path from 'path';
|
||||
|
||||
export const config = {
|
||||
networkId: 50,
|
||||
artifactsDir: path.resolve(__dirname, '../../artifacts'),
|
||||
contractsDir: path.resolve(__dirname, '../../contracts'),
|
||||
ganacheLogFile: 'ganache.log',
|
||||
mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
|
||||
};
|
20
packages/metacoin/test/utils/coverage.ts
Normal file
20
packages/metacoin/test/utils/coverage.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { devConstants } from '@0xproject/dev-utils';
|
||||
import { CoverageSubprovider } from '@0xproject/sol-cov';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { config } from './config';
|
||||
|
||||
let coverageSubprovider: CoverageSubprovider;
|
||||
|
||||
export const coverage = {
|
||||
getCoverageSubproviderSingleton(): CoverageSubprovider {
|
||||
if (_.isUndefined(coverageSubprovider)) {
|
||||
coverageSubprovider = coverage._getCoverageSubprovider();
|
||||
}
|
||||
return coverageSubprovider;
|
||||
},
|
||||
_getCoverageSubprovider(): CoverageSubprovider {
|
||||
const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
||||
return new CoverageSubprovider(config.artifactsDir, config.contractsDir, config.networkId, defaultFromAddress);
|
||||
},
|
||||
};
|
17
packages/metacoin/test/utils/deployer.ts
Normal file
17
packages/metacoin/test/utils/deployer.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Deployer } from '@0xproject/deployer';
|
||||
import { devConstants } from '@0xproject/dev-utils';
|
||||
import * as path from 'path';
|
||||
|
||||
import { config } from './config';
|
||||
import { web3Wrapper } from './web3_wrapper';
|
||||
|
||||
const deployerOpts = {
|
||||
web3Provider: web3Wrapper.getProvider(),
|
||||
artifactsDir: config.artifactsDir,
|
||||
networkId: config.networkId,
|
||||
defaults: {
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
},
|
||||
};
|
||||
|
||||
export const deployer = new Deployer(deployerOpts);
|
30
packages/metacoin/test/utils/web3_wrapper.ts
Normal file
30
packages/metacoin/test/utils/web3_wrapper.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { env, EnvVars } from '@0xproject/dev-utils';
|
||||
import { GanacheSubprovider } from '@0xproject/subproviders';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import * as fs from 'fs';
|
||||
import * as _ from 'lodash';
|
||||
import ProviderEngine = require('web3-provider-engine');
|
||||
|
||||
import { config } from './config';
|
||||
import { coverage } from './coverage';
|
||||
|
||||
export const web3Provider = new ProviderEngine();
|
||||
const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
|
||||
if (isCoverageEnabled) {
|
||||
web3Provider.addProvider(coverage.getCoverageSubproviderSingleton());
|
||||
}
|
||||
web3Provider.addProvider(
|
||||
new GanacheSubprovider({
|
||||
logger: {
|
||||
log: (arg: any) => {
|
||||
fs.appendFileSync(config.ganacheLogFile, `${arg}\n`);
|
||||
},
|
||||
},
|
||||
verbose: env.parseBoolean(EnvVars.SolidityCoverage),
|
||||
networkId: config.networkId,
|
||||
mnemonic: config.mnemonic,
|
||||
}),
|
||||
);
|
||||
web3Provider.start();
|
||||
|
||||
export const web3Wrapper = new Web3Wrapper(web3Provider);
|
7
packages/metacoin/tsconfig.json
Normal file
7
packages/metacoin/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["src/**/*", "test/**/*"]
|
||||
}
|
3
packages/metacoin/tslint.json
Normal file
3
packages/metacoin/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": ["@0xproject/tslint-config"]
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.1.15",
|
||||
"version": "0.1.16",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
|
@@ -5,10 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.1.15 - _April 2, 2018_
|
||||
## v0.1.16 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.1.13 - _March 18, 2018_
|
||||
## v0.1.13 - _March 17, 2018_
|
||||
|
||||
* Add postpublish utils
|
||||
|
@@ -112,14 +112,20 @@ export const postpublishUtils = {
|
||||
this.updateChangelogIsPublished(packageName);
|
||||
},
|
||||
getReleaseNotes(packageName: string) {
|
||||
const changelogJSONPath = path.join(constants.monorepoRootPath, 'packages', packageName, 'CHANGELOG.json');
|
||||
const packageNameWithNamespace = packageName.replace('@0xproject/', '');
|
||||
const changelogJSONPath = path.join(
|
||||
constants.monorepoRootPath,
|
||||
'packages',
|
||||
packageNameWithNamespace,
|
||||
'CHANGELOG.json',
|
||||
);
|
||||
const changelogJSON = fs.readFileSync(changelogJSONPath, 'utf-8');
|
||||
const changelogs = JSON.parse(changelogJSON);
|
||||
const latestLog = changelogs[0];
|
||||
if (_.isUndefined(latestLog.isPublished)) {
|
||||
let notes = '';
|
||||
_.each(latestLog.changes, change => {
|
||||
notes = `* ${change.note}`;
|
||||
notes += `* ${change.note}`;
|
||||
if (change.pr) {
|
||||
notes += ` (${change.pr})`;
|
||||
}
|
||||
@@ -130,7 +136,13 @@ export const postpublishUtils = {
|
||||
return 'N/A';
|
||||
},
|
||||
updateChangelogIsPublished(packageName: string) {
|
||||
const changelogJSONPath = path.join(constants.monorepoRootPath, 'packages', packageName, 'CHANGELOG.json');
|
||||
const packageNameWithNamespace = packageName.replace('@0xproject/', '');
|
||||
const changelogJSONPath = path.join(
|
||||
constants.monorepoRootPath,
|
||||
'packages',
|
||||
packageNameWithNamespace,
|
||||
'CHANGELOG.json',
|
||||
);
|
||||
const changelogJSON = fs.readFileSync(changelogJSONPath, 'utf-8');
|
||||
const changelogs = JSON.parse(changelogJSON);
|
||||
const latestLog = changelogs[0];
|
||||
|
@@ -112,8 +112,12 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin
|
||||
const child = spawn('lerna', ['publish', '--registry=https://registry.npmjs.org/'], {
|
||||
cwd: constants.monorepoRootPath,
|
||||
});
|
||||
let shouldPrintOutput = false;
|
||||
child.stdout.on('data', (data: Buffer) => {
|
||||
const output = data.toString('utf8');
|
||||
if (shouldPrintOutput) {
|
||||
utils.log(output);
|
||||
}
|
||||
const isVersionPrompt = _.includes(output, 'Select a new version');
|
||||
if (isVersionPrompt) {
|
||||
const outputStripLeft = output.split('new version for ')[1];
|
||||
@@ -129,6 +133,8 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin
|
||||
const isFinalPrompt = _.includes(output, 'Are you sure you want to publish the above changes?');
|
||||
if (isFinalPrompt && !IS_DRY_RUN) {
|
||||
child.stdin.write(`y\n`);
|
||||
// After confirmations, we want to print the output to watch the `lerna publish` command
|
||||
shouldPrintOutput = true;
|
||||
} else if (isFinalPrompt && IS_DRY_RUN) {
|
||||
utils.log(
|
||||
`Submitted all versions to Lerna but since this is a dry run, did not confirm. You need to CTRL-C to exit.`,
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.0.6",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.0.5",
|
||||
"changes": [
|
||||
@@ -22,7 +31,8 @@
|
||||
"pr": 465
|
||||
}
|
||||
],
|
||||
"timestamp": 1522658513
|
||||
"timestamp": 1522658513,
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.0.3",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.0.6 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.5 - _April 2, 2018_
|
||||
|
||||
* Handle `reflection` type rendering so that anonymous function type declarations render properly (#465)
|
||||
@@ -12,11 +16,11 @@ CHANGELOG
|
||||
* Rename `MethodBlock` to `SignatureBlock` since it is not used to render method and function signature blocks. (#465)
|
||||
* Add support for documenting exported functions. (#465)
|
||||
|
||||
## v0.0.3 - _March 18, 2018_
|
||||
## v0.0.3 - _March 17, 2018_
|
||||
|
||||
* Move TS typings from devDependencies to dependencies since they are needed by the package user.
|
||||
|
||||
## v0.0.2 - _March 18, 2018_
|
||||
## v0.0.2 - _March 17, 2018_
|
||||
|
||||
* Move example out into a separate sub-package
|
||||
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
|
||||
|
@@ -8,7 +8,8 @@
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'src/**/*.tsx'",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"build:watch": "tsc -w",
|
||||
"clean": "shx rm -rf lib scripts"
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"author": "Fabio Berger",
|
||||
"license": "Apache-2.0",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"changes": [
|
||||
@@ -13,6 +22,7 @@
|
||||
"note": "Reorganized colors and added new ones"
|
||||
}
|
||||
],
|
||||
"timestamp": 1522658513
|
||||
"timestamp": 1522658513,
|
||||
"isPublished": true
|
||||
}
|
||||
]
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.1.1 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.1.0 - _April 2, 2018_
|
||||
|
||||
* Added new colors (#468)
|
||||
|
@@ -8,7 +8,8 @@
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'src/**/*.tsx'",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"build:watch": "tsc -w",
|
||||
"clean": "shx rm -rf lib scripts"
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"author": "Fabio Berger",
|
||||
"license": "Apache-2.0",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.0.6",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.0.5",
|
||||
@@ -6,6 +15,7 @@
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
],
|
||||
"isPublished": true
|
||||
}
|
||||
]
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.0.6 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.5 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -14,6 +14,7 @@
|
||||
"run_mocha": "mocha lib/test/**/*_test.js",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"build": "copyfiles 'test/fixtures/**/*' ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
|
||||
@@ -50,7 +51,7 @@
|
||||
"lodash": "^4.17.4",
|
||||
"semaphore-async-await": "^1.5.1",
|
||||
"solidity-coverage": "^0.4.10",
|
||||
"solidity-parser-antlr": "^0.2.7",
|
||||
"solidity-parser-antlr": "^0.2.8",
|
||||
"solidity-parser-sc": "^0.4.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
2
packages/sol-cov/src/globals.d.ts
vendored
2
packages/sol-cov/src/globals.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
declare module 'dirty-chai';
|
||||
|
||||
// tslint:disable:completed-docs
|
||||
declare module '*.json' {
|
||||
const json: any;
|
||||
|
@@ -3,10 +3,5 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*",
|
||||
"./test/**/*",
|
||||
"../../node_modules/types-bn/index.d.ts",
|
||||
"../../node_modules/types-ethereumjs-util/index.d.ts"
|
||||
]
|
||||
"include": ["./src/**/*", "./test/**/*"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.0.7",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.0.6",
|
||||
"changes": [
|
||||
@@ -7,7 +16,8 @@
|
||||
"pr": 451
|
||||
}
|
||||
],
|
||||
"timestamp": 1522658513
|
||||
"timestamp": 1522658513,
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.0.2",
|
||||
|
@@ -5,12 +5,16 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.0.7 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.6 - _April 2, 2018_
|
||||
|
||||
* Added postman collection unit tests (#451)
|
||||
|
||||
## v0.0.2 - _March 18, 2018_
|
||||
## v0.0.2 - _March 17, 2018_
|
||||
|
||||
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
|
||||
|
||||
## v0.0.1 - _March 8, 2018_
|
||||
## v0.0.1 - _March 7, 2018_
|
||||
|
@@ -7,12 +7,13 @@
|
||||
"scripts": {
|
||||
"build:watch": "tsc -w",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"build": "tsc",
|
||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
||||
"test": "run-s clean build copy_test_environments copy_test_fixtures run_mocha",
|
||||
"copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures",
|
||||
"copy_test_environments": "copyfiles -u 2 './test/environments/**/*.json' ./lib/test/environments",
|
||||
"run_mocha": "mocha lib/test/**/*_test.js"
|
||||
"run_mocha": "mocha lib/test/**/*_test.js",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"bin": {
|
||||
"sra-report": "lib/index.js"
|
||||
|
2
packages/sra-report/src/globals.d.ts
vendored
2
packages/sra-report/src/globals.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
declare module 'dirty-chai';
|
||||
|
||||
declare module 'newman' {
|
||||
export interface NewmanRunSummary {
|
||||
run: NewmanRun;
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.8.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.8.3",
|
||||
"changes": [
|
||||
@@ -11,7 +20,8 @@
|
||||
"pr": 465
|
||||
}
|
||||
],
|
||||
"timestamp": 1522658513
|
||||
"timestamp": 1522658513,
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.8.0",
|
||||
|
@@ -5,48 +5,52 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.8.4 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.8.3 - _April 2, 2018_
|
||||
|
||||
* Introduce `JSONRPCRequestPayloadWithMethod` type (#465)
|
||||
* Export `ErrorCallback` type. (#465)
|
||||
|
||||
## v0.8.0 - _March 18, 2018_
|
||||
## v0.8.0 - _March 17, 2018_
|
||||
|
||||
* Export `GanacheSubprovider` and `Subprovider` (#426)
|
||||
* Make all subproviders to derive from `Subprovider` (#426)
|
||||
* Add types for `NextCallback`, `OnNextCompleted` (#426)
|
||||
* Ignore `ganache-core` dependency when using package in a browser environment.
|
||||
|
||||
## v0.7.0 - _March 8, 2018_
|
||||
## v0.7.0 - _March 7, 2018_
|
||||
|
||||
* Updated legerco packages. Removed node-hid package as a dependency and make it an optional dependency. It is still used in integration tests but is causing problems for users on Linux distros. (#437)
|
||||
|
||||
## v0.6.0 - _March 4, 2018_
|
||||
## v0.6.0 - _March 3, 2018_
|
||||
|
||||
* Move web3 types from being a devDep to a dep since one cannot use this package without it (#429)
|
||||
* Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync` (#432)
|
||||
|
||||
## v0.5.0 - _February 16, 2018_
|
||||
## v0.5.0 - _February 15, 2018_
|
||||
|
||||
* Add EmptyWalletSubprovider and FakeGasEstimateSubprovider (#392)
|
||||
|
||||
## v0.4.1 - _February 9, 2018_
|
||||
## v0.4.1 - _February 8, 2018_
|
||||
|
||||
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
|
||||
|
||||
## v0.4.0 - _February 7, 2018_
|
||||
## v0.4.0 - _February 6, 2018_
|
||||
|
||||
* Added NonceTrackerSubprovider (#355)
|
||||
* InjectedWeb3Subprovider accepts a Provider in the constructor, previously it was a Web3 object (#363)
|
||||
|
||||
## v0.3.6 - _January 28, 2018_
|
||||
## v0.3.6 - _January 27, 2018_
|
||||
|
||||
* Return a transaction hash from `_sendTransactionAsync` (#303)
|
||||
|
||||
## v0.3.0 - _December 28, 2017_
|
||||
## v0.3.0 - _December 27, 2017_
|
||||
|
||||
* Allow LedgerSubprovider to handle `eth_sign` in addition to `personal_sign` RPC requests
|
||||
|
||||
## v0.2.0 - _December 20, 2017_
|
||||
## v0.2.0 - _December 19, 2017_
|
||||
|
||||
* Improve the performance of address fetching (#271)
|
||||
|
@@ -18,6 +18,7 @@
|
||||
"test:all": "run-s test:unit test:integration",
|
||||
"test:unit": "run-s clean build run_mocha_unit",
|
||||
"test:integration": "run-s clean build run_mocha_integration",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
|
||||
@@ -69,8 +70,6 @@
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.8.0",
|
||||
"typedoc": "0xProject/typedoc",
|
||||
"types-bn": "^0.0.1",
|
||||
"types-ethereumjs-util": "0xProject/types-ethereumjs-util",
|
||||
"typescript": "2.7.1",
|
||||
"webpack": "^3.1.0"
|
||||
},
|
||||
|
25
packages/subproviders/src/globals.d.ts
vendored
25
packages/subproviders/src/globals.d.ts
vendored
@@ -1,4 +1,3 @@
|
||||
declare module 'dirty-chai';
|
||||
declare module 'es6-promisify';
|
||||
|
||||
// tslint:disable:max-classes-per-file
|
||||
@@ -7,19 +6,6 @@ declare module 'es6-promisify';
|
||||
// tslint:disable:completed-docs
|
||||
|
||||
// Ethereumjs-tx declarations
|
||||
declare module 'ethereumjs-tx' {
|
||||
class EthereumTx {
|
||||
public raw: Buffer[];
|
||||
public r: Buffer;
|
||||
public s: Buffer;
|
||||
public v: Buffer;
|
||||
public nonce: Buffer;
|
||||
public serialize(): Buffer;
|
||||
public getSenderAddress(): Buffer;
|
||||
constructor(txParams: any);
|
||||
}
|
||||
export = EthereumTx;
|
||||
}
|
||||
|
||||
// Ledgerco declarations
|
||||
interface ECSignatureString {
|
||||
@@ -84,17 +70,6 @@ declare module 'web3-provider-engine/subproviders/rpc' {
|
||||
}
|
||||
export = RpcSubprovider;
|
||||
}
|
||||
declare module 'web3-provider-engine' {
|
||||
class Web3ProviderEngine {
|
||||
public on(event: string, handler: () => void): void;
|
||||
public send(payload: any): void;
|
||||
public sendAsync(payload: any, callback: (error: any, response: any) => void): void;
|
||||
public addProvider(provider: any): void;
|
||||
public start(): void;
|
||||
public stop(): void;
|
||||
}
|
||||
export = Web3ProviderEngine;
|
||||
}
|
||||
declare module 'web3-provider-engine/util/rpc-cache-utils' {
|
||||
class ProviderEngineRpcUtils {
|
||||
public static blockTagForPayload(payload: any): string | null;
|
||||
|
@@ -3,10 +3,5 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*",
|
||||
"./test/**/*",
|
||||
"../../node_modules/types-bn/index.d.ts",
|
||||
"../../node_modules/types-ethereumjs-util/index.d.ts"
|
||||
]
|
||||
"include": ["./src/**/*", "./test/**/*"]
|
||||
}
|
||||
|
@@ -39,8 +39,6 @@
|
||||
"shx": "^0.2.2",
|
||||
"source-map-loader": "^0.1.6",
|
||||
"tslint": "5.8.0",
|
||||
"types-bn": "^0.0.1",
|
||||
"types-ethereumjs-util": "0xProject/types-ethereumjs-util",
|
||||
"typescript": "2.7.1",
|
||||
"webpack": "^3.1.0",
|
||||
"webpack-node-externals": "^1.6.0"
|
||||
|
28
packages/testnet-faucets/src/ts/global.d.ts
vendored
28
packages/testnet-faucets/src/ts/global.d.ts
vendored
@@ -9,31 +9,3 @@ declare module '*.json' {
|
||||
export default json;
|
||||
/* tslint:enable */
|
||||
}
|
||||
|
||||
// Ethereumjs-tx declarations
|
||||
declare module 'ethereumjs-tx' {
|
||||
class EthereumTx {
|
||||
public raw: Buffer[];
|
||||
public r: Buffer;
|
||||
public s: Buffer;
|
||||
public v: Buffer;
|
||||
public serialize(): Buffer;
|
||||
public sign(buffer: Buffer): void;
|
||||
constructor(txParams: any);
|
||||
}
|
||||
export = EthereumTx;
|
||||
}
|
||||
|
||||
/* tslint:disable */
|
||||
declare module 'web3-provider-engine' {
|
||||
class Web3ProviderEngine {
|
||||
public on(event: string, handler: () => void): void;
|
||||
public send(payload: any): void;
|
||||
public sendAsync(payload: any, callback: (error: any, response: any) => void): void;
|
||||
public addProvider(provider: any): void;
|
||||
public start(): void;
|
||||
public stop(): void;
|
||||
}
|
||||
export = Web3ProviderEngine;
|
||||
}
|
||||
/* tslint:enable */
|
||||
|
@@ -4,9 +4,5 @@
|
||||
"outDir": "lib",
|
||||
"strictPropertyInitialization": false
|
||||
},
|
||||
"include": [
|
||||
"./src/ts/**/*",
|
||||
"../../node_modules/types-bn/index.d.ts",
|
||||
"../../node_modules/types-ethereumjs-util/index.d.ts"
|
||||
]
|
||||
"include": ["./src/ts/**/*"]
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1522673609,
|
||||
"version": "0.4.14",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1522658513,
|
||||
"version": "0.4.13",
|
||||
@@ -6,7 +15,8 @@
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
],
|
||||
"isPublished": true
|
||||
},
|
||||
{
|
||||
"version": "0.4.9",
|
||||
|
@@ -5,32 +5,36 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.4.14 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.4.13 - _April 2, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.4.9 - _February 9, 2018_
|
||||
## v0.4.9 - _February 8, 2018_
|
||||
|
||||
* Move devDeps to deps to fix missed dependency issue in published package.
|
||||
|
||||
## v0.4.8 - _February 9, 2018_
|
||||
## v0.4.8 - _February 8, 2018_
|
||||
|
||||
* Fix publish issue where custom TSLint rules were not being included (#389)
|
||||
|
||||
## v0.4.7 - _February 7, 2018_
|
||||
## v0.4.7 - _February 6, 2018_
|
||||
|
||||
* Modified custom 'underscore-privates' rule, changing it to 'underscore-private-and-protected' requiring underscores to be prepended to both private and protected variable names (#354)
|
||||
|
||||
## v0.4.0 - _December 28, 2017_
|
||||
## v0.4.0 - _December 27, 2017_
|
||||
|
||||
* Added custom 'underscore-privates' rule, requiring underscores to be prepended to private variable names
|
||||
* Because our tools can be used in both a TS and JS environment, we want to make the private methods of any public facing interface show up at the bottom of auto-complete lists. Additionally, we wanted to remain consistent with respect to our usage of underscores in order to enforce this rule with a linter rule, rather then manual code reviews.
|
||||
|
||||
## v0.3.0 - _December 20, 2017_
|
||||
## v0.3.0 - _December 19, 2017_
|
||||
|
||||
* Added rules for unused imports, variables and Async suffixes (#265)
|
||||
|
||||
## v0.1.0 - _November 14, 2017_
|
||||
## v0.1.0 - _November 13, 2017_
|
||||
|
||||
* Re-published TsLintConfig previously published under NPM package `tslint-config-0xproject`
|
||||
* Updated to TSLint v5.8.0, requiring several rule additions to keep our conventions aligned.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user