@symmio/trading-react 4.4.0 → 4.6.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 (203) 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/candles/index.d.ts +2 -0
  77. package/dist/candles/index.d.ts.map +1 -1
  78. package/dist/candles/index.js +6 -4
  79. package/dist/candles/use-candle-history.d.ts +30 -0
  80. package/dist/candles/use-candle-history.d.ts.map +1 -0
  81. package/dist/candles/use-candle-history.js +66 -0
  82. package/dist/candles/use-candle-history.js.map +1 -0
  83. package/dist/candles/use-candle-stream.d.ts +5 -4
  84. package/dist/candles/use-candle-stream.d.ts.map +1 -1
  85. package/dist/candles/use-candle-stream.js +17 -10
  86. package/dist/candles/use-candle-stream.js.map +1 -1
  87. package/dist/candles/use-candles.js +2 -2
  88. package/dist/candles/use-candles.js.map +1 -1
  89. package/dist/candles/use-lowcap-candle-source.d.ts +19 -0
  90. package/dist/candles/use-lowcap-candle-source.d.ts.map +1 -0
  91. package/dist/candles/use-lowcap-candle-source.js +25 -0
  92. package/dist/candles/use-lowcap-candle-source.js.map +1 -0
  93. package/dist/errors/normalize-protected-write-error.d.ts +5 -0
  94. package/dist/errors/normalize-protected-write-error.d.ts.map +1 -0
  95. package/dist/errors/normalize-protected-write-error.js +43 -0
  96. package/dist/errors/normalize-protected-write-error.js.map +1 -0
  97. package/dist/errors/normalize-symm-error.d.ts.map +1 -1
  98. package/dist/errors/normalize-symm-error.js +56 -43
  99. package/dist/errors/normalize-symm-error.js.map +1 -1
  100. package/dist/errors/symmio-request-error.d.ts +5 -0
  101. package/dist/errors/symmio-request-error.d.ts.map +1 -1
  102. package/dist/errors/symmio-request-error.js +2 -1
  103. package/dist/errors/symmio-request-error.js.map +1 -1
  104. package/dist/gasless/index.d.ts +3 -0
  105. package/dist/gasless/index.d.ts.map +1 -1
  106. package/dist/gasless/index.js +22 -19
  107. package/dist/gasless/invalidate-relay-reads.d.ts +3 -1
  108. package/dist/gasless/invalidate-relay-reads.d.ts.map +1 -1
  109. package/dist/gasless/invalidate-relay-reads.js +115 -60
  110. package/dist/gasless/invalidate-relay-reads.js.map +1 -1
  111. package/dist/gasless/use-approve-operational-fee-allowance.d.ts +37 -0
  112. package/dist/gasless/use-approve-operational-fee-allowance.d.ts.map +1 -0
  113. package/dist/gasless/use-approve-operational-fee-allowance.js +48 -0
  114. package/dist/gasless/use-approve-operational-fee-allowance.js.map +1 -0
  115. package/dist/gasless/use-approve-operational-fee.d.ts +2 -2
  116. package/dist/gasless/use-approve-operational-fee.d.ts.map +1 -1
  117. package/dist/gasless/use-approve-operational-fee.js +28 -17
  118. package/dist/gasless/use-approve-operational-fee.js.map +1 -1
  119. package/dist/gasless/use-gasless-batch-funding.d.ts +22 -0
  120. package/dist/gasless/use-gasless-batch-funding.d.ts.map +1 -0
  121. package/dist/gasless/use-gasless-batch-funding.js +27 -0
  122. package/dist/gasless/use-gasless-batch-funding.js.map +1 -0
  123. package/dist/gasless/use-gasless-margin-funding.d.ts +26 -0
  124. package/dist/gasless/use-gasless-margin-funding.d.ts.map +1 -0
  125. package/dist/gasless/use-gasless-margin-funding.js +27 -0
  126. package/dist/gasless/use-gasless-margin-funding.js.map +1 -0
  127. package/dist/gasless/use-relay-gasless-batch.d.ts +5 -4
  128. package/dist/gasless/use-relay-gasless-batch.d.ts.map +1 -1
  129. package/dist/gasless/use-relay-gasless-batch.js.map +1 -1
  130. package/dist/index.d.ts +14 -8
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.js +275 -256
  133. package/dist/instant-layer/index.d.ts +2 -0
  134. package/dist/instant-layer/index.d.ts.map +1 -1
  135. package/dist/instant-layer/index.js +25 -23
  136. package/dist/instant-layer/invalidate-delegation-grant.d.ts +17 -0
  137. package/dist/instant-layer/invalidate-delegation-grant.d.ts.map +1 -0
  138. package/dist/instant-layer/invalidate-delegation-grant.js +26 -0
  139. package/dist/instant-layer/invalidate-delegation-grant.js.map +1 -0
  140. package/dist/instant-layer/use-grant-delegation.d.ts +3 -1
  141. package/dist/instant-layer/use-grant-delegation.d.ts.map +1 -1
  142. package/dist/instant-layer/use-grant-delegation.js +19 -28
  143. package/dist/instant-layer/use-grant-delegation.js.map +1 -1
  144. package/dist/instant-layer/use-grant-delegations.d.ts +44 -0
  145. package/dist/instant-layer/use-grant-delegations.d.ts.map +1 -0
  146. package/dist/instant-layer/use-grant-delegations.js +36 -0
  147. package/dist/instant-layer/use-grant-delegations.js.map +1 -0
  148. package/dist/instant-layer/use-instant-close-fees.js +8 -8
  149. package/dist/instant-layer/use-instant-open-inputs.js +8 -8
  150. package/dist/instant-layer/use-session-key-selectors.d.ts +5 -2
  151. package/dist/instant-layer/use-session-key-selectors.d.ts.map +1 -1
  152. package/dist/instant-layer/use-session-key-selectors.js +9 -5
  153. package/dist/instant-layer/use-session-key-selectors.js.map +1 -1
  154. package/dist/instant-layer/use-simulate-grant-delegations.d.ts +25 -0
  155. package/dist/instant-layer/use-simulate-grant-delegations.d.ts.map +1 -0
  156. package/dist/instant-layer/use-simulate-grant-delegations.js +29 -0
  157. package/dist/instant-layer/use-simulate-grant-delegations.js.map +1 -0
  158. package/dist/pools/use-listing-config.d.ts +3 -1
  159. package/dist/pools/use-listing-config.d.ts.map +1 -1
  160. package/dist/pools/use-listing-config.js.map +1 -1
  161. package/dist/provider/symmio-provider.d.ts +31 -4
  162. package/dist/provider/symmio-provider.d.ts.map +1 -1
  163. package/dist/provider/symmio-provider.js +12 -11
  164. package/dist/provider/symmio-provider.js.map +1 -1
  165. package/dist/solvers/timelock-capability-cache.d.ts +9 -0
  166. package/dist/solvers/timelock-capability-cache.d.ts.map +1 -0
  167. package/dist/solvers/timelock-capability-cache.js +79 -0
  168. package/dist/solvers/timelock-capability-cache.js.map +1 -0
  169. package/dist/solvers/use-solver-info.d.ts +5 -2
  170. package/dist/solvers/use-solver-info.d.ts.map +1 -1
  171. package/dist/solvers/use-solver-info.js +35 -11
  172. package/dist/solvers/use-solver-info.js.map +1 -1
  173. package/dist/transactions/write-types.d.ts +13 -1
  174. package/dist/transactions/write-types.d.ts.map +1 -1
  175. package/dist/withdraw/index.d.ts +3 -0
  176. package/dist/withdraw/index.d.ts.map +1 -1
  177. package/dist/withdraw/use-deallocate-debounce-time.d.ts +29 -0
  178. package/dist/withdraw/use-deallocate-debounce-time.d.ts.map +1 -0
  179. package/dist/withdraw/use-deallocate-debounce-time.js +27 -0
  180. package/dist/withdraw/use-deallocate-debounce-time.js.map +1 -0
  181. package/dist/withdraw/use-finalize-withdraw-request.d.ts.map +1 -1
  182. package/dist/withdraw/use-finalize-withdraw-request.js +13 -12
  183. package/dist/withdraw/use-finalize-withdraw-request.js.map +1 -1
  184. package/dist/withdraw/use-initiate-withdraw.d.ts +2 -2
  185. package/dist/withdraw/use-initiate-withdraw.d.ts.map +1 -1
  186. package/dist/withdraw/use-initiate-withdraw.js +29 -17
  187. package/dist/withdraw/use-initiate-withdraw.js.map +1 -1
  188. package/dist/withdraw/use-pending-withdraw-requests-batch.d.ts +19 -0
  189. package/dist/withdraw/use-pending-withdraw-requests-batch.d.ts.map +1 -0
  190. package/dist/withdraw/use-pending-withdraw-requests-batch.js +27 -0
  191. package/dist/withdraw/use-pending-withdraw-requests-batch.js.map +1 -0
  192. package/dist/withdraw/use-request-cancel-withdraw.d.ts.map +1 -1
  193. package/dist/withdraw/use-request-cancel-withdraw.js +14 -13
  194. package/dist/withdraw/use-request-cancel-withdraw.js.map +1 -1
  195. package/dist/withdraw/use-withdraw-cooldown-of.d.ts +33 -0
  196. package/dist/withdraw/use-withdraw-cooldown-of.d.ts.map +1 -0
  197. package/dist/withdraw/use-withdraw-cooldown-of.js +27 -0
  198. package/dist/withdraw/use-withdraw-cooldown-of.js.map +1 -0
  199. package/dist/withdraw/use-withdraw.d.ts +3 -3
  200. package/dist/withdraw/use-withdraw.d.ts.map +1 -1
  201. package/dist/withdraw/use-withdraw.js +57 -31
  202. package/dist/withdraw/use-withdraw.js.map +1 -1
  203. package/package.json +2 -2
@@ -0,0 +1,112 @@
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 { SymmioRequestError as n } from "../errors/symmio-request-error.js";
5
+ import { normalizeSymmError as r } from "../errors/normalize-symm-error.js";
6
+ import { TransactionRevertedError as i, resolveWriteResult as a } from "../transactions/resolve-write-result.js";
7
+ import { predicateMatch as o } from "../utils/predicate-match.js";
8
+ import { invalidateAccountBalances as s } from "../utils/invalidate-account-balances.js";
9
+ import { EarlyWithdrawExecutionError as c, earlyWithdrawMutationOptions as l, getLastWithdrawRequestIdQueryKey as u, getPendingWithdrawRequestsBatchQueryKey as d, getPendingWithdrawRequestsQueryKey as f, getSelectorTimelockQueryKey as p, getTimelockPolicyQueryKey as m, getTimelockPolicyQueryOptions as h, getTimelockScheduleStateQueryKey as g, getWithdrawRequestsQueryKey as _, getWithdrawableTimeQueryKey as v, setupTimelockPolicyMutationOptions as y } from "@symmio/trading-core";
10
+ import { useMutation as b, useQuery as x, useQueryClient as S } from "@tanstack/react-query";
11
+ //#region src/account-layer/use-timelock-policy.ts
12
+ function C(n) {
13
+ let i = t(n), a = e(), o = h(i, {
14
+ ...n,
15
+ chainId: n.chainId ?? a
16
+ });
17
+ return x({
18
+ ...o,
19
+ queryFn: async () => {
20
+ try {
21
+ return await o.queryFn();
22
+ } catch (e) {
23
+ throw r(e);
24
+ }
25
+ }
26
+ });
27
+ }
28
+ function w(e, t) {
29
+ for (let n of [
30
+ m,
31
+ p,
32
+ g
33
+ ]) e.invalidateQueries({ predicate: o(n, { configKey: t }) });
34
+ }
35
+ function T(n = {}) {
36
+ let i = t(n), a = e(), o = S(), s = y(i);
37
+ return b({
38
+ ...s,
39
+ mutationFn: async (e) => {
40
+ try {
41
+ return await s.mutationFn({
42
+ ...e,
43
+ chainId: e.chainId ?? a
44
+ });
45
+ } catch (e) {
46
+ throw r(e);
47
+ }
48
+ },
49
+ onSuccess: (e, t) => {
50
+ w(o, i.getChainConfigKey(t.chainId ?? a));
51
+ }
52
+ });
53
+ }
54
+ function E(n = {}) {
55
+ let r = t(n), i = e(), p = S(), m = l(r);
56
+ return b({
57
+ ...m,
58
+ mutationFn: async (e) => {
59
+ try {
60
+ let t = e.chainId ?? i, o = await m.mutationFn({
61
+ ...e,
62
+ chainId: t
63
+ });
64
+ try {
65
+ return {
66
+ ...o,
67
+ ...await a(r, o.hash, {
68
+ ...n,
69
+ chainId: t
70
+ })
71
+ };
72
+ } catch (e) {
73
+ throw new c(o.approval, o.callData, e, o.hash);
74
+ }
75
+ } catch (e) {
76
+ throw D(e);
77
+ }
78
+ },
79
+ onSuccess: (e, t) => {
80
+ if (!e.receipt) return;
81
+ let n = { configKey: r.getChainConfigKey(t.chainId ?? i) };
82
+ w(p, n.configKey), s(p, n);
83
+ for (let e of [
84
+ f,
85
+ d,
86
+ _,
87
+ u,
88
+ v
89
+ ]) p.invalidateQueries({ predicate: o(e, n) });
90
+ }
91
+ });
92
+ }
93
+ function D(e) {
94
+ if (!(e instanceof c)) return r(e);
95
+ let t = r(e.cause);
96
+ if (t instanceof i) {
97
+ let n = new i({
98
+ hash: t.hash,
99
+ receipt: t.receipt
100
+ });
101
+ return n.cause = e, n;
102
+ }
103
+ return new n({
104
+ ...t,
105
+ message: t.message,
106
+ cause: e
107
+ });
108
+ }
109
+ //#endregion
110
+ export { E as useEarlyWithdraw, T as useSetupTimelockPolicy, C as useTimelockPolicy };
111
+
112
+ //# sourceMappingURL=use-timelock-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-timelock-policy.js","names":[],"sources":["../../src/account-layer/use-timelock-policy.ts"],"sourcesContent":["\"use client\";\n\nimport {\n EarlyWithdrawExecutionError,\n earlyWithdrawMutationOptions,\n getLastWithdrawRequestIdQueryKey,\n getPendingWithdrawRequestsBatchQueryKey,\n getPendingWithdrawRequestsQueryKey,\n getSelectorTimelockQueryKey,\n getTimelockPolicyQueryKey,\n getTimelockPolicyQueryOptions,\n getTimelockScheduleStateQueryKey,\n getWithdrawableTimeQueryKey,\n getWithdrawRequestsQueryKey,\n setupTimelockPolicyMutationOptions,\n type ConfigParameter,\n type EarlyWithdrawParameters,\n type EarlyWithdrawResult,\n type GetTimelockPolicyOptions,\n type SetupTimelockPolicyParameters,\n type TimelockPolicyReport,\n type TimelockSetupResult,\n} from \"@symmio/trading-core\";\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type QueryClient,\n type UseMutationResult,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, TransactionRevertedError, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { invalidateAccountBalances } from \"../utils/invalidate-account-balances\";\nimport { predicateMatch } from \"../utils/predicate-match\";\n\n/** Complete policy query including standard React config overrides. */\nexport type UseTimelockPolicyParameters = GetTimelockPolicyOptions & ConfigParameter;\n\n/** Read all selector corrections for any root/virtual account. No writes or approval probes occur. */\nexport function useTimelockPolicy(\n parameters: UseTimelockPolicyParameters,\n): UseQueryResult<TimelockPolicyReport, SymmioRequestError> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getTimelockPolicyQueryOptions(config, { ...parameters, chainId: parameters.chainId ?? chainId });\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n }) as UseQueryResult<TimelockPolicyReport, SymmioRequestError>;\n}\n\nfunction invalidatePolicy(queryClient: QueryClient, configKey: string) {\n for (const key of [getTimelockPolicyQueryKey, getSelectorTimelockQueryKey, getTimelockScheduleStateQueryKey]) {\n void queryClient.invalidateQueries({ predicate: predicateMatch(key, { configKey }) });\n }\n}\n\n/** Configure root policy with defaults, returning confirmed receipt and separate indexing status. Retries are disabled. */\nexport function useSetupTimelockPolicy(\n parameters: ConfigParameter = {},\n): UseMutationResult<TimelockSetupResult, SymmioRequestError, SetupTimelockPolicyParameters> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = setupTimelockPolicyMutationOptions(config);\n return useMutation({\n ...base,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n onSuccess: (_result, variables) => {\n invalidatePolicy(queryClient, config.getChainConfigKey(variables.chainId ?? chainId));\n },\n });\n}\n\n/** Submitted approval/withdrawal plus optional receipt and relay handle. A hash alone is not confirmation. */\nexport type EarlyWithdrawWriteResult = EarlyWithdrawResult & WriteResult;\n\n/**\n * Obtain one approval and execute a withdrawal. Defaults to receipt confirmation; never automatically retries.\n * Failures keep their normalized classification and issued-approval recovery context in `cause`.\n * @param parameters - Config and standard receipt controls.\n * @returns Mutation with the approval, hash and confirmed receipt (unless explicitly disabled).\n * @example const withdrawal = useEarlyWithdraw();\n */\nexport function useEarlyWithdraw(\n parameters: WriteParameters = {},\n): UseMutationResult<EarlyWithdrawWriteResult, SymmioRequestError, EarlyWithdrawParameters> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = earlyWithdrawMutationOptions(config);\n return useMutation({\n ...base,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const submitted = await base.mutationFn({ ...variables, chainId: resolvedChainId });\n try {\n return {\n ...submitted,\n ...(await resolveWriteResult(config, submitted.hash, { ...parameters, chainId: resolvedChainId })),\n };\n } catch (error) {\n throw new EarlyWithdrawExecutionError(submitted.approval, submitted.callData, error, submitted.hash);\n }\n } catch (error) {\n throw normalizeEarlyWithdrawError(error);\n }\n },\n onSuccess: (result, variables) => {\n if (!result.receipt) return;\n const scope = { configKey: config.getChainConfigKey(variables.chainId ?? chainId) };\n invalidatePolicy(queryClient, scope.configKey);\n invalidateAccountBalances(queryClient, scope);\n for (const key of [\n getPendingWithdrawRequestsQueryKey,\n getPendingWithdrawRequestsBatchQueryKey,\n getWithdrawRequestsQueryKey,\n getLastWithdrawRequestIdQueryKey,\n getWithdrawableTimeQueryKey,\n ]) {\n void queryClient.invalidateQueries({ predicate: predicateMatch(key, scope) });\n }\n },\n });\n}\n\nfunction normalizeEarlyWithdrawError(error: unknown): SymmioRequestError {\n if (!(error instanceof EarlyWithdrawExecutionError)) return normalizeSymmError(error);\n const underlying = normalizeSymmError(error.cause);\n if (underlying instanceof TransactionRevertedError) {\n // Preserve the SDK's mined-revert subclass without mutating the original\n // cause or creating a cycle through the recovery wrapper.\n const reverted = new TransactionRevertedError({ hash: underlying.hash, receipt: underlying.receipt });\n reverted.cause = error;\n return reverted;\n }\n return new SymmioRequestError({ ...underlying, message: underlying.message, cause: error });\n}\n"],"mappings":";;;;;;;;;;;AA2CA,SAAgB,EACd,GAC0D;CAC1D,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA8B,GAAQ;EAAE,GAAG;EAAY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KACd,MAAM,IAAI,EAA4B,EAAU,UAAU,EAAU,UAAU,GAAO,EAAU,IAAI;IACrG;GACF,SAAS,GAAO;IACd,MAAM,EAA4B,CAAK;GACzC;EACF;EACA,YAAY,GAAQ,MAAc;GAChC,IAAI,CAAC,EAAO,SAAS;GACrB,IAAM,IAAQ,EAAE,WAAW,EAAO,kBAAkB,EAAU,WAAW,CAAO,EAAE;GAElF,AADA,EAAiB,GAAa,EAAM,SAAS,GAC7C,EAA0B,GAAa,CAAK;GAC5C,KAAK,IAAM,KAAO;IAChB;IACA;IACA;IACA;IACA;GACF,GACE,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAK,CAAK,EAAE,CAAC;EAEhF;CACF,CAAC;AACH;AAEA,SAAS,EAA4B,GAAoC;CACvE,IAAI,EAAE,aAAiB,IAA8B,OAAO,EAAmB,CAAK;CACpF,IAAM,IAAa,EAAmB,EAAM,KAAK;CACjD,IAAI,aAAsB,GAA0B;EAGlD,IAAM,IAAW,IAAI,EAAyB;GAAE,MAAM,EAAW;GAAM,SAAS,EAAW;EAAQ,CAAC;EAEpG,OADA,EAAS,QAAQ,GACV;CACT;CACA,OAAO,IAAI,EAAmB;EAAE,GAAG;EAAY,SAAS,EAAW;EAAS,OAAO;CAAM,CAAC;AAC5F"}
@@ -0,0 +1,75 @@
1
+ import { ConfigParameter, SolverId, TimelockApprovalCapability, TimelockApprovalProvider, TimelockAuthorization, ValidatedTimelockApproval } from '@symmio/trading-core';
2
+ import { Address, Hex } from 'viem';
3
+ /** Inputs for resolving a single operation's timelock route. */
4
+ export type UseTimelockRouteParameters = ConfigParameter & {
5
+ account?: Address;
6
+ selector?: Hex;
7
+ chainId?: number;
8
+ solverId?: SolverId;
9
+ /** Wallet identity, included in the attempt scope when supplied. */
10
+ owner?: Address;
11
+ /** Disable discovery and policy reads when the consuming flow does not use timelocks. Defaults to true. */
12
+ enabled?: boolean;
13
+ /** Non-Enigma providers can supply independently obtained deployment metadata. */
14
+ capability?: TimelockApprovalCapability;
15
+ /** Override the standard approval transport. Keep this reference stable while an attempt is running. */
16
+ provider?: TimelockApprovalProvider;
17
+ };
18
+ /** Routing outcome. `delayed` requires the consumer to offer the on-chain schedule flow. */
19
+ export type TimelockRoute = {
20
+ kind: "loading";
21
+ } | {
22
+ kind: "reconciliation";
23
+ } | {
24
+ kind: "normal";
25
+ } | {
26
+ kind: "approval";
27
+ rootAccount: Address;
28
+ capability: TimelockApprovalCapability;
29
+ } | {
30
+ kind: "delayed";
31
+ rootAccount: Address;
32
+ unlocker: Address;
33
+ delay: bigint;
34
+ } | {
35
+ kind: "error";
36
+ message: string;
37
+ };
38
+ /**
39
+ * Select a route from the configured solver capability and the root selector policy.
40
+ * `run` delegates execution to the supplied callbacks; it does not automatically
41
+ * schedule an operation. Persist recovery in the consumer across unmounts and tabs.
42
+ * A delayed result is only an option: reconcile prior ambiguous attempts first.
43
+ * @param parameters - Account, selector, deployment and optional provider metadata.
44
+ * @returns Current route and underlying reads for refresh and diagnostics.
45
+ * @example const route = useTimelockRoute({ account, selector });
46
+ */
47
+ export declare function useTimelockRoute(parameters: UseTimelockRouteParameters): {
48
+ route: TimelockRoute;
49
+ rootAccount: `0x${string}` | undefined;
50
+ selector: import('@tanstack/react-query').UseQueryResult<import('@symmio/trading-core').SelectorTimelock, import('../index.js').SymmioRequestError>;
51
+ policy: import('@tanstack/react-query').UseQueryResult<import('@symmio/trading-core').TimelockPolicyReport, import('../index.js').SymmioRequestError>;
52
+ info: import('../index.js').UseSolverInfoReturnType;
53
+ virtual: import('./use-virtual-account.js').UseVirtualAccountReturnType;
54
+ run: <T extends {
55
+ receipt?: {
56
+ status: string;
57
+ };
58
+ }>(actions: {
59
+ normal: () => Promise<T>;
60
+ protected: (authorization: TimelockAuthorization) => Promise<T>;
61
+ deadline?: bigint;
62
+ onApproval?: (approval: ValidatedTimelockApproval) => void | Promise<void>;
63
+ }) => Promise<{
64
+ kind: "submitted";
65
+ result: T;
66
+ } | {
67
+ kind: "delayed";
68
+ rootAccount: Address;
69
+ unlocker: Address;
70
+ delay: bigint;
71
+ }>;
72
+ attempt: "pending" | "reconcile" | undefined;
73
+ clearReconciledAttempt: () => void;
74
+ };
75
+ //# sourceMappingURL=use-timelock-route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-timelock-route.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-timelock-route.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAS3E,gEAAgE;AAChE,MAAM,MAAM,0BAA0B,GAAG,eAAe,GAAG;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2GAA2G;IAC3G,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kFAAkF;IAClF,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC,wGAAwG;IACxG,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACrC,CAAC;AAEF,4FAA4F;AAC5F,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,0BAA0B,CAAA;CAAE,GAClF;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,0BAA0B;;;;;;;UAwHlD,CAAC,SAAS;QAAE,OAAO,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,WAAW;QACtE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,SAAS,EAAE,CAAC,aAAa,EAAE,qBAAqB,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,yBAAyB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KAC5E,KAAG,OAAO,CACT;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,WAAW,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAC/G;;;EAoEF"}
@@ -0,0 +1,177 @@
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 { refreshTimelockInfoAfterUnavailable as n, useKnownTimelockCapability as r } from "../solvers/timelock-capability-cache.js";
5
+ import { useSelectorTimelock as i } from "./use-timelock.js";
6
+ import { useTimelockPolicy as a } from "./use-timelock-policy.js";
7
+ import { useSolverInfo as o } from "../solvers/use-solver-info.js";
8
+ import { useVirtualAccount as s } from "./use-virtual-account.js";
9
+ import { createHttpTimelockApprovalProvider as c, isDefiniteTimelockApprovalRejection as l, isUnsubmittedTimelockWalletRejection as u, resolveTimelockFamilyAccount as d } from "@symmio/trading-core";
10
+ import { isAddressEqual as f, zeroAddress as p } from "viem";
11
+ import { useEffect as m, useRef as h, useState as g } from "react";
12
+ import { useQueryClient as _ } from "@tanstack/react-query";
13
+ //#region src/account-layer/use-timelock-route.ts
14
+ function v(v) {
15
+ let y = t(v), b = _(), x = e(), S = v.chainId ?? x, C = y.getSolver({
16
+ chainId: S,
17
+ solverId: v.solverId
18
+ }), w = h(""), T = h(v.provider), E = h(0);
19
+ T.current !== v.provider && (T.current = v.provider, E.current += 1);
20
+ let D = h(!0);
21
+ m(() => (D.current = !0, () => {
22
+ D.current = !1;
23
+ }), []);
24
+ let O = h(/* @__PURE__ */ new Map()), [, k] = g(0), A = C.capabilities?.timelockApproval, j = v.enabled !== !1 && y.getChainConfig(S).timelockSupported !== !1, M = r(y, S, v.solverId), N = j && A !== !1 && C.id === "enigma" && !v.capability && !M, P = o({
25
+ chainId: S,
26
+ solverId: v.solverId,
27
+ config: y,
28
+ query: {
29
+ enabled: N,
30
+ retry: !1,
31
+ staleTime: 0
32
+ }
33
+ }), F = v.capability ?? M ?? (P.isPlaceholderData ? void 0 : P.data?.timelockApproval), I = j && A !== !1 && (A === !0 || !!F || N), L = s({
34
+ account: v.account,
35
+ chainId: S,
36
+ config: y,
37
+ query: {
38
+ enabled: I && !!v.account,
39
+ retry: !1
40
+ }
41
+ }), R = L.isSuccess && L.data && v.account ? d(v.account, L.data) : void 0, z = i({
42
+ account: R ?? p,
43
+ selector: v.selector ?? "0x00000000",
44
+ chainId: S,
45
+ config: y,
46
+ query: {
47
+ enabled: I && !!(R && v.selector),
48
+ retry: !1
49
+ }
50
+ }), B = a({
51
+ account: v.account ?? p,
52
+ chainId: S,
53
+ solverId: v.solverId,
54
+ capability: F,
55
+ selectors: v.selector ? [v.selector] : [],
56
+ config: y,
57
+ query: {
58
+ enabled: I && !!(v.account && v.selector && F),
59
+ retry: !1,
60
+ staleTime: 0
61
+ }
62
+ }), V = `${S}:${y.getChainConfig(S).addresses.accountLayerAddress.toLowerCase()}:${(R ?? v.account)?.toLowerCase()}`, H = JSON.stringify([
63
+ V,
64
+ C.id,
65
+ C.url,
66
+ v.owner?.toLowerCase(),
67
+ v.account?.toLowerCase(),
68
+ v.selector?.toLowerCase(),
69
+ v.enabled,
70
+ A,
71
+ j,
72
+ E.current,
73
+ F,
74
+ z.data?.unlocker,
75
+ z.data?.delay?.toString()
76
+ ]);
77
+ w.current = H;
78
+ let U;
79
+ if (!j || A === !1) U = { kind: "normal" };
80
+ else if (!I) U = { kind: "normal" };
81
+ else if (!v.account || !v.selector) U = { kind: "loading" };
82
+ else if (L.error || z.error) U = {
83
+ kind: "error",
84
+ message: (L.error ?? z.error).message
85
+ };
86
+ else if (!R || !z.data || z.isFetching) U = { kind: "loading" };
87
+ else if (f(z.data.unlocker, p)) U = { kind: "normal" };
88
+ else if (!v.capability && P.error && (A === !0 || F) && (P.error.kind === "rpc" || P.error.kind === "api" && (P.error.status === 0 || (P.error.status ?? 0) >= 500))) U = {
89
+ kind: "delayed",
90
+ rootAccount: R,
91
+ unlocker: z.data.unlocker,
92
+ delay: z.data.delay
93
+ };
94
+ else if (!v.capability && !M && P.error) U = {
95
+ kind: "error",
96
+ message: P.error.message
97
+ };
98
+ else if (!v.capability && !M && P.isFetching) U = { kind: "loading" };
99
+ else if (F) {
100
+ let e = y.getChainConfig(S);
101
+ U = Number(F.requestDomain.chainId) !== S || !f(F.requestDomain.verifyingContract, e.addresses.accountLayerAddress) ? {
102
+ kind: "error",
103
+ message: "Timelock provider belongs to another deployment."
104
+ } : B.error ? {
105
+ kind: "error",
106
+ message: B.error.message
107
+ } : !B.data || B.isFetching ? { kind: "loading" } : !B.data.ready || !f(F.unlocker, z.data.unlocker) ? {
108
+ kind: "error",
109
+ message: "The on-chain selector policy does not match the provider."
110
+ } : {
111
+ kind: "approval",
112
+ rootAccount: R,
113
+ capability: F
114
+ };
115
+ } else U = C.id !== "enigma" || P.isSuccess ? {
116
+ kind: "error",
117
+ message: "Timelock provider metadata is unavailable or not configured."
118
+ } : { kind: "loading" };
119
+ async function W(e) {
120
+ if (O.current.has(V)) throw Error("A prior protected operation requires reconciliation.");
121
+ if (U.kind === "delayed") return U;
122
+ if (U.kind === "normal") return {
123
+ kind: "submitted",
124
+ result: await e.normal()
125
+ };
126
+ if (U.kind !== "approval") throw Error(U.kind === "error" ? U.message : "Timelock routing is still loading.");
127
+ if (e.deadline === void 0) throw Error("An approval request deadline is required.");
128
+ O.current.set(V, "pending"), k((e) => e + 1);
129
+ let t = !1;
130
+ try {
131
+ let r = v.provider ?? c({ baseUrl: C.url }), i = {
132
+ capability: U.capability,
133
+ provider: { requestApproval: async (e, t) => {
134
+ if (!D.current || w.current !== H) throw Error("Account or deployment changed before requesting approval.");
135
+ try {
136
+ return await r.requestApproval(e, t);
137
+ } catch (e) {
138
+ throw v.provider || n(b, y, S, C.id, e), e;
139
+ }
140
+ } },
141
+ deadline: e.deadline,
142
+ onApproval: async (n) => {
143
+ if (t = !0, await e.onApproval?.(n), !D.current || w.current !== H) throw Error("Account or deployment changed; reconcile the previous approval.");
144
+ }
145
+ };
146
+ if (!D.current || w.current !== H) throw Error("Account or deployment changed before execution.");
147
+ let a = await e.protected(i);
148
+ return a.receipt?.status === "success" ? O.current.delete(V) : O.current.set(V, "reconcile"), {
149
+ kind: "submitted",
150
+ result: a
151
+ };
152
+ } catch (e) {
153
+ throw !t && (l(e) || u(e)) ? O.current.delete(V) : O.current.set(V, "reconcile"), e;
154
+ } finally {
155
+ k((e) => e + 1);
156
+ }
157
+ }
158
+ function G() {
159
+ if (O.current.get(V) === "pending") throw Error("The operation is still pending.");
160
+ O.current.delete(V), k((e) => e + 1);
161
+ }
162
+ return O.current.has(V) && (U = { kind: "reconciliation" }), {
163
+ route: U,
164
+ rootAccount: R,
165
+ selector: z,
166
+ policy: B,
167
+ info: P,
168
+ virtual: L,
169
+ run: W,
170
+ attempt: O.current.get(V),
171
+ clearReconciledAttempt: G
172
+ };
173
+ }
174
+ //#endregion
175
+ export { v as useTimelockRoute };
176
+
177
+ //# sourceMappingURL=use-timelock-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-timelock-route.js","names":[],"sources":["../../src/account-layer/use-timelock-route.ts"],"sourcesContent":["\"use client\";\n\nimport {\n createHttpTimelockApprovalProvider,\n isDefiniteTimelockApprovalRejection,\n isUnsubmittedTimelockWalletRejection,\n resolveTimelockFamilyAccount,\n type ConfigParameter,\n type SolverId,\n type TimelockApprovalCapability,\n type TimelockApprovalProvider,\n type TimelockAuthorization,\n type ValidatedTimelockApproval,\n} from \"@symmio/trading-core\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { isAddressEqual, zeroAddress, type Address, type Hex } from \"viem\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { refreshTimelockInfoAfterUnavailable, useKnownTimelockCapability } from \"../solvers/timelock-capability-cache\";\nimport { useSolverInfo } from \"../solvers/use-solver-info\";\nimport { useSelectorTimelock } from \"./use-timelock\";\nimport { useTimelockPolicy } from \"./use-timelock-policy\";\nimport { useVirtualAccount } from \"./use-virtual-account\";\n\n/** Inputs for resolving a single operation's timelock route. */\nexport type UseTimelockRouteParameters = ConfigParameter & {\n account?: Address;\n selector?: Hex;\n chainId?: number;\n solverId?: SolverId;\n /** Wallet identity, included in the attempt scope when supplied. */\n owner?: Address;\n /** Disable discovery and policy reads when the consuming flow does not use timelocks. Defaults to true. */\n enabled?: boolean;\n /** Non-Enigma providers can supply independently obtained deployment metadata. */\n capability?: TimelockApprovalCapability;\n /** Override the standard approval transport. Keep this reference stable while an attempt is running. */\n provider?: TimelockApprovalProvider;\n};\n\n/** Routing outcome. `delayed` requires the consumer to offer the on-chain schedule flow. */\nexport type TimelockRoute =\n | { kind: \"loading\" }\n | { kind: \"reconciliation\" }\n | { kind: \"normal\" }\n | { kind: \"approval\"; rootAccount: Address; capability: TimelockApprovalCapability }\n | { kind: \"delayed\"; rootAccount: Address; unlocker: Address; delay: bigint }\n | { kind: \"error\"; message: string };\n\n/**\n * Select a route from the configured solver capability and the root selector policy.\n * `run` delegates execution to the supplied callbacks; it does not automatically\n * schedule an operation. Persist recovery in the consumer across unmounts and tabs.\n * A delayed result is only an option: reconcile prior ambiguous attempts first.\n * @param parameters - Account, selector, deployment and optional provider metadata.\n * @returns Current route and underlying reads for refresh and diagnostics.\n * @example const route = useTimelockRoute({ account, selector });\n */\nexport function useTimelockRoute(parameters: UseTimelockRouteParameters) {\n const config = useSymmioConfig(parameters);\n const queryClient = useQueryClient();\n const connectedChain = useSymmioChainId();\n const chainId = parameters.chainId ?? connectedChain;\n const solver = config.getSolver({ chainId, solverId: parameters.solverId });\n const currentScope = useRef(\"\");\n const providerIdentity = useRef(parameters.provider);\n const providerRevision = useRef(0);\n if (providerIdentity.current !== parameters.provider) {\n providerIdentity.current = parameters.provider;\n providerRevision.current += 1;\n }\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const attempts = useRef(new Map<string, \"pending\" | \"reconcile\">());\n const [, refresh] = useState(0);\n const configured = solver.capabilities?.timelockApproval;\n const chainSupported = parameters.enabled !== false && config.getChainConfig(chainId).timelockSupported !== false;\n const known = useKnownTimelockCapability(config, chainId, parameters.solverId);\n const canDiscover =\n chainSupported && configured !== false && solver.id === \"enigma\" && !parameters.capability && !known;\n const info = useSolverInfo({\n chainId,\n solverId: parameters.solverId,\n config,\n query: { enabled: canDiscover, retry: false, staleTime: 0 },\n });\n const capability =\n parameters.capability ?? known ?? (info.isPlaceholderData ? undefined : info.data?.timelockApproval);\n const supported =\n chainSupported && configured !== false && (configured === true || Boolean(capability) || canDiscover);\n const virtual = useVirtualAccount({\n account: parameters.account,\n chainId,\n config,\n query: { enabled: supported && Boolean(parameters.account), retry: false },\n });\n const rootAccount =\n virtual.isSuccess && virtual.data && parameters.account\n ? resolveTimelockFamilyAccount(parameters.account, virtual.data)\n : undefined;\n const selector = useSelectorTimelock({\n account: rootAccount ?? zeroAddress,\n selector: parameters.selector ?? \"0x00000000\",\n chainId,\n config,\n query: { enabled: supported && Boolean(rootAccount && parameters.selector), retry: false },\n });\n const policy = useTimelockPolicy({\n account: parameters.account ?? zeroAddress,\n chainId,\n solverId: parameters.solverId,\n capability,\n selectors: parameters.selector ? [parameters.selector] : [],\n config,\n query: {\n enabled: supported && Boolean(parameters.account && parameters.selector && capability),\n retry: false,\n staleTime: 0,\n },\n });\n const attemptKey = `${chainId}:${config.getChainConfig(chainId).addresses.accountLayerAddress.toLowerCase()}:${(rootAccount ?? parameters.account)?.toLowerCase()}`;\n const scope = JSON.stringify([\n attemptKey,\n solver.id,\n solver.url,\n parameters.owner?.toLowerCase(),\n parameters.account?.toLowerCase(),\n parameters.selector?.toLowerCase(),\n parameters.enabled,\n configured,\n chainSupported,\n providerRevision.current,\n capability,\n selector.data?.unlocker,\n selector.data?.delay?.toString(),\n ]);\n currentScope.current = scope;\n let route: TimelockRoute;\n if (!chainSupported || configured === false) route = { kind: \"normal\" };\n else if (!supported) route = { kind: \"normal\" };\n else if (!parameters.account || !parameters.selector) route = { kind: \"loading\" };\n else if (virtual.error || selector.error)\n route = { kind: \"error\", message: (virtual.error ?? selector.error)!.message };\n else if (!rootAccount || !selector.data || selector.isFetching) route = { kind: \"loading\" };\n else if (isAddressEqual(selector.data.unlocker, zeroAddress)) route = { kind: \"normal\" };\n else {\n if (\n !parameters.capability &&\n info.error &&\n (configured === true || Boolean(capability)) &&\n (info.error.kind === \"rpc\" ||\n (info.error.kind === \"api\" && (info.error.status === 0 || (info.error.status ?? 0) >= 500)))\n )\n route = { kind: \"delayed\", rootAccount, unlocker: selector.data.unlocker, delay: selector.data.delay };\n else if (!parameters.capability && !known && info.error) route = { kind: \"error\", message: info.error.message };\n else if (!parameters.capability && !known && info.isFetching) route = { kind: \"loading\" };\n else if (capability) {\n const chain = config.getChainConfig(chainId);\n if (\n Number(capability.requestDomain.chainId) !== chainId ||\n !isAddressEqual(capability.requestDomain.verifyingContract, chain.addresses.accountLayerAddress)\n )\n route = { kind: \"error\", message: \"Timelock provider belongs to another deployment.\" };\n else if (policy.error) route = { kind: \"error\", message: policy.error.message };\n else if (!policy.data || policy.isFetching) route = { kind: \"loading\" };\n else if (!policy.data.ready || !isAddressEqual(capability.unlocker, selector.data.unlocker))\n route = { kind: \"error\", message: \"The on-chain selector policy does not match the provider.\" };\n else route = { kind: \"approval\", rootAccount, capability };\n } else if (solver.id !== \"enigma\" || info.isSuccess)\n route = { kind: \"error\", message: \"Timelock provider metadata is unavailable or not configured.\" };\n else route = { kind: \"loading\" };\n }\n /** Execute the selected normal/approval branch once, or return the delayed option to the UI. */\n async function run<T extends { receipt?: { status: string } }>(actions: {\n normal: () => Promise<T>;\n protected: (authorization: TimelockAuthorization) => Promise<T>;\n deadline?: bigint;\n onApproval?: (approval: ValidatedTimelockApproval) => void | Promise<void>;\n }): Promise<\n { kind: \"submitted\"; result: T } | { kind: \"delayed\"; rootAccount: Address; unlocker: Address; delay: bigint }\n > {\n if (attempts.current.has(attemptKey)) throw new Error(\"A prior protected operation requires reconciliation.\");\n if (route.kind === \"delayed\") return route;\n if (route.kind === \"normal\") return { kind: \"submitted\", result: await actions.normal() };\n if (route.kind !== \"approval\")\n throw new Error(route.kind === \"error\" ? route.message : \"Timelock routing is still loading.\");\n if (actions.deadline === undefined) throw new Error(\"An approval request deadline is required.\");\n attempts.current.set(attemptKey, \"pending\");\n refresh((value) => value + 1);\n let issued = false;\n try {\n const provider = parameters.provider ?? createHttpTimelockApprovalProvider({ baseUrl: solver.url });\n const authorization: TimelockAuthorization = {\n capability: route.capability,\n provider: {\n requestApproval: async (request, options) => {\n if (!mounted.current || currentScope.current !== scope)\n throw new Error(\"Account or deployment changed before requesting approval.\");\n try {\n return await provider.requestApproval(request, options);\n } catch (error) {\n if (!parameters.provider)\n void refreshTimelockInfoAfterUnavailable(queryClient, config, chainId, solver.id, error);\n throw error;\n }\n },\n },\n deadline: actions.deadline,\n onApproval: async (approval) => {\n issued = true;\n await actions.onApproval?.(approval);\n if (!mounted.current || currentScope.current !== scope)\n throw new Error(\"Account or deployment changed; reconcile the previous approval.\");\n },\n };\n if (!mounted.current || currentScope.current !== scope)\n throw new Error(\"Account or deployment changed before execution.\");\n const result = await actions.protected(authorization);\n if (result.receipt?.status === \"success\") attempts.current.delete(attemptKey);\n else attempts.current.set(attemptKey, \"reconcile\");\n return { kind: \"submitted\", result };\n } catch (error) {\n const definitelyNotSubmitted =\n !issued && (isDefiniteTimelockApprovalRejection(error) || isUnsubmittedTimelockWalletRejection(error));\n if (definitelyNotSubmitted) attempts.current.delete(attemptKey);\n else attempts.current.set(attemptKey, \"reconcile\");\n throw error;\n } finally {\n refresh((value) => value + 1);\n }\n }\n function clearReconciledAttempt() {\n if (attempts.current.get(attemptKey) === \"pending\") throw new Error(\"The operation is still pending.\");\n attempts.current.delete(attemptKey);\n refresh((value) => value + 1);\n }\n if (attempts.current.has(attemptKey)) route = { kind: \"reconciliation\" };\n return {\n route,\n rootAccount,\n selector,\n policy,\n info,\n virtual,\n run,\n attempt: attempts.current.get(attemptKey),\n clearReconciledAttempt,\n };\n}\n"],"mappings":";;;;;;;;;;;;;AA2DA,SAAgB,EAAiB,GAAwC;CACvE,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAc,EAAe,GAC7B,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAChC,IAAS,EAAO,UAAU;EAAE;EAAS,UAAU,EAAW;CAAS,CAAC,GACpE,IAAe,EAAO,EAAE,GACxB,IAAmB,EAAO,EAAW,QAAQ,GAC7C,IAAmB,EAAO,CAAC;CACjC,AAAI,EAAiB,YAAY,EAAW,aAC1C,EAAiB,UAAU,EAAW,UACtC,EAAiB,WAAW;CAE9B,IAAM,IAAU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AA2D;KAC7E,IAAI;MACF,OAAO,MAAM,EAAS,gBAAgB,GAAS,CAAO;KACxD,SAAS,GAAO;MAGd,MAFK,EAAW,YACd,EAAyC,GAAa,GAAQ,GAAS,EAAO,IAAI,CAAK,GACnF;KACR;IACF,EACF;IACA,UAAU,EAAQ;IAClB,YAAY,OAAO,MAAa;KAG9B,IAFA,IAAS,IACT,MAAM,EAAQ,aAAa,CAAQ,GAC/B,CAAC,EAAQ,WAAW,EAAa,YAAY,GAC/C,MAAU,MAAM,iEAAiE;IACrF;GACF;GACA,IAAI,CAAC,EAAQ,WAAW,EAAa,YAAY,GAC/C,MAAU,MAAM,iDAAiD;GACnE,IAAM,IAAS,MAAM,EAAQ,UAAU,CAAa;GAGpD,OAFI,EAAO,SAAS,WAAW,YAAW,EAAS,QAAQ,OAAO,CAAU,IACvE,EAAS,QAAQ,IAAI,GAAY,WAAW,GAC1C;IAAE,MAAM;IAAa;GAAO;EACrC,SAAS,GAAO;GAKd,MAHE,CAAC,MAAW,EAAoC,CAAK,KAAK,EAAqC,CAAK,KAC1E,EAAS,QAAQ,OAAO,CAAU,IACzD,EAAS,QAAQ,IAAI,GAAY,WAAW,GAC3C;EACR,UAAU;GACR,GAAS,MAAU,IAAQ,CAAC;EAC9B;CACF;CACA,SAAS,IAAyB;EAChC,IAAI,EAAS,QAAQ,IAAI,CAAU,MAAM,WAAW,MAAU,MAAM,iCAAiC;EAErG,AADA,EAAS,QAAQ,OAAO,CAAU,GAClC,GAAS,MAAU,IAAQ,CAAC;CAC9B;CAEA,OADI,EAAS,QAAQ,IAAI,CAAU,MAAG,IAAQ,EAAE,MAAM,iBAAiB,IAChE;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,EAAS,QAAQ,IAAI,CAAU;EACxC;CACF;AACF"}
@@ -0,0 +1,102 @@
1
+ import { CancelTimelockOpParameters, ClearTimelocksParameters, ConfigParameter, ExecuteProtectedCallParameters, ExecuteTimelockOpParameters, GetSelectorTimelockOptions, GetTimelockScheduleStateOptions, RequestTimelockApprovalParameters, ScheduleTimelockOpParameters, SelectorTimelock, SetupTimelocksParameters, SolverId, TimelockScheduleState, ValidatedTimelockApproval } from '@symmio/trading-core';
2
+ import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
3
+ import { Address, Hex } from 'viem';
4
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
5
+ import { WriteParameters, WriteResult } from '../transactions/index.js';
6
+ /** Select a supported policy selector by its ABI function name. */
7
+ export declare function useTimelockSelector(name: string): Hex | undefined;
8
+ /** Check whether an execution payload matches a single scheduled raw call. */
9
+ export declare function useScheduledCallMatch(account: Address, rawCallData: Hex, innerCallData: Hex): boolean;
10
+ /** Create the standard approval transport for the selected solver. */
11
+ export declare function useTimelockApprovalProvider(parameters?: ConfigParameter & {
12
+ chainId?: number;
13
+ solverId?: SolverId;
14
+ }): {
15
+ requestApproval(request: Parameters<(request: import('@symmio/trading-core').TimelockApprovalRequestPayload, options?: {
16
+ signal?: AbortSignal;
17
+ }) => Promise<import('@symmio/trading-core').TimelockApprovalResponse>>[0], options?: Parameters<(request: import('@symmio/trading-core').TimelockApprovalRequestPayload, options?: {
18
+ signal?: AbortSignal;
19
+ }) => Promise<import('@symmio/trading-core').TimelockApprovalResponse>>[1]): Promise<import('@symmio/trading-core').TimelockApprovalResponse>;
20
+ };
21
+ /** Execute one exact protected call and refresh affected reads after confirmation. */
22
+ export declare function useProtectedCall(parameters?: WriteParameters): UseMutationResult<WriteResult, SymmioRequestError, ExecuteProtectedCallParameters>;
23
+ /**
24
+ * Configure root-account timelock policy and refresh policy-derived reads after confirmation.
25
+ *
26
+ * @param parameters - Receipt waiting and optional config controls.
27
+ * @returns A mutation whose variables match `setupTimelocks`.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * const setup = useSetupTimelocks();
32
+ * setup.mutate({ account: root, unlocker, delay: 600n, selectors, gasless: true });
33
+ * ```
34
+ */
35
+ export declare function useSetupTimelocks(parameters?: WriteParameters): UseMutationResult<WriteResult, SymmioRequestError, SetupTimelocksParameters>;
36
+ /**
37
+ * Remove selector policies from a root account.
38
+ *
39
+ * @param parameters - Receipt waiting and optional config controls.
40
+ * @returns A mutation whose variables match `clearTimelocks`.
41
+ */
42
+ export declare function useClearTimelocks(parameters?: WriteParameters): UseMutationResult<WriteResult, SymmioRequestError, ClearTimelocksParameters>;
43
+ /**
44
+ * Schedule raw operation calldata for delayed fallback execution.
45
+ *
46
+ * @param parameters - Receipt waiting and optional config controls.
47
+ * @returns A mutation whose variables include the root account and exact raw calldata.
48
+ */
49
+ export declare function useScheduleTimelockOp(parameters?: WriteParameters): UseMutationResult<WriteResult, SymmioRequestError, ScheduleTimelockOpParameters>;
50
+ /**
51
+ * Cancel a pending fallback schedule before execution.
52
+ *
53
+ * @param parameters - Receipt waiting and optional config controls.
54
+ * @returns A mutation that accepts the same root account and raw calldata used to schedule.
55
+ */
56
+ export declare function useCancelTimelockOp(parameters?: WriteParameters): UseMutationResult<WriteResult, SymmioRequestError, CancelTimelockOpParameters>;
57
+ /**
58
+ * Execute a timelocked AccountLayer call with an approval or mature schedule.
59
+ * After confirmation, refresh the inner operation's affected reads, including
60
+ * account lists and details for `deleteSubAccount`. No approval is requested automatically.
61
+ *
62
+ * @param parameters - Receipt waiting and optional config controls.
63
+ * @returns A mutation whose variables carry inner AccountLayer calldata and optional approvals.
64
+ */
65
+ export declare function useExecuteTimelockOp(parameters?: WriteParameters): UseMutationResult<WriteResult, SymmioRequestError, ExecuteTimelockOpParameters>;
66
+ /**
67
+ * Request one public approval. Automatic mutation retries are always disabled.
68
+ *
69
+ * @param parameters - Optional SDK config override.
70
+ * @returns A mutation returning a validated signed approval and the prepared request.
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * const approval = useRequestTimelockApproval();
75
+ * approval.mutate({ provider, capability, account, rootAccount, callData, deadline });
76
+ * ```
77
+ */
78
+ export declare function useRequestTimelockApproval(parameters?: ConfigParameter): UseMutationResult<ValidatedTimelockApproval, SymmioRequestError, RequestTimelockApprovalParameters>;
79
+ /** Required selector-policy query inputs plus React config overrides. */
80
+ export type UseSelectorTimelockParameters = GetSelectorTimelockOptions & ConfigParameter;
81
+ /**
82
+ * Read the unlocker and delay configured for one root-account selector.
83
+ *
84
+ * @param parameters - Root account, selector, optional chain, and TanStack query controls.
85
+ * @returns A TanStack query result containing the selector policy.
86
+ */
87
+ export declare function useSelectorTimelock(parameters: UseSelectorTimelockParameters): UseQueryResult<SelectorTimelock, SymmioRequestError>;
88
+ /** Required schedule-state query inputs plus React config overrides. */
89
+ export type UseTimelockScheduleStateParameters = GetTimelockScheduleStateOptions & ConfigParameter;
90
+ /**
91
+ * Read a fallback schedule and its derived ready/expiry timestamps.
92
+ *
93
+ * @param parameters - Root account, exact raw calldata, optional selector calldata, and query controls.
94
+ * @returns A TanStack query result containing schedule state and policy timing.
95
+ *
96
+ * @example
97
+ * ```tsx
98
+ * const schedule = useTimelockScheduleState({ account: root, callData: rawWithdrawCall });
99
+ * ```
100
+ */
101
+ export declare function useTimelockScheduleState(parameters: UseTimelockScheduleStateParameters): UseQueryResult<TimelockScheduleState, SymmioRequestError>;
102
+ //# sourceMappingURL=use-timelock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-timelock.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-timelock.ts"],"names":[],"mappings":"AAEA,OAAO,EAmBL,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAE7B,KAAK,eAAe,EACpB,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EACb,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,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