> ## 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 balances and transaction history for any address without an authenticated 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 '@0xsequence/oms-react-native-sdk'

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 transaction history

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

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`.
