diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-05 05:52:49 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 04:36:59 +0800 |
commit | 57d9fcf9e5a13dd0de52aa0ed71f2dfa3f883db0 (patch) | |
tree | bc116aa8ccd5f5f8432157074d09d8266f0158f8 /packages/order-utils | |
parent | 2bd7b0f66bd28792281ba025cf005c666e7f767e (diff) | |
download | dexon-0x-contracts-57d9fcf9e5a13dd0de52aa0ed71f2dfa3f883db0.tar.gz dexon-0x-contracts-57d9fcf9e5a13dd0de52aa0ed71f2dfa3f883db0.tar.zst dexon-0x-contracts-57d9fcf9e5a13dd0de52aa0ed71f2dfa3f883db0.zip |
update order-utils to use new artifacts and abi-gen wrappers packages
Diffstat (limited to 'packages/order-utils')
6 files changed, 10 insertions, 38 deletions
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 6471de9f5..50bc0f0a0 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -8,23 +8,19 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "build": "yarn pre_build && tsc -b", + "build": "yarn tsc -b", "build:ci": "yarn build", - "pre_build": "run-s update_artifacts generate_contract_wrappers", - "generate_contract_wrappers": "abi-gen --abis 'lib/src/artifacts/@(Exchange|IWallet|IValidator|DummyERC20Token|ERC20Proxy|ERC20Token).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", - "update_artifacts": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-trimmed/$i.json lib/src/artifacts; done;", "test": "yarn run_mocha", "rebuild_and_test": "run-s build test", "test:circleci": "yarn test:coverage", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 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", - "clean": "shx rm -rf lib lib/src/artifacts src/generated_contract_wrappers generated_docs", - "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", + "clean": "shx rm -rf lib generated_docs", + "lint": "tslint --project .", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { - "contracts_v2": "IWallet IValidator Exchange ERC20Proxy ERC20Token DummyERC20Token", "postpublish": { "assets": [] } @@ -46,7 +42,6 @@ "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", - "copyfiles": "^2.0.0", "dirty-chai": "^2.0.1", "make-promises-safe": "^1.1.0", "mocha": "^4.1.0", @@ -58,8 +53,10 @@ "typescript": "3.0.1" }, "dependencies": { + "@0xproject/abi-gen-wrappers": "^1.0.0", "@0xproject/assert": "^1.0.13", "@0xproject/base-contract": "^3.0.1", + "@0xproject/contract-artifacts": "^1.0.0", "@0xproject/json-schemas": "^1.0.7", "@0xproject/types": "^1.1.4", "@0xproject/typescript-typings": "^3.0.2", diff --git a/packages/order-utils/src/artifacts.ts b/packages/order-utils/src/artifacts.ts deleted file mode 100644 index 735cc2403..000000000 --- a/packages/order-utils/src/artifacts.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ContractArtifact } from 'ethereum-types'; - -import * as DummyERC20Token from './artifacts/DummyERC20Token.json'; -import * as ERC20Proxy from './artifacts/ERC20Proxy.json'; -import * as Exchange from './artifacts/Exchange.json'; -import * as IValidator from './artifacts/IValidator.json'; -import * as IWallet from './artifacts/IWallet.json'; -export const artifacts = { - ERC20Proxy: (ERC20Proxy as any) as ContractArtifact, - DummyERC20Token: (DummyERC20Token as any) as ContractArtifact, - Exchange: (Exchange as any) as ContractArtifact, - IWallet: (IWallet as any) as ContractArtifact, - IValidator: (IValidator as any) as ContractArtifact, -}; diff --git a/packages/order-utils/src/globals.d.ts b/packages/order-utils/src/globals.d.ts deleted file mode 100644 index 94e63a32d..000000000 --- a/packages/order-utils/src/globals.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare module '*.json' { - const json: any; - /* tslint:disable */ - export default json; - /* tslint:enable */ -} diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts index 372d210d0..d755846ad 100644 --- a/packages/order-utils/src/signature_utils.ts +++ b/packages/order-utils/src/signature_utils.ts @@ -1,3 +1,5 @@ +import { ExchangeContract, IValidatorContract, IWalletContract } from '@0xproject/abi-gen-wrappers'; +import * as artifacts from '@0xproject/contract-artifacts'; import { schemas } from '@0xproject/json-schemas'; import { ECSignature, Order, SignatureType, SignedOrder, ValidatorSignature } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; @@ -5,12 +7,8 @@ import { Provider } from 'ethereum-types'; import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; -import { artifacts } from './artifacts'; import { assert } from './assert'; import { eip712Utils } from './eip712_utils'; -import { ExchangeContract } from './generated_contract_wrappers/exchange'; -import { IValidatorContract } from './generated_contract_wrappers/i_validator'; -import { IWalletContract } from './generated_contract_wrappers/i_wallet'; import { orderHashUtils } from './order_hash'; import { OrderError } from './types'; import { utils } from './utils'; diff --git a/packages/order-utils/test/exchange_transfer_simulator_test.ts b/packages/order-utils/test/exchange_transfer_simulator_test.ts index f5c18cdb9..c2367fd7f 100644 --- a/packages/order-utils/test/exchange_transfer_simulator_test.ts +++ b/packages/order-utils/test/exchange_transfer_simulator_test.ts @@ -1,15 +1,13 @@ +import { DummyERC20TokenContract, ERC20ProxyContract, ERC20TokenContract } from '@0xproject/abi-gen-wrappers'; +import * as artifacts from '@0xproject/contract-artifacts'; import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils'; import { ExchangeContractErrs } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; -import { artifacts } from '../src/artifacts'; import { assetDataUtils } from '../src/asset_data_utils'; import { constants } from '../src/constants'; import { ExchangeTransferSimulator } from '../src/exchange_transfer_simulator'; -import { DummyERC20TokenContract } from '../src/generated_contract_wrappers/dummy_erc20_token'; -import { ERC20ProxyContract } from '../src/generated_contract_wrappers/erc20_proxy'; -import { ERC20TokenContract } from '../src/generated_contract_wrappers/erc20_token'; import { BalanceAndProxyAllowanceLazyStore } from '../src/store/balance_and_proxy_allowance_lazy_store'; import { TradeSide, TransferType } from '../src/types'; diff --git a/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts b/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts index 279a5c0db..d00a25031 100644 --- a/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts +++ b/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts @@ -1,9 +1,8 @@ +import { ERC20TokenContract } from '@0xproject/abi-gen-wrappers'; import { BigNumber } from '@0xproject/utils'; import { AbstractBalanceAndProxyAllowanceFetcher } from '../../src/abstract/abstract_balance_and_proxy_allowance_fetcher'; -import { ERC20TokenContract } from '../../src/generated_contract_wrappers/erc20_token'; - export class SimpleERC20BalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher { private readonly _erc20TokenContract: ERC20TokenContract; private readonly _erc20ProxyAddress: string; |