• Given an instruction, this method will return a new transaction message with that instruction having been added to the end of the list of existing instructions.

    Type Parameters

    • TTransactionMessage extends TransactionMessage
    • TInstruction extends Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>

    Parameters

    Returns AppendTransactionMessageInstructions<TTransactionMessage, [TInstruction]>

    appendTransactionInstructions if you need to append multiple instructions to a transaction message.

    import { address } from '@solana/addresses';
    import { getUtf8Encoder } from '@solana/codecs-strings';
    import { appendTransactionMessageInstruction } from '@solana/transaction-messages';

    const memoTransactionMessage = appendTransactionMessageInstruction(
    {
    data: getUtf8Encoder().encode('Hello world!'),
    programAddress: address('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'),
    },
    transactionMessage,
    );