Transaction
Class representing a transaction model. This object is passed in send_transaction method
class Transaction(self, **config)
A completely empty transaction can be initialized without any config, the table below shows the available config options
Config | Description |
---|---|
recent_blockhash | Optional, latest on is fetched if not provided |
nonce_info | Alternative to recent_blockhash |
fee_payer | First signer's public key is used if this is not provided |
signers | List of keypairs who will sign the transaction. |
instructions | List of Instructions which the transaction will execute |
signatures | Initialize with externally created signatures |
Methods
Attributes
Methods
.compile_transaction
Compiles all the transaction data.
def compile_transaction()
.serialize_message
This method runs the [#compile_transaction] method and serializes the message returned from it.
def serialize_message()
.sign
Signs the transaction by the sender.
def sign()
.add_signature
Adds an externally created signature to the transaction object. Public key and signature (in bytes) are required arguments.
def add_signature(pubkey: PublicKey | str, signature: bytes)
This method is not stable right now.
.add_signer
Add a signer to the transaction object. The signer should be a keypair object.
def add_signer(keypair: Keypair)
This method is not stable right now.
.verify_signatures
Verify if the signatures are correct in a complete signed transaction object.
def verify_signatures()
.serialize
This method serializes the message to bytes.
def serialize()
Attributes
.instructions
Returns all transaction instructions.
.signatures
Returns all the signatures of the transaction object.
.recent_blockhash
Returns the recent blockhash of the transaction object.