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 11---
2- " @thirdweb-dev/wagmi-adapter " : major
2+ " @thirdweb-dev/wagmi-adapter " : minor
33---
44
55Wagmi connector for in-app wallets
66
77You can now connect to an in-app wallet in your wagmi applications.
88
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+
917``` ts
1018import { http , createConfig } from " wagmi" ;
1119import { inAppWalletConnector } from " @thirdweb-dev/wagmi-adapter" ;
20+ import { createThirdwebClient , defineChain as thirdwebChain } from " thirdweb" ;
21+
22+ const client = createThirdwebClient ({
23+ clientId: " ..." ,
24+ });
1225
1326export const config = createConfig ({
1427 chains: [sepolia ],
1528 connectors: [
1629 inAppWalletConnector ({
17- clientId: " ..." ,
18- strategy: " google" ,
30+ client ,
31+ // optional: turn on smart accounts
32+ smartAccounts: {
33+ sponsorGas: true ,
34+ chain: thirdwebChain (sepolia ),
35+ },
1936 }),
2037 ],
2138 transports: {
2239 [sepolia .id ]: http (),
2340 },
2441});
2542```
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 {
8989 * @deprecated use InAppWalletSocialAuth instead
9090 */
9191 InAppWalletSocialAuth as EmbeddedWalletSocialAuth ,
92+ InAppWalletCreationOptions ,
9293} from "../wallets/in-app/core/wallet/types.js" ;
9394
95+ export type {
96+ MultiStepAuthArgsType ,
97+ SingleStepAuthArgsType ,
98+ } from "../wallets/in-app/core/authentication/types.js" ;
99+
94100export {
95101 preAuthenticate ,
96102 authenticate ,
Original file line number Diff line number Diff line change @@ -96,8 +96,14 @@ export type {
9696 * @deprecated use InAppWalletSocialAuth instead
9797 */
9898 InAppWalletSocialAuth as EmbeddedWalletSocialAuth ,
99+ InAppWalletCreationOptions ,
99100} from "../wallets/in-app/core/wallet/types.js" ;
100101
102+ export type {
103+ MultiStepAuthArgsType ,
104+ SingleStepAuthArgsType ,
105+ } from "../wallets/in-app/core/authentication/types.js" ;
106+
101107export {
102108 preAuthenticate ,
103109 authenticate ,
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ export type {
1717 InAppWalletAuth ,
1818 InAppWalletSocialAuth ,
1919 InAppWalletConnectionOptions ,
20+ InAppWalletAutoConnectOptions ,
2021} from "../../wallets/in-app/core/wallet/types.js" ;
2122
23+ export type {
24+ MultiStepAuthArgsType ,
25+ SingleStepAuthArgsType ,
26+ } from "../../wallets/in-app/core/authentication/types.js" ;
27+
2228export { hasStoredPasskey } from "../../wallets/in-app/native/auth/passkeys.js" ;
Original file line number Diff line number Diff line change @@ -17,8 +17,14 @@ export type {
1717 InAppWalletAuth ,
1818 InAppWalletSocialAuth ,
1919 InAppWalletConnectionOptions ,
20+ InAppWalletAutoConnectOptions ,
2021} from "../../wallets/in-app/core/wallet/types.js" ;
2122
23+ export type {
24+ MultiStepAuthArgsType ,
25+ SingleStepAuthArgsType ,
26+ } from "../../wallets/in-app/core/authentication/types.js" ;
27+
2228export { hasStoredPasskey } from "../../wallets/in-app/web/lib/auth/passkeys.js" ;
2329
2430export {
Original file line number Diff line number Diff line change 11import type { Chain } from "../../../../chains/types.js" ;
22import type { ThirdwebClient } from "../../../../client/client.js" ;
3+ import type { Prettify } from "../../../../utils/type-utils.js" ;
34import type { SmartWalletOptions } from "../../../smart/types.js" ;
45import type {
56 AuthOption ,
@@ -19,14 +20,12 @@ export type Ecosystem = {
1920 partnerId ?: string ;
2021} ;
2122
22- export type InAppWalletConnectionOptions = (
23- | MultiStepAuthArgsType
24- | SingleStepAuthArgsType
25- ) & {
26- client : ThirdwebClient ;
27- chain ?: Chain ;
28- redirect ?: boolean ;
29- } ;
23+ export type InAppWalletConnectionOptions = Prettify <
24+ ( MultiStepAuthArgsType | SingleStepAuthArgsType ) & {
25+ client : ThirdwebClient ;
26+ chain ?: Chain ;
27+ }
28+ > ;
3029
3130export type InAppWalletAutoConnectOptions = {
3231 client : ThirdwebClient ;
You can’t perform that action at this time.
0 commit comments