diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-05 05:40:58 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 04:36:59 +0800 |
commit | 2bd7b0f66bd28792281ba025cf005c666e7f767e (patch) | |
tree | 228f2797a772a4ba828d6b71e5c85c78a708ed21 /packages/contract-wrappers/src/contract_wrappers.ts | |
parent | 8f0ceaf1d8261e9779213276372f4690cdf3426c (diff) | |
download | dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.gz dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.bz2 dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.lz dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.xz dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.tar.zst dexon-sol-tools-2bd7b0f66bd28792281ba025cf005c666e7f767e.zip |
update contract_wrappers to use new artifacts and abi-gen wrappers packages
Diffstat (limited to 'packages/contract-wrappers/src/contract_wrappers.ts')
-rw-r--r-- | packages/contract-wrappers/src/contract_wrappers.ts | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 8e4693da6..359307da4 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -1,4 +1,13 @@ -import { artifacts } from '@0xproject/contracts'; +import { + ERC20Proxy, + ERC20Token, + ERC721Proxy, + ERC721Token, + Exchange, + Forwarder, + OrderValidator, + WETH9, +} from '@0xproject/contract-artifacts'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider } from 'ethereum-types'; import * as _ from 'lodash'; @@ -71,14 +80,22 @@ export class ContractWrappers { contractWrappersPrivateNetworkConfigSchema, contractWrappersPublicNetworkConfigSchema, ]); - const artifactJSONs = _.values(artifacts); - const abiArrays = _.map(artifactJSONs, artifact => artifact.compilerOutput.abi); const txDefaults = { gasPrice: config.gasPrice, }; this._web3Wrapper = new Web3Wrapper(provider, txDefaults); - _.forEach(abiArrays, abi => { - this._web3Wrapper.abiDecoder.addABI(abi); + const artifactsArray = [ + ERC20Proxy, + ERC20Token, + ERC721Proxy, + ERC721Token, + Exchange, + Forwarder, + OrderValidator, + WETH9, + ]; + _.forEach(artifactsArray, artifact => { + this._web3Wrapper.abiDecoder.addABI(artifact.compilerOutput.abi); }); const blockPollingIntervalMs = _.isUndefined(config.blockPollingIntervalMs) ? constants.DEFAULT_BLOCK_POLLING_INTERVAL @@ -114,7 +131,6 @@ export class ContractWrappers { * @param networkId The id of the network your provider is connected to */ public setProvider(provider: Provider): void { - // TODO(albrow): Make sure all contract wrappers are called below. this._web3Wrapper.setProvider(provider); (this.exchange as any)._invalidateContractInstances(); (this.erc20Token as any)._invalidateContractInstances(); |