FeeBumpTransaction
extends AbstractTransaction
in package
Represents a fee bump transaction
Fee bump transactions allow an account to retroactively increase the fee on a previously submitted transaction. This is useful when a transaction is stuck in the queue due to insufficient fees or when network congestion requires higher fees.
The fee bump transaction wraps an existing transaction (the inner transaction) and specifies a new, higher fee. The fee account pays the additional fee, which must be at least the minimum network fee plus the original transaction's fee.
Key Characteristics:
- Contains an inner transaction that must already be signed
- Specifies a fee account (can be different from inner transaction's source)
- New fee must be higher than the inner transaction's fee
- Fee account must sign the fee bump transaction
Use Cases:
- Unstick transactions with low fees
- Priority transaction processing
- Third-party fee sponsorship
Usage:
// Create a fee bump transaction
$feeBump = new FeeBumpTransaction(
$feeAccount,
200000, // New higher fee in stroops
$innerTransaction
);
// Sign and submit $feeBump->sign($feeAccountKeyPair, $network); $response = $sdk->submitTransaction($feeBump);
Tags
Table of Contents
Methods
- __construct() : mixed
- Constructs a new FeeBumpTransaction
- 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
- fromFeeBumpTransactionEnvelope() : FeeBumpTransaction
- getFee() : int
- Gets the fee in stroops
- getFeeAccount() : MuxedAccount
- Gets the fee account
- getInnerTx() : Transaction
- Gets the inner transaction
- 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 fee bump transaction
- toEnvelopeXdr() : XdrTransactionEnvelope
- Converts the fee bump transaction to XDR envelope format
- toEnvelopeXdrBase64() : string
- Converts the transaction to base64-encoded XDR envelope format
- toXdr() : XdrFeeBumpTransaction
- Converts the fee bump transaction to XDR format
Methods
__construct()
Constructs a new FeeBumpTransaction
public
__construct(MuxedAccount $feeAccount, int $fee, Transaction $innerTx) : mixed
Parameters
- $feeAccount : MuxedAccount
-
The account paying the fee (can be muxed)
- $fee : int
-
The new fee in stroops (must be higher than inner transaction fee)
- $innerTx : Transaction
-
The inner transaction to bump
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)
fromFeeBumpTransactionEnvelope()
public
static fromFeeBumpTransactionEnvelope(XdrFeeBumpTransactionEnvelope $envelope) : FeeBumpTransaction
Parameters
- $envelope : XdrFeeBumpTransactionEnvelope
Return values
FeeBumpTransactiongetFee()
Gets the fee in stroops
public
getFee() : int
Return values
int —The fee amount in stroops
getFeeAccount()
Gets the fee account
public
getFeeAccount() : MuxedAccount
Return values
MuxedAccount —The account paying the fee
getInnerTx()
Gets the inner transaction
public
getInnerTx() : Transaction
Return values
Transaction —The wrapped inner transaction
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 fee bump transaction
public
signatureBase(Network $network) : string
Parameters
- $network : Network
-
The network for which to generate the signature base
Tags
Return values
string —The signature base bytes
toEnvelopeXdr()
Converts the fee bump transaction to XDR envelope format
public
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
toXdr()
Converts the fee bump transaction to XDR format
public
toXdr() : XdrFeeBumpTransaction
Return values
XdrFeeBumpTransaction —The XDR representation