From 5ce16c2cbbf1990b2c74c8c1d78bc8a8c6b26526 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Wed, 7 Nov 2018 14:13:29 -0700 Subject: [PATCH] fix: return signature from transfer transactions --- web3.js/module.flow.js | 2 +- web3.js/src/token-program.js | 5 +++-- web3.js/test/token-program.test.js | 7 ++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index 88de856cde..3297a3f97a 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -170,7 +170,7 @@ declare module '@solana/web3.js' { source: PublicKey, destination: PublicKey, amount: number | TokenAmount, - ): Promise; + ): Promise; approve( owner: Account, account: PublicKey, diff --git a/web3.js/src/token-program.js b/web3.js/src/token-program.js index 85b598d604..51f0a48130 100644 --- a/web3.js/src/token-program.js +++ b/web3.js/src/token-program.js @@ -11,6 +11,7 @@ import {Account} from './account'; import {PublicKey} from './publickey'; import {SystemProgram} from './system-program'; import {Transaction, TransactionInstruction} from './transaction'; +import type {TransactionSignature} from './transaction'; import {sendAndConfirmTransaction} from './util/send-and-confirm-transaction'; import type {Connection} from './connection'; @@ -373,8 +374,8 @@ export class Token { source: PublicKey, destination: PublicKey, amount: number | TokenAmount, - ): Promise { - await sendAndConfirmTransaction( + ): Promise { + return await sendAndConfirmTransaction( this.connection, owner, new Transaction().add( diff --git a/web3.js/test/token-program.test.js b/web3.js/test/token-program.test.js index 7a39a1328e..f6de1a0abb 100644 --- a/web3.js/test/token-program.test.js +++ b/web3.js/test/token-program.test.js @@ -477,7 +477,12 @@ test('transfer', async () => { mockGetSignatureStatus(); } - await testToken.transfer(initialOwner, initialOwnerTokenAccount, dest, 123); + await testToken.transfer( + initialOwner, + initialOwnerTokenAccount, + dest, + 123, + ); { // mock Token.accountInfo()'s getAccountInfo