File tree Expand file tree Collapse file tree 10 files changed +280
-198
lines changed Expand file tree Collapse file tree 10 files changed +280
-198
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- " @thirdweb-dev/wagmi-adapter " : major
2
+ " @thirdweb-dev/wagmi-adapter " : minor
3
3
---
4
4
5
5
Wagmi connector for in-app wallets
6
6
7
7
You can now connect to an in-app wallet in your wagmi applications.
8
8
9
+ Install the wagmi adapter:
10
+
11
+ ``` bash
12
+ npm install @thirdweb-dev/wagmi-adapter
13
+ ```
14
+
15
+ Create a wagmi config with the in-app wallet connector:
16
+
9
17
``` ts
10
18
import { http , createConfig } from " wagmi" ;
11
19
import { inAppWalletConnector } from " @thirdweb-dev/wagmi-adapter" ;
20
+ import { createThirdwebClient , defineChain as thirdwebChain } from " thirdweb" ;
21
+
22
+ const client = createThirdwebClient ({
23
+ clientId: " ..." ,
24
+ });
12
25
13
26
export const config = createConfig ({
14
27
chains: [sepolia ],
15
28
connectors: [
16
29
inAppWalletConnector ({
17
- clientId: " ..." ,
18
- strategy: " google" ,
30
+ client ,
31
+ // optional: turn on smart accounts
32
+ smartAccounts: {
33
+ sponsorGas: true ,
34
+ chain: thirdwebChain (sepolia ),
35
+ },
19
36
}),
20
37
],
21
38
transports: {
22
39
[sepolia .id ]: http (),
23
40
},
24
41
});
25
42
```
43
+
44
+ Then in your app, you can use the connector to connect with any supported strategy:
45
+
46
+ ``` ts
47
+ const { connect, connectors } = useConnect ();
48
+
49
+ const onClick = () => {
50
+ const inAppWallet = connectors .find ((x ) => x .id === " in-app-wallet" );
51
+ connect ({
52
+ connector: inAppWallet ,
53
+ strategy: " google" ,
54
+ });
55
+ };
56
+ ```
Original file line number Diff line number Diff line change @@ -89,8 +89,14 @@ export type {
89
89
* @deprecated use InAppWalletSocialAuth instead
90
90
*/
91
91
InAppWalletSocialAuth as EmbeddedWalletSocialAuth ,
92
+ InAppWalletCreationOptions ,
92
93
} from "../wallets/in-app/core/wallet/types.js" ;
93
94
95
+ export type {
96
+ MultiStepAuthArgsType ,
97
+ SingleStepAuthArgsType ,
98
+ } from "../wallets/in-app/core/authentication/types.js" ;
99
+
94
100
export {
95
101
preAuthenticate ,
96
102
authenticate ,
Original file line number Diff line number Diff line change @@ -96,8 +96,14 @@ export type {
96
96
* @deprecated use InAppWalletSocialAuth instead
97
97
*/
98
98
InAppWalletSocialAuth as EmbeddedWalletSocialAuth ,
99
+ InAppWalletCreationOptions ,
99
100
} from "../wallets/in-app/core/wallet/types.js" ;
100
101
102
+ export type {
103
+ MultiStepAuthArgsType ,
104
+ SingleStepAuthArgsType ,
105
+ } from "../wallets/in-app/core/authentication/types.js" ;
106
+
101
107
export {
102
108
preAuthenticate ,
103
109
authenticate ,
Original file line number Diff line number Diff line change @@ -18,6 +18,12 @@ export type {
18
18
InAppWalletAuth ,
19
19
InAppWalletSocialAuth ,
20
20
InAppWalletConnectionOptions ,
21
+ InAppWalletAutoConnectOptions ,
21
22
} from "../../wallets/in-app/core/wallet/types.js" ;
22
23
24
+ export type {
25
+ MultiStepAuthArgsType ,
26
+ SingleStepAuthArgsType ,
27
+ } from "../../wallets/in-app/core/authentication/types.js" ;
28
+
23
29
export { hasStoredPasskey } from "../../wallets/in-app/native/auth/passkeys.js" ;
Original file line number Diff line number Diff line change @@ -18,8 +18,14 @@ export type {
18
18
InAppWalletAuth ,
19
19
InAppWalletSocialAuth ,
20
20
InAppWalletConnectionOptions ,
21
+ InAppWalletAutoConnectOptions ,
21
22
} from "../../wallets/in-app/core/wallet/types.js" ;
22
23
24
+ export type {
25
+ MultiStepAuthArgsType ,
26
+ SingleStepAuthArgsType ,
27
+ } from "../../wallets/in-app/core/authentication/types.js" ;
28
+
23
29
export { hasStoredPasskey } from "../../wallets/in-app/web/lib/auth/passkeys.js" ;
24
30
25
31
export {
Original file line number Diff line number Diff line change 1
1
import type { Chain } from "../../../../chains/types.js" ;
2
2
import type { ThirdwebClient } from "../../../../client/client.js" ;
3
3
import type { SupportedSmsCountry } from "../../../../react/web/wallets/in-app/supported-sms-countries.js" ;
4
+ import type { Prettify } from "../../../../utils/type-utils.js" ;
4
5
import type { SmartWalletOptions } from "../../../smart/types.js" ;
5
6
import type {
6
7
AuthOption ,
@@ -20,14 +21,12 @@ export type Ecosystem = {
20
21
partnerId ?: string ;
21
22
} ;
22
23
23
- export type InAppWalletConnectionOptions = (
24
- | MultiStepAuthArgsType
25
- | SingleStepAuthArgsType
26
- ) & {
27
- client : ThirdwebClient ;
28
- chain ?: Chain ;
29
- redirect ?: boolean ;
30
- } ;
24
+ export type InAppWalletConnectionOptions = Prettify <
25
+ ( MultiStepAuthArgsType | SingleStepAuthArgsType ) & {
26
+ client : ThirdwebClient ;
27
+ chain ?: Chain ;
28
+ }
29
+ > ;
31
30
32
31
export type InAppWalletAutoConnectOptions = {
33
32
client : ThirdwebClient ;
You can’t perform that action at this time.
0 commit comments