update order-utils to use new artifacts and abi-gen wrappers packages

This commit is contained in:
Alex Browne 2018-10-04 14:52:49 -07:00
parent 2bd7b0f66b
commit 57d9fcf9e5
7 changed files with 13 additions and 39 deletions

View File

@ -2,11 +2,13 @@ export * from '../wrappers/asset_proxy_owner';
export * from '../wrappers/dummy_erc20_token';
export * from '../wrappers/dummy_erc721_token';
export * from '../wrappers/erc20_proxy';
export * from '../wrappers/erc721_proxy';
export * from '../wrappers/erc20_token';
export * from '../wrappers/erc721_proxy';
export * from '../wrappers/erc721_token';
export * from '../wrappers/exchange';
export * from '../wrappers/forwarder';
export * from '../wrappers/i_validator';
export * from '../wrappers/i_wallet';
export * from '../wrappers/order_validator';
export * from '../wrappers/weth9';
export * from '../wrappers/zrx_token';

View File

@ -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",

View File

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

View File

@ -1,6 +0,0 @@
declare module '*.json' {
const json: any;
/* tslint:disable */
export default json;
/* tslint:enable */
}

View File

@ -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';

View File

@ -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';

View File

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