aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-08-24 02:09:09 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-08-24 15:59:10 +0800
commit82ef8b19f01644dee14894e8dc4ec5ef33e922e9 (patch)
tree7b12a5d4109ac66aab4d1e0ce3c51fd2486a8b59 /src
parente216f2ff6de9b2dd998c37c919b8786f7dff1101 (diff)
downloaddexon-sol-tools-82ef8b19f01644dee14894e8dc4ec5ef33e922e9.tar
dexon-sol-tools-82ef8b19f01644dee14894e8dc4ec5ef33e922e9.tar.gz
dexon-sol-tools-82ef8b19f01644dee14894e8dc4ec5ef33e922e9.tar.bz2
dexon-sol-tools-82ef8b19f01644dee14894e8dc4ec5ef33e922e9.tar.lz
dexon-sol-tools-82ef8b19f01644dee14894e8dc4ec5ef33e922e9.tar.xz
dexon-sol-tools-82ef8b19f01644dee14894e8dc4ec5ef33e922e9.tar.zst
dexon-sol-tools-82ef8b19f01644dee14894e8dc4ec5ef33e922e9.zip
Add zeroEx.tokenRegistry.getTokenAddressesAsync()
Diffstat (limited to 'src')
-rw-r--r--src/contract_wrappers/token_registry_wrapper.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/contract_wrappers/token_registry_wrapper.ts b/src/contract_wrappers/token_registry_wrapper.ts
index 58c191ea5..ddfbc35ae 100644
--- a/src/contract_wrappers/token_registry_wrapper.ts
+++ b/src/contract_wrappers/token_registry_wrapper.ts
@@ -21,7 +21,7 @@ export class TokenRegistryWrapper extends ContractWrapper {
public async getTokensAsync(): Promise<Token[]> {
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
- const addresses = await tokenRegistryContract.getTokenAddresses.call();
+ const addresses = await this.getTokenAddressesAsync();
const tokenPromises: Array<Promise<Token|undefined>> = _.map(
addresses,
(address: string) => (this.getTokenIfExistsAsync(address)),
@@ -30,6 +30,15 @@ export class TokenRegistryWrapper extends ContractWrapper {
return tokens as Token[];
}
/**
+ * Retrieves all the addresses of the tokens currently listed in the Token Registry smart contract
+ * @return An array of token addresses.
+ */
+ public async getTokenAddressesAsync(): Promise<string[]> {
+ const tokenRegistryContract = await this._getTokenRegistryContractAsync();
+ const addresses = await tokenRegistryContract.getTokenAddresses.call();
+ return addresses;
+ }
+ /**
* Retrieves a token by address currently listed in the Token Registry smart contract
* @return An object that conforms to the Token interface or undefined if token not found.
*/