FeeBumpTransactionBuilder
in package
Builder for creating fee bump transactions.
Fee bump transactions allow a third party to pay the fee for an existing transaction, enabling sponsored transactions and fee abstraction patterns. The fee bump wraps an inner transaction and increases its fee to ensure it gets included in the ledger when the original fee is too low.
The new fee must be higher than the inner transaction's fee. The fee bump transaction replaces the inner transaction in the transaction queue.
Example usage:
$innerTx = ...; // Existing transaction
$feeBump = (new FeeBumpTransactionBuilder($innerTx))
->setFeeAccount("GABC...")
->setBaseFee(200)
->build();
Tags
Table of Contents
Methods
- __construct() : mixed
- Constructs a new fee bump transaction builder.
- build() : FeeBumpTransaction
- Builds and returns the fee bump transaction.
- setBaseFee() : FeeBumpTransactionBuilder
- Sets the base fee per operation for the fee bump transaction.
- setFeeAccount() : FeeBumpTransactionBuilder
- Sets the account that will pay the fee for the fee bump transaction.
- setMuxedFeeAccount() : FeeBumpTransactionBuilder
- Sets the muxed account that will pay the fee for the fee bump transaction.
Methods
__construct()
Constructs a new fee bump transaction builder.
public
__construct(Transaction $inner) : mixed
Parameters
- $inner : Transaction
-
The inner transaction to be fee-bumped
build()
Builds and returns the fee bump transaction.
public
build() : FeeBumpTransaction
Creates a FeeBumpTransaction with the configured fee account and base fee wrapping the inner transaction. Both fee account and base fee must be set before calling this method.
Tags
Return values
FeeBumpTransaction —The constructed fee bump transaction
setBaseFee()
Sets the base fee per operation for the fee bump transaction.
public
setBaseFee(int $baseFee) : FeeBumpTransactionBuilder
The base fee is the amount willing to pay per operation, in stroops. The total fee is calculated as: baseFee * (inner operations + 1). This fee must be higher than the inner transaction's base fee.
Parameters
- $baseFee : int
-
The base fee per operation in stroops (minimum 100)
Tags
Return values
FeeBumpTransactionBuilder —This builder instance for method chaining
setFeeAccount()
Sets the account that will pay the fee for the fee bump transaction.
public
setFeeAccount(string $feeAccountId) : FeeBumpTransactionBuilder
The fee account is the source account for the fee bump transaction and must have sufficient balance to cover the new fee. This can be different from the inner transaction's source account.
Parameters
- $feeAccountId : string
-
The account ID (public key) in StrKey format
Return values
FeeBumpTransactionBuilder —This builder instance for method chaining
setMuxedFeeAccount()
Sets the muxed account that will pay the fee for the fee bump transaction.
public
setMuxedFeeAccount(MuxedAccount $feeAccount) : FeeBumpTransactionBuilder
Similar to setFeeAccount but accepts a MuxedAccount directly, allowing for multiplexed accounts that share the same underlying account ID.
Parameters
- $feeAccount : MuxedAccount
-
The muxed account that will pay the fee
Return values
FeeBumpTransactionBuilder —This builder instance for method chaining