diff options
-rw-r--r-- | src/contract_wrappers/token_registry_wrapper.ts | 11 |
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. */ |