> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native balances and history

> Query EVM balances and history or Solana balances for any address without a wallet session.

`omsWallet.indexer` is read-only and can query any address. It does not require authentication, an active wallet session, or the address selected by `omsWallet.wallet`.

## Get balances for an address

Pass the address to query and one or more exported networks:

```typescript theme={null}
import {
  Networks,
  type BalancesResult,
} from '@polygonlabs/oms-wallet-react-native'

const result: BalancesResult = await omsWallet.indexer.getBalances({
  walletAddress: '0x1111111111111111111111111111111111111111',
  networks: [Networks.polygon],
  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.tokenId, balance.balance)
}
```

Amounts such as `balance` are raw base-unit strings. Use `formatUnits(balance.balance, decimals)` with the token's actual decimals for display.

`BalancesResult` separates native assets into `NativeTokenBalance[]` and contract assets into `ContractTokenBalance[]`. Contract balances include their contract address and token ID. Price, contract, and token metadata is optional even when requested. Use the [public API reference](/wallets/sdk/react-native/api-reference) when you need every response field.

## Get Solana balances

Use `getSolanaBalances` for native SOL and fungible SPL-token balances. Omitting `networks` queries both Solana Mainnet and Devnet.

```typescript theme={null}
import { SolanaNetworks } from '@polygonlabs/oms-wallet-react-native'

const result = await omsWallet.indexer.getSolanaBalances({
  walletAddress: 'vn3YnndV3gGu7DrHSQAPfywmba7QPq18SvA7PSiytAV',
  networks: [SolanaNetworks.mainnet, SolanaNetworks.devnet],
  includeMetadata: true,
})

for (const balance of result.balances) {
  console.log(balance.network, balance.symbol, balance.formattedBalance)
}

for (const error of result.errors) {
  console.warn(error.network, error.reason)
}
```

Filter fungible tokens with `mintAddresses` or `excludedMintAddresses`, and use `omitNativeBalances` when native SOL is not needed. Individual network failures appear in `errors` without discarding balances returned by another requested network.

The SDK does not expose Solana transaction history. `getTransactionHistory` is for EVM networks.

## Get transaction history

```typescript theme={null}
import type {
  Transaction,
  TransactionHistoryResult,
} from '@polygonlabs/oms-wallet-react-native'

const history: TransactionHistoryResult =
  await omsWallet.indexer.getTransactionHistory({
    walletAddress: '0x1111111111111111111111111111111111111111',
    networks: [Networks.polygon],
    includeMetadata: true,
  })

for (const transaction: Transaction of history.transactions) {
  console.log(transaction.txnHash, transaction.timestamp)
}
```

Each transaction includes its chain, hash, block position, timestamp, and transfers. The OMS transaction ID and transfer metadata are optional.

## Filter queries

Use `networks` for explicit chains. When you omit it, use `networkType` to query `'MAINNETS'`, `'TESTNETS'`, or `'ALL'` supported networks.

Balance filters include contract addresses, token IDs, verification status, metadata inclusion, and price omission:

```typescript theme={null}
const result = await omsWallet.indexer.getBalances({
  walletAddress: '0x1111111111111111111111111111111111111111',
  networkType: 'MAINNETS',
  contractAddresses: ['0x2222222222222222222222222222222222222222'],
  contractStatus: 'VERIFIED',
  includeMetadata: true,
  omitPrices: true,
})
```

History filters include contract addresses, transaction hashes, wallet transaction IDs, block range, token ID, and metadata options:

```typescript theme={null}
const history = await omsWallet.indexer.getTransactionHistory({
  walletAddress: '0x1111111111111111111111111111111111111111',
  networks: [Networks.polygon],
  transactionHashes: ['0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'],
  fromBlock: 70000000,
  metadataOptions: {
    verifiedOnly: true,
    includeContracts: ['0x2222222222222222222222222222222222222222'],
  },
})
```

## Paginate results

Both methods accept a page request:

```typescript theme={null}
const result = await omsWallet.indexer.getBalances({
  walletAddress: '0x1111111111111111111111111111111111111111',
  networks: [Networks.polygon],
  page: { page: 0, pageSize: 40 },
})

if (result.page?.more === true) {
  console.log('Next page:', result.page.page + 1)
}
```

Continue with the next page while `result.page?.more` is `true`.
