> ## 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 Blockchain Interaction

> Send transactions, call contracts, verify signatures, and sign messages with the React Native OMS Wallet SDK.

All wallet operations require `configure` and an active wallet session. React Native wallet, transaction, signature, and balance APIs take `chainId` as a string, such as `137` for Polygon mainnet or `80002` for Polygon Amoy.

```typescript theme={null}
import { getWalletAddress } from '@0xsequence/oms-react-native-sdk'

const walletAddress = await getWalletAddress()

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

## Get Supported Networks

List networks supported by this SDK build.

```typescript theme={null}
import { getSupportedNetworks } from '@0xsequence/oms-react-native-sdk'

const networks = await getSupportedNetworks()
const amoy = networks.find((network) => network.chainId === '80002')

console.log(amoy?.displayName)
```

**Parameters**

Takes no parameters.

**Returns**

Returns `Promise<OmsNetwork[]>`.

| Field               | Type     | Description               |
| ------------------- | -------- | ------------------------- |
| `chainId`           | `string` | EVM chain ID as a string. |
| `name`              | `string` | Network registry name.    |
| `nativeTokenSymbol` | `string` | Native token symbol.      |
| `explorerUrl`       | `string` | Block explorer URL.       |
| `displayName`       | `string` | Display name for UI.      |

## Send A Transaction

`sendTransaction` sends native tokens when you pass `to` and `value`. Values are raw base-unit integer strings.

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

const tx = await sendTransaction({
  chainId: '80002',
  to: '0xRecipient',
  value: parseUnits('0.01', 18),
})

console.log(tx.txnHash ?? tx.txnId)
```

**Parameters**

| Parameter         | Type                                         | Description                                     |
| ----------------- | -------------------------------------------- | ----------------------------------------------- |
| `chainId`         | `string`                                     | EVM chain ID as a string.                       |
| `to`              | `string`                                     | Recipient address or contract address.          |
| `value`           | `string`                                     | Raw base-unit native token value.               |
| `data`            | `string`, `null`, or undefined               | Encoded calldata for raw calldata transactions. |
| `mode`            | `'native'`, `'relayer'`, or undefined        | Transaction mode.                               |
| `selectFeeOption` | `OmsFeeOptionSelector`, `null`, or undefined | Optional callback for selecting a fee option.   |

**Returns**

Returns `Promise<OmsSendTransactionResponse>`.

| Field     | Type               | Description                                       |
| --------- | ------------------ | ------------------------------------------------- |
| `txnId`   | `string`           | Wallet transaction ID.                            |
| `status`  | `string`           | Latest transaction status returned by OMS Wallet. |
| `txnHash` | `string` or `null` | On-chain transaction hash when available.         |

## Send Raw Calldata

Use `data` when you already have encoded calldata.

```typescript theme={null}
import { sendTransaction } from '@0xsequence/oms-react-native-sdk'

const tx = await sendTransaction({
  chainId: '80002',
  to: '0xTokenContract',
  value: '0',
  data: '0xa9059cbb000000000000000000000000...',
})

console.log('Contract transaction:', tx.txnHash ?? tx.txnId)
```

**Parameters**

Use the same `sendTransaction` parameters.

**Returns**

Returns `Promise<OmsSendTransactionResponse>`.

## Call A Contract

Use `callContract` when you want the SDK to submit a method-string contract call.

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

const amount = parseUnits('1', 6)

const tx = await callContract({
  chainId: '80002',
  contractAddress: '0xTokenContract',
  method: 'transfer(address,uint256)',
  args: [
    { type: 'address', value: '0xRecipient' },
    { type: 'uint256', value: amount },
  ],
})

console.log('Contract transaction:', tx.txnHash ?? tx.txnId)
```

**Parameters**

| Parameter         | Type                                         | Description                                                |
| ----------------- | -------------------------------------------- | ---------------------------------------------------------- |
| `chainId`         | `string`                                     | EVM chain ID as a string.                                  |
| `contractAddress` | `string`                                     | Contract address to call.                                  |
| `method`          | `string`                                     | ABI method signature, such as `transfer(address,uint256)`. |
| `args`            | `CallContractArg[]`, `null`, or undefined    | Method arguments as Wallet API ABI args.                   |
| `mode`            | `'native'`, `'relayer'`, or undefined        | Transaction mode.                                          |
| `selectFeeOption` | `OmsFeeOptionSelector`, `null`, or undefined | Optional callback for selecting a fee option.              |

**Returns**

Returns `Promise<OmsSendTransactionResponse>`.

## Select A Fee Option

When OMS Wallet returns fee options, pass `selectFeeOption`. The selector receives fee options enriched with the wallet balance for each token when available.

Use a first-available selector when you want to choose the first fee option whose `availableRaw` balance covers the quoted fee `value`. The current React Native wrapper exposes fee selection through the `selectFeeOption` callback shape.

On testnets, fee options are automatically sponsored, so you usually do not need to choose a fee token.

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

const firstAvailable: OmsFeeOptionSelector = (feeOptions) =>
  feeOptions.find((option) => {
    if (option.availableRaw == null) {
      return false
    }

    return BigInt(option.availableRaw) >= BigInt(option.feeOption.value)
  })?.selection ?? null

const tx = await sendTransaction({
  chainId: '80002',
  to: '0xRecipient',
  value: '0',
  selectFeeOption: firstAvailable,
})
```

Return `option.selection` when choosing a quoted fee option. It uses `tokenId` when present and falls back to the token symbol for native fee options. Returning `null` is only valid for sponsored transactions.

**Parameters**

`selectFeeOption` receives `OmsFeeOptionWithBalance[]`. Each item includes `feeOption`, `selection`, and optional balance fields such as `availableRaw`.

**Returns**

Return `OmsFeeOptionSelection`, `null`, or a promise for either value.

## Get Transaction Status

Fetch the current status for a wallet transaction ID.

```typescript theme={null}
import { getTransactionStatus } from '@0xsequence/oms-react-native-sdk'

const status = await getTransactionStatus(tx.txnId)

console.log(status.status, status.txnHash)
```

**Parameters**

| Parameter | Type     | Description                                                            |
| --------- | -------- | ---------------------------------------------------------------------- |
| `txnId`   | `string` | Wallet transaction ID returned by `sendTransaction` or `callContract`. |

**Returns**

Returns `Promise<OmsTransactionStatus>`.

| Field     | Type               | Description                               |
| --------- | ------------------ | ----------------------------------------- |
| `status`  | `string`           | Latest Wallet transaction status.         |
| `txnHash` | `string` or `null` | On-chain transaction hash when available. |

## Sign A Message

`signMessage` returns a hex-encoded signature for the active wallet.

```typescript theme={null}
import { signMessage } from '@0xsequence/oms-react-native-sdk'

const message = 'Hello from OMS'
const signature = await signMessage('80002', message)

console.log('Signature:', signature)
```

**Parameters**

| Parameter | Type     | Description                |
| --------- | -------- | -------------------------- |
| `chainId` | `string` | EVM chain ID as a string.  |
| `message` | `string` | Plaintext message to sign. |

**Returns**

Returns `Promise<string>`, the hex-encoded signature.

## Verify A Message Signature

`verifyMessageSignature` verifies a message signature against the active wallet session.

```typescript theme={null}
import { verifyMessageSignature } from '@0xsequence/oms-react-native-sdk'

const isValid = await verifyMessageSignature({
  chainId: '80002',
  message,
  signature,
})

console.log('Signature valid:', isValid)
```

**Parameters**

| Parameter   | Type     | Description                      |
| ----------- | -------- | -------------------------------- |
| `chainId`   | `string` | EVM chain ID as a string.        |
| `message`   | `string` | Original plaintext message.      |
| `signature` | `string` | Hex-encoded signature to verify. |

**Returns**

Returns `Promise<boolean>`.

## Sign Typed Data

Use `signTypedData` for EIP-712 typed data.

```typescript theme={null}
import { signTypedData } from '@0xsequence/oms-react-native-sdk'

const typedData = {
  domain: {
    name: 'Example App',
    version: '1',
    chainId: 80002,
  },
  types: {
    Message: [{ name: 'contents', type: 'string' }],
  },
  primaryType: 'Message',
  message: {
    contents: 'Hello from OMS',
  },
}

const typedSignature = await signTypedData({
  chainId: '80002',
  typedData,
})
```

**Parameters**

| Parameter   | Type      | Description                                            |
| ----------- | --------- | ------------------------------------------------------ |
| `chainId`   | `string`  | EVM chain ID as a string.                              |
| `typedData` | `unknown` | EIP-712 typed-data payload. Must be JSON serializable. |

**Returns**

Returns `Promise<string>`, the hex-encoded signature.

## Verify Typed Data

Verify an EIP-712 signature against the active wallet session.

```typescript theme={null}
import { verifyTypedDataSignature } from '@0xsequence/oms-react-native-sdk'

const isTypedDataValid = await verifyTypedDataSignature({
  chainId: '80002',
  typedData,
  signature: typedSignature,
})
```

**Parameters**

| Parameter   | Type      | Description                                                     |
| ----------- | --------- | --------------------------------------------------------------- |
| `chainId`   | `string`  | EVM chain ID as a string.                                       |
| `typedData` | `unknown` | Original EIP-712 typed-data payload. Must be JSON serializable. |
| `signature` | `string`  | Hex-encoded signature to verify.                                |

**Returns**

Returns `Promise<boolean>`.

## Parse Units

Convert a decimal display value to a raw base-unit integer string.

```typescript theme={null}
import { parseUnits } from '@0xsequence/oms-react-native-sdk'

const rawAmount = parseUnits('1.00', 6)

console.log(rawAmount)
```

**Parameters**

| Parameter              | Type                      | Description                                                                              |
| ---------------------- | ------------------------- | ---------------------------------------------------------------------------------------- |
| `value`                | `string`                  | Decimal display value.                                                                   |
| `decimals`             | `number` or undefined     | Token decimals. Defaults to `18`.                                                        |
| `options.roundingMode` | `'reject'` or `'nearest'` | Defaults to `'reject'`. Use `'nearest'` to round fractional precision beyond `decimals`. |

**Returns**

Returns `string`.

## Format Units

Convert a raw base-unit value to a decimal display string.

```typescript theme={null}
import { formatUnits } from '@0xsequence/oms-react-native-sdk'

const displayAmount = formatUnits('1000000', 6)

console.log(displayAmount)
```

**Parameters**

| Parameter  | Type                  | Description                       |
| ---------- | --------------------- | --------------------------------- |
| `value`    | `string` or `bigint`  | Raw base-unit integer value.      |
| `decimals` | `number` or undefined | Token decimals. Defaults to `18`. |

**Returns**

Returns `string`.
