Merge pull request #130 from 0xProject/addProxyAddressMethod

Add public TokenTransferProxy address getter
This commit is contained in:
Fabio Berger
2017-08-23 17:37:31 +02:00
committed by GitHub
4 changed files with 15 additions and 3 deletions

View File

@@ -4,15 +4,16 @@ v0.9.4 - _TBD_
------------------------
* Add clear error message when checksummed address is passed to a public method (#124)
* Fixes the description of `shouldThrowOnInsufficientBalanceOrAllowance` in docs (#127)
* Add `zeroEx.proxy.getContractAddressAsync` to public interface (#130)
v0.9.3 - _Aug 22, 2017_
------------------------
* Update contract artifacts to include latest Kovan and Mainnet deploys.
* Update contract artifacts to include latest Kovan and Mainnet deploys (#118)
v0.9.2 - _Aug 21, 2017_
------------------------
* *This version was unpublished because of a publishing issue.*
* Update contract artifacts to include latest Kovan and Mainnet deploys.
* Update contract artifacts to include latest Kovan and Mainnet deploys (#118)
v0.9.1 - _Aug. 16, 2017_
------------------------

View File

@@ -623,7 +623,8 @@ export class ExchangeWrapper extends ContractWrapper {
*/
public async getContractAddressAsync(): Promise<string> {
const exchangeInstance = await this._getExchangeContractAsync();
return exchangeInstance.address;
const exchangeAddress = exchangeInstance.address;
return exchangeAddress;
}
private async _invalidateContractInstancesAsync(): Promise<void> {
await this.stopWatchingAllEventsAsync();

View File

@@ -27,6 +27,16 @@ export class TokenTransferProxyWrapper extends ContractWrapper {
const authorizedAddresses = await tokenTransferProxyContractInstance.getAuthorizedAddresses.call();
return authorizedAddresses;
}
/**
* Retrieves the Ethereum address of the TokenTransferProxy contract deployed on the network
* that the user-passed web3 provider is connected to.
* @returns The Ethereum address of the TokenTransferProxy contract being used.
*/
public async getContractAddressAsync(): Promise<string> {
const proxyInstance = await this._getTokenTransferProxyContractAsync();
const proxyAddress = proxyInstance.address;
return proxyAddress;
}
private _invalidateContractInstance(): void {
delete this._tokenTransferProxyContractIfExists;
}