From ed3d1a8142e6f65480f95df7c3991ae00c757e38 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 6 Jun 2017 12:37:52 +0200 Subject: Rename assert.isSenderAccountHexAsync to assert.isSenderAddressHexAsync --- src/0x.js.ts | 2 +- src/contract_wrappers/exchange_wrapper.ts | 2 +- src/contract_wrappers/token_wrapper.ts | 6 +++--- src/utils/assert.ts | 2 +- test/assert_test.ts | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/0x.js.ts b/src/0x.js.ts index 302064971..65d363218 100644 --- a/src/0x.js.ts +++ b/src/0x.js.ts @@ -163,7 +163,7 @@ export class ZeroEx { */ public async signOrderHashAsync(orderHashHex: string, senderAccount: string): Promise { assert.isHexString('orderHashHex', orderHashHex); - await assert.isSenderAccountHexAsync('senderAccount', senderAccount, this.web3Wrapper); + await assert.isSenderAddressHexAsync('senderAccount', senderAccount, this.web3Wrapper); let msgHashHex; const nodeVersion = await this.web3Wrapper.getNodeVersionAsync(); diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 7b0394391..5c5a46a03 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('takerAddress', takerAddress, this.web3Wrapper); + await assert.isSenderAddressHexAsync('takerAddress', takerAddress, this.web3Wrapper); const exchangeInstance = await this.getExchangeContractAsync(); await this.validateFillOrderAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, takerAddress); diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 758eb32f7..326bca189 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 { - await assert.isSenderAccountHexAsync('ownerAddress', ownerAddress, this.web3Wrapper); + await assert.isSenderAddressHexAsync('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 { assert.isETHAddressHex('tokenAddress', tokenAddress); - await assert.isSenderAccountHexAsync('fromAddress', fromAddress, this.web3Wrapper); + await assert.isSenderAddressHexAsync('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('senderAccount', senderAccount, this.web3Wrapper); + await assert.isSenderAddressHexAsync('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 0f45a62ff..d9cf57d1c 100644 --- a/src/utils/assert.ts +++ b/src/utils/assert.ts @@ -26,7 +26,7 @@ export const assert = { const web3 = new Web3(); this.assert(web3.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value)); }, - async isSenderAccountHexAsync(variableName: string, senderAccount: string, + async isSenderAddressHexAsync(variableName: string, senderAccount: string, web3Wrapper: Web3Wrapper): Promise { assert.isETHAddressHex(variableName, senderAccount); await assert.isSenderAccountAvailableAsync(web3Wrapper, senderAccount); diff --git a/test/assert_test.ts b/test/assert_test.ts index 2100611e9..f72956eb3 100644 --- a/test/assert_test.ts +++ b/test/assert_test.ts @@ -13,20 +13,20 @@ describe('Assertion library', () => { it('throws when address is invalid', async () => { const address = '0xdeadbeef'; const varName = 'account'; - return expect(assert.isSenderAccountHexAsync(varName, address, (zeroEx as any).web3Wrapper)) + return expect(assert.isSenderAddressHexAsync(varName, address, (zeroEx as any).web3Wrapper)) .to.be.rejectedWith(`Expected ${varName} to be of type ETHAddressHex, encountered: ${address}`); }); it('throws when address is unavailable', async () => { const validUnrelatedAddress = '0x8b0292b11a196601eddce54b665cafeca0347d42'; const varName = 'account'; - return expect(assert.isSenderAccountHexAsync(varName, validUnrelatedAddress, (zeroEx as any).web3Wrapper)) + return expect(assert.isSenderAddressHexAsync(varName, validUnrelatedAddress, (zeroEx as any).web3Wrapper)) .to.be.rejectedWith(`Specified sender account ${validUnrelatedAddress} \ isn't available through the supplied web3 instance`); }); it('doesn\'t throw if account is available', async () => { const availableAccount = (await zeroEx.getAvailableAccountsAsync())[0]; const varName = 'account'; - return expect(assert.isSenderAccountHexAsync(varName, availableAccount, (zeroEx as any).web3Wrapper)) + return expect(assert.isSenderAddressHexAsync(varName, availableAccount, (zeroEx as any).web3Wrapper)) .to.become(undefined); }); }); -- cgit v1.2.3