# Send transaction

Send onchain Ethereum transactions from your user's embedded wallet using the `wallet_sendCalls` RPC method.

### Send an ERC-20 transfer

The Expo-based recipes in `@recipes-hub/usdc` and `@recipes-hub/hyperliquid` show full flows that combine transfers with on-chain reads. The helper below focuses on a simple ERC-20 transfer.

:::info
This example uses a testnet USDC token address for demonstration purposes. This is not the real mainnet USDC token.
:::

```tsx [useSendUsdc.ts]
import { useMemo } from 'react'
import { encodeFunctionData, parseUnits } from 'viem'
import { useEmbeddedEthereumWallet } from '@openfort/react-native'

const usdcAddress = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' // replace with your token
const usdcAbi = [{
  name: 'transfer',
  type: 'function',
  stateMutability: 'nonpayable',
  inputs: [
    { name: 'to', type: 'address' },
    { name: 'amount', type: 'uint256' },
  ],
  outputs: [{ name: 'success', type: 'bool' }],
}]

export function useSendUsdc(chainIdHex = '0xaa36a7') {
  const ethereum = useEmbeddedEthereumWallet()

  return useMemo(() => {
    if (ethereum.status !== 'connected') return null

    return async (to: `0x${string}`, amount: string) => {
      const units = parseUnits(amount, 6)
      const data = encodeFunctionData({ abi: usdcAbi, functionName: 'transfer', args: [to, units] })

      return await ethereum.provider.request({
        method: 'wallet_sendCalls',
        params: [{
          version: '1.0',
          chainId: chainIdHex,
          from: ethereum.activeWallet.address,
          calls: [{ to: usdcAddress, value: '0x0', data }],
        }],
      })
    }
  }, [ethereum, chainIdHex])
}
```

Invoke this function from a button handler or mutation. To build richer experiences (polling balances, orchestrating multi-call flows) follow the patterns in the recipes referenced above.

### Sponsor gas from the dashboard

gas sponsorship keeps those actions ETH-free for users — or lets you collect ERC-20 reimbursements — by leveraging the Openfort dashboard.

:::info
gas sponsorship applies to **Ethereum wallets only**. For Solana gasless transactions, see [Solana Paymaster](/docs/products/infrastructure/paymaster/solana) or [Send transaction (Solana)](/docs/products/embedded-wallet/react-native/wallet/actions/send-transaction/solana#gasless-solana-transactions).
:::

1. Open [**Dashboard → gas sponsorships**](https://dashboard.openfort.io/policies), add a gas sponsorship, and copy the generated `pol_...` identifier.
2. Restrict eligibility by chain and method (for example `wallet_sendCalls` on Base Sepolia).
3. Pick a **Sponsorship mode**: **App pays** covers gas so users transact for free, or **User pays** lets users pay gas in a token you choose. On EVM you select a network and a gas-payment token — supported stablecoins (USDC, USDT, DAI, WETH) are priced automatically, or you set a fixed amount per transaction.

Attach the gas sponsorship ID directly in `walletConfig` so the React Native SDK applies it to every bundle.

```tsx [app/_layout.tsx]
<OpenfortProvider
  publishableKey="YOUR_PROJECT_PUBLISHABLE_KEY"
  walletConfig={{
    shieldPublishableKey: "YOUR_SHIELD_PUBLISHABLE_KEY",
    createEncryptedSessionEndpoint: "https://your-backend.com/api/protected-create-encryption-session",
    feeSponsorshipId: {
      [84532 /* Base Sepolia */]: 'pol_...',
    },
  }}
>
  <Slot />
</OpenfortProvider>
```

gas sponsorship changes go live immediately; any subsequent `wallet_sendCalls` requests inherit the latest sponsorship configuration.

### More examples

* [`MainAppScreen.tsx`](https://github.com/openfort-xyz/recipes-hub/tree/main/usdc/components/MainAppScreen.tsx) — drives gas-sponsored USDC transfers between embedded wallets.
* [`UserScreen.tsx`](https://github.com/openfort-xyz/recipes-hub/tree/main/hyperliquid/components/UserScreen.tsx) — combines transfers with third-party API calls in a mobile trading UI.
