@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,6 +3,7 @@ export * from './use-are-delegations-active.js';
3
3
  export * from './use-delegation-expiry.js';
4
4
  export * from './use-finalize-revoke-delegation.js';
5
5
  export * from './use-grant-delegation.js';
6
+ export * from './use-grant-delegations.js';
6
7
  export * from './use-initiate-revoke-delegation.js';
7
8
  export * from './use-instant-close.js';
8
9
  export * from './use-instant-close-auto.js';
@@ -25,4 +26,5 @@ export * from './use-prepare-instant-open-params.js';
25
26
  export * from './use-revocation-cooldown.js';
26
27
  export * from './use-session-key-selectors.js';
27
28
  export * from './use-simulate-grant-delegation.js';
29
+ export * from './use-simulate-grant-delegations.js';
28
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instant-layer/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instant-layer/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC"}
@@ -3,26 +3,28 @@ import { useAreDelegationsActive as t } from "./use-are-delegations-active.js";
3
3
  import { useDelegationExpiry as n } from "./use-delegation-expiry.js";
4
4
  import { useFinalizeRevokeDelegation as r } from "./use-finalize-revoke-delegation.js";
5
5
  import { useGrantDelegation as i } from "./use-grant-delegation.js";
6
- import { useInitiateRevokeDelegation as a } from "./use-initiate-revoke-delegation.js";
7
- import { useInstantClose as o } from "./use-instant-close.js";
8
- import { useInstantCloseAuto as s } from "./use-instant-close-auto.js";
9
- import { useInstantCloseBulk as c } from "./use-instant-close-bulk.js";
10
- import { useInstantCloseBulkAuto as l } from "./use-instant-close-bulk-auto.js";
11
- import { useInstantCloseFees as u } from "./use-instant-close-fees.js";
12
- import { useInstantCloses as d } from "./use-instant-closes.js";
13
- import { useInstantOpen as f } from "./use-instant-open.js";
14
- import { useInstantOpenAuto as p } from "./use-instant-open-auto.js";
15
- import { useInstantOpenFees as m } from "./use-instant-open-fees.js";
16
- import { useInstantOpenQuoteId as h } from "./use-instant-open-quote-id.js";
17
- import { useInstantOpenWithTpSl as g } from "./use-instant-open-with-tpsl.js";
18
- import { useInstantOpens as _ } from "./use-instant-opens.js";
19
- import { useInstantTradeRequiredSelectors as v } from "./use-instant-trade-required-selectors.js";
20
- import { useIsDelegationActive as y } from "./use-is-delegation-active.js";
21
- import { useLimitCloseAuto as b } from "./use-limit-close-auto.js";
22
- import { useLimitOpenAuto as x } from "./use-limit-open-auto.js";
23
- import { usePendingRevocation as S } from "./use-pending-revocation.js";
24
- import { usePrepareInstantOpenParams as C } from "./use-prepare-instant-open-params.js";
25
- import { useRevocationCooldown as w } from "./use-revocation-cooldown.js";
26
- import { useSessionKeySelectors as T } from "./use-session-key-selectors.js";
27
- import { useSimulateGrantDelegation as E } from "./use-simulate-grant-delegation.js";
28
- export { e as useActiveDelegations, t as useAreDelegationsActive, n as useDelegationExpiry, r as useFinalizeRevokeDelegation, i as useGrantDelegation, a as useInitiateRevokeDelegation, o as useInstantClose, s as useInstantCloseAuto, c as useInstantCloseBulk, l as useInstantCloseBulkAuto, u as useInstantCloseFees, d as useInstantCloses, f as useInstantOpen, p as useInstantOpenAuto, m as useInstantOpenFees, h as useInstantOpenQuoteId, g as useInstantOpenWithTpSl, _ as useInstantOpens, v as useInstantTradeRequiredSelectors, y as useIsDelegationActive, b as useLimitCloseAuto, x as useLimitOpenAuto, S as usePendingRevocation, C as usePrepareInstantOpenParams, w as useRevocationCooldown, T as useSessionKeySelectors, E as useSimulateGrantDelegation };
6
+ import { useGrantDelegations as a } from "./use-grant-delegations.js";
7
+ import { useInitiateRevokeDelegation as o } from "./use-initiate-revoke-delegation.js";
8
+ import { useInstantClose as s } from "./use-instant-close.js";
9
+ import { useInstantCloseAuto as c } from "./use-instant-close-auto.js";
10
+ import { useInstantCloseBulk as l } from "./use-instant-close-bulk.js";
11
+ import { useInstantCloseBulkAuto as u } from "./use-instant-close-bulk-auto.js";
12
+ import { useInstantCloseFees as d } from "./use-instant-close-fees.js";
13
+ import { useInstantCloses as f } from "./use-instant-closes.js";
14
+ import { useInstantOpen as p } from "./use-instant-open.js";
15
+ import { useInstantOpenAuto as m } from "./use-instant-open-auto.js";
16
+ import { useInstantOpenFees as h } from "./use-instant-open-fees.js";
17
+ import { useInstantOpenQuoteId as g } from "./use-instant-open-quote-id.js";
18
+ import { useInstantOpenWithTpSl as _ } from "./use-instant-open-with-tpsl.js";
19
+ import { useInstantOpens as v } from "./use-instant-opens.js";
20
+ import { useInstantTradeRequiredSelectors as y } from "./use-instant-trade-required-selectors.js";
21
+ import { useIsDelegationActive as b } from "./use-is-delegation-active.js";
22
+ import { useLimitCloseAuto as x } from "./use-limit-close-auto.js";
23
+ import { useLimitOpenAuto as S } from "./use-limit-open-auto.js";
24
+ import { usePendingRevocation as C } from "./use-pending-revocation.js";
25
+ import { usePrepareInstantOpenParams as w } from "./use-prepare-instant-open-params.js";
26
+ import { useRevocationCooldown as T } from "./use-revocation-cooldown.js";
27
+ import { useSessionKeySelectors as E } from "./use-session-key-selectors.js";
28
+ import { useSimulateGrantDelegation as D } from "./use-simulate-grant-delegation.js";
29
+ import { useSimulateGrantDelegations as O } from "./use-simulate-grant-delegations.js";
30
+ export { e as useActiveDelegations, t as useAreDelegationsActive, n as useDelegationExpiry, r as useFinalizeRevokeDelegation, i as useGrantDelegation, a as useGrantDelegations, o as useInitiateRevokeDelegation, s as useInstantClose, c as useInstantCloseAuto, l as useInstantCloseBulk, u as useInstantCloseBulkAuto, d as useInstantCloseFees, f as useInstantCloses, p as useInstantOpen, m as useInstantOpenAuto, h as useInstantOpenFees, g as useInstantOpenQuoteId, _ as useInstantOpenWithTpSl, v as useInstantOpens, y as useInstantTradeRequiredSelectors, b as useIsDelegationActive, x as useLimitCloseAuto, S as useLimitOpenAuto, C as usePendingRevocation, w as usePrepareInstantOpenParams, T as useRevocationCooldown, E as useSessionKeySelectors, D as useSimulateGrantDelegation, O as useSimulateGrantDelegations };
@@ -0,0 +1,17 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { Address } from 'viem';
3
+ /**
4
+ * Invalidate every read a delegation grant can move, for one granting account
5
+ * and the delegates it just authorized.
6
+ *
7
+ * @param queryClient - The active `QueryClient`.
8
+ * @param parameters - The chain's config key, the granting account, and each granted delegate.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function invalidateDelegationGrant(queryClient: QueryClient, parameters: {
13
+ configKey: string;
14
+ account: Address;
15
+ delegates: readonly Address[];
16
+ }): void;
17
+ //# sourceMappingURL=invalidate-delegation-grant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalidate-delegation-grant.d.ts","sourceRoot":"","sources":["../../src/instant-layer/invalidate-delegation-grant.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,QAmCnF"}
@@ -0,0 +1,26 @@
1
+ import { predicateMatch as e } from "../utils/predicate-match.js";
2
+ import { invalidateAccountBalances as t } from "../utils/invalidate-account-balances.js";
3
+ import { getActiveDelegationsQueryKey as n, getDelegationExpiryQueryKey as r, getInstantLayerNonceQueryKey as i, getIsDelegationActiveQueryKey as a, getOperationalFeeAllowanceQueryKey as o, getPendingRevocationEtasQueryKey as s } from "@symmio/trading-core";
4
+ //#region src/instant-layer/invalidate-delegation-grant.ts
5
+ function c(c, l) {
6
+ let { configKey: u, account: d } = l;
7
+ for (let t of l.delegates) {
8
+ let n = {
9
+ configKey: u,
10
+ account: d,
11
+ delegate: t
12
+ };
13
+ c.invalidateQueries({ predicate: e(r, n) }), c.invalidateQueries({ predicate: e(a, n) });
14
+ }
15
+ c.invalidateQueries({ predicate: e(n, { configKey: u }) }), c.invalidateQueries({ predicate: e(s, { configKey: u }) }), c.invalidateQueries({ predicate: e(i, {
16
+ configKey: u,
17
+ account: d
18
+ }) }), c.invalidateQueries({ predicate: e(o, {
19
+ configKey: u,
20
+ payer: d
21
+ }) }), t(c, { configKey: u });
22
+ }
23
+ //#endregion
24
+ export { c as invalidateDelegationGrant };
25
+
26
+ //# sourceMappingURL=invalidate-delegation-grant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalidate-delegation-grant.js","names":[],"sources":["../../src/instant-layer/invalidate-delegation-grant.ts"],"sourcesContent":["import {\n getActiveDelegationsQueryKey,\n getDelegationExpiryQueryKey,\n getInstantLayerNonceQueryKey,\n getIsDelegationActiveQueryKey,\n getOperationalFeeAllowanceQueryKey,\n getPendingRevocationEtasQueryKey,\n} from \"@symmio/trading-core\";\nimport type { QueryClient } from \"@tanstack/react-query\";\nimport type { Address } from \"viem\";\nimport { invalidateAccountBalances, predicateMatch } from \"../utils\";\n\n/**\n * Invalidate every read a delegation grant can move, for one granting account\n * and the delegates it just authorized.\n *\n * @param queryClient - The active `QueryClient`.\n * @param parameters - The chain's config key, the granting account, and each granted delegate.\n *\n * @internal\n */\nexport function invalidateDelegationGrant(\n queryClient: QueryClient,\n parameters: { configKey: string; account: Address; delegates: readonly Address[] },\n) {\n const { configKey, account } = parameters;\n\n for (const delegate of parameters.delegates) {\n const delegation = { configKey, account, delegate };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getDelegationExpiryQueryKey, delegation) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getIsDelegationActiveQueryKey, delegation) });\n }\n\n /**\n * A grant also turns probed selectors active and clears any pending\n * revocation for them. These two keys hold the delegator as an object, which\n * a field-equality predicate cannot select, and `getActiveDelegations` also\n * answers for the account's virtual accounts (resolved to their parent). So\n * they are refreshed per chain config; both are cheap reads and grants are\n * rare.\n */\n void queryClient.invalidateQueries({ predicate: predicateMatch(getActiveDelegationsQueryKey, { configKey }) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getPendingRevocationEtasQueryKey, { configKey }) });\n\n /**\n * A relayed grant also consumes an InstantLayer nonce and charges the\n * operational fee from collateral. The hook cannot see which transport ran,\n * so it invalidates the superset: a wallet grant moves none of these, and an\n * extra refetch costs far less than a stale allowance silently blocking the\n * next relay.\n */\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getInstantLayerNonceQueryKey, { configKey, account }),\n });\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getOperationalFeeAllowanceQueryKey, { configKey, payer: account }),\n });\n invalidateAccountBalances(queryClient, { configKey });\n}\n"],"mappings":";;;;AAqBA,SAAgB,EACd,GACA,GACA;CACA,IAAM,EAAE,cAAW,eAAY;CAE/B,KAAK,IAAM,KAAY,EAAW,WAAW;EAC3C,IAAM,IAAa;GAAE;GAAW;GAAS;EAAS;EAElD,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAU,EAAE,CAAC,GACzG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAU,EAAE,CAAC;CAC7G;CA0BA,AAhBA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA8B,EAAE,aAAU,CAAC,EAAE,CAAC,GAC7G,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAkC,EAAE,aAAU,CAAC,EAAE,CAAC,GASjH,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAA8B;EAAE;EAAW;CAAQ,CAAC,EAChF,CAAC,GACD,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAAoC;EAAE;EAAW,OAAO;CAAQ,CAAC,EAC7F,CAAC,GACD,EAA0B,GAAa,EAAE,aAAU,CAAC;AACtD"}
@@ -24,7 +24,9 @@ export type UseGrantDelegationReturnType = UseMutationResult<GrantDelegationResu
24
24
  * path; the signed-operation encoder has no PartyB form.
25
25
  *
26
26
  * On success the delegation reads for the account/delegated signer are
27
- * invalidated, along with the reads a *relayed* grant additionally moves.
27
+ * invalidated (expiry, active status, the active-delegation probe and any
28
+ * pending revocation the grant cleared), along with the reads a *relayed*
29
+ * grant additionally moves.
28
30
  *
29
31
  * @example
30
32
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"use-grant-delegation.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-grant-delegation.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,yBAAyB,EAC/B,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,4BAA4B,GAAG,eAAe,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAEhD,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CA4C9G"}
1
+ {"version":3,"file":"use-grant-delegation.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-grant-delegation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkC,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACtG,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAEhD,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CA6B9G"}
@@ -1,45 +1,36 @@
1
1
  "use client";
2
- import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
- import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
- import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
- import { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
6
- import { predicateMatch as i } from "../utils/predicate-match.js";
7
- import { invalidateAccountBalances as a } from "../utils/invalidate-account-balances.js";
8
- import { getDelegationExpiryQueryKey as o, getInstantLayerNonceQueryKey as s, getIsDelegationActiveQueryKey as c, getOperationalFeeAllowanceQueryKey as l, grantDelegationMutationOptions as u } from "@symmio/trading-core";
9
- import { useMutation as d, useQueryClient as f } from "@tanstack/react-query";
2
+ import { useSymmioConfig as e } from "../provider/use-symmio-config.js";
3
+ import { normalizeSymmError as t } from "../errors/normalize-symm-error.js";
4
+ import { resolveWriteResult as n } from "../transactions/resolve-write-result.js";
5
+ import { invalidateDelegationGrant as r } from "./invalidate-delegation-grant.js";
6
+ import { grantDelegationMutationOptions as i } from "@symmio/trading-core";
7
+ import { useMutation as a, useQueryClient as o } from "@tanstack/react-query";
10
8
  //#region src/instant-layer/use-grant-delegation.ts
11
- function p(p = {}) {
12
- let m = t(p), h = e(), g = f(), _ = u(m);
13
- return d({
14
- mutationKey: _.mutationKey,
9
+ function s(s = {}) {
10
+ let c = e(s), l = o(), u = i(c);
11
+ return a({
12
+ mutationKey: u.mutationKey,
15
13
  mutationFn: async (e) => {
16
14
  try {
17
- return r(m, await _.mutationFn(e), {
15
+ return n(c, await u.mutationFn(e), {
18
16
  chainId: e.chainId,
19
- waitForReceipt: p.waitForReceipt,
20
- confirmations: p.confirmations
17
+ waitForReceipt: s.waitForReceipt,
18
+ confirmations: s.confirmations
21
19
  });
22
20
  } catch (e) {
23
- throw n(e);
21
+ throw t(e);
24
22
  }
25
23
  },
26
24
  onSuccess: (e, t) => {
27
- let n = m.getChainConfigKey(t.chainId ?? h), r = {
28
- configKey: n,
25
+ r(l, {
26
+ configKey: c.getChainConfigKey(t.chainId ?? c.defaultChainId),
29
27
  account: t.account.addr,
30
- delegate: t.delegatedSigner
31
- };
32
- g.invalidateQueries({ predicate: i(o, r) }), g.invalidateQueries({ predicate: i(c, r) }), g.invalidateQueries({ predicate: i(s, {
33
- configKey: n,
34
- account: t.account.addr
35
- }) }), g.invalidateQueries({ predicate: i(l, {
36
- configKey: n,
37
- payer: t.account.addr
38
- }) }), a(g, { configKey: n });
28
+ delegates: [t.delegatedSigner]
29
+ });
39
30
  }
40
31
  });
41
32
  }
42
33
  //#endregion
43
- export { p as useGrantDelegation };
34
+ export { s as useGrantDelegation };
44
35
 
45
36
  //# sourceMappingURL=use-grant-delegation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-grant-delegation.js","names":[],"sources":["../../src/instant-layer/use-grant-delegation.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getDelegationExpiryQueryKey,\n getInstantLayerNonceQueryKey,\n getIsDelegationActiveQueryKey,\n getOperationalFeeAllowanceQueryKey,\n grantDelegationMutationOptions,\n type GrantDelegationParameters,\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 { invalidateAccountBalances, predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useGrantDelegation}.\n */\nexport type UseGrantDelegationParameters = WriteParameters;\n\n/**\n * Result returned by the {@link useGrantDelegation} mutation.\n */\nexport type GrantDelegationResult = WriteResult;\n\n/** Return type of {@link useGrantDelegation}. */\nexport type UseGrantDelegationReturnType = UseMutationResult<\n GrantDelegationResult,\n SymmioRequestError,\n GrantDelegationParameters\n>;\n\n/**\n * Grant Instant Layer delegation access for one delegated signer.\n *\n * **The transport comes from config, not from the hook.** Where the chain runs\n * in gasless execution mode (or the call passes `gasless: true`), the grant is\n * signed as an InstantLayer operation and relayed — the owner pays no native\n * gas — and the relayer's broadcast hash comes back exactly where a\n * wallet-submitted hash would, so the receipt wait and the invalidation below\n * are identical either way. A `isPartyB: true` account always takes the wallet\n * path; the signed-operation encoder has no PartyB form.\n *\n * On success the delegation reads for the account/delegated signer are\n * invalidated, along with the reads a *relayed* grant additionally moves.\n *\n * @example\n * ```tsx\n * const { mutate } = useGrantDelegation();\n * mutate({ account: { addr: account, isPartyB: false }, delegatedSigner, selectors, expiryTimestamp });\n * ```\n */\nexport function useGrantDelegation(parameters: UseGrantDelegationParameters = {}): UseGrantDelegationReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = grantDelegationMutationOptions(config);\n\n return useMutation<GrantDelegationResult, SymmioRequestError, GrantDelegationParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const hash = await base.mutationFn(variables);\n return resolveWriteResult(config, hash, {\n chainId: variables.chainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_data, variables) => {\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n const delegation = { configKey, account: variables.account.addr, delegate: variables.delegatedSigner };\n\n void queryClient.invalidateQueries({ predicate: predicateMatch(getDelegationExpiryQueryKey, delegation) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getIsDelegationActiveQueryKey, delegation) });\n\n /**\n * A relayed grant also consumes an InstantLayer nonce and charges the\n * operational fee from collateral. The hook cannot see which transport\n * ran, so it invalidates the superset: a wallet grant moves none of\n * these, and an extra refetch costs far less than a stale allowance\n * silently blocking the next relay.\n */\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getInstantLayerNonceQueryKey, { configKey, account: variables.account.addr }),\n });\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getOperationalFeeAllowanceQueryKey, { configKey, payer: variables.account.addr }),\n });\n invalidateAccountBalances(queryClient, { configKey });\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAuDA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAA+B,CAAM;CAElD,OAAO,EAAkF;EACvF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IAEF,OAAO,EAAmB,GAAQ,MADf,EAAK,WAAW,CAAS,GACJ;KACtC,SAAS,EAAU;KACnB,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAO,MAAc;GAC/B,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO,GACjE,IAAa;IAAE;IAAW,SAAS,EAAU,QAAQ;IAAM,UAAU,EAAU;GAAgB;GAkBrG,AAhBA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAU,EAAE,CAAC,GACzG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAU,EAAE,CAAC,GAS3G,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAA8B;IAAE;IAAW,SAAS,EAAU,QAAQ;GAAK,CAAC,EACxG,CAAC,GACD,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAAoC;IAAE;IAAW,OAAO,EAAU,QAAQ;GAAK,CAAC,EAC5G,CAAC,GACD,EAA0B,GAAa,EAAE,aAAU,CAAC;EACtD;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-grant-delegation.js","names":[],"sources":["../../src/instant-layer/use-grant-delegation.ts"],"sourcesContent":["\"use client\";\n\nimport { grantDelegationMutationOptions, type GrantDelegationParameters } 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 { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { invalidateDelegationGrant } from \"./invalidate-delegation-grant\";\n\n/**\n * Parameters for {@link useGrantDelegation}.\n */\nexport type UseGrantDelegationParameters = WriteParameters;\n\n/**\n * Result returned by the {@link useGrantDelegation} mutation.\n */\nexport type GrantDelegationResult = WriteResult;\n\n/** Return type of {@link useGrantDelegation}. */\nexport type UseGrantDelegationReturnType = UseMutationResult<\n GrantDelegationResult,\n SymmioRequestError,\n GrantDelegationParameters\n>;\n\n/**\n * Grant Instant Layer delegation access for one delegated signer.\n *\n * **The transport comes from config, not from the hook.** Where the chain runs\n * in gasless execution mode (or the call passes `gasless: true`), the grant is\n * signed as an InstantLayer operation and relayed — the owner pays no native\n * gas — and the relayer's broadcast hash comes back exactly where a\n * wallet-submitted hash would, so the receipt wait and the invalidation below\n * are identical either way. A `isPartyB: true` account always takes the wallet\n * path; the signed-operation encoder has no PartyB form.\n *\n * On success the delegation reads for the account/delegated signer are\n * invalidated (expiry, active status, the active-delegation probe and any\n * pending revocation the grant cleared), along with the reads a *relayed*\n * grant additionally moves.\n *\n * @example\n * ```tsx\n * const { mutate } = useGrantDelegation();\n * mutate({ account: { addr: account, isPartyB: false }, delegatedSigner, selectors, expiryTimestamp });\n * ```\n */\nexport function useGrantDelegation(parameters: UseGrantDelegationParameters = {}): UseGrantDelegationReturnType {\n const config = useSymmioConfig(parameters);\n const queryClient = useQueryClient();\n\n const base = grantDelegationMutationOptions(config);\n\n return useMutation<GrantDelegationResult, SymmioRequestError, GrantDelegationParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const hash = await base.mutationFn(variables);\n return resolveWriteResult(config, hash, {\n chainId: variables.chainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_data, variables) => {\n invalidateDelegationGrant(queryClient, {\n /** The chain the write went to: the action defaults an omitted `chainId` to the config's. */\n configKey: config.getChainConfigKey(variables.chainId ?? config.defaultChainId),\n account: variables.account.addr,\n delegates: [variables.delegatedSigner],\n });\n },\n });\n}\n"],"mappings":";;;;;;;;AAiDA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAc,EAAe,GAE7B,IAAO,EAA+B,CAAM;CAElD,OAAO,EAAkF;EACvF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IAEF,OAAO,EAAmB,GAAQ,MADf,EAAK,WAAW,CAAS,GACJ;KACtC,SAAS,EAAU;KACnB,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAO,MAAc;GAC/B,EAA0B,GAAa;IAErC,WAAW,EAAO,kBAAkB,EAAU,WAAW,EAAO,cAAc;IAC9E,SAAS,EAAU,QAAQ;IAC3B,WAAW,CAAC,EAAU,eAAe;GACvC,CAAC;EACH;CACF,CAAC;AACH"}
@@ -0,0 +1,44 @@
1
+ import { GrantDelegationsParameters } from '@symmio/trading-core';
2
+ import { UseMutationResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { WriteParameters, WriteResult } from '../transactions/index.js';
5
+ /**
6
+ * Parameters for {@link useGrantDelegations}.
7
+ */
8
+ export type UseGrantDelegationsParameters = WriteParameters;
9
+ /**
10
+ * Result returned by the {@link useGrantDelegations} mutation.
11
+ */
12
+ export type GrantDelegationsResult = WriteResult;
13
+ /** Return type of {@link useGrantDelegations}. */
14
+ export type UseGrantDelegationsReturnType = UseMutationResult<GrantDelegationsResult, SymmioRequestError, GrantDelegationsParameters>;
15
+ /**
16
+ * Grant InstantLayer delegations to several signers of one account in a single
17
+ * call, for example a session key and a TP/SL executor at once.
18
+ *
19
+ * **The transport comes from config, not from the hook.** Where the chain runs
20
+ * in gasless execution mode (or the call passes `gasless: true`), the whole
21
+ * grant is one owner signature, relayed with no native gas; otherwise it is one
22
+ * wallet transaction. An empty list or a PartyB account is rejected before any
23
+ * prompt, since the contract always reverts both. The InstantLayer must have
24
+ * `grantDelegations`; older deployments revert.
25
+ *
26
+ * On success every granted delegate's reads for the account are invalidated
27
+ * (expiry, active status, the active-delegation probe and any pending
28
+ * revocation the grant cleared), along with the reads a *relayed* grant
29
+ * additionally moves.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * const { mutate } = useGrantDelegations();
34
+ * mutate({
35
+ * account: { addr: subAccount, isPartyB: false },
36
+ * delegations: [
37
+ * { delegatedSigner: sessionKey, selectors: sessionKeySelectors, expiryTimestamp },
38
+ * { delegatedSigner: tpslExecutor, selectors: tradingSelectors, expiryTimestamp },
39
+ * ],
40
+ * });
41
+ * ```
42
+ */
43
+ export declare function useGrantDelegations(parameters?: UseGrantDelegationsParameters): UseGrantDelegationsReturnType;
44
+ //# sourceMappingURL=use-grant-delegations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-grant-delegations.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-grant-delegations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,KAAK,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CA6BjH"}
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { useSymmioConfig as e } from "../provider/use-symmio-config.js";
3
+ import { normalizeSymmError as t } from "../errors/normalize-symm-error.js";
4
+ import { resolveWriteResult as n } from "../transactions/resolve-write-result.js";
5
+ import { invalidateDelegationGrant as r } from "./invalidate-delegation-grant.js";
6
+ import { grantDelegationsMutationOptions as i } from "@symmio/trading-core";
7
+ import { useMutation as a, useQueryClient as o } from "@tanstack/react-query";
8
+ //#region src/instant-layer/use-grant-delegations.ts
9
+ function s(s = {}) {
10
+ let c = e(s), l = o(), u = i(c);
11
+ return a({
12
+ mutationKey: u.mutationKey,
13
+ mutationFn: async (e) => {
14
+ try {
15
+ return n(c, await u.mutationFn(e), {
16
+ chainId: e.chainId,
17
+ waitForReceipt: s.waitForReceipt,
18
+ confirmations: s.confirmations
19
+ });
20
+ } catch (e) {
21
+ throw t(e);
22
+ }
23
+ },
24
+ onSuccess: (e, t) => {
25
+ r(l, {
26
+ configKey: c.getChainConfigKey(t.chainId ?? c.defaultChainId),
27
+ account: t.account.addr,
28
+ delegates: t.delegations.map((e) => e.delegatedSigner)
29
+ });
30
+ }
31
+ });
32
+ }
33
+ //#endregion
34
+ export { s as useGrantDelegations };
35
+
36
+ //# sourceMappingURL=use-grant-delegations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-grant-delegations.js","names":[],"sources":["../../src/instant-layer/use-grant-delegations.ts"],"sourcesContent":["\"use client\";\n\nimport { grantDelegationsMutationOptions, type GrantDelegationsParameters } 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 { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { invalidateDelegationGrant } from \"./invalidate-delegation-grant\";\n\n/**\n * Parameters for {@link useGrantDelegations}.\n */\nexport type UseGrantDelegationsParameters = WriteParameters;\n\n/**\n * Result returned by the {@link useGrantDelegations} mutation.\n */\nexport type GrantDelegationsResult = WriteResult;\n\n/** Return type of {@link useGrantDelegations}. */\nexport type UseGrantDelegationsReturnType = UseMutationResult<\n GrantDelegationsResult,\n SymmioRequestError,\n GrantDelegationsParameters\n>;\n\n/**\n * Grant InstantLayer delegations to several signers of one account in a single\n * call, for example a session key and a TP/SL executor at once.\n *\n * **The transport comes from config, not from the hook.** Where the chain runs\n * in gasless execution mode (or the call passes `gasless: true`), the whole\n * grant is one owner signature, relayed with no native gas; otherwise it is one\n * wallet transaction. An empty list or a PartyB account is rejected before any\n * prompt, since the contract always reverts both. The InstantLayer must have\n * `grantDelegations`; older deployments revert.\n *\n * On success every granted delegate's reads for the account are invalidated\n * (expiry, active status, the active-delegation probe and any pending\n * revocation the grant cleared), along with the reads a *relayed* grant\n * additionally moves.\n *\n * @example\n * ```tsx\n * const { mutate } = useGrantDelegations();\n * mutate({\n * account: { addr: subAccount, isPartyB: false },\n * delegations: [\n * { delegatedSigner: sessionKey, selectors: sessionKeySelectors, expiryTimestamp },\n * { delegatedSigner: tpslExecutor, selectors: tradingSelectors, expiryTimestamp },\n * ],\n * });\n * ```\n */\nexport function useGrantDelegations(parameters: UseGrantDelegationsParameters = {}): UseGrantDelegationsReturnType {\n const config = useSymmioConfig(parameters);\n const queryClient = useQueryClient();\n\n const base = grantDelegationsMutationOptions(config);\n\n return useMutation<GrantDelegationsResult, SymmioRequestError, GrantDelegationsParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const hash = await base.mutationFn(variables);\n return resolveWriteResult(config, hash, {\n chainId: variables.chainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_data, variables) => {\n invalidateDelegationGrant(queryClient, {\n /** The chain the write went to: the action defaults an omitted `chainId` to the config's. */\n configKey: config.getChainConfigKey(variables.chainId ?? config.defaultChainId),\n account: variables.account.addr,\n delegates: variables.delegations.map((delegation) => delegation.delegatedSigner),\n });\n },\n });\n}\n"],"mappings":";;;;;;;;AAuDA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAc,EAAe,GAE7B,IAAO,EAAgC,CAAM;CAEnD,OAAO,EAAoF;EACzF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IAEF,OAAO,EAAmB,GAAQ,MADf,EAAK,WAAW,CAAS,GACJ;KACtC,SAAS,EAAU;KACnB,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAO,MAAc;GAC/B,EAA0B,GAAa;IAErC,WAAW,EAAO,kBAAkB,EAAU,WAAW,EAAO,cAAc;IAC9E,SAAS,EAAU,QAAQ;IAC3B,WAAW,EAAU,YAAY,KAAK,MAAe,EAAW,eAAe;GACjF,CAAC;EACH;CACF,CAAC;AACH"}
@@ -2,10 +2,10 @@
2
2
  import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
3
  import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
4
  import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
- import { useFeeForUser as r } from "../fees/use-fee-for-user.js";
6
- import { useMarkets as i } from "../markets/use-markets.js";
7
- import { usePriceByName as a } from "../price-service/use-price-by-name.js";
8
- import { useSolverInfo as o } from "../solvers/use-solver-info.js";
5
+ import { useSolverInfo as r } from "../solvers/use-solver-info.js";
6
+ import { useFeeForUser as i } from "../fees/use-fee-for-user.js";
7
+ import { useMarkets as a } from "../markets/use-markets.js";
8
+ import { usePriceByName as o } from "../price-service/use-price-by-name.js";
9
9
  import { getInstantCloseFeesQueryOptions as s } from "@symmio/trading-core";
10
10
  import { useQuery as c } from "@tanstack/react-query";
11
11
  //#region src/instant-layer/use-instant-close-fees.ts
@@ -13,7 +13,7 @@ function l(l) {
13
13
  let u = t(l), d = e(), f = l.chainId ?? d, { subAccountAddress: p, market: m, quantity: h, openedAt: g, now: _, solverId: v } = l, y = (l.query?.enabled ?? !0) && h.length > 0, b = u.getSolver({
14
14
  chainId: f,
15
15
  solverId: v
16
- }).id === "enigma", x = i({
16
+ }).id === "enigma", x = a({
17
17
  config: l.config,
18
18
  chainId: f,
19
19
  solverId: v,
@@ -21,7 +21,7 @@ function l(l) {
21
21
  enabled: y,
22
22
  staleTime: 3e5
23
23
  }
24
- }).data?.find((e) => e.symbolId === m.id), S = m.name ?? x?.name, C = m.pricePrecision ?? x?.pricePrecision, w = m.quantityPrecision ?? x?.quantityPrecision, T = m.hedgerFeeOpen ?? x?.hedgerFeeOpen, E = m.hedgerFeeClose ?? x?.hedgerFeeClose, D = x?.kind === "enigma" ? x : void 0, O = m.hedgerFeeCloseEarlyRate ?? D?.hedgerFeeCloseEarlyRate ?? E, k = m.hedgerFeeCloseEarlyThreshold ?? D?.hedgerFeeCloseEarlyThreshold ?? 0, A = m.hedgerFeeCloseStandardThreshold ?? D?.hedgerFeeCloseStandardThreshold ?? 0, j = r({
24
+ }).data?.find((e) => e.symbolId === m.id), S = m.name ?? x?.name, C = m.pricePrecision ?? x?.pricePrecision, w = m.quantityPrecision ?? x?.quantityPrecision, T = m.hedgerFeeOpen ?? x?.hedgerFeeOpen, E = m.hedgerFeeClose ?? x?.hedgerFeeClose, D = x?.kind === "enigma" ? x : void 0, O = m.hedgerFeeCloseEarlyRate ?? D?.hedgerFeeCloseEarlyRate ?? E, k = m.hedgerFeeCloseEarlyThreshold ?? D?.hedgerFeeCloseEarlyThreshold ?? 0, A = m.hedgerFeeCloseStandardThreshold ?? D?.hedgerFeeCloseStandardThreshold ?? 0, j = i({
25
25
  config: l.config,
26
26
  chainId: f,
27
27
  user: p,
@@ -30,12 +30,12 @@ function l(l) {
30
30
  enabled: y && l.feeRates === void 0,
31
31
  staleTime: 3e5
32
32
  }
33
- }), M = l.feeRates ?? j.data, N = o({
33
+ }), M = l.feeRates ?? j.data, N = r({
34
34
  config: l.config,
35
35
  chainId: f,
36
36
  solverId: v,
37
37
  query: { enabled: y && b && l.solverInfo === void 0 }
38
- }), P = b ? l.solverInfo ?? N.data ?? (N.isError ? {} : void 0) : void 0, F = !b || P !== void 0, I = a({
38
+ }), P = b ? l.solverInfo ?? N.data ?? (N.isError ? {} : void 0) : void 0, F = !b || P !== void 0, I = o({
39
39
  name: S,
40
40
  solverId: v,
41
41
  enabled: y && l.markPrice === void 0
@@ -5,6 +5,7 @@ export declare function useInstantOpenInputs(parameters: GetInstantOpenFeesParam
5
5
  validationError: import('../index.js').SymmioRequestError | undefined;
6
6
  ready: boolean;
7
7
  refetchEstimatedPrice: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<import('@symmio/trading-core').GetEstimatedPriceReturnType, import('../index.js').SymmioRequestError>>;
8
+ estimatedOpenPriceWithoutShadow: string | undefined;
8
9
  estimatedOpenPriceTimestamp: number | undefined;
9
10
  prefills: {
10
11
  chainId: number;
@@ -1 +1 @@
1
- {"version":3,"file":"use-instant-open-inputs.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-inputs.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAY9B,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,4BAA4B,GAAG,eAAe,EAC1D,OAAO,EAAE,SAAS,GAAG,MAAM,EAC3B,YAAY,UAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+NpB"}
1
+ {"version":3,"file":"use-instant-open-inputs.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-inputs.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAY9B,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,4BAA4B,GAAG,eAAe,EAC1D,OAAO,EAAE,SAAS,GAAG,MAAM,EAC3B,YAAY,UAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4OpB"}