@orca-so/tx-sender
    Preparing search index...

    Function buildTransaction

    • Builds and signs a transaction from the given instructions and configuration.

      Parameters

      • instructions: Instruction<
            string,
            readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[],
        >[]

        Array of instructions to include in the transaction

      • feePayer: KeyPairSigner | NoopSigner

        The signer that will pay for the transaction (must be the SAME instance used to build instructions)

      • OptionallookupTableAddresses: (string | Address)[]

        Optional array of address lookup table addresses to compress the transaction

      Returns Promise<
          Readonly<
              Readonly<
                  { messageBytes: TransactionMessageBytes; signatures: SignaturesMap },
              > & TransactionWithLifetime,
          >,
      >

      // Node.js with KeyPairSigner - fully signed automatically
      const { instructions } = await swapInstructions(rpc, params, pool, 100, keypairSigner);
      const tx = await buildTransaction(instructions, keypairSigner);
      await sendTransaction(tx);

      // Browser with NoopSigner - partially signed, wallet signs separately
      const noopSigner = createNoopSigner(walletAddress);
      const { instructions } = await swapInstructions(rpc, params, pool, 100, noopSigner);
      const partialTx = await buildTransaction(instructions, noopSigner); // Same instance!
      const [signedTx] = await wallet.modifyAndSignTransactions([partialTx]);
      await sendTransaction(signedTx);