Account Abstraction
Let users connect to their smart accounts with any wallet and unlock gas sponsorship, batched transactions, session keys and full wallet programmability.
Connect smart accounts
Enable smart accounts on the UI components or build your own UI.
// Using UI components
import { ConnectButton } from "thirdweb/react";
function App() {
return (
<>
<ConnectButton
client={client}
// account abstraction options
accountAbstraction={{ chain, sponsorGas: true }}
/>
</>
);
}
// Using your own UI
import { useConnect } from "thirdweb/react";
import { createWallet } from "thirdweb/wallets";
function App() {
const { connect } = useConnect({
client,
// account abstraction options
accountAbstraction: { chain, sponsorGas: true },
});
return (
<>
<button
onClick={() =>
connect(async () => {
// any wallet connected here will be
// converted to a smart account
const adminWallet = inAppWallet();
await adminWallet.connect({
client,
strategy: "google",
});
return adminWallet;
})
}
>
Connect with Google
</button>
</>
);
}