get Account Resources
abstract suspend fun getAccountResources(accountAddress: AccountAddressInput, params: SpecificPaginationQueryParams.() -> Unit = {}): Result<List<MoveResource>, AptosSdkError>
Retrieves all Move resources for a specific account.
This function automatically handles pagination, fetching the complete list of resources across multiple API calls if necessary. You can also provide an optional ledger version to view the account's state at a specific point in time.
Note: If the requested ledger version has been pruned by the node, the API will return a 410 HTTP error.
Usage
val address = AccountAddress.fromString("0x...")
val resourcesResult = aptos.getAccountResources(address)
when (resourcesResult) {
is Result.Ok -> println("Account has ${resourcesResult.value.size} resources.")
is Result.Err -> println("Error retrieving resources: ${resourcesResult.error.message}")
}Content copied to clipboard
Return
A Result which is either Ok containing the full list of MoveResources, or Err containing a categorized AptosSdkError.
Parameters
account Address
The address of the Aptos account to query.
params
A lambda to configure optional query parameters, such as limit or ledgerVersion.