@symmio/trading-react 3.0.0 → 3.1.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 (267) hide show
  1. package/dist/account-layer/use-account-balance-of.d.ts +5 -4
  2. package/dist/account-layer/use-account-balance-of.d.ts.map +1 -1
  3. package/dist/account-layer/use-account-balance-of.js.map +1 -1
  4. package/dist/account-layer/use-add-margin.d.ts.map +1 -1
  5. package/dist/account-layer/use-add-margin.js +1 -3
  6. package/dist/account-layer/use-add-margin.js.map +1 -1
  7. package/dist/account-layer/use-allocate.d.ts.map +1 -1
  8. package/dist/account-layer/use-allocate.js +1 -3
  9. package/dist/account-layer/use-allocate.js.map +1 -1
  10. package/dist/account-layer/use-cancel-registration.d.ts.map +1 -1
  11. package/dist/account-layer/use-cancel-registration.js +1 -2
  12. package/dist/account-layer/use-cancel-registration.js.map +1 -1
  13. package/dist/account-layer/use-create-sub-accounts.d.ts.map +1 -1
  14. package/dist/account-layer/use-create-sub-accounts.js +1 -3
  15. package/dist/account-layer/use-create-sub-accounts.js.map +1 -1
  16. package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts.map +1 -1
  17. package/dist/account-layer/use-deallocate-and-initiate-withdraw.js +1 -6
  18. package/dist/account-layer/use-deallocate-and-initiate-withdraw.js.map +1 -1
  19. package/dist/account-layer/use-deallocate.d.ts.map +1 -1
  20. package/dist/account-layer/use-deallocate.js +1 -3
  21. package/dist/account-layer/use-deallocate.js.map +1 -1
  22. package/dist/account-layer/use-delete-sub-account.d.ts.map +1 -1
  23. package/dist/account-layer/use-delete-sub-account.js +1 -2
  24. package/dist/account-layer/use-delete-sub-account.js.map +1 -1
  25. package/dist/account-layer/use-deposit-and-allocate.d.ts.map +1 -1
  26. package/dist/account-layer/use-deposit-and-allocate.js +1 -3
  27. package/dist/account-layer/use-deposit-and-allocate.js.map +1 -1
  28. package/dist/account-layer/use-deposit.d.ts.map +1 -1
  29. package/dist/account-layer/use-deposit.js +1 -3
  30. package/dist/account-layer/use-deposit.js.map +1 -1
  31. package/dist/account-layer/use-edit-account-name.d.ts.map +1 -1
  32. package/dist/account-layer/use-edit-account-name.js +1 -3
  33. package/dist/account-layer/use-edit-account-name.js.map +1 -1
  34. package/dist/account-layer/use-remove-margin.d.ts.map +1 -1
  35. package/dist/account-layer/use-remove-margin.js +1 -3
  36. package/dist/account-layer/use-remove-margin.js.map +1 -1
  37. package/dist/account-layer/use-request-to-register-affiliate.d.ts.map +1 -1
  38. package/dist/account-layer/use-request-to-register-affiliate.js +1 -2
  39. package/dist/account-layer/use-request-to-register-affiliate.js.map +1 -1
  40. package/dist/collateral/use-approve-collateral.d.ts.map +1 -1
  41. package/dist/collateral/use-approve-collateral.js +1 -2
  42. package/dist/collateral/use-approve-collateral.js.map +1 -1
  43. package/dist/errors/normalize-symm-error.d.ts.map +1 -1
  44. package/dist/errors/normalize-symm-error.js +1 -0
  45. package/dist/errors/normalize-symm-error.js.map +1 -1
  46. package/dist/errors/symmio-request-error.d.ts +19 -0
  47. package/dist/errors/symmio-request-error.d.ts.map +1 -1
  48. package/dist/errors/symmio-request-error.js +2 -1
  49. package/dist/errors/symmio-request-error.js.map +1 -1
  50. package/dist/gasless/gasless-relay-types.d.ts +115 -0
  51. package/dist/gasless/gasless-relay-types.d.ts.map +1 -0
  52. package/dist/gasless/gasless-relay-types.js +9 -0
  53. package/dist/gasless/gasless-relay-types.js.map +1 -0
  54. package/dist/gasless/index.d.ts +21 -0
  55. package/dist/gasless/index.d.ts.map +1 -0
  56. package/dist/gasless/index.js +21 -0
  57. package/dist/gasless/invalidate-relay-reads.d.ts +96 -0
  58. package/dist/gasless/invalidate-relay-reads.d.ts.map +1 -0
  59. package/dist/gasless/invalidate-relay-reads.js +107 -0
  60. package/dist/gasless/invalidate-relay-reads.js.map +1 -0
  61. package/dist/gasless/use-approve-operational-fee.d.ts +38 -0
  62. package/dist/gasless/use-approve-operational-fee.d.ts.map +1 -0
  63. package/dist/gasless/use-approve-operational-fee.js +37 -0
  64. package/dist/gasless/use-approve-operational-fee.js.map +1 -0
  65. package/dist/gasless/use-debounced-batch.d.ts +22 -0
  66. package/dist/gasless/use-debounced-batch.d.ts.map +1 -0
  67. package/dist/gasless/use-debounced-batch.js +27 -0
  68. package/dist/gasless/use-debounced-batch.js.map +1 -0
  69. package/dist/gasless/use-gasless-batch-fee-quote.d.ts +48 -0
  70. package/dist/gasless/use-gasless-batch-fee-quote.d.ts.map +1 -0
  71. package/dist/gasless/use-gasless-batch-fee-quote.js +33 -0
  72. package/dist/gasless/use-gasless-batch-fee-quote.js.map +1 -0
  73. package/dist/gasless/use-gasless-deposit-policy.d.ts +28 -0
  74. package/dist/gasless/use-gasless-deposit-policy.d.ts.map +1 -0
  75. package/dist/gasless/use-gasless-deposit-policy.js +27 -0
  76. package/dist/gasless/use-gasless-deposit-policy.js.map +1 -0
  77. package/dist/gasless/use-gasless-fee-quote.d.ts +25 -0
  78. package/dist/gasless/use-gasless-fee-quote.d.ts.map +1 -0
  79. package/dist/gasless/use-gasless-fee-quote.js +27 -0
  80. package/dist/gasless/use-gasless-fee-quote.js.map +1 -0
  81. package/dist/gasless/use-gasless-relay-confirmation.d.ts +72 -0
  82. package/dist/gasless/use-gasless-relay-confirmation.d.ts.map +1 -0
  83. package/dist/gasless/use-gasless-relay-confirmation.js +148 -0
  84. package/dist/gasless/use-gasless-relay-confirmation.js.map +1 -0
  85. package/dist/gasless/use-gasless-request-stream.d.ts +34 -0
  86. package/dist/gasless/use-gasless-request-stream.d.ts.map +1 -0
  87. package/dist/gasless/use-gasless-request-stream.js +86 -0
  88. package/dist/gasless/use-gasless-request-stream.js.map +1 -0
  89. package/dist/gasless/use-gasless-request-transactions.d.ts +42 -0
  90. package/dist/gasless/use-gasless-request-transactions.d.ts.map +1 -0
  91. package/dist/gasless/use-gasless-request-transactions.js +28 -0
  92. package/dist/gasless/use-gasless-request-transactions.js.map +1 -0
  93. package/dist/gasless/use-gasless-request.d.ts +56 -0
  94. package/dist/gasless/use-gasless-request.d.ts.map +1 -0
  95. package/dist/gasless/use-gasless-request.js +51 -0
  96. package/dist/gasless/use-gasless-request.js.map +1 -0
  97. package/dist/gasless/use-gasless-wallet-address.d.ts +24 -0
  98. package/dist/gasless/use-gasless-wallet-address.d.ts.map +1 -0
  99. package/dist/gasless/use-gasless-wallet-address.js +27 -0
  100. package/dist/gasless/use-gasless-wallet-address.js.map +1 -0
  101. package/dist/gasless/use-gasless-wallet-creation-fee.d.ts +29 -0
  102. package/dist/gasless/use-gasless-wallet-creation-fee.d.ts.map +1 -0
  103. package/dist/gasless/use-gasless-wallet-creation-fee.js +27 -0
  104. package/dist/gasless/use-gasless-wallet-creation-fee.js.map +1 -0
  105. package/dist/gasless/use-gasless-wallet-execute-selectors.d.ts +44 -0
  106. package/dist/gasless/use-gasless-wallet-execute-selectors.d.ts.map +1 -0
  107. package/dist/gasless/use-gasless-wallet-execute-selectors.js +19 -0
  108. package/dist/gasless/use-gasless-wallet-execute-selectors.js.map +1 -0
  109. package/dist/gasless/use-gasless-wallet-execute.d.ts +51 -0
  110. package/dist/gasless/use-gasless-wallet-execute.d.ts.map +1 -0
  111. package/dist/gasless/use-gasless-wallet-execute.js +44 -0
  112. package/dist/gasless/use-gasless-wallet-execute.js.map +1 -0
  113. package/dist/gasless/use-gasless-wallet-nonce.d.ts +27 -0
  114. package/dist/gasless/use-gasless-wallet-nonce.d.ts.map +1 -0
  115. package/dist/gasless/use-gasless-wallet-nonce.js +27 -0
  116. package/dist/gasless/use-gasless-wallet-nonce.js.map +1 -0
  117. package/dist/gasless/use-operational-fee-allowance.d.ts +23 -0
  118. package/dist/gasless/use-operational-fee-allowance.d.ts.map +1 -0
  119. package/dist/gasless/use-operational-fee-allowance.js +27 -0
  120. package/dist/gasless/use-operational-fee-allowance.js.map +1 -0
  121. package/dist/gasless/use-relay-gasless-batch.d.ts +48 -0
  122. package/dist/gasless/use-relay-gasless-batch.d.ts.map +1 -0
  123. package/dist/gasless/use-relay-gasless-batch.js +44 -0
  124. package/dist/gasless/use-relay-gasless-batch.js.map +1 -0
  125. package/dist/gasless/use-relay-instant-operations.d.ts +43 -0
  126. package/dist/gasless/use-relay-instant-operations.d.ts.map +1 -0
  127. package/dist/gasless/use-relay-instant-operations.js +44 -0
  128. package/dist/gasless/use-relay-instant-operations.js.map +1 -0
  129. package/dist/gasless/use-resubmit-gasless-request.d.ts +39 -0
  130. package/dist/gasless/use-resubmit-gasless-request.d.ts.map +1 -0
  131. package/dist/gasless/use-resubmit-gasless-request.js +56 -0
  132. package/dist/gasless/use-resubmit-gasless-request.js.map +1 -0
  133. package/dist/gasless/use-settle-gasless-deposit-existing-account.d.ts +41 -0
  134. package/dist/gasless/use-settle-gasless-deposit-existing-account.d.ts.map +1 -0
  135. package/dist/gasless/use-settle-gasless-deposit-existing-account.js +47 -0
  136. package/dist/gasless/use-settle-gasless-deposit-existing-account.js.map +1 -0
  137. package/dist/gasless/use-settle-gasless-deposit-new-account.d.ts +48 -0
  138. package/dist/gasless/use-settle-gasless-deposit-new-account.d.ts.map +1 -0
  139. package/dist/gasless/use-settle-gasless-deposit-new-account.js +48 -0
  140. package/dist/gasless/use-settle-gasless-deposit-new-account.js.map +1 -0
  141. package/dist/gasless/use-supports-gasless-service.d.ts +22 -0
  142. package/dist/gasless/use-supports-gasless-service.d.ts.map +1 -0
  143. package/dist/gasless/use-supports-gasless-service.js +13 -0
  144. package/dist/gasless/use-supports-gasless-service.js.map +1 -0
  145. package/dist/index.d.ts +29 -11
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +251 -221
  148. package/dist/instant-layer/index.d.ts +7 -0
  149. package/dist/instant-layer/index.d.ts.map +1 -1
  150. package/dist/instant-layer/index.js +26 -19
  151. package/dist/instant-layer/use-active-delegations.d.ts +31 -0
  152. package/dist/instant-layer/use-active-delegations.d.ts.map +1 -0
  153. package/dist/instant-layer/use-active-delegations.js +23 -0
  154. package/dist/instant-layer/use-active-delegations.js.map +1 -0
  155. package/dist/instant-layer/use-are-delegations-active.d.ts +100 -0
  156. package/dist/instant-layer/use-are-delegations-active.d.ts.map +1 -0
  157. package/dist/instant-layer/use-are-delegations-active.js +60 -0
  158. package/dist/instant-layer/use-are-delegations-active.js.map +1 -0
  159. package/dist/instant-layer/use-finalize-revoke-delegation.d.ts +32 -0
  160. package/dist/instant-layer/use-finalize-revoke-delegation.d.ts.map +1 -0
  161. package/dist/instant-layer/use-finalize-revoke-delegation.js +45 -0
  162. package/dist/instant-layer/use-finalize-revoke-delegation.js.map +1 -0
  163. package/dist/instant-layer/use-grant-delegation.d.ts +12 -2
  164. package/dist/instant-layer/use-grant-delegation.d.ts.map +1 -1
  165. package/dist/instant-layer/use-grant-delegation.js +27 -20
  166. package/dist/instant-layer/use-grant-delegation.js.map +1 -1
  167. package/dist/instant-layer/use-initiate-revoke-delegation.d.ts +32 -0
  168. package/dist/instant-layer/use-initiate-revoke-delegation.d.ts.map +1 -0
  169. package/dist/instant-layer/use-initiate-revoke-delegation.js +45 -0
  170. package/dist/instant-layer/use-initiate-revoke-delegation.js.map +1 -0
  171. package/dist/instant-layer/use-pending-revocation.d.ts +119 -0
  172. package/dist/instant-layer/use-pending-revocation.d.ts.map +1 -0
  173. package/dist/instant-layer/use-pending-revocation.js +73 -0
  174. package/dist/instant-layer/use-pending-revocation.js.map +1 -0
  175. package/dist/instant-layer/use-revocation-cooldown.d.ts +24 -0
  176. package/dist/instant-layer/use-revocation-cooldown.d.ts.map +1 -0
  177. package/dist/instant-layer/use-revocation-cooldown.js +23 -0
  178. package/dist/instant-layer/use-revocation-cooldown.js.map +1 -0
  179. package/dist/instant-layer/use-session-key-selectors.d.ts +53 -0
  180. package/dist/instant-layer/use-session-key-selectors.d.ts.map +1 -0
  181. package/dist/instant-layer/use-session-key-selectors.js +25 -0
  182. package/dist/instant-layer/use-session-key-selectors.js.map +1 -0
  183. package/dist/margin/use-available-instant-open-margin.js +8 -8
  184. package/dist/markets/index.d.ts +1 -0
  185. package/dist/markets/index.d.ts.map +1 -1
  186. package/dist/markets/index.js +3 -2
  187. package/dist/markets/use-funding-fees-of-party-b.d.ts +47 -0
  188. package/dist/markets/use-funding-fees-of-party-b.d.ts.map +1 -0
  189. package/dist/markets/use-funding-fees-of-party-b.js +27 -0
  190. package/dist/markets/use-funding-fees-of-party-b.js.map +1 -0
  191. package/dist/provider/create-session-key-wallet-client-resolver.d.ts +68 -0
  192. package/dist/provider/create-session-key-wallet-client-resolver.d.ts.map +1 -0
  193. package/dist/provider/create-session-key-wallet-client-resolver.js +51 -0
  194. package/dist/provider/create-session-key-wallet-client-resolver.js.map +1 -0
  195. package/dist/provider/index.d.ts +1 -0
  196. package/dist/provider/index.d.ts.map +1 -1
  197. package/dist/provider/index.js +5 -4
  198. package/dist/provider/symmio-provider.d.ts +7 -2
  199. package/dist/provider/symmio-provider.d.ts.map +1 -1
  200. package/dist/provider/symmio-provider.js +10 -7
  201. package/dist/provider/symmio-provider.js.map +1 -1
  202. package/dist/quotes/index.d.ts +2 -0
  203. package/dist/quotes/index.d.ts.map +1 -1
  204. package/dist/quotes/use-account-upnl.js +9 -9
  205. package/dist/quotes/use-close-quote-group.js +13 -13
  206. package/dist/quotes/use-force-cancel-close-request.d.ts.map +1 -1
  207. package/dist/quotes/use-force-cancel-close-request.js +1 -4
  208. package/dist/quotes/use-force-cancel-close-request.js.map +1 -1
  209. package/dist/quotes/use-force-cancel-quote.d.ts.map +1 -1
  210. package/dist/quotes/use-force-cancel-quote.js +1 -4
  211. package/dist/quotes/use-force-cancel-quote.js.map +1 -1
  212. package/dist/quotes/use-force-close.d.ts +2 -1
  213. package/dist/quotes/use-force-close.d.ts.map +1 -1
  214. package/dist/quotes/use-force-close.js +14 -12
  215. package/dist/quotes/use-force-close.js.map +1 -1
  216. package/dist/quotes/use-limit-orders.js +9 -9
  217. package/dist/quotes/use-managed-quotes.d.ts.map +1 -1
  218. package/dist/quotes/use-managed-quotes.js +103 -103
  219. package/dist/quotes/use-managed-quotes.js.map +1 -1
  220. package/dist/quotes/use-party-a-open-positions.js +5 -5
  221. package/dist/quotes/use-quote-group-funding-history.d.ts +10 -7
  222. package/dist/quotes/use-quote-group-funding-history.d.ts.map +1 -1
  223. package/dist/quotes/use-quote-group-funding-history.js.map +1 -1
  224. package/dist/quotes/use-quote-group-funding.d.ts +4 -2
  225. package/dist/quotes/use-quote-group-funding.d.ts.map +1 -1
  226. package/dist/quotes/use-quote-group-funding.js.map +1 -1
  227. package/dist/quotes/use-quote-pending-funding.d.ts +62 -0
  228. package/dist/quotes/use-quote-pending-funding.d.ts.map +1 -0
  229. package/dist/quotes/use-quote-pending-funding.js +31 -0
  230. package/dist/quotes/use-quote-pending-funding.js.map +1 -0
  231. package/dist/quotes/use-quotes-funding.d.ts +4 -2
  232. package/dist/quotes/use-quotes-funding.d.ts.map +1 -1
  233. package/dist/quotes/use-quotes-funding.js.map +1 -1
  234. package/dist/quotes/use-quotes-pending-funding.d.ts +92 -0
  235. package/dist/quotes/use-quotes-pending-funding.d.ts.map +1 -0
  236. package/dist/quotes/use-quotes-pending-funding.js +94 -0
  237. package/dist/quotes/use-quotes-pending-funding.js.map +1 -0
  238. package/dist/quotes/use-request-to-cancel-close-request.d.ts.map +1 -1
  239. package/dist/quotes/use-request-to-cancel-close-request.js +1 -4
  240. package/dist/quotes/use-request-to-cancel-close-request.js.map +1 -1
  241. package/dist/quotes/use-request-to-cancel-quote.d.ts.map +1 -1
  242. package/dist/quotes/use-request-to-cancel-quote.js +1 -4
  243. package/dist/quotes/use-request-to-cancel-quote.js.map +1 -1
  244. package/dist/transactions/index.js +3 -3
  245. package/dist/transactions/resolve-write-result.d.ts +53 -2
  246. package/dist/transactions/resolve-write-result.d.ts.map +1 -1
  247. package/dist/transactions/resolve-write-result.js +52 -9
  248. package/dist/transactions/resolve-write-result.js.map +1 -1
  249. package/dist/transactions/write-types.d.ts +19 -1
  250. package/dist/transactions/write-types.d.ts.map +1 -1
  251. package/dist/utils/predicate-match.d.ts +7 -4
  252. package/dist/utils/predicate-match.d.ts.map +1 -1
  253. package/dist/utils/predicate-match.js +5 -5
  254. package/dist/utils/predicate-match.js.map +1 -1
  255. package/dist/withdraw/use-finalize-withdraw-request.d.ts.map +1 -1
  256. package/dist/withdraw/use-finalize-withdraw-request.js +1 -3
  257. package/dist/withdraw/use-finalize-withdraw-request.js.map +1 -1
  258. package/dist/withdraw/use-initiate-withdraw.d.ts.map +1 -1
  259. package/dist/withdraw/use-initiate-withdraw.js +1 -5
  260. package/dist/withdraw/use-initiate-withdraw.js.map +1 -1
  261. package/dist/withdraw/use-request-cancel-withdraw.d.ts.map +1 -1
  262. package/dist/withdraw/use-request-cancel-withdraw.js +1 -3
  263. package/dist/withdraw/use-request-cancel-withdraw.js.map +1 -1
  264. package/dist/withdraw/use-withdraw.d.ts.map +1 -1
  265. package/dist/withdraw/use-withdraw.js +2 -1
  266. package/dist/withdraw/use-withdraw.js.map +1 -1
  267. package/package.json +6 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instant-layer/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,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,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,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,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,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC"}
@@ -1,19 +1,26 @@
1
- import { useDelegationExpiry as e } from "./use-delegation-expiry.js";
2
- import { useGrantDelegation as t } from "./use-grant-delegation.js";
3
- import { useInstantClose as n } from "./use-instant-close.js";
4
- import { useInstantCloseAuto as r } from "./use-instant-close-auto.js";
5
- import { useInstantCloseBulk as i } from "./use-instant-close-bulk.js";
6
- import { useInstantCloseBulkAuto as a } from "./use-instant-close-bulk-auto.js";
7
- import { useInstantCloses as o } from "./use-instant-closes.js";
8
- import { useInstantOpen as s } from "./use-instant-open.js";
9
- import { useInstantOpenAuto as c } from "./use-instant-open-auto.js";
10
- import { useInstantOpenFees as l } from "./use-instant-open-fees.js";
11
- import { useInstantOpenQuoteId as u } from "./use-instant-open-quote-id.js";
12
- import { useInstantOpenWithTpSl as d } from "./use-instant-open-with-tpsl.js";
13
- import { useInstantOpens as f } from "./use-instant-opens.js";
14
- import { useInstantTradeRequiredSelectors as p } from "./use-instant-trade-required-selectors.js";
15
- import { useIsDelegationActive as m } from "./use-is-delegation-active.js";
16
- import { useLimitCloseAuto as h } from "./use-limit-close-auto.js";
17
- import { useLimitOpenAuto as g } from "./use-limit-open-auto.js";
18
- import { useSimulateGrantDelegation as _ } from "./use-simulate-grant-delegation.js";
19
- export { e as useDelegationExpiry, t as useGrantDelegation, n as useInstantClose, r as useInstantCloseAuto, i as useInstantCloseBulk, a as useInstantCloseBulkAuto, o as useInstantCloses, s as useInstantOpen, c as useInstantOpenAuto, l as useInstantOpenFees, u as useInstantOpenQuoteId, d as useInstantOpenWithTpSl, f as useInstantOpens, p as useInstantTradeRequiredSelectors, m as useIsDelegationActive, h as useLimitCloseAuto, g as useLimitOpenAuto, _ as useSimulateGrantDelegation };
1
+ import { useActiveDelegations as e } from "./use-active-delegations.js";
2
+ import { useAreDelegationsActive as t } from "./use-are-delegations-active.js";
3
+ import { useDelegationExpiry as n } from "./use-delegation-expiry.js";
4
+ import { useFinalizeRevokeDelegation as r } from "./use-finalize-revoke-delegation.js";
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 { useInstantCloses as u } from "./use-instant-closes.js";
12
+ import { useInstantOpen as d } from "./use-instant-open.js";
13
+ import { useInstantOpenAuto as f } from "./use-instant-open-auto.js";
14
+ import { useInstantOpenFees as p } from "./use-instant-open-fees.js";
15
+ import { useInstantOpenQuoteId as m } from "./use-instant-open-quote-id.js";
16
+ import { useInstantOpenWithTpSl as h } from "./use-instant-open-with-tpsl.js";
17
+ import { useInstantOpens as g } from "./use-instant-opens.js";
18
+ import { useInstantTradeRequiredSelectors as _ } from "./use-instant-trade-required-selectors.js";
19
+ import { useIsDelegationActive as v } from "./use-is-delegation-active.js";
20
+ import { useLimitCloseAuto as y } from "./use-limit-close-auto.js";
21
+ import { useLimitOpenAuto as b } from "./use-limit-open-auto.js";
22
+ import { usePendingRevocation as x } from "./use-pending-revocation.js";
23
+ import { useRevocationCooldown as S } from "./use-revocation-cooldown.js";
24
+ import { useSessionKeySelectors as C } from "./use-session-key-selectors.js";
25
+ import { useSimulateGrantDelegation as w } from "./use-simulate-grant-delegation.js";
26
+ 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 useInstantCloses, d as useInstantOpen, f as useInstantOpenAuto, p as useInstantOpenFees, m as useInstantOpenQuoteId, h as useInstantOpenWithTpSl, g as useInstantOpens, _ as useInstantTradeRequiredSelectors, v as useIsDelegationActive, y as useLimitCloseAuto, b as useLimitOpenAuto, x as usePendingRevocation, S as useRevocationCooldown, C as useSessionKeySelectors, w as useSimulateGrantDelegation };
@@ -0,0 +1,31 @@
1
+ import { ConfigParameter, GetActiveDelegationsOptions, GetActiveDelegationsReturnType } from '@symmio/trading-core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ /**
5
+ * Parameters for {@link useActiveDelegations}: the core query options
6
+ * (delegator, delegates, selectors, chain id, TanStack `query` overrides) plus
7
+ * an optional `config`.
8
+ */
9
+ export type UseActiveDelegationsParameters = GetActiveDelegationsOptions & ConfigParameter;
10
+ /** Return type of {@link useActiveDelegations}. */
11
+ export type UseActiveDelegationsReturnType = UseQueryResult<GetActiveDelegationsReturnType, SymmioRequestError>;
12
+ /**
13
+ * Read which of the probed `(delegate, selector)` pairs the Instant Layer
14
+ * currently enforces, in one call.
15
+ *
16
+ * **Prefer this over {@link useIsDelegationActive} when the delegator may be a
17
+ * virtual account.** The underlying getter canonicalizes a VA to its parent
18
+ * sub-account the way enforcement does; the single-selector read hits the raw
19
+ * mapping and reports `false` for a VA whose parent holds the grant.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * const { data } = useActiveDelegations({
24
+ * delegator: { addr: subAccount, isPartyB: false },
25
+ * delegates: [sessionKey],
26
+ * selectors: [selectorSet],
27
+ * });
28
+ * ```
29
+ */
30
+ export declare function useActiveDelegations(parameters: UseActiveDelegationsParameters): UseActiveDelegationsReturnType;
31
+ //# sourceMappingURL=use-active-delegations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-active-delegations.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-active-delegations.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG,2BAA2B,GAAG,eAAe,CAAC;AAE3F,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAAC;AAEhH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,8BAA8B,GAAG,8BAA8B,CAc/G"}
@@ -0,0 +1,23 @@
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 { getActiveDelegationsQueryOptions as n } from "@symmio/trading-core";
5
+ import { useQuery as r } from "@tanstack/react-query";
6
+ //#region src/instant-layer/use-active-delegations.ts
7
+ function i(i) {
8
+ let a = n(e(i), i);
9
+ return r({
10
+ ...a,
11
+ queryFn: async () => {
12
+ try {
13
+ return await a.queryFn();
14
+ } catch (e) {
15
+ throw t(e);
16
+ }
17
+ }
18
+ });
19
+ }
20
+ //#endregion
21
+ export { i as useActiveDelegations };
22
+
23
+ //# sourceMappingURL=use-active-delegations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-active-delegations.js","names":[],"sources":["../../src/instant-layer/use-active-delegations.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getActiveDelegationsQueryOptions,\n type ConfigParameter,\n type GetActiveDelegationsOptions,\n type GetActiveDelegationsReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useActiveDelegations}: the core query options\n * (delegator, delegates, selectors, chain id, TanStack `query` overrides) plus\n * an optional `config`.\n */\nexport type UseActiveDelegationsParameters = GetActiveDelegationsOptions & ConfigParameter;\n\n/** Return type of {@link useActiveDelegations}. */\nexport type UseActiveDelegationsReturnType = UseQueryResult<GetActiveDelegationsReturnType, SymmioRequestError>;\n\n/**\n * Read which of the probed `(delegate, selector)` pairs the Instant Layer\n * currently enforces, in one call.\n *\n * **Prefer this over {@link useIsDelegationActive} when the delegator may be a\n * virtual account.** The underlying getter canonicalizes a VA to its parent\n * sub-account the way enforcement does; the single-selector read hits the raw\n * mapping and reports `false` for a VA whose parent holds the grant.\n *\n * @example\n * ```tsx\n * const { data } = useActiveDelegations({\n * delegator: { addr: subAccount, isPartyB: false },\n * delegates: [sessionKey],\n * selectors: [selectorSet],\n * });\n * ```\n */\nexport function useActiveDelegations(parameters: UseActiveDelegationsParameters): UseActiveDelegationsReturnType {\n const config = useSymmioConfig(parameters);\n const options = getActiveDelegationsQueryOptions(config, parameters);\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseActiveDelegationsReturnType;\n}\n"],"mappings":";;;;;;AAyCA,SAAgB,EAAqB,GAA4E;CAE/G,IAAM,IAAU,EADD,EAAgB,CACkB,GAAQ,CAAU;CAEnE,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,100 @@
1
+ import { ConfigParameter, GetActiveDelegationsOptions, GetActiveDelegationsReturnType, InstantLayerAccount } from '@symmio/trading-core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ import { Address, Hex } from 'viem';
4
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
5
+ /** Parameters for {@link useAreDelegationsActive}. */
6
+ export interface UseAreDelegationsActiveParameters extends ConfigParameter {
7
+ /**
8
+ * Account the delegation is enforced under. May be a sub-account **or** a
9
+ * virtual account — the underlying read canonicalizes a VA to its parent the
10
+ * way the contract's own enforcement does.
11
+ */
12
+ account: InstantLayerAccount;
13
+ /** Delegated signer being checked, typically the session key's address. */
14
+ delegate: Address;
15
+ /**
16
+ * Selectors the key must hold. Pass the same set that was granted — normally
17
+ * the output of `useSessionKeySelectors`.
18
+ */
19
+ selectors: readonly Hex[];
20
+ /** Optional chain override; defaults to the config's chain. */
21
+ chainId?: number;
22
+ /** TanStack Query overrides for the underlying read. */
23
+ query?: GetActiveDelegationsOptions["query"];
24
+ }
25
+ /** Return type of {@link useAreDelegationsActive}. */
26
+ export interface UseAreDelegationsActiveReturnType {
27
+ /**
28
+ * `true` only when every requested selector is active for the delegate. It is
29
+ * `false` while the read is in flight and `false` for an empty `selectors`
30
+ * list — a key that holds no authority is never "ready", and reporting a
31
+ * vacuous `true` there would green-light a flow that cannot sign anything.
32
+ */
33
+ allActive: boolean;
34
+ /**
35
+ * Requested selectors the contract does **not** report as active, in the
36
+ * order and casing they were requested. Until the read resolves this is the
37
+ * full requested set, so gate on {@link UseAreDelegationsActiveReturnType.isLoading}
38
+ * before rendering it as a re-grant list.
39
+ */
40
+ missing: readonly Hex[];
41
+ /** Requested selectors the contract reports as active for the delegate. */
42
+ activeSelectors: readonly Hex[];
43
+ /**
44
+ * Earliest expiry across the matched delegations, as a Unix timestamp in
45
+ * seconds; `undefined` when nothing is active. Selectors granted in separate
46
+ * transactions expire at different times and the contract reports only the
47
+ * soonest, so render this as "usable until", never as a per-selector expiry.
48
+ */
49
+ expiryTimestamp?: bigint;
50
+ /** `true` while the underlying read is in flight. */
51
+ isLoading: boolean;
52
+ /** `true` when the underlying read failed. */
53
+ isError: boolean;
54
+ /** The read's error, if any. */
55
+ error: SymmioRequestError | null;
56
+ /** Refetch the underlying read — call it after a grant or a revocation settles. */
57
+ refetch: UseQueryResult<GetActiveDelegationsReturnType, SymmioRequestError>["refetch"];
58
+ /** The full underlying query result, for states this hook does not surface. */
59
+ query: UseQueryResult<GetActiveDelegationsReturnType, SymmioRequestError>;
60
+ }
61
+ /**
62
+ * "Is my session key ready?" — whether one delegate currently holds **all** of
63
+ * the requested selectors for an account, plus exactly which ones it is
64
+ * missing. Drive an onboarding button off it: `allActive` gates trading,
65
+ * `missing` tells the user what a re-grant would add.
66
+ *
67
+ * **It is one contract read, not one per selector.** The hook calls
68
+ * `getActiveDelegations`, which answers the whole set in a single call *and*
69
+ * canonicalizes the account the way enforcement does — a virtual account
70
+ * resolves to its parent sub-account. The per-selector `getIsDelegationActive`
71
+ * reads the raw `delegations` mapping verbatim and does not canonicalize, so a
72
+ * fan-out over it answers `false` for a VA whose key really can act. That
73
+ * correctness gap, not the request count, is why this hook exists.
74
+ *
75
+ * **A pending revocation still reads as active.** `initiateRevokeDelegation`
76
+ * only schedules the revocation; the contract keeps enforcing the delegation
77
+ * until the cooldown ETA passes (see `useRevocationCooldown`). A key inside
78
+ * that window is reported here as active, because it is.
79
+ *
80
+ * The read is skipped entirely for an empty `selectors` list — there is nothing
81
+ * to probe — unless `query.enabled` says otherwise.
82
+ *
83
+ * @param parameters - Account, delegate, requested selectors, optional chain and query overrides.
84
+ * @returns Readiness (`allActive`, `missing`, `activeSelectors`, `expiryTimestamp`) plus the read's state.
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * const selectors = useSessionKeySelectors();
89
+ * const { allActive, missing, isLoading } = useAreDelegationsActive({
90
+ * account: { addr: subAccount, isPartyB: false },
91
+ * delegate: sessionKeyAddress,
92
+ * selectors,
93
+ * });
94
+ *
95
+ * if (isLoading) return <Spinner />;
96
+ * if (!allActive) return <GrantButton missingCount={missing.length} />;
97
+ * ```
98
+ */
99
+ export declare function useAreDelegationsActive(parameters: UseAreDelegationsActiveParameters): UseAreDelegationsActiveReturnType;
100
+ //# sourceMappingURL=use-are-delegations-active.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-are-delegations-active.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-are-delegations-active.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,sDAAsD;AACtD,MAAM,WAAW,iCAAkC,SAAQ,eAAe;IACxE;;;;OAIG;IACH,OAAO,EAAE,mBAAmB,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,EAAE,SAAS,GAAG,EAAE,CAAC;IAC1B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,KAAK,CAAC,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED,sDAAsD;AACtD,MAAM,WAAW,iCAAiC;IAChD;;;;;OAKG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,EAAE,SAAS,GAAG,EAAE,CAAC;IACxB,2EAA2E;IAC3E,eAAe,EAAE,SAAS,GAAG,EAAE,CAAC;IAChC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,SAAS,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACjC,mFAAmF;IACnF,OAAO,EAAE,cAAc,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC;IACvF,+EAA+E;IAC/E,KAAK,EAAE,cAAc,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAAC;CAC3E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,iCAAiC,GAC5C,iCAAiC,CA2DnC"}
@@ -0,0 +1,60 @@
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 { getActiveDelegationsQueryOptions as n } from "@symmio/trading-core";
5
+ import { useMemo as r } from "react";
6
+ import { useQuery as i } from "@tanstack/react-query";
7
+ //#region src/instant-layer/use-are-delegations-active.ts
8
+ function a(a) {
9
+ let o = e(a), { account: s, delegate: c, selectors: l, chainId: u, query: d } = a, f = n(o, {
10
+ delegator: s,
11
+ delegates: [c],
12
+ selectors: [l],
13
+ chainId: u,
14
+ query: {
15
+ ...d,
16
+ enabled: d?.enabled ?? l.length > 0
17
+ }
18
+ }), p = i({
19
+ ...f,
20
+ queryFn: async () => {
21
+ try {
22
+ return await f.queryFn();
23
+ } catch (e) {
24
+ throw t(e);
25
+ }
26
+ }
27
+ }), { data: m, isLoading: h, isError: g, error: _, refetch: v } = p;
28
+ return r(() => {
29
+ let e = c.toLowerCase(), t = /* @__PURE__ */ new Set(), n;
30
+ for (let r of m ?? []) if (r.delegatedSigner.toLowerCase() === e) {
31
+ for (let e of r.selectors) t.add(e.toLowerCase());
32
+ n = n === void 0 || r.expiryTimestamp < n ? r.expiryTimestamp : n;
33
+ }
34
+ let r = l.filter((e) => t.has(e.toLowerCase())), i = l.filter((e) => !t.has(e.toLowerCase()));
35
+ return {
36
+ allActive: l.length > 0 && i.length === 0,
37
+ missing: i,
38
+ activeSelectors: r,
39
+ expiryTimestamp: n,
40
+ isLoading: h,
41
+ isError: g,
42
+ error: _ ?? null,
43
+ refetch: v,
44
+ query: p
45
+ };
46
+ }, [
47
+ m,
48
+ c,
49
+ l,
50
+ h,
51
+ g,
52
+ _,
53
+ v,
54
+ p
55
+ ]);
56
+ }
57
+ //#endregion
58
+ export { a as useAreDelegationsActive };
59
+
60
+ //# sourceMappingURL=use-are-delegations-active.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-are-delegations-active.js","names":[],"sources":["../../src/instant-layer/use-are-delegations-active.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getActiveDelegationsQueryOptions,\n type ConfigParameter,\n type GetActiveDelegationsOptions,\n type GetActiveDelegationsReturnType,\n type InstantLayerAccount,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport type { Address, Hex } from \"viem\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useAreDelegationsActive}. */\nexport interface UseAreDelegationsActiveParameters extends ConfigParameter {\n /**\n * Account the delegation is enforced under. May be a sub-account **or** a\n * virtual account — the underlying read canonicalizes a VA to its parent the\n * way the contract's own enforcement does.\n */\n account: InstantLayerAccount;\n /** Delegated signer being checked, typically the session key's address. */\n delegate: Address;\n /**\n * Selectors the key must hold. Pass the same set that was granted — normally\n * the output of `useSessionKeySelectors`.\n */\n selectors: readonly Hex[];\n /** Optional chain override; defaults to the config's chain. */\n chainId?: number;\n /** TanStack Query overrides for the underlying read. */\n query?: GetActiveDelegationsOptions[\"query\"];\n}\n\n/** Return type of {@link useAreDelegationsActive}. */\nexport interface UseAreDelegationsActiveReturnType {\n /**\n * `true` only when every requested selector is active for the delegate. It is\n * `false` while the read is in flight and `false` for an empty `selectors`\n * list — a key that holds no authority is never \"ready\", and reporting a\n * vacuous `true` there would green-light a flow that cannot sign anything.\n */\n allActive: boolean;\n /**\n * Requested selectors the contract does **not** report as active, in the\n * order and casing they were requested. Until the read resolves this is the\n * full requested set, so gate on {@link UseAreDelegationsActiveReturnType.isLoading}\n * before rendering it as a re-grant list.\n */\n missing: readonly Hex[];\n /** Requested selectors the contract reports as active for the delegate. */\n activeSelectors: readonly Hex[];\n /**\n * Earliest expiry across the matched delegations, as a Unix timestamp in\n * seconds; `undefined` when nothing is active. Selectors granted in separate\n * transactions expire at different times and the contract reports only the\n * soonest, so render this as \"usable until\", never as a per-selector expiry.\n */\n expiryTimestamp?: bigint;\n /** `true` while the underlying read is in flight. */\n isLoading: boolean;\n /** `true` when the underlying read failed. */\n isError: boolean;\n /** The read's error, if any. */\n error: SymmioRequestError | null;\n /** Refetch the underlying read — call it after a grant or a revocation settles. */\n refetch: UseQueryResult<GetActiveDelegationsReturnType, SymmioRequestError>[\"refetch\"];\n /** The full underlying query result, for states this hook does not surface. */\n query: UseQueryResult<GetActiveDelegationsReturnType, SymmioRequestError>;\n}\n\n/**\n * \"Is my session key ready?\" — whether one delegate currently holds **all** of\n * the requested selectors for an account, plus exactly which ones it is\n * missing. Drive an onboarding button off it: `allActive` gates trading,\n * `missing` tells the user what a re-grant would add.\n *\n * **It is one contract read, not one per selector.** The hook calls\n * `getActiveDelegations`, which answers the whole set in a single call *and*\n * canonicalizes the account the way enforcement does — a virtual account\n * resolves to its parent sub-account. The per-selector `getIsDelegationActive`\n * reads the raw `delegations` mapping verbatim and does not canonicalize, so a\n * fan-out over it answers `false` for a VA whose key really can act. That\n * correctness gap, not the request count, is why this hook exists.\n *\n * **A pending revocation still reads as active.** `initiateRevokeDelegation`\n * only schedules the revocation; the contract keeps enforcing the delegation\n * until the cooldown ETA passes (see `useRevocationCooldown`). A key inside\n * that window is reported here as active, because it is.\n *\n * The read is skipped entirely for an empty `selectors` list — there is nothing\n * to probe — unless `query.enabled` says otherwise.\n *\n * @param parameters - Account, delegate, requested selectors, optional chain and query overrides.\n * @returns Readiness (`allActive`, `missing`, `activeSelectors`, `expiryTimestamp`) plus the read's state.\n *\n * @example\n * ```tsx\n * const selectors = useSessionKeySelectors();\n * const { allActive, missing, isLoading } = useAreDelegationsActive({\n * account: { addr: subAccount, isPartyB: false },\n * delegate: sessionKeyAddress,\n * selectors,\n * });\n *\n * if (isLoading) return <Spinner />;\n * if (!allActive) return <GrantButton missingCount={missing.length} />;\n * ```\n */\nexport function useAreDelegationsActive(\n parameters: UseAreDelegationsActiveParameters,\n): UseAreDelegationsActiveReturnType {\n const config = useSymmioConfig(parameters);\n const { account, delegate, selectors, chainId, query } = parameters;\n\n const options = getActiveDelegationsQueryOptions(config, {\n delegator: account,\n delegates: [delegate],\n selectors: [selectors],\n chainId,\n query: { ...query, enabled: query?.enabled ?? selectors.length > 0 },\n });\n\n const result = useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseQueryResult<GetActiveDelegationsReturnType, SymmioRequestError>;\n\n const { data, isLoading, isError, error, refetch } = result;\n\n return useMemo<UseAreDelegationsActiveReturnType>(() => {\n /**\n * The contract echoes the delegate back per entry, so match on it rather\n * than trusting positional alignment — and compare case-insensitively,\n * because a checksummed request and a lowercase response are the same key.\n */\n const wanted = delegate.toLowerCase();\n const active = new Set<string>();\n let expiryTimestamp: bigint | undefined;\n\n for (const entry of data ?? []) {\n if (entry.delegatedSigner.toLowerCase() !== wanted) continue;\n for (const selector of entry.selectors) active.add(selector.toLowerCase());\n expiryTimestamp =\n expiryTimestamp === undefined || entry.expiryTimestamp < expiryTimestamp\n ? entry.expiryTimestamp\n : expiryTimestamp;\n }\n\n const activeSelectors = selectors.filter((selector) => active.has(selector.toLowerCase()));\n const missing = selectors.filter((selector) => !active.has(selector.toLowerCase()));\n\n return {\n allActive: selectors.length > 0 && missing.length === 0,\n missing,\n activeSelectors,\n expiryTimestamp,\n isLoading,\n isError,\n error: error ?? null,\n refetch,\n query: result,\n };\n }, [data, delegate, selectors, isLoading, isError, error, refetch, result]);\n}\n"],"mappings":";;;;;;;AAgHA,SAAgB,EACd,GACmC;CACnC,IAAM,IAAS,EAAgB,CAAU,GACnC,EAAE,YAAS,aAAU,cAAW,YAAS,aAAU,GAEnD,IAAU,EAAiC,GAAQ;EACvD,WAAW;EACX,WAAW,CAAC,CAAQ;EACpB,WAAW,CAAC,CAAS;EACrB;EACA,OAAO;GAAE,GAAG;GAAO,SAAS,GAAO,WAAW,EAAU,SAAS;EAAE;CACrE,CAAC,GAEK,IAAS,EAAS;EACtB,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC,GAEK,EAAE,SAAM,cAAW,YAAS,UAAO,eAAY;CAErD,OAAO,QAAiD;EAMtD,IAAM,IAAS,EAAS,YAAY,GAC9B,oBAAS,IAAI,IAAY,GAC3B;EAEJ,KAAK,IAAM,KAAS,KAAQ,CAAC,GACvB,MAAM,gBAAgB,YAAY,MAAM,GAC5C;QAAK,IAAM,KAAY,EAAM,WAAW,EAAO,IAAI,EAAS,YAAY,CAAC;GACzE,IACE,MAAoB,KAAA,KAAa,EAAM,kBAAkB,IACrD,EAAM,kBACN;EAJmE;EAO3E,IAAM,IAAkB,EAAU,QAAQ,MAAa,EAAO,IAAI,EAAS,YAAY,CAAC,CAAC,GACnF,IAAU,EAAU,QAAQ,MAAa,CAAC,EAAO,IAAI,EAAS,YAAY,CAAC,CAAC;EAElF,OAAO;GACL,WAAW,EAAU,SAAS,KAAK,EAAQ,WAAW;GACtD;GACA;GACA;GACA;GACA;GACA,OAAO,KAAS;GAChB;GACA,OAAO;EACT;CACF,GAAG;EAAC;EAAM;EAAU;EAAW;EAAW;EAAS;EAAO;EAAS;CAAM,CAAC;AAC5E"}
@@ -0,0 +1,32 @@
1
+ import { FinalizeRevokeDelegationParameters } 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
+ /** Parameters for {@link useFinalizeRevokeDelegation}. */
6
+ export type UseFinalizeRevokeDelegationParameters = WriteParameters;
7
+ /** Result returned by the {@link useFinalizeRevokeDelegation} mutation. */
8
+ export type FinalizeRevokeDelegationResult = WriteResult;
9
+ /** Return type of {@link useFinalizeRevokeDelegation}. */
10
+ export type UseFinalizeRevokeDelegationReturnType = UseMutationResult<FinalizeRevokeDelegationResult, SymmioRequestError, FinalizeRevokeDelegationParameters>;
11
+ /**
12
+ * Complete a scheduled Instant Layer revocation, clearing the stored grant.
13
+ *
14
+ * **Always a gas-paid wallet transaction — there is no gasless option.** The
15
+ * relay signs InstantLayer *operations*, and the contract accepts a
16
+ * self-targeted operation only as a delegation grant, so a relayed revocation
17
+ * would revert.
18
+ *
19
+ * **Permissionless once the cooldown has passed**, so a keeper or backend can
20
+ * finish a revocation the owner started. It reverts `RevocationCooldownNotOver`
21
+ * while the ETA is still in the future. Note that enforcement already stops
22
+ * honoring the delegation at the ETA, so this is the bookkeeping leg rather
23
+ * than the moment authority ends — see {@link useInitiateRevokeDelegation}.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * const { mutate } = useFinalizeRevokeDelegation();
28
+ * mutate({ account: { addr: subAccount, isPartyB: false }, delegate: sessionKey, selectors });
29
+ * ```
30
+ */
31
+ export declare function useFinalizeRevokeDelegation(parameters?: UseFinalizeRevokeDelegationParameters): UseFinalizeRevokeDelegationReturnType;
32
+ //# sourceMappingURL=use-finalize-revoke-delegation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-finalize-revoke-delegation.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-finalize-revoke-delegation.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,kCAAkC,EACxC,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,0DAA0D;AAC1D,MAAM,MAAM,qCAAqC,GAAG,eAAe,CAAC;AAEpE,2EAA2E;AAC3E,MAAM,MAAM,8BAA8B,GAAG,WAAW,CAAC;AAEzD,0DAA0D;AAC1D,MAAM,MAAM,qCAAqC,GAAG,iBAAiB,CACnE,8BAA8B,EAC9B,kBAAkB,EAClB,kCAAkC,CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,GAAE,qCAA0C,GACrD,qCAAqC,CA4CvC"}
@@ -0,0 +1,45 @@
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 { finalizeRevokeDelegationMutationOptions as a, getActiveDelegationsQueryKey as o, getDelegationExpiryQueryKey as s, getIsDelegationActiveQueryKey as c, getPendingRevocationEtasQueryKey as l } from "@symmio/trading-core";
8
+ import { useMutation as u, useQueryClient as d } from "@tanstack/react-query";
9
+ //#region src/instant-layer/use-finalize-revoke-delegation.ts
10
+ function f(f = {}) {
11
+ let p = t(f), m = e(), h = d(), g = a(p);
12
+ return u({
13
+ mutationKey: g.mutationKey,
14
+ mutationFn: async (e) => {
15
+ try {
16
+ return r(p, await g.mutationFn(e), {
17
+ chainId: e.chainId,
18
+ waitForReceipt: f.waitForReceipt,
19
+ confirmations: f.confirmations
20
+ });
21
+ } catch (e) {
22
+ throw n(e);
23
+ }
24
+ },
25
+ onSuccess: (e, t) => {
26
+ let n = p.getChainConfigKey(t.chainId ?? m), r = {
27
+ configKey: n,
28
+ account: t.account.addr,
29
+ delegate: t.delegate
30
+ };
31
+ h.invalidateQueries({ predicate: i(s, r) }), h.invalidateQueries({ predicate: i(c, r) }), h.invalidateQueries({ predicate: i(o, {
32
+ configKey: n,
33
+ delegator: t.account
34
+ }) }), h.invalidateQueries({ predicate: i(l, {
35
+ configKey: n,
36
+ delegator: t.account,
37
+ delegate: t.delegate
38
+ }) });
39
+ }
40
+ });
41
+ }
42
+ //#endregion
43
+ export { f as useFinalizeRevokeDelegation };
44
+
45
+ //# sourceMappingURL=use-finalize-revoke-delegation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-finalize-revoke-delegation.js","names":[],"sources":["../../src/instant-layer/use-finalize-revoke-delegation.ts"],"sourcesContent":["\"use client\";\n\nimport {\n finalizeRevokeDelegationMutationOptions,\n getActiveDelegationsQueryKey,\n getDelegationExpiryQueryKey,\n getIsDelegationActiveQueryKey,\n getPendingRevocationEtasQueryKey,\n type FinalizeRevokeDelegationParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/** Parameters for {@link useFinalizeRevokeDelegation}. */\nexport type UseFinalizeRevokeDelegationParameters = WriteParameters;\n\n/** Result returned by the {@link useFinalizeRevokeDelegation} mutation. */\nexport type FinalizeRevokeDelegationResult = WriteResult;\n\n/** Return type of {@link useFinalizeRevokeDelegation}. */\nexport type UseFinalizeRevokeDelegationReturnType = UseMutationResult<\n FinalizeRevokeDelegationResult,\n SymmioRequestError,\n FinalizeRevokeDelegationParameters\n>;\n\n/**\n * Complete a scheduled Instant Layer revocation, clearing the stored grant.\n *\n * **Always a gas-paid wallet transaction — there is no gasless option.** The\n * relay signs InstantLayer *operations*, and the contract accepts a\n * self-targeted operation only as a delegation grant, so a relayed revocation\n * would revert.\n *\n * **Permissionless once the cooldown has passed**, so a keeper or backend can\n * finish a revocation the owner started. It reverts `RevocationCooldownNotOver`\n * while the ETA is still in the future. Note that enforcement already stops\n * honoring the delegation at the ETA, so this is the bookkeeping leg rather\n * than the moment authority ends — see {@link useInitiateRevokeDelegation}.\n *\n * @example\n * ```tsx\n * const { mutate } = useFinalizeRevokeDelegation();\n * mutate({ account: { addr: subAccount, isPartyB: false }, delegate: sessionKey, selectors });\n * ```\n */\nexport function useFinalizeRevokeDelegation(\n parameters: UseFinalizeRevokeDelegationParameters = {},\n): UseFinalizeRevokeDelegationReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = finalizeRevokeDelegationMutationOptions(config);\n\n return useMutation<FinalizeRevokeDelegationResult, SymmioRequestError, FinalizeRevokeDelegationParameters>({\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.delegate };\n\n void queryClient.invalidateQueries({ predicate: predicateMatch(getDelegationExpiryQueryKey, delegation) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getIsDelegationActiveQueryKey, delegation) });\n /**\n * The canonicalizing read keys by `delegator`, not `account`, so it needs\n * its own predicate rather than reusing the pair above.\n */\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getActiveDelegationsQueryKey, { configKey, delegator: variables.account }),\n });\n /** Finalizing clears the schedule too, so the pending read must not go stale. */\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getPendingRevocationEtasQueryKey, {\n configKey,\n delegator: variables.account,\n delegate: variables.delegate,\n }),\n });\n },\n });\n}\n"],"mappings":";;;;;;;;;AAmDA,SAAgB,EACd,IAAoD,CAAC,GACd;CACvC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAAwC,CAAM;CAE3D,OAAO,EAAoG;EACzG,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;GAAS;GAY9F,AAVA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAU,EAAE,CAAC,GACzG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAU,EAAE,CAAC,GAK3G,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAA8B;IAAE;IAAW,WAAW,EAAU;GAAQ,CAAC,EACrG,CAAC,GAED,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAAkC;IAC1D;IACA,WAAW,EAAU;IACrB,UAAU,EAAU;GACtB,CAAC,EACH,CAAC;EACH;CACF,CAAC;AACH"}
@@ -13,8 +13,18 @@ export type GrantDelegationResult = WriteResult;
13
13
  /** Return type of {@link useGrantDelegation}. */
14
14
  export type UseGrantDelegationReturnType = UseMutationResult<GrantDelegationResult, SymmioRequestError, GrantDelegationParameters>;
15
15
  /**
16
- * Submit an Instant Layer `grantDelegation` transaction. On success, delegation
17
- * access queries for the account/delegated signer are invalidated.
16
+ * Grant Instant Layer delegation access for one delegated signer.
17
+ *
18
+ * **The transport comes from config, not from the hook.** Where the chain runs
19
+ * in gasless execution mode (or the call passes `gasless: true`), the grant is
20
+ * signed as an InstantLayer operation and relayed — the owner pays no native
21
+ * gas — and the relayer's broadcast hash comes back exactly where a
22
+ * wallet-submitted hash would, so the receipt wait and the invalidation below
23
+ * are identical either way. A `isPartyB: true` account always takes the wallet
24
+ * path; the signed-operation encoder has no PartyB form.
25
+ *
26
+ * On success the delegation reads for the account/delegated signer are
27
+ * invalidated, along with the reads a *relayed* grant additionally moves.
18
28
  *
19
29
  * @example
20
30
  * ```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,EAIL,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;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;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CAmC9G"}
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,38 +1,45 @@
1
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 { predicateMatch as r } from "../utils/predicate-match.js";
6
- import { getDelegationExpiryQueryKey as i, getIsDelegationActiveQueryKey as a, grantDelegationMutationOptions as o } from "@symmio/trading-core";
7
- import { useMutation as s, useQueryClient as c } from "@tanstack/react-query";
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";
8
10
  //#region src/instant-layer/use-grant-delegation.ts
9
- function l(l = {}) {
10
- let u = e(l), d = c(), f = o(u);
11
- return s({
12
- mutationKey: f.mutationKey,
11
+ function p(p = {}) {
12
+ let m = t(p), h = e(), g = f(), _ = u(m);
13
+ return d({
14
+ mutationKey: _.mutationKey,
13
15
  mutationFn: async (e) => {
14
16
  try {
15
- return n(u, await f.mutationFn(e), {
17
+ return r(m, await _.mutationFn(e), {
16
18
  chainId: e.chainId,
17
- waitForReceipt: l.waitForReceipt,
18
- confirmations: l.confirmations
19
+ waitForReceipt: p.waitForReceipt,
20
+ confirmations: p.confirmations
19
21
  });
20
22
  } catch (e) {
21
- throw t(e);
23
+ throw n(e);
22
24
  }
23
25
  },
24
26
  onSuccess: (e, t) => {
25
- d.invalidateQueries({ predicate: r(i, {
27
+ let n = m.getChainConfigKey(t.chainId ?? h), r = {
28
+ configKey: n,
26
29
  account: t.account.addr,
27
30
  delegate: t.delegatedSigner
28
- }) }), d.invalidateQueries({ predicate: r(a, {
29
- account: t.account.addr,
30
- delegate: t.delegatedSigner
31
- }) });
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 });
32
39
  }
33
40
  });
34
41
  }
35
42
  //#endregion
36
- export { l as useGrantDelegation };
43
+ export { p as useGrantDelegation };
37
44
 
38
45
  //# 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 getIsDelegationActiveQueryKey,\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 { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { 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 * Submit an Instant Layer `grantDelegation` transaction. On success, delegation\n * access queries for the account/delegated signer are invalidated.\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 void queryClient.invalidateQueries({\n predicate: predicateMatch(getDelegationExpiryQueryKey, {\n account: variables.account.addr,\n delegate: variables.delegatedSigner,\n }),\n });\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getIsDelegationActiveQueryKey, {\n account: variables.account.addr,\n delegate: variables.delegatedSigner,\n }),\n });\n },\n });\n}\n"],"mappings":";;;;;;;;AA0CA,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;GAO/B,AANA,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAA6B;IACrD,SAAS,EAAU,QAAQ;IAC3B,UAAU,EAAU;GACtB,CAAC,EACH,CAAC,GACD,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAA+B;IACvD,SAAS,EAAU,QAAQ;IAC3B,UAAU,EAAU;GACtB,CAAC,EACH,CAAC;EACH;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 {\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"}
@@ -0,0 +1,32 @@
1
+ import { InitiateRevokeDelegationParameters } 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
+ /** Parameters for {@link useInitiateRevokeDelegation}. */
6
+ export type UseInitiateRevokeDelegationParameters = WriteParameters;
7
+ /** Result returned by the {@link useInitiateRevokeDelegation} mutation. */
8
+ export type InitiateRevokeDelegationResult = WriteResult;
9
+ /** Return type of {@link useInitiateRevokeDelegation}. */
10
+ export type UseInitiateRevokeDelegationReturnType = UseMutationResult<InitiateRevokeDelegationResult, SymmioRequestError, InitiateRevokeDelegationParameters>;
11
+ /**
12
+ * Start revoking a session key's Instant Layer delegation.
13
+ *
14
+ * **Always a gas-paid wallet transaction — there is no gasless option.** The
15
+ * relay signs InstantLayer *operations*, and the contract accepts a
16
+ * self-targeted operation only as a delegation grant, so a relayed revocation
17
+ * would revert. Budget native gas for this call.
18
+ *
19
+ * The contract accepts it from the account owner, from the delegate itself, or
20
+ * from a `REVOKER_ROLE` holder, and it only *schedules* the revocation: the key
21
+ * keeps its authority until the cooldown ETA passes (see
22
+ * {@link useRevocationCooldown}), after which {@link useFinalizeRevokeDelegation}
23
+ * clears the stored grant.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * const { mutate } = useInitiateRevokeDelegation();
28
+ * mutate({ account: { addr: subAccount, isPartyB: false }, delegate: sessionKey, selectors });
29
+ * ```
30
+ */
31
+ export declare function useInitiateRevokeDelegation(parameters?: UseInitiateRevokeDelegationParameters): UseInitiateRevokeDelegationReturnType;
32
+ //# sourceMappingURL=use-initiate-revoke-delegation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-initiate-revoke-delegation.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-initiate-revoke-delegation.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,kCAAkC,EACxC,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,0DAA0D;AAC1D,MAAM,MAAM,qCAAqC,GAAG,eAAe,CAAC;AAEpE,2EAA2E;AAC3E,MAAM,MAAM,8BAA8B,GAAG,WAAW,CAAC;AAEzD,0DAA0D;AAC1D,MAAM,MAAM,qCAAqC,GAAG,iBAAiB,CACnE,8BAA8B,EAC9B,kBAAkB,EAClB,kCAAkC,CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,GAAE,qCAA0C,GACrD,qCAAqC,CA+CvC"}
@@ -0,0 +1,45 @@
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 { getActiveDelegationsQueryKey as a, getDelegationExpiryQueryKey as o, getIsDelegationActiveQueryKey as s, getPendingRevocationEtasQueryKey as c, initiateRevokeDelegationMutationOptions as l } from "@symmio/trading-core";
8
+ import { useMutation as u, useQueryClient as d } from "@tanstack/react-query";
9
+ //#region src/instant-layer/use-initiate-revoke-delegation.ts
10
+ function f(f = {}) {
11
+ let p = t(f), m = e(), h = d(), g = l(p);
12
+ return u({
13
+ mutationKey: g.mutationKey,
14
+ mutationFn: async (e) => {
15
+ try {
16
+ return r(p, await g.mutationFn(e), {
17
+ chainId: e.chainId,
18
+ waitForReceipt: f.waitForReceipt,
19
+ confirmations: f.confirmations
20
+ });
21
+ } catch (e) {
22
+ throw n(e);
23
+ }
24
+ },
25
+ onSuccess: (e, t) => {
26
+ let n = p.getChainConfigKey(t.chainId ?? m), r = {
27
+ configKey: n,
28
+ account: t.account.addr,
29
+ delegate: t.delegate
30
+ };
31
+ h.invalidateQueries({ predicate: i(o, r) }), h.invalidateQueries({ predicate: i(s, r) }), h.invalidateQueries({ predicate: i(a, {
32
+ configKey: n,
33
+ delegator: t.account
34
+ }) }), h.invalidateQueries({ predicate: i(c, {
35
+ configKey: n,
36
+ delegator: t.account,
37
+ delegate: t.delegate
38
+ }) });
39
+ }
40
+ });
41
+ }
42
+ //#endregion
43
+ export { f as useInitiateRevokeDelegation };
44
+
45
+ //# sourceMappingURL=use-initiate-revoke-delegation.js.map