@symmio/trading-react 3.4.0 → 4.1.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.
- package/dist/estimated-price/use-estimated-price.js +2 -2
- package/dist/estimated-price/use-estimated-price.js.map +1 -1
- package/dist/funding/index.d.ts +3 -0
- package/dist/funding/index.d.ts.map +1 -0
- package/dist/funding/use-funding-index-checkpoints.d.ts +29 -0
- package/dist/funding/use-funding-index-checkpoints.d.ts.map +1 -0
- package/dist/funding/use-funding-index-checkpoints.js +27 -0
- package/dist/funding/use-funding-index-checkpoints.js.map +1 -0
- package/dist/funding/use-quote-funding-settlements.d.ts +28 -0
- package/dist/funding/use-quote-funding-settlements.d.ts.map +1 -0
- package/dist/funding/use-quote-funding-settlements.js +27 -0
- package/dist/funding/use-quote-funding-settlements.js.map +1 -0
- package/dist/funding-info/use-funding-info.d.ts +10 -7
- package/dist/funding-info/use-funding-info.d.ts.map +1 -1
- package/dist/funding-info/use-funding-info.js.map +1 -1
- package/dist/index.d.ts +20 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +147 -139
- package/dist/liquidation/index.d.ts +2 -0
- package/dist/liquidation/index.d.ts.map +1 -0
- package/dist/liquidation/use-liquidation-details.d.ts +28 -0
- package/dist/liquidation/use-liquidation-details.d.ts.map +1 -0
- package/dist/liquidation/use-liquidation-details.js +27 -0
- package/dist/liquidation/use-liquidation-details.js.map +1 -0
- package/dist/margin/index.d.ts +1 -0
- package/dist/margin/index.d.ts.map +1 -1
- package/dist/margin/use-margin-transfers.d.ts +32 -0
- package/dist/margin/use-margin-transfers.d.ts.map +1 -0
- package/dist/margin/use-margin-transfers.js +27 -0
- package/dist/margin/use-margin-transfers.js.map +1 -0
- package/dist/market-info/use-market-info.d.ts +3 -0
- package/dist/market-info/use-market-info.d.ts.map +1 -1
- package/dist/market-info/use-market-info.js.map +1 -1
- package/dist/notional-cap/index.d.ts +1 -0
- package/dist/notional-cap/index.d.ts.map +1 -1
- package/dist/notional-cap/use-notional-cap-all.d.ts +1 -1
- package/dist/notional-cap/use-notional-cap-all.js.map +1 -1
- package/dist/notional-cap/use-notional-cap-page.d.ts +39 -0
- package/dist/notional-cap/use-notional-cap-page.d.ts.map +1 -0
- package/dist/notional-cap/use-notional-cap-page.js +32 -0
- package/dist/notional-cap/use-notional-cap-page.js.map +1 -0
- package/dist/pools/use-listing-markets.d.ts +2 -0
- package/dist/pools/use-listing-markets.d.ts.map +1 -1
- package/dist/pools/use-listing-markets.js.map +1 -1
- package/dist/quotes/index.d.ts +3 -0
- package/dist/quotes/index.d.ts.map +1 -1
- package/dist/quotes/use-is-party-a-liquidated.d.ts +24 -0
- package/dist/quotes/use-is-party-a-liquidated.d.ts.map +1 -0
- package/dist/quotes/use-is-party-a-liquidated.js +27 -0
- package/dist/quotes/use-is-party-a-liquidated.js.map +1 -0
- package/dist/quotes/use-party-a-open-positions-batch.d.ts +30 -0
- package/dist/quotes/use-party-a-open-positions-batch.d.ts.map +1 -0
- package/dist/quotes/use-party-a-open-positions-batch.js +27 -0
- package/dist/quotes/use-party-a-open-positions-batch.js.map +1 -0
- package/dist/quotes/use-quote-events-by-type.d.ts +9 -4
- package/dist/quotes/use-quote-events-by-type.d.ts.map +1 -1
- package/dist/quotes/use-quote-events-by-type.js.map +1 -1
- package/dist/quotes/use-subgraph-quotes.d.ts +28 -0
- package/dist/quotes/use-subgraph-quotes.d.ts.map +1 -0
- package/dist/quotes/use-subgraph-quotes.js +27 -0
- package/dist/quotes/use-subgraph-quotes.js.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-notional-cap-all.js","names":[],"sources":["../../src/notional-cap/use-notional-cap-all.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getNotionalCapAllQueryOptions,\n type ConfigParameter,\n type GetNotionalCapAllOptions,\n type GetNotionalCapAllReturnType,\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\";\nimport { DEFAULT_NOTIONAL_CAP_POLLING_MS } from \"./use-notional-cap-by-symbol-id\";\n\n/**\n * Parameters for {@link useNotionalCapAll}: the core query options plus an\n * optional `config` and a `pollingInterval` knob layered on top of\n * `query.refetchInterval`.\n */\nexport type UseNotionalCapAllParameters = GetNotionalCapAllOptions &\n ConfigParameter & {\n /**\n * Polling cadence in milliseconds. Defaults to\n * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS}. Pass `false` to disable polling.\n */\n pollingInterval?: number | false;\n };\n\n/** Return type of {@link useNotionalCapAll}. */\nexport type UseNotionalCapAllReturnType = UseQueryResult<GetNotionalCapAllReturnType, SymmioRequestError>;\n\n/**\n * Read every market's notional cap
|
|
1
|
+
{"version":3,"file":"use-notional-cap-all.js","names":[],"sources":["../../src/notional-cap/use-notional-cap-all.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getNotionalCapAllQueryOptions,\n type ConfigParameter,\n type GetNotionalCapAllOptions,\n type GetNotionalCapAllReturnType,\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\";\nimport { DEFAULT_NOTIONAL_CAP_POLLING_MS } from \"./use-notional-cap-by-symbol-id\";\n\n/**\n * Parameters for {@link useNotionalCapAll}: the core query options plus an\n * optional `config` and a `pollingInterval` knob layered on top of\n * `query.refetchInterval`.\n */\nexport type UseNotionalCapAllParameters = GetNotionalCapAllOptions &\n ConfigParameter & {\n /**\n * Polling cadence in milliseconds. Defaults to\n * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS}. Pass `false` to disable polling.\n */\n pollingInterval?: number | false;\n };\n\n/** Return type of {@link useNotionalCapAll}. */\nexport type UseNotionalCapAllReturnType = UseQueryResult<GetNotionalCapAllReturnType, SymmioRequestError>;\n\n/**\n * Read every market's notional cap across all solver pages. Surfaces the aggregate\n * `totalOpenInterest` / `totalUsed` plus the per-symbol rows.\n *\n * Polls every {@link DEFAULT_NOTIONAL_CAP_POLLING_MS} by default; pass\n * `pollingInterval` to change or disable.\n *\n * @example\n * ```tsx\n * const { data } = useNotionalCapAll();\n * console.log(data?.totalOpenInterest, data?.symbols.length);\n * ```\n */\nexport function useNotionalCapAll(parameters: UseNotionalCapAllParameters = {}): UseNotionalCapAllReturnType {\n const { pollingInterval = DEFAULT_NOTIONAL_CAP_POLLING_MS, query, ...rest } = parameters;\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getNotionalCapAllQueryOptions(config, {\n ...rest,\n chainId: rest.chainId ?? chainId,\n query: {\n refetchInterval: pollingInterval === false ? false : pollingInterval,\n ...query,\n },\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 UseNotionalCapAllReturnType;\n}\n"],"mappings":";;;;;;;;AA6CA,SAAgB,EAAkB,IAA0C,CAAC,GAAgC;CAC3G,IAAM,EAAE,qBAAkB,GAAiC,UAAO,GAAG,MAAS,GACxE,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA8B,GAAQ;EACpD,GAAG;EACH,SAAS,EAAK,WAAW;EACzB,OAAO;GACL,iBAAiB,MAAoB,KAAQ,KAAQ;GACrD,GAAG;EACL;CACF,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,39 @@
|
|
|
1
|
+
import { ConfigParameter, GetNotionalCapPageOptions, GetNotionalCapPageReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useNotionalCapPage}: the core query options plus an
|
|
6
|
+
* optional `config` and a `pollingInterval` knob layered on top of
|
|
7
|
+
* `query.refetchInterval`.
|
|
8
|
+
* @example const parameters: UseNotionalCapPageParameters = { offset: 100, pollingInterval: false };
|
|
9
|
+
*/
|
|
10
|
+
export type UseNotionalCapPageParameters = GetNotionalCapPageOptions & ConfigParameter & {
|
|
11
|
+
/**
|
|
12
|
+
* Polling cadence in milliseconds. Defaults to
|
|
13
|
+
* {@link DEFAULT_NOTIONAL_CAP_POLLING_MS}. Pass `false` to disable polling.
|
|
14
|
+
*/
|
|
15
|
+
pollingInterval?: number | false;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Query state for a cap page, including normalized SDK errors and refetch state.
|
|
19
|
+
* @example const result: UseNotionalCapPageReturnType = useNotionalCapPage({ limit: 50 });
|
|
20
|
+
*/
|
|
21
|
+
export type UseNotionalCapPageReturnType = UseQueryResult<GetNotionalCapPageReturnType, SymmioRequestError>;
|
|
22
|
+
/**
|
|
23
|
+
* Read one page of market notional caps. Surfaces the page-only
|
|
24
|
+
* `totalOpenInterest` / `totalUsed` plus the per-symbol rows.
|
|
25
|
+
*
|
|
26
|
+
* Polls every {@link DEFAULT_NOTIONAL_CAP_POLLING_MS} by default; pass
|
|
27
|
+
* `pollingInterval` to change or disable.
|
|
28
|
+
*
|
|
29
|
+
* @param parameters - Page limits, deployment, config and query overrides.
|
|
30
|
+
* @returns Query state containing one page of numeric-dollar caps.
|
|
31
|
+
* @throws {SymmioRequestError} Action failures are normalized in query error state.
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const { data } = useNotionalCapPage({ limit: 100, offset: 100 });
|
|
35
|
+
* console.log(data?.totalOpenInterest, data?.symbols.length);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function useNotionalCapPage(parameters?: UseNotionalCapPageParameters): UseNotionalCapPageReturnType;
|
|
39
|
+
//# sourceMappingURL=use-notional-cap-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-notional-cap-page.d.ts","sourceRoot":"","sources":["../../src/notional-cap/use-notional-cap-page.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,GAClE,eAAe,GAAG;IAChB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAClC,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC;AAE5G;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CAuB9G"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { DEFAULT_NOTIONAL_CAP_POLLING_MS as r } from "./use-notional-cap-by-symbol-id.js";
|
|
6
|
+
import { getNotionalCapPageQueryOptions as i } from "@symmio/trading-core";
|
|
7
|
+
import { useQuery as a } from "@tanstack/react-query";
|
|
8
|
+
//#region src/notional-cap/use-notional-cap-page.ts
|
|
9
|
+
function o(o = {}) {
|
|
10
|
+
let { pollingInterval: s = r, query: c, ...l } = o, u = t(o), d = e(), f = i(u, {
|
|
11
|
+
...l,
|
|
12
|
+
chainId: l.chainId ?? d,
|
|
13
|
+
query: {
|
|
14
|
+
refetchInterval: s === !1 ? !1 : s,
|
|
15
|
+
...c
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return a({
|
|
19
|
+
...f,
|
|
20
|
+
queryFn: async () => {
|
|
21
|
+
try {
|
|
22
|
+
return await f.queryFn();
|
|
23
|
+
} catch (e) {
|
|
24
|
+
throw n(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { o as useNotionalCapPage };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=use-notional-cap-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-notional-cap-page.js","names":[],"sources":["../../src/notional-cap/use-notional-cap-page.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getNotionalCapPageQueryOptions,\n type ConfigParameter,\n type GetNotionalCapPageOptions,\n type GetNotionalCapPageReturnType,\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\";\nimport { DEFAULT_NOTIONAL_CAP_POLLING_MS } from \"./use-notional-cap-by-symbol-id\";\n\n/**\n * Parameters for {@link useNotionalCapPage}: the core query options plus an\n * optional `config` and a `pollingInterval` knob layered on top of\n * `query.refetchInterval`.\n * @example const parameters: UseNotionalCapPageParameters = { offset: 100, pollingInterval: false };\n */\nexport type UseNotionalCapPageParameters = GetNotionalCapPageOptions &\n ConfigParameter & {\n /**\n * Polling cadence in milliseconds. Defaults to\n * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS}. Pass `false` to disable polling.\n */\n pollingInterval?: number | false;\n };\n\n/**\n * Query state for a cap page, including normalized SDK errors and refetch state.\n * @example const result: UseNotionalCapPageReturnType = useNotionalCapPage({ limit: 50 });\n */\nexport type UseNotionalCapPageReturnType = UseQueryResult<GetNotionalCapPageReturnType, SymmioRequestError>;\n\n/**\n * Read one page of market notional caps. Surfaces the page-only\n * `totalOpenInterest` / `totalUsed` plus the per-symbol rows.\n *\n * Polls every {@link DEFAULT_NOTIONAL_CAP_POLLING_MS} by default; pass\n * `pollingInterval` to change or disable.\n *\n * @param parameters - Page limits, deployment, config and query overrides.\n * @returns Query state containing one page of numeric-dollar caps.\n * @throws {SymmioRequestError} Action failures are normalized in query error state.\n * @example\n * ```tsx\n * const { data } = useNotionalCapPage({ limit: 100, offset: 100 });\n * console.log(data?.totalOpenInterest, data?.symbols.length);\n * ```\n */\nexport function useNotionalCapPage(parameters: UseNotionalCapPageParameters = {}): UseNotionalCapPageReturnType {\n const { pollingInterval = DEFAULT_NOTIONAL_CAP_POLLING_MS, query, ...rest } = parameters;\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getNotionalCapPageQueryOptions(config, {\n ...rest,\n chainId: rest.chainId ?? chainId,\n query: {\n refetchInterval: pollingInterval === false ? false : pollingInterval,\n ...query,\n },\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 UseNotionalCapPageReturnType;\n}\n"],"mappings":";;;;;;;;AAoDA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,EAAE,qBAAkB,GAAiC,UAAO,GAAG,MAAS,GACxE,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA+B,GAAQ;EACrD,GAAG;EACH,SAAS,EAAK,WAAW;EACzB,OAAO;GACL,iBAAiB,MAAoB,KAAQ,KAAQ;GACrD,GAAG;EACL;CACF,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"}
|
|
@@ -13,6 +13,8 @@ export type UseListingMarketsReturnType = UseQueryResult<GetListingMarketsReturn
|
|
|
13
13
|
* parameter and the hook refetches under a new query key rather than filtering
|
|
14
14
|
* an already-fetched page in the client. Pass
|
|
15
15
|
* `marketStatus: ListingMarketStatus.LISTED` to see only tradable markets.
|
|
16
|
+
* Use `isLocked: false` for unlocked markets, `true` for locked markets, or
|
|
17
|
+
* omit it for both. The filter is included in the query key.
|
|
16
18
|
*
|
|
17
19
|
* Every money and rate field on a row is a `bigint` at `LISTING_VALUE_DECIMALS`
|
|
18
20
|
* (18); `null` means the service reported no value, not zero. Errors are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-listing-markets.d.ts","sourceRoot":"","sources":["../../src/pools/use-listing-markets.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,kGAAkG;AAClG,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,GAAG,eAAe,CAAC;AAErF,iFAAiF;AACjF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;AAE1G
|
|
1
|
+
{"version":3,"file":"use-listing-markets.d.ts","sourceRoot":"","sources":["../../src/pools/use-listing-markets.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,kGAAkG;AAClG,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,GAAG,eAAe,CAAC;AAErF,iFAAiF;AACjF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,GAAE,2BAAgC,GAAG,2BAA2B,CAkB3G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-listing-markets.js","names":[],"sources":["../../src/pools/use-listing-markets.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getListingMarketsQueryOptions,\n type ConfigParameter,\n type GetListingMarketsOptions,\n type GetListingMarketsReturnType,\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 useListingMarkets}: the core query options plus an optional `config`. */\nexport type UseListingMarketsParameters = GetListingMarketsOptions & ConfigParameter;\n\n/** Return type of {@link useListingMarkets}: one page of the listing catalog. */\nexport type UseListingMarketsReturnType = UseQueryResult<GetListingMarketsReturnType, SymmioRequestError>;\n\n/**\n * Read a page of the permissionless-listing market catalog — the data behind a\n * pools list.\n *\n * Search, filtering, sorting, and pagination are all server-side: change a\n * parameter and the hook refetches under a new query key rather than filtering\n * an already-fetched page in the client. Pass\n * `marketStatus: ListingMarketStatus.LISTED` to see only tradable markets.\n *\n * Every money and rate field on a row is a `bigint` at `LISTING_VALUE_DECIMALS`\n * (18); `null` means the service reported no value, not zero. Errors are\n * normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data, isPending } = useListingMarkets({\n * marketStatus: ListingMarketStatus.LISTED,\n * sortBy: \"tvl\",\n * limit: 25,\n * offset: page * 25,\n * });\n * ```\n */\nexport function useListingMarkets(parameters: UseListingMarketsParameters = {}): UseListingMarketsReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getListingMarketsQueryOptions(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 UseListingMarketsReturnType;\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"use-listing-markets.js","names":[],"sources":["../../src/pools/use-listing-markets.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getListingMarketsQueryOptions,\n type ConfigParameter,\n type GetListingMarketsOptions,\n type GetListingMarketsReturnType,\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 useListingMarkets}: the core query options plus an optional `config`. */\nexport type UseListingMarketsParameters = GetListingMarketsOptions & ConfigParameter;\n\n/** Return type of {@link useListingMarkets}: one page of the listing catalog. */\nexport type UseListingMarketsReturnType = UseQueryResult<GetListingMarketsReturnType, SymmioRequestError>;\n\n/**\n * Read a page of the permissionless-listing market catalog — the data behind a\n * pools list.\n *\n * Search, filtering, sorting, and pagination are all server-side: change a\n * parameter and the hook refetches under a new query key rather than filtering\n * an already-fetched page in the client. Pass\n * `marketStatus: ListingMarketStatus.LISTED` to see only tradable markets.\n * Use `isLocked: false` for unlocked markets, `true` for locked markets, or\n * omit it for both. The filter is included in the query key.\n *\n * Every money and rate field on a row is a `bigint` at `LISTING_VALUE_DECIMALS`\n * (18); `null` means the service reported no value, not zero. Errors are\n * normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data, isPending } = useListingMarkets({\n * marketStatus: ListingMarketStatus.LISTED,\n * sortBy: \"tvl\",\n * limit: 25,\n * offset: page * 25,\n * });\n * ```\n */\nexport function useListingMarkets(parameters: UseListingMarketsParameters = {}): UseListingMarketsReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getListingMarketsQueryOptions(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 UseListingMarketsReturnType;\n}\n"],"mappings":";;;;;;;AA6CA,SAAgB,EAAkB,IAA0C,CAAC,GAAgC;CAC3G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA8B,GAAQ;EACpD,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"}
|
package/dist/quotes/index.d.ts
CHANGED
|
@@ -9,9 +9,11 @@ export * from './use-force-close.js';
|
|
|
9
9
|
export * from './use-force-close-eligibility.js';
|
|
10
10
|
export * from './use-force-close-params.js';
|
|
11
11
|
export * from './use-grouped-quotes.js';
|
|
12
|
+
export * from './use-is-party-a-liquidated.js';
|
|
12
13
|
export * from './use-limit-orders.js';
|
|
13
14
|
export * from './use-managed-quotes.js';
|
|
14
15
|
export * from './use-party-a-open-positions.js';
|
|
16
|
+
export * from './use-party-a-open-positions-batch.js';
|
|
15
17
|
export * from './use-party-a-pending-quotes.js';
|
|
16
18
|
export * from './use-quote.js';
|
|
17
19
|
export * from './use-quote-events-by-type.js';
|
|
@@ -29,4 +31,5 @@ export * from './use-quotes-pending-funding.js';
|
|
|
29
31
|
export * from './use-request-to-cancel-close-request.js';
|
|
30
32
|
export * from './use-request-to-cancel-quote.js';
|
|
31
33
|
export * from './use-subgraph-query.js';
|
|
34
|
+
export * from './use-subgraph-quotes.js';
|
|
32
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/quotes/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/quotes/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConfigParameter, IsPartyALiquidatedOptions, IsPartyALiquidatedReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useIsPartyALiquidated}: the core query options (partyA,
|
|
6
|
+
* chain id, TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseIsPartyALiquidatedParameters = IsPartyALiquidatedOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link useIsPartyALiquidated}. */
|
|
10
|
+
export type UseIsPartyALiquidatedReturnType = UseQueryResult<IsPartyALiquidatedReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Read whether a partyA is **in liquidation** right now — `true` from the moment
|
|
13
|
+
* a liquidator starts its liquidation until that liquidation is finalized. While
|
|
14
|
+
* it is `true` the account is frozen and actions on its positions revert. The
|
|
15
|
+
* query is disabled until `partyA` is set. `chainId` defaults to the connected
|
|
16
|
+
* chain. Errors are normalized to {@link SymmioRequestError}.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const { data: inLiquidation } = useIsPartyALiquidated({ partyA: virtualAccount });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useIsPartyALiquidated(parameters?: UseIsPartyALiquidatedParameters): UseIsPartyALiquidatedReturnType;
|
|
24
|
+
//# sourceMappingURL=use-is-party-a-liquidated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-party-a-liquidated.d.ts","sourceRoot":"","sources":["../../src/quotes/use-is-party-a-liquidated.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GAAG,yBAAyB,GAAG,eAAe,CAAC;AAE1F,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC;AAE/G;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,GAAE,+BAAoC,GAC/C,+BAA+B,CAkBjC"}
|
|
@@ -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 { isPartyALiquidatedQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/quotes/use-is-party-a-liquidated.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 useIsPartyALiquidated };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-is-party-a-liquidated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-party-a-liquidated.js","names":[],"sources":["../../src/quotes/use-is-party-a-liquidated.ts"],"sourcesContent":["\"use client\";\n\nimport {\n isPartyALiquidatedQueryOptions,\n type ConfigParameter,\n type IsPartyALiquidatedOptions,\n type IsPartyALiquidatedReturnType,\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/**\n * Parameters for {@link useIsPartyALiquidated}: the core query options (partyA,\n * chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseIsPartyALiquidatedParameters = IsPartyALiquidatedOptions & ConfigParameter;\n\n/** Return type of {@link useIsPartyALiquidated}. */\nexport type UseIsPartyALiquidatedReturnType = UseQueryResult<IsPartyALiquidatedReturnType, SymmioRequestError>;\n\n/**\n * Read whether a partyA is **in liquidation** right now — `true` from the moment\n * a liquidator starts its liquidation until that liquidation is finalized. While\n * it is `true` the account is frozen and actions on its positions revert. The\n * query is disabled until `partyA` is set. `chainId` defaults to the connected\n * chain. Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: inLiquidation } = useIsPartyALiquidated({ partyA: virtualAccount });\n * ```\n */\nexport function useIsPartyALiquidated(\n parameters: UseIsPartyALiquidatedParameters = {},\n): UseIsPartyALiquidatedReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = isPartyALiquidatedQueryOptions(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 UseIsPartyALiquidatedReturnType;\n}\n"],"mappings":";;;;;;;AAmCA,SAAgB,EACd,IAA8C,CAAC,GACd;CACjC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA+B,GAAQ;EACrD,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,30 @@
|
|
|
1
|
+
import { ConfigParameter, GetPartyAOpenPositionsBatchOptions, GetPartyAOpenPositionsBatchReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link usePartyAOpenPositionsBatch}: the core query options
|
|
6
|
+
* (accounts, page size, liquidation flag, batch size, chain id, TanStack `query`
|
|
7
|
+
* overrides) plus an optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UsePartyAOpenPositionsBatchParameters = GetPartyAOpenPositionsBatchOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link usePartyAOpenPositionsBatch}: one result per account, in input order. */
|
|
11
|
+
export type UsePartyAOpenPositionsBatchReturnType = UseQueryResult<GetPartyAOpenPositionsBatchReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read the open positions of **many** partyAs (e.g. every virtual account of a
|
|
14
|
+
* sub-account) in chunked multicalls. Each entry is a `success` (with `quotes`,
|
|
15
|
+
* `hasMore`, and — with `includeLiquidationStatus` — `isLiquidated`) or a
|
|
16
|
+
* `failure` for an account whose read reverted; one bad account never fails the
|
|
17
|
+
* others. The query stays idle while `partyAs` is empty. `chainId` defaults to
|
|
18
|
+
* the connected chain. Errors are normalized to {@link SymmioRequestError}.
|
|
19
|
+
*
|
|
20
|
+
* Not live: invalidate with `getPartyAOpenPositionsBatchQueryKey` (e.g. via
|
|
21
|
+
* `predicateMatch`) when your app learns a position changed.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const { data } = usePartyAOpenPositionsBatch({ partyAs: virtualAccounts, includeLiquidationStatus: true });
|
|
26
|
+
* const quotes = data?.flatMap((r) => (r.status === "success" && !r.isLiquidated ? r.quotes : [])) ?? [];
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function usePartyAOpenPositionsBatch(parameters: UsePartyAOpenPositionsBatchParameters): UsePartyAOpenPositionsBatchReturnType;
|
|
30
|
+
//# sourceMappingURL=use-party-a-open-positions-batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-party-a-open-positions-batch.d.ts","sourceRoot":"","sources":["../../src/quotes/use-party-a-open-positions-batch.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,kCAAkC,EACvC,KAAK,qCAAqC,EAC3C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;GAIG;AACH,MAAM,MAAM,qCAAqC,GAAG,kCAAkC,GAAG,eAAe,CAAC;AAEzG,kGAAkG;AAClG,MAAM,MAAM,qCAAqC,GAAG,cAAc,CAChE,qCAAqC,EACrC,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,qCAAqC,GAChD,qCAAqC,CAkBvC"}
|
|
@@ -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 { getPartyAOpenPositionsBatchQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/quotes/use-party-a-open-positions-batch.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 usePartyAOpenPositionsBatch };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-party-a-open-positions-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-party-a-open-positions-batch.js","names":[],"sources":["../../src/quotes/use-party-a-open-positions-batch.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getPartyAOpenPositionsBatchQueryOptions,\n type ConfigParameter,\n type GetPartyAOpenPositionsBatchOptions,\n type GetPartyAOpenPositionsBatchReturnType,\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/**\n * Parameters for {@link usePartyAOpenPositionsBatch}: the core query options\n * (accounts, page size, liquidation flag, batch size, chain id, TanStack `query`\n * overrides) plus an optional `config`.\n */\nexport type UsePartyAOpenPositionsBatchParameters = GetPartyAOpenPositionsBatchOptions & ConfigParameter;\n\n/** Return type of {@link usePartyAOpenPositionsBatch}: one result per account, in input order. */\nexport type UsePartyAOpenPositionsBatchReturnType = UseQueryResult<\n GetPartyAOpenPositionsBatchReturnType,\n SymmioRequestError\n>;\n\n/**\n * Read the open positions of **many** partyAs (e.g. every virtual account of a\n * sub-account) in chunked multicalls. Each entry is a `success` (with `quotes`,\n * `hasMore`, and — with `includeLiquidationStatus` — `isLiquidated`) or a\n * `failure` for an account whose read reverted; one bad account never fails the\n * others. The query stays idle while `partyAs` is empty. `chainId` defaults to\n * the connected chain. Errors are normalized to {@link SymmioRequestError}.\n *\n * Not live: invalidate with `getPartyAOpenPositionsBatchQueryKey` (e.g. via\n * `predicateMatch`) when your app learns a position changed.\n *\n * @example\n * ```tsx\n * const { data } = usePartyAOpenPositionsBatch({ partyAs: virtualAccounts, includeLiquidationStatus: true });\n * const quotes = data?.flatMap((r) => (r.status === \"success\" && !r.isLiquidated ? r.quotes : [])) ?? [];\n * ```\n */\nexport function usePartyAOpenPositionsBatch(\n parameters: UsePartyAOpenPositionsBatchParameters,\n): UsePartyAOpenPositionsBatchReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getPartyAOpenPositionsBatchQueryOptions(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 UsePartyAOpenPositionsBatchReturnType;\n}\n"],"mappings":";;;;;;;AA4CA,SAAgB,EACd,GACuC;CACvC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAwC,GAAQ;EAC9D,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,12 +1,17 @@
|
|
|
1
|
-
import { ConfigParameter, GetQuoteEventsByTypeOptions, GetQuoteEventsByTypeReturnType } from '@symmio/trading-core';
|
|
1
|
+
import { ConfigParameter, GetQuoteEventsByTypeOptions, GetQuoteEventsByTypeReturnType, QuoteEventType } from '@symmio/trading-core';
|
|
2
2
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
3
|
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for {@link useQuoteEventsByType}: the core query options (quote id,
|
|
6
|
-
* types, paging, sort, chain id, TanStack `query` overrides) plus an
|
|
7
|
-
* `config`.
|
|
6
|
+
* types, diamond, paging, sort, chain id, TanStack `query` overrides) plus an
|
|
7
|
+
* optional `config`. This hook reads the price and funding events
|
|
8
|
+
* ({@link QuoteEventType}), so `types` is required here; read any other subgraph
|
|
9
|
+
* event type with the core `getQuoteEventsByType`.
|
|
8
10
|
*/
|
|
9
|
-
export type UseQuoteEventsByTypeParameters = GetQuoteEventsByTypeOptions & ConfigParameter
|
|
11
|
+
export type UseQuoteEventsByTypeParameters = Omit<GetQuoteEventsByTypeOptions<QuoteEventType>, "types"> & ConfigParameter & {
|
|
12
|
+
/** Event types to include — e.g. {@link PRICE_HISTORY_EVENT_TYPES}. */
|
|
13
|
+
types: readonly QuoteEventType[];
|
|
14
|
+
};
|
|
10
15
|
/** Return type of {@link useQuoteEventsByType}. */
|
|
11
16
|
export type UseQuoteEventsByTypeReturnType = UseQueryResult<GetQuoteEventsByTypeReturnType, SymmioRequestError>;
|
|
12
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-quote-events-by-type.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote-events-by-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,
|
|
1
|
+
{"version":3,"file":"use-quote-events-by-type.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote-events-by-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;;;GAMG;AACH,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAAC,2BAA2B,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,GACrG,eAAe,GAAG;IAChB,uEAAuE;IACvE,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;CAClC,CAAC;AAEJ,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAAC;AAEhH;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,8BAA8B,GAAG,8BAA8B,CAkB/G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-quote-events-by-type.js","names":[],"sources":["../../src/quotes/use-quote-events-by-type.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteEventsByTypeQueryOptions,\n type ConfigParameter,\n type GetQuoteEventsByTypeOptions,\n type GetQuoteEventsByTypeReturnType,\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/**\n * Parameters for {@link useQuoteEventsByType}: the core query options (quote id,\n * types, paging, sort, chain id, TanStack `query` overrides) plus an optional\n * `
|
|
1
|
+
{"version":3,"file":"use-quote-events-by-type.js","names":[],"sources":["../../src/quotes/use-quote-events-by-type.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteEventsByTypeQueryOptions,\n type ConfigParameter,\n type GetQuoteEventsByTypeOptions,\n type GetQuoteEventsByTypeReturnType,\n type QuoteEventType,\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/**\n * Parameters for {@link useQuoteEventsByType}: the core query options (quote id,\n * types, diamond, paging, sort, chain id, TanStack `query` overrides) plus an\n * optional `config`. This hook reads the price and funding events\n * ({@link QuoteEventType}), so `types` is required here; read any other subgraph\n * event type with the core `getQuoteEventsByType`.\n */\nexport type UseQuoteEventsByTypeParameters = Omit<GetQuoteEventsByTypeOptions<QuoteEventType>, \"types\"> &\n ConfigParameter & {\n /** Event types to include — e.g. {@link PRICE_HISTORY_EVENT_TYPES}. */\n types: readonly QuoteEventType[];\n };\n\n/** Return type of {@link useQuoteEventsByType}. */\nexport type UseQuoteEventsByTypeReturnType = UseQueryResult<GetQuoteEventsByTypeReturnType, SymmioRequestError>;\n\n/**\n * Read non-terminal `QuoteEvent`s for one quote from the analytics subgraph,\n * filtered to the requested event types. Pair with {@link PRICE_HISTORY_EVENT_TYPES}\n * (or call {@link useQuotePriceHistory} for that preset filter).\n *\n * `chainId` defaults to the connected chain. Errors normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useQuoteEventsByType({ quoteId: quote.quoteId, types: PRICE_HISTORY_EVENT_TYPES });\n * ```\n */\nexport function useQuoteEventsByType(parameters: UseQuoteEventsByTypeParameters): UseQuoteEventsByTypeReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getQuoteEventsByTypeQueryOptions(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 UseQuoteEventsByTypeReturnType;\n}\n"],"mappings":";;;;;;;AA4CA,SAAgB,EAAqB,GAA4E;CAC/G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAiC,GAAQ;EACvD,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,28 @@
|
|
|
1
|
+
import { ConfigParameter, GetSubgraphQuotesOptions, GetSubgraphQuotesReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useSubgraphQuotes}: the core query options (filters, paging,
|
|
6
|
+
* sort, chain id, TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseSubgraphQuotesParameters = GetSubgraphQuotesOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link useSubgraphQuotes}: one page of rows plus `hasMore`. */
|
|
10
|
+
export type UseSubgraphQuotesReturnType = UseQueryResult<GetSubgraphQuotesReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Read the analytics subgraph's `Quote` entities as indexed
|
|
13
|
+
* (`getSubgraphQuotes`) — funding index, settled funding totals, lifecycle
|
|
14
|
+
* timestamps. For the live on-chain struct use {@link useQuote}.
|
|
15
|
+
*
|
|
16
|
+
* `chainId` defaults to the connected chain. Errors normalized to
|
|
17
|
+
* {@link SymmioRequestError}.
|
|
18
|
+
*
|
|
19
|
+
* @param parameters - Filters, paging, sort, optional chain id and config.
|
|
20
|
+
* @returns The TanStack query result.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const { data } = useSubgraphQuotes({ quoteIds: [quote.quoteId], source: diamond });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function useSubgraphQuotes(parameters?: UseSubgraphQuotesParameters): UseSubgraphQuotesReturnType;
|
|
28
|
+
//# sourceMappingURL=use-subgraph-quotes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-subgraph-quotes.d.ts","sourceRoot":"","sources":["../../src/quotes/use-subgraph-quotes.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,GAAG,eAAe,CAAC;AAErF,iFAAiF;AACjF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,2BAA2B,EAAE,kBAAkB,CAAC,CAAC;AAE1G;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,GAAE,2BAAgC,GAAG,2BAA2B,CAkB3G"}
|
|
@@ -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 { getSubgraphQuotesQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/quotes/use-subgraph-quotes.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 useSubgraphQuotes };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-subgraph-quotes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-subgraph-quotes.js","names":[],"sources":["../../src/quotes/use-subgraph-quotes.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getSubgraphQuotesQueryOptions,\n type ConfigParameter,\n type GetSubgraphQuotesOptions,\n type GetSubgraphQuotesReturnType,\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/**\n * Parameters for {@link useSubgraphQuotes}: the core query options (filters, paging,\n * sort, chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseSubgraphQuotesParameters = GetSubgraphQuotesOptions & ConfigParameter;\n\n/** Return type of {@link useSubgraphQuotes}: one page of rows plus `hasMore`. */\nexport type UseSubgraphQuotesReturnType = UseQueryResult<GetSubgraphQuotesReturnType, SymmioRequestError>;\n\n/**\n * Read the analytics subgraph's `Quote` entities as indexed\n * (`getSubgraphQuotes`) — funding index, settled funding totals, lifecycle\n * timestamps. For the live on-chain struct use {@link useQuote}.\n *\n * `chainId` defaults to the connected chain. Errors normalized to\n * {@link SymmioRequestError}.\n *\n * @param parameters - Filters, paging, sort, optional chain id and config.\n * @returns The TanStack query result.\n *\n * @example\n * ```tsx\n * const { data } = useSubgraphQuotes({ quoteIds: [quote.quoteId], source: diamond });\n * ```\n */\nexport function useSubgraphQuotes(parameters: UseSubgraphQuotesParameters = {}): UseSubgraphQuotesReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getSubgraphQuotesQueryOptions(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 UseSubgraphQuotesReturnType;\n}\n"],"mappings":";;;;;;;AAuCA,SAAgB,EAAkB,IAA0C,CAAC,GAAgC;CAC3G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA8B,GAAQ;EACpD,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symmio/trading-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "React adapter for the SYMMIO SDK. Hooks, providers, and React-bound ergonomics on top of @symmio/trading-core.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/SYMM-IO/Trading-SDK/tree/main/packages/trading-react#readme",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@tanstack/react-query": "^5.100.0",
|
|
92
92
|
"decimal.js": "^10.4.3",
|
|
93
93
|
"zustand": "^5.0.0",
|
|
94
|
-
"@symmio/trading-core": "^
|
|
94
|
+
"@symmio/trading-core": "^4.1.0"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
97
|
"react": "^19.0.0",
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
"vite-plugin-dts": "^5.0.0",
|
|
118
118
|
"vitest": "^4.1.10",
|
|
119
119
|
"wagmi": "^3.4.2",
|
|
120
|
-
"@symmio/
|
|
121
|
-
"@symmio/
|
|
120
|
+
"@symmio/typescript-config": "^1.0.0",
|
|
121
|
+
"@symmio/eslint-config": "^1.0.0"
|
|
122
122
|
},
|
|
123
123
|
"scripts": {
|
|
124
124
|
"build": "vite build && node ../../scripts/fix-dts-extensions.mjs dist",
|