diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-09-26 21:07:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-26 21:07:14 +0800 |
commit | 3c40526bffcccbad2a64f92f69f3b6ec63946c88 (patch) | |
tree | 21c7b4f3bec21a59dd61ea1bd1686b9c5862a297 /src | |
parent | 0a19a7e8d165a3df33e862d761492c9b4382ed24 (diff) | |
parent | 8a29f12a614f0024ee0e566a9444fb93a26be9cd (diff) | |
download | dexon-sol-tools-3c40526bffcccbad2a64f92f69f3b6ec63946c88.tar dexon-sol-tools-3c40526bffcccbad2a64f92f69f3b6ec63946c88.tar.gz dexon-sol-tools-3c40526bffcccbad2a64f92f69f3b6ec63946c88.tar.bz2 dexon-sol-tools-3c40526bffcccbad2a64f92f69f3b6ec63946c88.tar.lz dexon-sol-tools-3c40526bffcccbad2a64f92f69f3b6ec63946c88.tar.xz dexon-sol-tools-3c40526bffcccbad2a64f92f69f3b6ec63946c88.tar.zst dexon-sol-tools-3c40526bffcccbad2a64f92f69f3b6ec63946c88.zip |
Merge pull request #171 from 0xProject/feature/zrx-getter
Make getZRXTokenAddressAsync public
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 54d7f62d5..694f3b71b 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -637,7 +637,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); assert.isBigNumber('fillTakerTokenAmount', fillTakerTokenAmount); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const zrxTokenAddress = await this._getZRXTokenAddressAsync(); + const zrxTokenAddress = await this.getZRXTokenAddressAsync(); await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync( signedOrder, fillTakerTokenAmount, takerAddress, zrxTokenAddress); } @@ -670,7 +670,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema); assert.isBigNumber('fillTakerTokenAmount', fillTakerTokenAmount); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - const zrxTokenAddress = await this._getZRXTokenAddressAsync(); + const zrxTokenAddress = await this.getZRXTokenAddressAsync(); await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync( signedOrder, fillTakerTokenAmount, takerAddress, zrxTokenAddress); } @@ -708,6 +708,15 @@ export class ExchangeWrapper extends ContractWrapper { throw new Error(errMessage); } } + /** + * Returns the ZRX token address used by the exchange contract. + * @return Address of ZRX token + */ + public async getZRXTokenAddressAsync(): Promise<string> { + const exchangeInstance = await this._getExchangeContractAsync(); + const ZRXtokenAddress = await exchangeInstance.ZRX_TOKEN_CONTRACT.callAsync(); + return ZRXtokenAddress; + } private async _invalidateContractInstancesAsync(): Promise<void> { await this.stopWatchingAllEventsAsync(); delete this._exchangeContractIfExists; @@ -745,11 +754,6 @@ export class ExchangeWrapper extends ContractWrapper { this._exchangeContractIfExists = contractInstance as ExchangeContract; return this._exchangeContractIfExists; } - private async _getZRXTokenAddressAsync(): Promise<string> { - const exchangeInstance = await this._getExchangeContractAsync(); - const ZRXtokenAddress = await exchangeInstance.ZRX_TOKEN_CONTRACT.callAsync(); - return ZRXtokenAddress; - } private async _getTokenTransferProxyAddressAsync(): Promise<string> { const exchangeInstance = await this._getExchangeContractAsync(); const tokenTransferProxyAddress = await exchangeInstance.TOKEN_TRANSFER_PROXY_CONTRACT.callAsync(); |