ExtrasResultCodes
in package
Represents detailed result codes for transaction submission failures
This response provides granular error information when a transaction fails, including both the overall transaction-level result code and individual operation-level result codes. This allows developers to identify exactly which operation failed and why, enabling precise error handling and debugging.
Transaction result codes indicate general failures (e.g., tx_bad_seq, tx_insufficient_balance), while operation result codes show specific operation failures (e.g., op_underfunded, op_no_trust).
Included in SubmitTransactionResponseExtras when a transaction submission fails.
Tags
Table of Contents
Methods
- fromJson() : ExtrasResultCodes
- Creates an ExtrasResultCodes instance from JSON data
- getOperationsResultCodes() : array<string|int, string>
- Gets the array of operation-level result codes
- getTransactionResultCode() : string
- Gets the transaction-level result code
- loadFromJson() : void
- Loads result codes from JSON response data
Methods
fromJson()
Creates an ExtrasResultCodes instance from JSON data
public
static fromJson(array<string|int, mixed> $json) : ExtrasResultCodes
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing result codes from Horizon
Return values
ExtrasResultCodes —The parsed result codes
getOperationsResultCodes()
Gets the array of operation-level result codes
public
getOperationsResultCodes() : array<string|int, string>
Returns an array of result codes for each operation in the transaction, in the same order as the operations. Each code indicates the specific result of that operation (e.g., op_success, op_underfunded, op_no_trust, op_not_authorized).
Return values
array<string|int, string> —Array of operation result codes
getTransactionResultCode()
Gets the transaction-level result code
public
getTransactionResultCode() : string
Returns the overall result code for the transaction, such as tx_failed, tx_bad_seq, tx_insufficient_balance, tx_no_source_account, etc. This indicates why the transaction as a whole failed.
Return values
string —The transaction result code
loadFromJson()
Loads result codes from JSON response data
protected
loadFromJson(array<string|int, mixed> $json) : void
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing result codes