Options
All
  • Public
  • Public/Protected
  • All
Menu

Transaction class

Hierarchy

  • Transaction

Index

Constructors

constructor

Properties

Optional feePayer

feePayer?: PublicKey

The transaction fee payer

instructions

instructions: TransactionInstruction[] = []

The instructions to atomically execute

Optional nonceInfo

nonceInfo?: NonceInformation

Optional Nonce information. If populated, transaction will use a durable Nonce hash instead of a recentBlockhash. Must be populated by the caller

Optional recentBlockhash

recentBlockhash?: string

A recent transaction id. Must be populated by the caller

signatures

signatures: SignaturePubkeyPair[] = []

Signatures for the transaction. Typically created by invoking the sign() method

Accessors

signature

  • get signature(): null | Buffer

Methods

add

addSignature

  • addSignature(pubkey: PublicKey, signature: Buffer): void
  • Add an externally created signature to a transaction. The public key must correspond to either the fee payer or a signer account in the transaction instructions.

    Parameters

    Returns void

compileMessage

partialSign

  • partialSign(...signers: Signer[]): void
  • Partially sign a transaction with the specified accounts. All accounts must correspond to either the fee payer or a signer account in the transaction instructions.

    All the caveats from the sign method apply to partialSign

    Parameters

    Returns void

serialize

serializeMessage

  • serializeMessage(): Buffer
  • Get a buffer of the Transaction data that need to be covered by signatures

    Returns Buffer

setSigners

  • Specify the public keys which will be used to sign the Transaction. The first signer will be used as the transaction fee payer account.

    Signatures can be added with either partialSign or addSignature

    deprecated

    Deprecated since v0.84.0. Only the fee payer needs to be specified and it can be set in the Transaction constructor or with the feePayer property.

    Parameters

    Returns void

sign

  • sign(...signers: Signer[]): void
  • Sign the Transaction with the specified signers. Multiple signatures may be applied to a Transaction. The first signature is considered "primary" and is used identify and confirm transactions.

    If the Transaction feePayer is not set, the first signer will be used as the transaction fee payer account.

    Transaction fields should not be modified after the first call to sign, as doing so may invalidate the signature and cause the Transaction to be rejected.

    The Transaction must be assigned a valid recentBlockhash before invoking this method

    Parameters

    Returns void

verifySignatures

  • verifySignatures(): boolean

Static from

  • from(buffer: Buffer | Uint8Array | number[]): Transaction

Static populate

Generated using TypeDoc