You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "Getting Started with Account Abstraction | thirdweb",
19
+
title: "Sponsor Gas | thirdweb",
19
20
description:
20
-
"Getting started to add ERC-4337 Account Abstraction support to your application easily.",
21
+
"Sponsor Gas for all users of your application.",
21
22
});
22
23
23
-
# Getting Started
24
-
25
-
Getting started to add ERC-4337 compatible smart accounts to your application easily.
26
-
27
-
Once set, your application will:
28
-
29
-
- Let users **connect to their smart account** using any personal wallet, including in-app wallets for easy onboarding.
30
-
- Automatically **deploy individual account contracts** for your users when they do their first onchain transaction.
31
-
-**Handle all transaction gas costs** via the thirdweb paymaster.
32
-
33
-
<Steps>
34
-
<Steptitle="Get a free API key">
35
-
36
-
You will require an API key to use thirdweb's infrastructure services such as the bundler and paymaster.
37
-
38
-
Obtain an API key from the [thirdweb dashboard Settings page](https://thirdweb.com/create-api-key).
39
-
40
-
The API key lets you access thirdweb's bundler and paymaster infrastructure, which is required for smart accounts to operate and optionally enable [gasless transactions](/glossary/gasless-transactions).
41
-
42
-
Learn more about creating an API key and restricting which contracts the smart account can interact with [here](/api-keys).
43
-
44
-
</Step>
45
-
<Steptitle="Connect smart accounts in your application">
46
-
47
-
Use the following code to integrate account abstraction into your apps.
To set up sponsored transactions, set the `sponsorGas` option to `true` in the smart account configuration.
52
-
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.
chain: sepolia, // the chain where your smart accounts will be or is deployed
81
-
sponsorGas: true// enable or disable sponsored transactions
82
-
}}
83
-
/>
84
-
</ThirdwebProvider>
85
-
);
86
-
}
87
-
```
88
-
</TabsContent>
89
-
90
-
<TabsContentvalue="react">
91
-
92
-
```tsx
93
-
import { useConnect } from"thirdweb/react";
94
-
import { inAppWallet } from"thirdweb/wallets";
95
-
import { sepolia } from"thirdweb/chains";
96
-
97
-
function App() {
98
-
// 1. set the `accountAbstraction` configuration
99
-
const { connect } =useConnect({
100
-
client,
101
-
accountAbstraction: {
102
-
chain: sepolia, // the chain where your smart accounts will be or is deployed
103
-
sponsorGas: true, // enable or disable sponsored transactions
104
-
},
105
-
});
106
-
107
-
const connectToSmartAccount =async () => {
108
-
// 2. connect with the admin wallet of the smart account
109
-
connect(async () => {
110
-
const wallet =inAppWallet(); // or any other wallet
111
-
awaitwallet.connect({
112
-
client,
113
-
chain: sepolia,
114
-
strategy: "google",
115
-
});
116
-
returnwallet;
24
+
# Sponsor gas
25
+
26
+
Sponsor gas fees for your users' in-app wallets using [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702), enabling gasless transactions and improving user experience.
authProvider: AuthProvider.Google, // or other auth providers
57
+
executionMode: ExecutionMode.EIP7702Sponsored// enable gas sponsorship
58
+
);
59
+
```
60
+
</TabsContent>
181
61
</Tabs>
182
62
183
-
</Step>
184
-
<Steptitle="Executing Transactions with Smart Accounts">
185
-
186
-
Once setup, you can use the Connect [TypeScript](/typescript/v5), [React](/react/v5) and [Unity SDKs](/unity) to deploy contracts, perform transactions, and manipulate smart accounts like any other wallet.
0 commit comments