Stellar PHP SDK API Documentation

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
see
FeeBumpTransaction
see
Transaction
link

Stellar developer docs

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

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
throws
RuntimeException

If fee account has not been set

throws
RuntimeException

If base fee has not been set

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
throws
InvalidArgumentException

If base fee is less than minimum (100 stroops)

throws
InvalidArgumentException

If base fee is lower than inner transaction's base fee

throws
InvalidArgumentException

If calculated max fee overflows 64-bit integer

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


        
On this page

Search results