aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers
diff options
context:
space:
mode:
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r--src/contract_wrappers/token_wrapper.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts
index 35e008905..cedbfbdae 100644
--- a/src/contract_wrappers/token_wrapper.ts
+++ b/src/contract_wrappers/token_wrapper.ts
@@ -52,7 +52,7 @@ export class TokenWrapper extends ContractWrapper {
* of an owner address.
*/
public async setProxyAllowanceAsync(tokenAddress: string, ownerAddress: string,
- amountInBaseUnits: BigNumber.BigNumber) {
+ amountInBaseUnits: BigNumber.BigNumber): Promise<void> {
assert.isETHAddressHex('ownerAddress', ownerAddress);
assert.isETHAddressHex('tokenAddress', tokenAddress);
assert.isBigNumber('amountInBaseUnits', amountInBaseUnits);
@@ -69,6 +69,21 @@ export class TokenWrapper extends ContractWrapper {
gas,
});
}
+ /**
+ * Transfers `amountInBaseUnits` ERC20 tokens from `fromAddress` to `toAddress`.
+ */
+ public async transferAsync(tokenAddress: string, fromAddress: string, toAddress: string,
+ amountInBaseUnits: BigNumber.BigNumber): Promise<void> {
+ assert.isETHAddressHex('tokenAddress', tokenAddress);
+ assert.isETHAddressHex('fromAddress', fromAddress);
+ assert.isETHAddressHex('toAddress', toAddress);
+ assert.isBigNumber('amountInBaseUnits', amountInBaseUnits);
+
+ const tokenContract = await this.getTokenContractAsync(tokenAddress);
+ await tokenContract.transfer(toAddress, amountInBaseUnits, {
+ from: fromAddress,
+ });
+ }
private async getTokenContractAsync(tokenAddress: string): Promise<TokenContract> {
let tokenContract = this.tokenContractsByAddress[tokenAddress];
if (!_.isUndefined(tokenContract)) {