Kit
Functions

sendAndConfirmTransactionFactory

Call Signature

sendAndConfirmTransactionFactory(config): SendAndConfirmTransactionWithBlockhashLifetimeFunction

Returns a function that you can call to send a blockhash-based transaction to the network and to wait until it has been confirmed.

Parameters

ParameterTypeDescription
configSendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<"devnet">

Returns

SendAndConfirmTransactionWithBlockhashLifetimeFunction

Example

import { isSolanaError, sendAndConfirmTransactionFactory, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED } from '@solana/kit';
 
const sendAndConfirmTransaction = sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });
 
try {
    await sendAndConfirmTransaction(transaction, { commitment: 'confirmed' });
} catch (e) {
    if (isSolanaError(e, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED)) {
        console.error('This transaction depends on a blockhash that has expired');
    } else {
        throw e;
    }
}

Call Signature

sendAndConfirmTransactionFactory(config): SendAndConfirmTransactionWithBlockhashLifetimeFunction

Returns a function that you can call to send a blockhash-based transaction to the network and to wait until it has been confirmed.

Parameters

ParameterTypeDescription
configSendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<"testnet">

Returns

SendAndConfirmTransactionWithBlockhashLifetimeFunction

Example

import { isSolanaError, sendAndConfirmTransactionFactory, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED } from '@solana/kit';
 
const sendAndConfirmTransaction = sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });
 
try {
    await sendAndConfirmTransaction(transaction, { commitment: 'confirmed' });
} catch (e) {
    if (isSolanaError(e, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED)) {
        console.error('This transaction depends on a blockhash that has expired');
    } else {
        throw e;
    }
}

Call Signature

sendAndConfirmTransactionFactory(config): SendAndConfirmTransactionWithBlockhashLifetimeFunction

Returns a function that you can call to send a blockhash-based transaction to the network and to wait until it has been confirmed.

Parameters

ParameterTypeDescription
configSendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<"mainnet">

Returns

SendAndConfirmTransactionWithBlockhashLifetimeFunction

Example

import { isSolanaError, sendAndConfirmTransactionFactory, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED } from '@solana/kit';
 
const sendAndConfirmTransaction = sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });
 
try {
    await sendAndConfirmTransaction(transaction, { commitment: 'confirmed' });
} catch (e) {
    if (isSolanaError(e, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED)) {
        console.error('This transaction depends on a blockhash that has expired');
    } else {
        throw e;
    }
}

On this page