diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-05 22:22:56 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-05 22:22:56 +0800 |
commit | bac6833436960d2a7eb50d89e94fed226a16008b (patch) | |
tree | 69556bb591ecd1fc5ebcd3e2da8c688d5cbaccd0 /src/contract_wrappers/token_wrapper.ts | |
parent | eb5c9ae70886cb1a14ae154f363f052a76b24479 (diff) | |
download | dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.gz dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.bz2 dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.lz dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.xz dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.tar.zst dexon-sol-tools-bac6833436960d2a7eb50d89e94fed226a16008b.zip |
Make methods accept senderAccount
Diffstat (limited to 'src/contract_wrappers/token_wrapper.ts')
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index c8b557d0d..55ad9be29 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -115,21 +115,20 @@ export class TokenWrapper extends ContractWrapper { /** * Transfers `amountInBaseUnits` ERC20 tokens from `fromAddress` to `toAddress`. * Requires the fromAddress to have sufficient funds and to have approved an allowance of - * `amountInBaseUnits` for senderAddress. + * `amountInBaseUnits` for senderAccount. */ public async transferFromAsync(tokenAddress: string, fromAddress: string, toAddress: string, - senderAddress: string, amountInBaseUnits: BigNumber.BigNumber): + senderAccount: string, amountInBaseUnits: BigNumber.BigNumber): Promise<void> { assert.isETHAddressHex('tokenAddress', tokenAddress); assert.isETHAddressHex('fromAddress', fromAddress); assert.isETHAddressHex('toAddress', toAddress); - assert.isETHAddressHex('senderAddress', senderAddress); + await assert.isSenderAccountHexAsync(this.web3Wrapper, senderAccount); assert.isBigNumber('amountInBaseUnits', amountInBaseUnits); - await assert.isSenderAddressAvailableAsync(this.web3Wrapper, senderAddress); const tokenContract = await this.getTokenContractAsync(tokenAddress); - const fromAddressAllowance = await this.getAllowanceAsync(tokenAddress, fromAddress, senderAddress); + const fromAddressAllowance = await this.getAllowanceAsync(tokenAddress, fromAddress, senderAccount); if (fromAddressAllowance.lessThan(amountInBaseUnits)) { throw new Error(ZeroExError.INSUFFICIENT_ALLOWANCE_FOR_TRANSFER); } @@ -140,7 +139,7 @@ export class TokenWrapper extends ContractWrapper { } await tokenContract.transferFrom(fromAddress, toAddress, amountInBaseUnits, { - from: senderAddress, + from: senderAccount, }); } private async getTokenContractAsync(tokenAddress: string): Promise<TokenContract> { |