feat: add sendRawTransaction()

This commit is contained in:
Michael Vines 2018-11-27 21:06:03 -08:00
parent aee383eaec
commit ac4bfaad32
2 changed files with 13 additions and 0 deletions

View File

@ -69,6 +69,9 @@ declare module '@solana/web3.js' {
transaction: Transaction, transaction: Transaction,
...signers: Array<Account> ...signers: Array<Account>
): Promise<TransactionSignature>; ): Promise<TransactionSignature>;
sendRawTransaction(
wireTransaction: Buffer,
): Promise<TransactionSignature>;
onAccountChange( onAccountChange(
publickey: PublicKey, publickey: PublicKey,
callback: AccountChangeCallback, callback: AccountChangeCallback,

View File

@ -421,6 +421,16 @@ export class Connection {
} }
const wireTransaction = transaction.serialize(); 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<TransactionSignature> {
const unsafeRes = await this._rpcRequest('sendTransaction', [ const unsafeRes = await this._rpcRequest('sendTransaction', [
[...wireTransaction], [...wireTransaction],
]); ]);