SubmitAsyncTransactionResponse
extends Response
in package
Represents the response from an asynchronous transaction submission
Async transaction submission allows clients to submit transactions without waiting for full validation and inclusion in the ledger. This is useful for high-throughput scenarios where immediate feedback is not required. The response includes a status indicating whether the transaction was accepted for processing.
Status values:
- ERROR: Transaction submission failed due to validation errors
- PENDING: Transaction accepted and queued for inclusion in a future ledger
- DUPLICATE: Transaction already submitted and in processing queue
- TRY_AGAIN_LATER: Server temporarily unable to accept the transaction
Use the transaction hash to query transaction status later via GET /transactions/{hash}.
Tags
Table of Contents
Constants
- TX_STATUS_DUPLICATE = 'DUPLICATE'
- TX_STATUS_ERROR = 'ERROR'
- TX_STATUS_PENDING = 'PENDING'
- TX_STATUS_TRY_AGAIN_LATER = 'TRY_AGAIN_LATER'
Properties
- $hash : string
- $httpStatusCode : int
- $txStatus : string
- $httpClient : Client|null
- $rateLimitLimit : int|null
- $rateLimitRemaining : int|null
- $rateLimitReset : int|null
Methods
- __construct() : mixed
- Creates a new SubmitAsyncTransactionResponse
- fromJson() : SubmitAsyncTransactionResponse
- Creates a SubmitAsyncTransactionResponse instance from JSON data
- getHttpClient() : Client|null
- Gets the HTTP client used for pagination requests
- getRateLimitLimit() : int|null
- Returns X-RateLimit-Limit header from the response.
- getRateLimitRemaining() : int|null
- Returns X-RateLimit-Remaining header from the response.
- getRateLimitReset() : int|null
- Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
- setHeaders() : void
- Extracts and sets rate limiting information from HTTP response headers
- setHttpClient() : void
- Sets the HTTP client for making follow-up requests
- loadFromJson() : void
- Loads response data from a JSON array
Constants
TX_STATUS_DUPLICATE
public
mixed
TX_STATUS_DUPLICATE
= 'DUPLICATE'
TX_STATUS_ERROR
public
mixed
TX_STATUS_ERROR
= 'ERROR'
TX_STATUS_PENDING
public
mixed
TX_STATUS_PENDING
= 'PENDING'
TX_STATUS_TRY_AGAIN_LATER
public
mixed
TX_STATUS_TRY_AGAIN_LATER
= 'TRY_AGAIN_LATER'
Properties
$hash
public
string
$hash
$httpStatusCode
public
int
$httpStatusCode
$txStatus
public
string
$txStatus
$httpClient
protected
Client|null
$httpClient
= null
$rateLimitLimit
protected
int|null
$rateLimitLimit
= null
$rateLimitRemaining
protected
int|null
$rateLimitRemaining
= null
$rateLimitReset
protected
int|null
$rateLimitReset
= null
Methods
__construct()
Creates a new SubmitAsyncTransactionResponse
public
__construct(string $txStatus, string $hash, int $httpStatusCode) : mixed
Parameters
- $txStatus : string
-
Status of the transaction submission (ERROR, PENDING, DUPLICATE, TRY_AGAIN_LATER)
- $hash : string
-
The 64-character hexadecimal transaction hash
- $httpStatusCode : int
-
The HTTP status code from the Horizon response
fromJson()
Creates a SubmitAsyncTransactionResponse instance from JSON data
public
static fromJson(array<string|int, mixed> $json, int $httpResponseStatusCode) : SubmitAsyncTransactionResponse
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing async submission response data from Horizon
- $httpResponseStatusCode : int
-
The HTTP status code from the response
Return values
SubmitAsyncTransactionResponse —The parsed async transaction submission response
getHttpClient()
Gets the HTTP client used for pagination requests
public
getHttpClient() : Client|null
Return values
Client|null —The HTTP client instance, or null if not set
getRateLimitLimit()
Returns X-RateLimit-Limit header from the response.
public
getRateLimitLimit() : int|null
This number represents the he maximum number of requests that the current client can make in one hour.
Tags
Return values
int|nullgetRateLimitRemaining()
Returns X-RateLimit-Remaining header from the response.
public
getRateLimitRemaining() : int|null
The number of remaining requests for the current window.
Tags
Return values
int|nullgetRateLimitReset()
Returns X-RateLimit-Reset header from the response. Seconds until a new window starts.
public
getRateLimitReset() : int|null
Tags
Return values
int|nullsetHeaders()
Extracts and sets rate limiting information from HTTP response headers
public
setHeaders(array<string|int, mixed> $headers) : void
This method processes the X-Ratelimit-* headers from the HTTP response and stores them for client access.
Parameters
- $headers : array<string|int, mixed>
-
Associative array of HTTP headers from the response
setHttpClient()
Sets the HTTP client for making follow-up requests
public
setHttpClient([Client|null $httpClient = null ]) : void
Paginated responses contain links to next/previous pages. This HTTP client is used when following those links to fetch additional pages.
Parameters
- $httpClient : Client|null = null
-
The Guzzle HTTP client to use for pagination
loadFromJson()
Loads response data from a JSON array
protected
loadFromJson(array<string|int, mixed> $json) : void
This method is used internally to populate response objects from parsed JSON. Subclasses override this to extract their specific data fields.
Parameters
- $json : array<string|int, mixed>
-
Associative array of parsed JSON data