diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-06 16:25:28 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-06 16:25:28 +0800 |
commit | 2a080427278d040d2e978ceb806e61818f13ae2f (patch) | |
tree | 00049cabbfb7cef858bf19efefbaf0c83c5d7c5f | |
parent | bac6833436960d2a7eb50d89e94fed226a16008b (diff) | |
download | dexon-0x-contracts-2a080427278d040d2e978ceb806e61818f13ae2f.tar.gz dexon-0x-contracts-2a080427278d040d2e978ceb806e61818f13ae2f.tar.zst dexon-0x-contracts-2a080427278d040d2e978ceb806e61818f13ae2f.zip |
Add variableName to isSenderAddcountHexAsync
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 2 | ||||
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 6 | ||||
-rw-r--r-- | src/utils/assert.ts | 7 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 459e24608..35ba7770c 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -121,7 +121,7 @@ export class ExchangeWrapper extends ContractWrapper { signedOrderSchema); assert.isBigNumber('fillTakerAmount', fillTakerAmount); assert.isBoolean('shouldCheckTransfer', shouldCheckTransfer); - await assert.isSenderAccountHexAsync(this.web3Wrapper, senderAccount); + await assert.isSenderAccountHexAsync('senderAccount', senderAccount, this.web3Wrapper); const exchangeInstance = await this.getExchangeContractAsync(); await this.validateFillOrderAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, senderAccount); diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 55ad9be29..758eb32f7 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -38,7 +38,7 @@ export class TokenWrapper extends ContractWrapper { */ public async setAllowanceAsync(tokenAddress: string, ownerAddress: string, spenderAddress: string, amountInBaseUnits: BigNumber.BigNumber): Promise<void> { - assert.isETHAddressHex('ownerAddress', ownerAddress); + await assert.isSenderAccountHexAsync('ownerAddress', ownerAddress, this.web3Wrapper); assert.isETHAddressHex('spenderAddress', spenderAddress); assert.isETHAddressHex('tokenAddress', tokenAddress); assert.isBigNumber('amountInBaseUnits', amountInBaseUnits); @@ -97,7 +97,7 @@ export class TokenWrapper extends ContractWrapper { public async transferAsync(tokenAddress: string, fromAddress: string, toAddress: string, amountInBaseUnits: BigNumber.BigNumber): Promise<void> { assert.isETHAddressHex('tokenAddress', tokenAddress); - assert.isETHAddressHex('fromAddress', fromAddress); + await assert.isSenderAccountHexAsync('fromAddress', fromAddress, this.web3Wrapper); assert.isETHAddressHex('toAddress', toAddress); assert.isBigNumber('amountInBaseUnits', amountInBaseUnits); @@ -123,7 +123,7 @@ export class TokenWrapper extends ContractWrapper { assert.isETHAddressHex('tokenAddress', tokenAddress); assert.isETHAddressHex('fromAddress', fromAddress); assert.isETHAddressHex('toAddress', toAddress); - await assert.isSenderAccountHexAsync(this.web3Wrapper, senderAccount); + await assert.isSenderAccountHexAsync('senderAccount', senderAccount, this.web3Wrapper); assert.isBigNumber('amountInBaseUnits', amountInBaseUnits); const tokenContract = await this.getTokenContractAsync(tokenAddress); diff --git a/src/utils/assert.ts b/src/utils/assert.ts index 2396b8534..0f45a62ff 100644 --- a/src/utils/assert.ts +++ b/src/utils/assert.ts @@ -26,13 +26,14 @@ export const assert = { const web3 = new Web3(); this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value)); }, - async isSenderAccountHexAsync(web3Wrapper: Web3Wrapper, senderAccount: string): Promise<void> { - assert.isETHAddressHex('senderAccount', senderAccount); + async isSenderAccountHexAsync(variableName: string, senderAccount: string, + web3Wrapper: Web3Wrapper): Promise<void> { + assert.isETHAddressHex(variableName, senderAccount); await assert.isSenderAccountAvailableAsync(web3Wrapper, senderAccount); }, async isSenderAccountAvailableAsync(web3Wrapper: Web3Wrapper, senderAccount: string): Promise<void> { const isSenderAddressAvailable = await web3Wrapper.isSenderAddressAvailableAsync(senderAccount); - assert.assert(isSenderAddressAvailable, `Specified senderAccount ${senderAccount} isn't available through the \ + assert.assert(isSenderAddressAvailable, `Specified sender account ${senderAccount} isn't available through the \ supplied web3 instance`); }, isNumber(variableName: string, value: number): void { |