get Current Fungible Asset Balances
abstract suspend fun getCurrentFungibleAssetBalances(filter: FungibleAssetBalanceFilter? = null, page: PaginationArgs? = null, minimumLedgerVersion: Long? = null): Result<GetCurrentFungibleAssetBalancesQuery.Data?, AptosIndexerError>
Queries for current fungible asset balances.
Usage
val aptos = Aptos(AptosConfig(AptosSettings(network = Network.DEVNET)))
val userAccount = Account.generate()
aptos.fundAccount(userAccount.accountAddress, 1_000)
val filter = currentFungibleAssetBalancesFilter {
ownerAddress = stringFilter { eq = userAccount.accountAddress.toString() }
assetType = stringFilter { eq = "0x1::aptos_coin::AptosCoin" }
}
val resolution = aptos.getCurrentFungibleAssetBalances(filter = filter)
when (resolution) {
is Result.Ok -> {
val data = resolution.value
println("Successfully retrieved balances: $data")
}
is Result.Err -> {
println("Error retrieving balances: ${resolution.error.message}")
}
}Content copied to clipboard
Return
A Result containing the query data or an AptosIndexerError.
Parameters
filter
Filtering options for the query.
page
Optional pagination arguments.
minimum Ledger Version
Optional ledger version to sync up to before querying.