Send USDC (or other ERC-20s)
In this recipe you’ll construct an ERC-20 transfer
call and submit it through a Smart Account Client. The same pattern works for any ERC-20 token; just swap the token address and number of decimals.
Prefer code? Jump straight to the React or Core tabs below.
Prerequisites
- Smart wallets integrated in your app (see the React quickstart or Core quickstart).
- The quickstart uses Arbitrum Sepolia, so make sure your gas policy is configured for Arbitrum Sepolia if you’re using the default settings.
- The USDC contract address for your target chain. For Arbitrum Sepolia this is
0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d
.
- Visit Circle’s documentation for USDC addresses on other chains.
1. Encode the transfer
calldata
2. Send the transaction
React (hook)
Core (vanilla JS)
3. Wait for the transaction to be mined
If you’re using the React hooks with waitForTxn: true
, the transaction will automatically be waited for. You can access the transaction hash from sendUserOperationResult
:
Alternatively, you can manually wait for the transaction:
Next steps
- Parameterize the token address/decimals to support any ERC-20.
- Batch multiple user operations in one request (e.g. aprrove, transfer, etc).
- Combine with sponsored gas for a completely gas-less UX.