TransactionPreconditionsResponse
in package
Represents transaction preconditions for advanced transaction control
Preconditions define constraints that must be satisfied for a transaction to be valid and included in a ledger. These constraints provide fine-grained control over transaction execution timing, sequencing, and authorization beyond basic sequence number requirements.
Available precondition types:
- Time bounds: Valid time range for transaction inclusion (minTime/maxTime)
- Ledger bounds: Valid ledger range for transaction inclusion (minLedger/maxLedger)
- Minimum account sequence: Minimum source account sequence number
- Minimum account sequence age: Minimum age of source account sequence in seconds
- Minimum account sequence ledger gap: Minimum ledger gap since sequence number update
- Extra signers: Additional required signers beyond source account
Preconditions enable use cases like time-locked transactions, coordinated multi-sig operations, and protection against premature transaction execution.
Introduced in Protocol 19 (CAP-21).
Tags
Table of Contents
Methods
- fromJson() : TransactionPreconditionsResponse
- Creates a TransactionPreconditionsResponse instance from JSON data
- getExtraSigners() : array<string|int, string>|null
- Gets the extra signers precondition
- getLedgerBounds() : PreconditionsLedgerBoundsResponse|null
- Gets the ledger bounds precondition
- getMinAccountSequence() : string|null
- Gets the minimum account sequence precondition
- getMinAccountSequenceAge() : string|null
- Gets the minimum account sequence age precondition
- getMinAccountSequenceLedgerGap() : int|null
- Gets the minimum account sequence ledger gap precondition
- getTimeBounds() : PreconditionsTimeBoundsResponse|null
- Gets the time bounds precondition
- loadFromJson() : void
- Loads preconditions data from JSON response
Methods
fromJson()
Creates a TransactionPreconditionsResponse instance from JSON data
public
static fromJson(array<string|int, mixed> $json) : TransactionPreconditionsResponse
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing preconditions data from Horizon
Return values
TransactionPreconditionsResponse —The parsed transaction preconditions response
getExtraSigners()
Gets the extra signers precondition
public
getExtraSigners() : array<string|int, string>|null
Returns the array of additional signer addresses (Ed25519 public keys or pre-authorized transaction hashes) that must sign this transaction beyond the source account signers. If null or empty, no extra signers are required.
Return values
array<string|int, string>|null —Array of extra signer addresses, or null if not set
getLedgerBounds()
Gets the ledger bounds precondition
public
getLedgerBounds() : PreconditionsLedgerBoundsResponse|null
Returns the ledger-based validity window for this transaction. If null, the transaction has no ledger-based constraints.
Return values
PreconditionsLedgerBoundsResponse|null —The ledger bounds, or null if not set
getMinAccountSequence()
Gets the minimum account sequence precondition
public
getMinAccountSequence() : string|null
Returns the minimum sequence number that the source account must have for this transaction to be valid. If null, no minimum sequence constraint is applied.
Return values
string|null —The minimum account sequence as a string, or null if not set
getMinAccountSequenceAge()
Gets the minimum account sequence age precondition
public
getMinAccountSequenceAge() : string|null
Returns the minimum age (in seconds) that the source account's sequence number must have been set for this transaction to be valid. If null, no age constraint is applied.
Return values
string|null —The minimum sequence age in seconds as a string, or null if not set
getMinAccountSequenceLedgerGap()
Gets the minimum account sequence ledger gap precondition
public
getMinAccountSequenceLedgerGap() : int|null
Returns the minimum number of ledgers that must have closed since the source account's sequence number was last updated for this transaction to be valid. If null, no ledger gap constraint is applied.
Return values
int|null —The minimum ledger gap, or null if not set
getTimeBounds()
Gets the time bounds precondition
public
getTimeBounds() : PreconditionsTimeBoundsResponse|null
Returns the time-based validity window for this transaction. If null, the transaction has no time-based constraints.
Return values
PreconditionsTimeBoundsResponse|null —The time bounds, or null if not set
loadFromJson()
Loads preconditions data from JSON response
protected
loadFromJson(array<string|int, mixed> $json) : void
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing preconditions data