getAccountOwnedObjects

abstract suspend fun getAccountOwnedObjects(accountAddress: AccountAddressInput, sortOrder: List<ObjectSortOrder>? = null, page: PaginationArgs? = null, minimumLedgerVersion: Long? = null): Result<GetObjectDataQuery.Data?, AptosIndexerError>

Queries for objects owned by a specific account.

This function can wait for the indexer to be synchronized to a specific ledger version before querying to ensure the data is up-to-date.

Usage

val address = AccountAddress.fromString("0x...")
val resolution = aptos.getAccountOwnedObjects(address)

when (resolution) {
is Result.Ok -> {
val data = resolution.value
println("Successfully retrieved owned objects data: $data")
}
is Result.Err -> println("Error retrieving owned objects: ${resolution.error.message}")
}

Return

A Result which is either Result.Ok containing the query data, or Result.Err containing an AptosIndexerError.

Parameters

accountAddress

The address of the account to query.

sortOrder

An optional list of sorting options for the results.

page

Optional pagination arguments (limit and offset).

minimumLedgerVersion

An optional ledger version. The function will wait for the indexer to be at or beyond this version before querying.