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], ]);