AbstractTransaction
in package
Abstract base class for all Stellar transaction types
This class provides common functionality for regular transactions and fee bump transactions, including signature management and XDR serialization. All transactions must be signed by the required signers before submission to the network.
Transaction Types:
- Transaction: Regular transactions containing operations
- FeeBumpTransaction: Wrapper transactions that increase fees for existing transactions
Security Notice: Always verify transaction contents before signing. Private keys should be handled securely and never exposed in logs or transmitted over insecure channels.
Tags
Table of Contents
Methods
- __construct() : mixed
- Constructs a new AbstractTransaction with an empty signature list
- addSignature() : void
- Adds a signature to the transaction
- fromEnvelopeBase64XdrString() : AbstractTransaction
- Creates a transaction from a base64-encoded XDR string
- fromEnvelopeXdr() : AbstractTransaction
- Creates a transaction from an XDR transaction envelope
- getSignatures() : array<string|int, XdrDecoratedSignature>
- Gets all signatures attached to this transaction
- hash() : string
- Calculates the hash of the transaction for signing
- setSignatures() : void
- Sets the signatures for this transaction
- sign() : void
- Signs the transaction with the provided keypair
- signatureBase() : string
- Returns the signature base for this transaction
- toEnvelopeXdr() : XdrTransactionEnvelope
- Converts the transaction to XDR envelope format
- toEnvelopeXdrBase64() : string
- Converts the transaction to base64-encoded XDR envelope format
Methods
__construct()
Constructs a new AbstractTransaction with an empty signature list
public
__construct() : mixed
addSignature()
Adds a signature to the transaction
public
addSignature(XdrDecoratedSignature $signature) : void
Parameters
- $signature : XdrDecoratedSignature
-
The signature to add
fromEnvelopeBase64XdrString()
Creates a transaction from a base64-encoded XDR string
public
static fromEnvelopeBase64XdrString(string $envelope) : AbstractTransaction
Parameters
- $envelope : string
-
Base64-encoded XDR transaction envelope
Tags
Return values
AbstractTransaction —The decoded transaction (Transaction or FeeBumpTransaction)
fromEnvelopeXdr()
Creates a transaction from an XDR transaction envelope
public
static fromEnvelopeXdr(XdrTransactionEnvelope $envelope) : AbstractTransaction
Parameters
- $envelope : XdrTransactionEnvelope
-
The XDR transaction envelope
Tags
Return values
AbstractTransaction —The decoded transaction (Transaction or FeeBumpTransaction)
getSignatures()
Gets all signatures attached to this transaction
public
getSignatures() : array<string|int, XdrDecoratedSignature>
Return values
array<string|int, XdrDecoratedSignature> —Array of decorated signatures
hash()
Calculates the hash of the transaction for signing
public
hash(Network $network) : string
Parameters
- $network : Network
-
The network for which to calculate the hash
Return values
string —The transaction hash
setSignatures()
Sets the signatures for this transaction
public
setSignatures(array<string|int, XdrDecoratedSignature> $signatures) : void
Parameters
- $signatures : array<string|int, XdrDecoratedSignature>
-
Array of decorated signatures
sign()
Signs the transaction with the provided keypair
public
sign(KeyPair $signer, Network $network) : void
Parameters
- $signer : KeyPair
-
The keypair used to sign the transaction (must have private key)
- $network : Network
-
The network for which this transaction is intended
Tags
signatureBase()
Returns the signature base for this transaction
public
abstract signatureBase(Network $network) : string
Parameters
- $network : Network
-
The network for which to generate the signature base
Return values
string —The signature base bytes
toEnvelopeXdr()
Converts the transaction to XDR envelope format
public
abstract toEnvelopeXdr() : XdrTransactionEnvelope
Return values
XdrTransactionEnvelope —The XDR transaction envelope
toEnvelopeXdrBase64()
Converts the transaction to base64-encoded XDR envelope format
public
toEnvelopeXdrBase64() : string
Return values
string —Base64-encoded XDR transaction envelope