From ac4bfaad329343f5c0c218416a497037d03acbb3 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Tue, 27 Nov 2018 21:06:03 -0800 Subject: [PATCH] feat: add sendRawTransaction() --- web3.js/module.flow.js | 3 +++ web3.js/src/connection.js | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/web3.js/module.flow.js b/web3.js/module.flow.js index 52ce6e7298..723d7b1eae 100644 --- a/web3.js/module.flow.js +++ b/web3.js/module.flow.js @@ -69,6 +69,9 @@ declare module '@solana/web3.js' { transaction: Transaction, ...signers: Array ): Promise; + sendRawTransaction( + wireTransaction: Buffer, + ): Promise; onAccountChange( publickey: PublicKey, callback: AccountChangeCallback, diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 99aa1d2408..364f3f54ca 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -421,6 +421,16 @@ export class Connection { } const wireTransaction = transaction.serialize(); + return await this.sendRawTransaction(wireTransaction); + } + + /** + * Send a transaction that has already been signed and serialized into the + * wire format + */ + async sendRawTransaction( + wireTransaction: Buffer, + ): Promise { const unsafeRes = await this._rpcRequest('sendTransaction', [ [...wireTransaction], ]);