thirdweb 5.42.0-nightly-e27ebef85bb61342c3de53f85e134cf4a29f787c-20240730000342 → 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/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/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/wallets/shared/ConnectWalletSocialOptions.js +19 -7
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +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/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/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/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/wallets/shared/ConnectWalletSocialOptions.js +19 -7
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +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/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/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/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/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +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/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/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/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/wallets/shared/ConnectWalletSocialOptions.tsx +19 -8
- 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/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
|
*
|
@@ -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 {
|
@@ -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
|
@@ -33,18 +33,212 @@ import { SignatureScreen } from "./screens/SignatureScreen.js";
|
|
33
33
|
const TW_CONNECT_WALLET = "tw-connect-wallet";
|
34
34
|
|
35
35
|
/**
|
36
|
-
* A component that allows
|
37
|
-
*
|
36
|
+
* A fully featured wallet connection component that allows to:
|
37
|
+
*
|
38
|
+
* - Connect to 350+ external wallets
|
39
|
+
* - Connect with email, phone, passkey or socials
|
40
|
+
* - Convert any wallet to a ERC4337 smart wallet for gasless transactions
|
41
|
+
* - Sign in with ethereum (Auth)
|
42
|
+
*
|
43
|
+
* Once connected, the component allows to:
|
44
|
+
*
|
45
|
+
* - Reolve ENS names and avatars
|
46
|
+
* - Manage multipple connected wallets
|
47
|
+
* - Send and receive native tokens and ERC20 tokens
|
48
|
+
* - View ERC20 tokens and NFTs
|
49
|
+
* - Onramp, bridge and swap tokens
|
50
|
+
* - Switch chains
|
51
|
+
* - Connect to another app with WalletConnect
|
52
|
+
*
|
38
53
|
* @example
|
54
|
+
*
|
55
|
+
* ## Default setup
|
56
|
+
*
|
39
57
|
* ```tsx
|
58
|
+
* import { createThirdwebClient } from "thirdweb";
|
59
|
+
* import { ConnectButton } from "thirdweb/react";
|
60
|
+
*
|
61
|
+
* const client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" });
|
62
|
+
*
|
40
63
|
* <ConnectButton
|
41
64
|
* client={client}
|
42
65
|
* />
|
43
66
|
* ```
|
67
|
+
*
|
68
|
+
* [View all available config options](https://portal.thirdweb.com/references/typescript/v5/ConnectButtonProps)
|
69
|
+
*
|
70
|
+
* ## Customization options
|
71
|
+
*
|
72
|
+
* ### Customizing wallet options
|
73
|
+
*
|
74
|
+
* ```tsx
|
75
|
+
* <ConnectButton
|
76
|
+
* client={client}
|
77
|
+
* wallets={[
|
78
|
+
* createWallet("io.metamask"),
|
79
|
+
* createWallet("com.coinbase.wallet"),
|
80
|
+
* createWallet("me.rainbow"),
|
81
|
+
* ]}
|
82
|
+
* />
|
83
|
+
* ```
|
84
|
+
*
|
85
|
+
* [View all available wallets](https://portal.thirdweb.com/typescript/v5/supported-wallets)
|
86
|
+
*
|
87
|
+
* ### Customizing the default chain to connect to
|
88
|
+
*
|
89
|
+
* ```tsx
|
90
|
+
* import { base } from "thirdweb/chains";
|
91
|
+
*
|
92
|
+
* <ConnectButton
|
93
|
+
* client={client}
|
94
|
+
* chain={base}
|
95
|
+
* />
|
96
|
+
* ```
|
97
|
+
*
|
98
|
+
* ### Enabling sign in with ethereum (Auth)
|
99
|
+
*
|
100
|
+
* ```tsx
|
101
|
+
* <ConnectButton
|
102
|
+
* client={client}
|
103
|
+
* auth={{
|
104
|
+
* isLoggedIn: async (address) => {
|
105
|
+
* console.log("checking if logged in!", { address });
|
106
|
+
* return await isLoggedIn();
|
107
|
+
* },
|
108
|
+
* doLogin: async (params) => {
|
109
|
+
* console.log("logging in!");
|
110
|
+
* await login(params);
|
111
|
+
* },
|
112
|
+
* getLoginPayload: async ({ address }) =>
|
113
|
+
* generatePayload({ address }),
|
114
|
+
* doLogout: async () => {
|
115
|
+
* console.log("logging out!");
|
116
|
+
* await logout();
|
117
|
+
* },
|
118
|
+
* }}
|
119
|
+
* />;
|
120
|
+
* ```
|
121
|
+
*
|
122
|
+
* ### Customizing the theme
|
123
|
+
*
|
124
|
+
* ```tsx
|
125
|
+
* <ConnectButton
|
126
|
+
* client={client}
|
127
|
+
* theme="light"
|
128
|
+
* />
|
129
|
+
* ```
|
130
|
+
*
|
131
|
+
* For more granular control, you can also pass a custom theme object:
|
132
|
+
*
|
133
|
+
* ```tsx
|
134
|
+
* <ConnectButton
|
135
|
+
* client={client}
|
136
|
+
* theme={lightTheme({
|
137
|
+
* colors: {
|
138
|
+
* modalBg: "red",
|
139
|
+
* },
|
140
|
+
* })}
|
141
|
+
* />
|
142
|
+
* ```
|
143
|
+
*
|
144
|
+
* [View all available themes properties](https://portal.thirdweb.com/references/typescript/v5/Theme)
|
145
|
+
*
|
146
|
+
* ### Changing the display language
|
147
|
+
*
|
148
|
+
* ```tsx
|
149
|
+
* <ConnectEmbed
|
150
|
+
* client={client}
|
151
|
+
* locale="ja_JP"
|
152
|
+
* />
|
153
|
+
* ```
|
154
|
+
*
|
155
|
+
* [View all available locales](https://portal.thirdweb.com/references/typescript/v5/LocaleId)
|
156
|
+
*
|
157
|
+
* ### Customizing the connect button UI
|
158
|
+
*
|
159
|
+
* ```tsx
|
160
|
+
* <ConnectButton
|
161
|
+
* client={client}
|
162
|
+
* connectButton={{
|
163
|
+
* label: "Sign in to MyApp",
|
164
|
+
* }}
|
165
|
+
* />
|
166
|
+
* ```
|
167
|
+
*
|
168
|
+
* ### Customizing the modal UI
|
169
|
+
*
|
170
|
+
* ```tsx
|
171
|
+
* <ConnectButton
|
172
|
+
* client={client}
|
173
|
+
* connectModal={{
|
174
|
+
* title: "Sign in to MyApp",
|
175
|
+
* titleIcon: https://example.com/logo.png,
|
176
|
+
* size: "compact",
|
177
|
+
* }}
|
178
|
+
* />
|
179
|
+
* ```
|
180
|
+
*
|
181
|
+
* ### Customizing details button UI (after connecting)
|
182
|
+
*
|
183
|
+
* ```tsx
|
184
|
+
* <ConnectButton
|
185
|
+
* client={client}
|
186
|
+
* detailsButton={{
|
187
|
+
* displayBalanceToken: {
|
188
|
+
* [sepolia.id]: "0x...", // token address to display balance for
|
189
|
+
* [ethereum.id]: "0x...", // token address to display balance for
|
190
|
+
* },
|
191
|
+
* }}
|
192
|
+
* />
|
193
|
+
* ```
|
194
|
+
*
|
195
|
+
* [View all available auth helper functions](https://portal.thirdweb.com/references/typescript/v5/createAuth)
|
196
|
+
*
|
197
|
+
* ### Customizing the Auth sign in button (after connecting, but before authenticating)
|
198
|
+
*
|
199
|
+
* ```tsx
|
200
|
+
* <ConnectButton
|
201
|
+
* client={client}
|
202
|
+
* auth={{ ... }}
|
203
|
+
* signInButton: {
|
204
|
+
* label: "Authenticate with MyApp",
|
205
|
+
* },
|
206
|
+
* }}
|
207
|
+
* />;
|
208
|
+
* ```
|
209
|
+
*
|
210
|
+
* ### Customizing supported Tokens and NFTs
|
211
|
+
*
|
212
|
+
* These tokens and NFTs will be shown in the modal when the user clicks "View Assets", as well as the send token screen.
|
213
|
+
*
|
214
|
+
* ```tsx
|
215
|
+
* <ConnectButton
|
216
|
+
* client={client}
|
217
|
+
* supportedTokens={{
|
218
|
+
* [ethereum.id]: [
|
219
|
+
* {
|
220
|
+
* address: "0x...",
|
221
|
+
* name: "MyToken",
|
222
|
+
* symbol: "MT",
|
223
|
+
* icon: "https://example.com/icon.png",
|
224
|
+
* },
|
225
|
+
* ],
|
226
|
+
* }}
|
227
|
+
* supportedNFTs={{
|
228
|
+
* [ethereum.id]: [
|
229
|
+
* "0x...", // nft contract address
|
230
|
+
* ],
|
231
|
+
* }}
|
232
|
+
* />
|
233
|
+
* ```
|
234
|
+
*
|
44
235
|
* @param props
|
45
236
|
* Props for the `ConnectButton` component
|
46
237
|
*
|
47
238
|
* Refer to [ConnectButtonProps](https://portal.thirdweb.com/references/typescript/v5/ConnectButtonProps) to see the available props.
|
239
|
+
*
|
240
|
+
* @returns A JSX element that renders the <ConnectButton> component.
|
241
|
+
*
|
48
242
|
* @component
|
49
243
|
*/
|
50
244
|
export function ConnectButton(props: ConnectButtonProps) {
|