Kit
Functions

sendAndConfirmDurableNonceTransactionFactory

Call Signature

sendAndConfirmDurableNonceTransactionFactory(config): SendAndConfirmDurableNonceTransactionFunction

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

Parameters

ParameterTypeDescription
configSendAndConfirmDurableNonceTransactionFactoryConfig<"devnet">

Returns

SendAndConfirmDurableNonceTransactionFunction

Example

import {
    isSolanaError,
    sendAndConfirmDurableNonceTransactionFactory,
    SOLANA_ERROR__INVALID_NONCE,
    SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND,
} from '@solana/kit';
 
const sendAndConfirmNonceTransaction = sendAndConfirmDurableNonceTransactionFactory({ rpc, rpcSubscriptions });
 
try {
    await sendAndConfirmNonceTransaction(transaction, { commitment: 'confirmed' });
} catch (e) {
    if (isSolanaError(e, SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND)) {
        console.error(
            'The lifetime specified by this transaction refers to a nonce account ' +
                `\`${e.context.nonceAccountAddress}\` that does not exist`,
        );
    } else if (isSolanaError(e, SOLANA_ERROR__INVALID_NONCE)) {
        console.error('This transaction depends on a nonce that is no longer valid');
    } else {
        throw e;
    }
}

Call Signature

sendAndConfirmDurableNonceTransactionFactory(config): SendAndConfirmDurableNonceTransactionFunction

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

Parameters

ParameterTypeDescription
configSendAndConfirmDurableNonceTransactionFactoryConfig<"testnet">

Returns

SendAndConfirmDurableNonceTransactionFunction

Example

import {
    isSolanaError,
    sendAndConfirmDurableNonceTransactionFactory,
    SOLANA_ERROR__INVALID_NONCE,
    SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND,
} from '@solana/kit';
 
const sendAndConfirmNonceTransaction = sendAndConfirmDurableNonceTransactionFactory({ rpc, rpcSubscriptions });
 
try {
    await sendAndConfirmNonceTransaction(transaction, { commitment: 'confirmed' });
} catch (e) {
    if (isSolanaError(e, SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND)) {
        console.error(
            'The lifetime specified by this transaction refers to a nonce account ' +
                `\`${e.context.nonceAccountAddress}\` that does not exist`,
        );
    } else if (isSolanaError(e, SOLANA_ERROR__INVALID_NONCE)) {
        console.error('This transaction depends on a nonce that is no longer valid');
    } else {
        throw e;
    }
}

Call Signature

sendAndConfirmDurableNonceTransactionFactory(config): SendAndConfirmDurableNonceTransactionFunction

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

Parameters

ParameterTypeDescription
configSendAndConfirmDurableNonceTransactionFactoryConfig<"mainnet">

Returns

SendAndConfirmDurableNonceTransactionFunction

Example

import {
    isSolanaError,
    sendAndConfirmDurableNonceTransactionFactory,
    SOLANA_ERROR__INVALID_NONCE,
    SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND,
} from '@solana/kit';
 
const sendAndConfirmNonceTransaction = sendAndConfirmDurableNonceTransactionFactory({ rpc, rpcSubscriptions });
 
try {
    await sendAndConfirmNonceTransaction(transaction, { commitment: 'confirmed' });
} catch (e) {
    if (isSolanaError(e, SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND)) {
        console.error(
            'The lifetime specified by this transaction refers to a nonce account ' +
                `\`${e.context.nonceAccountAddress}\` that does not exist`,
        );
    } else if (isSolanaError(e, SOLANA_ERROR__INVALID_NONCE)) {
        console.error('This transaction depends on a nonce that is no longer valid');
    } else {
        throw e;
    }
}

On this page