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
@@ -1,10 +1,27 @@
|
|
1
1
|
import type { Wallet } from "../../interfaces/wallet.js";
|
2
2
|
import type { CreateWalletArgs } from "../../wallet-types.js";
|
3
3
|
/**
|
4
|
-
* Creates an
|
4
|
+
* Creates an app scoped wallet for users based on various authentication methods.
|
5
|
+
*
|
6
|
+
* Available authentication methods:
|
7
|
+
* - Email
|
8
|
+
* - Phone
|
9
|
+
* - Passkey
|
10
|
+
* - Google
|
11
|
+
* - Apple
|
12
|
+
* - Facebook
|
13
|
+
* - Discord
|
14
|
+
* - Farcaster
|
15
|
+
*
|
16
|
+
* Can also be configured to use Account Abstraction to directly connect to a ERC4337 smart account based on those authentication methods.
|
17
|
+
*
|
5
18
|
* @param createOptions - configuration options
|
19
|
+
* Refer to [InAppWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/InAppWalletCreationOptions) to see the available options.
|
6
20
|
* @returns The created in-app wallet.
|
7
21
|
* @example
|
22
|
+
*
|
23
|
+
* ### Login with socials
|
24
|
+
*
|
8
25
|
* ```ts
|
9
26
|
* import { inAppWallet } from "thirdweb/wallets";
|
10
27
|
*
|
@@ -17,18 +34,90 @@ import type { CreateWalletArgs } from "../../wallet-types.js";
|
|
17
34
|
* });
|
18
35
|
* ```
|
19
36
|
*
|
20
|
-
*
|
37
|
+
* [View all available social auth methods](https://portal.thirdweb.com/references/typescript/v5/InAppWalletSocialAuth)
|
38
|
+
*
|
39
|
+
* * ### Login with email
|
40
|
+
*
|
41
|
+
* ```ts
|
42
|
+
* import { inAppWallet, preAuthenticate } from "thirdweb/wallets/in-app";
|
43
|
+
*
|
44
|
+
* const wallet = inAppWallet();
|
45
|
+
*
|
46
|
+
* // sends a verification code to the provided email
|
47
|
+
* await preAuthenticate({
|
48
|
+
* client,
|
49
|
+
* strategy: "email",
|
50
|
+
* email: "example@example.com",
|
51
|
+
* });
|
52
|
+
*
|
53
|
+
* // login with the verification code
|
54
|
+
* const account = await wallet.connect({
|
55
|
+
* client,
|
56
|
+
* chain,
|
57
|
+
* strategy: "email",
|
58
|
+
* verificationCode: "123456",
|
59
|
+
* });
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* ### Login with phone number
|
63
|
+
* ```ts
|
64
|
+
* import { inAppWallet, preAuthenticate } from "thirdweb/wallets/in-app";
|
65
|
+
*
|
66
|
+
* const wallet = inAppWallet();
|
67
|
+
*
|
68
|
+
* // sends a verification code to the provided phone number
|
69
|
+
* await preAuthenticate({
|
70
|
+
* client,
|
71
|
+
* strategy: "phone",
|
72
|
+
* phoneNumber: "+1234567890",
|
73
|
+
* });
|
74
|
+
*
|
75
|
+
* // login with the verification code
|
76
|
+
* const account = await wallet.connect({
|
77
|
+
* client,
|
78
|
+
* chain,
|
79
|
+
* strategy: "phone",
|
80
|
+
* verificationCode: "123456",
|
81
|
+
* });
|
82
|
+
*
|
83
|
+
* ### Login with passkey
|
84
|
+
*
|
85
|
+
* ```ts
|
86
|
+
* import { inAppWallet, hasStoredPasskey } from "thirdweb/wallets/in-app";
|
87
|
+
*
|
88
|
+
* const wallet = inAppWallet();
|
89
|
+
*
|
90
|
+
* const wallet = inAppWallet();
|
91
|
+
* const hasPasskey = await hasStoredPasskey(client);
|
92
|
+
* await wallet.connect({
|
93
|
+
* client,
|
94
|
+
* strategy: "passkey",
|
95
|
+
* type: hasPasskey ? "sign-in" : "sign-up",
|
96
|
+
* });
|
97
|
+
* ```
|
98
|
+
*
|
99
|
+
* ### Enable smart accounts and sponsor gas for your users:
|
100
|
+
*
|
21
101
|
* ```ts
|
22
102
|
* import { inAppWallet } from "thirdweb/wallets";
|
103
|
+
* import { sepolia } from "thirdweb/chains";
|
104
|
+
*
|
23
105
|
* const wallet = inAppWallet({
|
24
106
|
* smartAccount: {
|
25
107
|
* chain: sepolia,
|
26
108
|
* sponsorGas: true,
|
27
109
|
* },
|
28
110
|
* });
|
111
|
+
*
|
112
|
+
* // account will be a smart account with sponsored gas enabled
|
113
|
+
* const account = await wallet.connect({
|
114
|
+
* client,
|
115
|
+
* chain,
|
116
|
+
* strategy: "google",
|
117
|
+
* });
|
29
118
|
* ```
|
30
119
|
*
|
31
|
-
* Specify a logo for your login page
|
120
|
+
* ### Specify a logo for your login page (Connect UI)
|
32
121
|
* ```ts
|
33
122
|
* import { inAppWallet } from "thirdweb/wallets";
|
34
123
|
* const wallet = inAppWallet({
|
@@ -43,7 +132,8 @@ import type { CreateWalletArgs } from "../../wallet-types.js";
|
|
43
132
|
* });
|
44
133
|
* ```
|
45
134
|
*
|
46
|
-
* Hide the ability to export the private key within the Connect Modal
|
135
|
+
* ### Hide the ability to export the private key within the Connect Modal UI
|
136
|
+
*
|
47
137
|
* ```ts
|
48
138
|
* import { inAppWallet } from "thirdweb/wallets";
|
49
139
|
* const wallet = inAppWallet({
|
@@ -51,7 +141,10 @@ import type { CreateWalletArgs } from "../../wallet-types.js";
|
|
51
141
|
* });
|
52
142
|
* ```
|
53
143
|
*
|
54
|
-
* Open the Oauth window in the same tab
|
144
|
+
* ### Open the Oauth window in the same tab
|
145
|
+
*
|
146
|
+
* By default, the Oauth window will open in a popup window. You can change this behavior by setting the `auth.mode` option to `"redirect"`.
|
147
|
+
*
|
55
148
|
* ```ts
|
56
149
|
* import { inAppWallet } from "thirdweb/wallets";
|
57
150
|
* const wallet = inAppWallet({
|
@@ -60,6 +153,8 @@ import type { CreateWalletArgs } from "../../wallet-types.js";
|
|
60
153
|
* }
|
61
154
|
* });
|
62
155
|
* ```
|
156
|
+
*
|
157
|
+
* @returns The created in-app wallet.
|
63
158
|
* @wallet
|
64
159
|
*/
|
65
160
|
export declare function inAppWallet(createOptions?: CreateWalletArgs<"inApp">[1]): Wallet<"inApp">;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"in-app.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/in-app/web/in-app.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D
|
1
|
+
{"version":3,"file":"in-app.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/in-app/web/in-app.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4JG;AACH,wBAAgB,WAAW,CACzB,aAAa,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAC3C,MAAM,CAAC,OAAO,CAAC,CAUjB"}
|
@@ -1,23 +1,89 @@
|
|
1
1
|
import type { Wallet } from "../interfaces/wallet.js";
|
2
2
|
import type { CreateWalletArgs } from "../wallet-types.js";
|
3
3
|
/**
|
4
|
-
* Creates a smart wallet.
|
4
|
+
* Creates a ERC4337 smart wallet based on a admin account.
|
5
|
+
*
|
6
|
+
* Smart wallets are smart contract wallets that enable multiple benefits for users:
|
7
|
+
*
|
8
|
+
* - Sponsor gas fees for transactions
|
9
|
+
* - Multiple owners
|
10
|
+
* - Session keys
|
11
|
+
* - Batch transactions
|
12
|
+
* - Predictable addresses
|
13
|
+
* - Programmable features
|
14
|
+
*
|
15
|
+
* [Learn more about account abstraction](https://portal.thirdweb.com/connect/account-abstraction/how-it-works)
|
16
|
+
*
|
5
17
|
* @param createOptions - The options for creating the wallet.
|
18
|
+
* Refer to [SmartWalletCreationOptions](https://portal.thirdweb.com/references/typescript/v5/SmartWalletCreationOptions) for more details.
|
6
19
|
* @returns The created smart wallet.
|
7
20
|
* @example
|
21
|
+
*
|
22
|
+
* ## Connect to a smart wallet
|
23
|
+
*
|
24
|
+
* To connect to a smart wallet, you need to provide an admin account as the `personalAccount` option.
|
25
|
+
*
|
26
|
+
* Any wallet can be used as an admin account, including an in-app wallets.
|
27
|
+
*
|
28
|
+
* The `sponsorGas` option is used to enable sponsored gas for transactions automatically.
|
29
|
+
*
|
8
30
|
* ```ts
|
9
|
-
* import {
|
31
|
+
* import { smartWalletm inAppWallet } from "thirdweb/wallets";
|
32
|
+
* import { sepolia } from "thirdweb/chains";
|
33
|
+
* import { sendTransaction } from "thirdweb";
|
10
34
|
*
|
11
35
|
* const wallet = smartWallet({
|
12
36
|
* chain: sepolia,
|
13
|
-
*
|
37
|
+
* sponsorGas: true, // enable sponsored transactions
|
14
38
|
* });
|
15
39
|
*
|
16
|
-
*
|
40
|
+
* // any wallet can be used as an admin account
|
41
|
+
* // in this example we use an in-app wallet
|
42
|
+
* const adminWallet = inAppWallet();
|
43
|
+
* const personalAccount = await adminWallet.connect({
|
17
44
|
* client,
|
18
|
-
*
|
45
|
+
* chain: sepolia,
|
46
|
+
* strategy: "google",
|
47
|
+
* });
|
48
|
+
*
|
49
|
+
* const smartAccount = await wallet.connect({
|
50
|
+
* client,
|
51
|
+
* personalAccount, // pass the admin account
|
52
|
+
* });
|
53
|
+
*
|
54
|
+
* // sending sponsored transactions with the smartAccount
|
55
|
+
* await sendTransaction({
|
56
|
+
* account: smartAccount,
|
57
|
+
* transaction,
|
19
58
|
* });
|
20
59
|
* ```
|
60
|
+
*
|
61
|
+
* ## Configuring the smart wallet
|
62
|
+
*
|
63
|
+
* You can pass options to the `smartWallet` function to configure the smart wallet.
|
64
|
+
*
|
65
|
+
* ```ts
|
66
|
+
* import { smartWallet } from "thirdweb/wallets";
|
67
|
+
* import { sepolia } from "thirdweb/chains";
|
68
|
+
*
|
69
|
+
* const wallet = smartWallet({
|
70
|
+
* chain: sepolia,
|
71
|
+
* sponsorGas: true, // enable sponsored transactions
|
72
|
+
* factoryAddress: "0x...", // custom factory address
|
73
|
+
* overrides: {
|
74
|
+
* accountAddress: "0x...", // override account address
|
75
|
+
* accountSalt: "0x...", // override account salt
|
76
|
+
* entrypointAddress: "0x...", // override entrypoint address
|
77
|
+
* erc20Paymaster: { ... }, // enable erc20 paymaster
|
78
|
+
* bundlerUrl: "https://...", // override bundler url
|
79
|
+
* paymaster: (userOp) => { ... }, // override paymaster
|
80
|
+
* ...
|
81
|
+
* }
|
82
|
+
* });
|
83
|
+
* ```
|
84
|
+
*
|
85
|
+
* Refer to [SmartWalletOptions](https://portal.thirdweb.com/references/typescript/v5/SmartWalletOptions) for more details.
|
86
|
+
*
|
21
87
|
* @wallet
|
22
88
|
*/
|
23
89
|
export declare function smartWallet(createOptions: CreateWalletArgs<"smart">[1]): Wallet<"smart">;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"smart-wallet.d.ts","sourceRoot":"","sources":["../../../../src/wallets/smart/smart-wallet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAW,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAG5B
|
1
|
+
{"version":3,"file":"smart-wallet.d.ts","sourceRoot":"","sources":["../../../../src/wallets/smart/smart-wallet.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAW,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAC1C,MAAM,CAAC,OAAO,CAAC,CAwFjB"}
|
package/package.json
CHANGED
@@ -12,7 +12,18 @@ export type AdapterWalletOptions = {
|
|
12
12
|
};
|
13
13
|
|
14
14
|
/**
|
15
|
-
* Creates a wallet from the given
|
15
|
+
* Creates a wallet from the given account.
|
16
|
+
*
|
17
|
+
* You can use this to:
|
18
|
+
*
|
19
|
+
* - convert a third party library wallet (wagmi, viem, ethers) into a thirdweb wallet.
|
20
|
+
* - connect with a private key (for automated tests)
|
21
|
+
*
|
22
|
+
* Available wallet adatpers:
|
23
|
+
* - [Viem](https://portal.thirdweb.com/references/typescript/v5/viemAdapter)
|
24
|
+
* - [Ethers 6](https://portal.thirdweb.com/references/typescript/v5/ethers6Adapter)
|
25
|
+
* - [Ethers 5](https://portal.thirdweb.com/references/typescript/v5/ethers5Adapter)
|
26
|
+
*
|
16
27
|
* @param options - The options for the adapter wallet.
|
17
28
|
* @returns a wallet instance.
|
18
29
|
*
|
package/src/client/client.ts
CHANGED
@@ -70,15 +70,33 @@ export type ThirdwebClient = {
|
|
70
70
|
} & Readonly<ClientOptions>;
|
71
71
|
|
72
72
|
/**
|
73
|
-
* Creates a Thirdweb client
|
73
|
+
* Creates a Thirdweb client using the provided client ID (client-side) or secret key (server-side).
|
74
|
+
*
|
75
|
+
* Get your client ID and secret key from the Thirdweb dashboard [here](https://thirdweb.com/dashboard/settings/api-keys).
|
76
|
+
* **Never share your secret key with anyone.
|
77
|
+
*
|
78
|
+
* A client is necessary for most functions in the thirdweb SDK. It provides access to thirdweb APIs including built-in RPC, storage, and more.
|
79
|
+
*
|
74
80
|
* @param options - The options for creating the client.
|
81
|
+
* @param [options.clientId] - The client ID to use for thirdweb services.
|
82
|
+
* @param [options.secretKey] - The secret key to use for thirdweb services.
|
75
83
|
* @returns The created Thirdweb client.
|
76
84
|
* @throws An error if neither `clientId` nor `secretKey` is provided.
|
85
|
+
*
|
77
86
|
* @example
|
87
|
+
* Create a client on the client side (client ID):
|
78
88
|
* ```ts
|
79
89
|
* import { createThirdwebClient } from "thirdweb";
|
90
|
+
*
|
80
91
|
* const client = createThirdwebClient({ clientId: "..." });
|
81
92
|
* ```
|
93
|
+
*
|
94
|
+
* Create a client on the server (secret key):
|
95
|
+
* ```ts
|
96
|
+
* import { createThirdwebClient } from "thirdweb";
|
97
|
+
*
|
98
|
+
* const client = createThirdwebClient({ secretKey: "..." });
|
99
|
+
* ```
|
82
100
|
*/
|
83
101
|
export function createThirdwebClient(
|
84
102
|
options: CreateThirdwebClientOptions,
|
@@ -21,6 +21,11 @@ export {
|
|
21
21
|
type SetContractMetadataParams,
|
22
22
|
} from "../../extensions/common/write/setContractMetadata.js";
|
23
23
|
|
24
|
+
export {
|
25
|
+
multicall,
|
26
|
+
type MulticallParams,
|
27
|
+
} from "../../extensions/common/__generated__/IMulticall/write/multicall.js";
|
28
|
+
|
24
29
|
// events
|
25
30
|
|
26
31
|
export {
|
@@ -54,6 +54,7 @@ export {
|
|
54
54
|
} from "../../extensions/erc1155/__generated__/IERC1155/write/setApprovalForAll.js";
|
55
55
|
export {
|
56
56
|
safeTransferFrom,
|
57
|
+
encodeSafeTransferFrom,
|
57
58
|
type SafeTransferFromParams,
|
58
59
|
} from "../../extensions/erc1155/__generated__/IERC1155/write/safeTransferFrom.js";
|
59
60
|
export {
|
package/src/exports/react.ts
CHANGED
@@ -56,6 +56,9 @@ export { useSwitchActiveWalletChain } from "../react/core/hooks/wallets/useSwitc
|
|
56
56
|
export { useCallsStatus } from "../react/core/hooks/wallets/useCallsStatus.js";
|
57
57
|
export { useWalletBalance } from "../react/core/hooks/others/useWalletBalance.js";
|
58
58
|
|
59
|
+
// chain hooks
|
60
|
+
export { useChainMetadata } from "../react/core/hooks/others/useChainQuery.js";
|
61
|
+
|
59
62
|
export type { ConnectManagerOptions } from "../wallets/manager/index.js";
|
60
63
|
|
61
64
|
// contract
|
@@ -158,5 +161,9 @@ export { useEnsName, useEnsAvatar } from "../react/core/utils/wallet.js";
|
|
158
161
|
*/
|
159
162
|
export { ClaimButton } from "../react/web/ui/prebuilt/thirdweb/ClaimButton/index.js";
|
160
163
|
export type { ClaimButtonProps } from "../react/web/ui/prebuilt/thirdweb/ClaimButton/types.js";
|
164
|
+
export {
|
165
|
+
BuyDirectListingButton,
|
166
|
+
type BuyDirectListingButtonProps,
|
167
|
+
} from "../react/web/ui/prebuilt/thirdweb/BuyDirectListingButton/index.js";
|
161
168
|
|
162
169
|
export { useConnectionManager } from "../react/core/providers/connection-manager.js";
|
package/src/exports/utils.ts
CHANGED
@@ -21,6 +21,7 @@ export { getSaltHash } from "../utils/any-evm/get-salt-hash.js";
|
|
21
21
|
export { isEIP155Enforced } from "../utils/any-evm/is-eip155-enforced.js";
|
22
22
|
export { keccakId } from "../utils/any-evm/keccak-id.js";
|
23
23
|
export { getKeylessTransaction } from "../utils/any-evm/keyless-transaction.js";
|
24
|
+
export type { ExtendedMetadata } from "../utils/any-evm/deploy-metadata.js";
|
24
25
|
|
25
26
|
//signatures
|
26
27
|
export {
|
@@ -171,3 +172,5 @@ export {
|
|
171
172
|
} from "../utils/extensions/drops/get-claim-params.js";
|
172
173
|
|
173
174
|
export type { NFTMetadata, NFTInput } from "../utils/nft/parseNft.js";
|
175
|
+
|
176
|
+
export { parseAbiParams } from "../utils/contract/parse-abi-params.js";
|
@@ -10,6 +10,12 @@ export {
|
|
10
10
|
} from "../../wallets/in-app/web/lib/auth/index.js";
|
11
11
|
|
12
12
|
export { type GetAuthenticatedUserParams } from "../../wallets/in-app/core/authentication/type.js";
|
13
|
+
export type {
|
14
|
+
InAppWalletCreationOptions,
|
15
|
+
InAppWalletAuth,
|
16
|
+
InAppWalletSocialAuth,
|
17
|
+
InAppWalletConnectionOptions,
|
18
|
+
} from "../../wallets/in-app/core/wallet/types.js";
|
13
19
|
|
14
20
|
export { hasStoredPasskey } from "../../wallets/in-app/web/lib/auth/passkeys.js";
|
15
21
|
|
@@ -42,6 +42,9 @@ export type {
|
|
42
42
|
WalletCreationOptions,
|
43
43
|
WalletConnectionOption,
|
44
44
|
CreateWalletArgs,
|
45
|
+
InjectedConnectOptions,
|
46
|
+
DeepLinkSupportedWalletCreationOptions,
|
47
|
+
StandaloneWCConnectOptions,
|
45
48
|
} from "../wallets/wallet-types.js";
|
46
49
|
|
47
50
|
export type {
|
@@ -82,7 +85,10 @@ export type {
|
|
82
85
|
InAppWalletSocialAuth as EmbeddedWalletSocialAuth,
|
83
86
|
} from "../wallets/in-app/core/wallet/types.js";
|
84
87
|
|
85
|
-
export type {
|
88
|
+
export type {
|
89
|
+
CoinbaseWalletCreationOptions,
|
90
|
+
CoinbaseSDKWalletConnectionOptions,
|
91
|
+
} from "../wallets/coinbase/coinbaseWebSDK.js";
|
86
92
|
|
87
93
|
export type {
|
88
94
|
WalletEmitter,
|
@@ -94,6 +100,7 @@ export { getWalletInfo } from "../wallets/__generated__/getWalletInfo.js";
|
|
94
100
|
export { type WalletInfo } from "../wallets/wallet-info.js";
|
95
101
|
|
96
102
|
export { createWalletAdapter } from "../adapters/wallet-adapter.js";
|
103
|
+
export type { AdapterWalletOptions } from "../adapters/wallet-adapter.js";
|
97
104
|
|
98
105
|
// wallet connect
|
99
106
|
export {
|
package/src/exports/wallets.ts
CHANGED
@@ -12,6 +12,11 @@ export {
|
|
12
12
|
inAppWallet as embeddedWallet,
|
13
13
|
} from "../wallets/in-app/web/in-app.js";
|
14
14
|
export { ecosystemWallet } from "../wallets/in-app/web/ecosystem.js";
|
15
|
+
export type {
|
16
|
+
EcosystemWalletCreationOptions,
|
17
|
+
EcosystemWalletConnectionOptions,
|
18
|
+
EcosystemWalletAutoConnectOptions,
|
19
|
+
} from "../wallets/ecosystem/types.js";
|
15
20
|
export { smartWallet } from "../wallets/smart/smart-wallet.js";
|
16
21
|
|
17
22
|
export type { Wallet, Account } from "../wallets/interfaces/wallet.js";
|
@@ -49,6 +54,9 @@ export type {
|
|
49
54
|
WalletCreationOptions,
|
50
55
|
WalletConnectionOption,
|
51
56
|
CreateWalletArgs,
|
57
|
+
InjectedConnectOptions,
|
58
|
+
DeepLinkSupportedWalletCreationOptions,
|
59
|
+
StandaloneWCConnectOptions,
|
52
60
|
} from "../wallets/wallet-types.js";
|
53
61
|
|
54
62
|
export type {
|
@@ -89,7 +97,10 @@ export type {
|
|
89
97
|
InAppWalletSocialAuth as EmbeddedWalletSocialAuth,
|
90
98
|
} from "../wallets/in-app/core/wallet/types.js";
|
91
99
|
|
92
|
-
export type {
|
100
|
+
export type {
|
101
|
+
CoinbaseWalletCreationOptions,
|
102
|
+
CoinbaseSDKWalletConnectionOptions,
|
103
|
+
} from "../wallets/coinbase/coinbaseWebSDK.js";
|
93
104
|
|
94
105
|
export type {
|
95
106
|
WalletEmitter,
|
@@ -101,6 +112,7 @@ export { getWalletInfo } from "../wallets/__generated__/getWalletInfo.js";
|
|
101
112
|
export { type WalletInfo } from "../wallets/wallet-info.js";
|
102
113
|
|
103
114
|
export { createWalletAdapter } from "../adapters/wallet-adapter.js";
|
115
|
+
export type { AdapterWalletOptions } from "../adapters/wallet-adapter.js";
|
104
116
|
|
105
117
|
// wallet connect
|
106
118
|
export {
|
@@ -1,6 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
type UseQueryResult,
|
3
|
+
useQueries,
|
4
|
+
useQuery,
|
5
|
+
} from "@tanstack/react-query";
|
2
6
|
import { useMemo } from "react";
|
3
|
-
import type { Chain } from "../../../../chains/types.js";
|
7
|
+
import type { Chain, ChainMetadata } from "../../../../chains/types.js";
|
4
8
|
import {
|
5
9
|
convertApiChainToChain,
|
6
10
|
getChainMetadata,
|
@@ -140,9 +144,25 @@ function getQueryOptions(chain?: Chain) {
|
|
140
144
|
}
|
141
145
|
|
142
146
|
/**
|
143
|
-
* @
|
147
|
+
* @description Retrieves metadata for a chain such as name, icon, available faucets, block explorers, etc.
|
148
|
+
*
|
149
|
+
* @param chain - Chain to retrieve metadata for, see [defineChain](https://portal.thirdweb.com/references/typescript/v5/defineChain) for how to create a chain from a chain ID.
|
150
|
+
* @returns A React Query result containing the chain metadata, @see {@link ChainMetadata}.
|
151
|
+
*
|
152
|
+
* @example
|
153
|
+
* ```jsx
|
154
|
+
* import { useChainMetadata } from "thirdweb/react";
|
155
|
+
*
|
156
|
+
* const { data: chainMetadata } = useChainMetadata(defineChain(11155111));
|
157
|
+
*
|
158
|
+
* console.log("Name:", chainMetadata.name); // Sepolia
|
159
|
+
* console.log("Faucets:", chainMetadata.faucets); // ["https://thirdweb.com/sepolia/faucet"]
|
160
|
+
* console.log("Explorers:", chainMetadata.explorers); // ["https://sepolia.etherscan.io/"]
|
161
|
+
* ```
|
162
|
+
*
|
163
|
+
* @chain
|
144
164
|
*/
|
145
|
-
export function
|
165
|
+
export function useChainMetadata(chain?: Chain): UseQueryResult<ChainMetadata> {
|
146
166
|
return useQuery({
|
147
167
|
...getQueryOptions(chain),
|
148
168
|
queryFn: async () => {
|
@@ -9,6 +9,11 @@ import { useAutoConnect } from "../../hooks/wallets/useAutoConnect.js";
|
|
9
9
|
* Note: If you are using `ConnectButton` or `ConnectEmbed` components, You don't need to use this component as it is already included.
|
10
10
|
*
|
11
11
|
* This is useful if you are manually connecting the wallets using the [`useConnect`](https://portal.thirdweb.com/references/typescript/v5/useConnect) hook and want to auto connect the last connected wallets on page reload or revisit.
|
12
|
+
*
|
13
|
+
* You can also use the [`useAutoConnect`](https://portal.thirdweb.com/references/typescript/v5/useAutoConnect) hook to achieve the same result.
|
14
|
+
*
|
15
|
+
* To check if the wallet in in the process of auto connecting, you can use the [`useIsAutoConnecting`](https://portal.thirdweb.com/references/typescript/v5/useIsAutoConnecting) hook.
|
16
|
+
*
|
12
17
|
* @param props - Object of type `AutoConnectProps`. Refer to [`AutoConnectProps`](https://portal.thirdweb.com/references/typescript/v5/AutoConnectProps)
|
13
18
|
* @example
|
14
19
|
* ```tsx
|