Sponsor Transactions
By using Account abstraction or In-App Wallets, you can sponsor all gas costs for your users transactions.
Sponsored transactions
To set up sponsored transactions, set the sponsorGas
option to true
in the smart account configuration.
All transactions performed with the smart account will then be sponsored by your application. Testnet transactions are free, but you need a valid credit card on file for mainnet transactions.
Try out the demo for yourself in the sponsored transactions playground
To enable account abstraction for in-app wallets, you need to add the smartAccount
prop with the inAppWallet
creation.
This will create an in-app wallet and a smart account for the user. The smart account will be initialized with the in-app wallet as the owner.
You can sponsor transactions simply by passing sponsrGas: true
to the smartAccount
prop. This will allow the smart account to send transactions without the user needing to hold any ETH.
To sponsor transactions for all connected wallets, you can use the sponsorGas
prop on the ConnectButton
or useConnect
hook.
or with the useConnect
hook:
Once connected, all transactions sent via the useSendTransaction
hook or the TransactionButton
component will be sponsored.