feat: add sendRawTransaction()
This commit is contained in:
parent
aee383eaec
commit
ac4bfaad32
|
@ -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,
|
||||||
|
|
|
@ -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],
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue