Kit
Functions

signAndSendTransactionMessageWithSigners

signAndSendTransactionMessageWithSigners<TTransactionMessage>(transaction, config?): Promise<SignatureBytes>

Extracts all TransactionSigners inside the provided transaction message and uses them to sign it before sending it immediately to the blockchain.

It returns the signature of the sent transaction (i.e. its identifier) as bytes.

Type Parameters

Type ParameterDescription
TTransactionMessage extends Readonly<{ instructions: readonly Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>[]; version: TransactionVersion; }> & TransactionMessageWithFeePayer<string> & TransactionMessageWithSignersThe inferred type of the transaction message provided.

Parameters

ParameterType
transactionTTransactionMessage
config?BaseTransactionSignerConfig

Returns

Promise<SignatureBytes>

Example

import { signAndSendTransactionMessageWithSigners } from '@solana/signers';
 
const transactionSignature = await signAndSendTransactionMessageWithSigners(transactionMessage);
 
// With additional config.
const transactionSignature = await signAndSendTransactionMessageWithSigners(transactionMessage, {
    abortSignal: myAbortController.signal,
});

Remarks

Similarly to the partiallySignTransactionMessageWithSigners function, it first uses all TransactionModifyingSigners sequentially before using all TransactionPartialSigners in parallel. It then sends the transaction using the TransactionSendingSigner it identified.

Composite transaction signers are treated such that at least one sending signer is used if any. When a TransactionSigner implements more than one interface, we use it as a:

The provided transaction must contain exactly one TransactionSendingSigner inside its account metas. If more than one composite signers implement the TransactionSendingSigner interface, one of them will be selected as the sending signer. Otherwise, if multiple TransactionSendingSigners must be selected, the function will throw an error.

If you'd like to assert that a transaction makes use of exactly one TransactionSendingSigner before calling this function, you may use the assertIsTransactionMessageWithSingleSendingSigner function.

Alternatively, you may use the isTransactionMessageWithSingleSendingSigner function to provide a fallback in case the transaction does not contain any sending signer.

See

On this page