get SACBalance
suspend fun getSACBalance(contractId: String, asset: Asset, network: Network): GetSACBalanceResponse
Fetches the balance of a Stellar Asset Contract (SAC).
Stellar Asset Contracts are smart contracts that wrap classic Stellar assets, allowing them to be used in Soroban smart contracts. This method retrieves the balance of a specific contract for a given asset.
Example
val contractId = "GABC..."
val asset = Asset.native()
val response = server.getSACBalance(contractId, asset, Network.TESTNET)
response.balanceEntry?.let {
println("Balance: ${it.amount}")
println("Authorized: ${it.authorized}")
}Content copied to clipboard
Return
Balance information if the contract holds the asset
Parameters
contract Id
The contract address holding the asset
asset
The Stellar asset to check balance for
network
The network (needed for asset contract ID calculation)
See also
Throws
If contractId is not a valid contract address
If the RPC request fails