Built-in Gas Sponsorship for in-app wallets

Joaquim Verges

In-app wallets got an update in v5.19 of the connect SDK that allows for sponsoring gas and use all the benefits of smart accounts with just 2 extra lines of code!

In-app wallets allow users to login with email/phone/social logins and now accept a smartAccount property which converts the EOA into a smart account, enabling:

  • Gas sponsorship
  • Atomic batch transactions
  • Multiple signers and session keys
  • Programmability

To enable it, simply pass the smartAccount property to inAppWallet():

const wallet = inAppWallet({
smartAccount: {
chain: base, // the initial chain to connect to
sponsorGas: true, // whether to sponsor transactinos
},
});
await wallet.connect({
client,
strategy: "google",
});

That's it!

Under the hood, the inAppWallet creates a ERC4337 smart account, just like when using smartWallet, but much more convenient!

Note that enabling/disabling this property will result in a different address (smart account vs EOA).

Happy building 🛠️