@symmio/trading-react 4.0.0 → 4.2.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 (89) hide show
  1. package/dist/funding/index.d.ts +3 -0
  2. package/dist/funding/index.d.ts.map +1 -0
  3. package/dist/funding/use-funding-index-checkpoints.d.ts +29 -0
  4. package/dist/funding/use-funding-index-checkpoints.d.ts.map +1 -0
  5. package/dist/funding/use-funding-index-checkpoints.js +27 -0
  6. package/dist/funding/use-funding-index-checkpoints.js.map +1 -0
  7. package/dist/funding/use-quote-funding-settlements.d.ts +28 -0
  8. package/dist/funding/use-quote-funding-settlements.d.ts.map +1 -0
  9. package/dist/funding/use-quote-funding-settlements.js +27 -0
  10. package/dist/funding/use-quote-funding-settlements.js.map +1 -0
  11. package/dist/index.d.ts +26 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +154 -140
  14. package/dist/liquidation/index.d.ts +2 -0
  15. package/dist/liquidation/index.d.ts.map +1 -0
  16. package/dist/liquidation/use-liquidation-details.d.ts +28 -0
  17. package/dist/liquidation/use-liquidation-details.d.ts.map +1 -0
  18. package/dist/liquidation/use-liquidation-details.js +27 -0
  19. package/dist/liquidation/use-liquidation-details.js.map +1 -0
  20. package/dist/margin/index.d.ts +1 -0
  21. package/dist/margin/index.d.ts.map +1 -1
  22. package/dist/margin/use-margin-transfers.d.ts +32 -0
  23. package/dist/margin/use-margin-transfers.d.ts.map +1 -0
  24. package/dist/margin/use-margin-transfers.js +27 -0
  25. package/dist/margin/use-margin-transfers.js.map +1 -0
  26. package/dist/pools/index.d.ts +7 -0
  27. package/dist/pools/index.d.ts.map +1 -1
  28. package/dist/pools/index.js +25 -18
  29. package/dist/pools/use-authenticate-listing.d.ts +17 -4
  30. package/dist/pools/use-authenticate-listing.d.ts.map +1 -1
  31. package/dist/pools/use-authenticate-listing.js +87 -20
  32. package/dist/pools/use-authenticate-listing.js.map +1 -1
  33. package/dist/pools/use-listing-config.d.ts +1 -0
  34. package/dist/pools/use-listing-config.d.ts.map +1 -1
  35. package/dist/pools/use-listing-config.js.map +1 -1
  36. package/dist/pools/use-listing-token-metadata.d.ts +6 -0
  37. package/dist/pools/use-listing-token-metadata.d.ts.map +1 -0
  38. package/dist/pools/use-listing-token-metadata.js +27 -0
  39. package/dist/pools/use-listing-token-metadata.js.map +1 -0
  40. package/dist/pools/use-listing-token-support.d.ts +6 -0
  41. package/dist/pools/use-listing-token-support.d.ts.map +1 -0
  42. package/dist/pools/use-listing-token-support.js +27 -0
  43. package/dist/pools/use-listing-token-support.js.map +1 -0
  44. package/dist/pools/use-pool-maintenance-fees.d.ts +6 -0
  45. package/dist/pools/use-pool-maintenance-fees.d.ts.map +1 -0
  46. package/dist/pools/use-pool-maintenance-fees.js +27 -0
  47. package/dist/pools/use-pool-maintenance-fees.js.map +1 -0
  48. package/dist/pools/use-pool-open-positions.d.ts +34 -0
  49. package/dist/pools/use-pool-open-positions.d.ts.map +1 -0
  50. package/dist/pools/use-pool-open-positions.js +59 -0
  51. package/dist/pools/use-pool-open-positions.js.map +1 -0
  52. package/dist/pools/use-pool-pages.d.ts +25 -0
  53. package/dist/pools/use-pool-pages.d.ts.map +1 -0
  54. package/dist/pools/use-pool-pages.js +63 -0
  55. package/dist/pools/use-pool-pages.js.map +1 -0
  56. package/dist/pools/use-pool-portfolio.d.ts +20 -0
  57. package/dist/pools/use-pool-portfolio.d.ts.map +1 -0
  58. package/dist/pools/use-pool-portfolio.js +154 -0
  59. package/dist/pools/use-pool-portfolio.js.map +1 -0
  60. package/dist/pools/use-pool-position.d.ts +20 -0
  61. package/dist/pools/use-pool-position.d.ts.map +1 -0
  62. package/dist/pools/use-pool-position.js +79 -0
  63. package/dist/pools/use-pool-position.js.map +1 -0
  64. package/dist/pools/use-pool-read-queue.d.ts +5 -0
  65. package/dist/pools/use-pool-read-queue.d.ts.map +1 -0
  66. package/dist/pools/use-pool-read-queue.js +27 -0
  67. package/dist/pools/use-pool-read-queue.js.map +1 -0
  68. package/dist/pools/use-pool-statistics.d.ts +50 -0
  69. package/dist/pools/use-pool-statistics.d.ts.map +1 -0
  70. package/dist/pools/use-pool-statistics.js +114 -0
  71. package/dist/pools/use-pool-statistics.js.map +1 -0
  72. package/dist/quotes/index.d.ts +3 -0
  73. package/dist/quotes/index.d.ts.map +1 -1
  74. package/dist/quotes/use-is-party-a-liquidated.d.ts +24 -0
  75. package/dist/quotes/use-is-party-a-liquidated.d.ts.map +1 -0
  76. package/dist/quotes/use-is-party-a-liquidated.js +27 -0
  77. package/dist/quotes/use-is-party-a-liquidated.js.map +1 -0
  78. package/dist/quotes/use-party-a-open-positions-batch.d.ts +30 -0
  79. package/dist/quotes/use-party-a-open-positions-batch.d.ts.map +1 -0
  80. package/dist/quotes/use-party-a-open-positions-batch.js +27 -0
  81. package/dist/quotes/use-party-a-open-positions-batch.js.map +1 -0
  82. package/dist/quotes/use-quote-events-by-type.d.ts +9 -4
  83. package/dist/quotes/use-quote-events-by-type.d.ts.map +1 -1
  84. package/dist/quotes/use-quote-events-by-type.js.map +1 -1
  85. package/dist/quotes/use-subgraph-quotes.d.ts +28 -0
  86. package/dist/quotes/use-subgraph-quotes.d.ts.map +1 -0
  87. package/dist/quotes/use-subgraph-quotes.js +27 -0
  88. package/dist/quotes/use-subgraph-quotes.js.map +1 -0
  89. package/package.json +2 -2
@@ -11,21 +11,28 @@ import { useUserProfit as l } from "./use-user-profit.js";
11
11
  import { useListingMarketConfigProjection as u } from "./use-listing-market-config-projection.js";
12
12
  import { useListingMarkets as d } from "./use-listing-markets.js";
13
13
  import { useListingStatus as f } from "./use-listing-status.js";
14
- import { usePoolQuotes as p } from "./use-pool-quotes.js";
15
- import { usePoolRewardChart as m } from "./use-pool-reward-chart.js";
16
- import { usePoolTotalReward as h } from "./use-pool-total-reward.js";
17
- import { usePoolTradeHistory as g } from "./use-pool-trade-history.js";
18
- import { usePoolTransactions as _ } from "./use-pool-transactions.js";
19
- import { useRefundMarket as v } from "./use-refund-market.js";
20
- import { useRetryListing as y } from "./use-retry-listing.js";
21
- import { useRetryListingInfo as b } from "./use-retry-listing-info.js";
22
- import { useSupportsListingService as x } from "./use-supports-listing-service.js";
23
- import { useTokenPrice as S } from "./use-token-price.js";
24
- import { useUpdateListingMarketConfig as C } from "./use-update-listing-market-config.js";
25
- import { useUserListingMarkets as w } from "./use-user-listing-markets.js";
26
- import { useUserRewardChart as T } from "./use-user-reward-chart.js";
27
- import { useUserTotalReward as E } from "./use-user-total-reward.js";
28
- import { useUserTransactions as D } from "./use-user-transactions.js";
29
- import { useWeeklyListingLimit as O } from "./use-weekly-listing-limit.js";
30
- import { useWithdrawLp as k } from "./use-withdraw-lp.js";
31
- export { e as useAddMarket, t as useAuthenticateListing, n as useCancelWithdraw, r as useClaimHistory, i as useClaimProfit, a as useDepositAddress, o as useListingConfig, s as useListingMarketConfig, u as useListingMarketConfigProjection, c as useListingMarketDetail, d as useListingMarkets, f as useListingStatus, p as usePoolQuotes, m as usePoolRewardChart, h as usePoolTotalReward, g as usePoolTradeHistory, _ as usePoolTransactions, v as useRefundMarket, y as useRetryListing, b as useRetryListingInfo, x as useSupportsListingService, S as useTokenPrice, C as useUpdateListingMarketConfig, w as useUserListingMarkets, l as useUserProfit, T as useUserRewardChart, E as useUserTotalReward, D as useUserTransactions, O as useWeeklyListingLimit, k as useWithdrawLp };
14
+ import { useListingTokenMetadata as p } from "./use-listing-token-metadata.js";
15
+ import { useListingTokenSupport as m } from "./use-listing-token-support.js";
16
+ import { usePoolMaintenanceFees as h } from "./use-pool-maintenance-fees.js";
17
+ import { usePoolOpenPositions as g } from "./use-pool-open-positions.js";
18
+ import { useUserTotalReward as _ } from "./use-user-total-reward.js";
19
+ import { usePoolPortfolio as v } from "./use-pool-portfolio.js";
20
+ import { usePoolPosition as y } from "./use-pool-position.js";
21
+ import { usePoolQuotes as b } from "./use-pool-quotes.js";
22
+ import { usePoolRewardChart as x } from "./use-pool-reward-chart.js";
23
+ import { usePoolStatistics as S } from "./use-pool-statistics.js";
24
+ import { usePoolTotalReward as C } from "./use-pool-total-reward.js";
25
+ import { usePoolTradeHistory as w } from "./use-pool-trade-history.js";
26
+ import { usePoolTransactions as T } from "./use-pool-transactions.js";
27
+ import { useRefundMarket as E } from "./use-refund-market.js";
28
+ import { useRetryListing as D } from "./use-retry-listing.js";
29
+ import { useRetryListingInfo as O } from "./use-retry-listing-info.js";
30
+ import { useSupportsListingService as k } from "./use-supports-listing-service.js";
31
+ import { useTokenPrice as A } from "./use-token-price.js";
32
+ import { useUpdateListingMarketConfig as j } from "./use-update-listing-market-config.js";
33
+ import { useUserListingMarkets as M } from "./use-user-listing-markets.js";
34
+ import { useUserRewardChart as N } from "./use-user-reward-chart.js";
35
+ import { useUserTransactions as P } from "./use-user-transactions.js";
36
+ import { useWeeklyListingLimit as F } from "./use-weekly-listing-limit.js";
37
+ import { useWithdrawLp as I } from "./use-withdraw-lp.js";
38
+ export { e as useAddMarket, t as useAuthenticateListing, n as useCancelWithdraw, r as useClaimHistory, i as useClaimProfit, a as useDepositAddress, o as useListingConfig, s as useListingMarketConfig, u as useListingMarketConfigProjection, c as useListingMarketDetail, d as useListingMarkets, f as useListingStatus, p as useListingTokenMetadata, m as useListingTokenSupport, h as usePoolMaintenanceFees, g as usePoolOpenPositions, v as usePoolPortfolio, y as usePoolPosition, b as usePoolQuotes, x as usePoolRewardChart, S as usePoolStatistics, C as usePoolTotalReward, w as usePoolTradeHistory, T as usePoolTransactions, E as useRefundMarket, D as useRetryListing, O as useRetryListingInfo, k as useSupportsListingService, A as useTokenPrice, j as useUpdateListingMarketConfig, M as useUserListingMarkets, l as useUserProfit, N as useUserRewardChart, _ as useUserTotalReward, P as useUserTransactions, F as useWeeklyListingLimit, I as useWithdrawLp };
@@ -1,8 +1,19 @@
1
- import { AuthenticateListingParameters, ConfigParameter, ListingAuthToken } from '@symmio/trading-core';
1
+ import { AuthenticateListingParameters, ConfigParameter, ListingAuthToken, ListingSignInMessage } from '@symmio/trading-core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
+ import { Address } from 'viem';
3
4
  import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
- /** Parameters for {@link useAuthenticateListing}: just an optional `config`. */
5
- export type UseAuthenticateListingParameters = ConfigParameter;
5
+ /** Parameters for {@link useAuthenticateListing}: optional prefetch controls and `config`. */
6
+ export type UseAuthenticateListingParameters = ConfigParameter & {
7
+ /** Fetch a single-use challenge after a wallet connects. Defaults to false. */
8
+ prefetchChallenge?: boolean;
9
+ /** Explicit deployment, independent of the wallet chain. */
10
+ chainId?: number;
11
+ /** Explicit signing account for an injected or embedded signer. */
12
+ from?: Address;
13
+ domain?: string;
14
+ uri?: string;
15
+ statement?: string;
16
+ };
6
17
  /**
7
18
  * Variables for the {@link useAuthenticateListing} mutation.
8
19
  *
@@ -17,7 +28,9 @@ export type AuthenticateListingVariables = Omit<AuthenticateListingParameters, "
17
28
  uri?: string;
18
29
  };
19
30
  /** Return type of {@link useAuthenticateListing}: the issued bearer token or a normalized error. */
20
- export type UseAuthenticateListingReturnType = UseMutationResult<ListingAuthToken, SymmioRequestError, AuthenticateListingVariables>;
31
+ export type UseAuthenticateListingReturnType = UseMutationResult<ListingAuthToken, SymmioRequestError, AuthenticateListingVariables> & {
32
+ /** Current prefetched challenge, or undefined before it is available. */ challenge: ListingSignInMessage | undefined;
33
+ };
21
34
  /**
22
35
  * Sign in to the listing backend with SIWE (EIP-4361) in one call.
23
36
  *
@@ -1 +1 @@
1
- {"version":3,"file":"use-authenticate-listing.d.ts","sourceRoot":"","sources":["../../src/pools/use-authenticate-listing.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,gFAAgF;AAChF,MAAM,MAAM,gCAAgC,GAAG,eAAe,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC,6BAA6B,EAAE,QAAQ,GAAG,KAAK,CAAC,GAAG;IACjG,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oGAAoG;AACpG,MAAM,MAAM,gCAAgC,GAAG,iBAAiB,CAC9D,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,GAAE,gCAAqC,GAChD,gCAAgC,CAsBlC"}
1
+ {"version":3,"file":"use-authenticate-listing.d.ts","sourceRoot":"","sources":["../../src/pools/use-authenticate-listing.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAyC,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAEtG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,8FAA8F;AAC9F,MAAM,MAAM,gCAAgC,GAAG,eAAe,GAAG;IAC/D,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC,6BAA6B,EAAE,QAAQ,GAAG,KAAK,CAAC,GAAG;IACjG,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oGAAoG;AACpG,MAAM,MAAM,gCAAgC,GAAG,iBAAiB,CAC9D,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,CAC7B,GAAG;IACF,yEAAyE,CAAC,SAAS,EAAE,oBAAoB,GAAG,SAAS,CAAC;CACvH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,GAAE,gCAAqC,GAChD,gCAAgC,CA2FlC"}
@@ -2,29 +2,96 @@
2
2
  import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
3
  import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
4
  import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
- import { authenticateListingMutationOptions as r } from "@symmio/trading-core";
6
- import { useMutation as i } from "@tanstack/react-query";
5
+ import { authenticateListingMutationOptions as r, getListingSignInMessageQueryOptions as i } from "@symmio/trading-core";
6
+ import { useEffect as a, useRef as o, useState as s, useSyncExternalStore as c } from "react";
7
+ import { useConnection as l } from "wagmi";
8
+ import { useMutation as u, useQuery as d, useQueryClient as f } from "@tanstack/react-query";
7
9
  //#region src/pools/use-authenticate-listing.ts
8
- function a(a = {}) {
9
- let o = t(a), s = e(), c = r(o);
10
- return i({
11
- ...c,
12
- mutationFn: async (e) => {
13
- let t = e.domain ?? window.location.host, r = e.uri ?? window.location.origin;
14
- try {
15
- return await c.mutationFn({
16
- ...e,
17
- domain: t,
18
- uri: r,
19
- chainId: e.chainId ?? s
20
- });
21
- } catch (e) {
22
- throw n(e);
23
- }
10
+ function p(p = {}) {
11
+ let _ = t(p), v = e(), y = p.chainId ?? v, b = l(), x = p.from ?? b.address, S = f(), C = c(g, m, h), w = C == null ? void 0 : new URL(C), T = p.domain ?? w?.host, E = p.uri ?? w?.origin, D = !!p.prefetchChallenge && !!x && !!T && !!E, [O, k] = s(0), A = i(_, {
12
+ chainId: y,
13
+ address: x ?? "0x0000000000000000000000000000000000000000",
14
+ domain: T ?? "",
15
+ uri: E ?? "",
16
+ statement: p.statement,
17
+ query: {
18
+ enabled: D && O === 0,
19
+ retry: !1,
20
+ staleTime: Infinity,
21
+ gcTime: 0,
22
+ refetchOnWindowFocus: !1,
23
+ refetchOnReconnect: !1
24
24
  }
25
- });
25
+ }), { data: j, refetch: M } = d(A), N = JSON.stringify(A.queryKey), P = o(N);
26
+ P.current = N;
27
+ let F = j?.params.expirationTime;
28
+ a(() => {
29
+ if (!D || O > 0 || !F) return;
30
+ let e = Date.parse(F);
31
+ if (!Number.isFinite(e)) return;
32
+ let t = setTimeout(() => {
33
+ M();
34
+ }, Math.max(1e3, Math.min(2147483647, e - Date.now() - 1e3)));
35
+ return () => clearTimeout(t);
36
+ }, [
37
+ D,
38
+ O,
39
+ F,
40
+ M
41
+ ]);
42
+ let I = r(_);
43
+ return {
44
+ ...u({
45
+ ...I,
46
+ mutationFn: async (e) => {
47
+ let t = e.domain ?? p.domain ?? window.location.host, r = e.uri ?? p.uri ?? window.location.origin, i = e.statement ?? p.statement, a = D ? S.getQueryData(A.queryKey) : void 0;
48
+ if (D) {
49
+ k((e) => e + 1);
50
+ let e = S.cancelQueries({
51
+ queryKey: A.queryKey,
52
+ exact: !0
53
+ });
54
+ S.removeQueries({
55
+ queryKey: A.queryKey,
56
+ exact: !0
57
+ }), await e;
58
+ }
59
+ let o = a && a.params.domain === t && a.params.uri === r && (a.params.statement ?? "") === (i ?? "") && a.params.chainId === (e.chainId ?? y) && (!a.params.expirationTime || Date.parse(a.params.expirationTime) > Date.now()), s = e.signInMessage ?? (o ? a : void 0);
60
+ try {
61
+ return await I.mutationFn({
62
+ ...e,
63
+ domain: t,
64
+ uri: r,
65
+ ...i === void 0 ? {} : { statement: i },
66
+ ...p.from === void 0 ? {} : { from: e.from ?? p.from },
67
+ ...s === void 0 ? {} : { signInMessage: s },
68
+ chainId: e.chainId ?? y
69
+ });
70
+ } catch (e) {
71
+ throw n(e);
72
+ } finally {
73
+ D && (P.current === N && S.fetchQuery({
74
+ ...A,
75
+ staleTime: 0
76
+ }).catch(() => void 0), k((e) => e - 1));
77
+ }
78
+ }
79
+ }),
80
+ challenge: D ? j : void 0
81
+ };
82
+ }
83
+ function m() {
84
+ return window.location.href;
85
+ }
86
+ function h() {
87
+ return null;
88
+ }
89
+ function g(e) {
90
+ return window.addEventListener("popstate", e), window.addEventListener("hashchange", e), () => {
91
+ window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e);
92
+ };
26
93
  }
27
94
  //#endregion
28
- export { a as useAuthenticateListing };
95
+ export { p as useAuthenticateListing };
29
96
 
30
97
  //# sourceMappingURL=use-authenticate-listing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-authenticate-listing.js","names":[],"sources":["../../src/pools/use-authenticate-listing.ts"],"sourcesContent":["\"use client\";\n\nimport {\n authenticateListingMutationOptions,\n type AuthenticateListingParameters,\n type ConfigParameter,\n type ListingAuthToken,\n} from \"@symmio/trading-core\";\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useAuthenticateListing}: just an optional `config`. */\nexport type UseAuthenticateListingParameters = ConfigParameter;\n\n/**\n * Variables for the {@link useAuthenticateListing} mutation.\n *\n * `domain` and `uri` are optional here — omit them and the hook fills them from\n * the current `window.location` (`host` / `origin`). Pass them explicitly to\n * override (e.g. to bind the SIWE message to a canonical domain).\n */\nexport type AuthenticateListingVariables = Omit<AuthenticateListingParameters, \"domain\" | \"uri\"> & {\n /** RFC 4501 DNS authority requesting the sign-in. Defaults to `window.location.host`. */\n domain?: string;\n /** RFC 3986 URI of the dApp. Defaults to `window.location.origin`. */\n uri?: string;\n};\n\n/** Return type of {@link useAuthenticateListing}: the issued bearer token or a normalized error. */\nexport type UseAuthenticateListingReturnType = UseMutationResult<\n ListingAuthToken,\n SymmioRequestError,\n AuthenticateListingVariables\n>;\n\n/**\n * Sign in to the listing backend with SIWE (EIP-4361) in one call.\n *\n * The mutation runs the whole flow — fetch the sign-in message, sign it with the\n * connected wallet, and POST the login — and resolves to the issued bearer token\n * `{ accessToken, tokenType }`. Present it as an `Authorization: Bearer\n * <accessToken>` header on subsequent authenticated Pools requests.\n *\n * `domain` and `uri` default to the current origin (`window.location.host` /\n * `window.location.origin`); pass them to override. Pools is **chain-level**\n * — `mutate` / `mutateAsync` reject with a normalized {@link SymmioRequestError}\n * (`LISTING_NOT_CONFIGURED`) on a chain with no listing backend. Failures are\n * normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { mutate, data, isPending } = useAuthenticateListing();\n * // domain / uri auto-fill from the current origin:\n * mutate({});\n * // …later:\n * if (data) headers.Authorization = `${data.tokenType} ${data.accessToken}`;\n * ```\n */\nexport function useAuthenticateListing(\n parameters: UseAuthenticateListingParameters = {},\n): UseAuthenticateListingReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = authenticateListingMutationOptions(config);\n\n return useMutation({\n ...options,\n mutationFn: async (variables: AuthenticateListingVariables) => {\n const domain = variables.domain ?? window.location.host;\n const uri = variables.uri ?? window.location.origin;\n try {\n return await options.mutationFn({\n ...variables,\n domain,\n uri,\n chainId: variables.chainId ?? chainId,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseAuthenticateListingReturnType;\n}\n"],"mappings":";;;;;;;AA6DA,SAAgB,EACd,IAA+C,CAAC,GACd;CAClC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAmC,CAAM;CAEzD,OAAO,EAAY;EACjB,GAAG;EACH,YAAY,OAAO,MAA4C;GAC7D,IAAM,IAAS,EAAU,UAAU,OAAO,SAAS,MAC7C,IAAM,EAAU,OAAO,OAAO,SAAS;GAC7C,IAAI;IACF,OAAO,MAAM,EAAQ,WAAW;KAC9B,GAAG;KACH;KACA;KACA,SAAS,EAAU,WAAW;IAChC,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-authenticate-listing.js","names":[],"sources":["../../src/pools/use-authenticate-listing.ts"],"sourcesContent":["\"use client\";\n\nimport {\n authenticateListingMutationOptions,\n getListingSignInMessageQueryOptions,\n type AuthenticateListingParameters,\n type ConfigParameter,\n type ListingAuthToken,\n type ListingSignInMessage,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQuery, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { Address } from \"viem\";\nimport { useConnection } from \"wagmi\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useAuthenticateListing}: optional prefetch controls and `config`. */\nexport type UseAuthenticateListingParameters = ConfigParameter & {\n /** Fetch a single-use challenge after a wallet connects. Defaults to false. */\n prefetchChallenge?: boolean;\n /** Explicit deployment, independent of the wallet chain. */\n chainId?: number;\n /** Explicit signing account for an injected or embedded signer. */\n from?: Address;\n domain?: string;\n uri?: string;\n statement?: string;\n};\n\n/**\n * Variables for the {@link useAuthenticateListing} mutation.\n *\n * `domain` and `uri` are optional here — omit them and the hook fills them from\n * the current `window.location` (`host` / `origin`). Pass them explicitly to\n * override (e.g. to bind the SIWE message to a canonical domain).\n */\nexport type AuthenticateListingVariables = Omit<AuthenticateListingParameters, \"domain\" | \"uri\"> & {\n /** RFC 4501 DNS authority requesting the sign-in. Defaults to `window.location.host`. */\n domain?: string;\n /** RFC 3986 URI of the dApp. Defaults to `window.location.origin`. */\n uri?: string;\n};\n\n/** Return type of {@link useAuthenticateListing}: the issued bearer token or a normalized error. */\nexport type UseAuthenticateListingReturnType = UseMutationResult<\n ListingAuthToken,\n SymmioRequestError,\n AuthenticateListingVariables\n> & {\n /** Current prefetched challenge, or undefined before it is available. */ challenge: ListingSignInMessage | undefined;\n};\n\n/**\n * Sign in to the listing backend with SIWE (EIP-4361) in one call.\n *\n * The mutation runs the whole flow — fetch the sign-in message, sign it with the\n * connected wallet, and POST the login — and resolves to the issued bearer token\n * `{ accessToken, tokenType }`. Present it as an `Authorization: Bearer\n * <accessToken>` header on subsequent authenticated Pools requests.\n *\n * `domain` and `uri` default to the current origin (`window.location.host` /\n * `window.location.origin`); pass them to override. Pools is **chain-level**\n * — `mutate` / `mutateAsync` reject with a normalized {@link SymmioRequestError}\n * (`LISTING_NOT_CONFIGURED`) on a chain with no listing backend. Failures are\n * normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { mutate, data, isPending } = useAuthenticateListing();\n * // domain / uri auto-fill from the current origin:\n * mutate({});\n * // …later:\n * if (data) headers.Authorization = `${data.tokenType} ${data.accessToken}`;\n * ```\n */\nexport function useAuthenticateListing(\n parameters: UseAuthenticateListingParameters = {},\n): UseAuthenticateListingReturnType {\n const config = useSymmioConfig(parameters);\n const connectedChain = useSymmioChainId();\n const chainId = parameters.chainId ?? connectedChain;\n const connection = useConnection();\n const address = parameters.from ?? connection.address;\n const queryClient = useQueryClient();\n const locationHref = useSyncExternalStore(subscribeLocation, readLocation, readServerLocation);\n const location = locationHref == null ? undefined : new URL(locationHref);\n const domain = parameters.domain ?? location?.host;\n const uri = parameters.uri ?? location?.origin;\n const prefetch = !!parameters.prefetchChallenge && !!address && !!domain && !!uri;\n const [attempts, setAttempts] = useState(0);\n const challengeOptions = getListingSignInMessageQueryOptions(config, {\n chainId,\n address: address ?? \"0x0000000000000000000000000000000000000000\",\n domain: domain ?? \"\",\n uri: uri ?? \"\",\n statement: parameters.statement,\n query: {\n enabled: prefetch && attempts === 0,\n retry: false,\n staleTime: Infinity,\n gcTime: 0,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n },\n });\n const { data: challenge, refetch: refetchChallenge } = useQuery(challengeOptions);\n const identity = JSON.stringify(challengeOptions.queryKey);\n const currentIdentity = useRef(identity);\n currentIdentity.current = identity;\n const expirationTime = challenge?.params.expirationTime;\n useEffect(() => {\n if (!prefetch || attempts > 0 || !expirationTime) return;\n const expires = Date.parse(expirationTime);\n if (!Number.isFinite(expires)) return;\n const timer = setTimeout(\n () => {\n void refetchChallenge();\n },\n Math.max(1000, Math.min(2147483647, expires - Date.now() - 1000)),\n );\n return () => clearTimeout(timer);\n }, [prefetch, attempts, expirationTime, refetchChallenge]);\n const options = authenticateListingMutationOptions(config);\n\n const mutation = useMutation({\n ...options,\n mutationFn: async (variables: AuthenticateListingVariables) => {\n const domain = variables.domain ?? parameters.domain ?? window.location.host;\n const uri = variables.uri ?? parameters.uri ?? window.location.origin;\n const statement = variables.statement ?? parameters.statement;\n const cached = prefetch ? queryClient.getQueryData<ListingSignInMessage>(challengeOptions.queryKey) : undefined;\n // Remove before signing so two hook instances cannot consume the same nonce.\n if (prefetch) {\n setAttempts((count) => count + 1);\n const cancellation = queryClient.cancelQueries({ queryKey: challengeOptions.queryKey, exact: true });\n queryClient.removeQueries({ queryKey: challengeOptions.queryKey, exact: true });\n await cancellation;\n }\n const fits =\n cached &&\n cached.params.domain === domain &&\n cached.params.uri === uri &&\n (cached.params.statement ?? \"\") === (statement ?? \"\") &&\n cached.params.chainId === (variables.chainId ?? chainId) &&\n (!cached.params.expirationTime || Date.parse(cached.params.expirationTime) > Date.now());\n const signInMessage = variables.signInMessage ?? (fits ? cached : undefined);\n try {\n return await options.mutationFn({\n ...variables,\n domain,\n uri,\n ...(statement === undefined ? {} : { statement }),\n ...(parameters.from === undefined ? {} : { from: variables.from ?? parameters.from }),\n ...(signInMessage === undefined ? {} : { signInMessage }),\n chainId: variables.chainId ?? chainId,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n } finally {\n if (prefetch) {\n if (currentIdentity.current === identity)\n void queryClient.fetchQuery({ ...challengeOptions, staleTime: 0 }).catch(() => undefined);\n setAttempts((count) => count - 1);\n }\n }\n },\n });\n return { ...mutation, challenge: prefetch ? challenge : undefined } as UseAuthenticateListingReturnType;\n}\n\nfunction readLocation() {\n return window.location.href;\n}\nfunction readServerLocation() {\n return null;\n}\nfunction subscribeLocation(onChange: () => void) {\n window.addEventListener(\"popstate\", onChange);\n window.addEventListener(\"hashchange\", onChange);\n return () => {\n window.removeEventListener(\"popstate\", onChange);\n window.removeEventListener(\"hashchange\", onChange);\n };\n}\n"],"mappings":";;;;;;;;;AA8EA,SAAgB,EACd,IAA+C,CAAC,GACd;CAClC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAChC,IAAa,EAAc,GAC3B,IAAU,EAAW,QAAQ,EAAW,SACxC,IAAc,EAAe,GAC7B,IAAe,EAAqB,GAAmB,GAAc,CAAkB,GACvF,IAAW,KAAgB,OAAO,KAAA,IAAY,IAAI,IAAI,CAAY,GAClE,IAAS,EAAW,UAAU,GAAU,MACxC,IAAM,EAAW,OAAO,GAAU,QAClC,IAAW,CAAC,CAAC,EAAW,qBAAqB,CAAC,CAAC,KAAW,CAAC,CAAC,KAAU,CAAC,CAAC,GACxE,CAAC,GAAU,KAAe,EAAS,CAAC,GACpC,IAAmB,EAAoC,GAAQ;EACnE;EACA,SAAS,KAAW;EACpB,QAAQ,KAAU;EAClB,KAAK,KAAO;EACZ,WAAW,EAAW;EACtB,OAAO;GACL,SAAS,KAAY,MAAa;GAClC,OAAO;GACP,WAAW;GACX,QAAQ;GACR,sBAAsB;GACtB,oBAAoB;EACtB;CACF,CAAC,GACK,EAAE,MAAM,GAAW,SAAS,MAAqB,EAAS,CAAgB,GAC1E,IAAW,KAAK,UAAU,EAAiB,QAAQ,GACnD,IAAkB,EAAO,CAAQ;CACvC,EAAgB,UAAU;CAC1B,IAAM,IAAiB,GAAW,OAAO;CACzC,QAAgB;EACd,IAAI,CAAC,KAAY,IAAW,KAAK,CAAC,GAAgB;EAClD,IAAM,IAAU,KAAK,MAAM,CAAc;EACzC,IAAI,CAAC,OAAO,SAAS,CAAO,GAAG;EAC/B,IAAM,IAAQ,iBACN;GACJ,EAAsB;EACxB,GACA,KAAK,IAAI,KAAM,KAAK,IAAI,YAAY,IAAU,KAAK,IAAI,IAAI,GAAI,CAAC,CAClE;EACA,aAAa,aAAa,CAAK;CACjC,GAAG;EAAC;EAAU;EAAU;EAAgB;CAAgB,CAAC;CACzD,IAAM,IAAU,EAAmC,CAAM;CA6CzD,OAAO;EAAE,GA3CQ,EAAY;GAC3B,GAAG;GACH,YAAY,OAAO,MAA4C;IAC7D,IAAM,IAAS,EAAU,UAAU,EAAW,UAAU,OAAO,SAAS,MAClE,IAAM,EAAU,OAAO,EAAW,OAAO,OAAO,SAAS,QACzD,IAAY,EAAU,aAAa,EAAW,WAC9C,IAAS,IAAW,EAAY,aAAmC,EAAiB,QAAQ,IAAI,KAAA;IAEtG,IAAI,GAAU;KACZ,GAAa,MAAU,IAAQ,CAAC;KAChC,IAAM,IAAe,EAAY,cAAc;MAAE,UAAU,EAAiB;MAAU,OAAO;KAAK,CAAC;KAEnG,AADA,EAAY,cAAc;MAAE,UAAU,EAAiB;MAAU,OAAO;KAAK,CAAC,GAC9E,MAAM;IACR;IACA,IAAM,IACJ,KACA,EAAO,OAAO,WAAW,KACzB,EAAO,OAAO,QAAQ,MACrB,EAAO,OAAO,aAAa,SAAS,KAAa,OAClD,EAAO,OAAO,aAAa,EAAU,WAAW,OAC/C,CAAC,EAAO,OAAO,kBAAkB,KAAK,MAAM,EAAO,OAAO,cAAc,IAAI,KAAK,IAAI,IAClF,IAAgB,EAAU,kBAAkB,IAAO,IAAS,KAAA;IAClE,IAAI;KACF,OAAO,MAAM,EAAQ,WAAW;MAC9B,GAAG;MACH;MACA;MACA,GAAI,MAAc,KAAA,IAAY,CAAC,IAAI,EAAE,aAAU;MAC/C,GAAI,EAAW,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,EAAU,QAAQ,EAAW,KAAK;MACnF,GAAI,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,iBAAc;MACvD,SAAS,EAAU,WAAW;KAChC,CAAC;IACH,SAAS,GAAK;KACZ,MAAM,EAAmB,CAAG;IAC9B,UAAU;KACR,AAAI,MACE,EAAgB,YAAY,KAC9B,EAAiB,WAAW;MAAE,GAAG;MAAkB,WAAW;KAAE,CAAC,EAAE,YAAY,KAAA,CAAS,GAC1F,GAAa,MAAU,IAAQ,CAAC;IAEpC;GACF;EACF,CACY;EAAU,WAAW,IAAW,IAAY,KAAA;CAAU;AACpE;AAEA,SAAS,IAAe;CACtB,OAAO,OAAO,SAAS;AACzB;AACA,SAAS,IAAqB;CAC5B,OAAO;AACT;AACA,SAAS,EAAkB,GAAsB;CAG/C,OAFA,OAAO,iBAAiB,YAAY,CAAQ,GAC5C,OAAO,iBAAiB,cAAc,CAAQ,SACjC;EAEX,AADA,OAAO,oBAAoB,YAAY,CAAQ,GAC/C,OAAO,oBAAoB,cAAc,CAAQ;CACnD;AACF"}
@@ -6,6 +6,7 @@ export type UseListingConfigParameters = GetListingConfigOptions & ConfigParamet
6
6
  /** Return type of {@link useListingConfig}: the listing service's public client config. */
7
7
  export type UseListingConfigReturnType = UseQueryResult<ListingConfig, SymmioRequestError>;
8
8
  /**
9
+ * Missing rate limits remain null; legacy initial-deposit fields retain their actual minimum.
9
10
  * Read the listing service's **public** client configuration — the data a
10
11
  * create-pool UI must show a user before they list a token: the recommended and
11
12
  * minimum initial deposits, the listing fee, the supported deposit chains, the
@@ -1 +1 @@
1
- {"version":3,"file":"use-listing-config.d.ts","sourceRoot":"","sources":["../../src/pools/use-listing-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,iGAAiG;AACjG,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG,eAAe,CAAC;AAEnF,2FAA2F;AAC3F,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAE3F;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,GAAE,0BAA+B,GAAG,0BAA0B,CAkBxG"}
1
+ {"version":3,"file":"use-listing-config.d.ts","sourceRoot":"","sources":["../../src/pools/use-listing-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,iGAAiG;AACjG,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG,eAAe,CAAC;AAEnF,2FAA2F;AAC3F,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAE3F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,GAAE,0BAA+B,GAAG,0BAA0B,CAkBxG"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-listing-config.js","names":[],"sources":["../../src/pools/use-listing-config.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getListingConfigQueryOptions,\n type ConfigParameter,\n type GetListingConfigOptions,\n type ListingConfig,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useListingConfig}: the core query options plus an optional `config`. */\nexport type UseListingConfigParameters = GetListingConfigOptions & ConfigParameter;\n\n/** Return type of {@link useListingConfig}: the listing service's public client config. */\nexport type UseListingConfigReturnType = UseQueryResult<ListingConfig, SymmioRequestError>;\n\n/**\n * Read the listing service's **public** client configuration — the data a\n * create-pool UI must show a user before they list a token: the recommended and\n * minimum initial deposits, the listing fee, the supported deposit chains, the\n * per-day rate limits, and the protocol reward share.\n *\n * This is the public twin of {@link useAuthenticateListing}-gated reads: no\n * token, resolved from the config, so it can be mounted unconditionally. The\n * three `*Usdc` figures are `bigint` at `LISTING_VALUE_DECIMALS` (18) — descale\n * with `formatUnits` before rendering as USD. `supportedDepositChains` is the\n * source of truth for a deposit-chain picker; do not hardcode the list.\n * Enigma-only; errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data, isPending } = useListingConfig();\n * const chains = data?.supportedDepositChains ?? [];\n * ```\n */\nexport function useListingConfig(parameters: UseListingConfigParameters = {}): UseListingConfigReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getListingConfigQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseListingConfigReturnType;\n}\n"],"mappings":";;;;;;;AAuCA,SAAgB,EAAiB,IAAyC,CAAC,GAA+B;CACxG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA6B,GAAQ;EACnD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-listing-config.js","names":[],"sources":["../../src/pools/use-listing-config.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getListingConfigQueryOptions,\n type ConfigParameter,\n type GetListingConfigOptions,\n type ListingConfig,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useListingConfig}: the core query options plus an optional `config`. */\nexport type UseListingConfigParameters = GetListingConfigOptions & ConfigParameter;\n\n/** Return type of {@link useListingConfig}: the listing service's public client config. */\nexport type UseListingConfigReturnType = UseQueryResult<ListingConfig, SymmioRequestError>;\n\n/**\n * Missing rate limits remain null; legacy initial-deposit fields retain their actual minimum.\n * Read the listing service's **public** client configuration — the data a\n * create-pool UI must show a user before they list a token: the recommended and\n * minimum initial deposits, the listing fee, the supported deposit chains, the\n * per-day rate limits, and the protocol reward share.\n *\n * This is the public twin of {@link useAuthenticateListing}-gated reads: no\n * token, resolved from the config, so it can be mounted unconditionally. The\n * three `*Usdc` figures are `bigint` at `LISTING_VALUE_DECIMALS` (18) — descale\n * with `formatUnits` before rendering as USD. `supportedDepositChains` is the\n * source of truth for a deposit-chain picker; do not hardcode the list.\n * Enigma-only; errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data, isPending } = useListingConfig();\n * const chains = data?.supportedDepositChains ?? [];\n * ```\n */\nexport function useListingConfig(parameters: UseListingConfigParameters = {}): UseListingConfigReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getListingConfigQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseListingConfigReturnType;\n}\n"],"mappings":";;;;;;;AAwCA,SAAgB,EAAiB,IAAyC,CAAC,GAA+B;CACxG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA6B,GAAQ;EACnD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ import { ConfigParameter, GetListingTokenMetadataOptions } from '@symmio/trading-core';
2
+ /** Options for {@link useListingTokenMetadata}. */
3
+ export type UseListingTokenMetadataParameters = GetListingTokenMetadataOptions & ConfigParameter;
4
+ /** Read token metadata through the configured listing backend. */
5
+ export declare function useListingTokenMetadata(parameters: UseListingTokenMetadataParameters): import('@tanstack/react-query').UseQueryResult<import('@symmio/trading-core').ListingTokenMetadata, Error>;
6
+ //# sourceMappingURL=use-listing-token-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-listing-token-metadata.d.ts","sourceRoot":"","sources":["../../src/pools/use-listing-token-metadata.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,8BAA8B,EACpC,MAAM,sBAAsB,CAAC;AAM9B,mDAAmD;AACnD,MAAM,MAAM,iCAAiC,GAAG,8BAA8B,GAAG,eAAe,CAAC;AACjG,kEAAkE;AAClE,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,iCAAiC,8GAiBpF"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
+ import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
+ import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
+ import { getListingTokenMetadataQueryOptions as r } from "@symmio/trading-core";
6
+ import { useQuery as i } from "@tanstack/react-query";
7
+ //#region src/pools/use-listing-token-metadata.ts
8
+ function a(a) {
9
+ let o = t(a), s = e(), c = r(o, {
10
+ ...a,
11
+ chainId: a.chainId ?? s
12
+ });
13
+ return i({
14
+ ...c,
15
+ queryFn: async () => {
16
+ try {
17
+ return await c.queryFn();
18
+ } catch (e) {
19
+ throw n(e);
20
+ }
21
+ }
22
+ });
23
+ }
24
+ //#endregion
25
+ export { a as useListingTokenMetadata };
26
+
27
+ //# sourceMappingURL=use-listing-token-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-listing-token-metadata.js","names":[],"sources":["../../src/pools/use-listing-token-metadata.ts"],"sourcesContent":["\"use client\";\nimport {\n getListingTokenMetadataQueryOptions,\n type ConfigParameter,\n type GetListingTokenMetadataOptions,\n} from \"@symmio/trading-core\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Options for {@link useListingTokenMetadata}. */\nexport type UseListingTokenMetadataParameters = GetListingTokenMetadataOptions & ConfigParameter;\n/** Read token metadata through the configured listing backend. */\nexport function useListingTokenMetadata(parameters: UseListingTokenMetadataParameters) {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getListingTokenMetadataQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n });\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,EAAwB,GAA+C;CACrF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAoC,GAAQ;EAC1D,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CACD,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAO;IACd,MAAM,EAAmB,CAAK;GAChC;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ import { CheckListingTokenSupportOptions, ConfigParameter } from '@symmio/trading-core';
2
+ /** Options for {@link useListingTokenSupport}. */
3
+ export type UseListingTokenSupportParameters = CheckListingTokenSupportOptions & ConfigParameter;
4
+ /** Read token support through the configured listing backend. */
5
+ export declare function useListingTokenSupport(parameters: UseListingTokenSupportParameters): import('@tanstack/react-query').UseQueryResult<boolean, Error>;
6
+ //# sourceMappingURL=use-listing-token-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-listing-token-support.d.ts","sourceRoot":"","sources":["../../src/pools/use-listing-token-support.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAM9B,kDAAkD;AAClD,MAAM,MAAM,gCAAgC,GAAG,+BAA+B,GAAG,eAAe,CAAC;AACjG,iEAAiE;AACjE,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,gCAAgC,kEAiBlF"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
+ import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
+ import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
+ import { checkListingTokenSupportQueryOptions as r } from "@symmio/trading-core";
6
+ import { useQuery as i } from "@tanstack/react-query";
7
+ //#region src/pools/use-listing-token-support.ts
8
+ function a(a) {
9
+ let o = t(a), s = e(), c = r(o, {
10
+ ...a,
11
+ chainId: a.chainId ?? s
12
+ });
13
+ return i({
14
+ ...c,
15
+ queryFn: async () => {
16
+ try {
17
+ return await c.queryFn();
18
+ } catch (e) {
19
+ throw n(e);
20
+ }
21
+ }
22
+ });
23
+ }
24
+ //#endregion
25
+ export { a as useListingTokenSupport };
26
+
27
+ //# sourceMappingURL=use-listing-token-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-listing-token-support.js","names":[],"sources":["../../src/pools/use-listing-token-support.ts"],"sourcesContent":["\"use client\";\nimport {\n checkListingTokenSupportQueryOptions,\n type CheckListingTokenSupportOptions,\n type ConfigParameter,\n} from \"@symmio/trading-core\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Options for {@link useListingTokenSupport}. */\nexport type UseListingTokenSupportParameters = CheckListingTokenSupportOptions & ConfigParameter;\n/** Read token support through the configured listing backend. */\nexport function useListingTokenSupport(parameters: UseListingTokenSupportParameters) {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = checkListingTokenSupportQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n });\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,EAAuB,GAA8C;CACnF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAqC,GAAQ;EAC3D,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CACD,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAO;IACd,MAAM,EAAmB,CAAK;GAChC;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ import { ConfigParameter, GetPoolMaintenanceFeesOptions } from '@symmio/trading-core';
2
+ /** Options for {@link usePoolMaintenanceFees}. */
3
+ export type UsePoolMaintenanceFeesParameters = GetPoolMaintenanceFeesOptions & ConfigParameter;
4
+ /** Read maintenance fees through the configured listing backend. */
5
+ export declare function usePoolMaintenanceFees(parameters: UsePoolMaintenanceFeesParameters): import('@tanstack/react-query').UseQueryResult<import('@symmio/trading-core').PoolMaintenanceFees, Error>;
6
+ //# sourceMappingURL=use-pool-maintenance-fees.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pool-maintenance-fees.d.ts","sourceRoot":"","sources":["../../src/pools/use-pool-maintenance-fees.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,6BAA6B,EACnC,MAAM,sBAAsB,CAAC;AAM9B,kDAAkD;AAClD,MAAM,MAAM,gCAAgC,GAAG,6BAA6B,GAAG,eAAe,CAAC;AAC/F,oEAAoE;AACpE,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,gCAAgC,6GAclF"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
+ import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
+ import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
+ import { getPoolMaintenanceFeesQueryOptions as r } from "@symmio/trading-core";
6
+ import { useQuery as i } from "@tanstack/react-query";
7
+ //#region src/pools/use-pool-maintenance-fees.ts
8
+ function a(a) {
9
+ let o = t(a), s = e(), c = r(o, {
10
+ ...a,
11
+ chainId: a.chainId ?? s
12
+ });
13
+ return i({
14
+ ...c,
15
+ queryFn: async () => {
16
+ try {
17
+ return await c.queryFn();
18
+ } catch (e) {
19
+ throw n(e);
20
+ }
21
+ }
22
+ });
23
+ }
24
+ //#endregion
25
+ export { a as usePoolMaintenanceFees };
26
+
27
+ //# sourceMappingURL=use-pool-maintenance-fees.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pool-maintenance-fees.js","names":[],"sources":["../../src/pools/use-pool-maintenance-fees.ts"],"sourcesContent":["\"use client\";\nimport {\n getPoolMaintenanceFeesQueryOptions,\n type ConfigParameter,\n type GetPoolMaintenanceFeesOptions,\n} from \"@symmio/trading-core\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Options for {@link usePoolMaintenanceFees}. */\nexport type UsePoolMaintenanceFeesParameters = GetPoolMaintenanceFeesOptions & ConfigParameter;\n/** Read maintenance fees through the configured listing backend. */\nexport function usePoolMaintenanceFees(parameters: UsePoolMaintenanceFeesParameters) {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getPoolMaintenanceFeesQueryOptions(config, { ...parameters, chainId: parameters.chainId ?? chainId });\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n });\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,EAAuB,GAA8C;CACnF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAmC,GAAQ;EAAE,GAAG;EAAY,SAAS,EAAW,WAAW;CAAQ,CAAC;CACpH,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAO;IACd,MAAM,EAAmB,CAAK;GAChC;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,34 @@
1
+ import { GetPoolQuotesReturnType, PoolQuote, ConfigParameter, GetPoolOpenPositionsParameters, PoolReadGap } from '@symmio/trading-core';
2
+ /** Open-book projection controls. Consumers page the derived rows after account-wide calculations. */
3
+ export type UsePoolOpenPositionsParameters = GetPoolOpenPositionsParameters & ConfigParameter & {
4
+ enabled?: boolean;
5
+ refetchInterval?: number | false;
6
+ };
7
+ /** Compose shared quote and account-balance queries without a second data cache.
8
+ * @param parameters - Market, optional mark price, and query controls.
9
+ * @returns Derived open positions and explicit source gaps.
10
+ */
11
+ export declare function usePoolOpenPositions(parameters: UsePoolOpenPositionsParameters): {
12
+ data: {
13
+ entries: (PoolQuote & {
14
+ remainingQuantity: bigint | null;
15
+ entryPrice: bigint | null;
16
+ positionValueUsd: number | null;
17
+ entryValueUsd: number | null;
18
+ leverageMultiplier: number | null;
19
+ upnlUsd: number | null;
20
+ priceChangePercent: number | null;
21
+ liquidationPrice: bigint | null;
22
+ liquidationSource: "account" | "quote-lock" | null;
23
+ openedAt: number | null;
24
+ })[];
25
+ gaps: PoolReadGap[];
26
+ } | undefined;
27
+ isLoading: boolean;
28
+ isFetching: boolean;
29
+ error: Error | import('../index.js').SymmioRequestError | null;
30
+ refetch: () => Promise<[] | [import('@tanstack/query-core').QueryObserverResult<GetPoolQuotesReturnType, Error>[], ...import('@tanstack/query-core').QueryObserverResult<import('@symmio/trading-core').AccountBalanceInfo, Error>[]]>;
31
+ };
32
+ /** Result of usePoolOpenPositions. */
33
+ export type UsePoolOpenPositionsReturnType = ReturnType<typeof usePoolOpenPositions>;
34
+ //# sourceMappingURL=use-pool-open-positions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pool-open-positions.d.ts","sourceRoot":"","sources":["../../src/pools/use-pool-open-positions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAG/E,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,8BAA8B,EACnC,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAO9B,sGAAsG;AACtG,MAAM,MAAM,8BAA8B,GAAG,8BAA8B,GACzE,eAAe,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAAC;AAC5E;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,8BAA8B;;;;;;;;;;;;;;;;;;;;EAmE9E;AACD,sCAAsC;AACtC,MAAM,MAAM,8BAA8B,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
+ import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
+ import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
+ import { usePoolPages as r } from "./use-pool-pages.js";
6
+ import { POOL_OPEN_QUOTE_STATUSES as i, calculatePoolOpenPositions as a, getAccountBalanceInfoQueryOptions as o, getPoolQuotesQueryOptions as s } from "@symmio/trading-core";
7
+ import { useQueries as c } from "@tanstack/react-query";
8
+ //#region src/pools/use-pool-open-positions.ts
9
+ function l(l) {
10
+ let u = t(l), d = e(), f = l.chainId ?? d, p = l.enabled ?? !0, m = r({
11
+ source: "quotes",
12
+ pageSize: 100,
13
+ enabled: p,
14
+ refetchInterval: l.refetchInterval,
15
+ selectPage: (e, t) => ({
16
+ items: e.quotes,
17
+ total: e.quotes.length < 100 ? t + e.quotes.length : 2 ** 53 - 1
18
+ }),
19
+ identity: (e) => e.id,
20
+ options: (e) => s(u, {
21
+ chainId: f,
22
+ symbolId: l.symbolId,
23
+ orderDirection: l.orderDirection,
24
+ quoteStatuses: i,
25
+ first: 100,
26
+ skip: e,
27
+ query: { refetchInterval: l.refetchInterval }
28
+ })
29
+ }), h = [...new Set(m.items.map((e) => e.partyA.toLowerCase()))], g = c({ queries: h.map((e) => o(u, {
30
+ chainId: f,
31
+ account: e,
32
+ query: {
33
+ enabled: p,
34
+ refetchInterval: l.refetchInterval
35
+ }
36
+ })) }), _ = Object.fromEntries(h.map((e, t) => [e, g[t]?.data ?? null])), v = [...m.gaps, ...h.flatMap((e, t) => g[t]?.error ? [{
37
+ source: "accountBalance",
38
+ tokenContractAddress: e,
39
+ reason: "failed"
40
+ }] : [])], y = p && (m.isLoading || g.some((e) => e.isPending));
41
+ return {
42
+ data: p && !y ? a({
43
+ quotes: m.items,
44
+ balances: _,
45
+ priceUsd: l.priceUsd,
46
+ allowQuoteLockEstimate: l.allowQuoteLockEstimate,
47
+ complete: !m.gaps.length,
48
+ gaps: v
49
+ }) : void 0,
50
+ isLoading: y,
51
+ isFetching: m.isFetching || g.some((e) => e.isFetching),
52
+ error: m.error ?? (g.find((e) => e.error)?.error ? n(g.find((e) => e.error).error) : null),
53
+ refetch: () => Promise.all(p ? [m.refetch(), ...g.map((e) => e.refetch())] : [])
54
+ };
55
+ }
56
+ //#endregion
57
+ export { l as usePoolOpenPositions };
58
+
59
+ //# sourceMappingURL=use-pool-open-positions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pool-open-positions.js","names":[],"sources":["../../src/pools/use-pool-open-positions.ts"],"sourcesContent":["\"use client\";\nimport type { GetPoolQuotesReturnType, PoolQuote } from \"@symmio/trading-core\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\n\nimport {\n calculatePoolOpenPositions,\n getAccountBalanceInfoQueryOptions,\n getPoolQuotesQueryOptions,\n POOL_OPEN_QUOTE_STATUSES,\n type ConfigParameter,\n type GetPoolOpenPositionsParameters,\n type PoolReadGap,\n} from \"@symmio/trading-core\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport type { Address } from \"viem\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { usePoolPages } from \"./use-pool-pages\";\n\n/** Open-book projection controls. Consumers page the derived rows after account-wide calculations. */\nexport type UsePoolOpenPositionsParameters = GetPoolOpenPositionsParameters &\n ConfigParameter & { enabled?: boolean; refetchInterval?: number | false };\n/** Compose shared quote and account-balance queries without a second data cache.\n * @param parameters - Market, optional mark price, and query controls.\n * @returns Derived open positions and explicit source gaps.\n */\nexport function usePoolOpenPositions(parameters: UsePoolOpenPositionsParameters) {\n const config = useSymmioConfig(parameters),\n connected = useSymmioChainId();\n const chainId = parameters.chainId ?? connected,\n enabled = parameters.enabled ?? true;\n const quotes = usePoolPages<GetPoolQuotesReturnType, PoolQuote>({\n source: \"quotes\",\n pageSize: 100,\n enabled,\n refetchInterval: parameters.refetchInterval,\n selectPage: (page, skip) => ({\n items: page.quotes,\n total: page.quotes.length < 100 ? skip + page.quotes.length : Number.MAX_SAFE_INTEGER,\n }),\n identity: (row) => row.id,\n options: (skip) => {\n const options = getPoolQuotesQueryOptions(config, {\n chainId,\n symbolId: parameters.symbolId,\n orderDirection: parameters.orderDirection,\n quoteStatuses: POOL_OPEN_QUOTE_STATUSES,\n first: 100,\n skip,\n query: { refetchInterval: parameters.refetchInterval },\n });\n return options;\n },\n });\n const accounts = [...new Set(quotes.items.map((row) => row.partyA.toLowerCase()))];\n const reads = useQueries({\n queries: accounts.map((account) =>\n getAccountBalanceInfoQueryOptions(config, {\n chainId,\n account: account as Address,\n query: { enabled, refetchInterval: parameters.refetchInterval },\n }),\n ),\n });\n const balances = Object.fromEntries(accounts.map((account, index) => [account, reads[index]?.data ?? null]));\n const gaps: PoolReadGap[] = [\n ...quotes.gaps,\n ...accounts.flatMap((account, index) =>\n reads[index]?.error\n ? [{ source: \"accountBalance\", tokenContractAddress: account, reason: \"failed\" as const }]\n : [],\n ),\n ];\n const isLoading = enabled && (quotes.isLoading || reads.some((row) => row.isPending));\n return {\n data:\n enabled && !isLoading\n ? calculatePoolOpenPositions({\n quotes: quotes.items,\n balances,\n priceUsd: parameters.priceUsd,\n allowQuoteLockEstimate: parameters.allowQuoteLockEstimate,\n complete: !quotes.gaps.length,\n gaps,\n })\n : undefined,\n isLoading,\n isFetching: quotes.isFetching || reads.some((row) => row.isFetching),\n error:\n quotes.error ??\n (reads.find((row) => row.error)?.error ? normalizeSymmError(reads.find((row) => row.error)!.error) : null),\n refetch: () => Promise.all(enabled ? [quotes.refetch(), ...reads.map((row) => row.refetch())] : []),\n };\n}\n/** Result of usePoolOpenPositions. */\nexport type UsePoolOpenPositionsReturnType = ReturnType<typeof usePoolOpenPositions>;\n"],"mappings":";;;;;;;;AA0BA,SAAgB,EAAqB,GAA4C;CAC/E,IAAM,IAAS,EAAgB,CAAU,GACvC,IAAY,EAAiB,GACzB,IAAU,EAAW,WAAW,GACpC,IAAU,EAAW,WAAW,IAC5B,IAAS,EAAiD;EAC9D,QAAQ;EACR,UAAU;EACV;EACA,iBAAiB,EAAW;EAC5B,aAAa,GAAM,OAAU;GAC3B,OAAO,EAAK;GACZ,OAAO,EAAK,OAAO,SAAS,MAAM,IAAO,EAAK,OAAO;EACvD;EACA,WAAW,MAAQ,EAAI;EACvB,UAAU,MACQ,EAA0B,GAAQ;GAChD;GACA,UAAU,EAAW;GACrB,gBAAgB,EAAW;GAC3B,eAAe;GACf,OAAO;GACP;GACA,OAAO,EAAE,iBAAiB,EAAW,gBAAgB;EACvD,CACO;CAEX,CAAC,GACK,IAAW,CAAC,GAAG,IAAI,IAAI,EAAO,MAAM,KAAK,MAAQ,EAAI,OAAO,YAAY,CAAC,CAAC,CAAC,GAC3E,IAAQ,EAAW,EACvB,SAAS,EAAS,KAAK,MACrB,EAAkC,GAAQ;EACxC;EACS;EACT,OAAO;GAAE;GAAS,iBAAiB,EAAW;EAAgB;CAChE,CAAC,CACH,EACF,CAAC,GACK,IAAW,OAAO,YAAY,EAAS,KAAK,GAAS,MAAU,CAAC,GAAS,EAAM,IAAQ,QAAQ,IAAI,CAAC,CAAC,GACrG,IAAsB,CAC1B,GAAG,EAAO,MACV,GAAG,EAAS,SAAS,GAAS,MAC5B,EAAM,IAAQ,QACV,CAAC;EAAE,QAAQ;EAAkB,sBAAsB;EAAS,QAAQ;CAAkB,CAAC,IACvF,CAAC,CACP,CACF,GACM,IAAY,MAAY,EAAO,aAAa,EAAM,MAAM,MAAQ,EAAI,SAAS;CACnF,OAAO;EACL,MACE,KAAW,CAAC,IACR,EAA2B;GACzB,QAAQ,EAAO;GACf;GACA,UAAU,EAAW;GACrB,wBAAwB,EAAW;GACnC,UAAU,CAAC,EAAO,KAAK;GACvB;EACF,CAAC,IACD,KAAA;EACN;EACA,YAAY,EAAO,cAAc,EAAM,MAAM,MAAQ,EAAI,UAAU;EACnE,OACE,EAAO,UACN,EAAM,MAAM,MAAQ,EAAI,KAAK,GAAG,QAAQ,EAAmB,EAAM,MAAM,MAAQ,EAAI,KAAK,EAAG,KAAK,IAAI;EACvG,eAAe,QAAQ,IAAI,IAAU,CAAC,EAAO,QAAQ,GAAG,GAAG,EAAM,KAAK,MAAQ,EAAI,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;CACpG;AACF"}
@@ -0,0 +1,25 @@
1
+ import { PoolReadGap } from '@symmio/trading-core';
2
+ /** Internal sequential pagination over the existing primitive query keys. */
3
+ export declare function usePoolPages<Page, T>(input: {
4
+ options: (offset: number) => {
5
+ queryKey: readonly unknown[];
6
+ queryFn: () => Promise<Page>;
7
+ };
8
+ selectPage: (page: Page, offset: number) => {
9
+ items: readonly T[];
10
+ total: number;
11
+ };
12
+ refetchInterval?: number | false;
13
+ identity: (item: T) => string;
14
+ source: string;
15
+ pageSize: number;
16
+ enabled: boolean;
17
+ }): {
18
+ items: T[];
19
+ gaps: PoolReadGap[];
20
+ error: Error | null;
21
+ isLoading: boolean;
22
+ isFetching: boolean;
23
+ refetch: () => Promise<import('@tanstack/query-core').QueryObserverResult<Page, Error>[]>;
24
+ };
25
+ //# sourceMappingURL=use-pool-pages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-pool-pages.d.ts","sourceRoot":"","sources":["../../src/pools/use-pool-pages.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE;IAC3C,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK;QAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;IAC5F,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK;QAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACnF,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACjC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;;;;;;;EA2EA"}