@symmio/trading-react 3.1.0 → 3.3.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 (47) hide show
  1. package/dist/estimated-price/use-estimated-price.d.ts +6 -3
  2. package/dist/estimated-price/use-estimated-price.d.ts.map +1 -1
  3. package/dist/estimated-price/use-estimated-price.js +12 -9
  4. package/dist/estimated-price/use-estimated-price.js.map +1 -1
  5. package/dist/index.d.ts +7 -7
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +193 -190
  8. package/dist/instant-layer/get-instant-open-funding-error.d.ts +5 -0
  9. package/dist/instant-layer/get-instant-open-funding-error.d.ts.map +1 -0
  10. package/dist/instant-layer/get-instant-open-funding-error.js +15 -0
  11. package/dist/instant-layer/get-instant-open-funding-error.js.map +1 -0
  12. package/dist/instant-layer/index.d.ts +2 -0
  13. package/dist/instant-layer/index.d.ts.map +1 -1
  14. package/dist/instant-layer/index.js +18 -16
  15. package/dist/instant-layer/use-instant-close-fees.d.ts +46 -0
  16. package/dist/instant-layer/use-instant-close-fees.d.ts.map +1 -0
  17. package/dist/instant-layer/use-instant-close-fees.js +83 -0
  18. package/dist/instant-layer/use-instant-close-fees.js.map +1 -0
  19. package/dist/instant-layer/use-instant-open-auto.d.ts +8 -3
  20. package/dist/instant-layer/use-instant-open-auto.d.ts.map +1 -1
  21. package/dist/instant-layer/use-instant-open-auto.js.map +1 -1
  22. package/dist/instant-layer/use-instant-open-fees.d.ts +40 -10
  23. package/dist/instant-layer/use-instant-open-fees.d.ts.map +1 -1
  24. package/dist/instant-layer/use-instant-open-fees.js +23 -98
  25. package/dist/instant-layer/use-instant-open-fees.js.map +1 -1
  26. package/dist/instant-layer/use-instant-open-inputs.d.ts +37 -0
  27. package/dist/instant-layer/use-instant-open-inputs.d.ts.map +1 -0
  28. package/dist/instant-layer/use-instant-open-inputs.js +136 -0
  29. package/dist/instant-layer/use-instant-open-inputs.js.map +1 -0
  30. package/dist/instant-layer/use-instant-open-with-tpsl.d.ts +6 -0
  31. package/dist/instant-layer/use-instant-open-with-tpsl.d.ts.map +1 -1
  32. package/dist/instant-layer/use-instant-open-with-tpsl.js.map +1 -1
  33. package/dist/instant-layer/use-prepare-instant-open-params.d.ts +78 -0
  34. package/dist/instant-layer/use-prepare-instant-open-params.d.ts.map +1 -0
  35. package/dist/instant-layer/use-prepare-instant-open-params.js +38 -0
  36. package/dist/instant-layer/use-prepare-instant-open-params.js.map +1 -0
  37. package/dist/margin/use-available-instant-open-margin.d.ts +3 -2
  38. package/dist/margin/use-available-instant-open-margin.d.ts.map +1 -1
  39. package/dist/margin/use-available-instant-open-margin.js +0 -1
  40. package/dist/margin/use-available-instant-open-margin.js.map +1 -1
  41. package/dist/solvers/index.d.ts +1 -0
  42. package/dist/solvers/index.d.ts.map +1 -1
  43. package/dist/solvers/use-solver-info.d.ts +14 -0
  44. package/dist/solvers/use-solver-info.d.ts.map +1 -0
  45. package/dist/solvers/use-solver-info.js +27 -0
  46. package/dist/solvers/use-solver-info.js.map +1 -0
  47. package/package.json +2 -2
@@ -0,0 +1,46 @@
1
+ import { ConfigParameter, GetInstantCloseFeesOptions, GetInstantCloseFeesReturnType } 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 useInstantCloseFees}: the close intent
6
+ * (`subAccountAddress`, `market`, `quantity`, `openedAt`, optional pre-fetched
7
+ * data, TanStack `query` overrides) plus an optional `config`.
8
+ */
9
+ export type UseInstantCloseFeesParameters = GetInstantCloseFeesOptions & ConfigParameter;
10
+ /** Return type of {@link useInstantCloseFees}. */
11
+ export type UseInstantCloseFeesReturnType = UseQueryResult<GetInstantCloseFeesReturnType, SymmioRequestError>;
12
+ /**
13
+ * Preview every fee closing a position pays **right now** — the platform close
14
+ * fee plus, on lowcap (Enigma), the holding-time solver close fee and the flat
15
+ * static close leg. Read-only; nothing is signed. This is the close-flow
16
+ * counterpart of `useInstantOpenFees`, which deliberately previews only the
17
+ * open-side legs: the honest close cost exists only at close time, where the
18
+ * notional and the decaying solver rate are real.
19
+ *
20
+ * Wraps `getInstantCloseFees`, but **pre-fetches every input through its own
21
+ * cached queries and passes them in as prefills**, so the query function is
22
+ * pure math with zero network hops: market metadata (`useMarkets`), on-chain
23
+ * fee rates (`useFeeForUser`), and the solver's static fees (`useSolverInfo`)
24
+ * are slow-moving and cached for minutes; the mark price rides the shared
25
+ * price stream. Previous data is kept while inputs move, so a mark-price tick
26
+ * updates the numbers in place.
27
+ *
28
+ * The holding time is stamped each time the query function runs, so a refetch
29
+ * after the position ages re-prices the decaying solver close fee; pass `now`
30
+ * for a deterministic preview. Narrow on `kind` to reach the lowcap-only legs
31
+ * (`closeSolverFee`, `closeSolverFeeRate`, `holdingSeconds`,
32
+ * `staticSolverFeeClose`).
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * const { data: fees } = useInstantCloseFees({
37
+ * subAccountAddress: partyA,
38
+ * market: { id: symbolId },
39
+ * quantity: quantityToClose,
40
+ * openedAt: position.createTimestamp,
41
+ * });
42
+ * // fees?.totalFee; fees?.kind === "enigma" && fees.closeSolverFee
43
+ * ```
44
+ */
45
+ export declare function useInstantCloseFees(parameters: UseInstantCloseFeesParameters): UseInstantCloseFeesReturnType;
46
+ //# sourceMappingURL=use-instant-close-fees.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-instant-close-fees.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-close-fees.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAQzE;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,0BAA0B,GAAG,eAAe,CAAC;AAEzF,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,6BAA6B,EAAE,kBAAkB,CAAC,CAAC;AAE9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,6BAA6B,GAAG,6BAA6B,CAqH5G"}
@@ -0,0 +1,83 @@
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 { useFeeForUser as r } from "../fees/use-fee-for-user.js";
6
+ import { useMarkets as i } from "../markets/use-markets.js";
7
+ import { usePriceByName as a } from "../price-service/use-price-by-name.js";
8
+ import { useSolverInfo as o } from "../solvers/use-solver-info.js";
9
+ import { getInstantCloseFeesQueryOptions as s } from "@symmio/trading-core";
10
+ import { useQuery as c } from "@tanstack/react-query";
11
+ //#region src/instant-layer/use-instant-close-fees.ts
12
+ function l(l) {
13
+ let u = t(l), d = e(), f = l.chainId ?? d, { subAccountAddress: p, market: m, quantity: h, openedAt: g, now: _, solverId: v } = l, y = (l.query?.enabled ?? !0) && h.length > 0, b = u.getSolver({
14
+ chainId: f,
15
+ solverId: v
16
+ }).id === "enigma", x = i({
17
+ config: l.config,
18
+ chainId: f,
19
+ solverId: v,
20
+ query: {
21
+ enabled: y,
22
+ staleTime: 3e5
23
+ }
24
+ }).data?.find((e) => e.symbolId === m.id), S = m.name ?? x?.name, C = m.pricePrecision ?? x?.pricePrecision, w = m.quantityPrecision ?? x?.quantityPrecision, T = m.hedgerFeeOpen ?? x?.hedgerFeeOpen, E = m.hedgerFeeClose ?? x?.hedgerFeeClose, D = x?.kind === "enigma" ? x : void 0, O = m.hedgerFeeCloseEarlyRate ?? D?.hedgerFeeCloseEarlyRate ?? E, k = m.hedgerFeeCloseEarlyThreshold ?? D?.hedgerFeeCloseEarlyThreshold ?? 0, A = m.hedgerFeeCloseStandardThreshold ?? D?.hedgerFeeCloseStandardThreshold ?? 0, j = r({
25
+ config: l.config,
26
+ chainId: f,
27
+ user: p,
28
+ symbolId: BigInt(m.id),
29
+ query: {
30
+ enabled: y && l.feeRates === void 0,
31
+ staleTime: 3e5
32
+ }
33
+ }), M = l.feeRates ?? j.data, N = o({
34
+ config: l.config,
35
+ chainId: f,
36
+ solverId: v,
37
+ query: { enabled: y && b && l.solverInfo === void 0 }
38
+ }), P = b ? l.solverInfo ?? N.data ?? (N.isError ? {} : void 0) : void 0, F = !b || P !== void 0, I = a({
39
+ name: S,
40
+ solverId: v,
41
+ enabled: y && l.markPrice === void 0
42
+ }), L = l.markPrice ?? I.markPrice ?? void 0, R = y && S !== void 0 && C !== void 0 && w !== void 0 && M !== void 0 && L !== void 0 && (!b || T !== void 0 && E !== void 0) && F, z = s(u, {
43
+ subAccountAddress: p,
44
+ solverId: v,
45
+ chainId: f,
46
+ market: {
47
+ id: m.id,
48
+ name: S,
49
+ pricePrecision: C,
50
+ quantityPrecision: w,
51
+ hedgerFeeOpen: T,
52
+ hedgerFeeClose: E,
53
+ hedgerFeeCloseEarlyRate: O,
54
+ hedgerFeeCloseEarlyThreshold: k,
55
+ hedgerFeeCloseStandardThreshold: A
56
+ },
57
+ quantity: h,
58
+ openedAt: g,
59
+ now: _,
60
+ markPrice: L,
61
+ feeRates: M,
62
+ solverInfo: P,
63
+ query: {
64
+ ...l.query,
65
+ enabled: R,
66
+ placeholderData: (e) => e
67
+ }
68
+ });
69
+ return c({
70
+ ...z,
71
+ queryFn: async () => {
72
+ try {
73
+ return await z.queryFn();
74
+ } catch (e) {
75
+ throw n(e);
76
+ }
77
+ }
78
+ });
79
+ }
80
+ //#endregion
81
+ export { l as useInstantCloseFees };
82
+
83
+ //# sourceMappingURL=use-instant-close-fees.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-instant-close-fees.js","names":[],"sources":["../../src/instant-layer/use-instant-close-fees.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantCloseFeesQueryOptions,\n type ConfigParameter,\n type GetInstantCloseFeesOptions,\n type GetInstantCloseFeesReturnType,\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 { useFeeForUser } from \"../fees/use-fee-for-user\";\nimport { useMarkets } from \"../markets/use-markets\";\nimport { usePriceByName } from \"../price-service/use-price-by-name\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { useSolverInfo } from \"../solvers/use-solver-info\";\n\n/**\n * Parameters for {@link useInstantCloseFees}: the close intent\n * (`subAccountAddress`, `market`, `quantity`, `openedAt`, optional pre-fetched\n * data, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseInstantCloseFeesParameters = GetInstantCloseFeesOptions & ConfigParameter;\n\n/** Return type of {@link useInstantCloseFees}. */\nexport type UseInstantCloseFeesReturnType = UseQueryResult<GetInstantCloseFeesReturnType, SymmioRequestError>;\n\n/**\n * Preview every fee closing a position pays **right now** — the platform close\n * fee plus, on lowcap (Enigma), the holding-time solver close fee and the flat\n * static close leg. Read-only; nothing is signed. This is the close-flow\n * counterpart of `useInstantOpenFees`, which deliberately previews only the\n * open-side legs: the honest close cost exists only at close time, where the\n * notional and the decaying solver rate are real.\n *\n * Wraps `getInstantCloseFees`, but **pre-fetches every input through its own\n * cached queries and passes them in as prefills**, so the query function is\n * pure math with zero network hops: market metadata (`useMarkets`), on-chain\n * fee rates (`useFeeForUser`), and the solver's static fees (`useSolverInfo`)\n * are slow-moving and cached for minutes; the mark price rides the shared\n * price stream. Previous data is kept while inputs move, so a mark-price tick\n * updates the numbers in place.\n *\n * The holding time is stamped each time the query function runs, so a refetch\n * after the position ages re-prices the decaying solver close fee; pass `now`\n * for a deterministic preview. Narrow on `kind` to reach the lowcap-only legs\n * (`closeSolverFee`, `closeSolverFeeRate`, `holdingSeconds`,\n * `staticSolverFeeClose`).\n *\n * @example\n * ```tsx\n * const { data: fees } = useInstantCloseFees({\n * subAccountAddress: partyA,\n * market: { id: symbolId },\n * quantity: quantityToClose,\n * openedAt: position.createTimestamp,\n * });\n * // fees?.totalFee; fees?.kind === \"enigma\" && fees.closeSolverFee\n * ```\n */\nexport function useInstantCloseFees(parameters: UseInstantCloseFeesParameters): UseInstantCloseFeesReturnType {\n const config = useSymmioConfig(parameters);\n const contextChainId = useSymmioChainId();\n const chainId = parameters.chainId ?? contextChainId;\n const { subAccountAddress, market, quantity, openedAt, now, solverId } = parameters;\n const enabled = (parameters.query?.enabled ?? true) && quantity.length > 0;\n\n /** The solver close-fee schedule and the static leg exist only on lowcap (Enigma) solvers. */\n const isLowcap = config.getSolver({ chainId, solverId }).id === \"enigma\";\n\n // Market metadata — slow-moving; dedupes with any other useMarkets on the page.\n const marketsQuery = useMarkets({\n config: parameters.config,\n chainId,\n solverId,\n query: { enabled, staleTime: 300_000 },\n });\n const resolvedMarket = marketsQuery.data?.find((entry) => entry.symbolId === market.id);\n const marketName = market.name ?? resolvedMarket?.name;\n const pricePrecision = market.pricePrecision ?? resolvedMarket?.pricePrecision;\n const quantityPrecision = market.quantityPrecision ?? resolvedMarket?.quantityPrecision;\n const hedgerFeeOpen = market.hedgerFeeOpen ?? resolvedMarket?.hedgerFeeOpen;\n const hedgerFeeClose = market.hedgerFeeClose ?? resolvedMarket?.hedgerFeeClose;\n\n // Time-decaying close-fee rates ride the same `useMarkets` read — they are\n // Enigma-only fields on `EnigmaMarket`, so narrow on `kind` before reading.\n const resolvedEnigmaMarket = resolvedMarket?.kind === \"enigma\" ? resolvedMarket : undefined;\n const hedgerFeeCloseEarlyRate =\n market.hedgerFeeCloseEarlyRate ?? resolvedEnigmaMarket?.hedgerFeeCloseEarlyRate ?? hedgerFeeClose;\n const hedgerFeeCloseEarlyThreshold =\n market.hedgerFeeCloseEarlyThreshold ?? resolvedEnigmaMarket?.hedgerFeeCloseEarlyThreshold ?? 0;\n const hedgerFeeCloseStandardThreshold =\n market.hedgerFeeCloseStandardThreshold ?? resolvedEnigmaMarket?.hedgerFeeCloseStandardThreshold ?? 0;\n\n // On-chain platform fee rates — contract state, changes rarely; cached hard.\n const feeQuery = useFeeForUser({\n config: parameters.config,\n chainId,\n user: subAccountAddress,\n symbolId: BigInt(market.id),\n query: { enabled: enabled && parameters.feeRates === undefined, staleTime: 300_000 },\n });\n const feeRates = parameters.feeRates ?? feeQuery.data;\n\n // Static close fee from the solver's `/info` config — lowcap only. Fail-soft:\n // an unreachable `/info` prices the static leg at \"0\" instead of blocking the\n // preview (mirrors the action's own resolver).\n const solverInfoQuery = useSolverInfo({\n config: parameters.config,\n chainId,\n solverId,\n query: { enabled: enabled && isLowcap && parameters.solverInfo === undefined },\n });\n const solverInfo = !isLowcap\n ? undefined\n : (parameters.solverInfo ?? solverInfoQuery.data ?? (solverInfoQuery.isError ? {} : undefined));\n const solverInfoSettled = !isLowcap || solverInfo !== undefined;\n\n // Mark price — caller's cache-hot value wins; otherwise the shared stream.\n const priceQuery = usePriceByName({\n name: marketName,\n solverId,\n enabled: enabled && parameters.markPrice === undefined,\n });\n const markPrice = parameters.markPrice ?? priceQuery.markPrice ?? undefined;\n\n // Every prefill present → the query function is pure math, zero fetches.\n const ready =\n enabled &&\n marketName !== undefined &&\n pricePrecision !== undefined &&\n quantityPrecision !== undefined &&\n feeRates !== undefined &&\n markPrice !== undefined &&\n (!isLowcap || (hedgerFeeOpen !== undefined && hedgerFeeClose !== undefined)) &&\n solverInfoSettled;\n\n const options = getInstantCloseFeesQueryOptions(config, {\n subAccountAddress,\n solverId,\n chainId,\n market: {\n id: market.id,\n name: marketName,\n pricePrecision,\n quantityPrecision,\n hedgerFeeOpen,\n hedgerFeeClose,\n hedgerFeeCloseEarlyRate,\n hedgerFeeCloseEarlyThreshold,\n hedgerFeeCloseStandardThreshold,\n },\n quantity,\n openedAt,\n now,\n markPrice,\n feeRates,\n solverInfo,\n query: {\n ...parameters.query,\n enabled: ready,\n // The mark price ticks often; keep showing the previous numbers while\n // the pure recompute runs instead of flashing a loader.\n placeholderData: (previous: GetInstantCloseFeesReturnType | undefined) => previous,\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 UseInstantCloseFeesReturnType;\n}\n"],"mappings":";;;;;;;;;;;AA6DA,SAAgB,EAAoB,GAA0E;CAC5G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAChC,EAAE,sBAAmB,WAAQ,aAAU,aAAU,QAAK,gBAAa,GACnE,KAAW,EAAW,OAAO,WAAW,OAAS,EAAS,SAAS,GAGnE,IAAW,EAAO,UAAU;EAAE;EAAS;CAAS,CAAC,EAAE,OAAO,UAS1D,IANe,EAAW;EAC9B,QAAQ,EAAW;EACnB;EACA;EACA,OAAO;GAAE;GAAS,WAAW;EAAQ;CACvC,CACuB,EAAa,MAAM,MAAM,MAAU,EAAM,aAAa,EAAO,EAAE,GAChF,IAAa,EAAO,QAAQ,GAAgB,MAC5C,IAAiB,EAAO,kBAAkB,GAAgB,gBAC1D,IAAoB,EAAO,qBAAqB,GAAgB,mBAChE,IAAgB,EAAO,iBAAiB,GAAgB,eACxD,IAAiB,EAAO,kBAAkB,GAAgB,gBAI1D,IAAuB,GAAgB,SAAS,WAAW,IAAiB,KAAA,GAC5E,IACJ,EAAO,2BAA2B,GAAsB,2BAA2B,GAC/E,IACJ,EAAO,gCAAgC,GAAsB,gCAAgC,GACzF,IACJ,EAAO,mCAAmC,GAAsB,mCAAmC,GAG/F,IAAW,EAAc;EAC7B,QAAQ,EAAW;EACnB;EACA,MAAM;EACN,UAAU,OAAO,EAAO,EAAE;EAC1B,OAAO;GAAE,SAAS,KAAW,EAAW,aAAa,KAAA;GAAW,WAAW;EAAQ;CACrF,CAAC,GACK,IAAW,EAAW,YAAY,EAAS,MAK3C,IAAkB,EAAc;EACpC,QAAQ,EAAW;EACnB;EACA;EACA,OAAO,EAAE,SAAS,KAAW,KAAY,EAAW,eAAe,KAAA,EAAU;CAC/E,CAAC,GACK,IAAc,IAEf,EAAW,cAAc,EAAgB,SAAS,EAAgB,UAAU,CAAC,IAAI,KAAA,KADlF,KAAA,GAEE,IAAoB,CAAC,KAAY,MAAe,KAAA,GAGhD,IAAa,EAAe;EAChC,MAAM;EACN;EACA,SAAS,KAAW,EAAW,cAAc,KAAA;CAC/C,CAAC,GACK,IAAY,EAAW,aAAa,EAAW,aAAa,KAAA,GAG5D,IACJ,KACA,MAAe,KAAA,KACf,MAAmB,KAAA,KACnB,MAAsB,KAAA,KACtB,MAAa,KAAA,KACb,MAAc,KAAA,MACb,CAAC,KAAa,MAAkB,KAAA,KAAa,MAAmB,KAAA,MACjE,GAEI,IAAU,EAAgC,GAAQ;EACtD;EACA;EACA;EACA,QAAQ;GACN,IAAI,EAAO;GACX,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;GACL,GAAG,EAAW;GACd,SAAS;GAGT,kBAAkB,MAAwD;EAC5E;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"}
@@ -17,13 +17,18 @@ export type UseInstantOpenAutoReturnType = UseMutationResult<InstantOpenReturnTy
17
17
  * submit — use {@link useInstantOpen} after calling
18
18
  * `prepareInstantOpenParams(config, …)` directly.
19
19
  *
20
+ * Funding is a one-of on the variables: a typed `initialMargin`, or
21
+ * `fund: { mode: "full-balance", balance }` (lowcap only) to deploy the whole
22
+ * balance into the position's VA with the quantity sized down to fit it —
23
+ * see `FullBalanceFunding` in `@symmio/trading-core`.
24
+ *
20
25
  * @example
21
26
  * ```tsx
22
27
  * const { mutateAsync } = useInstantOpenAuto();
23
28
  * await mutateAsync({
24
- * walletAddress, sessionKeyAddress, signTypedData,
25
- * marketId: 1, positionType: "LONG",
26
- * userInput: "100", leverage: 5, slippage: 1,
29
+ * subAccountAddress, from: sessionKeyAddress,
30
+ * market: { id: 1 }, positionType: PositionType.LONG,
31
+ * fund: { mode: "full-balance", balance: "100" }, leverage: 5, slippage: 1,
27
32
  * });
28
33
  * ```
29
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"use-instant-open-auto.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-auto.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CA2B9G"}
1
+ {"version":3,"file":"use-instant-open-auto.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-auto.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CA2B9G"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-instant-open-auto.js","names":[],"sources":["../../src/instant-layer/use-instant-open-auto.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryKey,\n instantOpenAutoMutationOptions,\n type ConfigParameter,\n type InstantOpenReturnType,\n type PrepareInstantOpenParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, 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\";\nimport { invalidateAccountBalances, predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useInstantOpenAuto}.\n */\nexport type UseInstantOpenAutoParameters = ConfigParameter;\n\n/** Return type of {@link useInstantOpenAuto}. */\nexport type UseInstantOpenAutoReturnType = UseMutationResult<\n InstantOpenReturnType,\n SymmioRequestError,\n PrepareInstantOpenParameters\n>;\n\n/**\n * Open a lowcap instant position via the wizard `instantOpenAuto` action.\n *\n * Friendly default: accepts the minimal trade intent and lets the SDK fetch\n * market metadata, mark price, locked params, and fee rates. Pre-fill any\n * optional field on the variables (e.g. cache-hot `markPrice`) to skip its\n * fetch. For full control — inspect / mutate resolved params between fetch and\n * submit — use {@link useInstantOpen} after calling\n * `prepareInstantOpenParams(config, …)` directly.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useInstantOpenAuto();\n * await mutateAsync({\n * walletAddress, sessionKeyAddress, signTypedData,\n * marketId: 1, positionType: \"LONG\",\n * userInput: \"100\", leverage: 5, slippage: 1,\n * });\n * ```\n */\nexport function useInstantOpenAuto(parameters: UseInstantOpenAutoParameters = {}): UseInstantOpenAutoReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = instantOpenAutoMutationOptions(config);\n\n return useMutation<InstantOpenReturnType, SymmioRequestError, PrepareInstantOpenParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n /**\n * A freshly submitted instant-open exists on the hedger but not in any\n * cached read yet. Invalidate the instant-opens feed so it refetches and\n * the optimistic row appears immediately — without waiting for a poll.\n */\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantOpensQueryKey, { configKey }) });\n /** The open locks margin and charges a fee — every balance read on this chain is now suspect. */\n invalidateAccountBalances(queryClient, { configKey });\n },\n });\n}\n"],"mappings":";;;;;;;;;AAgDA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA+B,CAAM;CAElD,OAAO,EAAqF;EAC1F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GAMjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GAGvE,AAFA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAyB,EAAE,aAAU,CAAC,EAAE,CAAC,GAExG,EAA0B,GAAa,EAAE,aAAU,CAAC;EACtD;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-instant-open-auto.js","names":[],"sources":["../../src/instant-layer/use-instant-open-auto.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryKey,\n instantOpenAutoMutationOptions,\n type ConfigParameter,\n type InstantOpenReturnType,\n type PrepareInstantOpenParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, 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\";\nimport { invalidateAccountBalances, predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useInstantOpenAuto}.\n */\nexport type UseInstantOpenAutoParameters = ConfigParameter;\n\n/** Return type of {@link useInstantOpenAuto}. */\nexport type UseInstantOpenAutoReturnType = UseMutationResult<\n InstantOpenReturnType,\n SymmioRequestError,\n PrepareInstantOpenParameters\n>;\n\n/**\n * Open a lowcap instant position via the wizard `instantOpenAuto` action.\n *\n * Friendly default: accepts the minimal trade intent and lets the SDK fetch\n * market metadata, mark price, locked params, and fee rates. Pre-fill any\n * optional field on the variables (e.g. cache-hot `markPrice`) to skip its\n * fetch. For full control — inspect / mutate resolved params between fetch and\n * submit — use {@link useInstantOpen} after calling\n * `prepareInstantOpenParams(config, …)` directly.\n *\n * Funding is a one-of on the variables: a typed `initialMargin`, or\n * `fund: { mode: \"full-balance\", balance }` (lowcap only) to deploy the whole\n * balance into the position's VA with the quantity sized down to fit it —\n * see `FullBalanceFunding` in `@symmio/trading-core`.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useInstantOpenAuto();\n * await mutateAsync({\n * subAccountAddress, from: sessionKeyAddress,\n * market: { id: 1 }, positionType: PositionType.LONG,\n * fund: { mode: \"full-balance\", balance: \"100\" }, leverage: 5, slippage: 1,\n * });\n * ```\n */\nexport function useInstantOpenAuto(parameters: UseInstantOpenAutoParameters = {}): UseInstantOpenAutoReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = instantOpenAutoMutationOptions(config);\n\n return useMutation<InstantOpenReturnType, SymmioRequestError, PrepareInstantOpenParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n /**\n * A freshly submitted instant-open exists on the hedger but not in any\n * cached read yet. Invalidate the instant-opens feed so it refetches and\n * the optimistic row appears immediately — without waiting for a poll.\n */\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantOpensQueryKey, { configKey }) });\n /** The open locks margin and charges a fee — every balance read on this chain is now suspect. */\n invalidateAccountBalances(queryClient, { configKey });\n },\n });\n}\n"],"mappings":";;;;;;;;;AAqDA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA+B,CAAM;CAElD,OAAO,EAAqF;EAC1F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GAMjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GAGvE,AAFA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAyB,EAAE,aAAU,CAAC,EAAE,CAAC,GAExG,EAA0B,GAAa,EAAE,aAAU,CAAC;EACtD;CACF,CAAC;AACH"}
@@ -1,15 +1,27 @@
1
1
  import { ConfigParameter, GetInstantOpenFeesOptions, GetInstantOpenFeesReturnType } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
3
  import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { UseEstimatedPriceReturnType } from '../estimated-price/use-estimated-price.js';
4
5
  /**
5
6
  * Parameters for {@link useInstantOpenFees}: the trade intent
6
- * (`subAccountAddress`, `market`, `positionType`, `initialMargin`,
7
- * `leverage`, optional `slippage` / pre-fetched data, TanStack `query`
8
- * overrides) plus an optional `config`.
7
+ * (`subAccountAddress`, `market`, `positionType`, `initialMargin` **or**
8
+ * `fund` for a full-balance preview, `leverage`, optional `slippage` /
9
+ * pre-fetched data, TanStack `query` overrides) plus an optional `config`.
9
10
  */
10
11
  export type UseInstantOpenFeesParameters = GetInstantOpenFeesOptions & ConfigParameter;
11
12
  /** Return type of {@link useInstantOpenFees}. */
12
- export type UseInstantOpenFeesReturnType = UseQueryResult<GetInstantOpenFeesReturnType, SymmioRequestError>;
13
+ export type UseInstantOpenFeesReturnType = UseQueryResult<GetInstantOpenFeesReturnType, SymmioRequestError> & {
14
+ /**
15
+ * Refetch the SDK-managed estimate on the frontend's schedule. Resolves when
16
+ * the estimate request finishes; use isReady to await fee calculation. A supplied
17
+ * estimatedOpenPrice still takes precedence over the fetched value.
18
+ */
19
+ refetchEstimatedPrice: UseEstimatedPriceReturnType["refetch"];
20
+ /** Synchronous input error. Display before query.error; dependent queries stay disabled. */
21
+ validationError: SymmioRequestError | undefined;
22
+ /** True when all inputs and the current fee preview have settled successfully. */
23
+ isReady: boolean;
24
+ };
13
25
  /**
14
26
  * Preview every fee a new instant-open quote pays — separated by leg plus the
15
27
  * total — before the user submits. Read-only; nothing is signed.
@@ -17,15 +29,33 @@ export type UseInstantOpenFeesReturnType = UseQueryResult<GetInstantOpenFeesRetu
17
29
  * Wraps `getInstantOpenFees`, but **pre-fetches every input through its own
18
30
  * cached queries and passes them in as prefills**, so the query function is
19
31
  * pure math with zero network hops: market metadata (`useMarkets`) and
20
- * on-chain fee rates (`useFeeForUser`) are slow-moving and cached for
21
- * minutes; the mark price rides the shared price stream; the lowcap dry-run
22
- * estimate uses `useEstimatedPrice` (debounced internally). Previous data is
32
+ * on-chain fee rates (`useFeeForUser`) and solver info are cached for minutes.
33
+ * The mark price rides the shared price stream; the lowcap dry-run estimate
34
+ * uses `useEstimatedPrice` (debounced internally). Previous data is
23
35
  * kept while inputs move, so a mark-price tick updates the numbers in place —
24
36
  * it never resets the result to a loading state.
25
37
  *
26
- * The result is a `kind`-discriminated union: both kinds carry the platform
27
- * legs and `totalFee`; an `"enigma"` (lowcap) result adds `openSolverFee`,
28
- * `closeSolverFee`, and `expectedSettlementLoss`.
38
+ * The result is a `kind`-discriminated union of the **open-side** legs: both
39
+ * kinds carry `platformOpenFee`, the sized `quantity`, and `totalFee`; an
40
+ * `"enigma"` (lowcap) result adds `openSolverFee`, `staticSolverFeeOpen`, and
41
+ * `expectedSettlementLoss`. Close fees are charged at close from the position
42
+ * and are deliberately not part of this preview — price them in the close flow
43
+ * with `useInstantCloseFees`, where the notional and holding time are real.
44
+ * `totalFee` includes the settlement provision by default; pass
45
+ * `includeSettlementInTotalFee: false` to sum the fee legs only.
46
+ *
47
+ * With `fund` (`FullBalanceFunding`) instead of `initialMargin`, the
48
+ * preview runs the same probe-and-rescale sizing as the open, so the legs and
49
+ * `quantity` equal what a full-balance open will actually charge and submit —
50
+ * the extra inputs it needs (locked-param percents, market quote constraints)
51
+ * are prefetched here through the same cached queries.
52
+ *
53
+ * With `initialMargin` and `availableBalance`, core automatically uses full-balance
54
+ * sizing when required funding exceeds the raw balance. `data.fundingMode` reports
55
+ * the effective choice; pass the same inputs to preparation and submission.
56
+ * Display `validationError ?? error` and check `isReady` before using the fees
57
+ * for the current input. Input errors are synchronous, including offline.
58
+ * A disabled hook or empty input remains idle without input validation.
29
59
  *
30
60
  * @example
31
61
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"use-instant-open-fees.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-fees.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAQzE;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,GAAG,eAAe,CAAC;AAEvF,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC;AAE5G;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,4BAA4B,GAAG,4BAA4B,CAkJzG"}
1
+ {"version":3,"file":"use-instant-open-fees.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-fees.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;AACzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAG1F;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,GAAG,eAAe,CAAC;AAEvF,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,GAAG;IAC5G;;;;OAIG;IACH,qBAAqB,EAAE,2BAA2B,CAAC,SAAS,CAAC,CAAC;IAC9D,4FAA4F;IAC5F,eAAe,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAChD,kFAAkF;IAClF,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,4BAA4B,GAAG,4BAA4B,CA4BzG"}
@@ -1,111 +1,36 @@
1
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 { useEstimatedPrice as r } from "../estimated-price/use-estimated-price.js";
6
- import { useFeeForUser as i } from "../fees/use-fee-for-user.js";
7
- import { useMarkets as a } from "../markets/use-markets.js";
8
- import { usePriceByName as o } from "../price-service/use-price-by-name.js";
9
- import { PositionType as s, calculateTradeParams as c, getInstantOpenFeesQueryOptions as l } from "@symmio/trading-core";
10
- import { useMemo as u } from "react";
11
- import { useQuery as d } from "@tanstack/react-query";
2
+ import { normalizeSymmError as e } from "../errors/normalize-symm-error.js";
3
+ import { useInstantOpenInputs as t } from "./use-instant-open-inputs.js";
4
+ import { getInstantOpenFeesQueryOptions as n } from "@symmio/trading-core";
5
+ import { useQuery as r } from "@tanstack/react-query";
12
6
  //#region src/instant-layer/use-instant-open-fees.ts
13
- function f(f) {
14
- let p = t(f), m = e(), h = f.chainId ?? m, { subAccountAddress: g, market: _, positionType: v, initialMargin: y, leverage: b, slippage: x, solverId: S } = f, C = (f.query?.enabled ?? !0) && y.length > 0, w = p.getSolver({
15
- chainId: h,
16
- solverId: S
17
- }).id === "enigma", T = a({
18
- config: f.config,
19
- chainId: h,
20
- solverId: S,
7
+ function i(i) {
8
+ let a = t(i, "fees", i.query?.enabled !== !1), o = n(a.config, {
9
+ ...i,
10
+ ...a.prefills,
21
11
  query: {
22
- enabled: C,
23
- staleTime: 3e5
12
+ ...i.query,
13
+ enabled: a.ready,
14
+ placeholderData: (e) => a.validationError === void 0 ? e : void 0
24
15
  }
25
- }).data?.find((e) => e.symbolId === _.id), E = _.name ?? T?.name, D = _.pricePrecision ?? T?.pricePrecision, O = _.quantityPrecision ?? T?.quantityPrecision, k = _.hedgerFeeOpen ?? T?.hedgerFeeOpen, A = _.hedgerFeeClose ?? T?.hedgerFeeClose, j = T?.kind === "enigma" ? T : void 0, M = _.hedgerFeeCloseEarlyRate ?? j?.hedgerFeeCloseEarlyRate ?? A, N = _.hedgerFeeCloseEarlyThreshold ?? j?.hedgerFeeCloseEarlyThreshold ?? 0, P = _.hedgerFeeCloseStandardThreshold ?? j?.hedgerFeeCloseStandardThreshold ?? 0, F = i({
26
- config: f.config,
27
- chainId: h,
28
- user: g,
29
- symbolId: BigInt(_.id),
30
- query: {
31
- enabled: C && f.feeRates === void 0,
32
- staleTime: 3e5
33
- }
34
- }), I = f.feeRates ?? F.data, L = o({
35
- name: E,
36
- solverId: S,
37
- enabled: C && f.markPrice === void 0
38
- }), R = f.markPrice ?? L.markPrice ?? void 0, z = u(() => !C || !w || R === void 0 || D === void 0 || O === void 0 ? "" : c({
39
- markPrice: R,
40
- slippage: 0,
41
- positionType: v,
42
- userInput: y,
43
- inputField: "PRICE",
44
- leverage: b,
45
- pricePrecision: D,
46
- quantityPrecision: O
47
- })?.quantity ?? "", [
48
- C,
49
- w,
50
- R,
51
- D,
52
- O,
53
- v,
54
- y,
55
- b
56
- ]), B = R === void 0 ? "" : String(Number(R) * (v === s.SHORT ? .5 : 1.5)), V = r({
57
- config: f.config,
58
- chainId: h,
59
- solverId: S,
60
- symbolId: _.id,
61
- quantity: z,
62
- positionType: v,
63
- entry: "open",
64
- price: B,
65
- query: {
66
- enabled: C && w && f.estimatedOpenPrice === void 0 && z.length > 0,
67
- staleTime: 3e4
68
- }
69
- }), H = w ? f.estimatedOpenPrice ?? V.data?.estimatedPrice ?? "0" : void 0, U = !w || f.estimatedOpenPrice !== void 0 || V.isFetched || V.isError, W = C && E !== void 0 && D !== void 0 && O !== void 0 && I !== void 0 && R !== void 0 && (!w || k !== void 0 && A !== void 0) && U, G = l(p, {
70
- subAccountAddress: g,
71
- solverId: S,
72
- chainId: h,
73
- market: {
74
- id: _.id,
75
- name: E,
76
- pricePrecision: D,
77
- quantityPrecision: O,
78
- hedgerFeeOpen: k,
79
- hedgerFeeClose: A,
80
- hedgerFeeCloseEarlyRate: M,
81
- hedgerFeeCloseEarlyThreshold: N,
82
- hedgerFeeCloseStandardThreshold: P
83
- },
84
- positionType: v,
85
- initialMargin: y,
86
- leverage: b,
87
- slippage: x,
88
- markPrice: R,
89
- feeRates: I,
90
- estimatedOpenPrice: H,
91
- query: {
92
- ...f.query,
93
- enabled: W,
94
- placeholderData: (e) => e
95
- }
96
- });
97
- return d({
98
- ...G,
16
+ }), s = r({
17
+ ...o,
99
18
  queryFn: async () => {
100
19
  try {
101
- return await G.queryFn();
102
- } catch (e) {
103
- throw n(e);
20
+ return await o.queryFn();
21
+ } catch (t) {
22
+ throw e(t);
104
23
  }
105
24
  }
106
25
  });
26
+ return {
27
+ ...s,
28
+ refetchEstimatedPrice: a.refetchEstimatedPrice,
29
+ validationError: a.validationError,
30
+ isReady: a.ready && s.isSuccess && !s.isFetching && !s.isPlaceholderData
31
+ };
107
32
  }
108
33
  //#endregion
109
- export { f as useInstantOpenFees };
34
+ export { i as useInstantOpenFees };
110
35
 
111
36
  //# sourceMappingURL=use-instant-open-fees.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-instant-open-fees.js","names":[],"sources":["../../src/instant-layer/use-instant-open-fees.ts"],"sourcesContent":["\"use client\";\n\nimport {\n calculateTradeParams,\n getInstantOpenFeesQueryOptions,\n PositionType,\n type ConfigParameter,\n type GetInstantOpenFeesOptions,\n type GetInstantOpenFeesReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useEstimatedPrice } from \"../estimated-price/use-estimated-price\";\nimport { useFeeForUser } from \"../fees/use-fee-for-user\";\nimport { useMarkets } from \"../markets/use-markets\";\nimport { usePriceByName } from \"../price-service/use-price-by-name\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useInstantOpenFees}: the trade intent\n * (`subAccountAddress`, `market`, `positionType`, `initialMargin`,\n * `leverage`, optional `slippage` / pre-fetched data, TanStack `query`\n * overrides) plus an optional `config`.\n */\nexport type UseInstantOpenFeesParameters = GetInstantOpenFeesOptions & ConfigParameter;\n\n/** Return type of {@link useInstantOpenFees}. */\nexport type UseInstantOpenFeesReturnType = UseQueryResult<GetInstantOpenFeesReturnType, SymmioRequestError>;\n\n/**\n * Preview every fee a new instant-open quote pays — separated by leg plus the\n * total — before the user submits. Read-only; nothing is signed.\n *\n * Wraps `getInstantOpenFees`, but **pre-fetches every input through its own\n * cached queries and passes them in as prefills**, so the query function is\n * pure math with zero network hops: market metadata (`useMarkets`) and\n * on-chain fee rates (`useFeeForUser`) are slow-moving and cached for\n * minutes; the mark price rides the shared price stream; the lowcap dry-run\n * estimate uses `useEstimatedPrice` (debounced internally). Previous data is\n * kept while inputs move, so a mark-price tick updates the numbers in place —\n * it never resets the result to a loading state.\n *\n * The result is a `kind`-discriminated union: both kinds carry the platform\n * legs and `totalFee`; an `\"enigma\"` (lowcap) result adds `openSolverFee`,\n * `closeSolverFee`, and `expectedSettlementLoss`.\n *\n * @example\n * ```tsx\n * const { data: fees } = useInstantOpenFees({\n * subAccountAddress,\n * market: { id: symbolId },\n * positionType,\n * initialMargin,\n * leverage,\n * });\n * // fees?.totalFee; fees?.kind === \"enigma\" && fees.expectedSettlementLoss\n * ```\n */\nexport function useInstantOpenFees(parameters: UseInstantOpenFeesParameters): UseInstantOpenFeesReturnType {\n const config = useSymmioConfig(parameters);\n const contextChainId = useSymmioChainId();\n const chainId = parameters.chainId ?? contextChainId;\n const { subAccountAddress, market, positionType, initialMargin, leverage, slippage, solverId } = parameters;\n const enabled = (parameters.query?.enabled ?? true) && initialMargin.length > 0;\n\n /** The dry-run estimate exists only on lowcap (Enigma) solvers. */\n const isLowcap = config.getSolver({ chainId, solverId }).id === \"enigma\";\n\n // Market metadata — slow-moving; dedupes with any other useMarkets on the page.\n const marketsQuery = useMarkets({\n config: parameters.config,\n chainId,\n solverId,\n query: { enabled, staleTime: 300_000 },\n });\n const resolvedMarket = marketsQuery.data?.find((entry) => entry.symbolId === market.id);\n const marketName = market.name ?? resolvedMarket?.name;\n const pricePrecision = market.pricePrecision ?? resolvedMarket?.pricePrecision;\n const quantityPrecision = market.quantityPrecision ?? resolvedMarket?.quantityPrecision;\n const hedgerFeeOpen = market.hedgerFeeOpen ?? resolvedMarket?.hedgerFeeOpen;\n const hedgerFeeClose = market.hedgerFeeClose ?? resolvedMarket?.hedgerFeeClose;\n\n // Time-decaying close-fee rates ride the same `useMarkets` read — they are\n // Enigma-only fields on `EnigmaMarket`, so narrow on `kind` before reading.\n const resolvedEnigmaMarket = resolvedMarket?.kind === \"enigma\" ? resolvedMarket : undefined;\n const hedgerFeeCloseEarlyRate =\n market.hedgerFeeCloseEarlyRate ?? resolvedEnigmaMarket?.hedgerFeeCloseEarlyRate ?? hedgerFeeClose;\n const hedgerFeeCloseEarlyThreshold =\n market.hedgerFeeCloseEarlyThreshold ?? resolvedEnigmaMarket?.hedgerFeeCloseEarlyThreshold ?? 0;\n const hedgerFeeCloseStandardThreshold =\n market.hedgerFeeCloseStandardThreshold ?? resolvedEnigmaMarket?.hedgerFeeCloseStandardThreshold ?? 0;\n\n // On-chain platform fee rates — contract state, changes rarely; cached hard.\n const feeQuery = useFeeForUser({\n config: parameters.config,\n chainId,\n user: subAccountAddress,\n symbolId: BigInt(market.id),\n query: { enabled: enabled && parameters.feeRates === undefined, staleTime: 300_000 },\n });\n const feeRates = parameters.feeRates ?? feeQuery.data;\n\n // Mark price — caller's cache-hot value wins; otherwise the shared stream.\n const priceQuery = usePriceByName({\n name: marketName,\n solverId,\n enabled: enabled && parameters.markPrice === undefined,\n });\n const markPrice = parameters.markPrice ?? priceQuery.markPrice ?? undefined;\n\n // Lowcap dry-run estimate: mark-sized quantity, wide fixed request bound so\n // the solver's price gate never rejects the question. Debounced internally.\n const estimateQuantity = useMemo(() => {\n if (!enabled || !isLowcap || markPrice === undefined) return \"\";\n if (pricePrecision === undefined || quantityPrecision === undefined) return \"\";\n const sized = calculateTradeParams({\n markPrice,\n slippage: 0,\n positionType,\n userInput: initialMargin,\n inputField: \"PRICE\",\n leverage,\n pricePrecision,\n quantityPrecision,\n });\n return sized?.quantity ?? \"\";\n }, [enabled, isLowcap, markPrice, pricePrecision, quantityPrecision, positionType, initialMargin, leverage]);\n const estimateRequestPrice =\n markPrice !== undefined ? String(Number(markPrice) * (positionType === PositionType.SHORT ? 0.5 : 1.5)) : \"\";\n const estimateQuery = useEstimatedPrice({\n config: parameters.config,\n chainId,\n solverId,\n symbolId: market.id,\n quantity: estimateQuantity,\n positionType,\n entry: \"open\",\n price: estimateRequestPrice,\n query: {\n enabled: enabled && isLowcap && parameters.estimatedOpenPrice === undefined && estimateQuantity.length > 0,\n staleTime: 30_000,\n },\n });\n // `\"0\"` is the action's \"no usable estimate\" sentinel: it suppresses the\n // action's own fetch (the input IS supplied) and yields a zero settlement\n // provision — so a solver outage never puts network calls back in queryFn.\n const estimatedOpenPrice = !isLowcap\n ? undefined\n : (parameters.estimatedOpenPrice ?? estimateQuery.data?.estimatedPrice ?? \"0\");\n const estimateSettled =\n !isLowcap || parameters.estimatedOpenPrice !== undefined || estimateQuery.isFetched || estimateQuery.isError;\n\n // Every prefill present → the query function is pure math, zero fetches.\n const ready =\n enabled &&\n marketName !== undefined &&\n pricePrecision !== undefined &&\n quantityPrecision !== undefined &&\n feeRates !== undefined &&\n markPrice !== undefined &&\n (!isLowcap || (hedgerFeeOpen !== undefined && hedgerFeeClose !== undefined)) &&\n estimateSettled;\n\n const options = getInstantOpenFeesQueryOptions(config, {\n subAccountAddress,\n solverId,\n chainId,\n market: {\n id: market.id,\n name: marketName,\n pricePrecision,\n quantityPrecision,\n hedgerFeeOpen,\n hedgerFeeClose,\n hedgerFeeCloseEarlyRate,\n hedgerFeeCloseEarlyThreshold,\n hedgerFeeCloseStandardThreshold,\n },\n positionType,\n initialMargin,\n leverage,\n slippage,\n markPrice,\n feeRates,\n estimatedOpenPrice,\n query: {\n ...parameters.query,\n enabled: ready,\n // Inputs (mark price, estimate) tick often; keep showing the previous\n // numbers while the pure recompute runs instead of flashing a loader.\n placeholderData: (previous: GetInstantOpenFeesReturnType | undefined) => previous,\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 UseInstantOpenFeesReturnType;\n}\n"],"mappings":";;;;;;;;;;;;AA6DA,SAAgB,EAAmB,GAAwE;CACzG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAChC,EAAE,sBAAmB,WAAQ,iBAAc,kBAAe,aAAU,aAAU,gBAAa,GAC3F,KAAW,EAAW,OAAO,WAAW,OAAS,EAAc,SAAS,GAGxE,IAAW,EAAO,UAAU;EAAE;EAAS;CAAS,CAAC,EAAE,OAAO,UAS1D,IANe,EAAW;EAC9B,QAAQ,EAAW;EACnB;EACA;EACA,OAAO;GAAE;GAAS,WAAW;EAAQ;CACvC,CACuB,EAAa,MAAM,MAAM,MAAU,EAAM,aAAa,EAAO,EAAE,GAChF,IAAa,EAAO,QAAQ,GAAgB,MAC5C,IAAiB,EAAO,kBAAkB,GAAgB,gBAC1D,IAAoB,EAAO,qBAAqB,GAAgB,mBAChE,IAAgB,EAAO,iBAAiB,GAAgB,eACxD,IAAiB,EAAO,kBAAkB,GAAgB,gBAI1D,IAAuB,GAAgB,SAAS,WAAW,IAAiB,KAAA,GAC5E,IACJ,EAAO,2BAA2B,GAAsB,2BAA2B,GAC/E,IACJ,EAAO,gCAAgC,GAAsB,gCAAgC,GACzF,IACJ,EAAO,mCAAmC,GAAsB,mCAAmC,GAG/F,IAAW,EAAc;EAC7B,QAAQ,EAAW;EACnB;EACA,MAAM;EACN,UAAU,OAAO,EAAO,EAAE;EAC1B,OAAO;GAAE,SAAS,KAAW,EAAW,aAAa,KAAA;GAAW,WAAW;EAAQ;CACrF,CAAC,GACK,IAAW,EAAW,YAAY,EAAS,MAG3C,IAAa,EAAe;EAChC,MAAM;EACN;EACA,SAAS,KAAW,EAAW,cAAc,KAAA;CAC/C,CAAC,GACK,IAAY,EAAW,aAAa,EAAW,aAAa,KAAA,GAI5D,IAAmB,QACnB,CAAC,KAAW,CAAC,KAAY,MAAc,KAAA,KACvC,MAAmB,KAAA,KAAa,MAAsB,KAAA,IAAkB,KAC9D,EAAqB;EACjC;EACA,UAAU;EACV;EACA,WAAW;EACX,YAAY;EACZ;EACA;EACA;CACF,CACO,GAAO,YAAY,IACzB;EAAC;EAAS;EAAU;EAAW;EAAgB;EAAmB;EAAc;EAAe;CAAQ,CAAC,GACrG,IACJ,MAAc,KAAA,IAA4F,KAAhF,OAAO,OAAO,CAAS,KAAK,MAAiB,EAAa,QAAQ,KAAM,IAAI,GAClG,IAAgB,EAAkB;EACtC,QAAQ,EAAW;EACnB;EACA;EACA,UAAU,EAAO;EACjB,UAAU;EACV;EACA,OAAO;EACP,OAAO;EACP,OAAO;GACL,SAAS,KAAW,KAAY,EAAW,uBAAuB,KAAA,KAAa,EAAiB,SAAS;GACzG,WAAW;EACb;CACF,CAAC,GAIK,IAAsB,IAEvB,EAAW,sBAAsB,EAAc,MAAM,kBAAkB,MADxE,KAAA,GAEE,IACJ,CAAC,KAAY,EAAW,uBAAuB,KAAA,KAAa,EAAc,aAAa,EAAc,SAGjG,IACJ,KACA,MAAe,KAAA,KACf,MAAmB,KAAA,KACnB,MAAsB,KAAA,KACtB,MAAa,KAAA,KACb,MAAc,KAAA,MACb,CAAC,KAAa,MAAkB,KAAA,KAAa,MAAmB,KAAA,MACjE,GAEI,IAAU,EAA+B,GAAQ;EACrD;EACA;EACA;EACA,QAAQ;GACN,IAAI,EAAO;GACX,MAAM;GACN;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO;GACL,GAAG,EAAW;GACd,SAAS;GAGT,kBAAkB,MAAuD;EAC3E;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"}
1
+ {"version":3,"file":"use-instant-open-fees.js","names":[],"sources":["../../src/instant-layer/use-instant-open-fees.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpenFeesQueryOptions,\n type ConfigParameter,\n type GetInstantOpenFeesOptions,\n type GetInstantOpenFeesReturnType,\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 type { UseEstimatedPriceReturnType } from \"../estimated-price/use-estimated-price\";\nimport { useInstantOpenInputs } from \"./use-instant-open-inputs\";\n\n/**\n * Parameters for {@link useInstantOpenFees}: the trade intent\n * (`subAccountAddress`, `market`, `positionType`, `initialMargin` **or**\n * `fund` for a full-balance preview, `leverage`, optional `slippage` /\n * pre-fetched data, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseInstantOpenFeesParameters = GetInstantOpenFeesOptions & ConfigParameter;\n\n/** Return type of {@link useInstantOpenFees}. */\nexport type UseInstantOpenFeesReturnType = UseQueryResult<GetInstantOpenFeesReturnType, SymmioRequestError> & {\n /**\n * Refetch the SDK-managed estimate on the frontend's schedule. Resolves when\n * the estimate request finishes; use isReady to await fee calculation. A supplied\n * estimatedOpenPrice still takes precedence over the fetched value.\n */\n refetchEstimatedPrice: UseEstimatedPriceReturnType[\"refetch\"];\n /** Synchronous input error. Display before query.error; dependent queries stay disabled. */\n validationError: SymmioRequestError | undefined;\n /** True when all inputs and the current fee preview have settled successfully. */\n isReady: boolean;\n};\n\n/**\n * Preview every fee a new instant-open quote pays — separated by leg plus the\n * total — before the user submits. Read-only; nothing is signed.\n *\n * Wraps `getInstantOpenFees`, but **pre-fetches every input through its own\n * cached queries and passes them in as prefills**, so the query function is\n * pure math with zero network hops: market metadata (`useMarkets`) and\n * on-chain fee rates (`useFeeForUser`) and solver info are cached for minutes.\n * The mark price rides the shared price stream; the lowcap dry-run estimate\n * uses `useEstimatedPrice` (debounced internally). Previous data is\n * kept while inputs move, so a mark-price tick updates the numbers in place —\n * it never resets the result to a loading state.\n *\n * The result is a `kind`-discriminated union of the **open-side** legs: both\n * kinds carry `platformOpenFee`, the sized `quantity`, and `totalFee`; an\n * `\"enigma\"` (lowcap) result adds `openSolverFee`, `staticSolverFeeOpen`, and\n * `expectedSettlementLoss`. Close fees are charged at close from the position\n * and are deliberately not part of this preview — price them in the close flow\n * with `useInstantCloseFees`, where the notional and holding time are real.\n * `totalFee` includes the settlement provision by default; pass\n * `includeSettlementInTotalFee: false` to sum the fee legs only.\n *\n * With `fund` (`FullBalanceFunding`) instead of `initialMargin`, the\n * preview runs the same probe-and-rescale sizing as the open, so the legs and\n * `quantity` equal what a full-balance open will actually charge and submit —\n * the extra inputs it needs (locked-param percents, market quote constraints)\n * are prefetched here through the same cached queries.\n *\n * With `initialMargin` and `availableBalance`, core automatically uses full-balance\n * sizing when required funding exceeds the raw balance. `data.fundingMode` reports\n * the effective choice; pass the same inputs to preparation and submission.\n * Display `validationError ?? error` and check `isReady` before using the fees\n * for the current input. Input errors are synchronous, including offline.\n * A disabled hook or empty input remains idle without input validation.\n *\n * @example\n * ```tsx\n * const { data: fees } = useInstantOpenFees({\n * subAccountAddress,\n * market: { id: symbolId },\n * positionType,\n * initialMargin,\n * leverage,\n * });\n * // fees?.totalFee; fees?.kind === \"enigma\" && fees.expectedSettlementLoss\n * ```\n */\nexport function useInstantOpenFees(parameters: UseInstantOpenFeesParameters): UseInstantOpenFeesReturnType {\n const inputs = useInstantOpenInputs(parameters, \"fees\", parameters.query?.enabled !== false);\n const options = getInstantOpenFeesQueryOptions(inputs.config, {\n ...parameters,\n ...inputs.prefills,\n query: {\n ...parameters.query,\n enabled: inputs.ready,\n placeholderData: (previous) => (inputs.validationError === undefined ? previous : undefined),\n },\n });\n const query = useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseQueryResult<GetInstantOpenFeesReturnType, SymmioRequestError>;\n\n return {\n ...query,\n refetchEstimatedPrice: inputs.refetchEstimatedPrice,\n validationError: inputs.validationError,\n isReady: inputs.ready && query.isSuccess && !query.isFetching && !query.isPlaceholderData,\n };\n}\n"],"mappings":";;;;;;AAmFA,SAAgB,EAAmB,GAAwE;CACzG,IAAM,IAAS,EAAqB,GAAY,QAAQ,EAAW,OAAO,YAAY,EAAK,GACrF,IAAU,EAA+B,EAAO,QAAQ;EAC5D,GAAG;EACH,GAAG,EAAO;EACV,OAAO;GACL,GAAG,EAAW;GACd,SAAS,EAAO;GAChB,kBAAkB,MAAc,EAAO,oBAAoB,KAAA,IAAY,IAAW,KAAA;EACpF;CACF,CAAC,GACK,IAAQ,EAAS;EACrB,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;CAED,OAAO;EACL,GAAG;EACH,uBAAuB,EAAO;EAC9B,iBAAiB,EAAO;EACxB,SAAS,EAAO,SAAS,EAAM,aAAa,CAAC,EAAM,cAAc,CAAC,EAAM;CAC1E;AACF"}
@@ -0,0 +1,37 @@
1
+ import { ConfigParameter, GetInstantOpenFeesParameters } from '@symmio/trading-core';
2
+ /** Shared input orchestration for preparation and fee previews; calculations stay in core. */
3
+ export declare function useInstantOpenInputs(parameters: GetInstantOpenFeesParameters & ConfigParameter, purpose: "prepare" | "fees", queryEnabled?: boolean): {
4
+ config: import('@symmio/trading-core').Config;
5
+ validationError: import('../index.js').SymmioRequestError | undefined;
6
+ ready: boolean;
7
+ refetchEstimatedPrice: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<import('@symmio/trading-core').GetEstimatedPriceReturnType, import('../index.js').SymmioRequestError>>;
8
+ estimatedOpenPriceTimestamp: number | undefined;
9
+ prefills: {
10
+ chainId: number;
11
+ market: {
12
+ id: number;
13
+ name: string | undefined;
14
+ pricePrecision: number | undefined;
15
+ quantityPrecision: number | undefined;
16
+ minOpenSolverFeeCap: string | undefined;
17
+ minCloseSolverFeeCap: string | undefined;
18
+ hedgerFeeOpen: string | undefined;
19
+ hedgerFeeClose: string | undefined;
20
+ hedgerFeeCloseEarlyRate: string | undefined;
21
+ hedgerFeeCloseEarlyThreshold: number;
22
+ hedgerFeeCloseStandardThreshold: number;
23
+ minAcceptablePortionLf: string | undefined;
24
+ minAcceptableQuoteValue: string | undefined;
25
+ maxNotionalValue: number | undefined;
26
+ minNotionalValue: string | undefined;
27
+ maxQuantity: string | undefined;
28
+ lotSize: string | undefined;
29
+ };
30
+ markPrice: string | undefined;
31
+ feeRates: import('@symmio/trading-core').FeeForUser | undefined;
32
+ lockedParamPercent: import('@symmio/trading-core').SolverLockedParams | undefined;
33
+ solverInfo: import('@symmio/trading-core').EnigmaSolverInfo | undefined;
34
+ estimatedOpenPrice: string | null | undefined;
35
+ };
36
+ };
37
+ //# sourceMappingURL=use-instant-open-inputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-instant-open-inputs.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-inputs.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAY9B,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,4BAA4B,GAAG,eAAe,EAC1D,OAAO,EAAE,SAAS,GAAG,MAAM,EAC3B,YAAY,UAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+NpB"}