@getpara/react-sdk-lite 2.0.0-dev.7 → 2.0.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.
Files changed (172) hide show
  1. package/dist/cli/cli.mjs +26 -1
  2. package/dist/modal/ParaModal.js +16 -10
  3. package/dist/modal/components/Account/Account.js +42 -4
  4. package/dist/modal/components/Account/AccountHeader.js +10 -16
  5. package/dist/modal/components/Account/AccountProfile.d.ts +1 -1
  6. package/dist/modal/components/Account/AccountProfile.js +82 -210
  7. package/dist/modal/components/Account/AccountProfileEntry.d.ts +12 -0
  8. package/dist/modal/components/Account/AccountProfileEntry.js +220 -0
  9. package/dist/modal/components/Account/AccountProfileLinkOptions.js +15 -4
  10. package/dist/modal/components/Account/AccountSend/AccountSendAsset.d.ts +1 -0
  11. package/dist/modal/components/Account/AccountSend/AccountSendAsset.js +94 -0
  12. package/dist/modal/components/Account/AccountSend/AccountSendForm.d.ts +1 -0
  13. package/dist/modal/components/Account/AccountSend/AccountSendForm.js +343 -0
  14. package/dist/modal/components/Account/AccountSend/AccountSendNetwork.d.ts +1 -0
  15. package/dist/modal/components/Account/AccountSend/AccountSendNetwork.js +53 -0
  16. package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.d.ts +1 -0
  17. package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.js +56 -0
  18. package/dist/modal/components/Account/AccountSend/AssetNetwork.d.ts +5 -0
  19. package/dist/modal/components/Account/AccountSend/AssetNetwork.js +36 -0
  20. package/dist/modal/components/Account/AccountSend/context.d.ts +38 -0
  21. package/dist/modal/components/Account/AccountSend/context.js +418 -0
  22. package/dist/modal/components/Account/AccountSend/index.d.ts +4 -0
  23. package/dist/modal/components/Account/AccountSend/index.js +67 -0
  24. package/dist/modal/components/Account/AccountWallet.d.ts +1 -0
  25. package/dist/modal/components/Account/AccountWallet.js +133 -0
  26. package/dist/modal/components/{WalletSelect/WalletSelect.d.ts → Account/AccountWalletSelect.d.ts} +1 -1
  27. package/dist/modal/components/{WalletSelect/WalletSelect.js → Account/AccountWalletSelect.js} +20 -6
  28. package/dist/modal/components/AddFunds/AddFunds.js +3 -2
  29. package/dist/modal/components/AddFunds/AddFundsAsset.js +7 -6
  30. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
  31. package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -2
  32. package/dist/modal/components/AddFunds/AddFundsSettings.js +13 -54
  33. package/dist/modal/components/AddFunds/common.d.ts +0 -14
  34. package/dist/modal/components/AddFunds/common.js +1 -8
  35. package/dist/modal/components/AuthInput/AuthInput.js +2 -2
  36. package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +3 -2
  37. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +8 -33
  38. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +5 -2
  39. package/dist/modal/components/Body/Body.js +81 -48
  40. package/dist/modal/components/ChainSwitch/ChainSwitch.js +8 -5
  41. package/dist/modal/components/Controls/ChainSelect.js +1 -2
  42. package/dist/modal/components/Controls/Controls.js +1 -0
  43. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +5 -1
  44. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +48 -19
  45. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +5 -2
  46. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +63 -33
  47. package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +3 -1
  48. package/dist/modal/components/ExternalWallets/ExternalWallets.js +22 -12
  49. package/dist/modal/components/Footer/Footer.js +4 -5
  50. package/dist/modal/components/Header/Header.js +1 -2
  51. package/dist/modal/components/Header/hooks/useStepTitle.js +53 -38
  52. package/dist/modal/components/Hero/Hero.js +5 -3
  53. package/dist/modal/components/IFrameStep/IFrameStep.js +13 -12
  54. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +4 -1
  55. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +6 -5
  56. package/dist/modal/components/OAuth/TelegramOAuthStep.js +6 -5
  57. package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
  58. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -2
  59. package/dist/modal/components/QuantityInput.d.ts +9 -0
  60. package/dist/modal/components/QuantityInput.js +91 -0
  61. package/dist/modal/components/SearchableButtonList.d.ts +34 -0
  62. package/dist/modal/components/SearchableButtonList.js +223 -0
  63. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +4 -1
  64. package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +1 -0
  65. package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.js +10 -0
  66. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +13 -2
  67. package/dist/modal/components/Waiting/Waiting.d.ts +1 -1
  68. package/dist/modal/components/Waiting/Waiting.js +7 -2
  69. package/dist/modal/components/WalletCard/WalletCard.js +2 -3
  70. package/dist/modal/components/WalletSelectOld/WalletSelectOld.d.ts +7 -1
  71. package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +33 -12
  72. package/dist/modal/components/common.d.ts +8 -10
  73. package/dist/modal/components/common.js +16 -36
  74. package/dist/modal/hooks/index.d.ts +4 -0
  75. package/dist/modal/hooks/index.js +5 -0
  76. package/dist/modal/hooks/useDebounce.d.ts +4 -0
  77. package/dist/modal/hooks/useDebounce.js +16 -0
  78. package/dist/modal/hooks/useFarcasterLogin.js +8 -1
  79. package/dist/modal/hooks/useTelegramLogin.js +4 -0
  80. package/dist/modal/index.d.ts +1 -1
  81. package/dist/modal/index.js +1 -1
  82. package/dist/modal/stores/modal/actions.js +9 -2
  83. package/dist/modal/stores/modal/useModalStore.d.ts +9 -1
  84. package/dist/modal/stores/modal/useModalStore.js +6 -2
  85. package/dist/modal/types/modalProps.d.ts +5 -1
  86. package/dist/modal/utils/authInputHelpers.js +1 -1
  87. package/dist/modal/utils/countryCodes.js +50 -1
  88. package/dist/modal/utils/getWalletDisplayName.js +1 -1
  89. package/dist/modal/utils/openPopup.d.ts +1 -1
  90. package/dist/modal/utils/openPopup.js +6 -2
  91. package/dist/modal/utils/renderTextWithLinks.d.ts +2 -0
  92. package/dist/modal/utils/renderTextWithLinks.js +34 -0
  93. package/dist/modal/utils/steps.d.ts +24 -3
  94. package/dist/modal/utils/steps.js +51 -5
  95. package/dist/modal/utils/stringFormatters.d.ts +2 -3
  96. package/dist/modal/utils/stringFormatters.js +11 -7
  97. package/dist/modal/utils/validatePortalOrigin.d.ts +2 -0
  98. package/dist/modal/utils/validatePortalOrigin.js +14 -0
  99. package/dist/provider/ParaProviderMin.js +13 -5
  100. package/dist/provider/actions/getEmbeddedAccount.d.ts +3 -2
  101. package/dist/provider/actions/getEmbeddedAccount.js +13 -4
  102. package/dist/provider/actions/index.d.ts +11 -9
  103. package/dist/provider/actions/index.js +4 -0
  104. package/dist/provider/components/CosmosWalletWrapper.js +3 -3
  105. package/dist/provider/components/EvmWalletWrapper.js +3 -3
  106. package/dist/provider/components/ExternalWalletWrapper.js +7 -1
  107. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +3 -1
  108. package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +3 -1
  109. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +3 -1
  110. package/dist/provider/hooks/mutations/index.d.ts +2 -0
  111. package/dist/provider/hooks/mutations/index.js +4 -0
  112. package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +42 -0
  113. package/dist/provider/hooks/mutations/useAddAuthMethod.js +59 -0
  114. package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +2 -2
  115. package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +2 -2
  116. package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +5 -5
  117. package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +2 -2
  118. package/dist/provider/hooks/mutations/useCreateWallet.d.ts +2 -2
  119. package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +2 -2
  120. package/dist/provider/hooks/mutations/useEnable2fa.d.ts +2 -2
  121. package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +15 -0
  122. package/dist/provider/hooks/mutations/useExportPrivateKey.js +32 -0
  123. package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +2 -2
  124. package/dist/provider/hooks/mutations/useIssueJwt.d.ts +2 -2
  125. package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +2 -2
  126. package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +8 -2
  127. package/dist/provider/hooks/mutations/useLogout.d.ts +2 -2
  128. package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +2 -2
  129. package/dist/provider/hooks/mutations/useSetup2fa.d.ts +2 -2
  130. package/dist/provider/hooks/mutations/useSignMessage.d.ts +2 -2
  131. package/dist/provider/hooks/mutations/useSignTransaction.d.ts +2 -2
  132. package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +2 -2
  133. package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +57 -0
  134. package/dist/provider/hooks/mutations/useSwitchWallets.js +30 -0
  135. package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +2 -2
  136. package/dist/provider/hooks/mutations/useVerify2fa.d.ts +2 -2
  137. package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +18 -27
  138. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +5 -5
  139. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +14 -11
  140. package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +2 -2
  141. package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +5 -5
  142. package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +2 -2
  143. package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +2 -2
  144. package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +2 -2
  145. package/dist/provider/hooks/queries/index.d.ts +1 -0
  146. package/dist/provider/hooks/queries/index.js +2 -0
  147. package/dist/provider/hooks/queries/useAccount.js +58 -24
  148. package/dist/provider/hooks/queries/useLinkedAccounts.js +4 -2
  149. package/dist/provider/hooks/queries/useProfileBalance.d.ts +29 -0
  150. package/dist/provider/hooks/queries/useProfileBalance.js +65 -0
  151. package/dist/provider/hooks/utils/useAssetInfo.d.ts +3 -0
  152. package/dist/provider/hooks/utils/useAssetInfo.js +21 -0
  153. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +1 -1
  154. package/dist/provider/hooks/utils/useEventListeners.js +22 -5
  155. package/dist/provider/hooks/utils/useModal.js +3 -3
  156. package/dist/provider/hooks/utils/useWalletState.d.ts +2 -1
  157. package/dist/provider/hooks/utils/useWalletState.js +2 -1
  158. package/dist/provider/providers/AccountLinkProvider.js +18 -11
  159. package/dist/provider/providers/AssetsProvider.d.ts +14 -0
  160. package/dist/provider/providers/AssetsProvider.js +68 -0
  161. package/dist/provider/providers/AuthProvider.d.ts +4 -0
  162. package/dist/provider/providers/AuthProvider.js +187 -43
  163. package/dist/provider/providers/ExternalWalletProvider.d.ts +19 -5
  164. package/dist/provider/providers/ExternalWalletProvider.js +363 -44
  165. package/dist/provider/stores/getters.d.ts +2 -2
  166. package/dist/provider/stores/slices/modal.js +4 -1
  167. package/dist/provider/stores/types.d.ts +6 -3
  168. package/package.json +8 -8
  169. package/dist/modal/constants/constants.d.ts +0 -35
  170. package/dist/modal/constants/constants.js +0 -148
  171. package/dist/modal/utils/routeMobileExternalWallet.d.ts +0 -1
  172. package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
6
+ import { useClient } from "../utils/index.js";
7
+ import { getPortalBaseURL } from "@getpara/web-sdk";
8
+ import { renameMutations } from "../../utils/renameMutations.js";
9
+ import { addCredential } from "../../actions/index.js";
10
+ import { openPopup as openPopupFn } from "../../../modal/index.js";
11
+ import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
12
+ const ADD_CREDENTIAL_KEY = "ADD_CREDENTIAL";
13
+ const useAddAuthMethod = ({ openPopup } = { openPopup: true }) => {
14
+ const para = useClient();
15
+ const queryClient = useQueryClient();
16
+ const mutation = useMutation({
17
+ mutationKey: [ADD_CREDENTIAL_KEY],
18
+ mutationFn: (..._0) => __async(void 0, [..._0], function* (args = {}) {
19
+ try {
20
+ const result = yield addCredential(para, args);
21
+ if (result && openPopup) {
22
+ openPopupFn({ url: result, target: "ParaAddAuthCredential", type: "ADD_CREDENTIAL" });
23
+ if (typeof window !== "undefined" && para) {
24
+ const handleMessage = (event) => {
25
+ var _a;
26
+ const portalBase = getPortalBaseURL(para.ctx);
27
+ const portalLocalBase = getPortalBaseURL(para.ctx, true);
28
+ if (!event.origin.startsWith(portalBase) && !event.origin.startsWith(portalLocalBase)) {
29
+ return;
30
+ }
31
+ if (((_a = event.data) == null ? void 0 : _a.type) === "CLOSE_WINDOW") {
32
+ if (event.data.success) {
33
+ queryClient.refetchQueries({ queryKey: [ACCOUNT_BASE_KEY] });
34
+ }
35
+ window.removeEventListener("message", handleMessage);
36
+ clearTimeout(timeoutId);
37
+ }
38
+ };
39
+ const timeoutId = setTimeout(
40
+ () => {
41
+ window.removeEventListener("message", handleMessage);
42
+ },
43
+ 1e3 * 60 * 3
44
+ );
45
+ window.addEventListener("message", handleMessage);
46
+ }
47
+ }
48
+ return result;
49
+ } catch (error) {
50
+ throw error;
51
+ }
52
+ })
53
+ });
54
+ return renameMutations(mutation, "addAuthMethod");
55
+ };
56
+ export {
57
+ ADD_CREDENTIAL_KEY,
58
+ useAddAuthMethod
59
+ };
@@ -15,13 +15,13 @@ export declare const CLAIM_PREGEN_WALLETS_KEY = "CLAIM_PREGEN_WALLETS";
15
15
  * await claimPregenWalletsAsync({ ...params });
16
16
  */
17
17
  export declare const useClaimPregenWallets: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: Compute<string | undefined>;
20
21
  isSuccess: boolean;
21
22
  variables: {
22
23
  pregenId?: import("@getpara/web-sdk").PregenAuth | undefined;
23
24
  } | undefined;
24
- error: Error | null;
25
25
  isError: boolean;
26
26
  isIdle: boolean;
27
27
  isPending: boolean;
@@ -14,11 +14,11 @@ export declare const CREATE_GUEST_WALLETS_KEY = "CREATE_GUEST_WALLETS";
14
14
  * await createGuestWalletsAsync({ ...params });
15
15
  */
16
16
  export declare const useCreateGuestWallets: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: import("@getpara/web-sdk").Wallet[] | undefined;
19
20
  isSuccess: boolean;
20
21
  variables: void | undefined;
21
- error: Error | null;
22
22
  isError: boolean;
23
23
  isIdle: boolean;
24
24
  isPending: boolean;
@@ -14,7 +14,8 @@ export declare const CREATE_PREGEN_WALLET_KEY = "CREATE_PREGEN_WALLET";
14
14
  * await createPregenWalletAsync({ ...params });
15
15
  */
16
16
  export declare const useCreatePregenWallet: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: {
19
20
  createdAt?: string | undefined;
20
21
  id: string;
@@ -24,7 +25,7 @@ export declare const useCreatePregenWallet: () => {
24
25
  addressSecondary?: string | undefined;
25
26
  publicKey?: string | undefined;
26
27
  scheme?: import("@getpara/web-sdk").TWalletScheme | undefined;
27
- type?: (import("@getpara/user-management-client").EmbeddedWalletType | import("@getpara/user-management-client").ExternalWalletType) | undefined;
28
+ type?: import("@getpara/web-sdk").TWalletType | undefined;
28
29
  isPregen?: boolean | undefined;
29
30
  pregenIdentifier?: string | undefined;
30
31
  pregenIdentifierType?: import("@getpara/web-sdk").TPregenIdentifierType | undefined;
@@ -47,7 +48,6 @@ export declare const useCreatePregenWallet: () => {
47
48
  type: import("@getpara/web-sdk").TWalletType;
48
49
  pregenId: import("@getpara/web-sdk").PregenAuth;
49
50
  } | undefined;
50
- error: Error | null;
51
51
  isError: boolean;
52
52
  isIdle: boolean;
53
53
  isPending: boolean;
@@ -66,7 +66,7 @@ export declare const useCreatePregenWallet: () => {
66
66
  addressSecondary?: string | undefined;
67
67
  publicKey?: string | undefined;
68
68
  scheme?: import("@getpara/web-sdk").TWalletScheme | undefined;
69
- type?: (import("@getpara/user-management-client").EmbeddedWalletType | import("@getpara/user-management-client").ExternalWalletType) | undefined;
69
+ type?: import("@getpara/web-sdk").TWalletType | undefined;
70
70
  isPregen?: boolean | undefined;
71
71
  pregenIdentifier?: string | undefined;
72
72
  pregenIdentifierType?: import("@getpara/web-sdk").TPregenIdentifierType | undefined;
@@ -96,7 +96,7 @@ export declare const useCreatePregenWallet: () => {
96
96
  addressSecondary?: string | undefined;
97
97
  publicKey?: string | undefined;
98
98
  scheme?: import("@getpara/web-sdk").TWalletScheme | undefined;
99
- type?: (import("@getpara/user-management-client").EmbeddedWalletType | import("@getpara/user-management-client").ExternalWalletType) | undefined;
99
+ type?: import("@getpara/web-sdk").TWalletType | undefined;
100
100
  isPregen?: boolean | undefined;
101
101
  pregenIdentifier?: string | undefined;
102
102
  pregenIdentifierType?: import("@getpara/web-sdk").TPregenIdentifierType | undefined;
@@ -14,14 +14,14 @@ export declare const CREATE_PREGEN_WALLET_PER_TYPE_KEY = "CREATE_PREGEN_WALLET_P
14
14
  * await createPregenWalletPerTypeAsync({ ...params });
15
15
  */
16
16
  export declare const useCreatePregenWalletPerType: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: import("@getpara/web-sdk").Wallet[] | undefined;
19
20
  isSuccess: boolean;
20
21
  variables: {
21
22
  types?: import("@getpara/web-sdk").TWalletType[] | undefined;
22
23
  pregenId: import("@getpara/web-sdk").PregenAuth;
23
24
  } | undefined;
24
- error: Error | null;
25
25
  isError: boolean;
26
26
  isIdle: boolean;
27
27
  isPending: boolean;
@@ -14,14 +14,14 @@ export declare const CREATE_WALLET_KEY = "CREATE_WALLET";
14
14
  * await createWalletAsync({ ...params });
15
15
  */
16
16
  export declare const useCreateWallet: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: [import("@getpara/web-sdk").Wallet, string | undefined] | undefined;
19
20
  isSuccess: boolean;
20
21
  variables: void | {
21
22
  type?: Uppercase<import("@getpara/web-sdk").TWalletType> | undefined;
22
23
  skipDistribute?: boolean | undefined;
23
24
  } | undefined;
24
- error: Error | null;
25
25
  isError: boolean;
26
26
  isIdle: boolean;
27
27
  isPending: boolean;
@@ -14,7 +14,8 @@ export declare const CREATE_WALLET_PER_TYPE_KEY = "CREATE_WALLET_PER_TYPE";
14
14
  * await createWalletPerTypeAsync({ ...params });
15
15
  */
16
16
  export declare const useCreateWalletPerType: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: {
19
20
  wallets: import("@getpara/web-sdk").Wallet[];
20
21
  walletIds: import("@getpara/web-sdk").CurrentWalletIds;
@@ -25,7 +26,6 @@ export declare const useCreateWalletPerType: () => {
25
26
  types?: Uppercase<import("@getpara/web-sdk").TWalletType>[] | undefined;
26
27
  skipDistribute?: boolean | undefined;
27
28
  } | undefined;
28
- error: Error | null;
29
29
  isError: boolean;
30
30
  isIdle: boolean;
31
31
  isPending: boolean;
@@ -14,13 +14,13 @@ export declare const ENABLE_2FA_KEY = "ENABLE_2FA";
14
14
  * await enable2faAsync({ ...params });
15
15
  */
16
16
  export declare const useEnable2fa: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: void | undefined;
19
20
  isSuccess: boolean;
20
21
  variables: {
21
22
  verificationCode: string;
22
23
  } | undefined;
23
- error: Error | null;
24
24
  isError: boolean;
25
25
  isIdle: boolean;
26
26
  isPending: boolean;
@@ -0,0 +1,15 @@
1
+ export declare const EXPORT_PRIVATE_KEY_KEY = "EXPORT_PRIVATE_KEY";
2
+ /**
3
+ * React hook for the `exportPrivateKey` mutation.
4
+ *
5
+ * @example
6
+ * const { mutateAsync: exportPrivateKeyAsync } = useExportPrivateKey();
7
+ * await exportPrivateKeyAsync({ walletId: '...' });
8
+ */
9
+ export declare const useExportPrivateKey: () => import("@tanstack/react-query").UseMutationResult<{
10
+ popupWindow?: Window;
11
+ url: string;
12
+ }, Error, {
13
+ walletId?: string;
14
+ shouldOpenPopup?: boolean;
15
+ } | undefined, unknown>;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import {
3
+ __async,
4
+ __spreadValues
5
+ } from "../../../chunk-MMUBH76A.js";
6
+ import { useMutation } from "@tanstack/react-query";
7
+ import { useClient } from "../utils/index.js";
8
+ import { exportPrivateKey } from "../../actions/index.js";
9
+ import { useWallet } from "../queries/useWallet.js";
10
+ const EXPORT_PRIVATE_KEY_KEY = "EXPORT_PRIVATE_KEY";
11
+ const useExportPrivateKey = () => {
12
+ const para = useClient();
13
+ const { data: activeWallet } = useWallet();
14
+ return useMutation({
15
+ mutationKey: [EXPORT_PRIVATE_KEY_KEY],
16
+ mutationFn: (args) => __async(void 0, null, function* () {
17
+ try {
18
+ const result = yield exportPrivateKey(para, __spreadValues({
19
+ walletId: activeWallet == null ? void 0 : activeWallet.id,
20
+ shouldOpenPopup: true
21
+ }, args));
22
+ return result;
23
+ } catch (error) {
24
+ throw error;
25
+ }
26
+ })
27
+ });
28
+ };
29
+ export {
30
+ EXPORT_PRIVATE_KEY_KEY,
31
+ useExportPrivateKey
32
+ };
@@ -15,13 +15,13 @@ export declare const HAS_PREGEN_WALLET_KEY = "HAS_PREGEN_WALLET";
15
15
  * await hasPregenWalletAsync({ ...params });
16
16
  */
17
17
  export declare const useHasPregenWallet: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: Compute<boolean> | undefined;
20
21
  isSuccess: boolean;
21
22
  variables: {
22
23
  pregenId: import("@getpara/web-sdk").PregenAuth;
23
24
  } | undefined;
24
- error: Error | null;
25
25
  isError: boolean;
26
26
  isIdle: boolean;
27
27
  isPending: boolean;
@@ -14,7 +14,8 @@ export declare const ISSUE_JWT_KEY = "ISSUE_JWT";
14
14
  * await issueJwtAsync({ ...params });
15
15
  */
16
16
  export declare const useIssueJwt: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: {
19
20
  token: string;
20
21
  keyId: string;
@@ -23,7 +24,6 @@ export declare const useIssueJwt: () => {
23
24
  variables: void | {
24
25
  keyIndex?: number | undefined;
25
26
  } | undefined;
26
- error: Error | null;
27
27
  isError: boolean;
28
28
  isIdle: boolean;
29
29
  isPending: boolean;
@@ -15,11 +15,11 @@ export declare const KEEP_SESSION_ALIVE_KEY = "KEEP_SESSION_ALIVE";
15
15
  * await keepSessionAliveAsync({ ...params });
16
16
  */
17
17
  export declare const useKeepSessionAlive: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: Compute<boolean> | undefined;
20
21
  isSuccess: boolean;
21
22
  variables: void | undefined;
22
- error: Error | null;
23
23
  isError: boolean;
24
24
  isIdle: boolean;
25
25
  isPending: boolean;
@@ -15,15 +15,17 @@ export declare const LOGIN_EXTERNAL_WALLET_KEY = "LOGIN_EXTERNAL_WALLET";
15
15
  * await loginExternalWalletAsync({ ...params });
16
16
  */
17
17
  export declare const useLoginExternalWallet: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateVerifyOrLogin> | undefined;
20
21
  isSuccess: boolean;
21
22
  variables: {
22
23
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
23
24
  useShortUrls?: boolean | undefined;
24
25
  externalWallet: import("@getpara/web-sdk").ExternalWalletInfo | import("@getpara/web-sdk").ExternalWalletInfo[];
26
+ chainId?: string | undefined;
27
+ uri?: string | undefined;
25
28
  } | undefined;
26
- error: Error | null;
27
29
  isError: boolean;
28
30
  isIdle: boolean;
29
31
  isPending: boolean;
@@ -37,10 +39,14 @@ export declare const useLoginExternalWallet: () => {
37
39
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
38
40
  useShortUrls?: boolean | undefined;
39
41
  externalWallet: import("@getpara/web-sdk").ExternalWalletInfo | import("@getpara/web-sdk").ExternalWalletInfo[];
42
+ chainId?: string | undefined;
43
+ uri?: string | undefined;
40
44
  }, unknown>;
41
45
  loginExternalWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateVerifyOrLogin>, Error, {
42
46
  portalTheme?: import("@getpara/web-sdk").Theme | undefined;
43
47
  useShortUrls?: boolean | undefined;
44
48
  externalWallet: import("@getpara/web-sdk").ExternalWalletInfo | import("@getpara/web-sdk").ExternalWalletInfo[];
49
+ chainId?: string | undefined;
50
+ uri?: string | undefined;
45
51
  }, unknown>;
46
52
  };
@@ -14,13 +14,13 @@ export declare const LOGOUT_KEY = "LOGOUT";
14
14
  * await logoutAsync({ ...params });
15
15
  */
16
16
  export declare const useLogout: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: void | undefined;
19
20
  isSuccess: boolean;
20
21
  variables: void | {
21
22
  clearPregenWallets?: boolean | undefined;
22
23
  } | undefined;
23
- error: Error | null;
24
24
  isError: boolean;
25
25
  isIdle: boolean;
26
26
  isPending: boolean;
@@ -15,13 +15,13 @@ export declare const RESEND_VERIFICATION_CODE_KEY = "RESEND_VERIFICATION_CODE";
15
15
  * await resendVerificationCodeAsync({ ...params });
16
16
  */
17
17
  export declare const useResendVerificationCode: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: void | undefined;
20
21
  isSuccess: boolean;
21
22
  variables: void | Compute<{
22
23
  type?: "SIGNUP" | "LINK_ACCOUNT" | "LOGIN";
23
24
  } | undefined>;
24
- error: Error | null;
25
25
  isError: boolean;
26
26
  isIdle: boolean;
27
27
  isPending: boolean;
@@ -15,11 +15,11 @@ export declare const SETUP_2FA_KEY = "SETUP_2FA";
15
15
  * await setup2faAsync({ ...params });
16
16
  */
17
17
  export declare const useSetup2fa: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: Compute<import("@getpara/web-sdk").Setup2faResponse> | undefined;
20
21
  isSuccess: boolean;
21
22
  variables: void | undefined;
22
- error: Error | null;
23
23
  isError: boolean;
24
24
  isIdle: boolean;
25
25
  isPending: boolean;
@@ -15,7 +15,8 @@ export declare const SIGN_MESSAGE_KEY = "SIGN_MESSAGE";
15
15
  * await signMessageAsync({ ...params });
16
16
  */
17
17
  export declare const useSignMessage: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: Compute<import("@getpara/web-sdk").FullSignatureRes> | undefined;
20
21
  isSuccess: boolean;
21
22
  variables: {
@@ -27,7 +28,6 @@ export declare const useSignMessage: () => {
27
28
  cosmosSignDocBase64?: string | undefined;
28
29
  isCanceled?: (() => boolean) | undefined;
29
30
  } | undefined;
30
- error: Error | null;
31
31
  isError: boolean;
32
32
  isIdle: boolean;
33
33
  isPending: boolean;
@@ -15,7 +15,8 @@ export declare const SIGN_TRANSACTION_KEY = "SIGN_TRANSACTION";
15
15
  * await signTransactionAsync({ ...params });
16
16
  */
17
17
  export declare const useSignTransaction: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: Compute<import("@getpara/web-sdk").FullSignatureRes> | undefined;
20
21
  isSuccess: boolean;
21
22
  variables: {
@@ -27,7 +28,6 @@ export declare const useSignTransaction: () => {
27
28
  timeoutMs?: number | undefined;
28
29
  isCanceled?: (() => boolean) | undefined;
29
30
  } | undefined;
30
- error: Error | null;
31
31
  isError: boolean;
32
32
  isIdle: boolean;
33
33
  isPending: boolean;
@@ -15,7 +15,8 @@ export declare const SIGN_UP_LOG_IN_KEY = "SIGN_UP_LOG_IN";
15
15
  * await signUpOrLogInAsync({ ...params });
16
16
  */
17
17
  export declare const useSignUpOrLogIn: () => {
18
- status: "error" | "idle" | "pending" | "success";
18
+ status: "idle" | "pending" | "error" | "success";
19
+ error: Error | null;
19
20
  data: Compute<import("@getpara/web-sdk").AuthStateLogin | import("@getpara/web-sdk").AuthStateVerify> | undefined;
20
21
  isSuccess: boolean;
21
22
  variables: {
@@ -23,7 +24,6 @@ export declare const useSignUpOrLogIn: () => {
23
24
  useShortUrls?: boolean | undefined;
24
25
  auth: import("@getpara/web-sdk").VerifiedAuth;
25
26
  } | undefined;
26
- error: Error | null;
27
27
  isError: boolean;
28
28
  isIdle: boolean;
29
29
  isPending: boolean;
@@ -0,0 +1,57 @@
1
+ export declare const SWITCH_WALLETS_KEY = "SWITCH_WALLETS";
2
+ /**
3
+ * React hook for the `switchWallets` mutation.
4
+ *
5
+ * Returns a mutation result object with all standard fields from `useMutation`, except:
6
+ * - `mutate` and `mutateAsync` are replaced by:
7
+ * - `switchWallets`: function to trigger the mutation (same as `mutate`)
8
+ * - `switchWalletsAsync`: async function to trigger the mutation (same as `mutateAsync`)
9
+ *
10
+ * @example
11
+ * const { switchWallets, switchWalletsAsync } = useSwitchWallets();
12
+ * switchWallets({ authMethod: 'PASSKEY' });
13
+ * // or
14
+ * await switchWalletsAsync({ authMethod: 'PASSKEY' });
15
+ */
16
+ export declare const useSwitchWallets: () => {
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
19
+ data: {
20
+ needsWallet?: boolean | undefined;
21
+ partnerId?: string | undefined;
22
+ } | undefined;
23
+ isSuccess: boolean;
24
+ variables: void | {
25
+ onPoll?: (() => void) | undefined;
26
+ onCancel?: (() => void) | undefined;
27
+ skipSessionRefresh?: boolean | undefined;
28
+ isCanceled?: (() => boolean) | undefined;
29
+ } | undefined;
30
+ isError: boolean;
31
+ isIdle: boolean;
32
+ isPending: boolean;
33
+ reset: () => void;
34
+ context: unknown;
35
+ failureCount: number;
36
+ failureReason: Error | null;
37
+ isPaused: boolean;
38
+ submittedAt: number;
39
+ switchWallets: import("@tanstack/react-query").UseMutateFunction<{
40
+ needsWallet?: boolean | undefined;
41
+ partnerId?: string | undefined;
42
+ }, Error, void | {
43
+ onPoll?: (() => void) | undefined;
44
+ onCancel?: (() => void) | undefined;
45
+ skipSessionRefresh?: boolean | undefined;
46
+ isCanceled?: (() => boolean) | undefined;
47
+ }, unknown>;
48
+ switchWalletsAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
49
+ needsWallet?: boolean | undefined;
50
+ partnerId?: string | undefined;
51
+ }, Error, void | {
52
+ onPoll?: (() => void) | undefined;
53
+ onCancel?: (() => void) | undefined;
54
+ skipSessionRefresh?: boolean | undefined;
55
+ isCanceled?: (() => boolean) | undefined;
56
+ }, unknown>;
57
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { useMutation } from "@tanstack/react-query";
6
+ import { useInternalClient } from "../utils/useInternalClient.js";
7
+ import { renameMutations } from "../../utils/renameMutations.js";
8
+ const SWITCH_WALLETS_KEY = "SWITCH_WALLETS";
9
+ const useSwitchWallets = () => {
10
+ const para = useInternalClient();
11
+ const mutation = useMutation({
12
+ mutationKey: [SWITCH_WALLETS_KEY],
13
+ mutationFn: (..._0) => __async(void 0, [..._0], function* (args = {}) {
14
+ if (!para) {
15
+ throw new Error("Para client not available");
16
+ }
17
+ try {
18
+ const result = yield para.waitForWalletSwitching(args);
19
+ return result;
20
+ } catch (error) {
21
+ throw error;
22
+ }
23
+ })
24
+ });
25
+ return renameMutations(mutation, "switchWallets");
26
+ };
27
+ export {
28
+ SWITCH_WALLETS_KEY,
29
+ useSwitchWallets
30
+ };
@@ -14,14 +14,14 @@ export declare const UPDATE_PREGEN_WALLET_IDENTIFIER_KEY = "UPDATE_PREGEN_WALLET
14
14
  * await updatePregenWalletIdentifierAsync({ ...params });
15
15
  */
16
16
  export declare const useUpdatePregenWalletIdentifier: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: void | undefined;
19
20
  isSuccess: boolean;
20
21
  variables: {
21
22
  walletId: string;
22
23
  newPregenId: import("@getpara/web-sdk").PregenAuth;
23
24
  } | undefined;
24
- error: Error | null;
25
25
  isError: boolean;
26
26
  isIdle: boolean;
27
27
  isPending: boolean;
@@ -14,7 +14,8 @@ export declare const VERIFY_2FA_KEY = "VERIFY_2FA";
14
14
  * await verify2faAsync({ ...params });
15
15
  */
16
16
  export declare const useVerify2fa: () => {
17
- status: "error" | "idle" | "pending" | "success";
17
+ status: "idle" | "pending" | "error" | "success";
18
+ error: Error | null;
18
19
  data: {
19
20
  initiatedAt?: Date | undefined;
20
21
  status?: import("@getpara/web-sdk").RecoveryStatus | undefined;
@@ -26,7 +27,6 @@ export declare const useVerify2fa: () => {
26
27
  auth: import("@getpara/web-sdk").VerifiedAuth;
27
28
  verificationCode: string;
28
29
  } | undefined;
29
- error: Error | null;
30
30
  isError: boolean;
31
31
  isIdle: boolean;
32
32
  isPending: boolean;
@@ -15,18 +15,15 @@ export declare const VERIFY_EXTERNAL_WALLET_KEY = "VERIFY_EXTERNAL_WALLET";
15
15
  * await verifyExternalWalletAsync({ ...params });
16
16
  */
17
17
  export declare const useVerifyExternalWallet: () => {
18
- status: "error" | "idle" | "pending" | "success";
19
- data: Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin> | undefined;
20
- isSuccess: boolean;
21
- variables: {
22
- portalTheme?: import("@getpara/web-sdk").Theme | undefined;
23
- useShortUrls?: boolean | undefined;
24
- externalWallet: import("@getpara/web-sdk").ExternalWalletInfo;
25
- signedMessage: string;
26
- cosmosPublicKeyHex?: string | undefined;
27
- cosmosSigner?: string | undefined;
28
- } | undefined;
18
+ status: "idle" | "pending" | "error" | "success";
29
19
  error: Error | null;
20
+ data: Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin | import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateDone> | undefined;
21
+ isSuccess: boolean;
22
+ variables: Compute<(import("@getpara/core-sdk/dist/types/types/methods.js").WithCustomTheme & import("@getpara/core-sdk/dist/types/types/methods.js").WithUseShortUrls & {
23
+ serverAuthState: import("@getpara/shared").ServerAuthStateSignup | import("@getpara/shared").ServerAuthStateLogin | import("@getpara/shared").ServerAuthStateDone;
24
+ }) | (import("@getpara/core-sdk/dist/types/types/methods.js").WithCustomTheme & import("@getpara/core-sdk/dist/types/types/methods.js").WithUseShortUrls & import("@getpara/web-sdk").VerifyExternalWalletParams & {
25
+ serverAuthState?: undefined;
26
+ })> | undefined;
30
27
  isError: boolean;
31
28
  isIdle: boolean;
32
29
  isPending: boolean;
@@ -36,20 +33,14 @@ export declare const useVerifyExternalWallet: () => {
36
33
  failureReason: Error | null;
37
34
  isPaused: boolean;
38
35
  submittedAt: number;
39
- verifyExternalWallet: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin>, Error, {
40
- portalTheme?: import("@getpara/web-sdk").Theme | undefined;
41
- useShortUrls?: boolean | undefined;
42
- externalWallet: import("@getpara/web-sdk").ExternalWalletInfo;
43
- signedMessage: string;
44
- cosmosPublicKeyHex?: string | undefined;
45
- cosmosSigner?: string | undefined;
46
- }, unknown>;
47
- verifyExternalWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin>, Error, {
48
- portalTheme?: import("@getpara/web-sdk").Theme | undefined;
49
- useShortUrls?: boolean | undefined;
50
- externalWallet: import("@getpara/web-sdk").ExternalWalletInfo;
51
- signedMessage: string;
52
- cosmosPublicKeyHex?: string | undefined;
53
- cosmosSigner?: string | undefined;
54
- }, unknown>;
36
+ verifyExternalWallet: import("@tanstack/react-query").UseMutateFunction<Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin | import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateDone>, Error, Compute<(import("@getpara/core-sdk/dist/types/types/methods.js").WithCustomTheme & import("@getpara/core-sdk/dist/types/types/methods.js").WithUseShortUrls & {
37
+ serverAuthState: import("@getpara/shared").ServerAuthStateSignup | import("@getpara/shared").ServerAuthStateLogin | import("@getpara/shared").ServerAuthStateDone;
38
+ }) | (import("@getpara/core-sdk/dist/types/types/methods.js").WithCustomTheme & import("@getpara/core-sdk/dist/types/types/methods.js").WithUseShortUrls & import("@getpara/web-sdk").VerifyExternalWalletParams & {
39
+ serverAuthState?: undefined;
40
+ })>, unknown>;
41
+ verifyExternalWalletAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Compute<import("@getpara/web-sdk").AuthStateSignup | import("@getpara/web-sdk").AuthStateLogin | import("@getpara/core-sdk/dist/types/types/methods.js").AuthStateDone>, Error, Compute<(import("@getpara/core-sdk/dist/types/types/methods.js").WithCustomTheme & import("@getpara/core-sdk/dist/types/types/methods.js").WithUseShortUrls & {
42
+ serverAuthState: import("@getpara/shared").ServerAuthStateSignup | import("@getpara/shared").ServerAuthStateLogin | import("@getpara/shared").ServerAuthStateDone;
43
+ }) | (import("@getpara/core-sdk/dist/types/types/methods.js").WithCustomTheme & import("@getpara/core-sdk/dist/types/types/methods.js").WithUseShortUrls & import("@getpara/web-sdk").VerifyExternalWalletParams & {
44
+ serverAuthState?: undefined;
45
+ })>, unknown>;
55
46
  };