@symmio/trading-react 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/README.md +47 -0
  2. package/dist/account-layer/index.d.ts +28 -28
  3. package/dist/account-layer/index.js +29 -0
  4. package/dist/account-layer/use-account-balance-info.d.ts +1 -1
  5. package/dist/account-layer/use-account-balance-of.d.ts +1 -1
  6. package/dist/account-layer/use-add-margin.d.ts +2 -2
  7. package/dist/account-layer/use-allocate.d.ts +2 -2
  8. package/dist/account-layer/use-create-sub-accounts.d.ts +2 -2
  9. package/dist/account-layer/use-deallocate.d.ts +2 -2
  10. package/dist/account-layer/use-delete-sub-account.d.ts +2 -2
  11. package/dist/account-layer/use-deposit-and-allocate.d.ts +2 -2
  12. package/dist/account-layer/use-deposit.d.ts +2 -2
  13. package/dist/account-layer/use-edit-account-name.d.ts +2 -2
  14. package/dist/account-layer/use-predicted-next-virtual-account.d.ts +1 -1
  15. package/dist/account-layer/use-remove-margin.d.ts +2 -2
  16. package/dist/account-layer/use-simulate-add-margin.d.ts +1 -1
  17. package/dist/account-layer/use-simulate-allocate.d.ts +1 -1
  18. package/dist/account-layer/use-simulate-create-sub-accounts.d.ts +1 -1
  19. package/dist/account-layer/use-simulate-deallocate.d.ts +1 -1
  20. package/dist/account-layer/use-simulate-delete-sub-account.d.ts +1 -1
  21. package/dist/account-layer/use-simulate-deposit-and-allocate.d.ts +1 -1
  22. package/dist/account-layer/use-simulate-deposit.d.ts +1 -1
  23. package/dist/account-layer/use-simulate-edit-account-name.d.ts +1 -1
  24. package/dist/account-layer/use-simulate-remove-margin.d.ts +1 -1
  25. package/dist/account-layer/use-sub-account-virtual-nonce.d.ts +1 -1
  26. package/dist/account-layer/use-sub-account.d.ts +1 -1
  27. package/dist/account-layer/use-sub-accounts-count-of-user.d.ts +1 -1
  28. package/dist/account-layer/use-user-sub-accounts-addresses.d.ts +1 -1
  29. package/dist/account-layer/use-user-sub-accounts.d.ts +1 -1
  30. package/dist/account-layer/use-virtual-account.d.ts +1 -1
  31. package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.d.ts +1 -1
  32. package/dist/balance-history/index.d.ts +3 -3
  33. package/dist/balance-history/use-balance-history.d.ts +1 -1
  34. package/dist/balance-history/use-deposit-history.d.ts +1 -1
  35. package/dist/balance-history/use-withdraw-history.d.ts +1 -1
  36. package/dist/collateral/index.d.ts +4 -4
  37. package/dist/collateral/use-approve-collateral.d.ts +2 -2
  38. package/dist/collateral/use-collateral-allowance.d.ts +1 -1
  39. package/dist/collateral/use-collateral-balance.d.ts +1 -1
  40. package/dist/collateral/use-simulate-approve-collateral.d.ts +1 -1
  41. package/dist/error-codes/index.d.ts +2 -2
  42. package/dist/error-codes/use-solver-error-codes.d.ts +1 -1
  43. package/dist/error-codes/use-solver-error-message.d.ts +1 -1
  44. package/dist/errors/index.d.ts +3 -3
  45. package/dist/errors/index.js +3 -0
  46. package/dist/errors/normalize-symm-error.d.ts +1 -1
  47. package/dist/errors/symmio-request-error.d.ts +1 -1
  48. package/dist/fees/index.d.ts +1 -1
  49. package/dist/fees/index.js +2 -0
  50. package/dist/fees/use-fee-for-user.d.ts +1 -1
  51. package/dist/funding-info/index.d.ts +2 -0
  52. package/dist/funding-info/index.d.ts.map +1 -0
  53. package/dist/funding-info/use-funding-info.d.ts +25 -0
  54. package/dist/funding-info/use-funding-info.d.ts.map +1 -0
  55. package/dist/funding-info/use-funding-info.js +27 -0
  56. package/dist/funding-info/use-funding-info.js.map +1 -0
  57. package/dist/index.d.ts +40 -24
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +74 -69
  60. package/dist/instant-layer/index.d.ts +14 -13
  61. package/dist/instant-layer/index.d.ts.map +1 -1
  62. package/dist/instant-layer/index.js +15 -0
  63. package/dist/instant-layer/use-delegation-expiry.d.ts +1 -1
  64. package/dist/instant-layer/use-grant-delegation.d.ts +2 -2
  65. package/dist/instant-layer/use-instant-close-auto.d.ts +1 -1
  66. package/dist/instant-layer/use-instant-close-bulk-auto.d.ts +1 -1
  67. package/dist/instant-layer/use-instant-close-bulk.d.ts +1 -1
  68. package/dist/instant-layer/use-instant-close.d.ts +1 -1
  69. package/dist/instant-layer/use-instant-closes.d.ts +1 -1
  70. package/dist/instant-layer/use-instant-open-auto.d.ts +1 -1
  71. package/dist/instant-layer/use-instant-open-quote-id.d.ts +1 -1
  72. package/dist/instant-layer/use-instant-open-with-tpsl.d.ts +55 -0
  73. package/dist/instant-layer/use-instant-open-with-tpsl.d.ts.map +1 -0
  74. package/dist/instant-layer/use-instant-open-with-tpsl.js +56 -0
  75. package/dist/instant-layer/use-instant-open-with-tpsl.js.map +1 -0
  76. package/dist/instant-layer/use-instant-open.d.ts +1 -1
  77. package/dist/instant-layer/use-instant-opens.d.ts +1 -1
  78. package/dist/instant-layer/use-is-delegation-active.d.ts +1 -1
  79. package/dist/instant-layer/use-simulate-grant-delegation.d.ts +1 -1
  80. package/dist/locked-params/index.d.ts +1 -1
  81. package/dist/locked-params/use-locked-params.d.ts +1 -1
  82. package/dist/market-info/index.d.ts +2 -0
  83. package/dist/market-info/index.d.ts.map +1 -0
  84. package/dist/market-info/use-market-info.d.ts +28 -0
  85. package/dist/market-info/use-market-info.d.ts.map +1 -0
  86. package/dist/market-info/use-market-info.js +27 -0
  87. package/dist/market-info/use-market-info.js.map +1 -0
  88. package/dist/markets/index.d.ts +2 -2
  89. package/dist/markets/index.js +3 -0
  90. package/dist/markets/use-markets.d.ts +1 -1
  91. package/dist/markets/use-onchain-contract-markets.d.ts +1 -1
  92. package/dist/muon/index.d.ts +10 -10
  93. package/dist/muon/use-deallocate-upnl-sig.d.ts +1 -1
  94. package/dist/muon/use-muon-party-a-overview.d.ts +1 -1
  95. package/dist/muon/use-muon-price-range.d.ts +1 -1
  96. package/dist/muon/use-muon-price.d.ts +1 -1
  97. package/dist/muon/use-muon-settle-upnl.d.ts +1 -1
  98. package/dist/muon/use-muon-upnl-a-with-symbol-price.d.ts +1 -1
  99. package/dist/muon/use-muon-upnl-a.d.ts +1 -1
  100. package/dist/muon/use-muon-upnl-b.d.ts +1 -1
  101. package/dist/muon/use-muon-upnl-with-symbol-price.d.ts +1 -1
  102. package/dist/muon/use-muon-upnl.d.ts +1 -1
  103. package/dist/notifications/index.d.ts +1 -1
  104. package/dist/notifications/use-search-notifications.d.ts +1 -1
  105. package/dist/notional-cap/index.d.ts +3 -3
  106. package/dist/notional-cap/use-notional-cap-all.d.ts +1 -1
  107. package/dist/notional-cap/use-notional-cap-by-symbol-id.d.ts +1 -1
  108. package/dist/notional-cap/use-open-interest-by-symbol-id.d.ts +1 -1
  109. package/dist/price-service/index.d.ts +8 -8
  110. package/dist/price-service/index.js +9 -0
  111. package/dist/price-service/use-enigma-price-by-market-id.d.ts +1 -1
  112. package/dist/price-service/use-enigma-price-by-name.d.ts +1 -1
  113. package/dist/price-service/use-enigma-price-service-health.d.ts +1 -1
  114. package/dist/price-service/use-enigma-price-service-metadata.d.ts +1 -1
  115. package/dist/price-service/use-enigma-price-service-prices-by-addresses.d.ts +1 -1
  116. package/dist/price-service/use-enigma-price-service-prices-by-names.d.ts +1 -1
  117. package/dist/price-service/use-enigma-price-service-symbols-info.d.ts +1 -1
  118. package/dist/price-service/use-enigma-prices.d.ts +1 -1
  119. package/dist/provider/index.d.ts +3 -3
  120. package/dist/provider/index.js +4 -0
  121. package/dist/quotes/index.d.ts +15 -15
  122. package/dist/quotes/use-account-liquidation-price.d.ts +4 -7
  123. package/dist/quotes/use-account-liquidation-price.d.ts.map +1 -1
  124. package/dist/quotes/use-account-liquidation-price.js.map +1 -1
  125. package/dist/quotes/use-grouped-quotes.d.ts +1 -1
  126. package/dist/quotes/use-managed-quotes.d.ts +1 -1
  127. package/dist/quotes/use-managed-quotes.d.ts.map +1 -1
  128. package/dist/quotes/use-managed-quotes.js +125 -122
  129. package/dist/quotes/use-managed-quotes.js.map +1 -1
  130. package/dist/quotes/use-party-a-open-positions.d.ts +4 -4
  131. package/dist/quotes/use-party-a-open-positions.js.map +1 -1
  132. package/dist/quotes/use-party-a-pending-quotes.d.ts +1 -1
  133. package/dist/quotes/use-quote-events-by-type.d.ts +1 -1
  134. package/dist/quotes/use-quote-funding.d.ts +1 -1
  135. package/dist/quotes/use-quote-history.d.ts +1 -1
  136. package/dist/quotes/use-quote-price-history.d.ts +1 -1
  137. package/dist/quotes/use-quote.d.ts +1 -1
  138. package/dist/quotes/use-quotes-funding.d.ts +1 -1
  139. package/dist/quotes/use-subgraph-query.d.ts +1 -1
  140. package/dist/tpsl/index.d.ts +8 -7
  141. package/dist/tpsl/index.d.ts.map +1 -1
  142. package/dist/tpsl/tpsl-store.d.ts +84 -0
  143. package/dist/tpsl/tpsl-store.d.ts.map +1 -0
  144. package/dist/tpsl/tpsl-store.js +154 -0
  145. package/dist/tpsl/tpsl-store.js.map +1 -0
  146. package/dist/tpsl/use-delete-quote-tpsl.d.ts +15 -0
  147. package/dist/tpsl/use-delete-quote-tpsl.d.ts.map +1 -0
  148. package/dist/tpsl/use-delete-quote-tpsl.js +31 -0
  149. package/dist/tpsl/use-delete-quote-tpsl.js.map +1 -0
  150. package/dist/tpsl/use-quote-tpsl.d.ts +19 -20
  151. package/dist/tpsl/use-quote-tpsl.d.ts.map +1 -1
  152. package/dist/tpsl/use-quote-tpsl.js +24 -53
  153. package/dist/tpsl/use-quote-tpsl.js.map +1 -1
  154. package/dist/tpsl/use-set-quote-tpsl.d.ts +11 -10
  155. package/dist/tpsl/use-set-quote-tpsl.d.ts.map +1 -1
  156. package/dist/tpsl/use-set-quote-tpsl.js +18 -22
  157. package/dist/tpsl/use-set-quote-tpsl.js.map +1 -1
  158. package/dist/tpsl/use-tpsl-config.d.ts +1 -1
  159. package/dist/tpsl/use-tpsl-signing-spec.d.ts +1 -1
  160. package/dist/tpsl/use-watch-tpsl-notifications.d.ts +1 -1
  161. package/dist/transactions/index.d.ts +3 -3
  162. package/dist/transactions/index.js +3 -0
  163. package/dist/transactions/resolve-write-result.d.ts +1 -1
  164. package/dist/transfers/index.d.ts +1 -1
  165. package/dist/transfers/use-transfer-history.d.ts +1 -1
  166. package/dist/utils/index.d.ts +1 -1
  167. package/dist/wallet/index.d.ts +4 -4
  168. package/dist/wallet/index.js +5 -0
  169. package/dist/wallet/use-connect-wallet.d.ts +1 -1
  170. package/dist/wallet/use-switch-to-symmio-chain.d.ts +1 -1
  171. package/dist/websocket/index.d.ts +1 -1
  172. package/dist/websocket/use-notifications.d.ts +1 -1
  173. package/dist/withdraw/index.d.ts +10 -10
  174. package/dist/withdraw/use-finalize-withdraw-request.d.ts +2 -2
  175. package/dist/withdraw/use-initiate-withdraw.d.ts +2 -2
  176. package/dist/withdraw/use-last-withdraw-request-id.d.ts +1 -1
  177. package/dist/withdraw/use-pending-withdraw-requests.d.ts +1 -1
  178. package/dist/withdraw/use-request-cancel-withdraw.d.ts +2 -2
  179. package/dist/withdraw/use-simulate-finalize-withdraw-request.d.ts +1 -1
  180. package/dist/withdraw/use-simulate-initiate-withdraw.d.ts +1 -1
  181. package/dist/withdraw/use-simulate-request-cancel-withdraw.d.ts +1 -1
  182. package/dist/withdraw/use-withdraw-requests.d.ts +1 -1
  183. package/dist/withdraw/use-withdrawable-time.d.ts +1 -1
  184. package/package.json +8 -6
  185. package/dist/tpsl/tpsl-confirming.d.ts +0 -36
  186. package/dist/tpsl/tpsl-confirming.d.ts.map +0 -1
  187. package/dist/tpsl/tpsl-confirming.js +0 -28
  188. package/dist/tpsl/tpsl-confirming.js.map +0 -1
@@ -0,0 +1,15 @@
1
+ import { ConfigParameter, DeleteQuoteTpSlParameters, DeleteQuoteTpSlReturnType } from '@symmio/trading-core';
2
+ import { UseMutationResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ /** Parameters for {@link useDeleteQuoteTpSl}. */
5
+ export type UseDeleteQuoteTpSlParameters = ConfigParameter;
6
+ /** Return type of {@link useDeleteQuoteTpSl}. */
7
+ export type UseDeleteQuoteTpSlReturnType = UseMutationResult<DeleteQuoteTpSlReturnType, SymmioRequestError, DeleteQuoteTpSlParameters>;
8
+ /**
9
+ * Cancel a live TP or SL by its `cohQuoteId`. Signs an EIP-712 delete message
10
+ * with the session-key wallet and calls `DELETE /api/v5/`. On 200 the target
11
+ * side is marked `"confirming"` in the shared TP/SL store; the WS `cancel`
12
+ * report flips it to `"canceled"` via `applyNotification`.
13
+ */
14
+ export declare function useDeleteQuoteTpSl(parameters?: UseDeleteQuoteTpSlParameters): UseDeleteQuoteTpSlReturnType;
15
+ //# sourceMappingURL=use-delete-quote-tpsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-delete-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-delete-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,yBAAyB,EACzB,kBAAkB,EAClB,yBAAyB,CAC1B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CAoB9G"}
@@ -0,0 +1,31 @@
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 { useTpSlStore as r } from "./tpsl-store.js";
6
+ import { deleteQuoteTpSlMutationOptions as i } from "@symmio/trading-core";
7
+ import { useMutation as a } from "@tanstack/react-query";
8
+ //#region src/tpsl/use-delete-quote-tpsl.ts
9
+ function o(o = {}) {
10
+ let s = t(o), c = e(), l = i(s), u = r((e) => e.markConfirming);
11
+ return a({
12
+ mutationKey: l.mutationKey,
13
+ mutationFn: async (e) => {
14
+ try {
15
+ return await l.mutationFn({
16
+ ...e,
17
+ chainId: e.chainId ?? c
18
+ });
19
+ } catch (e) {
20
+ throw n(e);
21
+ }
22
+ },
23
+ onSuccess: (e, t) => {
24
+ t.conditionalOrderType === "take_profit" && u(t.quoteId, "tp"), t.conditionalOrderType === "stop_loss" && u(t.quoteId, "sl");
25
+ }
26
+ });
27
+ }
28
+ //#endregion
29
+ export { o as useDeleteQuoteTpSl };
30
+
31
+ //# sourceMappingURL=use-delete-quote-tpsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-delete-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-delete-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deleteQuoteTpSlMutationOptions,\n type ConfigParameter,\n type DeleteQuoteTpSlParameters,\n type DeleteQuoteTpSlReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { useTpSlStore } from \"./tpsl-store\";\n\n/** Parameters for {@link useDeleteQuoteTpSl}. */\nexport type UseDeleteQuoteTpSlParameters = ConfigParameter;\n\n/** Return type of {@link useDeleteQuoteTpSl}. */\nexport type UseDeleteQuoteTpSlReturnType = UseMutationResult<\n DeleteQuoteTpSlReturnType,\n SymmioRequestError,\n DeleteQuoteTpSlParameters\n>;\n\n/**\n * Cancel a live TP or SL by its `cohQuoteId`. Signs an EIP-712 delete message\n * with the session-key wallet and calls `DELETE /api/v5/`. On 200 the target\n * side is marked `\"confirming\"` in the shared TP/SL store; the WS `cancel`\n * report flips it to `\"canceled\"` via `applyNotification`.\n */\nexport function useDeleteQuoteTpSl(parameters: UseDeleteQuoteTpSlParameters = {}): UseDeleteQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const base = deleteQuoteTpSlMutationOptions(config);\n const markConfirming = useTpSlStore((state) => state.markConfirming);\n\n return useMutation<DeleteQuoteTpSlReturnType, SymmioRequestError, DeleteQuoteTpSlParameters>({\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 if (variables.conditionalOrderType === \"take_profit\") markConfirming(variables.quoteId, \"tp\");\n if (variables.conditionalOrderType === \"stop_loss\") markConfirming(variables.quoteId, \"sl\");\n },\n });\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAO,EAA+B,CAAM,GAC5C,IAAiB,GAAc,MAAU,EAAM,cAAc;CAEnE,OAAO,EAAsF;EAC3F,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;GAEjC,AADI,EAAU,yBAAyB,iBAAe,EAAe,EAAU,SAAS,IAAI,GACxF,EAAU,yBAAyB,eAAa,EAAe,EAAU,SAAS,IAAI;EAC5F;CACF,CAAC;AACH"}
@@ -1,34 +1,33 @@
1
- import { ConfigParameter, GetQuoteTpSlOptions, QuoteTpSl, QuoteTpSlRow } from '@symmio/trading-core';
1
+ import { ConfigParameter, GetQuoteTpSlOptions } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
3
  import { Address } from 'viem';
4
- import { SymmioRequestError } from '../errors/symmio-request-error';
4
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
5
+ import { TpSlRecord } from './tpsl-store.js';
5
6
  /** Parameters for {@link useQuoteTpSl}. */
6
- export type UseQuoteTpSlParameters = GetQuoteTpSlOptions & ConfigParameter & {
7
+ export type UseQuoteTpSlParameters = Omit<GetQuoteTpSlOptions, "quoteId"> & ConfigParameter & {
8
+ /**
9
+ * Quote id — accepts either the on-chain `quoteId` or the hedger
10
+ * `tempQuoteId`. Whichever is passed, the hook resolves to the same
11
+ * shared record via the store's id index.
12
+ */
13
+ quoteId: bigint;
7
14
  /**
8
15
  * SubAccount address — when provided, the hook also subscribes to the
9
- * TP/SL WebSocket and reconciles the snapshot (`confirming` → `new`)
10
- * without manual polling. Omit to skip WS (REST-only).
16
+ * TP/SL WebSocket and reconciles the record without manual polling.
11
17
  */
12
18
  account?: Address;
13
19
  };
14
20
  /** Return type of {@link useQuoteTpSl}. */
15
- export type UseQuoteTpSlReturnType = UseQueryResult<QuoteTpSl, SymmioRequestError> & {
16
- /** The unfiltered conditional-order rows returned by the handler. */
17
- rows: QuoteTpSlRow[] | undefined;
18
- };
21
+ export type UseQuoteTpSlReturnType = UseQueryResult<TpSlRecord, SymmioRequestError>;
19
22
  /**
20
- * Read the TP/SL snapshot for one on-chain quote.
21
- *
22
- * The query caches the **raw handler rows** (every state — `pending` / `new` /
23
- * `triggered` / `canceled` / `killed`); the hook returns a folded
24
- * {@link QuoteTpSl} via {@link toQuoteTpSl}.
23
+ * Read the folded TP/SL snapshot for one quote. Pass either the on-chain
24
+ * `quoteId` or the hedger `tempQuoteId` — the store keeps a single record per
25
+ * quote indexed under every id it has learned for that quote, so both callers
26
+ * get the same object.
25
27
  *
26
- * State machine — when a POST just landed (via
27
- * {@link useSetQuoteTpSl}) the shared "confirming" slot is set for the
28
- * submitted sides; this hook overlays `tpState` / `slState = "confirming"`
29
- * until a matching WebSocket `report` arrives with `successful: true`. On
30
- * that report the slot is cleared and the rows query is invalidated, so the
31
- * fresh snapshot flips the side to `new` (active).
28
+ * The `confirming` overlay ("POST accepted, awaiting handler") is merged into
29
+ * `tpState` / `slState` at read time — a side flagged as confirming reports
30
+ * state `"confirming"` regardless of what the row set says.
32
31
  */
33
32
  export declare function useQuoteTpSl(parameters: UseQuoteTpSlParameters): UseQuoteTpSlReturnType;
34
33
  //# sourceMappingURL=use-quote-tpsl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAYzE,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GACtD,eAAe,GAAG;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,GAAG;IACnF,qEAAqE;IACrE,IAAI,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,sBAAsB,GAAG,sBAAsB,CAmEvF"}
1
+ {"version":3,"file":"use-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG5E,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GACvE,eAAe,GAAG;IAChB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;AAEpF;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,sBAAsB,GAAG,sBAAsB,CA8CvF"}
@@ -2,72 +2,43 @@
2
2
  import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
3
  import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
4
  import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
- import { toQuoteTpSl as r } from "./to-quote-tpsl.js";
6
- import { EMPTY_TPSL_CONFIRMING as i, clearTpSlConfirmingSide as a, getTpSlConfirmingQueryKey as o } from "./tpsl-confirming.js";
7
- import { useWatchTpSlNotifications as s } from "./use-watch-tpsl-notifications.js";
8
- import { getQuoteTpSlQueryKey as c, getQuoteTpSlQueryOptions as l } from "@symmio/trading-core";
9
- import { useEffect as u, useMemo as d } from "react";
10
- import { useQuery as f, useQueryClient as p } from "@tanstack/react-query";
5
+ import { useTpSlRecord as r, useTpSlStore as i } from "./tpsl-store.js";
6
+ import { useWatchTpSlNotifications as a } from "./use-watch-tpsl-notifications.js";
7
+ import { getQuoteTpSlQueryOptions as o } from "@symmio/trading-core";
8
+ import { useQuery as s } from "@tanstack/react-query";
11
9
  //#region src/tpsl/use-quote-tpsl.ts
12
- function m(m) {
13
- let _ = t(m), v = e(), y = m.chainId ?? v, b = p(), x = _.getChainConfigKey(y), S = l(_, {
10
+ function c(c) {
11
+ let u = t(c), d = e(), f = c.chainId ?? d, p = r(c.quoteId), m = o(u, {
12
+ ...c,
13
+ chainId: f,
14
+ quoteId: c.quoteId
15
+ }), h = s({
14
16
  ...m,
15
- chainId: y
16
- }), C = f({
17
- ...S,
18
17
  queryFn: async () => {
19
18
  try {
20
- return await S.queryFn();
19
+ let e = await m.queryFn();
20
+ return i.getState().setRows(c.quoteId, e), e;
21
21
  } catch (e) {
22
22
  throw n(e);
23
23
  }
24
24
  }
25
- }), w = c({
26
- ...m,
27
- chainId: y,
28
- configKey: x
29
- }), T = o({
30
- chainId: y,
31
- quoteId: m.quoteId,
32
- configKey: x
33
- }), E = f({
34
- queryKey: T,
35
- queryFn: () => b.getQueryData(T) ?? i,
36
- initialData: i,
37
- staleTime: Infinity,
38
- gcTime: Infinity
39
- }).data ?? i, D = d(() => {
40
- if (C.data) return g(r(C.data), E);
41
- }, [C.data, E]), O = m.account, k = m.quoteId, A = JSON.stringify(w);
42
- return s({
43
- account: O,
44
- enabled: !!O && k > 0n,
25
+ });
26
+ return a({
27
+ account: c.account,
28
+ enabled: !!c.account && c.quoteId !== 0n,
45
29
  onNotification: (e) => {
46
- if (h(e, k)) {
47
- if (e.successful) {
48
- let t = e.conditionalOrderType === "take_profit" ? "tp" : e.conditionalOrderType === "stop_loss" ? "sl" : null;
49
- t && (e.state === "new" || e.state === "edit") && a(b, T, t);
50
- }
51
- b.invalidateQueries({ queryKey: w });
52
- }
30
+ e.primaryIdentifier !== 0 && e.secondaryIdentifier !== 0 && i.getState().link(BigInt(e.primaryIdentifier), BigInt(e.secondaryIdentifier)), l(e, c.quoteId) && i.getState().applyNotification(c.quoteId, e);
53
31
  }
54
- }), u(() => {}, [A]), {
55
- ...C,
56
- data: D,
57
- rows: C.data
32
+ }), {
33
+ query: h,
34
+ data: p
58
35
  };
59
36
  }
60
- function h(e, t) {
61
- return e.quoteId === Number(t);
62
- }
63
- function g(e, t) {
64
- return !t.tp && !t.sl ? e : {
65
- ...e,
66
- tpState: t.tp ? "confirming" : e.tpState,
67
- slState: t.sl ? "confirming" : e.slState
68
- };
37
+ function l(e, t) {
38
+ let n = i.getState(), r = n.get(t);
39
+ return r ? e.primaryIdentifier !== 0 && n.get(BigInt(e.primaryIdentifier)) === r || e.secondaryIdentifier !== 0 && n.get(BigInt(e.secondaryIdentifier)) === r : e.primaryIdentifier === Number(t) || e.secondaryIdentifier === Number(t) || e.quoteId === Number(t);
69
40
  }
70
41
  //#endregion
71
- export { m as useQuoteTpSl };
42
+ export { c as useQuoteTpSl };
72
43
 
73
44
  //# sourceMappingURL=use-quote-tpsl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteTpSlQueryKey,\n getQuoteTpSlQueryOptions,\n type ConfigParameter,\n type GetQuoteTpSlOptions,\n type QuoteTpSl,\n type QuoteTpSlRow,\n type TpSlNotification,\n} from \"@symmio/trading-core\";\nimport { useQuery, useQueryClient, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useEffect, useMemo } from \"react\";\nimport type { Address } from \"viem\";\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 { toQuoteTpSl } from \"./to-quote-tpsl\";\nimport {\n clearTpSlConfirmingSide,\n EMPTY_TPSL_CONFIRMING,\n getTpSlConfirmingQueryKey,\n type TpSlConfirming,\n} from \"./tpsl-confirming\";\nimport { useWatchTpSlNotifications } from \"./use-watch-tpsl-notifications\";\n\n/** Parameters for {@link useQuoteTpSl}. */\nexport type UseQuoteTpSlParameters = GetQuoteTpSlOptions &\n ConfigParameter & {\n /**\n * SubAccount address — when provided, the hook also subscribes to the\n * TP/SL WebSocket and reconciles the snapshot (`confirming` → `new`)\n * without manual polling. Omit to skip WS (REST-only).\n */\n account?: Address;\n };\n\n/** Return type of {@link useQuoteTpSl}. */\nexport type UseQuoteTpSlReturnType = UseQueryResult<QuoteTpSl, SymmioRequestError> & {\n /** The unfiltered conditional-order rows returned by the handler. */\n rows: QuoteTpSlRow[] | undefined;\n};\n\n/**\n * Read the TP/SL snapshot for one on-chain quote.\n *\n * The query caches the **raw handler rows** (every state — `pending` / `new` /\n * `triggered` / `canceled` / `killed`); the hook returns a folded\n * {@link QuoteTpSl} via {@link toQuoteTpSl}.\n *\n * State machine — when a POST just landed (via\n * {@link useSetQuoteTpSl}) the shared \"confirming\" slot is set for the\n * submitted sides; this hook overlays `tpState` / `slState = \"confirming\"`\n * until a matching WebSocket `report` arrives with `successful: true`. On\n * that report the slot is cleared and the rows query is invalidated, so the\n * fresh snapshot flips the side to `new` (active).\n */\nexport function useQuoteTpSl(parameters: UseQuoteTpSlParameters): UseQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const defaultChainId = useSymmioChainId();\n const chainId = parameters.chainId ?? defaultChainId;\n const queryClient = useQueryClient();\n const configKey = config.getChainConfigKey(chainId);\n\n const options = getQuoteTpSlQueryOptions(config, { ...parameters, chainId });\n const queryResult = useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n });\n\n const rowsKey = getQuoteTpSlQueryKey({ ...parameters, chainId, configKey });\n const confirmingKey = getTpSlConfirmingQueryKey({ chainId, quoteId: parameters.quoteId, configKey });\n\n const confirmingQuery = useQuery<TpSlConfirming>({\n queryKey: confirmingKey,\n queryFn: () => queryClient.getQueryData<TpSlConfirming>(confirmingKey) ?? EMPTY_TPSL_CONFIRMING,\n initialData: EMPTY_TPSL_CONFIRMING,\n staleTime: Infinity,\n gcTime: Infinity,\n });\n const confirming = confirmingQuery.data ?? EMPTY_TPSL_CONFIRMING;\n\n const folded = useMemo(() => {\n if (!queryResult.data) return undefined;\n const snapshot = toQuoteTpSl(queryResult.data);\n return applyConfirmingOverlay(snapshot, confirming);\n }, [queryResult.data, confirming]);\n\n const wsAccount = parameters.account;\n const matchQuoteId = parameters.quoteId;\n const rowsKeySerialized = JSON.stringify(rowsKey);\n\n useWatchTpSlNotifications({\n account: wsAccount,\n enabled: Boolean(wsAccount) && matchQuoteId > 0n,\n onNotification: (notification) => {\n if (!matchesQuote(notification, matchQuoteId)) return;\n if (notification.successful) {\n const side =\n notification.conditionalOrderType === \"take_profit\"\n ? \"tp\"\n : notification.conditionalOrderType === \"stop_loss\"\n ? \"sl\"\n : null;\n if (side && (notification.state === \"new\" || notification.state === \"edit\")) {\n clearTpSlConfirmingSide(queryClient, confirmingKey, side);\n }\n }\n void queryClient.invalidateQueries({ queryKey: rowsKey });\n },\n });\n\n useEffect(() => {\n void rowsKeySerialized;\n }, [rowsKeySerialized]);\n\n const result = { ...queryResult, data: folded, rows: queryResult.data } as unknown as UseQuoteTpSlReturnType;\n return result;\n}\n\nfunction matchesQuote(notification: TpSlNotification, quoteId: bigint): boolean {\n return notification.quoteId === Number(quoteId);\n}\n\n/**\n * If a side is awaiting WS confirmation, override its state to `confirming`\n * (the row snapshot may or may not have caught up yet — either way, \"await\n * WS\" takes precedence over what the REST rows report).\n */\nfunction applyConfirmingOverlay(snapshot: QuoteTpSl, confirming: TpSlConfirming): QuoteTpSl {\n if (!confirming.tp && !confirming.sl) return snapshot;\n return {\n ...snapshot,\n tpState: confirming.tp ? \"confirming\" : snapshot.tpState,\n slState: confirming.sl ? \"confirming\" : snapshot.slState,\n };\n}\n"],"mappings":";;;;;;;;;;;AA0DA,SAAgB,EAAa,GAA4D;CACvF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAChC,IAAc,EAAe,GAC7B,IAAY,EAAO,kBAAkB,CAAO,GAE5C,IAAU,EAAyB,GAAQ;EAAE,GAAG;EAAY;CAAQ,CAAC,GACrE,IAAc,EAAS;EAC3B,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC,GAEK,IAAU,EAAqB;EAAE,GAAG;EAAY;EAAS;CAAU,CAAC,GACpE,IAAgB,EAA0B;EAAE;EAAS,SAAS,EAAW;EAAS;CAAU,CAAC,GAS7F,IAPkB,EAAyB;EAC/C,UAAU;EACV,eAAe,EAAY,aAA6B,CAAa,KAAK;EAC1E,aAAa;EACb,WAAW;EACX,QAAQ;CACV,CACmB,EAAgB,QAAQ,GAErC,IAAS,QAAc;EACtB,MAAY,MAEjB,OAAO,EADU,EAAY,EAAY,IACX,GAAU,CAAU;CACpD,GAAG,CAAC,EAAY,MAAM,CAAU,CAAC,GAE3B,IAAY,EAAW,SACvB,IAAe,EAAW,SAC1B,IAAoB,KAAK,UAAU,CAAO;CA2BhD,OAzBA,EAA0B;EACxB,SAAS;EACT,SAAS,EAAQ,KAAc,IAAe;EAC9C,iBAAiB,MAAiB;GAC3B,MAAa,GAAc,CAAY,GAC5C;QAAI,EAAa,YAAY;KAC3B,IAAM,IACJ,EAAa,yBAAyB,gBAClC,OACA,EAAa,yBAAyB,cACpC,OACA;KACR,AAAI,MAAS,EAAa,UAAU,SAAS,EAAa,UAAU,WAClE,EAAwB,GAAa,GAAe,CAAI;IAE5D;IACA,EAAiB,kBAAkB,EAAE,UAAU,EAAQ,CAAC;GADxD;EAEF;CACF,CAAC,GAED,QAAgB,CAEhB,GAAG,CAAC,CAAiB,CAAC,GAGf;EADU,GAAG;EAAa,MAAM;EAAQ,MAAM,EAAY;CAC1D;AACT;AAEA,SAAS,EAAa,GAAgC,GAA0B;CAC9E,OAAO,EAAa,YAAY,OAAO,CAAO;AAChD;AAOA,SAAS,EAAuB,GAAqB,GAAuC;CAE1F,OADI,CAAC,EAAW,MAAM,CAAC,EAAW,KAAW,IACtC;EACL,GAAG;EACH,SAAS,EAAW,KAAK,eAAe,EAAS;EACjD,SAAS,EAAW,KAAK,eAAe,EAAS;CACnD;AACF"}
1
+ {"version":3,"file":"use-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteTpSlQueryOptions,\n type ConfigParameter,\n type GetQuoteTpSlOptions,\n type TpSlNotification,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport type { Address } from \"viem\";\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 { useTpSlRecord, useTpSlStore, type TpSlRecord } from \"./tpsl-store\";\nimport { useWatchTpSlNotifications } from \"./use-watch-tpsl-notifications\";\n\n/** Parameters for {@link useQuoteTpSl}. */\nexport type UseQuoteTpSlParameters = Omit<GetQuoteTpSlOptions, \"quoteId\"> &\n ConfigParameter & {\n /**\n * Quote id — accepts either the on-chain `quoteId` or the hedger\n * `tempQuoteId`. Whichever is passed, the hook resolves to the same\n * shared record via the store's id index.\n */\n quoteId: bigint;\n /**\n * SubAccount address — when provided, the hook also subscribes to the\n * TP/SL WebSocket and reconciles the record without manual polling.\n */\n account?: Address;\n };\n\n/** Return type of {@link useQuoteTpSl}. */\nexport type UseQuoteTpSlReturnType = UseQueryResult<TpSlRecord, SymmioRequestError>;\n\n/**\n * Read the folded TP/SL snapshot for one quote. Pass either the on-chain\n * `quoteId` or the hedger `tempQuoteId` — the store keeps a single record per\n * quote indexed under every id it has learned for that quote, so both callers\n * get the same object.\n *\n * The `confirming` overlay (\"POST accepted, awaiting handler\") is merged into\n * `tpState` / `slState` at read time — a side flagged as confirming reports\n * state `\"confirming\"` regardless of what the row set says.\n */\nexport function useQuoteTpSl(parameters: UseQuoteTpSlParameters): UseQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const defaultChainId = useSymmioChainId();\n const chainId = parameters.chainId ?? defaultChainId;\n\n const record = useTpSlRecord(parameters.quoteId);\n const options = getQuoteTpSlQueryOptions(config, {\n ...parameters,\n chainId,\n quoteId: parameters.quoteId,\n });\n // Re-fetch is driven by TanStack Query cache: mutations invalidate `rowsKey`,\n // which triggers a refetch here so the store record picks up the newly\n // committed tp/sl values. (An earlier version gated on `record === undefined`\n // to avoid a duplicate fetch when the on-chain quoteId first appeared, but\n // that also swallowed post-mutation invalidations — leaving the box stuck on\n // the old values.)\n const queryResult = useQuery({\n ...options,\n queryFn: async () => {\n try {\n const rows = await options.queryFn();\n useTpSlStore.getState().setRows(parameters.quoteId, rows);\n return rows;\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n });\n\n useWatchTpSlNotifications({\n account: parameters.account,\n enabled: Boolean(parameters.account) && parameters.quoteId !== 0n,\n onNotification: (notification) => {\n if (notification.primaryIdentifier !== 0 && notification.secondaryIdentifier !== 0) {\n useTpSlStore.getState().link(BigInt(notification.primaryIdentifier), BigInt(notification.secondaryIdentifier));\n }\n if (!matchesQuote(notification, parameters.quoteId)) return;\n useTpSlStore.getState().applyNotification(parameters.quoteId, notification);\n },\n });\n\n return {\n query: queryResult,\n data: record,\n } as unknown as UseQuoteTpSlReturnType;\n}\n\n/**\n * True when the notification and the caller address the same store record.\n * Uses the store's id index — every id linked to the same record maps to\n * the same object, so reference equality decides the match.\n */\nfunction matchesQuote(notification: TpSlNotification, quoteId: bigint): boolean {\n const store = useTpSlStore.getState();\n const target = store.get(quoteId);\n if (!target) {\n // No record yet for the target — fall back to raw-id compare so the\n // first \"seed\" frame still matches.\n return (\n notification.primaryIdentifier === Number(quoteId) ||\n notification.secondaryIdentifier === Number(quoteId) ||\n notification.quoteId === Number(quoteId)\n );\n }\n if (notification.primaryIdentifier !== 0 && store.get(BigInt(notification.primaryIdentifier)) === target) return true;\n if (notification.secondaryIdentifier !== 0 && store.get(BigInt(notification.secondaryIdentifier)) === target)\n return true;\n return false;\n}\n"],"mappings":";;;;;;;;;AA8CA,SAAgB,EAAa,GAA4D;CACvF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAEhC,IAAS,EAAc,EAAW,OAAO,GACzC,IAAU,EAAyB,GAAQ;EAC/C,GAAG;EACH;EACA,SAAS,EAAW;CACtB,CAAC,GAOK,IAAc,EAAS;EAC3B,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,IAAM,IAAO,MAAM,EAAQ,QAAQ;IAEnC,OADA,EAAa,SAAS,EAAE,QAAQ,EAAW,SAAS,CAAI,GACjD;GACT,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;CAcD,OAZA,EAA0B;EACxB,SAAS,EAAW;EACpB,SAAS,EAAQ,EAAW,WAAY,EAAW,YAAY;EAC/D,iBAAiB,MAAiB;GAChC,AAAI,EAAa,sBAAsB,KAAK,EAAa,wBAAwB,KAC/E,EAAa,SAAS,EAAE,KAAK,OAAO,EAAa,iBAAiB,GAAG,OAAO,EAAa,mBAAmB,CAAC,GAE1G,EAAa,GAAc,EAAW,OAAO,KAClD,EAAa,SAAS,EAAE,kBAAkB,EAAW,SAAS,CAAY;EAC5E;CACF,CAAC,GAEM;EACL,OAAO;EACP,MAAM;CACR;AACF;AAOA,SAAS,EAAa,GAAgC,GAA0B;CAC9E,IAAM,IAAQ,EAAa,SAAS,GAC9B,IAAS,EAAM,IAAI,CAAO;CAahC,OAZK,IASD,EAAa,sBAAsB,KAAK,EAAM,IAAI,OAAO,EAAa,iBAAiB,CAAC,MAAM,KAC9F,EAAa,wBAAwB,KAAK,EAAM,IAAI,OAAO,EAAa,mBAAmB,CAAC,MAAM,IANlG,EAAa,sBAAsB,OAAO,CAAO,KACjD,EAAa,wBAAwB,OAAO,CAAO,KACnD,EAAa,YAAY,OAAO,CAAO;AAO7C"}
@@ -1,22 +1,23 @@
1
1
  import { ConfigParameter, SetQuoteTpSlParameters, SetQuoteTpSlReturnType } from '@symmio/trading-core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /** Parameters for {@link useSetQuoteTpSl}. */
5
5
  export type UseSetQuoteTpSlParameters = ConfigParameter;
6
6
  /** Return type of {@link useSetQuoteTpSl}. */
7
7
  export type UseSetQuoteTpSlReturnType = UseMutationResult<SetQuoteTpSlReturnType, SymmioRequestError, SetQuoteTpSlParameters>;
8
8
  /**
9
- * Submit a TP/SL order for one on-chain quote. Signs an EIP-712 message with
10
- * the session-key wallet and posts to the handler.
9
+ * Submit a TP/SL order for one quote. Signs an EIP-712 message with the
10
+ * session-key wallet and POSTs to the handler.
11
11
  *
12
12
  * State machine (per side):
13
- * 1. `pending` — POST in flight (`mutation.isPending`).
14
- * 2. `confirming` — POST returned 200; we've written the flag into the shared
15
- * confirming cache slot ({@link getTpSlConfirmingQueryKey}). `useQuoteTpSl`
16
- * overlays this as `tpState` / `slState = "confirming"`.
17
- * 3. `new` — Handler broadcast a `report` with `successful: true`;
18
- * `useQuoteTpSl`'s WS listener clears the confirming flag and invalidates
19
- * the row query, so the fresh snapshot flips the side to active.
13
+ * 1. `pending` — POST in flight (`mutation.isPending`).
14
+ * 2. `confirming` — POST returned 200; the store's `markConfirming` sets
15
+ * `tp/slState` to `"confirming"` and seeds the target trigger price so
16
+ * the UI can render it immediately.
17
+ * 3. `new` — Handler broadcast a `report` with `successful: true`;
18
+ * `useQuoteTpSl`'s WS listener runs `applyNotification`, which flips the
19
+ * side into its wire-reported state and confirms the trigger price from
20
+ * `details.trigger_price`. No REST refetch — the store is authoritative.
20
21
  */
21
22
  export declare function useSetQuoteTpSl(parameters?: UseSetQuoteTpSlParameters): UseSetQuoteTpSlReturnType;
22
23
  //# sourceMappingURL=use-set-quote-tpsl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-set-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-set-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAExD,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CACvD,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,CACvB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,yBAA8B,GAAG,yBAAyB,CA+BrG"}
1
+ {"version":3,"file":"use-set-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-set-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAExD,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CACvD,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,yBAA8B,GAAG,yBAAyB,CAgCrG"}
@@ -2,42 +2,38 @@
2
2
  import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
3
  import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
4
  import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
- import { getTpSlConfirmingQueryKey as r, markTpSlConfirming as i } from "./tpsl-confirming.js";
6
- import { getQuoteTpSlQueryKey as a, setQuoteTpSlMutationOptions as o } from "@symmio/trading-core";
7
- import { useMutation as s, useQueryClient as c } from "@tanstack/react-query";
5
+ import { useTpSlStore as r } from "./tpsl-store.js";
6
+ import { setQuoteTpSlMutationOptions as i } from "@symmio/trading-core";
7
+ import { useMutation as a } from "@tanstack/react-query";
8
8
  //#region src/tpsl/use-set-quote-tpsl.ts
9
- function l(l = {}) {
10
- let u = t(l), d = e(), f = c(), p = o(u);
11
- return s({
12
- mutationKey: p.mutationKey,
9
+ function o(o = {}) {
10
+ let s = t(o), c = e(), l = i(s), u = r((e) => e.markConfirming);
11
+ return a({
12
+ mutationKey: l.mutationKey,
13
13
  mutationFn: async (e) => {
14
14
  try {
15
- return await p.mutationFn({
15
+ return await l.mutationFn({
16
16
  ...e,
17
- chainId: e.chainId ?? d
17
+ chainId: e.chainId ?? c
18
18
  });
19
19
  } catch (e) {
20
20
  throw n(e);
21
21
  }
22
22
  },
23
23
  onSuccess: (e, t) => {
24
- let n = t.chainId ?? d, o = u.getChainConfigKey(n), s = a({
25
- chainId: n,
26
- quoteId: t.quoteId,
27
- configKey: o
24
+ t.tp && u(t.quoteId, "tp", {
25
+ price: t.tp.triggerPrice,
26
+ priceType: t.tp.priceType,
27
+ cohQuoteId: e.cohQuoteId
28
+ }), t.sl && u(t.quoteId, "sl", {
29
+ price: t.sl.triggerPrice,
30
+ priceType: t.sl.priceType,
31
+ cohQuoteId: e.cohQuoteId
28
32
  });
29
- i(f, r({
30
- chainId: n,
31
- quoteId: t.quoteId,
32
- configKey: o
33
- }), {
34
- tp: !!t.tp,
35
- sl: !!t.sl
36
- }), f.invalidateQueries({ queryKey: s });
37
33
  }
38
34
  });
39
35
  }
40
36
  //#endregion
41
- export { l as useSetQuoteTpSl };
37
+ export { o as useSetQuoteTpSl };
42
38
 
43
39
  //# sourceMappingURL=use-set-quote-tpsl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-set-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-set-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteTpSlQueryKey,\n setQuoteTpSlMutationOptions,\n type ConfigParameter,\n type SetQuoteTpSlParameters,\n type SetQuoteTpSlReturnType,\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 { getTpSlConfirmingQueryKey, markTpSlConfirming } from \"./tpsl-confirming\";\n\n/** Parameters for {@link useSetQuoteTpSl}. */\nexport type UseSetQuoteTpSlParameters = ConfigParameter;\n\n/** Return type of {@link useSetQuoteTpSl}. */\nexport type UseSetQuoteTpSlReturnType = UseMutationResult<\n SetQuoteTpSlReturnType,\n SymmioRequestError,\n SetQuoteTpSlParameters\n>;\n\n/**\n * Submit a TP/SL order for one on-chain quote. Signs an EIP-712 message with\n * the session-key wallet and posts to the handler.\n *\n * State machine (per side):\n * 1. `pending` — POST in flight (`mutation.isPending`).\n * 2. `confirming` — POST returned 200; we've written the flag into the shared\n * confirming cache slot ({@link getTpSlConfirmingQueryKey}). `useQuoteTpSl`\n * overlays this as `tpState` / `slState = \"confirming\"`.\n * 3. `new` — Handler broadcast a `report` with `successful: true`;\n * `useQuoteTpSl`'s WS listener clears the confirming flag and invalidates\n * the row query, so the fresh snapshot flips the side to active.\n */\nexport function useSetQuoteTpSl(parameters: UseSetQuoteTpSlParameters = {}): UseSetQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = setQuoteTpSlMutationOptions(config);\n\n return useMutation<SetQuoteTpSlReturnType, SymmioRequestError, SetQuoteTpSlParameters>({\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 const resolvedChainId = variables.chainId ?? chainId;\n const configKey = config.getChainConfigKey(resolvedChainId);\n const rowsKey = getQuoteTpSlQueryKey({ chainId: resolvedChainId, quoteId: variables.quoteId, configKey });\n const confirmingKey = getTpSlConfirmingQueryKey({\n chainId: resolvedChainId,\n quoteId: variables.quoteId,\n configKey,\n });\n markTpSlConfirming(queryClient, confirmingKey, {\n tp: Boolean(variables.tp),\n sl: Boolean(variables.sl),\n });\n void queryClient.invalidateQueries({ queryKey: rowsKey });\n },\n });\n}\n"],"mappings":";;;;;;;;AAuCA,SAAgB,EAAgB,IAAwC,CAAC,GAA8B;CACrG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA4B,CAAM;CAE/C,OAAO,EAAgF;EACrF,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;GACjC,IAAM,IAAkB,EAAU,WAAW,GACvC,IAAY,EAAO,kBAAkB,CAAe,GACpD,IAAU,EAAqB;IAAE,SAAS;IAAiB,SAAS,EAAU;IAAS;GAAU,CAAC;GAUxG,AAJA,EAAmB,GALG,EAA0B;IAC9C,SAAS;IACT,SAAS,EAAU;IACnB;GACF,CACgC,GAAe;IAC7C,IAAI,EAAQ,EAAU;IACtB,IAAI,EAAQ,EAAU;GACxB,CAAC,GACD,EAAiB,kBAAkB,EAAE,UAAU,EAAQ,CAAC;EAC1D;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-set-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-set-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n setQuoteTpSlMutationOptions,\n type ConfigParameter,\n type SetQuoteTpSlParameters,\n type SetQuoteTpSlReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { useTpSlStore } from \"./tpsl-store\";\n\n/** Parameters for {@link useSetQuoteTpSl}. */\nexport type UseSetQuoteTpSlParameters = ConfigParameter;\n\n/** Return type of {@link useSetQuoteTpSl}. */\nexport type UseSetQuoteTpSlReturnType = UseMutationResult<\n SetQuoteTpSlReturnType,\n SymmioRequestError,\n SetQuoteTpSlParameters\n>;\n\n/**\n * Submit a TP/SL order for one quote. Signs an EIP-712 message with the\n * session-key wallet and POSTs to the handler.\n *\n * State machine (per side):\n * 1. `pending` — POST in flight (`mutation.isPending`).\n * 2. `confirming` — POST returned 200; the store's `markConfirming` sets\n * `tp/slState` to `\"confirming\"` and seeds the target trigger price so\n * the UI can render it immediately.\n * 3. `new` — Handler broadcast a `report` with `successful: true`;\n * `useQuoteTpSl`'s WS listener runs `applyNotification`, which flips the\n * side into its wire-reported state and confirms the trigger price from\n * `details.trigger_price`. No REST refetch — the store is authoritative.\n */\nexport function useSetQuoteTpSl(parameters: UseSetQuoteTpSlParameters = {}): UseSetQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const base = setQuoteTpSlMutationOptions(config);\n const markConfirming = useTpSlStore((state) => state.markConfirming);\n\n return useMutation<SetQuoteTpSlReturnType, SymmioRequestError, SetQuoteTpSlParameters>({\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 if (variables.tp) {\n markConfirming(variables.quoteId, \"tp\", {\n price: variables.tp.triggerPrice,\n priceType: variables.tp.priceType,\n cohQuoteId: result.cohQuoteId,\n });\n }\n if (variables.sl) {\n markConfirming(variables.quoteId, \"sl\", {\n price: variables.sl.triggerPrice,\n priceType: variables.sl.priceType,\n cohQuoteId: result.cohQuoteId,\n });\n }\n },\n });\n}\n"],"mappings":";;;;;;;;AAuCA,SAAgB,EAAgB,IAAwC,CAAC,GAA8B;CACrG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAO,EAA4B,CAAM,GACzC,IAAiB,GAAc,MAAU,EAAM,cAAc;CAEnE,OAAO,EAAgF;EACrF,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,GAAQ,MAAc;GAQhC,AAPI,EAAU,MACZ,EAAe,EAAU,SAAS,MAAM;IACtC,OAAO,EAAU,GAAG;IACpB,WAAW,EAAU,GAAG;IACxB,YAAY,EAAO;GACrB,CAAC,GAEC,EAAU,MACZ,EAAe,EAAU,SAAS,MAAM;IACtC,OAAO,EAAU,GAAG;IACpB,WAAW,EAAU,GAAG;IACxB,YAAY,EAAO;GACrB,CAAC;EAEL;CACF,CAAC;AACH"}
@@ -1,6 +1,6 @@
1
1
  import { ConfigParameter, GetTpSlConfigOptions, GetTpSlConfigReturnType } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /** Parameters for {@link useTpSlConfig}. */
5
5
  export type UseTpSlConfigParameters = GetTpSlConfigOptions & ConfigParameter;
6
6
  /** Return type of {@link useTpSlConfig}. */
@@ -1,6 +1,6 @@
1
1
  import { ConfigParameter, GetTpSlSigningSpecOptions, GetTpSlSigningSpecReturnType } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /** Parameters for {@link useTpSlSigningSpec}. */
5
5
  export type UseTpSlSigningSpecParameters = GetTpSlSigningSpecOptions & ConfigParameter;
6
6
  /** Return type of {@link useTpSlSigningSpec}. */
@@ -1,6 +1,6 @@
1
1
  import { ConfigParameter, SocketStatus, TpSlNotification } from '@symmio/trading-core';
2
2
  import { Address } from 'viem';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /**
5
5
  * Parameters for {@link useWatchTpSlNotifications}.
6
6
  */
@@ -1,4 +1,4 @@
1
- export * from './resolve-write-result';
2
- export * from './use-transactions-store';
3
- export * from './write-types';
1
+ export * from './resolve-write-result.js';
2
+ export * from './use-transactions-store.js';
3
+ export * from './write-types.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { resolveWriteResult as e } from "./resolve-write-result.js";
2
+ import { useTransactionsStore as t } from "./use-transactions-store.js";
3
+ export { e as resolveWriteResult, t as useTransactionsStore };
@@ -1,6 +1,6 @@
1
1
  import { Config } from '@symmio/trading-core';
2
2
  import { Hash } from 'viem';
3
- import { WriteResult } from './write-types';
3
+ import { WriteResult } from './write-types.js';
4
4
  /**
5
5
  * Options for {@link resolveWriteResult}.
6
6
  */
@@ -1,2 +1,2 @@
1
- export * from './use-transfer-history';
1
+ export * from './use-transfer-history.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { ConfigParameter, GetTransferHistoryOptions, GetTransferHistoryReturnType } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /**
5
5
  * Parameters for {@link useTransferHistory}: the core query options (accounts,
6
6
  * direction, paging, time range, chain id, TanStack `query` overrides) plus an
@@ -1,2 +1,2 @@
1
- export { predicateMatch } from './predicate-match';
1
+ export { predicateMatch } from './predicate-match.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- export * from './use-connect-wallet';
2
- export * from './use-disconnect-wallet';
3
- export * from './use-switch-to-symmio-chain';
4
- export * from './use-wallet-account';
1
+ export * from './use-connect-wallet.js';
2
+ export * from './use-disconnect-wallet.js';
3
+ export * from './use-switch-to-symmio-chain.js';
4
+ export * from './use-wallet-account.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { useConnectWallet as e } from "./use-connect-wallet.js";
2
+ import { useDisconnectWallet as t } from "./use-disconnect-wallet.js";
3
+ import { useSwitchToSymmioChain as n } from "./use-switch-to-symmio-chain.js";
4
+ import { useWalletAccount as r } from "./use-wallet-account.js";
5
+ export { e as useConnectWallet, t as useDisconnectWallet, n as useSwitchToSymmioChain, r as useWalletAccount };
@@ -1,5 +1,5 @@
1
1
  import { Connector } from 'wagmi';
2
- import { SymmioRequestError } from '../errors/symmio-request-error';
2
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
3
3
  /**
4
4
  * Result shape returned by {@link useConnectWallet}.
5
5
  */
@@ -1,4 +1,4 @@
1
- import { SymmioRequestError } from '../errors/symmio-request-error';
1
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
2
2
  /**
3
3
  * Result shape returned by {@link useSwitchToSymmioChain}.
4
4
  */
@@ -1,2 +1,2 @@
1
- export { useNotifications, type UseNotificationsParameters, type UseNotificationsReturnType, } from './use-notifications';
1
+ export { useNotifications, type UseNotificationsParameters, type UseNotificationsReturnType, } from './use-notifications.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { ConfigParameter, Notification, SocketStatus } from '@symmio/trading-core';
2
2
  import { Address } from 'viem';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /**
5
5
  * Parameters for {@link useNotifications}.
6
6
  */
@@ -1,11 +1,11 @@
1
- export * from './use-finalize-withdraw-request';
2
- export * from './use-initiate-withdraw';
3
- export * from './use-last-withdraw-request-id';
4
- export * from './use-pending-withdraw-requests';
5
- export * from './use-request-cancel-withdraw';
6
- export * from './use-simulate-finalize-withdraw-request';
7
- export * from './use-simulate-initiate-withdraw';
8
- export * from './use-simulate-request-cancel-withdraw';
9
- export * from './use-withdraw-requests';
10
- export * from './use-withdrawable-time';
1
+ export * from './use-finalize-withdraw-request.js';
2
+ export * from './use-initiate-withdraw.js';
3
+ export * from './use-last-withdraw-request-id.js';
4
+ export * from './use-pending-withdraw-requests.js';
5
+ export * from './use-request-cancel-withdraw.js';
6
+ export * from './use-simulate-finalize-withdraw-request.js';
7
+ export * from './use-simulate-initiate-withdraw.js';
8
+ export * from './use-simulate-request-cancel-withdraw.js';
9
+ export * from './use-withdraw-requests.js';
10
+ export * from './use-withdrawable-time.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { FinalizeWithdrawRequestParameters } from '@symmio/trading-core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
4
- import { WriteParameters, WriteResult } from '../transactions';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { WriteParameters, WriteResult } from '../transactions/index.js';
5
5
  /**
6
6
  * Parameters for {@link useFinalizeWithdrawRequest}.
7
7
  */
@@ -1,7 +1,7 @@
1
1
  import { InitiateWithdrawParameters } from '@symmio/trading-core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
4
- import { WriteParameters, WriteResult } from '../transactions';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { WriteParameters, WriteResult } from '../transactions/index.js';
5
5
  /**
6
6
  * Parameters for {@link useInitiateWithdraw}.
7
7
  */
@@ -1,6 +1,6 @@
1
1
  import { ConfigParameter, GetLastWithdrawRequestIdOptions, GetLastWithdrawRequestIdReturnType } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /**
5
5
  * Parameters for {@link useLastWithdrawRequestId}: the core query options (user,
6
6
  * chain id, TanStack `query` overrides) plus an optional `config`.
@@ -1,6 +1,6 @@
1
1
  import { ConfigParameter, GetPendingWithdrawRequestsOptions, GetPendingWithdrawRequestsReturnType } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /**
5
5
  * Parameters for {@link usePendingWithdrawRequests}: the core query options (user,
6
6
  * pagination, chain id, TanStack `query` overrides) plus an optional `config`.
@@ -1,7 +1,7 @@
1
1
  import { RequestCancelWithdrawParameters } from '@symmio/trading-core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
4
- import { WriteParameters, WriteResult } from '../transactions';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { WriteParameters, WriteResult } from '../transactions/index.js';
5
5
  /**
6
6
  * Parameters for {@link useRequestCancelWithdraw}.
7
7
  */
@@ -1,6 +1,6 @@
1
1
  import { ConfigParameter, SimulateFinalizeWithdrawRequestParameters, SimulateFinalizeWithdrawRequestReturnType } from '@symmio/trading-core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
- import { SymmioRequestError } from '../errors/symmio-request-error';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /**
5
5
  * Parameters for {@link useSimulateFinalizeWithdrawRequest}: an optional `config` override. The dry-run's
6
6
  * inputs are passed as the mutation `variables`.