thirdweb 5.41.0 → 5.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adapters/wallet-adapter.js +12 -1
- package/dist/cjs/adapters/wallet-adapter.js.map +1 -1
- package/dist/cjs/client/client.js +19 -1
- package/dist/cjs/client/client.js.map +1 -1
- package/dist/cjs/exports/extensions/common.js +3 -1
- package/dist/cjs/exports/extensions/common.js.map +1 -1
- package/dist/cjs/exports/extensions/erc1155.js +2 -1
- package/dist/cjs/exports/extensions/erc1155.js.map +1 -1
- package/dist/cjs/exports/react.js +7 -2
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/exports/utils.js +3 -1
- package/dist/cjs/exports/utils.js.map +1 -1
- package/dist/cjs/exports/wallets/in-app.js.map +1 -1
- package/dist/cjs/exports/wallets.js.map +1 -1
- package/dist/cjs/exports/wallets.native.js.map +1 -1
- package/dist/cjs/react/core/hooks/others/useChainQuery.js +19 -3
- package/dist/cjs/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/transaction-button-utils.js.map +1 -1
- package/dist/cjs/react/web/ui/AutoConnect/AutoConnect.js +5 -0
- package/dist/cjs/react/web/ui/AutoConnect/AutoConnect.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +196 -2
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +109 -3
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +127 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -0
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +70 -3
- package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +19 -7
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/storage/download.js +44 -4
- package/dist/cjs/storage/download.js.map +1 -1
- package/dist/cjs/utils/contract/parse-abi-params.js +87 -0
- package/dist/cjs/utils/contract/parse-abi-params.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/create-wallet.js +73 -0
- package/dist/cjs/wallets/create-wallet.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/index.js +2 -3
- package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/ecosystem.js +29 -3
- package/dist/cjs/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/in-app.js +100 -5
- package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/cjs/wallets/smart/smart-wallet.js +71 -5
- package/dist/cjs/wallets/smart/smart-wallet.js.map +1 -1
- package/dist/esm/adapters/wallet-adapter.js +12 -1
- package/dist/esm/adapters/wallet-adapter.js.map +1 -1
- package/dist/esm/client/client.js +19 -1
- package/dist/esm/client/client.js.map +1 -1
- package/dist/esm/exports/extensions/common.js +1 -0
- package/dist/esm/exports/extensions/common.js.map +1 -1
- package/dist/esm/exports/extensions/erc1155.js +1 -1
- package/dist/esm/exports/extensions/erc1155.js.map +1 -1
- package/dist/esm/exports/react.js +3 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/utils.js +1 -0
- package/dist/esm/exports/utils.js.map +1 -1
- package/dist/esm/exports/wallets/in-app.js.map +1 -1
- package/dist/esm/exports/wallets.js.map +1 -1
- package/dist/esm/exports/wallets.native.js.map +1 -1
- package/dist/esm/react/core/hooks/others/useChainQuery.js +19 -3
- package/dist/esm/react/core/hooks/others/useChainQuery.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/transaction-button-utils.js.map +1 -1
- package/dist/esm/react/web/ui/AutoConnect/AutoConnect.js +5 -0
- package/dist/esm/react/web/ui/AutoConnect/AutoConnect.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +196 -2
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +109 -3
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -1
- package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js +124 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js.map +1 -0
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +69 -3
- package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +19 -7
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/storage/download.js +44 -4
- package/dist/esm/storage/download.js.map +1 -1
- package/dist/esm/utils/contract/parse-abi-params.js +84 -0
- package/dist/esm/utils/contract/parse-abi-params.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/create-wallet.js +73 -0
- package/dist/esm/wallets/create-wallet.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/index.js +2 -3
- package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/esm/wallets/in-app/web/ecosystem.js +29 -3
- package/dist/esm/wallets/in-app/web/ecosystem.js.map +1 -1
- package/dist/esm/wallets/in-app/web/in-app.js +100 -5
- package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/esm/wallets/smart/smart-wallet.js +71 -5
- package/dist/esm/wallets/smart/smart-wallet.js.map +1 -1
- package/dist/types/adapters/wallet-adapter.d.ts +12 -1
- package/dist/types/adapters/wallet-adapter.d.ts.map +1 -1
- package/dist/types/client/client.d.ts +19 -1
- package/dist/types/client/client.d.ts.map +1 -1
- package/dist/types/exports/extensions/common.d.ts +1 -0
- package/dist/types/exports/extensions/common.d.ts.map +1 -1
- package/dist/types/exports/extensions/erc1155.d.ts +1 -1
- package/dist/types/exports/extensions/erc1155.d.ts.map +1 -1
- package/dist/types/exports/react.d.ts +2 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/utils.d.ts +2 -0
- package/dist/types/exports/utils.d.ts.map +1 -1
- package/dist/types/exports/wallets/in-app.d.ts +1 -0
- package/dist/types/exports/wallets/in-app.d.ts.map +1 -1
- package/dist/types/exports/wallets.d.ts +4 -2
- package/dist/types/exports/wallets.d.ts.map +1 -1
- package/dist/types/exports/wallets.native.d.ts +3 -2
- package/dist/types/exports/wallets.native.d.ts.map +1 -1
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts +21 -4
- package/dist/types/react/core/hooks/others/useChainQuery.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/transaction-button-utils.d.ts +1 -0
- package/dist/types/react/core/hooks/transaction/transaction-button-utils.d.ts.map +1 -1
- package/dist/types/react/web/ui/AutoConnect/AutoConnect.d.ts +5 -0
- package/dist/types/react/web/ui/AutoConnect/AutoConnect.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts +196 -2
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts +109 -3
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts +1 -1
- package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts +63 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.d.ts.map +1 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts +21 -0
- package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/storage/download.d.ts +43 -3
- package/dist/types/storage/download.d.ts.map +1 -1
- package/dist/types/utils/contract/parse-abi-params.d.ts +29 -0
- package/dist/types/utils/contract/parse-abi-params.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/create-wallet.d.ts +73 -0
- package/dist/types/wallets/create-wallet.d.ts.map +1 -1
- package/dist/types/wallets/ecosystem/types.d.ts +5 -4
- package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/ecosystem.d.ts +29 -3
- package/dist/types/wallets/in-app/web/ecosystem.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/in-app.d.ts +100 -5
- package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
- package/dist/types/wallets/smart/smart-wallet.d.ts +71 -5
- package/dist/types/wallets/smart/smart-wallet.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/wallet-adapter.ts +12 -1
- package/src/client/client.ts +19 -1
- package/src/exports/extensions/common.ts +5 -0
- package/src/exports/extensions/erc1155.ts +1 -0
- package/src/exports/react.ts +7 -0
- package/src/exports/utils.ts +3 -0
- package/src/exports/wallets/in-app.ts +6 -0
- package/src/exports/wallets.native.ts +8 -1
- package/src/exports/wallets.ts +13 -1
- package/src/react/core/hooks/others/useChainQuery.ts +24 -4
- package/src/react/core/hooks/transaction/transaction-button-utils.ts +1 -0
- package/src/react/web/ui/AutoConnect/AutoConnect.tsx +5 -0
- package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +196 -2
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +109 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +2 -2
- package/src/react/web/ui/PayEmbed.tsx +1 -1
- package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/BuyDirectListingButton.test.tsx +27 -0
- package/src/react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.tsx +200 -0
- package/src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx +78 -5
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +19 -8
- package/src/storage/download.ts +47 -4
- package/src/utils/contract/parse-abi-params.test.ts +160 -0
- package/src/utils/contract/parse-abi-params.ts +90 -0
- package/src/version.ts +1 -1
- package/src/wallets/create-wallet.ts +73 -0
- package/src/wallets/ecosystem/types.ts +9 -5
- package/src/wallets/in-app/core/wallet/index.ts +2 -3
- package/src/wallets/in-app/web/ecosystem.ts +29 -3
- package/src/wallets/in-app/web/in-app.ts +100 -5
- package/src/wallets/smart/smart-wallet.ts +71 -5
@@ -7,10 +7,29 @@ import type {
|
|
7
7
|
import { createEcosystemWallet } from "../core/wallet/ecosystem-core.js";
|
8
8
|
|
9
9
|
/**
|
10
|
-
* Creates an
|
10
|
+
* Creates an [Ecosystem Wallet](https://portal.thirdweb.com/connect/ecosystems/overview) based on various authentication methods.
|
11
|
+
*
|
12
|
+
* Available authentication methods:
|
13
|
+
* - Email
|
14
|
+
* - Phone
|
15
|
+
* - Passkey
|
16
|
+
* - Google
|
17
|
+
* - Apple
|
18
|
+
* - Facebook
|
19
|
+
* - Discord
|
20
|
+
* - Farcaster
|
21
|
+
*
|
22
|
+
* Can also be configured to use Account Abstraction to directly connect to a ERC4337 smart account based on those authentication methods.
|
23
|
+
*
|
24
|
+
* Refer to [inAppWallet](https://portal.thirdweb.com/references/typescript/v5/inAppWallet) for detailed usage examples.
|
25
|
+
*
|
11
26
|
* @param createOptions - configuration options
|
27
|
+
* Refer to [EcosystemWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/EcosystemWalletCreationOptions) for more details.
|
12
28
|
* @returns The created ecosystem wallet.
|
13
29
|
* @example
|
30
|
+
*
|
31
|
+
* ### Connect to an ecosystem wallet
|
32
|
+
*
|
14
33
|
* ```ts
|
15
34
|
* import { ecosystemWallet } from "thirdweb/wallets";
|
16
35
|
*
|
@@ -23,14 +42,21 @@ import { createEcosystemWallet } from "../core/wallet/ecosystem-core.js";
|
|
23
42
|
* });
|
24
43
|
* ```
|
25
44
|
*
|
26
|
-
*
|
27
|
-
*
|
45
|
+
* [View all connection options](https://portal.thirdweb.com/references/typescript/v5/EcosystemWalletConnectionOptions)
|
46
|
+
*
|
47
|
+
* ### Connect to a restricted ecosystem wallet with your designated partner ID
|
48
|
+
*
|
49
|
+
* The parnter ID will be provided to you by the ecosystem with which you're integrating.
|
50
|
+
*
|
28
51
|
* ```ts
|
29
52
|
* import { ecosystemWallet } from "thirdweb/wallets";
|
30
53
|
* const wallet = ecosystemWallet("ecosystem.hooli", {
|
31
54
|
* partnerId: "..."
|
32
55
|
* });
|
33
56
|
* ```
|
57
|
+
*
|
58
|
+
* Refer to [inAppWallet](https://portal.thirdweb.com/references/typescript/v5/inAppWallet) for more usage examples.
|
59
|
+
*
|
34
60
|
* @wallet
|
35
61
|
*/
|
36
62
|
export function ecosystemWallet(
|
@@ -4,10 +4,27 @@ import type { CreateWalletArgs } from "../../wallet-types.js";
|
|
4
4
|
import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
5
5
|
|
6
6
|
/**
|
7
|
-
* Creates an
|
7
|
+
* Creates an app scoped wallet for users based on various authentication methods.
|
8
|
+
*
|
9
|
+
* Available authentication methods:
|
10
|
+
* - Email
|
11
|
+
* - Phone
|
12
|
+
* - Passkey
|
13
|
+
* - Google
|
14
|
+
* - Apple
|
15
|
+
* - Facebook
|
16
|
+
* - Discord
|
17
|
+
* - Farcaster
|
18
|
+
*
|
19
|
+
* Can also be configured to use Account Abstraction to directly connect to a ERC4337 smart account based on those authentication methods.
|
20
|
+
*
|
8
21
|
* @param createOptions - configuration options
|
22
|
+
* Refer to [InAppWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/InAppWalletCreationOptions) to see the available options.
|
9
23
|
* @returns The created in-app wallet.
|
10
24
|
* @example
|
25
|
+
*
|
26
|
+
* ### Login with socials
|
27
|
+
*
|
11
28
|
* ```ts
|
12
29
|
* import { inAppWallet } from "thirdweb/wallets";
|
13
30
|
*
|
@@ -20,18 +37,90 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
|
20
37
|
* });
|
21
38
|
* ```
|
22
39
|
*
|
23
|
-
*
|
40
|
+
* [View all available social auth methods](https://portal.thirdweb.com/references/typescript/v5/InAppWalletSocialAuth)
|
41
|
+
*
|
42
|
+
* * ### Login with email
|
43
|
+
*
|
44
|
+
* ```ts
|
45
|
+
* import { inAppWallet, preAuthenticate } from "thirdweb/wallets/in-app";
|
46
|
+
*
|
47
|
+
* const wallet = inAppWallet();
|
48
|
+
*
|
49
|
+
* // sends a verification code to the provided email
|
50
|
+
* await preAuthenticate({
|
51
|
+
* client,
|
52
|
+
* strategy: "email",
|
53
|
+
* email: "example@example.com",
|
54
|
+
* });
|
55
|
+
*
|
56
|
+
* // login with the verification code
|
57
|
+
* const account = await wallet.connect({
|
58
|
+
* client,
|
59
|
+
* chain,
|
60
|
+
* strategy: "email",
|
61
|
+
* verificationCode: "123456",
|
62
|
+
* });
|
63
|
+
* ```
|
64
|
+
*
|
65
|
+
* ### Login with phone number
|
66
|
+
* ```ts
|
67
|
+
* import { inAppWallet, preAuthenticate } from "thirdweb/wallets/in-app";
|
68
|
+
*
|
69
|
+
* const wallet = inAppWallet();
|
70
|
+
*
|
71
|
+
* // sends a verification code to the provided phone number
|
72
|
+
* await preAuthenticate({
|
73
|
+
* client,
|
74
|
+
* strategy: "phone",
|
75
|
+
* phoneNumber: "+1234567890",
|
76
|
+
* });
|
77
|
+
*
|
78
|
+
* // login with the verification code
|
79
|
+
* const account = await wallet.connect({
|
80
|
+
* client,
|
81
|
+
* chain,
|
82
|
+
* strategy: "phone",
|
83
|
+
* verificationCode: "123456",
|
84
|
+
* });
|
85
|
+
*
|
86
|
+
* ### Login with passkey
|
87
|
+
*
|
88
|
+
* ```ts
|
89
|
+
* import { inAppWallet, hasStoredPasskey } from "thirdweb/wallets/in-app";
|
90
|
+
*
|
91
|
+
* const wallet = inAppWallet();
|
92
|
+
*
|
93
|
+
* const wallet = inAppWallet();
|
94
|
+
* const hasPasskey = await hasStoredPasskey(client);
|
95
|
+
* await wallet.connect({
|
96
|
+
* client,
|
97
|
+
* strategy: "passkey",
|
98
|
+
* type: hasPasskey ? "sign-in" : "sign-up",
|
99
|
+
* });
|
100
|
+
* ```
|
101
|
+
*
|
102
|
+
* ### Enable smart accounts and sponsor gas for your users:
|
103
|
+
*
|
24
104
|
* ```ts
|
25
105
|
* import { inAppWallet } from "thirdweb/wallets";
|
106
|
+
* import { sepolia } from "thirdweb/chains";
|
107
|
+
*
|
26
108
|
* const wallet = inAppWallet({
|
27
109
|
* smartAccount: {
|
28
110
|
* chain: sepolia,
|
29
111
|
* sponsorGas: true,
|
30
112
|
* },
|
31
113
|
* });
|
114
|
+
*
|
115
|
+
* // account will be a smart account with sponsored gas enabled
|
116
|
+
* const account = await wallet.connect({
|
117
|
+
* client,
|
118
|
+
* chain,
|
119
|
+
* strategy: "google",
|
120
|
+
* });
|
32
121
|
* ```
|
33
122
|
*
|
34
|
-
* Specify a logo for your login page
|
123
|
+
* ### Specify a logo for your login page (Connect UI)
|
35
124
|
* ```ts
|
36
125
|
* import { inAppWallet } from "thirdweb/wallets";
|
37
126
|
* const wallet = inAppWallet({
|
@@ -46,7 +135,8 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
|
46
135
|
* });
|
47
136
|
* ```
|
48
137
|
*
|
49
|
-
* Hide the ability to export the private key within the Connect Modal
|
138
|
+
* ### Hide the ability to export the private key within the Connect Modal UI
|
139
|
+
*
|
50
140
|
* ```ts
|
51
141
|
* import { inAppWallet } from "thirdweb/wallets";
|
52
142
|
* const wallet = inAppWallet({
|
@@ -54,7 +144,10 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
|
54
144
|
* });
|
55
145
|
* ```
|
56
146
|
*
|
57
|
-
* Open the Oauth window in the same tab
|
147
|
+
* ### Open the Oauth window in the same tab
|
148
|
+
*
|
149
|
+
* By default, the Oauth window will open in a popup window. You can change this behavior by setting the `auth.mode` option to `"redirect"`.
|
150
|
+
*
|
58
151
|
* ```ts
|
59
152
|
* import { inAppWallet } from "thirdweb/wallets";
|
60
153
|
* const wallet = inAppWallet({
|
@@ -63,6 +156,8 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
|
|
63
156
|
* }
|
64
157
|
* });
|
65
158
|
* ```
|
159
|
+
*
|
160
|
+
* @returns The created in-app wallet.
|
66
161
|
* @wallet
|
67
162
|
*/
|
68
163
|
export function inAppWallet(
|
@@ -11,23 +11,89 @@ import type {
|
|
11
11
|
import { DEFAULT_ACCOUNT_FACTORY } from "./lib/constants.js";
|
12
12
|
|
13
13
|
/**
|
14
|
-
* Creates a smart wallet.
|
14
|
+
* Creates a ERC4337 smart wallet based on a admin account.
|
15
|
+
*
|
16
|
+
* Smart wallets are smart contract wallets that enable multiple benefits for users:
|
17
|
+
*
|
18
|
+
* - Sponsor gas fees for transactions
|
19
|
+
* - Multiple owners
|
20
|
+
* - Session keys
|
21
|
+
* - Batch transactions
|
22
|
+
* - Predictable addresses
|
23
|
+
* - Programmable features
|
24
|
+
*
|
25
|
+
* [Learn more about account abstraction](https://portal.thirdweb.com/connect/account-abstraction/how-it-works)
|
26
|
+
*
|
15
27
|
* @param createOptions - The options for creating the wallet.
|
28
|
+
* Refer to [SmartWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/SmartWalletCreationOptions) for more details.
|
16
29
|
* @returns The created smart wallet.
|
17
30
|
* @example
|
31
|
+
*
|
32
|
+
* ## Connect to a smart wallet
|
33
|
+
*
|
34
|
+
* To connect to a smart wallet, you need to provide an admin account as the `personalAccount` option.
|
35
|
+
*
|
36
|
+
* Any wallet can be used as an admin account, including an in-app wallets.
|
37
|
+
*
|
38
|
+
* The `sponsorGas` option is used to enable sponsored gas for transactions automatically.
|
39
|
+
*
|
18
40
|
* ```ts
|
19
|
-
* import {
|
41
|
+
* import { smartWalletm inAppWallet } from "thirdweb/wallets";
|
42
|
+
* import { sepolia } from "thirdweb/chains";
|
43
|
+
* import { sendTransaction } from "thirdweb";
|
20
44
|
*
|
21
45
|
* const wallet = smartWallet({
|
22
46
|
* chain: sepolia,
|
23
|
-
*
|
47
|
+
* sponsorGas: true, // enable sponsored transactions
|
24
48
|
* });
|
25
49
|
*
|
26
|
-
*
|
50
|
+
* // any wallet can be used as an admin account
|
51
|
+
* // in this example we use an in-app wallet
|
52
|
+
* const adminWallet = inAppWallet();
|
53
|
+
* const personalAccount = await adminWallet.connect({
|
27
54
|
* client,
|
28
|
-
*
|
55
|
+
* chain: sepolia,
|
56
|
+
* strategy: "google",
|
57
|
+
* });
|
58
|
+
*
|
59
|
+
* const smartAccount = await wallet.connect({
|
60
|
+
* client,
|
61
|
+
* personalAccount, // pass the admin account
|
62
|
+
* });
|
63
|
+
*
|
64
|
+
* // sending sponsored transactions with the smartAccount
|
65
|
+
* await sendTransaction({
|
66
|
+
* account: smartAccount,
|
67
|
+
* transaction,
|
29
68
|
* });
|
30
69
|
* ```
|
70
|
+
*
|
71
|
+
* ## Configuring the smart wallet
|
72
|
+
*
|
73
|
+
* You can pass options to the `smartWallet` function to configure the smart wallet.
|
74
|
+
*
|
75
|
+
* ```ts
|
76
|
+
* import { smartWallet } from "thirdweb/wallets";
|
77
|
+
* import { sepolia } from "thirdweb/chains";
|
78
|
+
*
|
79
|
+
* const wallet = smartWallet({
|
80
|
+
* chain: sepolia,
|
81
|
+
* sponsorGas: true, // enable sponsored transactions
|
82
|
+
* factoryAddress: "0x...", // custom factory address
|
83
|
+
* overrides: {
|
84
|
+
* accountAddress: "0x...", // override account address
|
85
|
+
* accountSalt: "0x...", // override account salt
|
86
|
+
* entrypointAddress: "0x...", // override entrypoint address
|
87
|
+
* erc20Paymaster: { ... }, // enable erc20 paymaster
|
88
|
+
* bundlerUrl: "https://...", // override bundler url
|
89
|
+
* paymaster: (userOp) => { ... }, // override paymaster
|
90
|
+
* ...
|
91
|
+
* }
|
92
|
+
* });
|
93
|
+
* ```
|
94
|
+
*
|
95
|
+
* Refer to [SmartWalletOptions](https://portal.thirdweb.com/references/typescript/v5/SmartWalletOptions) for more details.
|
96
|
+
*
|
31
97
|
* @wallet
|
32
98
|
*/
|
33
99
|
export function smartWallet(
|