This project is a simple web application that allows users to swap tokens on the Base blockchain without having to pay for gas fees. It uses an open-sourced Paymaster from SBC and common libraries like viem to execute the swaps via the Uniswap V3 Router and WalletConnect to connect to the user's wallet.
You can see it live here. You need to be on the Base blockchain.
After connecting your wallet, you can swap between USDC and SBC tokens in either direction.
You don't need any ETH to pay for gas fees as our Paymaster will cover the fees for you.
To run this project locally, you'll need to set up the following environment variables in your .env file:
# Get a project ID from https://cloud.reown.com/ (WalletConnect)
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=""
# Get an Alchemy RPC endpoint for the Base network from https://alchemy.com/
NEXT_PUBLIC_ALCHEMY_BASE_ENDPOINT=""# 1. Get an API Key for the SBC paymaster from the SBC Dashboard - https://dashboard.stablecoin.xyz/
# 2. Replace YOUR_SBC_API_KEY with your API Key from the SBC Dashboard
NEXT_PUBLIC_AA_BASE_URL="https://api.aa.stablecoin.xyz/rpc/v1/base/YOUR_SBC_API_KEY"# 1. Get your ZeroDev App ID from https://dashboard.zerodev.app/projects (Make sure Base is enabled)
# 2. Replace YOUR_ZERODEV_APP_ID with your ZeroDev app ID
NEXT_PUBLIC_ZERODEV_APP_ID="YOUR_ZERODEV_APP_ID"Install dependencies
npm installStart development server
npm run dev