Skip to main content
Use oms.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

guard let walletAddress = oms.wallet.walletAddress else { return }

let result = try await oms.indexer.getBalances(
    GetBalancesParams(
        walletAddress: walletAddress,
        networks: [.polygon],
        contractAddresses: ["0x2222222222222222222222222222222222222222"],
        includeMetadata: true
    )
)

for balance in result.nativeBalances {
    print(balance.symbol ?? "", balance.balance ?? "0")
}

for balance in result.balances {
    print(balance.contractAddress ?? "", balance.balance ?? "0")
}
Parameters
ParameterTypeDescription
walletAddressStringWallet address to inspect. This can be the active non-custodial wallet or any wallet address.
networks[Network]?Explicit SDK network values, such as [.polygon].
networkTypeIndexerNetworkType?Network group used when networks is omitted. Defaults to .mainnets.
contractAddresses[String]?Optional token contract address filters. Omit them to query balances across contracts.
includeMetadataBoolWhether token metadata should be included. Defaults to true.
omitPricesBool?Whether price fields should be omitted.
tokenIds[String]?Optional token ID filter.
contractStatusContractVerificationStatus?Optional contract verification filter.
pageTokenBalancesPageRequest?Optional pagination request. Defaults to page 0 with up to 40 entries.
Returns getBalances returns BalancesResult.
FieldTypeDescription
statusIntHTTP status code from the indexer response.
pageTokenBalancesPage?Pagination metadata from the indexer response.
nativeBalances[TokenBalance]Native token balances returned for the wallet.
balances[TokenBalance]Token contract balances returned for the wallet.

Get Transaction History

guard let walletAddress = oms.wallet.walletAddress else { return }

let history = try await oms.indexer.getTransactionHistory(
    GetTransactionHistoryParams(
        walletAddress: walletAddress,
        networks: [.polygon],
        includeMetadata: true
    )
)

for transaction in history.transactions {
    print(transaction.txnHash, transaction.timestamp)
}
Parameters
ParameterTypeDescription
walletAddressStringWallet address whose history should be fetched.
networks[Network]?Explicit SDK network values.
networkTypeIndexerNetworkType?Network group used when networks is omitted. Defaults to .mainnets.
contractAddresses[String]?Optional contract address filters.
transactionHashes[String]?Optional transaction hash filters.
metaTransactionIds[String]?Optional wallet transaction ID filters, such as txnId returned by transaction APIs.
fromBlockInt?Optional starting block number.
toBlockInt?Optional ending block number.
tokenIdString?Optional token ID filter.
includeMetadataBoolWhether token and contract metadata should be included. Defaults to true.
omitPricesBool?Whether price fields should be omitted.
metadataOptionsMetadataOptions?Optional metadata enrichment filters.
pageTokenBalancesPageRequest?Optional pagination request.
Returns getTransactionHistory returns TransactionHistoryResult.
FieldTypeDescription
statusIntHTTP status code from the indexer response.
pageTokenBalancesPage?Pagination metadata from the indexer response.
transactions[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.
blockNumberInt64?Block number for the balance snapshot.
chainIdInt64?Numeric chain ID.
uniqueCollectiblesString?Unique collectible count for NFT summary rows.
isSummaryBool?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
txnHashStringOnchain transaction hash.
blockNumberInt64Block number.
blockHashStringBlock hash.
chainIdInt64Numeric chain ID.
metaTxnIdString?Wallet transaction ID when available.
transfers[TransactionTransfer]?Token and native transfers detected in the transaction.
timestampStringTransaction timestamp.