@getpara/react-sdk-lite 2.0.0-alpha.71 → 2.0.0-alpha.73

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 (49) hide show
  1. package/dist/cli/cli.mjs +26 -1
  2. package/dist/modal/components/Account/Account.js +39 -2
  3. package/dist/modal/components/Account/AccountSend/AccountSendAsset.d.ts +1 -0
  4. package/dist/modal/components/Account/AccountSend/AccountSendAsset.js +94 -0
  5. package/dist/modal/components/Account/AccountSend/AccountSendForm.d.ts +1 -0
  6. package/dist/modal/components/Account/AccountSend/AccountSendForm.js +343 -0
  7. package/dist/modal/components/Account/AccountSend/AccountSendNetwork.d.ts +1 -0
  8. package/dist/modal/components/Account/AccountSend/AccountSendNetwork.js +53 -0
  9. package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.d.ts +1 -0
  10. package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.js +56 -0
  11. package/dist/modal/components/Account/AccountSend/AssetNetwork.d.ts +5 -0
  12. package/dist/modal/components/Account/AccountSend/AssetNetwork.js +36 -0
  13. package/dist/modal/components/Account/AccountSend/context.d.ts +38 -0
  14. package/dist/modal/components/Account/AccountSend/context.js +418 -0
  15. package/dist/modal/components/Account/AccountSend/index.d.ts +4 -0
  16. package/dist/modal/components/Account/AccountSend/index.js +67 -0
  17. package/dist/modal/components/AddFunds/AddFundsAsset.js +1 -2
  18. package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -2
  19. package/dist/modal/components/AddFunds/AddFundsSettings.js +12 -52
  20. package/dist/modal/components/AddFunds/common.d.ts +0 -14
  21. package/dist/modal/components/AddFunds/common.js +1 -8
  22. package/dist/modal/components/Body/Body.js +13 -13
  23. package/dist/modal/components/Header/hooks/useStepTitle.js +4 -1
  24. package/dist/modal/components/IFrameStep/IFrameStep.js +1 -1
  25. package/dist/modal/components/QuantityInput.d.ts +9 -0
  26. package/dist/modal/components/QuantityInput.js +91 -0
  27. package/dist/modal/components/SearchableButtonList.d.ts +34 -0
  28. package/dist/modal/components/SearchableButtonList.js +223 -0
  29. package/dist/modal/components/WalletSelectOld/WalletSelectOld.d.ts +7 -1
  30. package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +16 -7
  31. package/dist/modal/components/common.d.ts +4 -1
  32. package/dist/modal/components/common.js +14 -1
  33. package/dist/modal/hooks/index.d.ts +4 -0
  34. package/dist/modal/hooks/index.js +5 -0
  35. package/dist/modal/hooks/useDebounce.d.ts +4 -0
  36. package/dist/modal/hooks/useDebounce.js +16 -0
  37. package/dist/modal/stores/modal/actions.js +2 -1
  38. package/dist/modal/stores/modal/useModalStore.d.ts +3 -1
  39. package/dist/modal/stores/modal/useModalStore.js +2 -1
  40. package/dist/modal/utils/countryCodes.js +11 -1
  41. package/dist/modal/utils/steps.d.ts +8 -2
  42. package/dist/modal/utils/steps.js +13 -1
  43. package/dist/provider/hooks/queries/useAccount.js +53 -20
  44. package/dist/provider/hooks/queries/useProfileBalance.d.ts +4 -0
  45. package/dist/provider/hooks/queries/useProfileBalance.js +10 -5
  46. package/dist/provider/hooks/utils/useEventListeners.js +4 -1
  47. package/dist/provider/hooks/utils/useWalletState.d.ts +1 -0
  48. package/dist/provider/hooks/utils/useWalletState.js +2 -1
  49. package/package.json +8 -8
@@ -217,7 +217,7 @@ function GradientScroll({ height, gap, children }) {
217
217
  const onScroll = () => {
218
218
  if (ref.current) {
219
219
  const { scrollTop, scrollHeight, clientHeight } = ref.current;
220
- if (height && scrollHeight <= parseInt(height)) {
220
+ if (scrollHeight <= clientHeight) {
221
221
  setIsNotAtTop(false);
222
222
  setIsNotAtBottom(false);
223
223
  } else {
@@ -228,6 +228,15 @@ function GradientScroll({ height, gap, children }) {
228
228
  };
229
229
  useEffect(() => {
230
230
  onScroll();
231
+ const resizeObserver = new ResizeObserver(() => {
232
+ onScroll();
233
+ });
234
+ if (ref.current) {
235
+ resizeObserver.observe(ref.current);
236
+ }
237
+ return () => {
238
+ resizeObserver.disconnect();
239
+ };
231
240
  }, []);
232
241
  return /* @__PURE__ */ jsx(
233
242
  GradientScrollContainer,
@@ -267,8 +276,12 @@ const Avatar = safeStyled.div`
267
276
  justify-content: center;
268
277
  background-color: var(--cpsl-color-background-8);
269
278
  `;
279
+ export * from "./SearchableButtonList.js";
280
+ export * from "./QuantityInput.js";
281
+ import { AnimatedHeightWrapper } from "./Body/AnimatedHeightWrapper.js";
270
282
  export {
271
283
  AccountTypeIcon,
284
+ AnimatedHeightWrapper,
272
285
  AssetIcon,
273
286
  CenteredText,
274
287
  ErrorContainer,
@@ -0,0 +1,4 @@
1
+ export * from './useDebounce.js';
2
+ export * from './useFarcasterLogin.js';
3
+ export * from './useGoBack.js';
4
+ export * from './useTelegramLogin.js';
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ export * from "./useDebounce.js";
3
+ export * from "./useFarcasterLogin.js";
4
+ export * from "./useGoBack.js";
5
+ export * from "./useTelegramLogin.js";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Debounce a changing value by the specified delay.
3
+ */
4
+ export declare function useDebounce<T>(value: T, delay?: number): T;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ import { useEffect, useState } from "react";
4
+ function useDebounce(value, delay = 500) {
5
+ const [debouncedValue, setDebouncedValue] = useState(value);
6
+ useEffect(() => {
7
+ const timer = window.setTimeout(() => {
8
+ setDebouncedValue(value);
9
+ }, delay);
10
+ return () => window.clearTimeout(timer);
11
+ }, [value, delay]);
12
+ return debouncedValue;
13
+ }
14
+ export {
15
+ useDebounce
16
+ };
@@ -138,7 +138,8 @@ const getActions = (set, get) => ({
138
138
  setAuthStepRoute: (authStepRoute) => set({ authStepRoute }),
139
139
  setIsPasskeySupported: (isPasskeySupported) => set({ isPasskeySupported }),
140
140
  setAccountLinkOptions: (accountLinkOptions) => set({ accountLinkOptions }),
141
- setProfileWallet: (profileWallet) => set({ profileWallet })
141
+ setProfileWallet: (profileWallet) => set({ profileWallet }),
142
+ setSendTx: (sendTx) => set({ sendTx })
142
143
  });
143
144
  export {
144
145
  getActions
@@ -1,6 +1,6 @@
1
1
  import { AvailableWallet } from '@getpara/core-sdk';
2
2
  import { ModalStep } from '../../utils/steps.js';
3
- import { AuthStateLogin, AuthStateSignup, AuthState, AuthStateVerify, OnRampConfig as OnRampConfigBase, OnRampPurchase, TWalletType, Setup2faResponse, SupportedAccountLinks } from '@getpara/web-sdk';
3
+ import { AuthStateLogin, AuthStateSignup, AuthState, AuthStateVerify, OnRampConfig as OnRampConfigBase, OnRampPurchase, TWalletType, Setup2faResponse, SupportedAccountLinks, BroadcastTransactionResult } from '@getpara/web-sdk';
4
4
  import { Tab as AddFundsTabType } from '../../components/AddFunds/AddFundsContext.js';
5
5
  import { TAuthLayout } from '../../types/modalProps.js';
6
6
  import { MutableRefObject } from 'react';
@@ -61,6 +61,7 @@ interface ModalState {
61
61
  isPasskeySupported: boolean;
62
62
  accountLinkOptions: SupportedAccountLinks;
63
63
  profileWallet?: AvailableWallet;
64
+ sendTx?: BroadcastTransactionResult;
64
65
  }
65
66
  export interface ModalActions {
66
67
  resetState: () => void;
@@ -100,6 +101,7 @@ export interface ModalActions {
100
101
  setIsPasskeySupported: (_: boolean) => void;
101
102
  setAccountLinkOptions: (_: SupportedAccountLinks) => void;
102
103
  setProfileWallet: (_?: AvailableWallet) => void;
104
+ setSendTx: (_?: BroadcastTransactionResult) => void;
103
105
  }
104
106
  export type ModalStore = ModalState & ModalActions;
105
107
  export declare const DEFAULT_MODAL_STATE: Omit<ModalState, 'step' | 'onRampConfig'>;
@@ -49,7 +49,8 @@ const DEFAULT_MODAL_STATE = {
49
49
  },
50
50
  isPasskeySupported: true,
51
51
  accountLinkOptions: [...LINKED_ACCOUNT_TYPES],
52
- profileWallet: void 0
52
+ profileWallet: void 0,
53
+ sendTx: void 0
53
54
  };
54
55
  const useModalStore = create()(
55
56
  persist(
@@ -6,6 +6,7 @@ const excludedCountries = [
6
6
  "AF",
7
7
  "AO",
8
8
  "AZ",
9
+ "BI",
9
10
  "BD",
10
11
  "BO",
11
12
  "CG",
@@ -13,6 +14,7 @@ const excludedCountries = [
13
14
  "CV",
14
15
  "DZ",
15
16
  "ER",
17
+ "EG",
16
18
  "ET",
17
19
  "GE",
18
20
  "GF",
@@ -25,8 +27,11 @@ const excludedCountries = [
25
27
  "JO",
26
28
  "KG",
27
29
  "KH",
30
+ "KM",
31
+ "KW",
28
32
  "KZ",
29
33
  "LA",
34
+ "LB",
30
35
  "LK",
31
36
  "LS",
32
37
  "LY",
@@ -34,6 +39,8 @@ const excludedCountries = [
34
39
  "MF",
35
40
  "MG",
36
41
  "MM",
42
+ "MR",
43
+ "MZ",
37
44
  "NC",
38
45
  "NG",
39
46
  "NP",
@@ -47,6 +54,7 @@ const excludedCountries = [
47
54
  "SD",
48
55
  "SH",
49
56
  "SJ",
57
+ "SS",
50
58
  "TA",
51
59
  "TJ",
52
60
  "TM",
@@ -58,7 +66,9 @@ const excludedCountries = [
58
66
  "WF",
59
67
  "XK",
60
68
  "YE",
61
- "YT"
69
+ "YT",
70
+ "ZM",
71
+ "ZW"
62
72
  ];
63
73
  const generateCountryCodes = () => {
64
74
  const countries = getCountries();
@@ -47,7 +47,10 @@ export declare enum ModalStep {
47
47
  ADD_EX_WALLET_MORE = "ADD_EX_WALLET_MORE",
48
48
  ADD_EX_WALLET_SELECTED = "ADD_EX_WALLET_SELECTED",
49
49
  ADD_EX_WALLET_NETWORK_SELECT = "ADD_EX_WALLET_NETWORK_SELECT",
50
- LINK_EX_WALLET_NETWORK_SELECT = "LINK_EX_WALLET_NETWORK_SELECT"
50
+ LINK_EX_WALLET_NETWORK_SELECT = "LINK_EX_WALLET_NETWORK_SELECT",
51
+ ACCOUNT_SEND = "ACCOUNT_SEND",
52
+ ACCOUNT_SEND_ASSET = "ACCOUNT_SEND_ASSET",
53
+ ACCOUNT_SEND_NETWORK = "ACCOUNT_SEND_NETWORK"
51
54
  }
52
55
  export type ModalStepPropU = keyof typeof ModalStep | ModalStep;
53
56
  export type ModalStepPropL = Lowercase<ModalStepPropU>;
@@ -73,7 +76,10 @@ declare enum AccountStep {
73
76
  ADD_EX_WALLET_MORE = "ADD_EX_WALLET_MORE",
74
77
  ADD_EX_WALLET_SELECTED = "ADD_EX_WALLET_SELECTED",
75
78
  ADD_EX_WALLET_NETWORK_SELECT = "ADD_EX_WALLET_NETWORK_SELECT",
76
- LINK_EX_WALLET_NETWORK_SELECT = "LINK_EX_WALLET_NETWORK_SELECT"
79
+ LINK_EX_WALLET_NETWORK_SELECT = "LINK_EX_WALLET_NETWORK_SELECT",
80
+ ACCOUNT_SEND = "ACCOUNT_SEND",
81
+ ACCOUNT_SEND_ASSET = "ACCOUNT_SEND_ASSET",
82
+ ACCOUNT_SEND_NETWORK = "ACCOUNT_SEND_NETWORK"
77
83
  }
78
84
  export declare const RESET_TO_AUTH_STEPS: ModalStep[];
79
85
  export declare const RESET_TO_ACCOUNT_STEPS: ModalStep[];
@@ -49,6 +49,9 @@ var ModalStep = /* @__PURE__ */ ((ModalStep2) => {
49
49
  ModalStep2["ADD_EX_WALLET_SELECTED"] = "ADD_EX_WALLET_SELECTED";
50
50
  ModalStep2["ADD_EX_WALLET_NETWORK_SELECT"] = "ADD_EX_WALLET_NETWORK_SELECT";
51
51
  ModalStep2["LINK_EX_WALLET_NETWORK_SELECT"] = "LINK_EX_WALLET_NETWORK_SELECT";
52
+ ModalStep2["ACCOUNT_SEND"] = "ACCOUNT_SEND";
53
+ ModalStep2["ACCOUNT_SEND_ASSET"] = "ACCOUNT_SEND_ASSET";
54
+ ModalStep2["ACCOUNT_SEND_NETWORK"] = "ACCOUNT_SEND_NETWORK";
52
55
  return ModalStep2;
53
56
  })(ModalStep || {});
54
57
  var AccountStep = /* @__PURE__ */ ((AccountStep2) => {
@@ -73,6 +76,9 @@ var AccountStep = /* @__PURE__ */ ((AccountStep2) => {
73
76
  AccountStep2["ADD_EX_WALLET_SELECTED"] = "ADD_EX_WALLET_SELECTED";
74
77
  AccountStep2["ADD_EX_WALLET_NETWORK_SELECT"] = "ADD_EX_WALLET_NETWORK_SELECT";
75
78
  AccountStep2["LINK_EX_WALLET_NETWORK_SELECT"] = "LINK_EX_WALLET_NETWORK_SELECT";
79
+ AccountStep2["ACCOUNT_SEND"] = "ACCOUNT_SEND";
80
+ AccountStep2["ACCOUNT_SEND_ASSET"] = "ACCOUNT_SEND_ASSET";
81
+ AccountStep2["ACCOUNT_SEND_NETWORK"] = "ACCOUNT_SEND_NETWORK";
76
82
  return AccountStep2;
77
83
  })(AccountStep || {});
78
84
  const RESET_TO_AUTH_STEPS = [
@@ -113,6 +119,9 @@ const RESET_TO_ACCOUNT_STEPS = [
113
119
  "ACCOUNT_PROFILE_ADD" /* ACCOUNT_PROFILE_ADD */,
114
120
  "ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */,
115
121
  "ACCOUNT_PROFILE_REMOVE" /* ACCOUNT_PROFILE_REMOVE */,
122
+ "ACCOUNT_SEND" /* ACCOUNT_SEND */,
123
+ "ACCOUNT_SEND_ASSET" /* ACCOUNT_SEND_ASSET */,
124
+ "ACCOUNT_SEND_NETWORK" /* ACCOUNT_SEND_NETWORK */,
116
125
  "ACCOUNT_WALLET" /* ACCOUNT_WALLET */,
117
126
  "SWITCH_WALLETS" /* SWITCH_WALLETS */,
118
127
  "SWITCH_WALLETS_IFRAME" /* SWITCH_WALLETS_IFRAME */,
@@ -143,7 +152,10 @@ const AccountPreviousStep = {
143
152
  ["ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
144
153
  ["ADD_EX_WALLET_SELECTED" /* ADD_EX_WALLET_SELECTED */]: "ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */,
145
154
  ["ADD_EX_WALLET_NETWORK_SELECT" /* ADD_EX_WALLET_NETWORK_SELECT */]: "ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */,
146
- ["LINK_EX_WALLET_NETWORK_SELECT" /* LINK_EX_WALLET_NETWORK_SELECT */]: "ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */
155
+ ["LINK_EX_WALLET_NETWORK_SELECT" /* LINK_EX_WALLET_NETWORK_SELECT */]: "ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */,
156
+ ["ACCOUNT_SEND" /* ACCOUNT_SEND */]: "ACCOUNT_MAIN" /* ACCOUNT_MAIN */,
157
+ ["ACCOUNT_SEND_ASSET" /* ACCOUNT_SEND_ASSET */]: "ACCOUNT_SEND" /* ACCOUNT_SEND */,
158
+ ["ACCOUNT_SEND_NETWORK" /* ACCOUNT_SEND_NETWORK */]: "ACCOUNT_SEND_ASSET" /* ACCOUNT_SEND_ASSET */
147
159
  };
148
160
  var SignUpModalStep = /* @__PURE__ */ ((SignUpModalStep2) => {
149
161
  SignUpModalStep2["AUTH_MAIN"] = "AUTH_MAIN";
@@ -5,11 +5,11 @@ import {
5
5
  __spreadProps,
6
6
  __spreadValues
7
7
  } from "../../../chunk-MMUBH76A.js";
8
- import { useQuery } from "@tanstack/react-query";
8
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
9
9
  import { useInternalClient } from "../utils/useInternalClient.js";
10
10
  import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
11
11
  import { useStore } from "../../stores/useStore.js";
12
- import { useContext } from "react";
12
+ import { useContext, useEffect, useMemo } from "react";
13
13
  import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
14
14
  const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
15
15
  function pickSolanaAdapter(adapter) {
@@ -31,38 +31,69 @@ function pickCosmosAccount(account) {
31
31
  const _a = account, { reconnect: _ } = _a, rest = __objRest(_a, ["reconnect"]);
32
32
  return rest;
33
33
  }
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
+ };
34
59
  const useAccount = ({ cosmos } = {}) => {
35
- var _a, _b, _c, _d, _e, _f, _g, _h;
60
+ var _a, _b, _c, _d, _e, _f;
36
61
  const client = useInternalClient();
37
62
  const { data: isFullyLoggedIn, isSuccess, isLoading: isFullyLoggedInLoading } = useIsFullyLoggedIn();
38
63
  const evmContext = useStore((state) => state.evmContext);
39
64
  const { useAccount: useEvmAccount } = useContext(evmContext);
40
65
  const evmAccount = useEvmAccount();
41
- const evmQueryKeys = [evmAccount == null ? void 0 : evmAccount.status, evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId];
66
+ const evmQueryKeys = [evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId];
42
67
  const cosmosContext = useStore((state) => state.cosmosContext);
43
68
  const { useAccount: useCosmosAccount } = useContext(cosmosContext);
44
69
  const cosmosAccount = useCosmosAccount(cosmos);
45
- const cosmosQueryKeys = [cosmosAccount == null ? void 0 : cosmosAccount.status, cosmosAccount == null ? void 0 : cosmosAccount.data];
70
+ const cosmosQueryKeys = [cosmosAccount == null ? void 0 : cosmosAccount.data];
46
71
  const solanaContext = useStore((state) => state.solanaContext);
47
72
  const { useWallet: useSolanaWallet } = useContext(solanaContext);
48
73
  const solanaWallet = useSolanaWallet();
49
- const solanaQueryKeys = [
50
- (_b = (_a = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _a.adapter) == null ? void 0 : _b.connected,
51
- (_d = (_c = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _c.adapter) == null ? void 0 : _d.connecting,
52
- (_f = (_e = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _e.adapter) == null ? void 0 : _f.publicKey
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
53
84
  ];
54
- const solanaAdapter = (_g = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _g.adapter;
85
+ const connectionStates = useMemo(() => {
86
+ var _a2, _b2;
87
+ return {
88
+ evm: !!(evmAccount == null ? void 0 : evmAccount.isConnected),
89
+ 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);
55
94
  const { data, isLoading } = useQuery({
56
95
  enabled: isSuccess && !!client,
57
- queryKey: [
58
- ACCOUNT_BASE_KEY,
59
- isFullyLoggedIn != null ? isFullyLoggedIn : null,
60
- isFullyLoggedInLoading,
61
- (_h = client == null ? void 0 : client.userId) != null ? _h : null,
62
- evmQueryKeys,
63
- cosmosQueryKeys,
64
- solanaQueryKeys
65
- ],
96
+ queryKey,
66
97
  queryFn: () => __async(void 0, null, function* () {
67
98
  const paraAccount = yield getEmbeddedAccount(client, isFullyLoggedIn);
68
99
  let connectionType = "none";
@@ -135,7 +166,9 @@ const useAccount = ({ cosmos } = {}) => {
135
166
  solana: { isConnected: false }
136
167
  }
137
168
  };
138
- return __spreadProps(__spreadValues({}, data != null ? data : defaultResp), { isLoading: isFullyLoggedInLoading || isLoading });
169
+ return __spreadProps(__spreadValues({}, data != null ? data : defaultResp), {
170
+ isLoading: isFullyLoggedInLoading || isLoading
171
+ });
139
172
  };
140
173
  export {
141
174
  ACCOUNT_BASE_KEY,
@@ -12,6 +12,10 @@ type UseProfileBalanceOptions = {
12
12
  * When not provided, internal SDK events (like asset transfers) will still trigger refetches via React Query invalidation.
13
13
  */
14
14
  refetchTrigger?: number | string;
15
+ /**
16
+ * Whether to return the comprehensive balance set. If `false` or `undefined`, the results will be filtered and modified based on your `ParaProvider`'s balances configuration.
17
+ */
18
+ isComprehensive?: boolean;
15
19
  };
16
20
  /**
17
21
  * React Query hook for retrieving the asset balance for your currently connected wallets.
@@ -7,8 +7,9 @@ import { useRef, useEffect } from "react";
7
7
  import { useStore } from "../../stores/useStore.js";
8
8
  import { useInternalClient } from "../utils/useInternalClient.js";
9
9
  import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
10
+ import { filterProfileBalance } from "@getpara/shared";
10
11
  const useProfileBalance = (options) => {
11
- var _a, _b;
12
+ var _a, _b, _c;
12
13
  const client = useInternalClient();
13
14
  const { data: isFullyLoggedIn, isSuccess } = useIsFullyLoggedIn();
14
15
  const config = useStore((state) => {
@@ -16,9 +17,11 @@ const useProfileBalance = (options) => {
16
17
  return (_a2 = state.modalConfig) == null ? void 0 : _a2.balances;
17
18
  });
18
19
  const refs = useStore((state) => state.refs);
20
+ const isComprehensive = (_a = options == null ? void 0 : options.isComprehensive) != null ? _a : false;
19
21
  const previousTriggerRef = useRef(options == null ? void 0 : options.refetchTrigger);
20
22
  const shouldRefetchRef = useRef(false);
21
23
  const lastQueryTimeRef = useRef(0);
24
+ const isInitialLoadRef = useRef(true);
22
25
  useEffect(() => {
23
26
  if ((options == null ? void 0 : options.refetchTrigger) !== previousTriggerRef.current) {
24
27
  shouldRefetchRef.current = true;
@@ -30,8 +33,8 @@ const useProfileBalance = (options) => {
30
33
  queryKey: [
31
34
  "useProfileBalance",
32
35
  isFullyLoggedIn != null ? isFullyLoggedIn : null,
33
- (_a = client == null ? void 0 : client.userId) != null ? _a : null,
34
- (_b = client == null ? void 0 : client.availableWallets.map(({ address }) => address)) != null ? _b : null,
36
+ (_b = client == null ? void 0 : client.userId) != null ? _b : null,
37
+ (_c = client == null ? void 0 : client.availableWallets.map(({ address }) => address)) != null ? _c : null,
35
38
  config != null ? config : null
36
39
  // Note: refetchTrigger is NOT in query key to allow cache sharing
37
40
  ],
@@ -43,13 +46,15 @@ const useProfileBalance = (options) => {
43
46
  return null;
44
47
  }
45
48
  const isInvalidationRefetch = ((_a2 = refs.balancesInvalidationTime.current) != null ? _a2 : 0) > lastQueryTimeRef.current;
49
+ const isInitialLoad = isInitialLoadRef.current;
46
50
  const profileBalance = yield client == null ? void 0 : client.getProfileBalance({
47
51
  config,
48
- refetch: shouldRefetchRef.current || isInvalidationRefetch
52
+ refetch: shouldRefetchRef.current || isInvalidationRefetch || isInitialLoad
49
53
  });
50
54
  lastQueryTimeRef.current = Date.now();
51
55
  shouldRefetchRef.current = false;
52
- return profileBalance;
56
+ isInitialLoadRef.current = false;
57
+ return isComprehensive ? profileBalance : filterProfileBalance(profileBalance, config || { displayType: "AGGREGATED" });
53
58
  }),
54
59
  // We handle refetch manually
55
60
  refetchOnWindowFocus: false
@@ -11,6 +11,7 @@ import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
11
11
  import { WALLET_BASE_KEY } from "../queries/useWallet.js";
12
12
  import { WALLET_BALANCE_BASE_KEY } from "../queries/useWalletBalance.js";
13
13
  import { IS_FULLY_LOGGED_IN_BASE_KEY } from "../queries/useIsFullyLoggedIn.js";
14
+ import { useModalStore } from "../../../modal/stores/index.js";
14
15
  const useEventListeners = ({
15
16
  onLogin,
16
17
  onLogout,
@@ -28,6 +29,7 @@ const useEventListeners = ({
28
29
  const refs = useStore((state) => state.refs);
29
30
  const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
30
31
  const { updateSelectedWallet } = useWalletState();
32
+ const setSendTx = useModalStore((state) => state.setSendTx);
31
33
  const loginOrSetupListener = useCallback(() => {
32
34
  queryClient.refetchQueries({ queryKey: [IS_FULLY_LOGGED_IN_BASE_KEY] });
33
35
  queryClient.refetchQueries({ queryKey: [ACCOUNT_BASE_KEY] });
@@ -61,9 +63,10 @@ const useEventListeners = ({
61
63
  queryClient.invalidateQueries({ queryKey: [IS_FULLY_LOGGED_IN_BASE_KEY] });
62
64
  queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY] });
63
65
  clearSelectedWallet();
66
+ setSendTx(void 0);
64
67
  onLogout == null ? void 0 : onLogout(event);
65
68
  },
66
- [queryClient, clearSelectedWallet, onLogout]
69
+ [queryClient, clearSelectedWallet, setSendTx, onLogout]
67
70
  );
68
71
  const signMessageListener = useCallback(
69
72
  (event) => {
@@ -6,6 +6,7 @@ export declare const useWalletState: () => {
6
6
  selectedWallet: {
7
7
  id: string | undefined;
8
8
  type: "SOLANA" | "COSMOS" | "EVM" | undefined;
9
+ address: string | undefined;
9
10
  };
10
11
  setSelectedWallet: ({ id, type }: {
11
12
  id?: string;
@@ -37,7 +37,8 @@ const useWalletState = () => {
37
37
  return {
38
38
  selectedWallet: {
39
39
  id: selectedWalletId,
40
- type: selectedWalletType
40
+ type: selectedWalletType,
41
+ address: selectedWalletId ? client == null ? void 0 : client.getDisplayAddress(selectedWalletId, { addressType: selectedWalletType }) : void 0
41
42
  },
42
43
  setSelectedWallet,
43
44
  updateSelectedWallet
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0-alpha.71",
3
+ "version": "2.0.0-alpha.73",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.71",
9
- "@getpara/react-components": "2.0.0-alpha.71",
10
- "@getpara/web-sdk": "2.0.0-alpha.71",
8
+ "@getpara/react-common": "2.0.0-alpha.73",
9
+ "@getpara/react-components": "2.0.0-alpha.73",
10
+ "@getpara/web-sdk": "2.0.0-alpha.73",
11
11
  "date-fns": "^3.6.0",
12
12
  "framer-motion": "^11.3.31",
13
13
  "libphonenumber-js": "^1.11.7",
@@ -16,9 +16,9 @@
16
16
  "zustand-sync-tabs": "^0.2.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.71",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.71",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.71",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.73",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.73",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.73",
22
22
  "@tanstack/react-query": "^5.74.0",
23
23
  "@testing-library/dom": "^10.4.0",
24
24
  "@testing-library/react": "^16.3.0",
@@ -38,7 +38,7 @@
38
38
  "package.json",
39
39
  "styles.css"
40
40
  ],
41
- "gitHead": "30e5bad6a141f1b56959432f11aaf1536b84dece",
41
+ "gitHead": "52a9fc31810d56e792e23f68b73e1d4efbf6b96b",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",