Skip to main content
Use client.indexer for wallet balance and transaction history reads. Requests use the publishable key configured on OMSClient, and balance amounts are returned as raw base-unit strings. Pass explicit SDK Network values with networks, or omit networks and use networkType. When both are omitted, the indexer request defaults to mainnets.

Get Balances

import com.omsclient.kotlin_sdk.Network

val walletAddress = requireNotNull(client.wallet.walletAddress) {
    "No wallet selected"
}

val result = client.indexer.getBalances(
    walletAddress = walletAddress,
    networks = listOf(Network.POLYGON),
    contractAddresses = listOf("0x2222222222222222222222222222222222222222"),
    includeMetadata = true,
)

for (balance in result.nativeBalances) {
    println("${balance.symbol}: ${balance.balance}")
}

for (balance in result.balances) {
    println("${balance.contractAddress}: ${balance.balance}")
}
Parameters
ParameterTypeDescription
walletAddressStringWallet address to inspect. This can be the active non-custodial wallet or any wallet address.
networksList<Network>Explicit SDK network values, such as listOf(Network.POLYGON).
networkTypeIndexerNetworkTypeNetwork group used when networks is empty. Defaults to IndexerNetworkType.MAINNETS.
contractAddressesList<String>Optional token contract address filters. Omit them to query balances across contracts.
includeMetadataBooleanWhether token metadata should be included. Defaults to true.
omitPricesBoolean?Whether price fields should be omitted.
tokenIdsList<String>Optional token ID filter.
contractStatusContractVerificationStatus?Optional contract verification filter.
pageTokenBalancesPageRequestOptional pagination request. Defaults to page 0 with up to 40 entries.
Returns getBalances returns TokenBalancesResult.
FieldTypeDescription
statusIntHTTP status code from the indexer response.
pageTokenBalancesPage?Pagination metadata from the indexer response.
nativeBalancesList<TokenBalance>Native token balances returned for the wallet.
balancesList<TokenBalance>Token contract balances returned for the wallet.

Get Transaction History

import com.omsclient.kotlin_sdk.Network

val walletAddress = requireNotNull(client.wallet.walletAddress) {
    "No wallet selected"
}

val history = client.indexer.getTransactionHistory(
    walletAddress = walletAddress,
    networks = listOf(Network.POLYGON),
    includeMetadata = true,
)

for (transaction in history.transactions) {
    println("${transaction.txnHash}: ${transaction.timestamp}")
}
Parameters
ParameterTypeDescription
walletAddressStringWallet address whose history should be fetched.
networksList<Network>Explicit SDK network values.
networkTypeIndexerNetworkTypeNetwork group used when networks is empty. Defaults to IndexerNetworkType.MAINNETS.
contractAddressesList<String>Optional contract address filters.
transactionHashesList<String>Optional transaction hash filters.
metaTransactionIdsList<String>Optional wallet transaction ID filters, such as txnId returned by transaction APIs.
fromBlockLong?Optional starting block number.
toBlockLong?Optional ending block number.
tokenIdString?Optional token ID filter.
includeMetadataBooleanWhether token and contract metadata should be included. Defaults to true.
omitPricesBoolean?Whether price fields should be omitted.
metadataOptionsMetadataOptions?Optional metadata enrichment filters.
pageTokenBalancesPageRequestOptional pagination request.
Returns getTransactionHistory returns TransactionHistoryResult.
FieldTypeDescription
statusIntHTTP status code from the indexer response.
pageTokenBalancesPage?Pagination metadata from the indexer response.
transactionsList<Transaction>Transactions returned for the wallet.

Token Balance Shape

Each TokenBalance can include:
FieldTypeDescription
contractTypeString?Token contract type, such as ERC20, ERC721, or NATIVE.
contractAddressString?Token contract address. Native token balances do not include a contract address.
accountAddressString?Wallet address queried.
tokenIdString?Token ID for token types that use IDs.
nameString?Token name when returned by the indexer.
symbolString?Token symbol when returned by the indexer.
balanceString?Raw base-unit balance as a string.
balanceUSDString?Balance value in USD when price data is returned.
priceUSDString?Token price in USD when price data is returned.
priceUpdatedAtString?Timestamp for the returned price data.
blockHashString?Block hash for the balance snapshot.
blockNumberLong?Block number for the balance snapshot.
chainIdLong?Numeric chain ID.
uniqueCollectiblesString?Unique collectible count for NFT summary rows.
isSummaryBoolean?Whether the row is a summary balance.
contractInfoTokenContractInfo?Contract metadata when includeMetadata is true.
tokenMetadataTokenMetadata?Token metadata when includeMetadata is true.

Transaction Shape

Each Transaction can include:
FieldTypeDescription
txnHashString?Onchain transaction hash.
blockNumberLong?Block number.
blockHashString?Block hash.
chainIdLong?Numeric chain ID.
metaTxnIdString?Wallet transaction ID when available.
transfersList<TransactionTransfer>?Token and native transfers detected in the transaction.
timestampString?Transaction timestamp.