@symmio/trading-react 4.3.0 → 4.5.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 (186) hide show
  1. package/dist/account-layer/automatic-timelock-attempt.d.ts +11 -0
  2. package/dist/account-layer/automatic-timelock-attempt.d.ts.map +1 -0
  3. package/dist/account-layer/automatic-timelock-attempt.js +41 -0
  4. package/dist/account-layer/automatic-timelock-attempt.js.map +1 -0
  5. package/dist/account-layer/index.d.ts +9 -0
  6. package/dist/account-layer/index.d.ts.map +1 -1
  7. package/dist/account-layer/index.js +41 -32
  8. package/dist/account-layer/use-active-virtual-account-by-key.d.ts +33 -0
  9. package/dist/account-layer/use-active-virtual-account-by-key.d.ts.map +1 -0
  10. package/dist/account-layer/use-active-virtual-account-by-key.js +27 -0
  11. package/dist/account-layer/use-active-virtual-account-by-key.js.map +1 -0
  12. package/dist/account-layer/use-add-margin.d.ts +2 -2
  13. package/dist/account-layer/use-add-margin.d.ts.map +1 -1
  14. package/dist/account-layer/use-add-margin.js +28 -17
  15. package/dist/account-layer/use-add-margin.js.map +1 -1
  16. package/dist/account-layer/use-allocate.d.ts +2 -2
  17. package/dist/account-layer/use-allocate.d.ts.map +1 -1
  18. package/dist/account-layer/use-allocate.js +28 -17
  19. package/dist/account-layer/use-allocate.js.map +1 -1
  20. package/dist/account-layer/use-automatic-timelock-recovery.d.ts +25 -0
  21. package/dist/account-layer/use-automatic-timelock-recovery.d.ts.map +1 -0
  22. package/dist/account-layer/use-automatic-timelock-recovery.js +26 -0
  23. package/dist/account-layer/use-automatic-timelock-recovery.js.map +1 -0
  24. package/dist/account-layer/use-automatic-timelock.d.ts +48 -0
  25. package/dist/account-layer/use-automatic-timelock.d.ts.map +1 -0
  26. package/dist/account-layer/use-automatic-timelock.js +189 -0
  27. package/dist/account-layer/use-automatic-timelock.js.map +1 -0
  28. package/dist/account-layer/use-create-sub-accounts.d.ts +9 -4
  29. package/dist/account-layer/use-create-sub-accounts.d.ts.map +1 -1
  30. package/dist/account-layer/use-create-sub-accounts.js +11 -13
  31. package/dist/account-layer/use-create-sub-accounts.js.map +1 -1
  32. package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts +3 -3
  33. package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts.map +1 -1
  34. package/dist/account-layer/use-deallocate-and-initiate-withdraw.js +32 -21
  35. package/dist/account-layer/use-deallocate-and-initiate-withdraw.js.map +1 -1
  36. package/dist/account-layer/use-deallocate.d.ts +6 -5
  37. package/dist/account-layer/use-deallocate.d.ts.map +1 -1
  38. package/dist/account-layer/use-deallocate.js +33 -20
  39. package/dist/account-layer/use-deallocate.js.map +1 -1
  40. package/dist/account-layer/use-delete-sub-account.d.ts +2 -2
  41. package/dist/account-layer/use-delete-sub-account.d.ts.map +1 -1
  42. package/dist/account-layer/use-delete-sub-account.js +30 -19
  43. package/dist/account-layer/use-delete-sub-account.js.map +1 -1
  44. package/dist/account-layer/use-execute-account-calls.d.ts +7 -0
  45. package/dist/account-layer/use-execute-account-calls.d.ts.map +1 -0
  46. package/dist/account-layer/use-execute-account-calls.js +54 -0
  47. package/dist/account-layer/use-execute-account-calls.js.map +1 -0
  48. package/dist/account-layer/use-protected-function.d.ts +22 -0
  49. package/dist/account-layer/use-protected-function.d.ts.map +1 -0
  50. package/dist/account-layer/use-protected-function.js +68 -0
  51. package/dist/account-layer/use-protected-function.js.map +1 -0
  52. package/dist/account-layer/use-remove-margin.d.ts +2 -2
  53. package/dist/account-layer/use-remove-margin.d.ts.map +1 -1
  54. package/dist/account-layer/use-remove-margin.js +31 -20
  55. package/dist/account-layer/use-remove-margin.js.map +1 -1
  56. package/dist/account-layer/use-timelock-policy.d.ts +21 -0
  57. package/dist/account-layer/use-timelock-policy.d.ts.map +1 -0
  58. package/dist/account-layer/use-timelock-policy.js +112 -0
  59. package/dist/account-layer/use-timelock-policy.js.map +1 -0
  60. package/dist/account-layer/use-timelock-route.d.ts +75 -0
  61. package/dist/account-layer/use-timelock-route.d.ts.map +1 -0
  62. package/dist/account-layer/use-timelock-route.js +177 -0
  63. package/dist/account-layer/use-timelock-route.js.map +1 -0
  64. package/dist/account-layer/use-timelock.d.ts +102 -0
  65. package/dist/account-layer/use-timelock.d.ts.map +1 -0
  66. package/dist/account-layer/use-timelock.js +177 -0
  67. package/dist/account-layer/use-timelock.js.map +1 -0
  68. package/dist/account-layer/use-virtual-accounts-count-of-sub-account.d.ts +24 -0
  69. package/dist/account-layer/use-virtual-accounts-count-of-sub-account.d.ts.map +1 -0
  70. package/dist/account-layer/use-virtual-accounts-count-of-sub-account.js +27 -0
  71. package/dist/account-layer/use-virtual-accounts-count-of-sub-account.js.map +1 -0
  72. package/dist/account-layer/use-virtual-accounts-of-sub-account.d.ts +25 -0
  73. package/dist/account-layer/use-virtual-accounts-of-sub-account.d.ts.map +1 -0
  74. package/dist/account-layer/use-virtual-accounts-of-sub-account.js +27 -0
  75. package/dist/account-layer/use-virtual-accounts-of-sub-account.js.map +1 -0
  76. package/dist/errors/normalize-protected-write-error.d.ts +5 -0
  77. package/dist/errors/normalize-protected-write-error.d.ts.map +1 -0
  78. package/dist/errors/normalize-protected-write-error.js +43 -0
  79. package/dist/errors/normalize-protected-write-error.js.map +1 -0
  80. package/dist/errors/normalize-symm-error.d.ts.map +1 -1
  81. package/dist/errors/normalize-symm-error.js +56 -43
  82. package/dist/errors/normalize-symm-error.js.map +1 -1
  83. package/dist/errors/symmio-request-error.d.ts +5 -0
  84. package/dist/errors/symmio-request-error.d.ts.map +1 -1
  85. package/dist/errors/symmio-request-error.js +2 -1
  86. package/dist/errors/symmio-request-error.js.map +1 -1
  87. package/dist/gasless/index.d.ts +1 -0
  88. package/dist/gasless/index.d.ts.map +1 -1
  89. package/dist/gasless/index.js +20 -19
  90. package/dist/gasless/invalidate-relay-reads.d.ts +3 -1
  91. package/dist/gasless/invalidate-relay-reads.d.ts.map +1 -1
  92. package/dist/gasless/invalidate-relay-reads.js +115 -60
  93. package/dist/gasless/invalidate-relay-reads.js.map +1 -1
  94. package/dist/gasless/use-approve-operational-fee-allowance.d.ts +37 -0
  95. package/dist/gasless/use-approve-operational-fee-allowance.d.ts.map +1 -0
  96. package/dist/gasless/use-approve-operational-fee-allowance.js +48 -0
  97. package/dist/gasless/use-approve-operational-fee-allowance.js.map +1 -0
  98. package/dist/gasless/use-approve-operational-fee.d.ts +2 -2
  99. package/dist/gasless/use-approve-operational-fee.d.ts.map +1 -1
  100. package/dist/gasless/use-approve-operational-fee.js +28 -17
  101. package/dist/gasless/use-approve-operational-fee.js.map +1 -1
  102. package/dist/gasless/use-relay-gasless-batch.d.ts +5 -4
  103. package/dist/gasless/use-relay-gasless-batch.d.ts.map +1 -1
  104. package/dist/gasless/use-relay-gasless-batch.js.map +1 -1
  105. package/dist/index.d.ts +13 -7
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +271 -256
  108. package/dist/instant-layer/index.d.ts +2 -0
  109. package/dist/instant-layer/index.d.ts.map +1 -1
  110. package/dist/instant-layer/index.js +25 -23
  111. package/dist/instant-layer/invalidate-delegation-grant.d.ts +17 -0
  112. package/dist/instant-layer/invalidate-delegation-grant.d.ts.map +1 -0
  113. package/dist/instant-layer/invalidate-delegation-grant.js +26 -0
  114. package/dist/instant-layer/invalidate-delegation-grant.js.map +1 -0
  115. package/dist/instant-layer/use-grant-delegation.d.ts +3 -1
  116. package/dist/instant-layer/use-grant-delegation.d.ts.map +1 -1
  117. package/dist/instant-layer/use-grant-delegation.js +19 -28
  118. package/dist/instant-layer/use-grant-delegation.js.map +1 -1
  119. package/dist/instant-layer/use-grant-delegations.d.ts +44 -0
  120. package/dist/instant-layer/use-grant-delegations.d.ts.map +1 -0
  121. package/dist/instant-layer/use-grant-delegations.js +36 -0
  122. package/dist/instant-layer/use-grant-delegations.js.map +1 -0
  123. package/dist/instant-layer/use-instant-close-fees.js +8 -8
  124. package/dist/instant-layer/use-instant-open-inputs.d.ts +1 -0
  125. package/dist/instant-layer/use-instant-open-inputs.d.ts.map +1 -1
  126. package/dist/instant-layer/use-instant-open-inputs.js +81 -80
  127. package/dist/instant-layer/use-instant-open-inputs.js.map +1 -1
  128. package/dist/instant-layer/use-prepare-instant-open-params.d.ts +6 -0
  129. package/dist/instant-layer/use-prepare-instant-open-params.d.ts.map +1 -1
  130. package/dist/instant-layer/use-prepare-instant-open-params.js +1 -0
  131. package/dist/instant-layer/use-prepare-instant-open-params.js.map +1 -1
  132. package/dist/instant-layer/use-session-key-selectors.d.ts +5 -2
  133. package/dist/instant-layer/use-session-key-selectors.d.ts.map +1 -1
  134. package/dist/instant-layer/use-session-key-selectors.js +9 -5
  135. package/dist/instant-layer/use-session-key-selectors.js.map +1 -1
  136. package/dist/instant-layer/use-simulate-grant-delegations.d.ts +25 -0
  137. package/dist/instant-layer/use-simulate-grant-delegations.d.ts.map +1 -0
  138. package/dist/instant-layer/use-simulate-grant-delegations.js +29 -0
  139. package/dist/instant-layer/use-simulate-grant-delegations.js.map +1 -0
  140. package/dist/price-service/use-enigma-prices.d.ts +4 -0
  141. package/dist/price-service/use-enigma-prices.d.ts.map +1 -1
  142. package/dist/price-service/use-enigma-prices.js +60 -24
  143. package/dist/price-service/use-enigma-prices.js.map +1 -1
  144. package/dist/provider/symmio-provider.d.ts +31 -4
  145. package/dist/provider/symmio-provider.d.ts.map +1 -1
  146. package/dist/provider/symmio-provider.js +12 -11
  147. package/dist/provider/symmio-provider.js.map +1 -1
  148. package/dist/solvers/timelock-capability-cache.d.ts +9 -0
  149. package/dist/solvers/timelock-capability-cache.d.ts.map +1 -0
  150. package/dist/solvers/timelock-capability-cache.js +79 -0
  151. package/dist/solvers/timelock-capability-cache.js.map +1 -0
  152. package/dist/solvers/use-solver-info.d.ts +5 -2
  153. package/dist/solvers/use-solver-info.d.ts.map +1 -1
  154. package/dist/solvers/use-solver-info.js +35 -11
  155. package/dist/solvers/use-solver-info.js.map +1 -1
  156. package/dist/transactions/write-types.d.ts +13 -1
  157. package/dist/transactions/write-types.d.ts.map +1 -1
  158. package/dist/withdraw/index.d.ts +3 -0
  159. package/dist/withdraw/index.d.ts.map +1 -1
  160. package/dist/withdraw/use-deallocate-debounce-time.d.ts +29 -0
  161. package/dist/withdraw/use-deallocate-debounce-time.d.ts.map +1 -0
  162. package/dist/withdraw/use-deallocate-debounce-time.js +27 -0
  163. package/dist/withdraw/use-deallocate-debounce-time.js.map +1 -0
  164. package/dist/withdraw/use-finalize-withdraw-request.d.ts.map +1 -1
  165. package/dist/withdraw/use-finalize-withdraw-request.js +13 -12
  166. package/dist/withdraw/use-finalize-withdraw-request.js.map +1 -1
  167. package/dist/withdraw/use-initiate-withdraw.d.ts +2 -2
  168. package/dist/withdraw/use-initiate-withdraw.d.ts.map +1 -1
  169. package/dist/withdraw/use-initiate-withdraw.js +29 -17
  170. package/dist/withdraw/use-initiate-withdraw.js.map +1 -1
  171. package/dist/withdraw/use-pending-withdraw-requests-batch.d.ts +19 -0
  172. package/dist/withdraw/use-pending-withdraw-requests-batch.d.ts.map +1 -0
  173. package/dist/withdraw/use-pending-withdraw-requests-batch.js +27 -0
  174. package/dist/withdraw/use-pending-withdraw-requests-batch.js.map +1 -0
  175. package/dist/withdraw/use-request-cancel-withdraw.d.ts.map +1 -1
  176. package/dist/withdraw/use-request-cancel-withdraw.js +14 -13
  177. package/dist/withdraw/use-request-cancel-withdraw.js.map +1 -1
  178. package/dist/withdraw/use-withdraw-cooldown-of.d.ts +33 -0
  179. package/dist/withdraw/use-withdraw-cooldown-of.d.ts.map +1 -0
  180. package/dist/withdraw/use-withdraw-cooldown-of.js +27 -0
  181. package/dist/withdraw/use-withdraw-cooldown-of.js.map +1 -0
  182. package/dist/withdraw/use-withdraw.d.ts +3 -3
  183. package/dist/withdraw/use-withdraw.d.ts.map +1 -1
  184. package/dist/withdraw/use-withdraw.js +57 -31
  185. package/dist/withdraw/use-withdraw.js.map +1 -1
  186. package/package.json +2 -2
@@ -3,40 +3,53 @@ 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
5
  import { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
6
- import { predicateMatch as i } from "../utils/predicate-match.js";
7
- import { deallocateMutationOptions as a, getAccountBalanceInfoQueryKey as o, getAccountBalanceOfQueryKey as s, getDeallocateUpnlSig as c } from "@symmio/trading-core";
8
- import { useMutation as l, useQueryClient as u } from "@tanstack/react-query";
6
+ import { normalizeProtectedWriteError as i } from "../errors/normalize-protected-write-error.js";
7
+ import { predicateMatch as a } from "../utils/predicate-match.js";
8
+ import { useAutomaticTimelock as o } from "./use-automatic-timelock.js";
9
+ import { assertTimelockAuthorizationUnused as s, deallocateMutationOptions as c, getAccountBalanceInfoQueryKey as l, getAccountBalanceOfQueryKey as u, getDeallocateUpnlSig as d, getWithdrawCooldownOfQueryKey as f, getWithdrawableTimeQueryKey as p } from "@symmio/trading-core";
10
+ import { useMutation as m, useQueryClient as h } from "@tanstack/react-query";
9
11
  //#region src/account-layer/use-deallocate.ts
10
- function d(d = {}) {
11
- let f = t(d), p = e(), m = u(), h = a(f);
12
- return l({
13
- mutationKey: h.mutationKey,
12
+ function g(g = {}) {
13
+ let _ = t(g), v = e(), y = h(), b = o(_, g.automaticTimelock), x = c(_);
14
+ return m({
15
+ mutationKey: x.mutationKey,
14
16
  mutationFn: async (e) => {
17
+ let t = e.timelock;
15
18
  try {
16
- let t = e.chainId ?? p, n = e.upnlSig ?? await c(f, {
19
+ let n = e.chainId ?? v;
20
+ t = await b(e, {
21
+ account: e.account,
22
+ chainId: n,
23
+ functionName: "deallocate",
24
+ explicit: t
25
+ }), t && s(t);
26
+ let i = e.upnlSig ?? await d(_, {
17
27
  virtualAccount: e.account,
18
- chainId: t
19
- });
20
- return r(f, await h.mutationFn({
28
+ chainId: n
29
+ }), a = await r(_, await x.mutationFn({
21
30
  ...e,
22
- upnlSig: n,
23
- chainId: t
31
+ upnlSig: i,
32
+ chainId: n,
33
+ ...t ? { timelock: t } : {}
24
34
  }), {
25
- chainId: t,
26
- waitForReceipt: d.waitForReceipt,
27
- confirmations: d.confirmations
35
+ chainId: n,
36
+ waitForReceipt: g.waitForReceipt,
37
+ confirmations: g.confirmations
28
38
  });
29
- } catch (e) {
30
- throw n(e);
39
+ return b.finish(e, a), a;
40
+ } catch (r) {
41
+ throw b.fail(e, r), t ? i(r, t) : n(r);
31
42
  }
32
43
  },
33
44
  onSuccess: (e, t) => {
34
45
  let n = { account: t.account };
35
- m.invalidateQueries({ predicate: i(o, n) }), m.invalidateQueries({ predicate: i(s, n) });
46
+ y.invalidateQueries({ predicate: a(l, n) }), y.invalidateQueries({ predicate: a(u, n) });
47
+ let r = { user: t.account };
48
+ y.invalidateQueries({ predicate: a(f, r) }), y.invalidateQueries({ predicate: a(p, r) });
36
49
  }
37
50
  });
38
51
  }
39
52
  //#endregion
40
- export { d as useDeallocate };
53
+ export { g as useDeallocate };
41
54
 
42
55
  //# sourceMappingURL=use-deallocate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-deallocate.js","names":[],"sources":["../../src/account-layer/use-deallocate.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deallocateMutationOptions,\n getAccountBalanceInfoQueryKey,\n getAccountBalanceOfQueryKey,\n getDeallocateUpnlSig,\n type DeallocateParameters,\n type SingleUpnlSig,\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 { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useDeallocate}.\n */\nexport type UseDeallocateParameters = WriteParameters;\n\n/**\n * Variables for the {@link useDeallocate} mutation: the core action's inputs\n * except `upnlSig` is **optional**. When omitted, the hook fetches a fresh Muon\n * uPnL signature itself before submitting; pass one only to reuse a signature you\n * already fetched.\n */\nexport type DeallocateVariables = Omit<DeallocateParameters, \"upnlSig\"> & {\n /** A pre-fetched Muon uPnL signature. Omit to let the hook fetch a fresh one. */\n upnlSig?: SingleUpnlSig;\n};\n\n/** Result returned by the {@link useDeallocate} mutation. */\nexport type DeallocateResult = WriteResult;\n\n/** Return type of {@link useDeallocate}. */\nexport type UseDeallocateReturnType = UseMutationResult<DeallocateResult, SymmioRequestError, DeallocateVariables>;\n\n/**\n * Deallocate a subaccount's allocated (tradeable) balance back into its available\n * balance (routed through the AccountLayer `_call` proxy). The hook **fetches a\n * fresh Muon uPnL signature** (the contract requires it to prove the subaccount\n * stays solvent) immediately before submitting, unless you pass one as `upnlSig`.\n * The connected wallet must own the subaccount. On success, the subaccount's\n * balance reads are invalidated.\n *\n * @remarks\n * Subject to the on-chain deallocate debounce — submitting too soon after a prior\n * deallocate reverts. That (and an insolvent result, or a stale signature) is\n * surfaced as a normalized {@link SymmioRequestError}; enabling `simulateBeforeWrite`\n * catches it as a dry-run before anything is signed.\n *\n * @example\n * ```tsx\n * const { mutate } = useDeallocate();\n * mutate({ account: \"0xsub…\", amount: 1_000000000000000000n });\n * ```\n */\nexport function useDeallocate(parameters: UseDeallocateParameters = {}): UseDeallocateReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = deallocateMutationOptions(config);\n\n return useMutation<DeallocateResult, SymmioRequestError, DeallocateVariables>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const upnlSig =\n variables.upnlSig ??\n (await getDeallocateUpnlSig(config, {\n virtualAccount: variables.account,\n chainId: resolvedChainId,\n }));\n const hash = await base.mutationFn({ ...variables, upnlSig, chainId: resolvedChainId });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const partial = { account: variables.account };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceInfoQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceOfQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;AA4DA,SAAgB,EAAc,IAAsC,CAAC,GAA4B;CAC/F,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAA0B,CAAM;CAE7C,OAAO,EAAuE;EAC5E,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW,GACvC,IACJ,EAAU,WACT,MAAM,EAAqB,GAAQ;KAClC,gBAAgB,EAAU;KAC1B,SAAS;IACX,CAAC;IAEH,OAAO,EAAmB,GAAQ,MADf,EAAK,WAAW;KAAE,GAAG;KAAW;KAAS,SAAS;IAAgB,CAAC,GAC9C;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAU,EAAE,SAAS,EAAU,QAAQ;GAE7C,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAO,EAAE,CAAC,GACxG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAO,EAAE,CAAC;EACxG;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-deallocate.js","names":[],"sources":["../../src/account-layer/use-deallocate.ts"],"sourcesContent":["\"use client\";\n\nimport {\n assertTimelockAuthorizationUnused,\n deallocateMutationOptions,\n getAccountBalanceInfoQueryKey,\n getAccountBalanceOfQueryKey,\n getDeallocateUpnlSig,\n getWithdrawCooldownOfQueryKey,\n getWithdrawableTimeQueryKey,\n type DeallocateParameters,\n type SingleUpnlSig,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeProtectedWriteError } from \"../errors/normalize-protected-write-error\";\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 { resolveWriteResult, type AutomaticTimelockWriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\nimport { useAutomaticTimelock } from \"./use-automatic-timelock\";\n\n/**\n * Parameters for {@link useDeallocate}.\n */\nexport type UseDeallocateParameters = AutomaticTimelockWriteParameters;\n\n/**\n * Variables for the {@link useDeallocate} mutation: the core action's inputs\n * except `upnlSig` is **optional**. When omitted, the hook fetches a fresh Muon\n * uPnL signature itself before submitting; pass one only to reuse a signature you\n * already fetched.\n */\nexport type DeallocateVariables = Omit<DeallocateParameters, \"upnlSig\"> & {\n /** A pre-fetched Muon uPnL signature. Omit to let the hook fetch a fresh one. */\n upnlSig?: SingleUpnlSig;\n};\n\n/** Result returned by the {@link useDeallocate} mutation. */\nexport type DeallocateResult = WriteResult;\n\n/** Return type of {@link useDeallocate}. */\nexport type UseDeallocateReturnType = UseMutationResult<DeallocateResult, SymmioRequestError, DeallocateVariables>;\n\n/**\n * Deallocate a subaccount's allocated (tradeable) balance back into its available\n * balance (routed through the AccountLayer `_call` proxy). The hook **fetches a\n * fresh Muon uPnL signature** (the contract requires it to prove the subaccount\n * stays solvent) immediately before submitting, unless you pass one as `upnlSig`.\n * The connected wallet must own the subaccount. On success, the subaccount's\n * balance, withdraw-cooldown and withdrawable-time reads are invalidated.\n *\n * @remarks\n * Subject to the on-chain deallocate debounce — submitting before\n * `withdrawCooldownOf + debounce` reverts (read both with\n * {@link useWithdrawCooldownOf} and {@link useDeallocateDebounceTime}). That (and an insolvent result, or a stale signature) is\n * surfaced as a normalized {@link SymmioRequestError}; enabling `simulateBeforeWrite`\n * catches it as a dry-run before anything is signed.\n *\n * @example\n * ```tsx\n * const { mutate } = useDeallocate();\n * mutate({ account: \"0xsub…\", amount: 1_000000000000000000n });\n * ```\n */\nexport function useDeallocate(parameters: UseDeallocateParameters = {}): UseDeallocateReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const automaticTimelock = useAutomaticTimelock(config, parameters.automaticTimelock);\n\n const base = deallocateMutationOptions(config);\n\n return useMutation<DeallocateResult, SymmioRequestError, DeallocateVariables>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n let authorization = variables.timelock;\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n authorization = await automaticTimelock(variables, {\n account: variables.account,\n chainId: resolvedChainId,\n functionName: \"deallocate\",\n explicit: authorization,\n });\n if (authorization) assertTimelockAuthorizationUnused(authorization);\n const upnlSig =\n variables.upnlSig ??\n (await getDeallocateUpnlSig(config, {\n virtualAccount: variables.account,\n chainId: resolvedChainId,\n }));\n const hash = await base.mutationFn({\n ...variables,\n upnlSig,\n chainId: resolvedChainId,\n ...(authorization ? { timelock: authorization } : {}),\n });\n const result = resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n const settled = await result;\n automaticTimelock.finish(variables, settled);\n return settled;\n } catch (err) {\n automaticTimelock.fail(variables, err);\n throw authorization ? normalizeProtectedWriteError(err, authorization) : normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const partial = { account: variables.account };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceInfoQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceOfQueryKey, partial) });\n\n /** A deallocation stamps the account's cooldown timestamp, which also moves its withdrawable time. */\n const timing = { user: variables.account };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getWithdrawCooldownOfQueryKey, timing) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getWithdrawableTimeQueryKey, timing) });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;AAkEA,SAAgB,EAAc,IAAsC,CAAC,GAA4B;CAC/F,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAoB,EAAqB,GAAQ,EAAW,iBAAiB,GAE7E,IAAO,EAA0B,CAAM;CAE7C,OAAO,EAAuE;EAC5E,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI,IAAgB,EAAU;GAC9B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAO7C,AANA,IAAgB,MAAM,EAAkB,GAAW;KACjD,SAAS,EAAU;KACnB,SAAS;KACT,cAAc;KACd,UAAU;IACZ,CAAC,GACG,KAAe,EAAkC,CAAa;IAClE,IAAM,IACJ,EAAU,WACT,MAAM,EAAqB,GAAQ;KAClC,gBAAgB,EAAU;KAC1B,SAAS;IACX,CAAC,GAYG,IAAU,MALD,EAAmB,GAAQ,MANvB,EAAK,WAAW;KACjC,GAAG;KACH;KACA,SAAS;KACT,GAAI,IAAgB,EAAE,UAAU,EAAc,IAAI,CAAC;IACrD,CAAC,GAC+C;KAC9C,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CACsB;IAEtB,OADA,EAAkB,OAAO,GAAW,CAAO,GACpC;GACT,SAAS,GAAK;IAEZ,MADA,EAAkB,KAAK,GAAW,CAAG,GAC/B,IAAgB,EAA6B,GAAK,CAAa,IAAI,EAAmB,CAAG;GACjG;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAU,EAAE,SAAS,EAAU,QAAQ;GAE7C,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAO,EAAE,CAAC,GACxG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAO,EAAE,CAAC;GAGtG,IAAM,IAAS,EAAE,MAAM,EAAU,QAAQ;GAEzC,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAM,EAAE,CAAC,GACvG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAM,EAAE,CAAC;EACvG;CACF,CAAC;AACH"}
@@ -1,11 +1,11 @@
1
1
  import { DeleteSubAccountParameters } from '@symmio/trading-core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
3
  import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
- import { WriteParameters, WriteResult } from '../transactions/index.js';
4
+ import { AutomaticTimelockWriteParameters, WriteResult } from '../transactions/index.js';
5
5
  /**
6
6
  * Parameters for {@link useDeleteSubAccount}.
7
7
  */
8
- export type UseDeleteSubAccountParameters = WriteParameters;
8
+ export type UseDeleteSubAccountParameters = AutomaticTimelockWriteParameters;
9
9
  /**
10
10
  * Result returned by the {@link useDeleteSubAccount} mutation.
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"use-delete-sub-account.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-delete-sub-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAEjD,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,CAC3D,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,CAC3B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CA8BjH"}
1
+ {"version":3,"file":"use-delete-sub-account.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-delete-sub-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,gCAAgC,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9G;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,gCAAgC,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAEjD,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,CAC3D,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,CAC3B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CA8CjH"}
@@ -3,37 +3,48 @@ 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
5
  import { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
6
- import { predicateMatch as i } from "../utils/predicate-match.js";
7
- import { deleteSubAccountMutationOptions as a, getSubAccountsCountOfUserQueryKey as o, getUserSubAccountsAddressesQueryKey as s, getUserSubAccountsQueryKey as c } from "@symmio/trading-core";
8
- import { useConnection as l } from "wagmi";
9
- import { useMutation as u, useQueryClient as d } from "@tanstack/react-query";
6
+ import { normalizeProtectedWriteError as i } from "../errors/normalize-protected-write-error.js";
7
+ import { predicateMatch as a } from "../utils/predicate-match.js";
8
+ import { useAutomaticTimelock as o } from "./use-automatic-timelock.js";
9
+ import { deleteSubAccountMutationOptions as s, getSubAccountsCountOfUserQueryKey as c, getUserSubAccountsAddressesQueryKey as l, getUserSubAccountsQueryKey as u } from "@symmio/trading-core";
10
+ import { useConnection as d } from "wagmi";
11
+ import { useMutation as f, useQueryClient as p } from "@tanstack/react-query";
10
12
  //#region src/account-layer/use-delete-sub-account.ts
11
- function f(f = {}) {
12
- let p = t(f), m = e(), { address: h } = l(), g = d(), _ = a(p);
13
- return u({
14
- mutationKey: _.mutationKey,
13
+ function m(m = {}) {
14
+ let h = t(m), g = e(), { address: _ } = d(), v = p(), y = o(h, m.automaticTimelock), b = s(h);
15
+ return f({
16
+ mutationKey: b.mutationKey,
15
17
  mutationFn: async (e) => {
18
+ let t = e.timelock;
16
19
  try {
17
- let t = e.chainId ?? m;
18
- return r(p, await _.mutationFn({
20
+ let n = e.chainId ?? g;
21
+ t = await y(e, {
22
+ account: e.subAccount,
23
+ chainId: n,
24
+ functionName: "deleteSubAccount",
25
+ explicit: t
26
+ });
27
+ let i = await r(h, await b.mutationFn({
19
28
  ...e,
20
- chainId: t
29
+ chainId: n,
30
+ ...t ? { timelock: t } : {}
21
31
  }), {
22
- chainId: t,
23
- waitForReceipt: f.waitForReceipt,
24
- confirmations: f.confirmations
32
+ chainId: n,
33
+ waitForReceipt: m.waitForReceipt,
34
+ confirmations: m.confirmations
25
35
  });
26
- } catch (e) {
27
- throw n(e);
36
+ return y.finish(e, i), i;
37
+ } catch (r) {
38
+ throw y.fail(e, r), t ? i(r, t) : n(r);
28
39
  }
29
40
  },
30
41
  onSuccess: () => {
31
- let e = h ? { user: h } : void 0;
32
- g.invalidateQueries({ predicate: i(c, e) }), g.invalidateQueries({ predicate: i(s, e) }), g.invalidateQueries({ predicate: i(o, e) });
42
+ let e = _ ? { user: _ } : void 0;
43
+ v.invalidateQueries({ predicate: a(u, e) }), v.invalidateQueries({ predicate: a(l, e) }), v.invalidateQueries({ predicate: a(c, e) });
33
44
  }
34
45
  });
35
46
  }
36
47
  //#endregion
37
- export { f as useDeleteSubAccount };
48
+ export { m as useDeleteSubAccount };
38
49
 
39
50
  //# sourceMappingURL=use-delete-sub-account.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-delete-sub-account.js","names":[],"sources":["../../src/account-layer/use-delete-sub-account.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deleteSubAccountMutationOptions,\n getSubAccountsCountOfUserQueryKey,\n getUserSubAccountsAddressesQueryKey,\n getUserSubAccountsQueryKey,\n type DeleteSubAccountParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { useConnection } from \"wagmi\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useDeleteSubAccount}.\n */\nexport type UseDeleteSubAccountParameters = WriteParameters;\n\n/**\n * Result returned by the {@link useDeleteSubAccount} mutation.\n */\nexport type DeleteSubAccountResult = WriteResult;\n\n/** Return type of {@link useDeleteSubAccount}. */\nexport type UseDeleteSubAccountReturnType = UseMutationResult<\n DeleteSubAccountResult,\n SymmioRequestError,\n DeleteSubAccountParameters\n>;\n\n/**\n * Submit a `deleteSubAccount` transaction. Deletion is irreversible and only\n * succeeds once the subaccount has no virtual accounts, zero balance, no open\n * positions, and no pending quotes (the call reverts otherwise). On success, the\n * connected user's `getUserSubAccounts`, `getUserSubAccountsAddresses`, and\n * `getSubAccountsCountOfUser` queries are invalidated so mounted lists refetch\n * without the removed subaccount.\n *\n * @example\n * ```tsx\n * const { mutate, status, error } = useDeleteSubAccount();\n * <button onClick={() => mutate({ subAccount: \"0xsub…\" })}>Delete</button>\n * ```\n */\nexport function useDeleteSubAccount(parameters: UseDeleteSubAccountParameters = {}): UseDeleteSubAccountReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const queryClient = useQueryClient();\n\n const base = deleteSubAccountMutationOptions(config);\n\n return useMutation<DeleteSubAccountResult, SymmioRequestError, DeleteSubAccountParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({ ...variables, chainId: resolvedChainId });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: () => {\n const partial = address ? { user: address } : undefined;\n void queryClient.invalidateQueries({ predicate: predicateMatch(getUserSubAccountsQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getUserSubAccountsAddressesQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getSubAccountsCountOfUserQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAiDA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAc,EAAe,GAE7B,IAAO,EAAgC,CAAM;CAEnD,OAAO,EAAoF;EACzF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAE7C,OAAO,EAAmB,GAAQ,MADf,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS;IAAgB,CAAC,GACrC;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,iBAAiB;GACf,IAAM,IAAU,IAAU,EAAE,MAAM,EAAQ,IAAI,KAAA;GAG9C,AAFA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA4B,CAAO,EAAE,CAAC,GACrG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAqC,CAAO,EAAE,CAAC,GAC9G,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAmC,CAAO,EAAE,CAAC;EAC9G;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-delete-sub-account.js","names":[],"sources":["../../src/account-layer/use-delete-sub-account.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deleteSubAccountMutationOptions,\n getSubAccountsCountOfUserQueryKey,\n getUserSubAccountsAddressesQueryKey,\n getUserSubAccountsQueryKey,\n type DeleteSubAccountParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { useConnection } from \"wagmi\";\nimport { normalizeProtectedWriteError } from \"../errors/normalize-protected-write-error\";\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 { resolveWriteResult, type AutomaticTimelockWriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\nimport { useAutomaticTimelock } from \"./use-automatic-timelock\";\n\n/**\n * Parameters for {@link useDeleteSubAccount}.\n */\nexport type UseDeleteSubAccountParameters = AutomaticTimelockWriteParameters;\n\n/**\n * Result returned by the {@link useDeleteSubAccount} mutation.\n */\nexport type DeleteSubAccountResult = WriteResult;\n\n/** Return type of {@link useDeleteSubAccount}. */\nexport type UseDeleteSubAccountReturnType = UseMutationResult<\n DeleteSubAccountResult,\n SymmioRequestError,\n DeleteSubAccountParameters\n>;\n\n/**\n * Submit a `deleteSubAccount` transaction. Deletion is irreversible and only\n * succeeds once the subaccount has no virtual accounts, zero balance, no open\n * positions, and no pending quotes (the call reverts otherwise). On success, the\n * connected user's `getUserSubAccounts`, `getUserSubAccountsAddresses`, and\n * `getSubAccountsCountOfUser` queries are invalidated so mounted lists refetch\n * without the removed subaccount.\n *\n * @example\n * ```tsx\n * const { mutate, status, error } = useDeleteSubAccount();\n * <button onClick={() => mutate({ subAccount: \"0xsub…\" })}>Delete</button>\n * ```\n */\nexport function useDeleteSubAccount(parameters: UseDeleteSubAccountParameters = {}): UseDeleteSubAccountReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const queryClient = useQueryClient();\n const automaticTimelock = useAutomaticTimelock(config, parameters.automaticTimelock);\n\n const base = deleteSubAccountMutationOptions(config);\n\n return useMutation<DeleteSubAccountResult, SymmioRequestError, DeleteSubAccountParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n let authorization = variables.timelock;\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n authorization = await automaticTimelock(variables, {\n account: variables.subAccount,\n chainId: resolvedChainId,\n functionName: \"deleteSubAccount\",\n explicit: authorization,\n });\n const hash = await base.mutationFn({\n ...variables,\n chainId: resolvedChainId,\n ...(authorization ? { timelock: authorization } : {}),\n });\n const result = resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n const settled = await result;\n automaticTimelock.finish(variables, settled);\n return settled;\n } catch (err) {\n automaticTimelock.fail(variables, err);\n throw authorization ? normalizeProtectedWriteError(err, authorization) : normalizeSymmError(err);\n }\n },\n onSuccess: () => {\n const partial = address ? { user: address } : undefined;\n void queryClient.invalidateQueries({ predicate: predicateMatch(getUserSubAccountsQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getUserSubAccountsAddressesQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getSubAccountsCountOfUserQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;AAmDA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAc,EAAe,GAC7B,IAAoB,EAAqB,GAAQ,EAAW,iBAAiB,GAE7E,IAAO,EAAgC,CAAM;CAEnD,OAAO,EAAoF;EACzF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI,IAAgB,EAAU;GAC9B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAC7C,IAAgB,MAAM,EAAkB,GAAW;KACjD,SAAS,EAAU;KACnB,SAAS;KACT,cAAc;KACd,UAAU;IACZ,CAAC;IAWD,IAAM,IAAU,MALD,EAAmB,GAAQ,MALvB,EAAK,WAAW;KACjC,GAAG;KACH,SAAS;KACT,GAAI,IAAgB,EAAE,UAAU,EAAc,IAAI,CAAC;IACrD,CAAC,GAC+C;KAC9C,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CACsB;IAEtB,OADA,EAAkB,OAAO,GAAW,CAAO,GACpC;GACT,SAAS,GAAK;IAEZ,MADA,EAAkB,KAAK,GAAW,CAAG,GAC/B,IAAgB,EAA6B,GAAK,CAAa,IAAI,EAAmB,CAAG;GACjG;EACF;EACA,iBAAiB;GACf,IAAM,IAAU,IAAU,EAAE,MAAM,EAAQ,IAAI,KAAA;GAG9C,AAFA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA4B,CAAO,EAAE,CAAC,GACrG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAqC,CAAO,EAAE,CAAC,GAC9G,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAmC,CAAO,EAAE,CAAC;EAC9G;CACF,CAAC;AACH"}
@@ -0,0 +1,7 @@
1
+ import { ExecuteAccountCallsParameters } from '@symmio/trading-core';
2
+ import { UseMutationResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { AutomaticTimelockWriteParameters, WriteResult } from '../transactions/index.js';
5
+ /** Execute named Core calls atomically, optionally with per-call timelock authorizations. */
6
+ export declare function useExecuteAccountCalls(parameters?: AutomaticTimelockWriteParameters): UseMutationResult<WriteResult, SymmioRequestError, ExecuteAccountCallsParameters>;
7
+ //# sourceMappingURL=use-execute-account-calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-execute-account-calls.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-execute-account-calls.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,6BAA6B,EACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAAsB,KAAK,gCAAgC,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9G,6FAA6F;AAC7F,wBAAgB,sBAAsB,CACpC,UAAU,GAAE,gCAAqC,GAChD,iBAAiB,CAAC,WAAW,EAAE,kBAAkB,EAAE,6BAA6B,CAAC,CA6CnF"}
@@ -0,0 +1,54 @@
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 { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
6
+ import { normalizeProtectedWriteError as i } from "../errors/normalize-protected-write-error.js";
7
+ import { useAutomaticTimelock as a } from "./use-automatic-timelock.js";
8
+ import { invalidateTimelockExecutionReads as o } from "../gasless/invalidate-relay-reads.js";
9
+ import { encodeTimelockedCoreCall as s, executeAccountCallsMutationOptions as c, symmioAbi as l } from "@symmio/trading-core";
10
+ import { encodeFunctionData as u } from "viem";
11
+ import { useMutation as d, useQueryClient as f } from "@tanstack/react-query";
12
+ //#region src/account-layer/use-execute-account-calls.ts
13
+ function p(p = {}) {
14
+ let m = t(p), h = e(), g = f(), _ = a(m, p.automaticTimelock), v = c(m);
15
+ return d({
16
+ mutationKey: v.mutationKey,
17
+ retry: !1,
18
+ mutationFn: async (e) => {
19
+ let t = e.timelock;
20
+ try {
21
+ let n = e.chainId ?? h, i = e.account, a = e.calls.map((e) => u({
22
+ abi: l,
23
+ functionName: e.functionName,
24
+ args: e.args
25
+ }));
26
+ t ??= await _.batch(e, {
27
+ account: i,
28
+ chainId: n,
29
+ functionNames: e.calls.map((e) => e.functionName)
30
+ });
31
+ let c = await r(m, await v.mutationFn({
32
+ ...e,
33
+ chainId: n,
34
+ ...t ? { timelock: t } : {}
35
+ }), {
36
+ chainId: n,
37
+ waitForReceipt: p.waitForReceipt,
38
+ confirmations: p.confirmations
39
+ });
40
+ if (c.receipt) {
41
+ let e = { configKey: m.getChainConfigKey(n) };
42
+ for (let t of a) o(g, e, s(i, t));
43
+ }
44
+ return _.finish(e, c), c;
45
+ } catch (r) {
46
+ throw _.fail(e, r), t ? i(r, t) : n(r);
47
+ }
48
+ }
49
+ });
50
+ }
51
+ //#endregion
52
+ export { p as useExecuteAccountCalls };
53
+
54
+ //# sourceMappingURL=use-execute-account-calls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-execute-account-calls.js","names":[],"sources":["../../src/account-layer/use-execute-account-calls.ts"],"sourcesContent":["\"use client\";\n\nimport {\n encodeTimelockedCoreCall,\n executeAccountCallsMutationOptions,\n symmioAbi,\n type ExecuteAccountCallsParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { encodeFunctionData, type Abi } from \"viem\";\nimport { normalizeProtectedWriteError } from \"../errors/normalize-protected-write-error\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { invalidateTimelockExecutionReads } from \"../gasless/invalidate-relay-reads\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type AutomaticTimelockWriteParameters, type WriteResult } from \"../transactions\";\nimport { useAutomaticTimelock } from \"./use-automatic-timelock\";\n\n/** Execute named Core calls atomically, optionally with per-call timelock authorizations. */\nexport function useExecuteAccountCalls(\n parameters: AutomaticTimelockWriteParameters = {},\n): UseMutationResult<WriteResult, SymmioRequestError, ExecuteAccountCallsParameters> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const client = useQueryClient();\n const automaticTimelock = useAutomaticTimelock(config, parameters.automaticTimelock);\n const base = executeAccountCallsMutationOptions(config);\n return useMutation({\n mutationKey: base.mutationKey,\n retry: false,\n mutationFn: async (variables) => {\n let authorization = variables.timelock;\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const account = variables.account;\n const affected = variables.calls.map((call) =>\n encodeFunctionData({ abi: symmioAbi as Abi, functionName: call.functionName, args: call.args }),\n );\n authorization ??= await automaticTimelock.batch(variables, {\n account,\n chainId: resolvedChainId,\n functionNames: variables.calls.map((call) => call.functionName),\n });\n const hash = await base.mutationFn({\n ...variables,\n chainId: resolvedChainId,\n ...(authorization ? { timelock: authorization } : {}),\n });\n const result = await resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n if (result.receipt) {\n const scope = { configKey: config.getChainConfigKey(resolvedChainId) };\n for (const raw of affected)\n invalidateTimelockExecutionReads(client, scope, encodeTimelockedCoreCall(account, raw));\n }\n automaticTimelock.finish(variables, result);\n return result;\n } catch (error) {\n automaticTimelock.fail(variables, error);\n throw authorization ? normalizeProtectedWriteError(error, authorization) : normalizeSymmError(error);\n }\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAgB,EACd,IAA+C,CAAC,GACmC;CACnF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAS,EAAe,GACxB,IAAoB,EAAqB,GAAQ,EAAW,iBAAiB,GAC7E,IAAO,EAAmC,CAAM;CACtD,OAAO,EAAY;EACjB,aAAa,EAAK;EAClB,OAAO;EACP,YAAY,OAAO,MAAc;GAC/B,IAAI,IAAgB,EAAU;GAC9B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW,GACvC,IAAU,EAAU,SACpB,IAAW,EAAU,MAAM,KAAK,MACpC,EAAmB;KAAE,KAAK;KAAkB,cAAc,EAAK;KAAc,MAAM,EAAK;IAAK,CAAC,CAChG;IACA,MAAkB,MAAM,EAAkB,MAAM,GAAW;KACzD;KACA,SAAS;KACT,eAAe,EAAU,MAAM,KAAK,MAAS,EAAK,YAAY;IAChE,CAAC;IAMD,IAAM,IAAS,MAAM,EAAmB,GAAQ,MAL7B,EAAK,WAAW;KACjC,GAAG;KACH,SAAS;KACT,GAAI,IAAgB,EAAE,UAAU,EAAc,IAAI,CAAC;IACrD,CAAC,GACqD;KACpD,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;IACD,IAAI,EAAO,SAAS;KAClB,IAAM,IAAQ,EAAE,WAAW,EAAO,kBAAkB,CAAe,EAAE;KACrE,KAAK,IAAM,KAAO,GAChB,EAAiC,GAAQ,GAAO,EAAyB,GAAS,CAAG,CAAC;IAC1F;IAEA,OADA,EAAkB,OAAO,GAAW,CAAM,GACnC;GACT,SAAS,GAAO;IAEd,MADA,EAAkB,KAAK,GAAW,CAAK,GACjC,IAAgB,EAA6B,GAAO,CAAa,IAAI,EAAmB,CAAK;GACrG;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,22 @@
1
+ import { encodeProtectedFunction, encodeTimelockedCoreCall, ExecuteProtectedFunctionParameters } from '@symmio/trading-core';
2
+ import { UseMutationResult } from '@tanstack/react-query';
3
+ import { AbiFunction } from 'viem';
4
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
5
+ import { WriteParameters, WriteResult } from '../transactions/index.js';
6
+ /** Return the SDK encoder for validating named function input before an action. */
7
+ export declare function useProtectedFunctionEncoder(): typeof encodeProtectedFunction;
8
+ /**
9
+ * Return the SDK encoder that wraps a Core call for an account.
10
+ * @returns A function accepting the original account and raw Core calldata.
11
+ * @example const inner = useTimelockedCoreCallEncoder()(account, rawCallData);
12
+ */
13
+ export declare function useTimelockedCoreCallEncoder(): typeof encodeTimelockedCoreCall;
14
+ /** The documented protected functions and their ABI inputs, for SDK-driven forms. */
15
+ export declare function useProtectedFunctionCatalog(): readonly {
16
+ target: "core" | "account-layer";
17
+ name: string;
18
+ inputs: AbiFunction["inputs"];
19
+ }[];
20
+ /** Execute any documented protected function with ABI-typed arguments and explicit authorization. */
21
+ export declare function useProtectedFunction(parameters?: WriteParameters): UseMutationResult<WriteResult, SymmioRequestError, ExecuteProtectedFunctionParameters>;
22
+ //# sourceMappingURL=use-protected-function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-protected-function.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-protected-function.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EAKxB,KAAK,kCAAkC,EACxC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAA4C,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7F,mFAAmF;AACnF,wBAAgB,2BAA2B,IAAI,OAAO,uBAAuB,CAE5E;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,OAAO,wBAAwB,CAE9E;AAED,qFAAqF;AACrF,wBAAgB,2BAA2B,IAAI,SAAS;IACtD,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CAC/B,EAAE,CAaF;AAED,qGAAqG;AACrG,wBAAgB,oBAAoB,CAClC,UAAU,GAAE,eAAoB,GAC/B,iBAAiB,CAAC,WAAW,EAAE,kBAAkB,EAAE,kCAAkC,CAAC,CAiCxF"}
@@ -0,0 +1,68 @@
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 { resolveWriteResult as n } from "../transactions/resolve-write-result.js";
5
+ import { normalizeProtectedWriteError as r } from "../errors/normalize-protected-write-error.js";
6
+ import { invalidateTimelockExecutionReads as i } from "../gasless/invalidate-relay-reads.js";
7
+ import { INSTANT_OPEN_TIMELOCK_ACCOUNT_LAYER_FUNCTIONS as a, INSTANT_OPEN_TIMELOCK_CORE_FUNCTIONS as o, accountLayerAbi as s, encodeProtectedFunction as c, encodeTimelockedCoreCall as l, executeProtectedFunctionMutationOptions as u, symmioAbi as d } from "@symmio/trading-core";
8
+ import { encodeFunctionData as f, getAbiItem as p } from "viem";
9
+ import { useMutation as m, useQueryClient as h } from "@tanstack/react-query";
10
+ //#region src/account-layer/use-protected-function.ts
11
+ function g() {
12
+ return c;
13
+ }
14
+ function _() {
15
+ return l;
16
+ }
17
+ function v() {
18
+ return [...o.map((e) => ({
19
+ target: "core",
20
+ name: e,
21
+ inputs: p({
22
+ abi: d,
23
+ name: e
24
+ }).inputs
25
+ })), ...a.map((e) => ({
26
+ target: "account-layer",
27
+ name: e,
28
+ inputs: p({
29
+ abi: s,
30
+ name: e
31
+ }).inputs
32
+ }))];
33
+ }
34
+ function y(a = {}) {
35
+ let o = t(a), c = e(), p = h(), g = u(o);
36
+ return m({
37
+ mutationKey: g.mutationKey,
38
+ retry: !1,
39
+ mutationFn: async (e) => {
40
+ try {
41
+ let t = e.chainId ?? c;
42
+ return await n(o, await g.mutationFn({
43
+ ...e,
44
+ chainId: t
45
+ }), {
46
+ chainId: t,
47
+ waitForReceipt: a.waitForReceipt,
48
+ confirmations: a.confirmations
49
+ });
50
+ } catch (t) {
51
+ throw r(t, e.timelock);
52
+ }
53
+ },
54
+ onSuccess: (e, t) => {
55
+ if (!e.receipt) return;
56
+ let n = f({
57
+ abi: t.target === "core" ? d : s,
58
+ functionName: t.functionName,
59
+ args: t.args
60
+ }), r = t.target === "core" ? l(t.account, n) : n;
61
+ i(p, { configKey: o.getChainConfigKey(t.chainId ?? c) }, r);
62
+ }
63
+ });
64
+ }
65
+ //#endregion
66
+ export { y as useProtectedFunction, v as useProtectedFunctionCatalog, g as useProtectedFunctionEncoder, _ as useTimelockedCoreCallEncoder };
67
+
68
+ //# sourceMappingURL=use-protected-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-protected-function.js","names":[],"sources":["../../src/account-layer/use-protected-function.ts"],"sourcesContent":["\"use client\";\n\nimport {\n accountLayerAbi,\n encodeProtectedFunction,\n encodeTimelockedCoreCall,\n executeProtectedFunctionMutationOptions,\n INSTANT_OPEN_TIMELOCK_ACCOUNT_LAYER_FUNCTIONS,\n INSTANT_OPEN_TIMELOCK_CORE_FUNCTIONS,\n symmioAbi,\n type ExecuteProtectedFunctionParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { encodeFunctionData, getAbiItem, type Abi, type AbiFunction } from \"viem\";\nimport { normalizeProtectedWriteError } from \"../errors/normalize-protected-write-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { invalidateTimelockExecutionReads } from \"../gasless/invalidate-relay-reads\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\n\n/** Return the SDK encoder for validating named function input before an action. */\nexport function useProtectedFunctionEncoder(): typeof encodeProtectedFunction {\n return encodeProtectedFunction;\n}\n\n/**\n * Return the SDK encoder that wraps a Core call for an account.\n * @returns A function accepting the original account and raw Core calldata.\n * @example const inner = useTimelockedCoreCallEncoder()(account, rawCallData);\n */\nexport function useTimelockedCoreCallEncoder(): typeof encodeTimelockedCoreCall {\n return encodeTimelockedCoreCall;\n}\n\n/** The documented protected functions and their ABI inputs, for SDK-driven forms. */\nexport function useProtectedFunctionCatalog(): readonly {\n target: \"core\" | \"account-layer\";\n name: string;\n inputs: AbiFunction[\"inputs\"];\n}[] {\n return [\n ...INSTANT_OPEN_TIMELOCK_CORE_FUNCTIONS.map((name) => ({\n target: \"core\" as const,\n name,\n inputs: (getAbiItem({ abi: symmioAbi as Abi, name }) as AbiFunction).inputs,\n })),\n ...INSTANT_OPEN_TIMELOCK_ACCOUNT_LAYER_FUNCTIONS.map((name) => ({\n target: \"account-layer\" as const,\n name,\n inputs: (getAbiItem({ abi: accountLayerAbi as Abi, name }) as AbiFunction).inputs,\n })),\n ];\n}\n\n/** Execute any documented protected function with ABI-typed arguments and explicit authorization. */\nexport function useProtectedFunction(\n parameters: WriteParameters = {},\n): UseMutationResult<WriteResult, SymmioRequestError, ExecuteProtectedFunctionParameters> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const client = useQueryClient();\n const base = executeProtectedFunctionMutationOptions(config);\n return useMutation({\n mutationKey: base.mutationKey,\n retry: false,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({ ...variables, chainId: resolvedChainId });\n return await resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (error) {\n throw normalizeProtectedWriteError(error, variables.timelock);\n }\n },\n onSuccess: (result, variables) => {\n if (!result.receipt) return;\n const abi = variables.target === \"core\" ? symmioAbi : accountLayerAbi;\n const raw = encodeFunctionData({ abi: abi as Abi, functionName: variables.functionName, args: variables.args });\n const inner = variables.target === \"core\" ? encodeTimelockedCoreCall(variables.account, raw) : raw;\n invalidateTimelockExecutionReads(\n client,\n { configKey: config.getChainConfigKey(variables.chainId ?? chainId) },\n inner,\n );\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAsBA,SAAgB,IAA8D;CAC5E,OAAO;AACT;AAOA,SAAgB,IAAgE;CAC9E,OAAO;AACT;AAGA,SAAgB,IAIZ;CACF,OAAO,CACL,GAAG,EAAqC,KAAK,OAAU;EACrD,QAAQ;EACR;EACA,QAAS,EAAW;GAAE,KAAK;GAAkB;EAAK,CAAC,EAAkB;CACvE,EAAE,GACF,GAAG,EAA8C,KAAK,OAAU;EAC9D,QAAQ;EACR;EACA,QAAS,EAAW;GAAE,KAAK;GAAwB;EAAK,CAAC,EAAkB;CAC7E,EAAE,CACJ;AACF;AAGA,SAAgB,EACd,IAA8B,CAAC,GACyD;CACxF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAS,EAAe,GACxB,IAAO,EAAwC,CAAM;CAC3D,OAAO,EAAY;EACjB,aAAa,EAAK;EAClB,OAAO;EACP,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAE7C,OAAO,MAAM,EAAmB,GAAQ,MADrB,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS;IAAgB,CAAC,GAC/B;KAC5C,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAO;IACd,MAAM,EAA6B,GAAO,EAAU,QAAQ;GAC9D;EACF;EACA,YAAY,GAAQ,MAAc;GAChC,IAAI,CAAC,EAAO,SAAS;GAErB,IAAM,IAAM,EAAmB;IAAO,KAD1B,EAAU,WAAW,SAAS,IAAY;IACJ,cAAc,EAAU;IAAc,MAAM,EAAU;GAAK,CAAC,GACxG,IAAQ,EAAU,WAAW,SAAS,EAAyB,EAAU,SAAS,CAAG,IAAI;GAC/F,EACE,GACA,EAAE,WAAW,EAAO,kBAAkB,EAAU,WAAW,CAAO,EAAE,GACpE,CACF;EACF;CACF,CAAC;AACH"}
@@ -1,11 +1,11 @@
1
1
  import { RemoveMarginParameters, SingleUpnlSig } from '@symmio/trading-core';
2
2
  import { UseMutationResult } from '@tanstack/react-query';
3
3
  import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
- import { WriteParameters, WriteResult } from '../transactions/index.js';
4
+ import { AutomaticTimelockWriteParameters, WriteResult } from '../transactions/index.js';
5
5
  /**
6
6
  * Parameters for {@link useRemoveMargin}.
7
7
  */
8
- export type UseRemoveMarginParameters = WriteParameters;
8
+ export type UseRemoveMarginParameters = AutomaticTimelockWriteParameters;
9
9
  /**
10
10
  * Variables for the {@link useRemoveMargin} mutation: the core action's inputs
11
11
  * except `upnlSig` is **optional**. When omitted, the hook fetches a fresh Muon
@@ -1 +1 @@
1
- {"version":3,"file":"use-remove-margin.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-remove-margin.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,GAAG;IAC5E,iFAAiF;IACjF,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CACvD,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,yBAA8B,GAAG,yBAAyB,CAkCrG"}
1
+ {"version":3,"file":"use-remove-margin.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-remove-margin.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,gCAAgC,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9G;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,gCAAgC,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,GAAG;IAC5E,iFAAiF;IACjF,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CACvD,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,yBAA8B,GAAG,yBAAyB,CAoDrG"}
@@ -3,40 +3,51 @@ 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
5
  import { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
6
- import { predicateMatch as i } from "../utils/predicate-match.js";
7
- import { getAccountBalanceInfoQueryKey as a, getAccountBalanceOfQueryKey as o, getDeallocateUpnlSig as s, removeMarginMutationOptions as c } from "@symmio/trading-core";
8
- import { useMutation as l, useQueryClient as u } from "@tanstack/react-query";
6
+ import { normalizeProtectedWriteError as i } from "../errors/normalize-protected-write-error.js";
7
+ import { predicateMatch as a } from "../utils/predicate-match.js";
8
+ import { useAutomaticTimelock as o } from "./use-automatic-timelock.js";
9
+ import { assertTimelockAuthorizationUnused as s, getAccountBalanceInfoQueryKey as c, getAccountBalanceOfQueryKey as l, getDeallocateUpnlSig as u, removeMarginMutationOptions as d } from "@symmio/trading-core";
10
+ import { useMutation as f, useQueryClient as p } from "@tanstack/react-query";
9
11
  //#region src/account-layer/use-remove-margin.ts
10
- function d(d = {}) {
11
- let f = t(d), p = e(), m = u(), h = c(f);
12
- return l({
13
- mutationKey: h.mutationKey,
12
+ function m(m = {}) {
13
+ let h = t(m), g = e(), _ = p(), v = o(h, m.automaticTimelock), y = d(h);
14
+ return f({
15
+ mutationKey: y.mutationKey,
14
16
  mutationFn: async (e) => {
17
+ let t = e.timelock;
15
18
  try {
16
- let t = e.chainId ?? p, n = e.upnlSig ?? await s(f, {
19
+ let n = e.chainId ?? g;
20
+ t = await v(e, {
21
+ account: e.virtualAccount,
22
+ chainId: n,
23
+ functionName: "removeMargin",
24
+ explicit: t
25
+ }), t && s(t);
26
+ let i = e.upnlSig ?? await u(h, {
17
27
  virtualAccount: e.virtualAccount,
18
- chainId: t
19
- });
20
- return r(f, await h.mutationFn({
28
+ chainId: n
29
+ }), a = await r(h, await y.mutationFn({
21
30
  ...e,
22
- upnlSig: n,
23
- chainId: t
31
+ upnlSig: i,
32
+ chainId: n,
33
+ ...t ? { timelock: t } : {}
24
34
  }), {
25
- chainId: t,
26
- waitForReceipt: d.waitForReceipt,
27
- confirmations: d.confirmations
35
+ chainId: n,
36
+ waitForReceipt: m.waitForReceipt,
37
+ confirmations: m.confirmations
28
38
  });
29
- } catch (e) {
30
- throw n(e);
39
+ return v.finish(e, a), a;
40
+ } catch (r) {
41
+ throw v.fail(e, r), t ? i(r, t) : n(r);
31
42
  }
32
43
  },
33
44
  onSuccess: (e, t) => {
34
45
  let n = { account: t.virtualAccount };
35
- m.invalidateQueries({ predicate: i(a, n) }), m.invalidateQueries({ predicate: i(o, n) });
46
+ _.invalidateQueries({ predicate: a(c, n) }), _.invalidateQueries({ predicate: a(l, n) });
36
47
  }
37
48
  });
38
49
  }
39
50
  //#endregion
40
- export { d as useRemoveMargin };
51
+ export { m as useRemoveMargin };
41
52
 
42
53
  //# sourceMappingURL=use-remove-margin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-remove-margin.js","names":[],"sources":["../../src/account-layer/use-remove-margin.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAccountBalanceInfoQueryKey,\n getAccountBalanceOfQueryKey,\n getDeallocateUpnlSig,\n removeMarginMutationOptions,\n type RemoveMarginParameters,\n type SingleUpnlSig,\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 { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useRemoveMargin}.\n */\nexport type UseRemoveMarginParameters = WriteParameters;\n\n/**\n * Variables for the {@link useRemoveMargin} mutation: the core action's inputs\n * except `upnlSig` is **optional**. When omitted, the hook fetches a fresh Muon\n * uPnL signature itself before submitting; pass one only to reuse a signature you\n * already fetched.\n */\nexport type RemoveMarginVariables = Omit<RemoveMarginParameters, \"upnlSig\"> & {\n /** A pre-fetched Muon uPnL signature. Omit to let the hook fetch a fresh one. */\n upnlSig?: SingleUpnlSig;\n};\n\n/** Result returned by the {@link useRemoveMargin} mutation. */\nexport type RemoveMarginResult = WriteResult;\n\n/** Return type of {@link useRemoveMargin}. */\nexport type UseRemoveMarginReturnType = UseMutationResult<\n RemoveMarginResult,\n SymmioRequestError,\n RemoveMarginVariables\n>;\n\n/**\n * Remove margin from a virtual account (VA) — a deallocate via\n * `AccountLayer.removeMargin`. The hook **fetches a fresh Muon uPnL signature**\n * (the contract requires it to prove the VA stays solvent) immediately before\n * submitting, unless you pass one as `upnlSig`. The connected wallet must own the\n * VA. On success, the VA's balance reads are invalidated.\n *\n * @remarks\n * Subject to the on-chain deallocate debounce — submitting too soon after a prior\n * deallocate reverts. That (and an insolvent result, or a stale signature) is\n * surfaced as a normalized {@link SymmioRequestError}; enabling `simulateBeforeWrite`\n * catches it as a dry-run before anything is signed.\n *\n * @example\n * ```tsx\n * const { mutate } = useRemoveMargin();\n * mutate({ virtualAccount: \"0xva…\", amount: 50_000000000000000000n });\n * ```\n */\nexport function useRemoveMargin(parameters: UseRemoveMarginParameters = {}): UseRemoveMarginReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = removeMarginMutationOptions(config);\n\n return useMutation<RemoveMarginResult, SymmioRequestError, RemoveMarginVariables>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const upnlSig =\n variables.upnlSig ??\n (await getDeallocateUpnlSig(config, {\n virtualAccount: variables.virtualAccount,\n chainId: resolvedChainId,\n }));\n const hash = await base.mutationFn({ ...variables, upnlSig, chainId: resolvedChainId });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const partial = { account: variables.virtualAccount };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceInfoQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceOfQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;AA+DA,SAAgB,EAAgB,IAAwC,CAAC,GAA8B;CACrG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAA4B,CAAM;CAE/C,OAAO,EAA2E;EAChF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW,GACvC,IACJ,EAAU,WACT,MAAM,EAAqB,GAAQ;KAClC,gBAAgB,EAAU;KAC1B,SAAS;IACX,CAAC;IAEH,OAAO,EAAmB,GAAQ,MADf,EAAK,WAAW;KAAE,GAAG;KAAW;KAAS,SAAS;IAAgB,CAAC,GAC9C;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAU,EAAE,SAAS,EAAU,eAAe;GAEpD,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAO,EAAE,CAAC,GACxG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAO,EAAE,CAAC;EACxG;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-remove-margin.js","names":[],"sources":["../../src/account-layer/use-remove-margin.ts"],"sourcesContent":["\"use client\";\n\nimport {\n assertTimelockAuthorizationUnused,\n getAccountBalanceInfoQueryKey,\n getAccountBalanceOfQueryKey,\n getDeallocateUpnlSig,\n removeMarginMutationOptions,\n type RemoveMarginParameters,\n type SingleUpnlSig,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeProtectedWriteError } from \"../errors/normalize-protected-write-error\";\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 { resolveWriteResult, type AutomaticTimelockWriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\nimport { useAutomaticTimelock } from \"./use-automatic-timelock\";\n\n/**\n * Parameters for {@link useRemoveMargin}.\n */\nexport type UseRemoveMarginParameters = AutomaticTimelockWriteParameters;\n\n/**\n * Variables for the {@link useRemoveMargin} mutation: the core action's inputs\n * except `upnlSig` is **optional**. When omitted, the hook fetches a fresh Muon\n * uPnL signature itself before submitting; pass one only to reuse a signature you\n * already fetched.\n */\nexport type RemoveMarginVariables = Omit<RemoveMarginParameters, \"upnlSig\"> & {\n /** A pre-fetched Muon uPnL signature. Omit to let the hook fetch a fresh one. */\n upnlSig?: SingleUpnlSig;\n};\n\n/** Result returned by the {@link useRemoveMargin} mutation. */\nexport type RemoveMarginResult = WriteResult;\n\n/** Return type of {@link useRemoveMargin}. */\nexport type UseRemoveMarginReturnType = UseMutationResult<\n RemoveMarginResult,\n SymmioRequestError,\n RemoveMarginVariables\n>;\n\n/**\n * Remove margin from a virtual account (VA) — a deallocate via\n * `AccountLayer.removeMargin`. The hook **fetches a fresh Muon uPnL signature**\n * (the contract requires it to prove the VA stays solvent) immediately before\n * submitting, unless you pass one as `upnlSig`. The connected wallet must own the\n * VA. On success, the VA's balance reads are invalidated.\n *\n * @remarks\n * Subject to the on-chain deallocate debounce — submitting too soon after a prior\n * deallocate reverts. That (and an insolvent result, or a stale signature) is\n * surfaced as a normalized {@link SymmioRequestError}; enabling `simulateBeforeWrite`\n * catches it as a dry-run before anything is signed.\n *\n * @example\n * ```tsx\n * const { mutate } = useRemoveMargin();\n * mutate({ virtualAccount: \"0xva…\", amount: 50_000000000000000000n });\n * ```\n */\nexport function useRemoveMargin(parameters: UseRemoveMarginParameters = {}): UseRemoveMarginReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const automaticTimelock = useAutomaticTimelock(config, parameters.automaticTimelock);\n\n const base = removeMarginMutationOptions(config);\n\n return useMutation<RemoveMarginResult, SymmioRequestError, RemoveMarginVariables>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n let authorization = variables.timelock;\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n authorization = await automaticTimelock(variables, {\n account: variables.virtualAccount,\n chainId: resolvedChainId,\n functionName: \"removeMargin\",\n explicit: authorization,\n });\n if (authorization) assertTimelockAuthorizationUnused(authorization);\n const upnlSig =\n variables.upnlSig ??\n (await getDeallocateUpnlSig(config, {\n virtualAccount: variables.virtualAccount,\n chainId: resolvedChainId,\n }));\n const hash = await base.mutationFn({\n ...variables,\n upnlSig,\n chainId: resolvedChainId,\n ...(authorization ? { timelock: authorization } : {}),\n });\n const result = resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n const settled = await result;\n automaticTimelock.finish(variables, settled);\n return settled;\n } catch (err) {\n automaticTimelock.fail(variables, err);\n throw authorization ? normalizeProtectedWriteError(err, authorization) : normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const partial = { account: variables.virtualAccount };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceInfoQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceOfQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;AAkEA,SAAgB,EAAgB,IAAwC,CAAC,GAA8B;CACrG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAoB,EAAqB,GAAQ,EAAW,iBAAiB,GAE7E,IAAO,EAA4B,CAAM;CAE/C,OAAO,EAA2E;EAChF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI,IAAgB,EAAU;GAC9B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAO7C,AANA,IAAgB,MAAM,EAAkB,GAAW;KACjD,SAAS,EAAU;KACnB,SAAS;KACT,cAAc;KACd,UAAU;IACZ,CAAC,GACG,KAAe,EAAkC,CAAa;IAClE,IAAM,IACJ,EAAU,WACT,MAAM,EAAqB,GAAQ;KAClC,gBAAgB,EAAU;KAC1B,SAAS;IACX,CAAC,GAYG,IAAU,MALD,EAAmB,GAAQ,MANvB,EAAK,WAAW;KACjC,GAAG;KACH;KACA,SAAS;KACT,GAAI,IAAgB,EAAE,UAAU,EAAc,IAAI,CAAC;IACrD,CAAC,GAC+C;KAC9C,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CACsB;IAEtB,OADA,EAAkB,OAAO,GAAW,CAAO,GACpC;GACT,SAAS,GAAK;IAEZ,MADA,EAAkB,KAAK,GAAW,CAAG,GAC/B,IAAgB,EAA6B,GAAK,CAAa,IAAI,EAAmB,CAAG;GACjG;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAU,EAAE,SAAS,EAAU,eAAe;GAEpD,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAO,EAAE,CAAC,GACxG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAO,EAAE,CAAC;EACxG;CACF,CAAC;AACH"}
@@ -0,0 +1,21 @@
1
+ import { ConfigParameter, EarlyWithdrawParameters, EarlyWithdrawResult, GetTimelockPolicyOptions, SetupTimelockPolicyParameters, TimelockPolicyReport, TimelockSetupResult } from '@symmio/trading-core';
2
+ import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { WriteParameters, WriteResult } from '../transactions/index.js';
5
+ /** Complete policy query including standard React config overrides. */
6
+ export type UseTimelockPolicyParameters = GetTimelockPolicyOptions & ConfigParameter;
7
+ /** Read all selector corrections for any root/virtual account. No writes or approval probes occur. */
8
+ export declare function useTimelockPolicy(parameters: UseTimelockPolicyParameters): UseQueryResult<TimelockPolicyReport, SymmioRequestError>;
9
+ /** Configure root policy with defaults, returning confirmed receipt and separate indexing status. Retries are disabled. */
10
+ export declare function useSetupTimelockPolicy(parameters?: ConfigParameter): UseMutationResult<TimelockSetupResult, SymmioRequestError, SetupTimelockPolicyParameters>;
11
+ /** Submitted approval/withdrawal plus optional receipt and relay handle. A hash alone is not confirmation. */
12
+ export type EarlyWithdrawWriteResult = EarlyWithdrawResult & WriteResult;
13
+ /**
14
+ * Obtain one approval and execute a withdrawal. Defaults to receipt confirmation; never automatically retries.
15
+ * Failures keep their normalized classification and issued-approval recovery context in `cause`.
16
+ * @param parameters - Config and standard receipt controls.
17
+ * @returns Mutation with the approval, hash and confirmed receipt (unless explicitly disabled).
18
+ * @example const withdrawal = useEarlyWithdraw();
19
+ */
20
+ export declare function useEarlyWithdraw(parameters?: WriteParameters): UseMutationResult<EarlyWithdrawWriteResult, SymmioRequestError, EarlyWithdrawParameters>;
21
+ //# sourceMappingURL=use-timelock-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-timelock-policy.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-timelock-policy.ts"],"names":[],"mappings":"AAEA,OAAO,EAaL,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAgD,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAIvH,uEAAuE;AACvE,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,GAAG,eAAe,CAAC;AAErF,sGAAsG;AACtG,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,2BAA2B,GACtC,cAAc,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAc1D;AAQD,2HAA2H;AAC3H,wBAAgB,sBAAsB,CACpC,UAAU,GAAE,eAAoB,GAC/B,iBAAiB,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,6BAA6B,CAAC,CAkB3F;AAED,8GAA8G;AAC9G,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GAAG,WAAW,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,GAAE,eAAoB,GAC/B,iBAAiB,CAAC,wBAAwB,EAAE,kBAAkB,EAAE,uBAAuB,CAAC,CAuC1F"}