Skip to main content

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.

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.
import { getWalletAddress } from 'oms-client-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.
import { getSupportedNetworks } from 'oms-client-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[]>.
FieldTypeDescription
chainIdstringEVM chain ID as a string.
namestringNetwork registry name.
nativeTokenSymbolstringNative token symbol.
explorerUrlstringBlock explorer URL.
displayNamestringDisplay name for UI.

Send A Transaction

sendTransaction sends native tokens when you pass to and value. Values are raw base-unit integer strings.
import { parseUnits, sendTransaction } from 'oms-client-react-native-sdk'

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

console.log(tx.txnHash ?? tx.txnId)
Parameters
ParameterTypeDescription
chainIdstringEVM chain ID as a string.
tostringRecipient address or contract address.
valuestringRaw base-unit native token value.
datastring, null, or undefinedEncoded calldata for raw calldata transactions.
mode'native', 'relayer', or undefinedTransaction mode.
selectFeeOptionOmsFeeOptionSelector, null, or undefinedOptional callback for selecting a fee option.
Returns Returns Promise<OmsSendTransactionResponse>.
FieldTypeDescription
txnIdstringWallet transaction ID.
statusstringLatest transaction status returned by OMS Wallet.
txnHashstring or nullOn-chain transaction hash when available.

Send Raw Calldata

Use data when you already have encoded calldata.
import { sendTransaction } from 'oms-client-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.
import { callContract, parseUnits } from 'oms-client-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
ParameterTypeDescription
chainIdstringEVM chain ID as a string.
contractAddressstringContract address to call.
methodstringABI method signature, such as transfer(address,uint256).
argsCallContractArg[], null, or undefinedMethod arguments as Wallet API ABI args.
mode'native', 'relayer', or undefinedTransaction mode.
selectFeeOptionOmsFeeOptionSelector, null, or undefinedOptional 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. On testnets, fee options are automatically sponsored, so you usually do not need to choose a fee token.
import { sendTransaction } from 'oms-client-react-native-sdk'

const tx = await sendTransaction({
  chainId: '80002',
  to: '0xRecipient',
  value: '0',
  selectFeeOption: async (feeOptions) => {
    const selected =
      feeOptions.find((option) => option.availableRaw !== '0') ?? feeOptions[0]

    return selected ? selected.selection : null
  },
})
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[]. Returns Return OmsFeeOptionSelection, null, or a promise for either value.

Get Transaction Status

Fetch the current status for a wallet transaction ID.
import { getTransactionStatus } from 'oms-client-react-native-sdk'

const status = await getTransactionStatus(tx.txnId)

console.log(status.status, status.txnHash)
Parameters
ParameterTypeDescription
txnIdstringWallet transaction ID returned by sendTransaction or callContract.
Returns Returns Promise<OmsTransactionStatus>.
FieldTypeDescription
statusstringLatest Wallet transaction status.
txnHashstring or nullOn-chain transaction hash when available.

Sign A Message

signMessage returns a hex-encoded signature for the active wallet.
import { signMessage } from 'oms-client-react-native-sdk'

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

console.log('Signature:', signature)
Parameters
ParameterTypeDescription
chainIdstringEVM chain ID as a string.
messagestringPlaintext 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.
import { verifyMessageSignature } from 'oms-client-react-native-sdk'

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

console.log('Signature valid:', isValid)
Parameters
ParameterTypeDescription
chainIdstringEVM chain ID as a string.
messagestringOriginal plaintext message.
signaturestringHex-encoded signature to verify.
Returns Returns Promise<boolean>.

Sign Typed Data

Use signTypedData for EIP-712 typed data.
import { signTypedData } from 'oms-client-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
ParameterTypeDescription
chainIdstringEVM chain ID as a string.
typedDataunknownEIP-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.
import { verifyTypedDataSignature } from 'oms-client-react-native-sdk'

const isTypedDataValid = await verifyTypedDataSignature({
  chainId: '80002',
  typedData,
  signature: typedSignature,
})
Parameters
ParameterTypeDescription
chainIdstringEVM chain ID as a string.
typedDataunknownOriginal EIP-712 typed-data payload. Must be JSON serializable.
signaturestringHex-encoded signature to verify.
Returns Returns Promise<boolean>.

Parse Units

Convert a decimal display value to a raw base-unit integer string.
import { parseUnits } from 'oms-client-react-native-sdk'

const rawAmount = parseUnits('1.00', 6)

console.log(rawAmount)
Parameters
ParameterTypeDescription
valuestringDecimal display value.
decimalsnumber or undefinedToken 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.
import { formatUnits } from 'oms-client-react-native-sdk'

const displayAmount = formatUnits('1000000', 6)

console.log(displayAmount)
Parameters
ParameterTypeDescription
valuestring or bigintRaw base-unit integer value.
decimalsnumber or undefinedToken decimals. Defaults to 18.
Returns Returns string.