Sponsor Transactions

By combining Account abstraction and In-App Wallet, you can create a truly seamless user experience:

  • Gasless transactions sponsored by your application
  • Batched transactions
  • Full account recovery the user "account"

Configure in-app wallet for sponsored transactions

To enable account abstraction in your app, you need to add the smartAccount prop with the inAppWallet creation.

import { ConnectButton } from "thirdweb/react";
import { inAppWallet } from "thirdweb/wallets";
import { sepolia } from "thirdweb/chains";
const wallets = [
inAppWallet({
smartAccount: {
chain: sepolia,
sponsorGas: true,
},
}),
];
export default function App() {
return (
<ThirdwebProvider>
<ConnectButton client={client} wallets={wallets} />
</ThirdwebProvider>
);
}

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.