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 entries with networks, or omit networks and use networkType. When both are omitted, the indexer request defaults to mainnets.

Get Balances

import { Networks } from '@0xsequence/typescript-sdk'

const walletAddress = oms.wallet.walletAddress

if (!walletAddress) {
  throw new Error('No active wallet session')
}

const result = await oms.indexer.getBalances({
  walletAddress,
  networks: [Networks.polygon],
  contractAddresses: ['0x2222222222222222222222222222222222222222'],
  includeMetadata: true,
})

for (const balance of result.nativeBalances) {
  console.log(balance.symbol, balance.balance)
}

for (const balance of result.balances) {
  console.log(balance.contractAddress, balance.balance)
}
Parameters
ParameterTypeDescription
walletAddressstringWallet address to inspect. This can be the active non-custodial wallet or any wallet address.
networksNetwork[] or undefinedExplicit SDK network entries, such as [Networks.polygon].
networkType'MAINNETS', 'TESTNETS', or 'ALL'Network group used when networks is omitted. Defaults to 'MAINNETS'.
contractAddressesstring[] or undefinedOptional token contract address filters. Omit them to query balances across contracts.
includeMetadataboolean or undefinedWhether token metadata should be included. Defaults to true.
omitPricesboolean or undefinedWhether price fields should be omitted.
tokenIdsstring[] or undefinedOptional token ID filter.
contractStatusContractVerificationStatus or undefinedOptional contract verification filter.
pageTokenBalancesPage or undefinedOptional pagination request. Defaults to page 0 with up to 40 entries.
Returns getBalances returns Promise<BalancesResult>.
FieldTypeDescription
statusnumberHTTP status code from the indexer response.
pageTokenBalancesPage or undefinedPagination metadata from the indexer response.
nativeBalancesTokenBalance[]Native token balances returned for the wallet.
balancesTokenBalance[]Token contract balances returned for the wallet.

Get Transaction History

import { Networks } from '@0xsequence/typescript-sdk'

const walletAddress = oms.wallet.walletAddress

if (!walletAddress) {
  throw new Error('No active wallet session')
}

const history = await oms.indexer.getTransactionHistory({
  walletAddress,
  networks: [Networks.polygon],
  includeMetadata: true,
})

for (const transaction of history.transactions) {
  console.log(transaction.txnHash, transaction.timestamp)
}
Parameters
ParameterTypeDescription
walletAddressstringWallet address whose history should be fetched.
networksNetwork[] or undefinedExplicit SDK network entries.
networkType'MAINNETS', 'TESTNETS', or 'ALL'Network group used when networks is omitted. Defaults to 'MAINNETS'.
contractAddressesstring[] or undefinedOptional contract address filters.
transactionHashesstring[] or undefinedOptional transaction hash filters.
metaTransactionIdsstring[] or undefinedOptional wallet transaction ID filters, such as txnId returned by transaction APIs.
fromBlocknumber or undefinedOptional starting block number.
toBlocknumber or undefinedOptional ending block number.
tokenIdstring or undefinedOptional token ID filter.
includeMetadataboolean or undefinedWhether token and contract metadata should be included. Defaults to true.
omitPricesboolean or undefinedWhether price fields should be omitted.
metadataOptionsMetadataOptions or undefinedOptional metadata enrichment filters.
pageTokenBalancesPage or undefinedOptional pagination request.
Returns getTransactionHistory returns Promise<TransactionHistoryResult>.
FieldTypeDescription
statusnumberHTTP status code from the indexer response.
pageTokenBalancesPage or undefinedPagination metadata from the indexer response.
transactionsTransaction[]Transactions returned for the wallet.

Token Balance Shape

Each TokenBalance can include:
FieldTypeDescription
contractTypestring or undefinedToken contract type, such as ERC20, ERC721, or NATIVE.
contractAddressstring or undefinedToken contract address. Native token balances do not include a contract address.
accountAddressstring or undefinedWallet address queried.
tokenIdstring or undefinedToken ID for token types that use IDs.
namestring or undefinedToken name when returned by the indexer.
symbolstring or undefinedToken symbol when returned by the indexer.
balancestring or undefinedRaw base-unit balance as a string.
balanceUSDstring or undefinedBalance value in USD when price data is returned.
priceUSDstring or undefinedToken price in USD when price data is returned.
priceUpdatedAtstring or undefinedTimestamp for the returned price data.
blockHashstring or undefinedBlock hash for the balance snapshot.
blockNumbernumber or undefinedBlock number for the balance snapshot.
chainIdnumber or undefinedNumeric chain ID.
uniqueCollectiblesstring or undefinedUnique collectible count for NFT summary rows.
isSummaryboolean or undefinedWhether the row is a summary balance.
contractInfoTokenContractInfo or undefinedContract metadata when includeMetadata is true.
tokenMetadataTokenMetadata or undefinedToken metadata when includeMetadata is true.

Transaction Shape

Each Transaction can include:
FieldTypeDescription
txnHashstringOnchain transaction hash.
blockNumbernumberBlock number.
blockHashstringBlock hash.
chainIdnumberNumeric chain ID.
metaTxnIdstring or undefinedWallet transaction ID when available.
transfersTransactionTransfer[] or undefinedToken and native transfers detected in the transaction.
timestampstringTransaction timestamp.