getAccountCoinAmountFromSmartContract

abstract suspend fun getAccountCoinAmountFromSmartContract(accountAddress: AccountAddressInput, coinType: MoveValue.MoveStructId? = null, faMetadataAddress: AccountAddressInput? = null): Result<Long, AptosSdkError>

Queries an account's coin balance directly from on-chain smart contracts using a view call.

This mirrors the TS SDK's smart-contract path:

  • 0x1::coin::balance<T> when coinType is provided (or inferred for APT FA metadata)

  • 0x1::primary_fungible_store::balance when only faMetadataAddress is provided

Return

The balance amount, or an AptosSdkError when the view call fails/inputs are invalid.

Parameters

accountAddress

The account address to query.

coinType

Optional coin type (e.g. 0x1::aptos_coin::AptosCoin).

faMetadataAddress

Optional fungible asset metadata address.