AssetResponse
extends Response
in package
Represents an asset issued on the Stellar network
This response contains comprehensive asset details including asset type, code, and issuer, account statistics, balance distributions, flags, and liquidity pool information. Assets can be native (XLM) or issued by specific accounts. The response includes usage metrics across accounts, claimable balances, liquidity pools, and smart contracts.
Key fields:
- Asset type, code, and issuer identification
- Number of accounts holding the asset
- Total balances and distribution statistics
- Asset authorization flags
- Claimable balance and liquidity pool amounts
- Smart contract integration metrics
Returned by Horizon endpoints:
- GET /assets - List of all assets
- GET /assets?asset_code={code}&asset_issuer={issuer} - Specific asset details
Tags
Table of Contents
Properties
- $httpClient : Client|null
- $rateLimitLimit : int|null
- $rateLimitRemaining : int|null
- $rateLimitReset : int|null
Methods
- fromJson() : AssetResponse
- getAccounts() : AssetAccountsResponse
- Gets statistics about accounts holding this asset
- getAssetCode() : string|null
- Gets the asset code for non-native assets
- getAssetIssuer() : string|null
- Gets the account address of the asset issuer
- getAssetType() : string
- Gets the asset type (native, credit_alphanum4, or credit_alphanum12)
- getBalances() : AssetBalancesResponse
- Gets the balance distribution statistics for this asset
- getClaimableBalancesAmount() : string
- Gets the total amount of this asset in claimable balances
- getContractsAmount() : string|null
- Gets the total amount of this asset held in smart contracts
- getFlags() : AssetFlagsResponse
- Gets the authorization flags for this asset
- getHttpClient() : Client|null
- Gets the HTTP client used for pagination requests
- getLinks() : AssetLinksResponse
- Gets the links to related resources for this asset
- getLiquidityPoolsAmount() : string
- Gets the total amount of this asset in liquidity pools
- getNumClaimableBalances() : int
- Gets the number of claimable balances holding this asset
- getNumContracts() : int|null
- Gets the number of smart contracts holding this asset
- getNumLiquidityPools() : int
- Gets the number of liquidity pools containing this asset
- getPagingToken() : string
- Gets the paging token for this asset in list results
- 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.
- setContractsAmount() : void
- Sets the total amount of this asset held in smart contracts
- setHeaders() : void
- Extracts and sets rate limiting information from HTTP response headers
- setHttpClient() : void
- Sets the HTTP client for making follow-up requests
- setNumContracts() : void
- Sets the number of smart contracts holding this asset
- loadFromJson() : void
- Loads response data from a JSON array
Properties
$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
fromJson()
public
static fromJson(array<string|int, mixed> $json) : AssetResponse
Parameters
- $json : array<string|int, mixed>
Return values
AssetResponsegetAccounts()
Gets statistics about accounts holding this asset
public
getAccounts() : AssetAccountsResponse
Return values
AssetAccountsResponse —The account statistics including authorized and unauthorized counts
getAssetCode()
Gets the asset code for non-native assets
public
getAssetCode() : string|null
Return values
string|null —The asset code, or null for native assets
getAssetIssuer()
Gets the account address of the asset issuer
public
getAssetIssuer() : string|null
Return values
string|null —The issuer account ID, or null for native assets
getAssetType()
Gets the asset type (native, credit_alphanum4, or credit_alphanum12)
public
getAssetType() : string
Return values
string —The asset type
getBalances()
Gets the balance distribution statistics for this asset
public
getBalances() : AssetBalancesResponse
Return values
AssetBalancesResponse —The balance distribution across different holder tiers
getClaimableBalancesAmount()
Gets the total amount of this asset in claimable balances
public
getClaimableBalancesAmount() : string
Return values
string —The claimable balances amount
getContractsAmount()
Gets the total amount of this asset held in smart contracts
public
getContractsAmount() : string|null
Return values
string|null —The contracts amount, or null if not available
getFlags()
Gets the authorization flags for this asset
public
getFlags() : AssetFlagsResponse
Return values
AssetFlagsResponse —The asset flags indicating authorization requirements
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
getLinks()
Gets the links to related resources for this asset
public
getLinks() : AssetLinksResponse
Return values
AssetLinksResponse —The navigation links
getLiquidityPoolsAmount()
Gets the total amount of this asset in liquidity pools
public
getLiquidityPoolsAmount() : string
Return values
string —The liquidity pools amount
getNumClaimableBalances()
Gets the number of claimable balances holding this asset
public
getNumClaimableBalances() : int
Return values
int —The count of claimable balances
getNumContracts()
Gets the number of smart contracts holding this asset
public
getNumContracts() : int|null
Return values
int|null —The count of contracts, or null if not available
getNumLiquidityPools()
Gets the number of liquidity pools containing this asset
public
getNumLiquidityPools() : int
Return values
int —The count of liquidity pools
getPagingToken()
Gets the paging token for this asset in list results
public
getPagingToken() : string
Return values
string —The paging token used for cursor-based pagination
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|nullsetContractsAmount()
Sets the total amount of this asset held in smart contracts
public
setContractsAmount(string|null $contractsAmount) : void
Parameters
- $contractsAmount : string|null
-
The contracts amount
setHeaders()
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
setNumContracts()
Sets the number of smart contracts holding this asset
public
setNumContracts(int|null $numContracts) : void
Parameters
- $numContracts : int|null
-
The count of contracts
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