aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-24 03:35:44 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-02-28 04:05:23 +0800
commit2d561bc8a05e8d1fca91cde93bae2080d87be926 (patch)
tree10d785eff73c67ecae09a337ed3721ff6b6102a9 /packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts
parentf5275d3ad75d2a989556de99cdef82bcf2cd687c (diff)
downloaddexon-sol-tools-2d561bc8a05e8d1fca91cde93bae2080d87be926.tar.gz
dexon-sol-tools-2d561bc8a05e8d1fca91cde93bae2080d87be926.tar.zst
dexon-sol-tools-2d561bc8a05e8d1fca91cde93bae2080d87be926.zip
Allow users to specify the contracts backend in abi-gen
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts')
-rw-r--r--packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts
index f0ae5f33c..e1806c6f2 100644
--- a/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts
+++ b/packages/0x.js/src/contract_wrappers/token_registry_wrapper.ts
@@ -23,7 +23,7 @@ export class TokenRegistryWrapper extends ContractWrapper {
address: metadata[0],
name: metadata[1],
symbol: metadata[2],
- decimals: metadata[3].toNumber(),
+ decimals: metadata[3],
};
return token;
}
@@ -50,7 +50,8 @@ export class TokenRegistryWrapper extends ContractWrapper {
public async getTokenAddressesAsync(): Promise<string[]> {
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const addresses = await tokenRegistryContract.getTokenAddresses.callAsync();
- return addresses;
+ const lowerCaseAddresses = _.map(addresses, address => address.toLowerCase());
+ return lowerCaseAddresses;
}
/**
* Retrieves a token by address currently listed in the Token Registry smart contract
@@ -116,14 +117,11 @@ export class TokenRegistryWrapper extends ContractWrapper {
if (!_.isUndefined(this._tokenRegistryContractIfExists)) {
return this._tokenRegistryContractIfExists;
}
- const web3ContractInstance = await this._instantiateContractIfExistsAsync(
+ const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.TokenRegistryArtifact,
this._contractAddressIfExists,
);
- const contractInstance = new TokenRegistryContract(
- web3ContractInstance,
- this._web3Wrapper.getContractDefaults(),
- );
+ const contractInstance = new TokenRegistryContract(this._web3Wrapper, abi, address);
this._tokenRegistryContractIfExists = contractInstance;
return this._tokenRegistryContractIfExists;
}