Kit
Functions

assertIsFullySignedTransaction

assertIsFullySignedTransaction<TTransaction>(transaction): asserts transaction is NominalType<"transactionSignedness", "fullySigned"> & Readonly<{ messageBytes: TransactionMessageBytes; signatures: SignaturesMap }> & TTransaction

From time to time you might acquire a Transaction, that you expect to be fully signed, from an untrusted network API or user input. Use this function to assert that such a transaction is fully signed.

Type Parameters

Type Parameter
TTransaction extends Readonly<{ messageBytes: TransactionMessageBytes; signatures: SignaturesMap; }>

Parameters

ParameterType
transactionTTransaction

Returns

asserts transaction is NominalType<"transactionSignedness", "fullySigned"> & Readonly<{ messageBytes: TransactionMessageBytes; signatures: SignaturesMap }> & TTransaction

Example

import { assertIsFullySignedTransaction } from '@solana/transactions';
 
const transaction = getTransactionDecoder().decode(transactionBytes);
try {
    // If this type assertion function doesn't throw, then Typescript will upcast `transaction`
    // to `FullySignedTransaction`.
    assertIsFullySignedTransaction(transaction);
    // At this point we know that the transaction is signed and can be sent to the network.
    await sendAndConfirmTransaction(transaction, { commitment: 'confirmed' });
} catch(e) {
    if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING)) {
        setError(`Missing signatures for ${e.context.addresses.join(', ')}`);
    }
    throw;
}

On this page