This example dapp follows EIP-5792 for batch calls and EIP-7677 for gas sponsorship.
- Wallet connector library: Appkit by reown
- Ethereum Interface library: wagmi and viem
-
Wallet Capability Check
The dapp uses wagmi's useCapabilities hook to assess the features of the connected wallet, such as sponsorship capabilities. -
Transaction Submission
If the wallet supports sponsorship through paymaster capabilities, the dapp proceeds to send the transaction using the useSendCalls hook, which includes the paymaster URL and the sponsorship policy ID in the context field. -
Transaction Status Tracking
The dapp uses useCallsStatus hook to monitor the status of the transaction.. -
Fallback Mechanism
In cases where the wallet does not support any capabilities, the dapp fallback to wagmi's standard useSendTransaction hook to handle sending the transaction.
- Go to Candide Dashboard and create both an app and a gas policy.
- Copy your api key from the app and the Sponsorship Policy ID from the gas policy.
- Rename
.env.example
to.env
and paste in your api key and policy id. - Run
pnpm install
to install dependencies. - Run
pnpm run dev
to start the development server.