AccountBalanceResponse
in package
Represents a single asset balance held by an account
This response contains detailed information about an asset balance including the amount, asset details, liabilities, authorization flags, and sponsorship information. Balance entries can represent native XLM, issued assets, or liquidity pool shares.
Key fields:
- Balance amount and asset identification
- Buying and selling liabilities from open offers
- Authorization status for issued assets
- Trustline limit for non-native assets
- Clawback enabled flag
- Sponsorship information
This response is included in AccountResponse as part of the balances array.
Tags
Table of Contents
Methods
- fromJson() : AccountBalanceResponse
- Creates an AccountBalanceResponse instance from JSON data
- getAssetCode() : string|null
- Gets the asset code for issued assets
- getAssetIssuer() : string|null
- Gets the asset issuer account ID for issued assets
- getAssetType() : string
- Gets the asset type
- getBalance() : string
- Gets the balance amount for this asset
- getBuyingLiabilities() : string|null
- Gets the buying liabilities for this asset from open offers
- getIsAuthorized() : bool|null
- Gets whether this trustline is fully authorized by the issuer
- getIsAuthorizedToMaintainLiabilities() : bool|null
- Gets whether this trustline is authorized to maintain liabilities
- getIsClawbackEnabled() : bool|null
- Gets whether clawback is enabled for this asset
- getLastModifiedLedger() : int|null
- Gets the ledger sequence number when this balance was last modified
- getLimit() : string|null
- Gets the maximum balance limit for this trustline
- getLiquidityPoolId() : string|null
- Gets the liquidity pool ID for liquidity pool shares
- getSellingLiabilities() : string|null
- Gets the selling liabilities for this asset from open offers
- getSponsor() : string|null
- Gets the sponsor account ID for this balance entry
- loadFromJson() : void
Methods
fromJson()
Creates an AccountBalanceResponse instance from JSON data
public
static fromJson(array<string|int, mixed> $json) : AccountBalanceResponse
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing balance data from Horizon
Return values
AccountBalanceResponse —The parsed balance response
getAssetCode()
Gets the asset code for issued assets
public
getAssetCode() : string|null
Only present for credit_alphanum4 and credit_alphanum12 assets.
Return values
string|null —The asset code, or null for native assets
getAssetIssuer()
Gets the asset issuer account ID for issued assets
public
getAssetIssuer() : string|null
Only present for credit_alphanum4 and credit_alphanum12 assets.
Return values
string|null —The issuer account ID, or null for native assets
getAssetType()
Gets the asset type
public
getAssetType() : string
Can be "native", "credit_alphanum4", "credit_alphanum12", or "liquidity_pool_shares".
Return values
string —The asset type
getBalance()
Gets the balance amount for this asset
public
getBalance() : string
Return values
string —The balance amount as a string to preserve precision
getBuyingLiabilities()
Gets the buying liabilities for this asset from open offers
public
getBuyingLiabilities() : string|null
The amount reserved for buying other assets.
Return values
string|null —The buying liabilities amount, or null if not applicable
getIsAuthorized()
Gets whether this trustline is fully authorized by the issuer
public
getIsAuthorized() : bool|null
Only relevant for issued assets with authorization required.
Return values
bool|null —True if authorized, false if not, null if not applicable
getIsAuthorizedToMaintainLiabilities()
Gets whether this trustline is authorized to maintain liabilities
public
getIsAuthorizedToMaintainLiabilities() : bool|null
When true, the account can maintain existing offers but not receive new funds.
Return values
bool|null —True if authorized to maintain liabilities, null if not applicable
getIsClawbackEnabled()
Gets whether clawback is enabled for this asset
public
getIsClawbackEnabled() : bool|null
When true, the issuer can clawback this asset from the account.
Return values
bool|null —True if clawback enabled, null if not applicable
getLastModifiedLedger()
Gets the ledger sequence number when this balance was last modified
public
getLastModifiedLedger() : int|null
Return values
int|null —The ledger sequence number, or null if not available
getLimit()
Gets the maximum balance limit for this trustline
public
getLimit() : string|null
Only present for issued assets. Native assets have no limit.
Return values
string|null —The trustline limit, or null for native assets
getLiquidityPoolId()
Gets the liquidity pool ID for liquidity pool shares
public
getLiquidityPoolId() : string|null
Only present when asset type is liquidity_pool_shares.
Return values
string|null —The liquidity pool ID, or null for other asset types
getSellingLiabilities()
Gets the selling liabilities for this asset from open offers
public
getSellingLiabilities() : string|null
The amount reserved for selling this asset.
Return values
string|null —The selling liabilities amount, or null if not applicable
getSponsor()
Gets the sponsor account ID for this balance entry
public
getSponsor() : string|null
Return values
string|null —The sponsor account ID, or null if not sponsored
loadFromJson()
protected
loadFromJson(array<string|int, mixed> $json) : void
Parameters
- $json : array<string|int, mixed>