paymasterOptions for the same gasless UX.
What you’ll build
A single button that:- Connects the user (if not yet connected).
- Sends a USDSC
transferfrom the smart account to a recipient address. - Reads the on-chain receipt to confirm the payment.
Prerequisites
- A working connect button.
- A recipient address controlled by your app. For testing, your own EOA on Soneium Minato is fine.
- A smart account funded with USDSC. On Minato, request testnet USDSC from the Startale team in Discord; there is no public USDSC faucet today.
Steps
1. Define constants
src/constants.ts
2. Build the pay button
src/PayButton.tsx
3. Render it
src/App.tsx
4. Verify the receipt
useWaitForTransactionReceipt from wagmi resolves once the transaction lands. The isSuccess flag flips when the receipt is available with status 'success'. For a deeper verification, read the recipient’s USDSC balance after the receipt:
Reading decimals dynamically
Hardcoding6 works today, but if Startale ever upgrades USDSC to use different decimals, the math breaks. The defensive pattern reads them at runtime:
What you’ve learned
- How to send an ERC-20 transfer from the user’s smart account.
- That the user pays no gas, sponsorship is automatic.
- How to confirm settlement on-chain with viem and wagmi.