Adjust 0x.js to use generated wrappers

This commit is contained in:
Leonid Logvinov
2017-12-01 22:47:05 -06:00
parent 6cbd0d4537
commit eb667f653c
8 changed files with 76 additions and 27 deletions

View File

@@ -1,12 +1,13 @@
import * as _ from 'lodash';
import {artifacts} from '../artifacts';
import {Token, TokenMetadata, TokenRegistryContract, ZeroExError} from '../types';
import {Token, TokenMetadata, ZeroExError} from '../types';
import {assert} from '../utils/assert';
import {constants} from '../utils/constants';
import {Web3Wrapper} from '../web3_wrapper';
import {ContractWrapper} from './contract_wrapper';
import {TokenRegistryContract} from './generated/token_registry';
/**
* This class includes all the functionality related to interacting with the 0x Token Registry smart contract.
@@ -116,9 +117,12 @@ export class TokenRegistryWrapper extends ContractWrapper {
if (!_.isUndefined(this._tokenRegistryContractIfExists)) {
return this._tokenRegistryContractIfExists;
}
const contractInstance = await this._instantiateContractIfExistsAsync<TokenRegistryContract>(
const web3ContractInstance = await this._instantiateContractIfExistsAsync(
artifacts.TokenRegistryArtifact, this._contractAddressIfExists,
);
const contractInstance = new TokenRegistryContract(
web3ContractInstance, this._web3Wrapper.getContractDefaults(),
);
this._tokenRegistryContractIfExists = contractInstance;
return this._tokenRegistryContractIfExists;
}