@cfxlabsinc/b2b-services
    Preparing search index...

    Solana transaction builder and related helpers

    Index

    Constructors

    Methods

    • Creates an unsigned versioned transaction with compute budget instructions. The transaction has a placeholder blockhash and must be given a real one before sending (see transactionWithBlockhash).

      Parameters

      • __namedParameters: {
            cuLimit?: number | "UNSET";
            cuPrice?: number | bigint | "UNSET";
            instructions: TransactionInstruction[];
            nonceInstruction?: TransactionInstruction;
            payer: Address;
        }
        • OptionalcuLimit?: number | "UNSET"
        • OptionalcuPrice?: number | bigint | "UNSET"
        • instructions: TransactionInstruction[]
        • OptionalnonceInstruction?: TransactionInstruction

          Nonce advance instruction — placed first, before compute budget instructions.

        • payer: Address

      Returns VersionedTransaction

    • Parameters

      • __namedParameters: { nonceAccount: Address }

      Returns Promise<{ instruction: TransactionInstruction; nonce: string }>

      Durable nonce with its instruction

    • Simulate a Solana transaction by sending it to the RPC

      Parameters

      • transaction: VersionedTransaction
      • opts: { sigVerify?: boolean } = {}

      Returns Promise<
          {
              response: {
                  accounts: object[]
                  | null;
                  err: string | object | null;
                  logs: string[] | null;
                  unitsConsumed: number | undefined;
              };
              success: boolean;
          },
      >

    • Remember to sign this transaction before sending it (at least payer)

      Parameters

      • __namedParameters: {
            cuLimit?: number | "UNSET";
            cuPrice?: number | bigint | "UNSET";
            instructions: TransactionInstruction[];
            payer: Address;
        }

      Returns Promise<{ lastValidBlockHeight: number; transaction: VersionedTransaction }>

      Versioned transaction for the given instructions, with freshly-fetched blockhash

    • Remember to sign this transaction before sending it (at least payer and nonce authority)

      Parameters

      • __namedParameters: {
            cuLimit?: number | "UNSET";
            cuPrice?: number | bigint | "UNSET";
            instructions: TransactionInstruction[];
            nonceAccount: Address;
            payer: Address;
        }

      Returns Promise<VersionedTransaction>

      Versioned transaction for the given instructions, with a durable nonce for blockhash