diff options
author | Fabio Berger <me@fabioberger.com> | 2018-10-16 23:59:02 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-10-16 23:59:02 +0800 |
commit | c84c92663d1ce0227b755dc861f825c35a3c7999 (patch) | |
tree | 3800297ba0072233fe88839b675e33e6b44f9649 /packages/asset-buyer | |
parent | 55a3bc8cb6772802672f60f22c5ed5c7e1b2dfdd (diff) | |
parent | c333d093b585fa0250a6973f2d396eb3cf227334 (diff) | |
download | dexon-sol-tools-c84c92663d1ce0227b755dc861f825c35a3c7999.tar dexon-sol-tools-c84c92663d1ce0227b755dc861f825c35a3c7999.tar.gz dexon-sol-tools-c84c92663d1ce0227b755dc861f825c35a3c7999.tar.bz2 dexon-sol-tools-c84c92663d1ce0227b755dc861f825c35a3c7999.tar.lz dexon-sol-tools-c84c92663d1ce0227b755dc861f825c35a3c7999.tar.xz dexon-sol-tools-c84c92663d1ce0227b755dc861f825c35a3c7999.tar.zst dexon-sol-tools-c84c92663d1ce0227b755dc861f825c35a3c7999.zip |
Merge branch 'dev-section-redesign' into reSkinReferenceDocs
* dev-section-redesign: (87 commits)
Added note about restriction on `testDirectory`
fix(dev-utils): Make chai a dev dependency since exported interface depends on it
Add changelog entries
fix(subproviders): make web3-provider-engine types a 'dependency' so it's available to users of the library
fix(sra-spec): make @loopback/openapi-v3-types a 'dependency' so it's available to users of the library
fix(sol-cov): make @types/solidity-parser-antlr a 'dependency' so it's available to users of the library
fix(dev-utils): make web3-provider-engine types a 'dependency' so it's available to users of the library
fix(0x.js): make web3-provider-engine types a 'dependency' so it's available to users of the library
fix(monorepo-scripts): Move the creation of the `.installation-test` directory OUTSIDE of the monorepo root, so that the installed packages can't reference the hoisted node_modules folder
Remove ContractNotFound errors in contract-wrappers
Update prettierignore
Update website to use the new unsubscribeAll method in contract-wrappers
In abi-gen-wrappers, ./wrappers -> ./src/generated-wrappers
In contract-wrappers, remove setProvider and add unsubscribeAll method.
take out explicit children definition in props
Update json-schemas for contract-wrappers
Add OrThrow suffix to getContractAddressesForNetwork
remove unused import
Update CHANGELOG.json for all changed packages
Remove ContractAddresses from packages/types (mistake after rebase)
...
Diffstat (limited to 'packages/asset-buyer')
-rw-r--r-- | packages/asset-buyer/CHANGELOG.json | 5 | ||||
-rw-r--r-- | packages/asset-buyer/package.json | 9 | ||||
-rw-r--r-- | packages/asset-buyer/src/asset_buyer.ts | 4 | ||||
-rw-r--r-- | packages/asset-buyer/src/utils/asset_data_utils.ts | 20 |
4 files changed, 13 insertions, 25 deletions
diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json index dbb801b69..b50fe2c63 100644 --- a/packages/asset-buyer/CHANGELOG.json +++ b/packages/asset-buyer/CHANGELOG.json @@ -4,6 +4,11 @@ "changes": [ { "note": "Add `gasLimit` and `gasPrice` as optional properties on `BuyQuoteExecutionOpts`" + }, + { + "note": + "Updated to use new modularized artifacts and the latest version of @0xproject/contract-wrappers", + "pr": 1105 } ] }, diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json index 291342169..8c8f3c92c 100644 --- a/packages/asset-buyer/package.json +++ b/packages/asset-buyer/package.json @@ -8,7 +8,8 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", + "build": "yarn tsc -b", + "build:ci": "yarn build", "lint": "tslint --project .", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", @@ -16,10 +17,7 @@ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", - "clean": "shx rm -rf lib test_temp scripts", - "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", - "build:ci": "yarn build", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "clean": "shx rm -rf lib test_temp" }, "config": { "postpublish": { @@ -58,7 +56,6 @@ "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", - "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "make-promises-safe": "^1.1.0", "mocha": "^4.1.0", diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 50343efde..4739e5a29 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -283,13 +283,13 @@ export class AssetBuyer { * Will throw if WETH does not exist for the current network. */ private _getEtherTokenAssetDataOrThrow(): string { - return assetDataUtils.getEtherTokenAssetDataOrThrow(this._contractWrappers); + return assetDataUtils.getEtherTokenAssetData(this._contractWrappers); } /** * Get the assetData that represents the ZRX token. * Will throw if ZRX does not exist for the current network. */ private _getZrxTokenAssetDataOrThrow(): string { - return assetDataUtils.getZrxTokenAssetDataOrThrow(this._contractWrappers); + return this._contractWrappers.exchange.getZRXAssetData(); } } diff --git a/packages/asset-buyer/src/utils/asset_data_utils.ts b/packages/asset-buyer/src/utils/asset_data_utils.ts index d05ff2504..f54462a23 100644 --- a/packages/asset-buyer/src/utils/asset_data_utils.ts +++ b/packages/asset-buyer/src/utils/asset_data_utils.ts @@ -2,25 +2,11 @@ import { ContractWrappers } from '@0xproject/contract-wrappers'; import { assetDataUtils as sharedAssetDataUtils } from '@0xproject/order-utils'; import * as _ from 'lodash'; -import { AssetBuyerError } from '../types'; - export const assetDataUtils = { ...sharedAssetDataUtils, - getEtherTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string { - const etherTokenAddressIfExists = contractWrappers.etherToken.getContractAddressIfExists(); - if (_.isUndefined(etherTokenAddressIfExists)) { - throw new Error(AssetBuyerError.NoEtherTokenContractFound); - } - const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddressIfExists); + getEtherTokenAssetData(contractWrappers: ContractWrappers): string { + const etherTokenAddress = contractWrappers.forwarder.etherTokenAddress; + const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddress); return etherTokenAssetData; }, - getZrxTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string { - let zrxTokenAssetData: string; - try { - zrxTokenAssetData = contractWrappers.exchange.getZRXAssetData(); - } catch (err) { - throw new Error(AssetBuyerError.NoZrxTokenContractFound); - } - return zrxTokenAssetData; - }, }; |