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 @@ -18,6 +18,12 @@ export type {
1818 InAppWalletAuth ,
1919 InAppWalletSocialAuth ,
2020 InAppWalletConnectionOptions ,
21+ InAppWalletAutoConnectOptions ,
2122} from "../../wallets/in-app/core/wallet/types.js" ;
2223
24+ export type {
25+ MultiStepAuthArgsType ,
26+ SingleStepAuthArgsType ,
27+ } from "../../wallets/in-app/core/authentication/types.js" ;
28+
2329export { 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 {
1818 InAppWalletAuth ,
1919 InAppWalletSocialAuth ,
2020 InAppWalletConnectionOptions ,
21+ InAppWalletAutoConnectOptions ,
2122} from "../../wallets/in-app/core/wallet/types.js" ;
2223
24+ export type {
25+ MultiStepAuthArgsType ,
26+ SingleStepAuthArgsType ,
27+ } from "../../wallets/in-app/core/authentication/types.js" ;
28+
2329export { hasStoredPasskey } from "../../wallets/in-app/web/lib/auth/passkeys.js" ;
2430
2531export {
Original file line number Diff line number Diff line change 11import type { Chain } from "../../../../chains/types.js" ;
22import type { ThirdwebClient } from "../../../../client/client.js" ;
33import type { SupportedSmsCountry } from "../../../../react/web/wallets/in-app/supported-sms-countries.js" ;
4+ import type { Prettify } from "../../../../utils/type-utils.js" ;
45import type { SmartWalletOptions } from "../../../smart/types.js" ;
56import type {
67 AuthOption ,
@@ -20,14 +21,12 @@ export type Ecosystem = {
2021 partnerId ?: string ;
2122} ;
2223
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+ > ;
3130
3231export type InAppWalletAutoConnectOptions = {
3332 client : ThirdwebClient ;
You can’t perform that action at this time.
0 commit comments