@getpara/react-sdk-lite 2.0.0-alpha.33 → 2.0.0-alpha.35

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.
Files changed (104) hide show
  1. package/dist/modal/components/Account/AccountProfile.js +22 -4
  2. package/dist/modal/components/Account/AccountProfileLink.js +10 -5
  3. package/dist/modal/components/Account/AccountProfileLinkOptions.js +21 -13
  4. package/dist/modal/components/Account/AccountProfileUnlink.js +6 -4
  5. package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -1
  6. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +3 -54
  7. package/dist/modal/components/AddFunds/AddFundsProvider.js +2 -6
  8. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +2 -2
  9. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +6 -6
  10. package/dist/modal/components/ExternalWallets/ExternalWallets.js +5 -5
  11. package/dist/modal/components/OAuth/OAuth.js +3 -5
  12. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +2 -2
  13. package/dist/modal/components/common.d.ts +7 -5
  14. package/dist/modal/components/common.js +5 -4
  15. package/dist/modal/constants/constants.js +1 -1
  16. package/dist/modal/constants/oAuthLogos.d.ts +2 -3
  17. package/dist/modal/constants/oAuthLogos.js +28 -28
  18. package/dist/modal/stores/modal/actions.js +2 -2
  19. package/dist/modal/stores/modal/useModalStore.d.ts +8 -2
  20. package/dist/modal/stores/modal/useModalStore.js +1 -1
  21. package/dist/provider/components/ExternalWalletWrapper.js +3 -26
  22. package/dist/provider/hooks/mutations/index.d.ts +28 -2
  23. package/dist/provider/hooks/mutations/index.js +57 -3
  24. package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +40 -0
  25. package/dist/provider/hooks/mutations/useClaimPregenWallets.js +28 -0
  26. package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +33 -0
  27. package/dist/provider/hooks/mutations/useCreateGuestWallets.js +28 -0
  28. package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +120 -0
  29. package/dist/provider/hooks/mutations/useCreatePregenWallet.js +28 -0
  30. package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +42 -0
  31. package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.js +28 -0
  32. package/dist/provider/hooks/mutations/useCreateWallet.d.ts +42 -0
  33. package/dist/provider/hooks/mutations/useCreateWallet.js +28 -0
  34. package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +54 -0
  35. package/dist/provider/hooks/mutations/useCreateWalletPerType.js +28 -0
  36. package/dist/provider/hooks/mutations/useEnable2fa.d.ts +39 -0
  37. package/dist/provider/hooks/mutations/useEnable2fa.js +28 -0
  38. package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +40 -0
  39. package/dist/provider/hooks/mutations/useHasPregenWallet.js +28 -0
  40. package/dist/provider/hooks/mutations/useIssueJwt.d.ts +48 -0
  41. package/dist/provider/hooks/mutations/useIssueJwt.js +28 -0
  42. package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +34 -0
  43. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +28 -0
  44. package/dist/provider/hooks/mutations/useLinkAccount.d.ts +30 -1
  45. package/dist/provider/hooks/mutations/useLinkAccount.js +3 -1
  46. package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +46 -0
  47. package/dist/provider/hooks/mutations/useLoginExternalWallet.js +28 -0
  48. package/dist/provider/hooks/mutations/useLogout.d.ts +39 -0
  49. package/dist/provider/hooks/mutations/useLogout.js +28 -0
  50. package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +40 -0
  51. package/dist/provider/hooks/mutations/useResendVerificationCode.js +28 -0
  52. package/dist/provider/hooks/mutations/useSetup2fa.d.ts +34 -0
  53. package/dist/provider/hooks/mutations/useSetup2fa.js +28 -0
  54. package/dist/provider/hooks/mutations/useSignMessage.d.ts +58 -0
  55. package/dist/provider/hooks/mutations/useSignMessage.js +28 -0
  56. package/dist/provider/hooks/mutations/useSignTransaction.d.ts +58 -0
  57. package/dist/provider/hooks/mutations/useSignTransaction.js +28 -0
  58. package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +46 -0
  59. package/dist/provider/hooks/mutations/useSignUpOrLogIn.js +28 -0
  60. package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +42 -0
  61. package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.js +28 -0
  62. package/dist/provider/hooks/mutations/useVerify2fa.d.ts +57 -0
  63. package/dist/provider/hooks/mutations/useVerify2fa.js +28 -0
  64. package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +93 -0
  65. package/dist/provider/hooks/mutations/useVerifyExternalWallet.js +28 -0
  66. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +55 -0
  67. package/dist/provider/hooks/mutations/useVerifyFarcaster.js +28 -0
  68. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +84 -0
  69. package/dist/provider/hooks/mutations/useVerifyNewAccount.js +28 -0
  70. package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +64 -0
  71. package/dist/provider/hooks/mutations/useVerifyOAuth.js +28 -0
  72. package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +46 -0
  73. package/dist/provider/hooks/mutations/useVerifyTelegram.js +28 -0
  74. package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +57 -0
  75. package/dist/provider/hooks/mutations/useWaitForLogin.js +28 -0
  76. package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +45 -0
  77. package/dist/provider/hooks/mutations/useWaitForSignup.js +28 -0
  78. package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +54 -0
  79. package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +28 -0
  80. package/dist/provider/hooks/mutations/utils.d.ts +2 -7
  81. package/dist/provider/hooks/mutations/utils.js +0 -24
  82. package/dist/provider/hooks/queries/index.d.ts +2 -1
  83. package/dist/provider/hooks/queries/index.js +4 -1
  84. package/dist/provider/hooks/queries/useAccountLinkInProgress.d.ts +6 -0
  85. package/dist/provider/hooks/queries/useAccountLinkInProgress.js +24 -0
  86. package/dist/provider/hooks/queries/useLinkedAccounts.d.ts +11 -0
  87. package/dist/provider/hooks/queries/useLinkedAccounts.js +24 -0
  88. package/dist/provider/providers/AccountLinkProvider.d.ts +4 -4
  89. package/dist/provider/providers/AccountLinkProvider.js +17 -13
  90. package/dist/provider/providers/AuthProvider.d.ts +0 -1
  91. package/dist/provider/providers/AuthProvider.js +18 -45
  92. package/dist/provider/providers/ExternalWalletProvider.d.ts +6 -5
  93. package/dist/provider/providers/ExternalWalletProvider.js +21 -26
  94. package/dist/provider/utils/externalWalletDefaults.d.ts +6 -0
  95. package/dist/provider/utils/externalWalletDefaults.js +33 -0
  96. package/dist/provider/utils/renameMutations.d.ts +9 -5
  97. package/dist/provider/utils/renameMutations.js +3 -5
  98. package/package.json +8 -8
  99. package/dist/provider/hooks/mutations/core.d.ts +0 -27
  100. package/dist/provider/hooks/mutations/core.js +0 -66
  101. package/dist/provider/hooks/queries/core.d.ts +0 -4
  102. package/dist/provider/hooks/queries/core.js +0 -16
  103. package/dist/provider/hooks/queries/utils.d.ts +0 -7
  104. package/dist/provider/hooks/queries/utils.js +0 -25
@@ -4,31 +4,8 @@ import {
4
4
  __spreadProps,
5
5
  __spreadValues
6
6
  } from "../../../chunk-MMUBH76A.js";
7
- import { renameCoreMutations } from "../../utils/renameMutations.js";
8
- import { useClient } from "../utils/index.js";
9
7
  import { useMutation, useMutationState } from "@tanstack/react-query";
10
8
  import { useInternalClient } from "../utils/useInternalClient.js";
11
- function generateCoreMutation(method, action, {
12
- delay,
13
- defaultParams
14
- } = {}) {
15
- return () => {
16
- const para = useClient();
17
- const mutation = useMutation({
18
- mutationKey: [method],
19
- mutationFn: (args) => __async(this, null, function* () {
20
- if (typeof delay === "number") yield new Promise((resolve) => setTimeout(resolve, delay));
21
- try {
22
- const result = yield action(para, args != null ? args : defaultParams);
23
- return result;
24
- } catch (error) {
25
- throw error;
26
- }
27
- })
28
- });
29
- return renameCoreMutations(mutation, method);
30
- };
31
- }
32
9
  function generateInternalMutation(method, action, {
33
10
  delay,
34
11
  defaultParams
@@ -84,7 +61,6 @@ function generateStateHook(method) {
84
61
  };
85
62
  }
86
63
  export {
87
- generateCoreMutation,
88
64
  generateInternalMutation,
89
65
  generateStateHook
90
66
  };
@@ -2,4 +2,5 @@ export { useAccount } from './useAccount.js';
2
2
  export { useParaStatus } from './useParaStatus.js';
3
3
  export { useWallet } from './useWallet.js';
4
4
  export { useWalletBalance } from './useWalletBalance.js';
5
- export * from './core.js';
5
+ export { useLinkedAccounts } from './useLinkedAccounts.js';
6
+ export { useAccountLinkInProgress } from './useAccountLinkInProgress.js';
@@ -4,9 +4,12 @@ import { useAccount } from "./useAccount.js";
4
4
  import { useParaStatus } from "./useParaStatus.js";
5
5
  import { useWallet } from "./useWallet.js";
6
6
  import { useWalletBalance } from "./useWalletBalance.js";
7
- export * from "./core.js";
7
+ import { useLinkedAccounts } from "./useLinkedAccounts.js";
8
+ import { useAccountLinkInProgress } from "./useAccountLinkInProgress.js";
8
9
  export {
9
10
  useAccount,
11
+ useAccountLinkInProgress,
12
+ useLinkedAccounts,
10
13
  useParaStatus,
11
14
  useWallet,
12
15
  useWalletBalance
@@ -0,0 +1,6 @@
1
+ export declare const ACCOUNT_LINK_IN_PROGRESS_BASE_KEY = "ACCOUNT_LINK_IN_PROGRESS";
2
+ /**
3
+ * Hook for returning the account linking status of the user
4
+ * @returns A query that returns the account linking status
5
+ */
6
+ export declare const useAccountLinkInProgress: () => import("@tanstack/react-query").UseQueryResult<import("@getpara/core-sdk").AccountLinkInProgress, Error>;
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { useQuery } from "@tanstack/react-query";
6
+ import { useInternalClient } from "../utils/useInternalClient.js";
7
+ import { accountLinkInProgress } from "../../actions/index.js";
8
+ const ACCOUNT_LINK_IN_PROGRESS_BASE_KEY = "ACCOUNT_LINK_IN_PROGRESS";
9
+ const useAccountLinkInProgress = () => {
10
+ var _a, _b;
11
+ const client = useInternalClient();
12
+ return useQuery({
13
+ enabled: !!(client == null ? void 0 : client.isReady),
14
+ queryKey: [ACCOUNT_LINK_IN_PROGRESS_BASE_KEY, (_a = client == null ? void 0 : client.userId) != null ? _a : null, (_b = client == null ? void 0 : client.accountLinkInProgress) != null ? _b : null],
15
+ queryFn: () => __async(void 0, null, function* () {
16
+ var _a2;
17
+ return (_a2 = yield accountLinkInProgress(client)) != null ? _a2 : null;
18
+ })
19
+ });
20
+ };
21
+ export {
22
+ ACCOUNT_LINK_IN_PROGRESS_BASE_KEY,
23
+ useAccountLinkInProgress
24
+ };
@@ -0,0 +1,11 @@
1
+ import { CoreMethodParams } from '@getpara/web-sdk';
2
+ export declare const LINKED_ACCOUNTS_BASE_KEY = "PARA_LINKED_ACCOUNTS";
3
+ /**
4
+ * Hook for returning the linked accounts of the user.
5
+ * @param params - Optional parameters for fetching linked accounts.
6
+ * - withMetadata (boolean): Whether to include metadata for each linked account. Defaults to false.
7
+ * @returns A query object containing the linked accounts array and query status.
8
+ */
9
+ export declare const useLinkedAccounts: (params?: CoreMethodParams<"getLinkedAccounts">) => import("@tanstack/react-query").UseQueryResult<import("@getpara/web-sdk").LinkedAccounts & {
10
+ userId: string;
11
+ }, Error>;
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { useQuery } from "@tanstack/react-query";
6
+ import { useInternalClient } from "../utils/useInternalClient.js";
7
+ import { getLinkedAccounts } from "../../actions/index.js";
8
+ const LINKED_ACCOUNTS_BASE_KEY = "PARA_LINKED_ACCOUNTS";
9
+ const useLinkedAccounts = (params = { withMetadata: false }) => {
10
+ var _a;
11
+ const client = useInternalClient();
12
+ return useQuery({
13
+ enabled: !!(client == null ? void 0 : client.isReady),
14
+ queryKey: [LINKED_ACCOUNTS_BASE_KEY, (_a = client == null ? void 0 : client.userId) != null ? _a : null, params],
15
+ queryFn: () => __async(void 0, null, function* () {
16
+ var _a2;
17
+ return (_a2 = yield getLinkedAccounts(client, params)) != null ? _a2 : [];
18
+ })
19
+ });
20
+ };
21
+ export {
22
+ LINKED_ACCOUNTS_BASE_KEY,
23
+ useLinkedAccounts
24
+ };
@@ -1,9 +1,9 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { MutationStatus } from '@tanstack/react-query';
3
- import { AccountLinkError, AccountLinkInProgress as CoreAccountLinkInProgress, LinkedAccount, LinkedAccounts, SupportedAccountLinks, TelegramAuthResponse, TExternalWallet, TLinkedAccountType, Auth, InternalMethodParams } from '@getpara/web-sdk';
4
- import { TWalletType } from '@getpara/user-management-client';
3
+ import { AccountLinkError, AccountLinkInProgress as CoreAccountLinkInProgress, LinkedAccount, LinkedAccounts, SupportedAccountLinks, TelegramAuthResponse, TLinkedAccountType, Auth, InternalMethodParams } from '@getpara/web-sdk';
4
+ import { TExternalWallet, TWalletType } from '@getpara/user-management-client';
5
5
  type AccountLinkInProgress = Partial<CoreAccountLinkInProgress & {
6
- pendingWalletProvider?: TExternalWallet;
6
+ pendingWalletProvider?: string;
7
7
  pendingWalletType?: TWalletType;
8
8
  }>;
9
9
  export type ModalLinkAccountArgs = undefined | {
@@ -12,7 +12,7 @@ export type ModalLinkAccountArgs = undefined | {
12
12
  type: Exclude<TLinkedAccountType, 'EXTERNAL_WALLET'> | 'X';
13
13
  } | {
14
14
  externalWallet: {
15
- internalId: TExternalWallet;
15
+ provider: TExternalWallet | string;
16
16
  type?: TWalletType;
17
17
  };
18
18
  } | {
@@ -12,13 +12,13 @@ import {
12
12
  LINKED_ACCOUNT_TYPES
13
13
  } from "@getpara/web-sdk";
14
14
  import { useModalStore } from "../../modal/stores/index.js";
15
- import { ModalStep, openPopup } from "../../modal/index.js";
15
+ import { ModalStep } from "../../modal/index.js";
16
16
  import { useGoBack } from "../../modal/hooks/useGoBack.js";
17
17
  import { useExternalWallets } from "./ExternalWalletProvider.js";
18
18
  import { useInternalClient } from "../hooks/utils/useInternalClient.js";
19
19
  import { generateInternalMutation } from "../hooks/mutations/utils.js";
20
20
  import { validateAuth } from "../../modal/utils/authInputHelpers.js";
21
- import { extractAuthInfo } from "@getpara/user-management-client";
21
+ import { EXTERNAL_WALLET_TYPES, extractAuthInfo } from "@getpara/user-management-client";
22
22
  import { useStore } from "../stores/useStore.js";
23
23
  const AccountLinkContext = createContext({
24
24
  isEnabled: false,
@@ -119,6 +119,7 @@ const AccountLinkProvider = ({ children }) => {
119
119
  const [linkAccountError, setLinkAccountError] = useState(null);
120
120
  const [linkAccountStatus, setLinkAccountStatus] = useState("pending");
121
121
  const linkAccount = (args) => __async(void 0, null, function* () {
122
+ var _a2;
122
123
  if (!isEnabled) {
123
124
  setLinkAccountError(AccountLinkError.NotAuthenticated);
124
125
  throw new Error(AccountLinkError.NotAuthenticated);
@@ -138,9 +139,17 @@ const AccountLinkProvider = ({ children }) => {
138
139
  break;
139
140
  case (args && "externalWallet" in args):
140
141
  {
141
- const providerId = args.externalWallet.internalId;
142
+ const isSupportedWalletType = EXTERNAL_WALLET_TYPES.includes(args.externalWallet.provider);
143
+ let supportedWalletId;
144
+ if (isSupportedWalletType) {
145
+ supportedWalletId = (_a2 = wallets.find((w) => w.internalId === args.externalWallet.provider)) == null ? void 0 : _a2.id;
146
+ if (!supportedWalletId) {
147
+ throw new Error(`wallet not installed: ${args.externalWallet.provider}`);
148
+ }
149
+ }
150
+ const providerId = supportedWalletId != null ? supportedWalletId : args.externalWallet.provider;
142
151
  const type = args.externalWallet.type;
143
- if (providerId === (connectedWallet == null ? void 0 : connectedWallet.internalId)) {
152
+ if (providerId === (connectedWallet == null ? void 0 : connectedWallet.id)) {
144
153
  throw new Error(`Cannot link the currently connected external wallet: ${providerId}`);
145
154
  }
146
155
  setAccountLinkInProgress({
@@ -148,7 +157,7 @@ const AccountLinkProvider = ({ children }) => {
148
157
  pendingWalletProvider: providerId,
149
158
  pendingWalletType: type
150
159
  });
151
- const linkWallet = wallets.find((w) => w.internalId === providerId);
160
+ const linkWallet = wallets.find((w) => w.id === providerId);
152
161
  if (!linkWallet) {
153
162
  throw new Error(`wallet not installed: ${providerId}`);
154
163
  }
@@ -181,7 +190,7 @@ const AccountLinkProvider = ({ children }) => {
181
190
  setLinkAccountError(`Error authenticating external wallet: ${e.message}`);
182
191
  } finally {
183
192
  if (linkWallet.type === "EVM" || linkWallet.type === "SOLANA") {
184
- yield disconnectBase(providerId);
193
+ yield disconnectBase(providerId, linkWallet.type);
185
194
  }
186
195
  }
187
196
  }
@@ -250,13 +259,8 @@ const AccountLinkProvider = ({ children }) => {
250
259
  var _a2;
251
260
  return !!((_a2 = refs.popupWindow.current) == null ? void 0 : _a2.closed);
252
261
  },
253
- onOAuthUrl: (oAuthUrl) => {
254
- refs.popupWindow.current = openPopup({
255
- url: oAuthUrl,
256
- target: `${method}AuthPopup`,
257
- type: "OAUTH",
258
- current: refs.popupWindow.current
259
- });
262
+ onOAuthPopup: (oAuthPopup) => {
263
+ refs.popupWindow.current = oAuthPopup;
260
264
  }
261
265
  },
262
266
  {
@@ -22,7 +22,6 @@ type Value = {
22
22
  isCreateGuestWalletsPending: boolean;
23
23
  logout: () => void;
24
24
  biometricHints?: BiometricHints;
25
- isOAuthReady?: boolean;
26
25
  };
27
26
  type Props = PropsWithChildren<{
28
27
  is2faEnabled?: boolean;
@@ -6,7 +6,7 @@ import {
6
6
  } from "../../chunk-MMUBH76A.js";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import { useUserAgent } from "@getpara/react-common";
9
- import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
9
+ import { createContext, useCallback, useContext, useEffect, useMemo } from "react";
10
10
  import { useModalStore } from "../../modal/stores/index.js";
11
11
  import { ModalStep } from "../../modal/utils/steps.js";
12
12
  import {
@@ -20,8 +20,7 @@ import {
20
20
  useVerifyTelegram,
21
21
  useSetup2fa,
22
22
  useLogout,
23
- useCreateGuestWallets,
24
- useAccount
23
+ useCreateGuestWallets
25
24
  } from "../index.js";
26
25
  import { DEFAULTS } from "../../modal/constants/defaults.js";
27
26
  import { openPopup } from "../../modal/utils/openPopup.js";
@@ -97,39 +96,22 @@ function AuthProvider({
97
96
  const authStepRoute = useModalStore((state) => state.authStepRoute);
98
97
  const isIFrameReady = useModalStore((state) => state.isIFrameReady);
99
98
  const goBack = useGoBack();
100
- const { isConnected } = useAccount();
101
- const { mutate: mutateSignUpOrLogIn, isPending: isSignUpOrLogInPending } = useSignUpOrLogIn();
99
+ const { signUpOrLogIn: mutateSignUpOrLogIn, isPending: isSignUpOrLogInPending } = useSignUpOrLogIn();
102
100
  const {
103
- mutate: mutateVerifyNewAccount,
101
+ verifyNewAccount: mutateVerifyNewAccount,
104
102
  status: verifyNewAccountStatus,
105
103
  error: verifyNewAccountError
106
104
  } = useVerifyNewAccount();
107
- const { mutate: mutateVerifyOAuth } = useVerifyOAuth();
108
- const { mutate: mutateVerifyFarcaster } = useVerifyFarcaster();
109
- const { mutate: mutateVerifyTelegram, status: verifyTelegramStatus } = useVerifyTelegram();
110
- const { mutate: mutateWaitForLogin } = useWaitForLogin();
111
- const { mutate: mutateWaitForSignup } = useWaitForSignup();
112
- const { mutateAsync: mutateAsyncWaitForWalletCreation } = useWaitForWalletCreation();
113
- const { mutate: mutateSetup2fa, isPending: isSetup2faPending } = useSetup2fa();
114
- const { mutate: mutateCreateGuestWallets, isPending: isCreateGuestWalletsPending } = useCreateGuestWallets();
115
- const { mutate: mutateLogout } = useLogout();
105
+ const { verifyOAuth: mutateVerifyOAuth } = useVerifyOAuth();
106
+ const { verifyFarcaster: mutateVerifyFarcaster } = useVerifyFarcaster();
107
+ const { verifyTelegram: mutateVerifyTelegram, status: verifyTelegramStatus } = useVerifyTelegram();
108
+ const { waitForLogin: mutateWaitForLogin } = useWaitForLogin();
109
+ const { waitForSignup: mutateWaitForSignup } = useWaitForSignup();
110
+ const { waitForWalletCreationAsync: mutateAsyncWaitForWalletCreation } = useWaitForWalletCreation();
111
+ const { setup2fa: mutateSetup2fa, isPending: isSetup2faPending } = useSetup2fa();
112
+ const { createGuestWallets: mutateCreateGuestWallets, isPending: isCreateGuestWalletsPending } = useCreateGuestWallets();
113
+ const { logout: mutateLogout } = useLogout();
116
114
  const { data: biometricHints } = useFormattedBiometricHints();
117
- const [sessionLookupId, setSessionLookupId] = useState(void 0);
118
- useEffect(() => {
119
- const setupOAuthSessionLookupId = () => __async(this, null, function* () {
120
- if (!para || isConnected) {
121
- return;
122
- }
123
- const authStepsWithOAuth = [ModalStep.AUTH_MAIN, ModalStep.AUTH_MORE];
124
- if (authStepsWithOAuth.includes(currentStep) && !sessionLookupId) {
125
- setSessionLookupId(yield para.prepareLogin());
126
- return;
127
- } else if (!authStepsWithOAuth.includes(currentStep) && sessionLookupId) {
128
- setSessionLookupId(void 0);
129
- }
130
- });
131
- setupOAuthSessionLookupId();
132
- }, [isConnected, currentStep]);
133
115
  const goBackIfPopupClosedOnSteps = (steps) => {
134
116
  var _a;
135
117
  if (((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) && (!refs.currentStep.current || steps.includes(refs.currentStep.current))) {
@@ -358,20 +340,13 @@ function AuthProvider({
358
340
  );
359
341
  });
360
342
  const verifyOAuth = (method) => __async(this, null, function* () {
361
- if (!sessionLookupId) {
362
- return;
363
- }
364
343
  setStep(ModalStep.AWAITING_OAUTH);
365
- const oAuthUrl = para.getOAuthUrlSync({ method, sessionLookupId });
366
- refs.popupWindow.current = openPopup({
367
- url: oAuthUrl,
368
- target: `${method}AuthPopup`,
369
- type: "OAUTH",
370
- current: refs.popupWindow.current
371
- });
372
344
  mutateVerifyOAuth(
373
345
  {
374
346
  method,
347
+ onOAuthPopup: (oAuthPopup) => {
348
+ refs.popupWindow.current = oAuthPopup;
349
+ },
375
350
  isCanceled: () => {
376
351
  var _a;
377
352
  return ((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) || cancelIfExitedSteps([ModalStep.AWAITING_OAUTH]);
@@ -519,8 +494,7 @@ function AuthProvider({
519
494
  createGuestWallets,
520
495
  isCreateGuestWalletsPending,
521
496
  logout,
522
- biometricHints: biometricHints || void 0,
523
- isOAuthReady: !!sessionLookupId
497
+ biometricHints: biometricHints || void 0
524
498
  }),
525
499
  [
526
500
  presentSignupUi,
@@ -540,8 +514,7 @@ function AuthProvider({
540
514
  createGuestWallets,
541
515
  isCreateGuestWalletsPending,
542
516
  logout,
543
- biometricHints,
544
- sessionLookupId
517
+ biometricHints
545
518
  ]
546
519
  );
547
520
  useEffect(() => {
@@ -1,6 +1,6 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { TWalletType } from '@getpara/web-sdk';
3
- import { BalanceManagement, ChainManagement, CommonWallet, ExternalWalletContextType, TExternalWallet } from '@getpara/react-common';
3
+ import { BalanceManagement, ChainManagement, CommonWallet, ExternalWalletContextType } from '@getpara/react-common';
4
4
  import { ExternalWalletInfo, VerifyExternalWalletParams } from '@getpara/web-sdk';
5
5
  import { CosmosSignResult } from '@getpara/cosmos-wallet-connectors';
6
6
  export declare const useWalletDisplayHelpers: (wallet: CommonWallet | undefined) => {
@@ -31,11 +31,11 @@ export declare const defaultExternalWallet: {
31
31
  signMessage: () => Promise<any>;
32
32
  isSigningMessage: boolean;
33
33
  getWalletBalance: () => Promise<undefined>;
34
- requestInfo: (_: TExternalWallet) => Promise<ExternalWalletInfo>;
35
- disconnectBase: (_: TExternalWallet) => Promise<void>;
34
+ requestInfo: (_: string) => Promise<ExternalWalletInfo>;
35
+ disconnectBase: (_: string, __: TWalletType) => Promise<void>;
36
36
  connectFarcasterMiniApp: () => Promise<void>;
37
37
  };
38
- type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage' | 'requestInfo'> & ChainManagement<string, void> & BalanceManagement & {
38
+ type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage' | 'requestInfo' | 'disconnectBase'> & ChainManagement<string, void> & BalanceManagement & {
39
39
  wallet?: CommonWallet;
40
40
  qrUri?: string;
41
41
  chainIdSwitchingTo?: string;
@@ -52,7 +52,8 @@ type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 's
52
52
  connectEmbeddedToExternalConnectors: () => Promise<void>;
53
53
  isSigningMessage: boolean;
54
54
  verifyWalletSignature: () => Promise<VerifyExternalWalletParams | undefined>;
55
- requestInfo: (_: TExternalWallet, __: TWalletType) => Promise<ExternalWalletInfo>;
55
+ requestInfo: (_: string, __: TWalletType) => Promise<ExternalWalletInfo>;
56
+ disconnectBase: (_: string, __: TWalletType) => Promise<void>;
56
57
  connectFarcasterMiniApp: () => Promise<void>;
57
58
  };
58
59
  export declare const ExternalWalletContext: import("react").Context<Value>;
@@ -11,11 +11,6 @@ import { useStore } from "../stores/useStore.js";
11
11
  import { ModalStep } from "../../modal/index.js";
12
12
  import { useModalStore } from "../../modal/stores/index.js";
13
13
  import { useAccount, useModal, useParaStatus, useVerifyExternalWallet, useWalletState } from "../hooks/index.js";
14
- import {
15
- COSMOS_WALLETS,
16
- EVM_WALLETS,
17
- SOLANA_WALLETS
18
- } from "@getpara/web-sdk";
19
14
  import { useAuthActions } from "./AuthProvider.js";
20
15
  const useWalletDisplayHelpers = (wallet) => {
21
16
  const isUsingMobileConnector = useModalStore((state) => state.isUsingMobileConnector);
@@ -49,7 +44,7 @@ const defaultExternalWallet = {
49
44
  isSigningMessage: false,
50
45
  getWalletBalance: () => Promise.resolve(void 0),
51
46
  requestInfo: (_) => Promise.resolve({}),
52
- disconnectBase: (_) => Promise.resolve(),
47
+ disconnectBase: (_, __) => Promise.resolve(),
53
48
  connectFarcasterMiniApp: () => Promise.resolve()
54
49
  };
55
50
  const ExternalWalletContext = createContext(defaultExternalWallet);
@@ -107,26 +102,31 @@ function ExternalWalletProvider({ children }) {
107
102
  const setStepDirection = useModalStore((state) => state.setStepDirection);
108
103
  const setIsExternalWalletConnecting = useModalStore((state) => state.setIsExternalWalletConnecting);
109
104
  const isExternalWalletConnecting = useModalStore((state) => state.isExternalWalletConnecting);
110
- const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
111
- const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
105
+ const selectedExternalWallet = useModalStore((state) => state.selectedExternalWallet);
106
+ const setSelectedExternalWallet = useModalStore((state) => state.setSelectedExternalWallet);
112
107
  const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
113
108
  const setIsUsingMobileConnector = useModalStore((state) => state.setIsUsingMobileConnector);
114
109
  const refs = useModalStore((state) => state.refs);
115
110
  const para = useInternalClient();
116
111
  const { setSelectedWallet } = useWalletState();
117
112
  const { onNewAuthState } = useAuthActions();
118
- const { mutateAsync: verifyExternalWallet } = useVerifyExternalWallet();
113
+ const { verifyExternalWalletAsync } = useVerifyExternalWallet();
119
114
  const [qrUri, setQrUri] = useState();
120
115
  const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
121
116
  const [isSigningMessage, setIsSigningMessage] = useState(false);
122
- const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter(
117
+ const allWallets = [...evmWallets, ...solanaWallets, ...cosmosWallets];
118
+ let wallets = allWallets.filter(
123
119
  (w) => (w.internalId !== "FARCASTER" || (para == null ? void 0 : para.isFarcasterMiniApp)) && externalWallets.includes(w.id.toUpperCase())
124
120
  ).sort(
125
121
  (a, b) => externalWallets.indexOf(a.id.toUpperCase()) - externalWallets.indexOf(b.id.toUpperCase())
126
122
  ).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
123
+ const injectedWallets = allWallets.filter(
124
+ (w) => (w == null ? void 0 : w.id) !== "Para" && !wallets.some((wallet2) => wallet2.id === w.id) && w.installed
125
+ );
126
+ wallets = [...wallets, ...injectedWallets];
127
127
  const wallet = useMemo(
128
- () => wallets.find((w) => w.internalId === selectedExternalWalletId),
129
- [wallets, selectedExternalWalletId]
128
+ () => wallets.find((w) => w.id === (selectedExternalWallet == null ? void 0 : selectedExternalWallet.id) && w.type === (selectedExternalWallet == null ? void 0 : selectedExternalWallet.type)),
129
+ [wallets, selectedExternalWallet]
130
130
  );
131
131
  const updateQrUri = () => __async(this, null, function* () {
132
132
  var _a;
@@ -153,7 +153,7 @@ function ExternalWalletProvider({ children }) {
153
153
  return void 0;
154
154
  }
155
155
  }
156
- }), [evmGetWalletBalance, selectedExternalWalletId]);
156
+ }), [evmGetWalletBalance, selectedExternalWallet]);
157
157
  const chains = useMemo(() => {
158
158
  var _a;
159
159
  const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
@@ -168,7 +168,7 @@ function ExternalWalletProvider({ children }) {
168
168
  return [];
169
169
  }
170
170
  }
171
- }, [cosmosChains, evmChains, selectedExternalWalletId]);
171
+ }, [cosmosChains, evmChains, selectedExternalWallet]);
172
172
  const chainId = useMemo(() => {
173
173
  var _a;
174
174
  const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
@@ -183,7 +183,7 @@ function ExternalWalletProvider({ children }) {
183
183
  return void 0;
184
184
  }
185
185
  }
186
- }, [cosmosChains, evmChains, selectedExternalWalletId]);
186
+ }, [cosmosChains, evmChains, selectedExternalWallet]);
187
187
  const switchChain = useCallback(
188
188
  (chainId2) => __async(this, null, function* () {
189
189
  var _a;
@@ -300,7 +300,7 @@ function ExternalWalletProvider({ children }) {
300
300
  return;
301
301
  }
302
302
  try {
303
- const d = yield verifyExternalWallet(verifyExternalWalletParams);
303
+ const d = yield verifyExternalWalletAsync(verifyExternalWalletParams);
304
304
  if (wallet2 && (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes((_a = wallet2.name) == null ? void 0 : _a.toUpperCase()))) {
305
305
  yield onNewAuthState(d);
306
306
  } else {
@@ -459,17 +459,12 @@ function ExternalWalletProvider({ children }) {
459
459
  }
460
460
  }
461
461
  });
462
- const disconnectBase = (providerId) => __async(this, null, function* () {
463
- const [isEvm, isSolana, _isCosmos] = [
464
- EVM_WALLETS.includes(providerId),
465
- SOLANA_WALLETS.includes(providerId),
466
- COSMOS_WALLETS.includes(providerId)
467
- ];
468
- switch (true) {
469
- case isEvm:
462
+ const disconnectBase = (providerId, type) => __async(this, null, function* () {
463
+ switch (type) {
464
+ case "EVM":
470
465
  yield evmDisconnectBase(providerId);
471
466
  break;
472
- case isSolana:
467
+ case "SOLANA":
473
468
  yield solanaDisconnectBase(providerId);
474
469
  break;
475
470
  default: {
@@ -482,7 +477,7 @@ function ExternalWalletProvider({ children }) {
482
477
  yield para.logout();
483
478
  yield evmDisconnect();
484
479
  yield cosmosDisconnect();
485
- setSelectedExternalWalletId();
480
+ setSelectedExternalWallet();
486
481
  yield solanaDisconnect();
487
482
  });
488
483
  const walletDisplayHelpers = useWalletDisplayHelpers(wallet);
@@ -0,0 +1,6 @@
1
+ import { Chain, Transport } from 'viem';
2
+ import { ParaEvmProviderConfigNoWallets } from '../types/externalWalletProviders.js';
3
+ export declare const getEVMExternalWalletConfigDefault: ({ appName, projectId, }: {
4
+ appName: string;
5
+ projectId?: string;
6
+ }) => ParaEvmProviderConfigNoWallets<readonly [Chain, ...Chain[]], Record<[Chain, ...Chain[]][number]["id"], Transport>>;
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ const getEVMExternalWalletConfigDefault = ({
4
+ appName,
5
+ projectId
6
+ }) => ({
7
+ appName,
8
+ chains: [
9
+ {
10
+ id: 11155111,
11
+ name: "Sepolia",
12
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
13
+ rpcUrls: { default: { http: ["https://rpc.sepolia.org"] } },
14
+ blockExplorers: {
15
+ default: {
16
+ name: "Etherscan",
17
+ url: "https://sepolia.etherscan.io",
18
+ apiUrl: "https://api-sepolia.etherscan.io/api"
19
+ }
20
+ },
21
+ contracts: {
22
+ multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 751532 },
23
+ ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
24
+ ensUniversalResolver: { address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC", blockCreated: 5317080 }
25
+ },
26
+ testnet: true
27
+ }
28
+ ],
29
+ projectId: projectId != null ? projectId : ""
30
+ });
31
+ export {
32
+ getEVMExternalWalletConfigDefault
33
+ };
@@ -1,5 +1,9 @@
1
- import { CoreMethodName, CoreMethodParams, CoreMethodResponse, CoreMethods } from '@getpara/web-sdk';
2
- import { DefaultError, UseMutationResult } from '@tanstack/react-query';
3
- import { CoreMethodMutationHook } from '../types/utils.js';
4
- export declare function renameMutations<TResp = unknown, TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(mutationObj: UseMutationResult<TData, TError, TVariables, TContext>, name: string): TResp;
5
- export declare function renameCoreMutations<method extends CoreMethodName & keyof CoreMethods>(mutationObj: UseMutationResult<CoreMethodResponse<method>, Error, CoreMethodParams<method> | undefined, unknown>, name: method): CoreMethodMutationHook<method>;
1
+ import { DefaultError, UseMutateAsyncFunction, UseMutateFunction, UseMutationResult } from '@tanstack/react-query';
2
+ import { Compute } from '../types/utils.js';
3
+ type RenamedMutationResult<TData, TError, TVariables, TContext, TName extends string> = Omit<UseMutationResult<TData, TError, TVariables, TContext>, 'mutate' | 'mutateAsync'> & {
4
+ [K in TName]: UseMutateFunction<TData, TError, TVariables, TContext>;
5
+ } & {
6
+ [K in `${TName}Async`]: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
7
+ };
8
+ export declare function renameMutations<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown, TName extends string = string>(mutationObj: UseMutationResult<TData, TError, TVariables, TContext>, name: TName): Compute<RenamedMutationResult<TData, TError, TVariables, TContext, TName>>;
9
+ export {};
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import {
3
+ __objRest,
3
4
  __spreadValues
4
5
  } from "../../chunk-MMUBH76A.js";
5
6
  function renameMutations(mutationObj, name) {
@@ -7,12 +8,9 @@ function renameMutations(mutationObj, name) {
7
8
  [name]: mutationObj.mutate,
8
9
  [`${name}Async`]: mutationObj.mutateAsync
9
10
  };
10
- return __spreadValues(__spreadValues({}, newMutations), mutationObj);
11
- }
12
- function renameCoreMutations(mutationObj, name) {
13
- return renameMutations(mutationObj, name);
11
+ const _a = mutationObj, { mutate: _, mutateAsync: __ } = _a, rest = __objRest(_a, ["mutate", "mutateAsync"]);
12
+ return __spreadValues(__spreadValues({}, newMutations), rest);
14
13
  }
15
14
  export {
16
- renameCoreMutations,
17
15
  renameMutations
18
16
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0-alpha.33",
3
+ "version": "2.0.0-alpha.35",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.33",
9
- "@getpara/react-components": "2.0.0-alpha.33",
10
- "@getpara/web-sdk": "2.0.0-alpha.33",
8
+ "@getpara/react-common": "2.0.0-alpha.35",
9
+ "@getpara/react-components": "2.0.0-alpha.35",
10
+ "@getpara/web-sdk": "2.0.0-alpha.35",
11
11
  "date-fns": "^3.6.0",
12
12
  "framer-motion": "^11.3.31",
13
13
  "libphonenumber-js": "^1.11.7",
@@ -16,9 +16,9 @@
16
16
  "zustand-sync-tabs": "^0.2.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.33",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.33",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.33",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.35",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.35",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.35",
22
22
  "@tanstack/react-query": "^5.74.0",
23
23
  "@testing-library/dom": "^10.4.0",
24
24
  "@testing-library/react": "^16.3.0",
@@ -38,7 +38,7 @@
38
38
  "package.json",
39
39
  "styles.css"
40
40
  ],
41
- "gitHead": "f338306fa30497d2190f8da2ff72ddd8d9d9032f",
41
+ "gitHead": "abfec8cf9931f7a8469b09b67b5d48eee6f4cfd5",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",