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

# Wallet Operations

> Send transactions, transfer stablecoins, sign messages, and read balances from a non-custodial wallet.

Once a user has signed in with a non-custodial wallet, your app can read balances, sign messages, and submit transactions, all without the user leaving your product.

The examples below use the OMS Wallet SDKs.

## Get wallet address

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    const address = oms.wallet.walletAddress

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

    console.log('Wallet address:', address)
    ```
  </Tab>

  <Tab title="React Native">
    ```typescript theme={null}
    const address = await oms.wallet.getWalletAddress()

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

    console.log('Wallet address:', address)
    ```
  </Tab>

  <Tab title="Swift">
    ```swift theme={null}
    guard let address = oms.wallet.walletAddress else {
        throw NSError(domain: "App", code: 1, userInfo: [NSLocalizedDescriptionKey: "No active wallet session"])
    }

    print("Wallet address:", address)
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    val address = requireNotNull(client.wallet.walletAddress) {
        "No wallet selected"
    }

    println("Wallet address: $address")
    ```
  </Tab>
</Tabs>

## Read balances

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    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],
    })

    for (const balance of result.nativeBalances) {
      console.log(balance.symbol, balance.balance)
    }
    ```
  </Tab>

  <Tab title="React Native">
    ```typescript theme={null}
    const walletAddress = await oms.wallet.getWalletAddress()

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

    const polygon = oms.supportedNetworks.find((network) => network.chainId === '137')

    if (!polygon) {
      throw new Error('Polygon network unavailable')
    }

    const result = await oms.indexer.getBalances({
      walletAddress,
      networks: [polygon],
    })

    for (const balance of result.nativeBalances) {
      console.log(balance.symbol, balance.balance)
    }
    ```
  </Tab>

  <Tab title="Swift">
    ```swift theme={null}
    guard let walletAddress = oms.wallet.walletAddress else {
        throw NSError(domain: "App", code: 1, userInfo: [NSLocalizedDescriptionKey: "No active wallet session"])
    }

    let result = try await oms.indexer.getBalances(
        GetBalancesParams(
            walletAddress: walletAddress,
            networks: [.polygon]
        )
    )

    for balance in result.nativeBalances {
        print(balance.symbol ?? "", balance.balance ?? "0")
    }
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    import com.omsclient.kotlin_sdk.Network

    val walletAddress = requireNotNull(client.wallet.walletAddress) {
        "No wallet selected"
    }

    val result = client.indexer.getBalances(
        walletAddress = walletAddress,
        networks = listOf(Network.POLYGON),
    )

    for (balance in result.nativeBalances) {
        println("${balance.symbol}: ${balance.balance}")
    }
    ```
  </Tab>
</Tabs>

## Send a stablecoin payment (USDC)

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Networks } from '@0xsequence/typescript-sdk'
    import { parseUnits, type Abi, type Address } from 'viem'

    const usdcContract = '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359' as Address
    const recipient = '0x1111111111111111111111111111111111111111' as Address
    const amount = parseUnits('10', 6)

    const erc20Abi = [
      {
        name: 'transfer',
        type: 'function',
        stateMutability: 'nonpayable',
        inputs: [
          { name: 'to', type: 'address' },
          { name: 'amount', type: 'uint256' },
        ],
        outputs: [{ type: 'bool' }],
      },
    ] as const satisfies Abi

    const tx = await oms.wallet.sendTransaction({
      network: Networks.polygon,
      to: usdcContract,
      abi: erc20Abi,
      functionName: 'transfer',
      args: [recipient, amount],
    })

    console.log('Transaction:', tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="React Native">
    ```typescript theme={null}
    import { parseUnits } from '@0xsequence/oms-react-native-sdk'

    const amount = parseUnits('10', 6)

    const tx = await oms.wallet.callContract({
      chainId: '137',
      contractAddress: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359',
      method: 'transfer(address,uint256)',
      args: [
        { type: 'address', value: '0x1111111111111111111111111111111111111111' },
        { type: 'uint256', value: amount },
      ],
    })

    console.log('Transaction:', tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="Swift">
    ```swift theme={null}
    let amount = try parseUnits(value: "10", decimals: 6)

    let tx = try await oms.wallet.callContract(
        network: .polygon,
        contract: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
        method: "transfer(address,uint256)",
        args: [
            AbiArg(type: "address", value: .string("0x1111111111111111111111111111111111111111")),
            AbiArg(type: "uint256", value: .string(amount))
        ]
    )

    print("Transaction:", tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    import com.omsclient.kotlin_sdk.Network
    import com.omsclient.kotlin_sdk.models.AbiArg
    import com.omsclient.kotlin_sdk.utils.parseUnits
    import kotlinx.serialization.json.JsonPrimitive

    val amount = parseUnits("10", 6)

    val tx = client.wallet.callContract(
        network = Network.POLYGON,
        contract = "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
        method = "transfer(address,uint256)",
        args = listOf(
            AbiArg(type = "address", value = JsonPrimitive("0x1111111111111111111111111111111111111111")),
            AbiArg(type = "uint256", value = JsonPrimitive(amount.toString())),
        ),
    )

    println("Transaction id: ${tx.txnId}")
    println("Transaction hash: ${tx.txnHash}")
    ```
  </Tab>
</Tabs>

## Send encoded calldata

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Networks } from '@0xsequence/typescript-sdk'
    import type { Address, Hex } from 'viem'

    const tx = await oms.wallet.sendTransaction({
      network: Networks.polygon,
      to: '0x3333333333333333333333333333333333333333' as Address,
      value: 0n,
      data: '0x...' as Hex,
    })

    console.log('Transaction:', tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="React Native">
    ```typescript theme={null}
    const tx = await oms.wallet.sendTransaction({
      chainId: '137',
      to: '0x3333333333333333333333333333333333333333',
      value: '0',
      data: '0x...',
    })

    console.log('Transaction:', tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="Swift">
    ```swift theme={null}
    let tx = try await oms.wallet.sendTransaction(
        network: .polygon,
        request: SendTransactionRequest(
            to: "0x3333333333333333333333333333333333333333",
            value: "0",
            data: "0x..."
        )
    )

    print("Transaction:", tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    import com.omsclient.kotlin_sdk.Network
    import com.omsclient.kotlin_sdk.models.SendTransactionRequest
    import java.math.BigInteger

    val tx = client.wallet.sendTransaction(
        network = Network.POLYGON,
        request = SendTransactionRequest(
            to = "0x3333333333333333333333333333333333333333",
            value = BigInteger.ZERO,
            data = "0x...",
        ),
    )

    println("Transaction id: ${tx.txnId}")
    println("Transaction hash: ${tx.txnHash}")
    ```
  </Tab>
</Tabs>

## Call a contract

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Networks } from '@0xsequence/typescript-sdk'
    import { parseUnits, type Abi, type Address } from 'viem'

    const abi = [
      {
        name: 'transfer',
        type: 'function',
        stateMutability: 'nonpayable',
        inputs: [
          { name: 'to', type: 'address' },
          { name: 'amount', type: 'uint256' },
        ],
        outputs: [{ type: 'bool' }],
      },
    ] as const satisfies Abi

    const tx = await oms.wallet.sendTransaction({
      network: Networks.polygon,
      to: '0x3333333333333333333333333333333333333333' as Address,
      abi,
      functionName: 'transfer',
      args: ['0x1111111111111111111111111111111111111111' as Address, parseUnits('10', 6)],
    })

    console.log('Transaction:', tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="React Native">
    ```typescript theme={null}
    import { parseUnits } from '@0xsequence/oms-react-native-sdk'

    const tx = await oms.wallet.callContract({
      chainId: '137',
      contractAddress: '0x3333333333333333333333333333333333333333',
      method: 'transfer(address,uint256)',
      args: [
        { type: 'address', value: '0x1111111111111111111111111111111111111111' },
        { type: 'uint256', value: parseUnits('10', 6) },
      ],
    })

    console.log('Transaction:', tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="Swift">
    ```swift theme={null}
    let tx = try await oms.wallet.callContract(
        network: .polygon,
        contract: "0x3333333333333333333333333333333333333333",
        method: "transfer(address,uint256)",
        args: [
            AbiArg(type: "address", value: .string("0x1111111111111111111111111111111111111111")),
            AbiArg(type: "uint256", value: .string("10000000"))
        ]
    )

    print("Transaction:", tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    import com.omsclient.kotlin_sdk.Network
    import com.omsclient.kotlin_sdk.models.AbiArg
    import kotlinx.serialization.json.JsonPrimitive

    val tx = client.wallet.callContract(
        network = Network.POLYGON,
        contract = "0x3333333333333333333333333333333333333333",
        method = "transfer(address,uint256)",
        args = listOf(
            AbiArg(type = "address", value = JsonPrimitive("0x1111111111111111111111111111111111111111")),
            AbiArg(type = "uint256", value = JsonPrimitive("10000000")),
        ),
    )

    println("Transaction id: ${tx.txnId}")
    println("Transaction hash: ${tx.txnHash}")
    ```
  </Tab>
</Tabs>

## Sign a message

Used for authentication, consent flows, or off-chain verifications:

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Networks } from '@0xsequence/typescript-sdk'

    const signature = await oms.wallet.signMessage({
      network: Networks.polygon,
      message: 'I authorize this payment of 10 USDC',
    })

    console.log('Signature:', signature)
    ```
  </Tab>

  <Tab title="React Native">
    ```typescript theme={null}
    const signature = await oms.wallet.signMessage(
      '137',
      'I authorize this payment of 10 USDC',
    )

    console.log('Signature:', signature)
    ```
  </Tab>

  <Tab title="Swift">
    ```swift theme={null}
    let signature = try await oms.wallet.signMessage(
        network: .polygon,
        message: "I authorize this payment of 10 USDC"
    )

    print("Signature:", signature)
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    import com.omsclient.kotlin_sdk.Network

    val signature = client.wallet.signMessage(
        network = Network.POLYGON,
        message = "I authorize this payment of 10 USDC",
    )

    println("Signature: $signature")
    ```
  </Tab>
</Tabs>

## Send ERC-20, ERC-721, ERC-1155

Use standard ABI calls for token types that do not have dedicated helpers:

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Networks } from '@0xsequence/typescript-sdk'
    import type { Abi, Address } from 'viem'

    const erc721Abi = [
      {
        name: 'safeTransferFrom',
        type: 'function',
        stateMutability: 'nonpayable',
        inputs: [
          { name: 'from', type: 'address' },
          { name: 'to', type: 'address' },
          { name: 'tokenId', type: 'uint256' },
        ],
        outputs: [],
      },
    ] as const satisfies Abi

    const walletAddress = oms.wallet.walletAddress

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

    const tx = await oms.wallet.sendTransaction({
      network: Networks.polygon,
      to: '0x4444444444444444444444444444444444444444' as Address,
      abi: erc721Abi,
      functionName: 'safeTransferFrom',
      args: [
        walletAddress as Address,
        '0x1111111111111111111111111111111111111111' as Address,
        42n,
      ],
    })

    console.log('NFT transfer:', tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="React Native">
    ```typescript theme={null}
    const walletAddress = await oms.wallet.getWalletAddress()

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

    const tx = await oms.wallet.callContract({
      chainId: '137',
      contractAddress: '0x4444444444444444444444444444444444444444',
      method: 'safeTransferFrom(address,address,uint256)',
      args: [
        { type: 'address', value: walletAddress },
        { type: 'address', value: '0x1111111111111111111111111111111111111111' },
        { type: 'uint256', value: '42' },
      ],
    })

    console.log('NFT transfer:', tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="Swift">
    ```swift theme={null}
    guard let walletAddress = oms.wallet.walletAddress else {
        throw NSError(domain: "App", code: 1, userInfo: [NSLocalizedDescriptionKey: "No active wallet session"])
    }

    let tx = try await oms.wallet.callContract(
        network: .polygon,
        contract: "0x4444444444444444444444444444444444444444",
        method: "safeTransferFrom(address,address,uint256)",
        args: [
            AbiArg(type: "address", value: .string(walletAddress)),
            AbiArg(type: "address", value: .string("0x1111111111111111111111111111111111111111")),
            AbiArg(type: "uint256", value: .string("42"))
        ]
    )

    print("NFT transfer:", tx.txnHash ?? tx.txnId)
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    import com.omsclient.kotlin_sdk.Network
    import com.omsclient.kotlin_sdk.models.AbiArg
    import kotlinx.serialization.json.JsonPrimitive

    val walletAddress = requireNotNull(client.wallet.walletAddress) {
        "No wallet selected"
    }

    val tx = client.wallet.callContract(
        network = Network.POLYGON,
        contract = "0x4444444444444444444444444444444444444444",
        method = "safeTransferFrom(address,address,uint256)",
        args = listOf(
            AbiArg(type = "address", value = JsonPrimitive(walletAddress)),
            AbiArg(type = "address", value = JsonPrimitive("0x1111111111111111111111111111111111111111")),
            AbiArg(type = "uint256", value = JsonPrimitive("42")),
        ),
    )

    println("NFT transfer: ${tx.txnHash ?: tx.txnId}")
    ```
  </Tab>
</Tabs>

## Transaction receipts

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Networks } from '@0xsequence/typescript-sdk'
    import type { Address } from 'viem'

    const tx = await oms.wallet.sendTransaction({
      network: Networks.polygon,
      to: '0x1111111111111111111111111111111111111111' as Address,
      value: 0n,
    })

    console.log('Wallet transaction ID:', tx.txnId)
    console.log('Onchain hash:', tx.txnHash ?? 'pending')
    ```
  </Tab>

  <Tab title="React Native">
    ```typescript theme={null}
    const tx = await oms.wallet.sendTransaction({
      chainId: '137',
      to: '0x1111111111111111111111111111111111111111',
      value: '0',
    })

    console.log('Wallet transaction ID:', tx.txnId)
    console.log('Onchain hash:', tx.txnHash ?? 'pending')
    ```
  </Tab>

  <Tab title="Swift">
    ```swift theme={null}
    let tx = try await oms.wallet.sendTransaction(
        network: .polygon,
        to: "0x1111111111111111111111111111111111111111",
        value: "0"
    )

    print("Wallet transaction ID:", tx.txnId)
    print("Onchain hash:", tx.txnHash ?? "pending")
    ```
  </Tab>

  <Tab title="Kotlin">
    ```kotlin theme={null}
    import com.omsclient.kotlin_sdk.Network
    import java.math.BigInteger

    val tx = client.wallet.sendTransaction(
        network = Network.POLYGON,
        to = "0x1111111111111111111111111111111111111111",
        value = BigInteger.ZERO,
    )

    println("Wallet transaction ID: ${tx.txnId}")
    println("Onchain hash: ${tx.txnHash ?: "pending"}")
    ```
  </Tab>
</Tabs>
