diff options
Diffstat (limited to 'src')
-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 { |