@getpara/react-sdk-lite 2.18.0 → 2.20.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 (148) hide show
  1. package/dist/aa/hooks/alchemy.d.ts +15 -0
  2. package/dist/aa/hooks/alchemy.js +9 -0
  3. package/dist/aa/hooks/biconomy.d.ts +15 -0
  4. package/dist/aa/hooks/biconomy.js +9 -0
  5. package/dist/aa/hooks/cdp.d.ts +14 -0
  6. package/dist/aa/hooks/cdp.js +9 -0
  7. package/dist/aa/hooks/gelato.d.ts +14 -0
  8. package/dist/aa/hooks/gelato.js +9 -0
  9. package/dist/aa/hooks/pimlico.d.ts +15 -0
  10. package/dist/aa/hooks/pimlico.js +9 -0
  11. package/dist/aa/hooks/porto.d.ts +15 -0
  12. package/dist/aa/hooks/porto.js +9 -0
  13. package/dist/aa/hooks/rhinestone.d.ts +15 -0
  14. package/dist/aa/hooks/rhinestone.js +9 -0
  15. package/dist/aa/hooks/safe.d.ts +15 -0
  16. package/dist/aa/hooks/safe.js +9 -0
  17. package/dist/aa/hooks/thirdweb.d.ts +13 -0
  18. package/dist/aa/hooks/thirdweb.js +9 -0
  19. package/dist/aa/hooks/zerodev.d.ts +15 -0
  20. package/dist/aa/hooks/zerodev.js +9 -0
  21. package/dist/aa/useWagmiSignerEnhancer.d.ts +15 -0
  22. package/dist/aa/useWagmiSignerEnhancer.js +45 -0
  23. package/dist/index.d.ts +11 -12
  24. package/dist/index.js +10 -12
  25. package/dist/modal/ParaModal.js +1 -1
  26. package/dist/modal/components/Header/hooks/useStepTitle.d.ts +1 -1
  27. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -1
  28. package/dist/modal/components/QuantityInput.js +1 -0
  29. package/dist/modal/components/SearchableButtonList.js +20 -11
  30. package/dist/modal/components/flows/account/AddFunds/AddFundsReceive.js +2 -1
  31. package/dist/modal/components/flows/account/AddFunds/AddFundsSettings.js +1 -0
  32. package/dist/modal/components/flows/account/Send/context.js +4 -4
  33. package/dist/modal/components/flows/account/Wallet/Wallet.js +5 -1
  34. package/dist/modal/constants/walletTypeConfig.js +2 -1
  35. package/dist/provider/ParaProviderMin.js +46 -54
  36. package/dist/provider/actions/index.d.ts +2 -34
  37. package/dist/provider/actions/index.js +43 -34
  38. package/dist/provider/hooks/mutations/index.d.ts +2 -29
  39. package/dist/provider/hooks/mutations/index.js +3 -58
  40. package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +2 -2
  41. package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +24 -4
  42. package/dist/provider/hooks/mutations/useExportPrivateKey.js +7 -2
  43. package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +2 -2
  44. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +2 -2
  45. package/dist/provider/hooks/queries/index.d.ts +2 -2
  46. package/dist/provider/hooks/queries/index.js +2 -3
  47. package/dist/provider/hooks/queries/useAccount.d.ts +14 -69
  48. package/dist/provider/hooks/queries/useAccount.js +30 -136
  49. package/dist/provider/hooks/queries/useParaStatus.d.ts +7 -11
  50. package/dist/provider/hooks/queries/useParaStatus.js +9 -16
  51. package/dist/provider/hooks/queries/useProfileBalance.js +1 -1
  52. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +14 -10
  53. package/dist/provider/hooks/utils/useEventListeners.js +1 -1
  54. package/dist/provider/hooks/utils/useWalletState.d.ts +1 -1
  55. package/dist/provider/index.d.ts +1 -0
  56. package/dist/provider/stores/getters.d.ts +1 -1
  57. package/dist/provider/utils/renameMutations.d.ts +4 -2
  58. package/package.json +19 -18
  59. package/dist/aa/alchemy/hook.d.ts +0 -16708
  60. package/dist/aa/alchemy/hook.js +0 -26
  61. package/dist/aa/biconomy/hook.d.ts +0 -44
  62. package/dist/aa/biconomy/hook.js +0 -26
  63. package/dist/aa/cdp/hook.d.ts +0 -11
  64. package/dist/aa/cdp/hook.js +0 -26
  65. package/dist/aa/createSmartAccountHook.d.ts +0 -13
  66. package/dist/aa/createSmartAccountHook.js +0 -81
  67. package/dist/aa/gelato/hook.d.ts +0 -11
  68. package/dist/aa/gelato/hook.js +0 -26
  69. package/dist/aa/pimlico/hook.d.ts +0 -838
  70. package/dist/aa/pimlico/hook.js +0 -26
  71. package/dist/aa/porto/hook.d.ts +0 -12
  72. package/dist/aa/porto/hook.js +0 -26
  73. package/dist/aa/rhinestone/hook.d.ts +0 -12
  74. package/dist/aa/rhinestone/hook.js +0 -26
  75. package/dist/aa/safe/hook.d.ts +0 -12
  76. package/dist/aa/safe/hook.js +0 -26
  77. package/dist/aa/thirdweb/hook.d.ts +0 -12
  78. package/dist/aa/thirdweb/hook.js +0 -26
  79. package/dist/aa/types.d.ts +0 -21
  80. package/dist/aa/types.js +0 -1
  81. package/dist/aa/zerodev/hook.d.ts +0 -12
  82. package/dist/aa/zerodev/hook.js +0 -26
  83. package/dist/modal/components/flows/account/AddFunds/MoonPayEmbed.d.ts +0 -2
  84. package/dist/modal/components/flows/account/AddFunds/MoonPayEmbed.js +0 -7
  85. package/dist/provider/actions/getEmbeddedAccount.d.ts +0 -27
  86. package/dist/provider/actions/getEmbeddedAccount.js +0 -66
  87. package/dist/provider/actions/getWallet.d.ts +0 -5
  88. package/dist/provider/actions/getWallet.js +0 -18
  89. package/dist/provider/hooks/mutations/useAuthenticateWithEmailOrPhone.d.ts +0 -34
  90. package/dist/provider/hooks/mutations/useAuthenticateWithEmailOrPhone.js +0 -28
  91. package/dist/provider/hooks/mutations/useAuthenticateWithOAuth.d.ts +0 -34
  92. package/dist/provider/hooks/mutations/useAuthenticateWithOAuth.js +0 -28
  93. package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +0 -34
  94. package/dist/provider/hooks/mutations/useClaimPregenWallets.js +0 -31
  95. package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +0 -34
  96. package/dist/provider/hooks/mutations/useCreateGuestWallets.js +0 -31
  97. package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +0 -34
  98. package/dist/provider/hooks/mutations/useCreatePregenWallet.js +0 -31
  99. package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +0 -34
  100. package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.js +0 -28
  101. package/dist/provider/hooks/mutations/useCreateWallet.d.ts +0 -34
  102. package/dist/provider/hooks/mutations/useCreateWallet.js +0 -31
  103. package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +0 -34
  104. package/dist/provider/hooks/mutations/useCreateWalletPerType.js +0 -28
  105. package/dist/provider/hooks/mutations/useEnable2fa.d.ts +0 -34
  106. package/dist/provider/hooks/mutations/useEnable2fa.js +0 -28
  107. package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +0 -34
  108. package/dist/provider/hooks/mutations/useHasPregenWallet.js +0 -28
  109. package/dist/provider/hooks/mutations/useIssueJwt.d.ts +0 -34
  110. package/dist/provider/hooks/mutations/useIssueJwt.js +0 -28
  111. package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -33
  112. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -28
  113. package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +0 -34
  114. package/dist/provider/hooks/mutations/useLoginExternalWallet.js +0 -31
  115. package/dist/provider/hooks/mutations/useLogout.d.ts +0 -34
  116. package/dist/provider/hooks/mutations/useLogout.js +0 -28
  117. package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +0 -34
  118. package/dist/provider/hooks/mutations/useResendVerificationCode.js +0 -31
  119. package/dist/provider/hooks/mutations/useSetup2fa.d.ts +0 -34
  120. package/dist/provider/hooks/mutations/useSetup2fa.js +0 -28
  121. package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -34
  122. package/dist/provider/hooks/mutations/useSignMessage.js +0 -28
  123. package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -34
  124. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -31
  125. package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +0 -34
  126. package/dist/provider/hooks/mutations/useSignUpOrLogIn.js +0 -31
  127. package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +0 -34
  128. package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.js +0 -31
  129. package/dist/provider/hooks/mutations/useVerify2fa.d.ts +0 -34
  130. package/dist/provider/hooks/mutations/useVerify2fa.js +0 -28
  131. package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +0 -34
  132. package/dist/provider/hooks/mutations/useVerifyExternalWallet.js +0 -31
  133. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +0 -34
  134. package/dist/provider/hooks/mutations/useVerifyFarcaster.js +0 -31
  135. package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +0 -34
  136. package/dist/provider/hooks/mutations/useVerifyOAuth.js +0 -28
  137. package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +0 -34
  138. package/dist/provider/hooks/mutations/useVerifyTelegram.js +0 -28
  139. package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +0 -34
  140. package/dist/provider/hooks/mutations/useWaitForLogin.js +0 -31
  141. package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +0 -34
  142. package/dist/provider/hooks/mutations/useWaitForSignup.js +0 -28
  143. package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +0 -34
  144. package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +0 -28
  145. package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +0 -8
  146. package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +0 -29
  147. package/dist/provider/hooks/queries/useWallet.d.ts +0 -5
  148. package/dist/provider/hooks/queries/useWallet.js +0 -26
@@ -1,90 +1,35 @@
1
1
  import { useContext } from 'react';
2
- import { Account } from '../../actions/getEmbeddedAccount.js';
3
2
  import type { CosmosExternalWalletContextType, UseAccountParameters as UseCosmosAccountParameters } from '@getpara/cosmos-wallet-connectors';
4
3
  import type { EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
5
4
  import type { Adapter } from '@getpara/solana-wallet-connectors';
6
- export declare const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
7
5
  type EVMAccountType = ReturnType<ReturnType<typeof useContext<EvmExternalWalletContextType>>['useAccount']>;
8
6
  type CosmosAccountType = Omit<ReturnType<ReturnType<typeof useContext<CosmosExternalWalletContextType>>['useAccount']>, 'reconnect'>;
9
7
  type SolanaAccountType = Pick<Adapter, 'publicKey' | 'name' | 'icon' | 'readyState' | 'supportedTransactionVersions' | 'url'> & {
10
8
  isConnected?: boolean;
11
9
  isConnecting?: boolean;
12
10
  };
13
- type ConnectionType = 'embedded' | 'external' | 'both' | 'none';
14
- type ExternalNetwork = 'evm' | 'cosmos' | 'solana';
15
- /**
16
- * The return type for the useAccount hook.
17
- *
18
- * @property isConnected - Indicates whether there is a wallet connected (either embedded, external or both).
19
- * @property isLoading - Indicates whether the account is currently loading.
20
- * @property connectionType - The type of connection for the account:
21
- * @property embedded - The embedded account object.
22
- * @property external - An object containing connected external wallet account data:
23
- * - `evm`: The connected EVM wallet account (if any).
24
- * - `cosmos`: The connected Cosmos wallet account (if any), with the `reconnect` property omitted.
25
- * - `solana`: The connected Solana wallet adapter, with only allowed properties included.
26
- */
27
- export type UseAccountReturn = {
28
- /**
29
- * Indicates whether there is a wallet connected (either embedded, external or both).
30
- */
31
- isConnected: boolean;
32
- /**
33
- * Indicates whether the account is currently loading.
34
- */
35
- isLoading: boolean;
36
- /**
37
- * The type of connection for the account.
38
- * - 'embedded': Only the embedded account is connected.
39
- * - 'external': Only an external wallet is connected.
40
- * - 'both': Both embedded and external wallets are connected.
41
- * - 'none': No wallets are connected.
42
- */
43
- connectionType: ConnectionType;
44
- /**
45
- * The embedded account object. Use this instead of the deprecated top-level properties.
46
- */
47
- embedded: Omit<Account, 'isReady' | 'isFarcasterMiniApp' | 'isConnected' | 'isGuestMode'> & {
48
- isConnected: boolean;
49
- isGuestMode?: boolean;
50
- };
51
- /**
52
- * Connected external wallet account data.
53
- */
54
- external: {
55
- /**
56
- * The list of connected external networks, which can include 'evm', 'cosmos', and 'solana'.
57
- */
58
- connectedNetworks: ExternalNetwork[];
59
- /**
60
- * The connected EVM wallet (if any), with only allowed properties included.
61
- */
62
- evm: EVMAccountType;
63
- /**
64
- * The connected Cosmos wallet (if any), with only allowed properties included.
65
- */
66
- cosmos: CosmosAccountType;
67
- /**
68
- * The connected Solana wallet (if any), with only allowed properties included.
69
- */
70
- solana: SolanaAccountType;
71
- };
11
+ export type ExternalAccounts = {
12
+ evm: EVMAccountType;
13
+ cosmos: CosmosAccountType;
14
+ solana: SolanaAccountType;
72
15
  };
73
16
  export type UseAccountParameters = {
74
17
  cosmos?: UseCosmosAccountParameters;
75
18
  };
19
+ export declare const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
76
20
  /**
77
21
  * React Query hook for retrieving the current embedded account and connected external wallets.
78
22
  *
79
23
  * @returns {UseAccountReturn}
80
- * The account data object, or undefined while loading.
24
+ * The account data object. Contains:
25
+ * - `isConnected`: whether any wallet is connected (embedded, external, or both).
26
+ * - `isLoading`: whether the account is currently loading.
27
+ * - `connectionType`: `'embedded'` | `'external'` | `'both'` | `'none'`.
28
+ * - `embedded`: the Para MPC account object.
29
+ * - `external`: connected external wallet data (EVM, Cosmos, Solana) plus `connectedNetworks`.
81
30
  *
82
- * The returned object contains:
83
- * - `isConnected`: Indicates whether there is a wallet connected (either embedded, external or both).
84
- * - `isLoading`: Indicates whether the account is currently loading.
85
- * - `connectionType`: The type of connection for the account:
86
- * - `embedded`: The embedded account object.
87
- * - `external`: Connected external wallet data (EVM, Cosmos, Solana).
31
+ * Extends the platform-agnostic base with wagmi/graz/solana-wallet-adapter support.
88
32
  */
89
- export declare const useAccount: ({ cosmos }?: UseAccountParameters) => UseAccountReturn;
33
+ export declare const useAccount: () => import("@getpara/react-core/internal").UseAccountReturn<ExternalAccounts>;
34
+ export type UseAccountReturn = ReturnType<typeof useAccount>;
90
35
  export {};
@@ -1,17 +1,10 @@
1
1
  "use client";
2
2
  import {
3
- __async,
4
- __objRest,
5
- __spreadProps,
6
- __spreadValues
3
+ __objRest
7
4
  } from "../../../chunk-MMUBH76A.js";
8
- import { useQuery, useQueryClient } from "@tanstack/react-query";
9
- import { useInternalClient } from "../utils/useInternalClient.js";
10
- import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
5
+ import { useContext } from "react";
11
6
  import { useStore } from "../../stores/useStore.js";
12
- import { useContext, useEffect, useMemo } from "react";
13
- import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
14
- const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
7
+ import { createAccountHook } from "@getpara/react-core/internal";
15
8
  function pickSolanaAdapter(adapter) {
16
9
  if (!adapter) return { isConnected: false };
17
10
  const { connected, connecting, publicKey, name, icon, readyState, supportedTransactionVersions, url } = adapter;
@@ -31,145 +24,46 @@ function pickCosmosAccount(account) {
31
24
  const _a = account, { reconnect: _ } = _a, rest = __objRest(_a, ["reconnect"]);
32
25
  return rest;
33
26
  }
34
- let lastConnectionState = "";
35
- let invalidationTimeoutId = null;
36
- const useInvalidation = (connectionStates, queryKey) => {
37
- const queryClient = useQueryClient();
38
- useEffect(() => {
39
- const connectionStateKey = `${connectionStates.evm}-${connectionStates.cosmos}-${connectionStates.solana}`;
40
- if (connectionStateKey === lastConnectionState) {
41
- return;
42
- }
43
- lastConnectionState = connectionStateKey;
44
- if (invalidationTimeoutId) {
45
- clearTimeout(invalidationTimeoutId);
46
- }
47
- invalidationTimeoutId = setTimeout(() => {
48
- queryClient.invalidateQueries({ queryKey });
49
- invalidationTimeoutId = null;
50
- }, 0);
51
- return () => {
52
- if (invalidationTimeoutId) {
53
- clearTimeout(invalidationTimeoutId);
54
- invalidationTimeoutId = null;
55
- }
56
- };
57
- }, [connectionStates, queryClient]);
58
- };
59
- const useAccount = ({ cosmos } = {}) => {
60
- var _a, _b, _c, _d, _e, _f;
61
- const client = useInternalClient();
62
- const { data: isFullyLoggedIn, isSuccess, isLoading: isFullyLoggedInLoading } = useIsFullyLoggedIn();
27
+ function useExternalWallets() {
28
+ var _a, _b, _c;
63
29
  const evmContext = useStore((state) => state.evmContext);
64
30
  const { useAccount: useEvmAccount } = useContext(evmContext);
65
31
  const evmAccount = useEvmAccount();
66
- const evmQueryKeys = [evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId];
67
32
  const cosmosContext = useStore((state) => state.cosmosContext);
68
33
  const { useAccount: useCosmosAccount } = useContext(cosmosContext);
69
- const cosmosAccount = useCosmosAccount(cosmos);
70
- const cosmosQueryKeys = [cosmosAccount == null ? void 0 : cosmosAccount.data];
34
+ const cosmosAccount = useCosmosAccount();
71
35
  const solanaContext = useStore((state) => state.solanaContext);
72
36
  const { useWallet: useSolanaWallet } = useContext(solanaContext);
73
37
  const solanaWallet = useSolanaWallet();
74
- const solanaQueryKeys = [(_b = (_a = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _a.adapter) == null ? void 0 : _b.publicKey];
75
- const solanaAdapter = (_c = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _c.adapter;
76
- const queryKey = [
77
- ACCOUNT_BASE_KEY,
78
- isFullyLoggedIn != null ? isFullyLoggedIn : null,
79
- isFullyLoggedInLoading,
80
- (_d = client == null ? void 0 : client.userId) != null ? _d : null,
81
- evmQueryKeys,
82
- cosmosQueryKeys,
83
- solanaQueryKeys
84
- ];
85
- const connectionStates = useMemo(() => {
86
- var _a2, _b2;
87
- return {
38
+ const solanaAdapter = (_a = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _a.adapter;
39
+ const defaultEvm = {
40
+ address: void 0,
41
+ addresses: void 0,
42
+ chain: void 0,
43
+ chainId: void 0,
44
+ connector: void 0,
45
+ isConnected: false,
46
+ isReconnecting: false,
47
+ isConnecting: false,
48
+ isDisconnected: true,
49
+ status: "disconnected"
50
+ };
51
+ return {
52
+ queryKeys: [evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId, cosmosAccount == null ? void 0 : cosmosAccount.data, (_c = (_b = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _b.adapter) == null ? void 0 : _c.publicKey],
53
+ connections: {
88
54
  evm: !!(evmAccount == null ? void 0 : evmAccount.isConnected),
89
55
  cosmos: !!(cosmosAccount == null ? void 0 : cosmosAccount.isConnected),
90
- solana: !!((_b2 = (_a2 = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _a2.adapter) == null ? void 0 : _b2.connected)
91
- };
92
- }, [!!(evmAccount == null ? void 0 : evmAccount.isConnected), !!(cosmosAccount == null ? void 0 : cosmosAccount.isConnected), !!((_f = (_e = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _e.adapter) == null ? void 0 : _f.connected)]);
93
- useInvalidation(connectionStates, queryKey);
94
- const { data, isLoading } = useQuery({
95
- enabled: isSuccess && !!client,
96
- queryKey,
97
- queryFn: () => __async(void 0, null, function* () {
98
- const paraAccount = yield getEmbeddedAccount(client, isFullyLoggedIn);
99
- let connectionType = "none";
100
- if (paraAccount.isConnected) {
101
- connectionType = "embedded";
102
- if (paraAccount.wallets.some((w) => w.isExternal)) {
103
- connectionType = "both";
104
- }
105
- if (paraAccount.wallets.every((w) => w.isExternal) && ((evmAccount == null ? void 0 : evmAccount.isConnected) || (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) || (solanaAdapter == null ? void 0 : solanaAdapter.connected))) {
106
- connectionType = "external";
107
- }
108
- }
109
- const isEmbeddedConnected = connectionType === "embedded" || connectionType === "both";
110
- const connectedNetworks = [];
111
- if (evmAccount == null ? void 0 : evmAccount.isConnected) {
112
- connectedNetworks.push("evm");
113
- }
114
- if (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) {
115
- connectedNetworks.push("cosmos");
116
- }
117
- if (solanaAdapter == null ? void 0 : solanaAdapter.connected) {
118
- connectedNetworks.push("solana");
119
- }
120
- return {
121
- isConnected: paraAccount.isConnected,
122
- connectionType,
123
- embedded: __spreadProps(__spreadValues({}, paraAccount), { isConnected: isEmbeddedConnected }),
124
- external: {
125
- connectedNetworks,
126
- evm: evmAccount != null ? evmAccount : {
127
- address: void 0,
128
- addresses: void 0,
129
- chain: void 0,
130
- chainId: void 0,
131
- connector: void 0,
132
- isConnected: false,
133
- isReconnecting: false,
134
- isConnecting: false,
135
- isDisconnected: true,
136
- status: "disconnected"
137
- },
138
- cosmos: pickCosmosAccount(cosmosAccount),
139
- solana: pickSolanaAdapter(solanaAdapter)
140
- }
141
- };
142
- })
143
- });
144
- const defaultResp = {
145
- isConnected: false,
146
- connectionType: "none",
147
- isLoading,
148
- embedded: {
149
- isConnected: false
56
+ solana: !!(solanaAdapter == null ? void 0 : solanaAdapter.connected)
150
57
  },
151
- external: {
152
- connectedNetworks: [],
153
- evm: {
154
- address: void 0,
155
- addresses: void 0,
156
- chain: void 0,
157
- chainId: void 0,
158
- connector: void 0,
159
- isConnected: false,
160
- isReconnecting: false,
161
- isConnecting: false,
162
- isDisconnected: true,
163
- status: "disconnected"
164
- },
165
- cosmos: { isConnected: false },
166
- solana: { isConnected: false }
58
+ data: {
59
+ evm: evmAccount != null ? evmAccount : defaultEvm,
60
+ cosmos: pickCosmosAccount(cosmosAccount),
61
+ solana: pickSolanaAdapter(solanaAdapter)
167
62
  }
168
63
  };
169
- return __spreadProps(__spreadValues({}, data != null ? data : defaultResp), {
170
- isLoading: isFullyLoggedInLoading || isLoading
171
- });
172
- };
64
+ }
65
+ const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
66
+ const useAccount = createAccountHook(useExternalWallets);
173
67
  export {
174
68
  ACCOUNT_BASE_KEY,
175
69
  useAccount
@@ -1,16 +1,8 @@
1
- export type ParaStatus = {
2
- /**
3
- * Indicates whether the client's first-time setup is complete.
4
- */
5
- isReady: boolean;
6
- /**
7
- * Indicates whether the current application is a Farcaster Mini App.
8
- */
9
- isFarcasterMiniApp: boolean;
10
- };
11
1
  /**
12
2
  * Hook for retrieving the initial setup status of the Para client.
13
3
  *
4
+ * Extends the platform-agnostic base with `isFarcasterMiniApp` from ParaWeb.
5
+ *
14
6
  * @example
15
7
  * const status = useParaStatus();
16
8
  * if (status.isReady) {
@@ -18,4 +10,8 @@ export type ParaStatus = {
18
10
  * // ...
19
11
  * }
20
12
  */
21
- export declare const useParaStatus: () => ParaStatus;
13
+ export declare const useParaStatus: () => import("@getpara/react-core/internal").ParaStatusBase & {
14
+ /** Whether the current application is a Farcaster Mini App. */
15
+ isFarcasterMiniApp: any;
16
+ };
17
+ export type ParaStatus = ReturnType<typeof useParaStatus>;
@@ -1,23 +1,16 @@
1
1
  "use client";
2
2
  import "../../../chunk-MMUBH76A.js";
3
- import { useQuery } from "@tanstack/react-query";
3
+ import { createParaStatusHook } from "@getpara/react-core/internal";
4
4
  import { useInternalClient } from "../utils/useInternalClient.js";
5
- const useParaStatus = () => {
6
- var _a, _b;
5
+ function useFarcasterStatus() {
6
+ var _a;
7
7
  const client = useInternalClient();
8
- const { data } = useQuery({
9
- enabled: !!client,
10
- queryKey: ["useParaStatus", (_a = client == null ? void 0 : client.isReady) != null ? _a : null, (_b = client == null ? void 0 : client.isFarcasterMiniApp) != null ? _b : null],
11
- queryFn: () => {
12
- var _a2, _b2;
13
- return {
14
- isReady: (_a2 = client == null ? void 0 : client.isReady) != null ? _a2 : false,
15
- isFarcasterMiniApp: (_b2 = client == null ? void 0 : client.isFarcasterMiniApp) != null ? _b2 : false
16
- };
17
- }
18
- });
19
- return data != null ? data : { isReady: false, isFarcasterMiniApp: false };
20
- };
8
+ return {
9
+ /** Whether the current application is a Farcaster Mini App. */
10
+ isFarcasterMiniApp: (_a = client == null ? void 0 : client.isFarcasterMiniApp) != null ? _a : false
11
+ };
12
+ }
13
+ const useParaStatus = createParaStatusHook(useFarcasterStatus);
21
14
  export {
22
15
  useParaStatus
23
16
  };
@@ -8,7 +8,7 @@ import { useQuery } from "@tanstack/react-query";
8
8
  import { useRef, useEffect, useMemo } from "react";
9
9
  import { useStore } from "../../stores/useStore.js";
10
10
  import { useInternalClient } from "../utils/useInternalClient.js";
11
- import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
11
+ import { useIsFullyLoggedIn } from "@getpara/react-core";
12
12
  import { filterProfileBalance, formatCurrency } from "@getpara/shared";
13
13
  const useProfileBalance = (options) => {
14
14
  var _a, _b, _c;
@@ -3,28 +3,32 @@ import {
3
3
  __async
4
4
  } from "../../../chunk-MMUBH76A.js";
5
5
  import { useEffect, useRef } from "react";
6
- import { useAccount, useKeepSessionAlive, useLogout } from "../index.js";
6
+ import { useStore } from "../../stores/useStore.js";
7
+ import { logout, keepSessionAlive } from "../../actions/index.js";
7
8
  import { useInternalClient } from "./useInternalClient.js";
8
9
  const SESSION_CHECK_INTERVAL = 6e4;
9
10
  const SESSION_REFRESH_THRESHOLD = 3e5;
10
11
  const useAutoSessionKeepAlive = ({ disabled }) => {
11
12
  const client = useInternalClient();
12
- const { embedded } = useAccount();
13
- const { logoutAsync } = useLogout();
14
- const { keepSessionAliveAsync } = useKeepSessionAlive();
13
+ const corePhase = useStore((state) => {
14
+ var _a;
15
+ return (_a = state.paraState) == null ? void 0 : _a.corePhase;
16
+ });
17
+ const isConnected = corePhase === "authenticated" || corePhase === "guest_mode";
18
+ const isGuestMode = corePhase === "guest_mode";
15
19
  const sessionCheckInterval = useRef(null);
16
20
  useEffect(() => {
17
21
  if (!client || disabled) {
18
22
  clearSessionMonitoring();
19
23
  return;
20
24
  }
21
- if ((embedded == null ? void 0 : embedded.isConnected) && !embedded.isGuestMode && client.externalWalletConnectionType !== "CONNECTION_ONLY") {
25
+ if (isConnected && !isGuestMode && client.externalWalletConnectionType !== "CONNECTION_ONLY") {
22
26
  setupSessionMonitoring();
23
27
  } else {
24
28
  clearSessionMonitoring();
25
29
  }
26
30
  return () => clearSessionMonitoring();
27
- }, [client, embedded, disabled]);
31
+ }, [client, isConnected, isGuestMode, disabled]);
28
32
  const getSessionExpiry = () => __async(void 0, null, function* () {
29
33
  try {
30
34
  const sessionCookie = client == null ? void 0 : client.retrieveSessionCookie();
@@ -40,23 +44,23 @@ const useAutoSessionKeepAlive = ({ disabled }) => {
40
44
  sessionCheckInterval.current = setInterval(() => __async(void 0, null, function* () {
41
45
  const expiry = yield getSessionExpiry();
42
46
  if (!expiry) {
43
- yield logoutAsync({});
47
+ yield logout(client);
44
48
  clearSessionMonitoring();
45
49
  return;
46
50
  }
47
51
  const timeUntilExpiry = expiry.getTime() - Date.now();
48
52
  if (timeUntilExpiry <= 0) {
49
- yield logoutAsync({});
53
+ yield logout(client);
50
54
  clearSessionMonitoring();
51
55
  return;
52
56
  }
53
57
  if (timeUntilExpiry <= SESSION_REFRESH_THRESHOLD) {
54
58
  try {
55
- yield keepSessionAliveAsync();
59
+ yield keepSessionAlive(client);
56
60
  setupSessionMonitoring();
57
61
  } catch (err) {
58
62
  console.error("Failed to keep session alive:", err);
59
- yield logoutAsync({});
63
+ yield logout(client);
60
64
  clearSessionMonitoring();
61
65
  }
62
66
  return;
@@ -8,7 +8,7 @@ import {
8
8
  ParaEvent
9
9
  } from "@getpara/web-sdk";
10
10
  import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
11
- import { WALLET_BASE_KEY } from "../queries/useWallet.js";
11
+ import { WALLET_BASE_KEY } from "@getpara/react-core/internal";
12
12
  import { WALLET_BALANCE_BASE_KEY } from "../queries/useWalletBalance.js";
13
13
  import { useModalSessionStore } from "../../../modal/stores/index.js";
14
14
  const useEventListeners = ({
@@ -5,7 +5,7 @@ import { TWalletType } from '@getpara/web-sdk';
5
5
  export declare const useWalletState: () => {
6
6
  selectedWallet: {
7
7
  id: string | undefined;
8
- type: "EVM" | "SOLANA" | "COSMOS" | undefined;
8
+ type: "EVM" | "SOLANA" | "COSMOS" | "STELLAR" | undefined;
9
9
  address: string | undefined;
10
10
  };
11
11
  setSelectedWallet: ({ id, type }: {
@@ -5,3 +5,4 @@ export * from './stores/getters.js';
5
5
  export * from './stores/setters.js';
6
6
  export * from './types/externalWalletProviders.js';
7
7
  export * from './types/provider.js';
8
+ export { type CoreProviderConfig, type CoreCallbacks, type ParaStorageAdapter } from '@getpara/react-core';
@@ -1,4 +1,4 @@
1
1
  export declare const getClient: () => import("graz").ParaWeb | undefined;
2
2
  export declare const getIsOpen: () => boolean;
3
3
  export declare const getSelectedWalletId: () => string | undefined;
4
- export declare const getSelectedWalletType: () => "EVM" | "SOLANA" | "COSMOS" | undefined;
4
+ export declare const getSelectedWalletType: () => "EVM" | "SOLANA" | "COSMOS" | "STELLAR" | undefined;
@@ -1,5 +1,7 @@
1
- import { DefaultError, UseMutateAsyncFunction, UseMutateFunction, UseMutationResult } from '@tanstack/react-query';
2
- import { Compute } from '../types/utils.js';
1
+ import type { DefaultError, UseMutateAsyncFunction, UseMutateFunction, UseMutationResult } from '@tanstack/react-query';
2
+ export type Compute<type> = {
3
+ [key in keyof type]: type[key];
4
+ } & unknown;
3
5
  type RenamedMutationResult<TData, TError, TVariables, TContext, TName extends string> = Omit<UseMutationResult<TData, TError, TVariables, TContext>, 'mutate' | 'mutateAsync'> & {
4
6
  [K in TName]: UseMutateFunction<TData, TError, TVariables, TContext>;
5
7
  } & {
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.18.0",
3
+ "version": "2.20.0",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.18.0",
9
- "@getpara/react-components": "2.18.0",
10
- "@getpara/web-sdk": "2.18.0",
8
+ "@getpara/react-common": "2.20.0",
9
+ "@getpara/react-components": "2.20.0",
10
+ "@getpara/react-core": "2.20.0",
11
+ "@getpara/web-sdk": "2.20.0",
11
12
  "date-fns": "^3.6.0",
12
13
  "detect-browser": "^5.3.0",
13
14
  "framer-motion": "^11.3.31",
@@ -18,19 +19,19 @@
18
19
  "zustand-sync-tabs": "^0.2.2"
19
20
  },
20
21
  "devDependencies": {
21
- "@getpara/aa-alchemy": "2.18.0",
22
- "@getpara/aa-biconomy": "2.18.0",
23
- "@getpara/aa-cdp": "2.18.0",
24
- "@getpara/aa-gelato": "2.18.0",
25
- "@getpara/aa-pimlico": "2.18.0",
26
- "@getpara/aa-porto": "2.18.0",
27
- "@getpara/aa-rhinestone": "2.18.0",
28
- "@getpara/aa-safe": "2.18.0",
29
- "@getpara/aa-thirdweb": "2.18.0",
30
- "@getpara/aa-zerodev": "2.18.0",
31
- "@getpara/cosmos-wallet-connectors": "2.18.0",
32
- "@getpara/evm-wallet-connectors": "2.18.0",
33
- "@getpara/solana-wallet-connectors": "2.18.0",
22
+ "@getpara/aa-alchemy": "2.20.0",
23
+ "@getpara/aa-biconomy": "2.20.0",
24
+ "@getpara/aa-cdp": "2.20.0",
25
+ "@getpara/aa-gelato": "2.20.0",
26
+ "@getpara/aa-pimlico": "2.20.0",
27
+ "@getpara/aa-porto": "2.20.0",
28
+ "@getpara/aa-rhinestone": "2.20.0",
29
+ "@getpara/aa-safe": "2.20.0",
30
+ "@getpara/aa-thirdweb": "2.20.0",
31
+ "@getpara/aa-zerodev": "2.20.0",
32
+ "@getpara/cosmos-wallet-connectors": "2.20.0",
33
+ "@getpara/evm-wallet-connectors": "2.20.0",
34
+ "@getpara/solana-wallet-connectors": "2.20.0",
34
35
  "@tanstack/react-query": "^5.74.0",
35
36
  "@testing-library/dom": "^10.4.0",
36
37
  "@testing-library/react": "^16.3.0",
@@ -50,7 +51,7 @@
50
51
  "package.json",
51
52
  "styles.css"
52
53
  ],
53
- "gitHead": "4481f6f4e108e682d14c74d4433696141c47fc58",
54
+ "gitHead": "a8443bcc4018864f5e582f238ade1bb3b4e121f4",
54
55
  "main": "dist/index.js",
55
56
  "peerDependencies": {
56
57
  "@getpara/aa-alchemy": ">=2.15.0",