Soldev

Sign transactions

Last updated:

On the client, signers abstract the interface to sign transactions.

A signer is an interface that hides the implementation details of a specific signer (like a wallet in the browser).

await mySigner.signTransactions([myTransaction]);

Usually we construct the transaction by building up a bunch of instructions:

import { pipe } from "@solana/functional";
import { createTransactionMessage } from "@solana/transaction-messages";
import { compileTransaction } from "@solana/transactions";

const myTransactionMessage = pipe(
    createTransactionMessage({ version: 0 }),
    // Add instructions, fee payer, lifetime, etc.
);
const myTransaction = compileTransaction(myTransactionMessage);
const [transactionSignatures] = await mySigner.signTransactions([myTransaction]);

There are 3 categories of signers: