@getpara/react-sdk 1.12.0 → 2.0.0-alpha.10

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 (241) hide show
  1. package/dist/cli/cli.mjs +35 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +5 -0
  4. package/dist/modal/ParaModal.js +211 -313
  5. package/dist/modal/components/Account/Account.js +73 -16
  6. package/dist/modal/components/AddFunds/AddFunds.js +5 -6
  7. package/dist/modal/components/AddFunds/AddFundsAsset.js +15 -13
  8. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +16 -10
  9. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +2 -2
  10. package/dist/modal/components/AddFunds/AddFundsContext.js +20 -14
  11. package/dist/modal/components/AddFunds/AddFundsDone.js +10 -4
  12. package/dist/modal/components/AddFunds/AddFundsProvider.js +11 -7
  13. package/dist/modal/components/AddFunds/AddFundsReceive.js +17 -13
  14. package/dist/modal/components/AddFunds/AddFundsSettings.js +10 -6
  15. package/dist/modal/components/AddFunds/common.d.ts +1 -1
  16. package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
  17. package/dist/modal/components/AuthInput/AuthInput.js +70 -91
  18. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
  19. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +4 -4
  20. package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
  21. package/dist/modal/components/AuthMainStep/AuthMainStep.js +20 -7
  22. package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
  23. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +54 -10
  24. package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
  25. package/dist/modal/components/AuthOptions/AuthOptions.js +35 -7
  26. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
  27. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +9 -4
  28. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -3
  29. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +25 -17
  30. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -1
  31. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +34 -72
  32. package/dist/modal/components/Body/Body.d.ts +4 -3
  33. package/dist/modal/components/Body/Body.js +27 -10
  34. package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
  35. package/dist/modal/components/ChainSwitch/ChainSwitch.js +5 -4
  36. package/dist/modal/components/Controls/Controls.js +5 -2
  37. package/dist/modal/components/Controls/Selects.d.ts +1 -1
  38. package/dist/modal/components/Controls/Selects.js +30 -25
  39. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
  40. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +10 -6
  41. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +7 -69
  42. package/dist/modal/components/ExternalWallets/ExternalWallets.js +7 -6
  43. package/dist/modal/components/Footer/Footer.d.ts +1 -1
  44. package/dist/modal/components/Footer/Footer.js +6 -4
  45. package/dist/modal/components/Header/hooks/useStepTitle.js +7 -3
  46. package/dist/modal/components/Hero/Hero.js +5 -5
  47. package/dist/modal/components/IFrameStep/IFrameStep.js +8 -4
  48. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +7 -4
  49. package/dist/modal/components/ModalContent/ModalContent.js +14 -243
  50. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +3 -57
  51. package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
  52. package/dist/modal/components/OAuth/OAuth.js +11 -85
  53. package/dist/modal/components/OAuth/TelegramOAuthStep.js +11 -60
  54. package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
  55. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +10 -4
  56. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +23 -32
  57. package/dist/modal/components/StripeComponents/StripeComponents.js +1 -1
  58. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +5 -2
  59. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +44 -60
  60. package/dist/modal/components/WalletCard/WalletCard.d.ts +5 -5
  61. package/dist/modal/components/WalletCard/WalletCard.js +8 -7
  62. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +33 -12
  63. package/dist/modal/components/common.d.ts +5 -5
  64. package/dist/modal/components/common.js +10 -4
  65. package/dist/modal/constants/constants.d.ts +1 -1
  66. package/dist/modal/constants/oAuthLogos.d.ts +3 -3
  67. package/dist/modal/hooks/useGoBack.js +6 -5
  68. package/dist/modal/index.d.ts +0 -3
  69. package/dist/modal/index.js +1 -5
  70. package/dist/modal/stores/index.d.ts +0 -2
  71. package/dist/modal/stores/index.js +0 -2
  72. package/dist/modal/stores/modal/actions.js +69 -16
  73. package/dist/modal/stores/modal/useModalStore.d.ts +26 -22
  74. package/dist/modal/stores/modal/useModalStore.js +9 -13
  75. package/dist/modal/types/commonTypes.d.ts +0 -52
  76. package/dist/modal/types/modalProps.d.ts +8 -32
  77. package/dist/modal/utils/authInputHelpers.d.ts +7 -0
  78. package/dist/modal/utils/authInputHelpers.js +38 -0
  79. package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
  80. package/dist/modal/{components/AuthInput → utils}/countryCodes.js +6 -3
  81. package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
  82. package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
  83. package/dist/modal/utils/isPasskeySupported.js +15 -0
  84. package/dist/modal/utils/openPopup.d.ts +2 -2
  85. package/dist/modal/utils/openPopup.js +2 -2
  86. package/dist/modal/utils/steps.d.ts +6 -0
  87. package/dist/modal/utils/steps.js +15 -0
  88. package/dist/provider/ParaProvider.d.ts +3 -1
  89. package/dist/provider/ParaProvider.js +69 -8
  90. package/dist/provider/actions/getAccount.d.ts +26 -8
  91. package/dist/provider/actions/getAccount.js +42 -14
  92. package/dist/provider/actions/getWallet.d.ts +3 -3
  93. package/dist/provider/actions/index.d.ts +27 -0
  94. package/dist/provider/actions/index.js +59 -0
  95. package/dist/provider/actions/utils.d.ts +3 -0
  96. package/dist/provider/actions/utils.js +15 -0
  97. package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
  98. package/dist/provider/components/CosmosWalletWrapper.js +34 -0
  99. package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
  100. package/dist/provider/components/EvmWalletWrapper.js +34 -0
  101. package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
  102. package/dist/provider/components/ExternalWalletWrapper.js +139 -0
  103. package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
  104. package/dist/provider/components/SolanaWalletWrapper.js +36 -0
  105. package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
  106. package/dist/provider/external/getParaCosmosConnector.js +22 -0
  107. package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
  108. package/dist/provider/external/getParaEvmConnector.js +22 -0
  109. package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
  110. package/dist/provider/external/getParaSolanaConnector.js +22 -0
  111. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +12 -0
  112. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +18 -0
  113. package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
  114. package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +21 -0
  115. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +8 -0
  116. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +14 -0
  117. package/dist/provider/hooks/mutations/index.d.ts +27 -11
  118. package/dist/provider/hooks/mutations/index.js +54 -17
  119. package/dist/provider/hooks/mutations/utils.d.ts +5 -0
  120. package/dist/provider/hooks/mutations/utils.js +59 -0
  121. package/dist/provider/hooks/queries/useAccount.d.ts +1 -7
  122. package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
  123. package/dist/provider/hooks/queries/useWalletBalance.d.ts +1 -2
  124. package/dist/provider/hooks/queries/useWalletBalance.js +40 -11
  125. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +5 -5
  126. package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
  127. package/dist/provider/hooks/utils/useEventListeners.js +100 -56
  128. package/dist/provider/hooks/utils/useWalletState.d.ts +5 -4
  129. package/dist/provider/hooks/utils/useWalletState.js +24 -9
  130. package/dist/provider/index.d.ts +1 -0
  131. package/dist/provider/index.js +1 -0
  132. package/dist/provider/providers/AuthProvider.d.ts +35 -0
  133. package/dist/provider/providers/AuthProvider.js +498 -0
  134. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
  135. package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
  136. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
  137. package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
  138. package/dist/provider/providers/ExternalWalletProvider.d.ts +76 -0
  139. package/dist/{modal/providers/ExternalWalletContext.js → provider/providers/ExternalWalletProvider.js} +146 -112
  140. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
  141. package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
  142. package/dist/provider/stores/getters.d.ts +3 -3
  143. package/dist/provider/stores/setters.d.ts +1 -0
  144. package/dist/provider/stores/setters.js +7 -0
  145. package/dist/provider/stores/slices/config.d.ts +3 -0
  146. package/dist/provider/stores/slices/config.js +9 -0
  147. package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
  148. package/dist/provider/stores/slices/externalWallets.js +40 -0
  149. package/dist/provider/stores/slices/index.d.ts +1 -0
  150. package/dist/provider/stores/slices/index.js +1 -0
  151. package/dist/provider/stores/slices/modal.js +11 -4
  152. package/dist/provider/stores/types.d.ts +50 -4
  153. package/dist/provider/stores/useStore.js +4 -3
  154. package/dist/provider/types/externalWalletProviders.d.ts +12 -0
  155. package/dist/provider/types/externalWalletProviders.js +1 -0
  156. package/dist/provider/types/provider.d.ts +126 -17
  157. package/dist/provider/types/utils.d.ts +20 -0
  158. package/dist/provider/utils/constants.js +3 -4
  159. package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
  160. package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
  161. package/dist/provider/utils/renameMutations.d.ts +3 -0
  162. package/dist/provider/utils/renameMutations.js +5 -3
  163. package/package.json +20 -8
  164. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -8
  165. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -124
  166. package/dist/modal/hooks/useActiveWallet.d.ts +0 -1
  167. package/dist/modal/hooks/useActiveWallet.js +0 -15
  168. package/dist/modal/hooks/useCreateAccount.d.ts +0 -6
  169. package/dist/modal/hooks/useCreateAccount.js +0 -77
  170. package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
  171. package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -54
  172. package/dist/modal/hooks/useSetLoginURLs.d.ts +0 -8
  173. package/dist/modal/hooks/useSetLoginURLs.js +0 -49
  174. package/dist/modal/hooks/useWalletBalance.d.ts +0 -4
  175. package/dist/modal/hooks/useWalletBalance.js +0 -49
  176. package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -42
  177. package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -38
  178. package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -46
  179. package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -55
  180. package/dist/modal/providers/ExternalWalletContext.d.ts +0 -92
  181. package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -32
  182. package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -32
  183. package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
  184. package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
  185. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -22
  186. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -21
  187. package/dist/modal/stores/theme/actions.d.ts +0 -3
  188. package/dist/modal/stores/theme/actions.js +0 -28
  189. package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
  190. package/dist/modal/stores/theme/useThemeStore.js +0 -21
  191. package/dist/modal/stores/userInfo/actions.d.ts +0 -3
  192. package/dist/modal/stores/userInfo/actions.js +0 -30
  193. package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +0 -19
  194. package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
  195. package/dist/provider/actions/checkIfUserExists.d.ts +0 -9
  196. package/dist/provider/actions/checkIfUserExists.js +0 -21
  197. package/dist/provider/actions/createGuestWallets.d.ts +0 -2
  198. package/dist/provider/actions/createGuestWallets.js +0 -13
  199. package/dist/provider/actions/createUser.d.ts +0 -12
  200. package/dist/provider/actions/createUser.js +0 -26
  201. package/dist/provider/actions/getWalletBalance.d.ts +0 -2
  202. package/dist/provider/actions/getWalletBalance.js +0 -14
  203. package/dist/provider/actions/initiateLogin.d.ts +0 -4
  204. package/dist/provider/actions/initiateLogin.js +0 -20
  205. package/dist/provider/actions/keepSessionAlive.d.ts +0 -2
  206. package/dist/provider/actions/keepSessionAlive.js +0 -20
  207. package/dist/provider/actions/logout.d.ts +0 -2
  208. package/dist/provider/actions/logout.js +0 -17
  209. package/dist/provider/actions/signMessage.d.ts +0 -8
  210. package/dist/provider/actions/signMessage.js +0 -20
  211. package/dist/provider/actions/signTransaction.d.ts +0 -8
  212. package/dist/provider/actions/signTransaction.js +0 -20
  213. package/dist/provider/actions/waitForAccountCreation.d.ts +0 -2
  214. package/dist/provider/actions/waitForAccountCreation.js +0 -21
  215. package/dist/provider/actions/waitForLoginAndSetup.d.ts +0 -6
  216. package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
  217. package/dist/provider/actions/waitForPasskeyAndCreateWallet.d.ts +0 -2
  218. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -21
  219. package/dist/provider/hooks/mutations/useCheckIfUserExists.d.ts +0 -13
  220. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
  221. package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +0 -15
  222. package/dist/provider/hooks/mutations/useCreateGuestWallets.js +0 -23
  223. package/dist/provider/hooks/mutations/useCreateUser.d.ts +0 -13
  224. package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
  225. package/dist/provider/hooks/mutations/useInitiateLogin.d.ts +0 -14
  226. package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
  227. package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -12
  228. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
  229. package/dist/provider/hooks/mutations/useLogout.d.ts +0 -12
  230. package/dist/provider/hooks/mutations/useLogout.js +0 -30
  231. package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -15
  232. package/dist/provider/hooks/mutations/useSignMessage.js +0 -39
  233. package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -14
  234. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -39
  235. package/dist/provider/hooks/mutations/useWaitForAccountCreation.d.ts +0 -12
  236. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
  237. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.d.ts +0 -14
  238. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
  239. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.d.ts +0 -13
  240. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
  241. /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
@@ -1,20 +0,0 @@
1
- "use client";
2
- import {
3
- __async
4
- } from "../../../chunk-MMUBH76A.js";
5
- import { useMutation } from "@tanstack/react-query";
6
- import { useClient } from "../index.js";
7
- import { keepSessionAlive } from "../../actions/keepSessionAlive.js";
8
- import { renameMutations } from "../../utils/renameMutations.js";
9
- const useKeepSessionAlive = () => {
10
- const client = useClient();
11
- const mutation = useMutation({
12
- mutationFn: () => __async(void 0, null, function* () {
13
- return yield keepSessionAlive(client);
14
- })
15
- });
16
- return renameMutations(mutation, "keepSessionAlive");
17
- };
18
- export {
19
- useKeepSessionAlive
20
- };
@@ -1,12 +0,0 @@
1
- import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
2
- import { Compute } from '../../types/utils.js';
3
- import { UseMutationReturnType } from '../../types/query.js';
4
- type UseLogoutReturnType<TData = void, TError = Error, TVariables = void, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
5
- logout: UseMutateFunction<TData, TError, TVariables, TContext>;
6
- logoutAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
7
- }>;
8
- /**
9
- * Hook for logging out a user
10
- */
11
- export declare const useLogout: () => UseLogoutReturnType<void, Error, void, unknown>;
12
- export {};
@@ -1,30 +0,0 @@
1
- "use client";
2
- import {
3
- __async
4
- } from "../../../chunk-MMUBH76A.js";
5
- import { useMutation, useQueryClient } from "@tanstack/react-query";
6
- import { useClient } from "../index.js";
7
- import { logout } from "../../actions/logout.js";
8
- import { useStore } from "../../stores/useStore.js";
9
- import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
10
- import { WALLET_BASE_KEY } from "../queries/useWallet.js";
11
- import { renameMutations } from "../../utils/renameMutations.js";
12
- const useLogout = () => {
13
- const client = useClient();
14
- const queryClient = useQueryClient();
15
- const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
16
- const mutation = useMutation({
17
- mutationFn: () => __async(void 0, null, function* () {
18
- return yield logout(client);
19
- }),
20
- onSettled: () => __async(void 0, null, function* () {
21
- yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
22
- yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
23
- clearSelectedWallet();
24
- })
25
- });
26
- return renameMutations(mutation, "logout");
27
- };
28
- export {
29
- useLogout
30
- };
@@ -1,15 +0,0 @@
1
- import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
2
- import { SignMessageArgs } from '../../actions/signMessage.js';
3
- import { Compute } from '../../types/utils.js';
4
- import { UseMutationReturnType } from '../../types/query.js';
5
- import { FullSignatureRes } from '@getpara/web-sdk';
6
- type SignMessageMutationArgs = Omit<SignMessageArgs, 'walletId'> & Partial<Pick<SignMessageArgs, 'walletId'>>;
7
- type UseSignMessageReturnType<TData = FullSignatureRes, TError = Error, TVariables = SignMessageMutationArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
8
- signMessage: UseMutateFunction<TData, TError, TVariables, TContext>;
9
- signMessageAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
10
- }>;
11
- /**
12
- * Hook for signing a message
13
- */
14
- export declare const useSignMessage: () => UseSignMessageReturnType<FullSignatureRes, Error, SignMessageMutationArgs, unknown>;
15
- export {};
@@ -1,39 +0,0 @@
1
- "use client";
2
- import {
3
- __async,
4
- __spreadProps,
5
- __spreadValues
6
- } from "../../../chunk-MMUBH76A.js";
7
- import { useMutation } from "@tanstack/react-query";
8
- import { useClient, useWallet } from "../index.js";
9
- import { signMessage } from "../../actions/signMessage.js";
10
- import { renameMutations } from "../../utils/renameMutations.js";
11
- import { EXTERNAL_WALLET_PACKAGE_BY_TYPE } from "../../utils/constants.js";
12
- const useSignMessage = () => {
13
- const client = useClient();
14
- const { data: wallet } = useWallet();
15
- const mutation = useMutation({
16
- mutationFn: (args) => __async(void 0, null, function* () {
17
- let walletId = args == null ? void 0 : args.walletId;
18
- if (!walletId) {
19
- if (wallet.isExternal) {
20
- throw Error(
21
- `Cannot sign with Capsule using an external wallet. Try using the methods from ${wallet.type ? EXTERNAL_WALLET_PACKAGE_BY_TYPE[wallet.type] : "the external wallet provider package"}.`
22
- );
23
- }
24
- walletId = wallet == null ? void 0 : wallet.id;
25
- }
26
- if (!walletId) {
27
- throw Error("no wallet id found");
28
- }
29
- return yield signMessage(client, __spreadProps(__spreadValues({}, args), { walletId }));
30
- })
31
- });
32
- return renameMutations(
33
- mutation,
34
- "signMessage"
35
- );
36
- };
37
- export {
38
- useSignMessage
39
- };
@@ -1,14 +0,0 @@
1
- import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
2
- import { SignTransactionArgs } from '../../actions/signTransaction.js';
3
- import { Compute } from '../../types/utils.js';
4
- import { UseMutationReturnType } from '../../types/query.js';
5
- import { FullSignatureRes } from '@getpara/web-sdk';
6
- type UseSignTransactionReturnType<TData = FullSignatureRes, TError = Error, TVariables = SignTransactionArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
7
- signTransaction: UseMutateFunction<TData, TError, TVariables, TContext>;
8
- signTransactionAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
9
- }>;
10
- /**
11
- * Hook for signing a transaction
12
- */
13
- export declare const useSignTransaction: () => UseSignTransactionReturnType<FullSignatureRes, Error, SignTransactionArgs, unknown>;
14
- export {};
@@ -1,39 +0,0 @@
1
- "use client";
2
- import {
3
- __async,
4
- __spreadProps,
5
- __spreadValues
6
- } from "../../../chunk-MMUBH76A.js";
7
- import { useMutation } from "@tanstack/react-query";
8
- import { useClient, useWallet } from "../index.js";
9
- import { signTransaction } from "../../actions/signTransaction.js";
10
- import { renameMutations } from "../../utils/renameMutations.js";
11
- import { EXTERNAL_WALLET_PACKAGE_BY_TYPE } from "../../utils/constants.js";
12
- const useSignTransaction = () => {
13
- const client = useClient();
14
- const { data: wallet } = useWallet();
15
- const mutation = useMutation({
16
- mutationFn: (args) => __async(void 0, null, function* () {
17
- let walletId = args == null ? void 0 : args.walletId;
18
- if (!walletId) {
19
- if (wallet.isExternal) {
20
- throw Error(
21
- `Cannot sign with Capsule using an external wallet. Try using the methods from ${wallet.type ? EXTERNAL_WALLET_PACKAGE_BY_TYPE[wallet.type] : "the external wallet provider package"}.`
22
- );
23
- }
24
- walletId = wallet == null ? void 0 : wallet.id;
25
- }
26
- if (!walletId) {
27
- throw Error("no wallet id found");
28
- }
29
- return yield signTransaction(client, __spreadProps(__spreadValues({}, args), { walletId }));
30
- })
31
- });
32
- return renameMutations(
33
- mutation,
34
- "signTransaction"
35
- );
36
- };
37
- export {
38
- useSignTransaction
39
- };
@@ -1,12 +0,0 @@
1
- import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
2
- import { UseMutationReturnType } from '../../types/query.js';
3
- import { Compute } from '../../types/utils.js';
4
- type UseWaitForAccountCreationReturnType<TData = boolean, TError = Error, TVariables = void, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
5
- waitForAccountCreation: UseMutateFunction<TData, TError, TVariables, TContext>;
6
- waitForAccountCreationAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
7
- }>;
8
- /**
9
- * Hook for waiting for account creation
10
- */
11
- export declare const useWaitForAccountCreation: () => UseWaitForAccountCreationReturnType<boolean, Error, void, unknown>;
12
- export {};
@@ -1,30 +0,0 @@
1
- "use client";
2
- import {
3
- __async
4
- } from "../../../chunk-MMUBH76A.js";
5
- import { useMutation, useQueryClient } from "@tanstack/react-query";
6
- import { useClient } from "../index.js";
7
- import { waitForAccountCreation } from "../../actions/waitForAccountCreation.js";
8
- import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
9
- import { WALLET_BASE_KEY } from "../queries/useWallet.js";
10
- import { renameMutations } from "../../utils/renameMutations.js";
11
- const useWaitForAccountCreation = () => {
12
- const client = useClient();
13
- const queryClient = useQueryClient();
14
- const mutation = useMutation({
15
- mutationFn: () => __async(void 0, null, function* () {
16
- return yield waitForAccountCreation(client);
17
- }),
18
- onSettled: () => __async(void 0, null, function* () {
19
- yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
20
- yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
21
- })
22
- });
23
- return renameMutations(
24
- mutation,
25
- "waitForAccountCreation"
26
- );
27
- };
28
- export {
29
- useWaitForAccountCreation
30
- };
@@ -1,14 +0,0 @@
1
- import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
2
- import { WaitForLoginAndSetupArgs } from '../../actions/waitForLoginAndSetup.js';
3
- import { Compute } from '../../types/utils.js';
4
- import { UseMutationReturnType } from '../../types/query.js';
5
- import { LoginResponse } from '@getpara/web-sdk';
6
- type UseWaitForLoginAndSetupReturnType<TData = LoginResponse, TError = Error, TVariables = WaitForLoginAndSetupArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
7
- waitForLoginAndSetup: UseMutateFunction<TData, TError, TVariables, TContext>;
8
- waitForLoginAndSetupAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
9
- }>;
10
- /**
11
- * Hook for waiting for user login and account setup
12
- */
13
- export declare const useWaitForLoginAndSetup: () => UseWaitForLoginAndSetupReturnType<LoginResponse, Error, WaitForLoginAndSetupArgs, unknown>;
14
- export {};
@@ -1,30 +0,0 @@
1
- "use client";
2
- import {
3
- __async
4
- } from "../../../chunk-MMUBH76A.js";
5
- import { useMutation, useQueryClient } from "@tanstack/react-query";
6
- import { useClient } from "../index.js";
7
- import { waitForLoginAndSetup } from "../../actions/waitForLoginAndSetup.js";
8
- import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
9
- import { WALLET_BASE_KEY } from "../queries/useWallet.js";
10
- import { renameMutations } from "../../utils/renameMutations.js";
11
- const useWaitForLoginAndSetup = () => {
12
- const client = useClient();
13
- const queryClient = useQueryClient();
14
- const mutation = useMutation({
15
- mutationFn: (args) => __async(void 0, null, function* () {
16
- return yield waitForLoginAndSetup(client, args);
17
- }),
18
- onSettled: () => __async(void 0, null, function* () {
19
- yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
20
- yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
21
- })
22
- });
23
- return renameMutations(
24
- mutation,
25
- "waitForLoginAndSetup"
26
- );
27
- };
28
- export {
29
- useWaitForLoginAndSetup
30
- };
@@ -1,13 +0,0 @@
1
- import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
2
- import { UseMutationReturnType } from '../../types/query.js';
3
- import { Compute } from '../../types/utils.js';
4
- import { AccountSetupResponse } from '@getpara/web-sdk';
5
- type UseWaitForPasskeyAndCreateWalletReturnType<TData = AccountSetupResponse, TError = Error, TVariables = void, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
6
- waitForPasskeyAndCreateWallet: UseMutateFunction<TData, TError, TVariables, TContext>;
7
- waitForPasskeyAndCreateWalletAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
8
- }>;
9
- /**
10
- * Hook for waiting for session setup and wallet creation
11
- */
12
- export declare const useWaitForPasskeyAndCreateWallet: () => UseWaitForPasskeyAndCreateWalletReturnType<AccountSetupResponse, Error, void, unknown>;
13
- export {};
@@ -1,30 +0,0 @@
1
- "use client";
2
- import {
3
- __async
4
- } from "../../../chunk-MMUBH76A.js";
5
- import { useMutation, useQueryClient } from "@tanstack/react-query";
6
- import { useClient } from "../index.js";
7
- import { waitForPasskeyAndCreateWallet } from "../../actions/waitForPasskeyAndCreateWallet.js";
8
- import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
9
- import { WALLET_BASE_KEY } from "../queries/useWallet.js";
10
- import { renameMutations } from "../../utils/renameMutations.js";
11
- const useWaitForPasskeyAndCreateWallet = () => {
12
- const client = useClient();
13
- const queryClient = useQueryClient();
14
- const mutation = useMutation({
15
- mutationFn: () => __async(void 0, null, function* () {
16
- return yield waitForPasskeyAndCreateWallet(client);
17
- }),
18
- onSettled: () => __async(void 0, null, function* () {
19
- yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
20
- yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
21
- })
22
- });
23
- return renameMutations(
24
- mutation,
25
- "waitForPasskeyAndCreateWallet"
26
- );
27
- };
28
- export {
29
- useWaitForPasskeyAndCreateWallet
30
- };