@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
@@ -0,0 +1,27 @@
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 { getGaslessWalletCreationFeeQueryOptions as r } from "@symmio/trading-core";
6
+ import { useQuery as i } from "@tanstack/react-query";
7
+ //#region src/gasless/use-gasless-wallet-creation-fee.ts
8
+ function a(a) {
9
+ let o = t(a), s = e(), c = r(o, {
10
+ ...a,
11
+ chainId: a.chainId ?? s
12
+ });
13
+ return i({
14
+ ...c,
15
+ queryFn: async () => {
16
+ try {
17
+ return await c.queryFn();
18
+ } catch (e) {
19
+ throw n(e);
20
+ }
21
+ }
22
+ });
23
+ }
24
+ //#endregion
25
+ export { a as useGaslessWalletCreationFee };
26
+
27
+ //# sourceMappingURL=use-gasless-wallet-creation-fee.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-gasless-wallet-creation-fee.js","names":[],"sources":["../../src/gasless/use-gasless-wallet-creation-fee.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getGaslessWalletCreationFeeQueryOptions,\n type ConfigParameter,\n type GetGaslessWalletCreationFeeOptions,\n type GetGaslessWalletCreationFeeReturnType,\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 { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useGaslessWalletCreationFee}. */\nexport type UseGaslessWalletCreationFeeParameters = GetGaslessWalletCreationFeeOptions & ConfigParameter;\n\n/** Return type of {@link useGaslessWalletCreationFee}. */\nexport type UseGaslessWalletCreationFeeReturnType = UseQueryResult<\n GetGaslessWalletCreationFeeReturnType,\n SymmioRequestError\n>;\n\n/**\n * Read the one-time fee for deploying one of an owner's GaslessWallets\n * (`getWalletCreationFee(owner, walletId)` on the GaslessLayer), in collateral\n * token units. It is the configured fee while the wallet has no code, for any\n * wallet id including `0`, and `0n` once the wallet is deployed. A deposit\n * settlement deducts it from the swept balance; a relayed wallet operation\n * charges it to the payer's SYMMIO balance.\n *\n * The relay hooks invalidate it after a wallet execute or a deposit settlement,\n * since either may deploy the wallet.\n *\n * @param parameters - Owner, optional `walletId` (default `0n`), optional chain id, config and query overrides.\n * @returns The TanStack query result, with failures normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const creationFee = useGaslessWalletCreationFee({ owner, walletId: 1n });\n * const chargesFirstUse = (creationFee.data ?? 0n) > 0n;\n * ```\n */\nexport function useGaslessWalletCreationFee(\n parameters: UseGaslessWalletCreationFeeParameters,\n): UseGaslessWalletCreationFeeReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n\n const options = getGaslessWalletCreationFeeQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\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 UseGaslessWalletCreationFeeReturnType;\n}\n"],"mappings":";;;;;;;AA2CA,SAAgB,EACd,GACuC;CACvC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAE3B,IAAU,EAAwC,GAAQ;EAC9D,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,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,44 @@
1
+ import { GaslessWalletCall } from '@symmio/trading-core';
2
+ import { Hex } from 'viem';
3
+ /** Parameters for {@link useGaslessWalletExecuteSelectors}. */
4
+ export interface UseGaslessWalletExecuteSelectorsParameters {
5
+ /**
6
+ * The batch the session key must be able to run. Pass `undefined` while the
7
+ * UI cannot yet describe one — the hook then returns an empty set rather
8
+ * than a partial grant.
9
+ */
10
+ calls?: readonly GaslessWalletCall[];
11
+ }
12
+ /** Return type of {@link useGaslessWalletExecuteSelectors}: the selector set to grant. */
13
+ export type UseGaslessWalletExecuteSelectorsReturnType = readonly Hex[];
14
+ /**
15
+ * The selector set a session key must hold before it may sign a delegated
16
+ * {@link useGaslessWalletExecute} batch: the wallet-execution sentinel plus
17
+ * every inner call's own selector.
18
+ *
19
+ * This is **not** the set {@link useSessionKeySelectors} returns. That one
20
+ * covers AccountLayer and trade writes; wallet execution is checked selector by
21
+ * selector against the batch itself, so a key onboarded for trading and account
22
+ * management still holds none of the authority this needs. Grant both sets to a
23
+ * key that does both.
24
+ *
25
+ * The delegation must be granted on a **sub-account**, never on the owner EOA:
26
+ * `grantDelegation` is owner-only and the AccountLayer knows no owner for a
27
+ * bare EOA. Pass that same sub-account as the execute call's `signerAccount`.
28
+ *
29
+ * The result keeps its reference while the selector set is unchanged, even
30
+ * though the batch is typically rebuilt on every keystroke, so it is safe to
31
+ * pass straight into `useAreDelegationsActive` or a mutation's variables.
32
+ *
33
+ * @param parameters - The batch to derive the grant from.
34
+ * @returns The lowercase, de-duplicated selector set, sentinel first.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * const selectors = useGaslessWalletExecuteSelectors({ calls });
39
+ * const delegation = useAreDelegationsActive({ account, delegate: sessionKey, selectors });
40
+ * if (!delegation.isActive) await grant({ account, delegatedSigner: sessionKey, selectors, expiryTimestamp });
41
+ * ```
42
+ */
43
+ export declare function useGaslessWalletExecuteSelectors(parameters?: UseGaslessWalletExecuteSelectorsParameters): UseGaslessWalletExecuteSelectorsReturnType;
44
+ //# sourceMappingURL=use-gasless-wallet-execute-selectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-gasless-wallet-execute-selectors.d.ts","sourceRoot":"","sources":["../../src/gasless/use-gasless-wallet-execute-selectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEhG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC,+DAA+D;AAC/D,MAAM,WAAW,0CAA0C;IACzD;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CACtC;AAED,0FAA0F;AAC1F,MAAM,MAAM,0CAA0C,GAAG,SAAS,GAAG,EAAE,CAAC;AAKxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,GAAE,0CAA+C,GAC1D,0CAA0C,CAe5C"}
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { getGaslessWalletExecuteSelectors as e } from "@symmio/trading-core";
3
+ import { useRef as t } from "react";
4
+ //#region src/gasless/use-gasless-wallet-execute-selectors.ts
5
+ var n = [];
6
+ function r(r = {}) {
7
+ let { calls: i } = r, a = i === void 0 || i.length === 0 ? n : e(i), o = a.join(","), s = t({
8
+ signature: o,
9
+ value: a
10
+ });
11
+ return s.current.signature !== o && (s.current = {
12
+ signature: o,
13
+ value: a
14
+ }), s.current.value;
15
+ }
16
+ //#endregion
17
+ export { r as useGaslessWalletExecuteSelectors };
18
+
19
+ //# sourceMappingURL=use-gasless-wallet-execute-selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-gasless-wallet-execute-selectors.js","names":[],"sources":["../../src/gasless/use-gasless-wallet-execute-selectors.ts"],"sourcesContent":["\"use client\";\nimport { getGaslessWalletExecuteSelectors, type GaslessWalletCall } from \"@symmio/trading-core\";\nimport { useRef } from \"react\";\nimport type { Hex } from \"viem\";\n\n/** Parameters for {@link useGaslessWalletExecuteSelectors}. */\nexport interface UseGaslessWalletExecuteSelectorsParameters {\n /**\n * The batch the session key must be able to run. Pass `undefined` while the\n * UI cannot yet describe one — the hook then returns an empty set rather\n * than a partial grant.\n */\n calls?: readonly GaslessWalletCall[];\n}\n\n/** Return type of {@link useGaslessWalletExecuteSelectors}: the selector set to grant. */\nexport type UseGaslessWalletExecuteSelectorsReturnType = readonly Hex[];\n\n/** Shared empty result, so \"no batch yet\" keeps one stable reference. */\nconst EMPTY_SELECTORS: readonly Hex[] = [];\n\n/**\n * The selector set a session key must hold before it may sign a delegated\n * {@link useGaslessWalletExecute} batch: the wallet-execution sentinel plus\n * every inner call's own selector.\n *\n * This is **not** the set {@link useSessionKeySelectors} returns. That one\n * covers AccountLayer and trade writes; wallet execution is checked selector by\n * selector against the batch itself, so a key onboarded for trading and account\n * management still holds none of the authority this needs. Grant both sets to a\n * key that does both.\n *\n * The delegation must be granted on a **sub-account**, never on the owner EOA:\n * `grantDelegation` is owner-only and the AccountLayer knows no owner for a\n * bare EOA. Pass that same sub-account as the execute call's `signerAccount`.\n *\n * The result keeps its reference while the selector set is unchanged, even\n * though the batch is typically rebuilt on every keystroke, so it is safe to\n * pass straight into `useAreDelegationsActive` or a mutation's variables.\n *\n * @param parameters - The batch to derive the grant from.\n * @returns The lowercase, de-duplicated selector set, sentinel first.\n *\n * @example\n * ```tsx\n * const selectors = useGaslessWalletExecuteSelectors({ calls });\n * const delegation = useAreDelegationsActive({ account, delegate: sessionKey, selectors });\n * if (!delegation.isActive) await grant({ account, delegatedSigner: sessionKey, selectors, expiryTimestamp });\n * ```\n */\nexport function useGaslessWalletExecuteSelectors(\n parameters: UseGaslessWalletExecuteSelectorsParameters = {},\n): UseGaslessWalletExecuteSelectorsReturnType {\n const { calls } = parameters;\n const selectors =\n calls === undefined || calls.length === 0 ? EMPTY_SELECTORS : getGaslessWalletExecuteSelectors(calls);\n const signature = selectors.join(\",\");\n\n /**\n * Selectors are canonical lowercase `bytes4` hex, so their join is a faithful\n * identity for the set. Holding the previous array while that identity is\n * unchanged keeps a caller's query from refetching on every render.\n */\n const cache = useRef<{ signature: string; value: readonly Hex[] }>({ signature, value: selectors });\n if (cache.current.signature !== signature) cache.current = { signature, value: selectors };\n\n return cache.current.value;\n}\n"],"mappings":";;;;AAmBA,IAAM,IAAkC,CAAC;AA+BzC,SAAgB,EACd,IAAyD,CAAC,GACd;CAC5C,IAAM,EAAE,aAAU,GACZ,IACJ,MAAU,KAAA,KAAa,EAAM,WAAW,IAAI,IAAkB,EAAiC,CAAK,GAChG,IAAY,EAAU,KAAK,GAAG,GAO9B,IAAQ,EAAqD;EAAE;EAAW,OAAO;CAAU,CAAC;CAGlG,OAFI,EAAM,QAAQ,cAAc,MAAW,EAAM,UAAU;EAAE;EAAW,OAAO;CAAU,IAElF,EAAM,QAAQ;AACvB"}
@@ -0,0 +1,51 @@
1
+ import { GaslessWalletExecuteParameters, GaslessWalletExecuteReturnType } from '@symmio/trading-core';
2
+ import { UseMutationResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { GaslessRelayParameters, GaslessRelayProgress, GaslessRelayResult } from './gasless-relay-types.js';
5
+ /** Parameters for {@link useGaslessWalletExecute}. */
6
+ export type UseGaslessWalletExecuteParameters = GaslessRelayParameters;
7
+ /** Mutation variables of {@link useGaslessWalletExecute}: the core action's parameters. */
8
+ export type GaslessWalletExecuteVariables = GaslessWalletExecuteParameters;
9
+ /** What {@link useGaslessWalletExecute} resolves with. */
10
+ export type GaslessWalletExecuteResult = GaslessRelayResult<GaslessWalletExecuteReturnType>;
11
+ /** Return type of {@link useGaslessWalletExecute}. */
12
+ export type UseGaslessWalletExecuteReturnType = UseMutationResult<GaslessWalletExecuteResult, SymmioRequestError, GaslessWalletExecuteVariables> & {
13
+ /** Live relay progress — `queued` → `submitted` → `confirmed`. */
14
+ relay: GaslessRelayProgress;
15
+ };
16
+ /**
17
+ * Run **any contract call from the deterministic gasless wallet**, with no
18
+ * native gas — an atomic batch of arbitrary calls, each given either as raw
19
+ * `data` or as an `{ abi, functionName, args }` triple the SDK encodes.
20
+ *
21
+ * The wallet's own balance never pays the fee: the GaslessLayer prices the
22
+ * operation from the inner call selectors and charges the SYMMIO account,
23
+ * bounded by its operational-fee allowance. See `gaslessWalletExecute`.
24
+ *
25
+ * **Resolves when the operation has landed, not when the relayer accepts it.**
26
+ * A submit returns `202` in milliseconds while the transaction lands seconds
27
+ * later, so resolving on acceptance would resolve before the effect exists. By
28
+ * default this waits for the terminal `succeeded` and then for the receipt on
29
+ * your own client, then invalidates the reads below.
30
+ *
31
+ * Set `confirmation: "none"` to resolve on acceptance instead; you then own the
32
+ * polling and the invalidation. A non-succeeded terminal rejects with the
33
+ * record attached to the error's `responseData`.
34
+ *
35
+ * On success the wallet-operation nonce of the signer account, the wallet's
36
+ * collateral balance, the fee allowance, and the owner's deposit policy and
37
+ * wallet creation fee (a first use deploys the wallet) are invalidated.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * const relay = useGaslessWalletExecute();
42
+ * const receipt = await relay.mutateAsync({
43
+ * calls: [
44
+ * { target: usdc, abi: erc20Abi, functionName: "approve", args: [router, amount] },
45
+ * { target: router, data: routeCalldata },
46
+ * ],
47
+ * });
48
+ * ```
49
+ */
50
+ export declare function useGaslessWalletExecute(parameters?: UseGaslessWalletExecuteParameters): UseGaslessWalletExecuteReturnType;
51
+ //# sourceMappingURL=use-gasless-wallet-execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-gasless-wallet-execute.d.ts","sourceRoot":"","sources":["../../src/gasless/use-gasless-wallet-execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI9G,sDAAsD;AACtD,MAAM,MAAM,iCAAiC,GAAG,sBAAsB,CAAC;AAEvE,2FAA2F;AAC3F,MAAM,MAAM,6BAA6B,GAAG,8BAA8B,CAAC;AAE3E,0DAA0D;AAC1D,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,CAAC,8BAA8B,CAAC,CAAC;AAE5F,sDAAsD;AACtD,MAAM,MAAM,iCAAiC,GAAG,iBAAiB,CAC/D,0BAA0B,EAC1B,kBAAkB,EAClB,6BAA6B,CAC9B,GAAG;IACF,kEAAkE;IAClE,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,GAAE,iCAAsC,GACjD,iCAAiC,CA+CnC"}
@@ -0,0 +1,44 @@
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 { invalidateGaslessWalletExecuteReads as r } from "./invalidate-relay-reads.js";
6
+ import { useGaslessRelayConfirmation as i } from "./use-gasless-relay-confirmation.js";
7
+ import { gaslessWalletExecuteMutationOptions as a } from "@symmio/trading-core";
8
+ import { useMutation as o } from "@tanstack/react-query";
9
+ //#region src/gasless/use-gasless-wallet-execute.ts
10
+ function s(s = {}) {
11
+ let c = t(s), l = e(), u = i(s, c), d = a(c), f = o({
12
+ ...d,
13
+ mutationFn: async (e) => {
14
+ let t = e.chainId ?? l;
15
+ try {
16
+ let n = await u.submit(() => d.mutationFn({
17
+ ...e,
18
+ chainId: t
19
+ }));
20
+ return {
21
+ accepted: n,
22
+ confirmed: await u.confirm(n, {
23
+ chainId: t,
24
+ service: "operations",
25
+ operationType: e.operationType,
26
+ invalidate: (n) => r(n, { configKey: c.getChainConfigKey(t) }, e)
27
+ })
28
+ };
29
+ } catch (e) {
30
+ throw n(e);
31
+ }
32
+ }
33
+ }), p = f.reset;
34
+ return Object.assign(f, {
35
+ relay: u.progress,
36
+ reset: () => {
37
+ u.reset(), p();
38
+ }
39
+ });
40
+ }
41
+ //#endregion
42
+ export { s as useGaslessWalletExecute };
43
+
44
+ //# sourceMappingURL=use-gasless-wallet-execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-gasless-wallet-execute.js","names":[],"sources":["../../src/gasless/use-gasless-wallet-execute.ts"],"sourcesContent":["\"use client\";\n\nimport {\n gaslessWalletExecuteMutationOptions,\n type GaslessWalletExecuteParameters,\n type GaslessWalletExecuteReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport type { GaslessRelayParameters, GaslessRelayProgress, GaslessRelayResult } from \"./gasless-relay-types\";\nimport { invalidateGaslessWalletExecuteReads } from \"./invalidate-relay-reads\";\nimport { useGaslessRelayConfirmation } from \"./use-gasless-relay-confirmation\";\n\n/** Parameters for {@link useGaslessWalletExecute}. */\nexport type UseGaslessWalletExecuteParameters = GaslessRelayParameters;\n\n/** Mutation variables of {@link useGaslessWalletExecute}: the core action's parameters. */\nexport type GaslessWalletExecuteVariables = GaslessWalletExecuteParameters;\n\n/** What {@link useGaslessWalletExecute} resolves with. */\nexport type GaslessWalletExecuteResult = GaslessRelayResult<GaslessWalletExecuteReturnType>;\n\n/** Return type of {@link useGaslessWalletExecute}. */\nexport type UseGaslessWalletExecuteReturnType = UseMutationResult<\n GaslessWalletExecuteResult,\n SymmioRequestError,\n GaslessWalletExecuteVariables\n> & {\n /** Live relay progress — `queued` → `submitted` → `confirmed`. */\n relay: GaslessRelayProgress;\n};\n\n/**\n * Run **any contract call from the deterministic gasless wallet**, with no\n * native gas — an atomic batch of arbitrary calls, each given either as raw\n * `data` or as an `{ abi, functionName, args }` triple the SDK encodes.\n *\n * The wallet's own balance never pays the fee: the GaslessLayer prices the\n * operation from the inner call selectors and charges the SYMMIO account,\n * bounded by its operational-fee allowance. See `gaslessWalletExecute`.\n *\n * **Resolves when the operation has landed, not when the relayer accepts it.**\n * A submit returns `202` in milliseconds while the transaction lands seconds\n * later, so resolving on acceptance would resolve before the effect exists. By\n * default this waits for the terminal `succeeded` and then for the receipt on\n * your own client, then invalidates the reads below.\n *\n * Set `confirmation: \"none\"` to resolve on acceptance instead; you then own the\n * polling and the invalidation. A non-succeeded terminal rejects with the\n * record attached to the error's `responseData`.\n *\n * On success the wallet-operation nonce of the signer account, the wallet's\n * collateral balance, the fee allowance, and the owner's deposit policy and\n * wallet creation fee (a first use deploys the wallet) are invalidated.\n *\n * @example\n * ```tsx\n * const relay = useGaslessWalletExecute();\n * const receipt = await relay.mutateAsync({\n * calls: [\n * { target: usdc, abi: erc20Abi, functionName: \"approve\", args: [router, amount] },\n * { target: router, data: routeCalldata },\n * ],\n * });\n * ```\n */\nexport function useGaslessWalletExecute(\n parameters: UseGaslessWalletExecuteParameters = {},\n): UseGaslessWalletExecuteReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const confirmation = useGaslessRelayConfirmation(parameters, config);\n\n const options = gaslessWalletExecuteMutationOptions(config);\n\n const mutation = useMutation({\n ...options,\n mutationFn: async (variables: GaslessWalletExecuteVariables): Promise<GaslessWalletExecuteResult> => {\n const resolvedChainId = variables.chainId ?? chainId;\n try {\n const accepted = await confirmation.submit(() =>\n options.mutationFn({ ...variables, chainId: resolvedChainId }),\n );\n const confirmed = await confirmation.confirm(accepted, {\n chainId: resolvedChainId,\n service: \"operations\",\n operationType: variables.operationType,\n invalidate: (queryClient) =>\n invalidateGaslessWalletExecuteReads(\n queryClient,\n { configKey: config.getChainConfigKey(resolvedChainId) },\n variables,\n ),\n });\n return { accepted, confirmed };\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseMutationResult<GaslessWalletExecuteResult, SymmioRequestError, GaslessWalletExecuteVariables>;\n\n /**\n * Capture the observer's own `reset` before merging: `Object.assign` writes\n * onto `mutation` itself, so a wrapper that called `mutation.reset()` would\n * resolve to the wrapper and recurse until the stack blew.\n */\n const resetMutation = mutation.reset;\n\n return Object.assign(mutation, {\n relay: confirmation.progress,\n reset: () => {\n confirmation.reset();\n resetMutation();\n },\n });\n}\n"],"mappings":";;;;;;;;;AAqEA,SAAgB,EACd,IAAgD,CAAC,GACd;CACnC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAe,EAA4B,GAAY,CAAM,GAE7D,IAAU,EAAoC,CAAM,GAEpD,IAAW,EAAY;EAC3B,GAAG;EACH,YAAY,OAAO,MAAkF;GACnG,IAAM,IAAkB,EAAU,WAAW;GAC7C,IAAI;IACF,IAAM,IAAW,MAAM,EAAa,aAClC,EAAQ,WAAW;KAAE,GAAG;KAAW,SAAS;IAAgB,CAAC,CAC/D;IAYA,OAAO;KAAE;KAAU,WAAA,MAXK,EAAa,QAAQ,GAAU;MACrD,SAAS;MACT,SAAS;MACT,eAAe,EAAU;MACzB,aAAa,MACX,EACE,GACA,EAAE,WAAW,EAAO,kBAAkB,CAAe,EAAE,GACvD,CACF;KACJ,CAAC;IAC4B;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC,GAOK,IAAgB,EAAS;CAE/B,OAAO,OAAO,OAAO,GAAU;EAC7B,OAAO,EAAa;EACpB,aAAa;GAEX,AADA,EAAa,MAAM,GACnB,EAAc;EAChB;CACF,CAAC;AACH"}
@@ -0,0 +1,27 @@
1
+ import { ConfigParameter, GetGaslessWalletNonceOptions, GetGaslessWalletNonceReturnType } from '@symmio/trading-core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ /** Parameters for {@link useGaslessWalletNonce}. */
5
+ export type UseGaslessWalletNonceParameters = GetGaslessWalletNonceOptions & ConfigParameter;
6
+ /** Return type of {@link useGaslessWalletNonce}. */
7
+ export type UseGaslessWalletNonceReturnType = UseQueryResult<GetGaslessWalletNonceReturnType, SymmioRequestError>;
8
+ /**
9
+ * Read the GaslessLayer's wallet-operation replay nonce
10
+ * (`walletOperationNonces(owner, walletId, signerAccount)`) — the last nonce a
11
+ * GaslessWallet consumed for one signer account. Each `(walletId, account)` pair
12
+ * is its own stream, separate from InstantLayer nonces.
13
+ *
14
+ * Use it to display a wallet's state. Do not sign from a cached value:
15
+ * `useGaslessWalletExecute` reads the nonce itself immediately before signing,
16
+ * and invalidates this query once the operation lands.
17
+ *
18
+ * @param parameters - Owner, optional `walletId` (default `0n`), signer `account`, optional chain id, config and query overrides.
19
+ * @returns The TanStack query result, with failures normalized to {@link SymmioRequestError}.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * const nonce = useGaslessWalletNonce({ owner, walletId: 1n, account: subAccount });
24
+ * ```
25
+ */
26
+ export declare function useGaslessWalletNonce(parameters: UseGaslessWalletNonceParameters): UseGaslessWalletNonceReturnType;
27
+ //# sourceMappingURL=use-gasless-wallet-nonce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-gasless-wallet-nonce.d.ts","sourceRoot":"","sources":["../../src/gasless/use-gasless-wallet-nonce.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACrC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,4BAA4B,GAAG,eAAe,CAAC;AAE7F,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,+BAA+B,EAAE,kBAAkB,CAAC,CAAC;AAElH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,+BAA+B,GAAG,+BAA+B,CAmBlH"}
@@ -0,0 +1,27 @@
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 { getGaslessWalletNonceQueryOptions as r } from "@symmio/trading-core";
6
+ import { useQuery as i } from "@tanstack/react-query";
7
+ //#region src/gasless/use-gasless-wallet-nonce.ts
8
+ function a(a) {
9
+ let o = t(a), s = e(), c = r(o, {
10
+ ...a,
11
+ chainId: a.chainId ?? s
12
+ });
13
+ return i({
14
+ ...c,
15
+ queryFn: async () => {
16
+ try {
17
+ return await c.queryFn();
18
+ } catch (e) {
19
+ throw n(e);
20
+ }
21
+ }
22
+ });
23
+ }
24
+ //#endregion
25
+ export { a as useGaslessWalletNonce };
26
+
27
+ //# sourceMappingURL=use-gasless-wallet-nonce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-gasless-wallet-nonce.js","names":[],"sources":["../../src/gasless/use-gasless-wallet-nonce.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getGaslessWalletNonceQueryOptions,\n type ConfigParameter,\n type GetGaslessWalletNonceOptions,\n type GetGaslessWalletNonceReturnType,\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 { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useGaslessWalletNonce}. */\nexport type UseGaslessWalletNonceParameters = GetGaslessWalletNonceOptions & ConfigParameter;\n\n/** Return type of {@link useGaslessWalletNonce}. */\nexport type UseGaslessWalletNonceReturnType = UseQueryResult<GetGaslessWalletNonceReturnType, SymmioRequestError>;\n\n/**\n * Read the GaslessLayer's wallet-operation replay nonce\n * (`walletOperationNonces(owner, walletId, signerAccount)`) — the last nonce a\n * GaslessWallet consumed for one signer account. Each `(walletId, account)` pair\n * is its own stream, separate from InstantLayer nonces.\n *\n * Use it to display a wallet's state. Do not sign from a cached value:\n * `useGaslessWalletExecute` reads the nonce itself immediately before signing,\n * and invalidates this query once the operation lands.\n *\n * @param parameters - Owner, optional `walletId` (default `0n`), signer `account`, optional chain id, config and query overrides.\n * @returns The TanStack query result, with failures normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const nonce = useGaslessWalletNonce({ owner, walletId: 1n, account: subAccount });\n * ```\n */\nexport function useGaslessWalletNonce(parameters: UseGaslessWalletNonceParameters): UseGaslessWalletNonceReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n\n const options = getGaslessWalletNonceQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\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 UseGaslessWalletNonceReturnType;\n}\n"],"mappings":";;;;;;;AAsCA,SAAgB,EAAsB,GAA8E;CAClH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAE3B,IAAU,EAAkC,GAAQ;EACxD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,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,23 @@
1
+ import { ConfigParameter, GetOperationalFeeAllowanceOptions, GetOperationalFeeAllowanceReturnType } from '@symmio/trading-core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ /** Parameters for {@link useOperationalFeeAllowance}. */
5
+ export type UseOperationalFeeAllowanceParameters = GetOperationalFeeAllowanceOptions & ConfigParameter;
6
+ /** Return type of {@link useOperationalFeeAllowance}. */
7
+ export type UseOperationalFeeAllowanceReturnType = UseQueryResult<GetOperationalFeeAllowanceReturnType, SymmioRequestError>;
8
+ /**
9
+ * Read a payer's operational-fee allowance for the gasless charger from the
10
+ * SYMMIO core diamond. Allowance reductions can be delayed on-chain - surface
11
+ * `pendingAllowance` and `reductionReadyAt` in any revoke UX.
12
+ *
13
+ * The amounts are **18-decimal Core units**, like the Core balance the fee is
14
+ * drawn from. The allowance only caps the charge and adds no balance, so show
15
+ * it next to the payer's Core balance, never as spendable funds.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * const query = useOperationalFeeAllowance({ payer });
20
+ * ```
21
+ */
22
+ export declare function useOperationalFeeAllowance(parameters: UseOperationalFeeAllowanceParameters): UseOperationalFeeAllowanceReturnType;
23
+ //# sourceMappingURL=use-operational-fee-allowance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-operational-fee-allowance.d.ts","sourceRoot":"","sources":["../../src/gasless/use-operational-fee-allowance.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EAC1C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,yDAAyD;AACzD,MAAM,MAAM,oCAAoC,GAAG,iCAAiC,GAAG,eAAe,CAAC;AAEvG,yDAAyD;AACzD,MAAM,MAAM,oCAAoC,GAAG,cAAc,CAC/D,oCAAoC,EACpC,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,oCAAoC,GAC/C,oCAAoC,CAmBtC"}
@@ -0,0 +1,27 @@
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 { getOperationalFeeAllowanceQueryOptions as r } from "@symmio/trading-core";
6
+ import { useQuery as i } from "@tanstack/react-query";
7
+ //#region src/gasless/use-operational-fee-allowance.ts
8
+ function a(a) {
9
+ let o = t(a), s = e(), c = r(o, {
10
+ ...a,
11
+ chainId: a.chainId ?? s
12
+ });
13
+ return i({
14
+ ...c,
15
+ queryFn: async () => {
16
+ try {
17
+ return await c.queryFn();
18
+ } catch (e) {
19
+ throw n(e);
20
+ }
21
+ }
22
+ });
23
+ }
24
+ //#endregion
25
+ export { a as useOperationalFeeAllowance };
26
+
27
+ //# sourceMappingURL=use-operational-fee-allowance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-operational-fee-allowance.js","names":[],"sources":["../../src/gasless/use-operational-fee-allowance.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getOperationalFeeAllowanceQueryOptions,\n type ConfigParameter,\n type GetOperationalFeeAllowanceOptions,\n type GetOperationalFeeAllowanceReturnType,\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 { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useOperationalFeeAllowance}. */\nexport type UseOperationalFeeAllowanceParameters = GetOperationalFeeAllowanceOptions & ConfigParameter;\n\n/** Return type of {@link useOperationalFeeAllowance}. */\nexport type UseOperationalFeeAllowanceReturnType = UseQueryResult<\n GetOperationalFeeAllowanceReturnType,\n SymmioRequestError\n>;\n\n/**\n * Read a payer's operational-fee allowance for the gasless charger from the\n * SYMMIO core diamond. Allowance reductions can be delayed on-chain - surface\n * `pendingAllowance` and `reductionReadyAt` in any revoke UX.\n *\n * The amounts are **18-decimal Core units**, like the Core balance the fee is\n * drawn from. The allowance only caps the charge and adds no balance, so show\n * it next to the payer's Core balance, never as spendable funds.\n *\n * @example\n * ```tsx\n * const query = useOperationalFeeAllowance({ payer });\n * ```\n */\nexport function useOperationalFeeAllowance(\n parameters: UseOperationalFeeAllowanceParameters,\n): UseOperationalFeeAllowanceReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n\n const options = getOperationalFeeAllowanceQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\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 UseOperationalFeeAllowanceReturnType;\n}\n"],"mappings":";;;;;;;AAqCA,SAAgB,EACd,GACsC;CACtC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAE3B,IAAU,EAAuC,GAAQ;EAC7D,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,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,48 @@
1
+ import { RelayGaslessBatchParameters, RelayGaslessBatchReturnType } from '@symmio/trading-core';
2
+ import { UseMutationResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { GaslessRelayParameters, GaslessRelayProgress, GaslessRelayResult } from './gasless-relay-types.js';
5
+ /** Parameters for {@link useRelayGaslessBatch}. */
6
+ export type UseRelayGaslessBatchParameters = GaslessRelayParameters;
7
+ /** Mutation variables of {@link useRelayGaslessBatch}: the core action's parameters. */
8
+ export type RelayGaslessBatchVariables = RelayGaslessBatchParameters;
9
+ /** What {@link useRelayGaslessBatch} resolves with. */
10
+ export type RelayGaslessBatchResult = GaslessRelayResult<RelayGaslessBatchReturnType>;
11
+ /** Return type of {@link useRelayGaslessBatch}. */
12
+ export type UseRelayGaslessBatchReturnType = UseMutationResult<RelayGaslessBatchResult, SymmioRequestError, RelayGaslessBatchVariables> & {
13
+ /** Live relay progress — `queued` → `submitted` → `confirmed`. */
14
+ relay: GaslessRelayProgress;
15
+ };
16
+ /**
17
+ * Relay **several gasless actions as one request** — one atomic transaction,
18
+ * no native gas. Give relayable writes as `{ functionName, args }` (optional
19
+ * `abi`) or raw `{ data }`, and GaslessWallet calls as `{ walletCalls, walletId }`;
20
+ * see `relayGaslessBatch`.
21
+ *
22
+ * Every call is signed separately — the protocol has no batch signature — so
23
+ * a browser wallet shows one prompt per call, in order, while a session key
24
+ * (`from`) signs them silently. Nothing is submitted until every prompt is
25
+ * signed. Preview the same batch with {@link useGaslessBatchFeeQuote}.
26
+ *
27
+ * **Resolves when the batch has landed, not when the relayer accepts it.** By
28
+ * default this waits for the terminal `succeeded` and then for the receipt on
29
+ * your own client, then invalidates what the batch's calls changed — the
30
+ * account's nonce, balances and fee allowance always, plus the withdrawal,
31
+ * quote, sub-account, deposit, delegation and GaslessWallet reads of the calls
32
+ * it actually carried. Set `confirmation: "none"` to resolve on acceptance and
33
+ * own the polling and invalidation yourself.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * const batch = useRelayGaslessBatch();
38
+ * await batch.mutateAsync({
39
+ * account: subAccount,
40
+ * calls: [
41
+ * { functionName: "approveOperationalFeeWithMultiplier", args: [[gaslessLayer], [budget18], [10_000n]] },
42
+ * { functionName: "allocate", args: [amount] },
43
+ * ],
44
+ * });
45
+ * ```
46
+ */
47
+ export declare function useRelayGaslessBatch(parameters?: UseRelayGaslessBatchParameters): UseRelayGaslessBatchReturnType;
48
+ //# sourceMappingURL=use-relay-gasless-batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-relay-gasless-batch.d.ts","sourceRoot":"","sources":["../../src/gasless/use-relay-gasless-batch.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI9G,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,sBAAsB,CAAC;AAEpE,wFAAwF;AACxF,MAAM,MAAM,0BAA0B,GAAG,2BAA2B,CAAC;AAErE,uDAAuD;AACvD,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,CAAC,2BAA2B,CAAC,CAAC;AAEtF,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,iBAAiB,CAC5D,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,CAC3B,GAAG;IACF,kEAAkE;IAClE,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,GAAE,8BAAmC,GAAG,8BAA8B,CA+CpH"}
@@ -0,0 +1,44 @@
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 { invalidateGaslessBatchReads as r } from "./invalidate-relay-reads.js";
6
+ import { useGaslessRelayConfirmation as i } from "./use-gasless-relay-confirmation.js";
7
+ import { relayGaslessBatchMutationOptions as a } from "@symmio/trading-core";
8
+ import { useMutation as o } from "@tanstack/react-query";
9
+ //#region src/gasless/use-relay-gasless-batch.ts
10
+ function s(s = {}) {
11
+ let c = t(s), l = e(), u = i(s, c), d = a(c), f = o({
12
+ ...d,
13
+ mutationFn: async (e) => {
14
+ let t = e.chainId ?? l;
15
+ try {
16
+ let n = await u.submit(() => d.mutationFn({
17
+ ...e,
18
+ chainId: t
19
+ }));
20
+ return {
21
+ accepted: n,
22
+ confirmed: await u.confirm(n, {
23
+ chainId: t,
24
+ service: "operations",
25
+ operationType: e.operationType,
26
+ invalidate: (n) => r(n, { configKey: c.getChainConfigKey(t) }, e)
27
+ })
28
+ };
29
+ } catch (e) {
30
+ throw n(e);
31
+ }
32
+ }
33
+ }), p = f.reset;
34
+ return Object.assign(f, {
35
+ relay: u.progress,
36
+ reset: () => {
37
+ u.reset(), p();
38
+ }
39
+ });
40
+ }
41
+ //#endregion
42
+ export { s as useRelayGaslessBatch };
43
+
44
+ //# sourceMappingURL=use-relay-gasless-batch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-relay-gasless-batch.js","names":[],"sources":["../../src/gasless/use-relay-gasless-batch.ts"],"sourcesContent":["\"use client\";\n\nimport {\n relayGaslessBatchMutationOptions,\n type RelayGaslessBatchParameters,\n type RelayGaslessBatchReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport type { GaslessRelayParameters, GaslessRelayProgress, GaslessRelayResult } from \"./gasless-relay-types\";\nimport { invalidateGaslessBatchReads } from \"./invalidate-relay-reads\";\nimport { useGaslessRelayConfirmation } from \"./use-gasless-relay-confirmation\";\n\n/** Parameters for {@link useRelayGaslessBatch}. */\nexport type UseRelayGaslessBatchParameters = GaslessRelayParameters;\n\n/** Mutation variables of {@link useRelayGaslessBatch}: the core action's parameters. */\nexport type RelayGaslessBatchVariables = RelayGaslessBatchParameters;\n\n/** What {@link useRelayGaslessBatch} resolves with. */\nexport type RelayGaslessBatchResult = GaslessRelayResult<RelayGaslessBatchReturnType>;\n\n/** Return type of {@link useRelayGaslessBatch}. */\nexport type UseRelayGaslessBatchReturnType = UseMutationResult<\n RelayGaslessBatchResult,\n SymmioRequestError,\n RelayGaslessBatchVariables\n> & {\n /** Live relay progress — `queued` → `submitted` → `confirmed`. */\n relay: GaslessRelayProgress;\n};\n\n/**\n * Relay **several gasless actions as one request** — one atomic transaction,\n * no native gas. Give relayable writes as `{ functionName, args }` (optional\n * `abi`) or raw `{ data }`, and GaslessWallet calls as `{ walletCalls, walletId }`;\n * see `relayGaslessBatch`.\n *\n * Every call is signed separately — the protocol has no batch signature — so\n * a browser wallet shows one prompt per call, in order, while a session key\n * (`from`) signs them silently. Nothing is submitted until every prompt is\n * signed. Preview the same batch with {@link useGaslessBatchFeeQuote}.\n *\n * **Resolves when the batch has landed, not when the relayer accepts it.** By\n * default this waits for the terminal `succeeded` and then for the receipt on\n * your own client, then invalidates what the batch's calls changed — the\n * account's nonce, balances and fee allowance always, plus the withdrawal,\n * quote, sub-account, deposit, delegation and GaslessWallet reads of the calls\n * it actually carried. Set `confirmation: \"none\"` to resolve on acceptance and\n * own the polling and invalidation yourself.\n *\n * @example\n * ```tsx\n * const batch = useRelayGaslessBatch();\n * await batch.mutateAsync({\n * account: subAccount,\n * calls: [\n * { functionName: \"approveOperationalFeeWithMultiplier\", args: [[gaslessLayer], [budget18], [10_000n]] },\n * { functionName: \"allocate\", args: [amount] },\n * ],\n * });\n * ```\n */\nexport function useRelayGaslessBatch(parameters: UseRelayGaslessBatchParameters = {}): UseRelayGaslessBatchReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const confirmation = useGaslessRelayConfirmation(parameters, config);\n\n const options = relayGaslessBatchMutationOptions(config);\n\n const mutation = useMutation({\n ...options,\n mutationFn: async (variables: RelayGaslessBatchVariables): Promise<RelayGaslessBatchResult> => {\n const resolvedChainId = variables.chainId ?? chainId;\n try {\n const accepted = await confirmation.submit(() =>\n options.mutationFn({ ...variables, chainId: resolvedChainId }),\n );\n const confirmed = await confirmation.confirm(accepted, {\n chainId: resolvedChainId,\n service: \"operations\",\n operationType: variables.operationType,\n invalidate: (queryClient) =>\n invalidateGaslessBatchReads(\n queryClient,\n { configKey: config.getChainConfigKey(resolvedChainId) },\n variables,\n ),\n });\n return { accepted, confirmed };\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseMutationResult<RelayGaslessBatchResult, SymmioRequestError, RelayGaslessBatchVariables>;\n\n /**\n * Capture the observer's own `reset` before merging: `Object.assign` writes\n * onto `mutation` itself, so a wrapper that called `mutation.reset()` would\n * resolve to the wrapper and recurse until the stack blew.\n */\n const resetMutation = mutation.reset;\n\n return Object.assign(mutation, {\n relay: confirmation.progress,\n reset: () => {\n confirmation.reset();\n resetMutation();\n },\n });\n}\n"],"mappings":";;;;;;;;;AAkEA,SAAgB,EAAqB,IAA6C,CAAC,GAAmC;CACpH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAe,EAA4B,GAAY,CAAM,GAE7D,IAAU,EAAiC,CAAM,GAEjD,IAAW,EAAY;EAC3B,GAAG;EACH,YAAY,OAAO,MAA4E;GAC7F,IAAM,IAAkB,EAAU,WAAW;GAC7C,IAAI;IACF,IAAM,IAAW,MAAM,EAAa,aAClC,EAAQ,WAAW;KAAE,GAAG;KAAW,SAAS;IAAgB,CAAC,CAC/D;IAYA,OAAO;KAAE;KAAU,WAAA,MAXK,EAAa,QAAQ,GAAU;MACrD,SAAS;MACT,SAAS;MACT,eAAe,EAAU;MACzB,aAAa,MACX,EACE,GACA,EAAE,WAAW,EAAO,kBAAkB,CAAe,EAAE,GACvD,CACF;KACJ,CAAC;IAC4B;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC,GAOK,IAAgB,EAAS;CAE/B,OAAO,OAAO,OAAO,GAAU;EAC7B,OAAO,EAAa;EACpB,aAAa;GAEX,AADA,EAAa,MAAM,GACnB,EAAc;EAChB;CACF,CAAC;AACH"}
@@ -0,0 +1,43 @@
1
+ import { RelayInstantOperationsParameters, RelayInstantOperationsReturnType } from '@symmio/trading-core';
2
+ import { UseMutationResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ import { GaslessRelayParameters, GaslessRelayProgress, GaslessRelayResult } from './gasless-relay-types.js';
5
+ /** Parameters for {@link useRelayInstantOperations}. */
6
+ export type UseRelayInstantOperationsParameters = GaslessRelayParameters;
7
+ /** Mutation variables of {@link useRelayInstantOperations}: the core action's parameters. */
8
+ export type RelayInstantOperationsVariables = RelayInstantOperationsParameters;
9
+ /** What {@link useRelayInstantOperations} resolves with. */
10
+ export type RelayInstantOperationsResult = GaslessRelayResult<RelayInstantOperationsReturnType>;
11
+ /** Return type of {@link useRelayInstantOperations}. */
12
+ export type UseRelayInstantOperationsReturnType = UseMutationResult<RelayInstantOperationsResult, SymmioRequestError, RelayInstantOperationsVariables> & {
13
+ /** Live relay progress — `queued` → `submitted` → `confirmed`. */
14
+ relay: GaslessRelayProgress;
15
+ };
16
+ /**
17
+ * Submit pre-signed InstantLayer operations to the GaslessQ relayer - the
18
+ * explicit escape hatch under the transparent gasless execution mode.
19
+ *
20
+ * **Resolves when the operation has landed, not when the relayer accepts it.**
21
+ * A submit returns `202` in milliseconds while the transaction lands seconds
22
+ * later, so resolving on acceptance would resolve before the effect exists. By
23
+ * default this waits for the terminal `succeeded` and then for the receipt on
24
+ * your own client, then invalidates the reads below.
25
+ *
26
+ * Set `confirmation: "none"` to resolve on acceptance instead; you then own the
27
+ * polling and the invalidation. A non-succeeded terminal rejects with the
28
+ * record attached to the error's `responseData`.
29
+ *
30
+ * Only transport-level reads are invalidated — the InstantLayer nonce, the
31
+ * operational-fee allowance and account balances. `operationType` is a
32
+ * free-form label the fee policy ignores, so the SDK cannot know which domain
33
+ * reads a batch touched and must not guess: pass your own `onSuccess` to
34
+ * `mutate`, which now runs after confirmation.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * const relay = useRelayInstantOperations();
39
+ * const receipt = await relay.mutateAsync({ userAddress, operationType, operations });
40
+ * ```
41
+ */
42
+ export declare function useRelayInstantOperations(parameters?: UseRelayInstantOperationsParameters): UseRelayInstantOperationsReturnType;
43
+ //# sourceMappingURL=use-relay-instant-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-relay-instant-operations.d.ts","sourceRoot":"","sources":["../../src/gasless/use-relay-instant-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,EACtC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI9G,wDAAwD;AACxD,MAAM,MAAM,mCAAmC,GAAG,sBAAsB,CAAC;AAEzE,6FAA6F;AAC7F,MAAM,MAAM,+BAA+B,GAAG,gCAAgC,CAAC;AAE/E,4DAA4D;AAC5D,MAAM,MAAM,4BAA4B,GAAG,kBAAkB,CAAC,gCAAgC,CAAC,CAAC;AAEhG,wDAAwD;AACxD,MAAM,MAAM,mCAAmC,GAAG,iBAAiB,CACjE,4BAA4B,EAC5B,kBAAkB,EAClB,+BAA+B,CAChC,GAAG;IACF,kEAAkE;IAClE,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,GAAE,mCAAwC,GACnD,mCAAmC,CA+CrC"}
@@ -0,0 +1,44 @@
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 { invalidateRelayInstantOperationsReads as r } from "./invalidate-relay-reads.js";
6
+ import { useGaslessRelayConfirmation as i } from "./use-gasless-relay-confirmation.js";
7
+ import { relayInstantOperationsMutationOptions as a } from "@symmio/trading-core";
8
+ import { useMutation as o } from "@tanstack/react-query";
9
+ //#region src/gasless/use-relay-instant-operations.ts
10
+ function s(s = {}) {
11
+ let c = t(s), l = e(), u = i(s, c), d = a(c), f = o({
12
+ ...d,
13
+ mutationFn: async (e) => {
14
+ let t = e.chainId ?? l;
15
+ try {
16
+ let n = await u.submit(() => d.mutationFn({
17
+ ...e,
18
+ chainId: t
19
+ }));
20
+ return {
21
+ accepted: n,
22
+ confirmed: await u.confirm(n, {
23
+ chainId: t,
24
+ service: "operations",
25
+ operationType: e.operationType,
26
+ invalidate: (n) => r(n, { configKey: c.getChainConfigKey(t) }, e.operations.map((e) => e.operation.signerAccount.addr))
27
+ })
28
+ };
29
+ } catch (e) {
30
+ throw n(e);
31
+ }
32
+ }
33
+ }), p = f.reset;
34
+ return Object.assign(f, {
35
+ relay: u.progress,
36
+ reset: () => {
37
+ u.reset(), p();
38
+ }
39
+ });
40
+ }
41
+ //#endregion
42
+ export { s as useRelayInstantOperations };
43
+
44
+ //# sourceMappingURL=use-relay-instant-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-relay-instant-operations.js","names":[],"sources":["../../src/gasless/use-relay-instant-operations.ts"],"sourcesContent":["\"use client\";\n\nimport {\n relayInstantOperationsMutationOptions,\n type RelayInstantOperationsParameters,\n type RelayInstantOperationsReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport type { GaslessRelayParameters, GaslessRelayProgress, GaslessRelayResult } from \"./gasless-relay-types\";\nimport { invalidateRelayInstantOperationsReads } from \"./invalidate-relay-reads\";\nimport { useGaslessRelayConfirmation } from \"./use-gasless-relay-confirmation\";\n\n/** Parameters for {@link useRelayInstantOperations}. */\nexport type UseRelayInstantOperationsParameters = GaslessRelayParameters;\n\n/** Mutation variables of {@link useRelayInstantOperations}: the core action's parameters. */\nexport type RelayInstantOperationsVariables = RelayInstantOperationsParameters;\n\n/** What {@link useRelayInstantOperations} resolves with. */\nexport type RelayInstantOperationsResult = GaslessRelayResult<RelayInstantOperationsReturnType>;\n\n/** Return type of {@link useRelayInstantOperations}. */\nexport type UseRelayInstantOperationsReturnType = UseMutationResult<\n RelayInstantOperationsResult,\n SymmioRequestError,\n RelayInstantOperationsVariables\n> & {\n /** Live relay progress — `queued` → `submitted` → `confirmed`. */\n relay: GaslessRelayProgress;\n};\n\n/**\n * Submit pre-signed InstantLayer operations to the GaslessQ relayer - the\n * explicit escape hatch under the transparent gasless execution mode.\n *\n * **Resolves when the operation has landed, not when the relayer accepts it.**\n * A submit returns `202` in milliseconds while the transaction lands seconds\n * later, so resolving on acceptance would resolve before the effect exists. By\n * default this waits for the terminal `succeeded` and then for the receipt on\n * your own client, then invalidates the reads below.\n *\n * Set `confirmation: \"none\"` to resolve on acceptance instead; you then own the\n * polling and the invalidation. A non-succeeded terminal rejects with the\n * record attached to the error's `responseData`.\n *\n * Only transport-level reads are invalidated — the InstantLayer nonce, the\n * operational-fee allowance and account balances. `operationType` is a\n * free-form label the fee policy ignores, so the SDK cannot know which domain\n * reads a batch touched and must not guess: pass your own `onSuccess` to\n * `mutate`, which now runs after confirmation.\n *\n * @example\n * ```tsx\n * const relay = useRelayInstantOperations();\n * const receipt = await relay.mutateAsync({ userAddress, operationType, operations });\n * ```\n */\nexport function useRelayInstantOperations(\n parameters: UseRelayInstantOperationsParameters = {},\n): UseRelayInstantOperationsReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const confirmation = useGaslessRelayConfirmation(parameters, config);\n\n const options = relayInstantOperationsMutationOptions(config);\n\n const mutation = useMutation({\n ...options,\n mutationFn: async (variables: RelayInstantOperationsVariables): Promise<RelayInstantOperationsResult> => {\n const resolvedChainId = variables.chainId ?? chainId;\n try {\n const accepted = await confirmation.submit(() =>\n options.mutationFn({ ...variables, chainId: resolvedChainId }),\n );\n const confirmed = await confirmation.confirm(accepted, {\n chainId: resolvedChainId,\n service: \"operations\",\n operationType: variables.operationType,\n invalidate: (queryClient) =>\n invalidateRelayInstantOperationsReads(\n queryClient,\n { configKey: config.getChainConfigKey(resolvedChainId) },\n variables.operations.map((entry) => entry.operation.signerAccount.addr),\n ),\n });\n return { accepted, confirmed };\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseMutationResult<RelayInstantOperationsResult, SymmioRequestError, RelayInstantOperationsVariables>;\n\n /**\n * Capture the observer's own `reset` before merging: `Object.assign` writes\n * onto `mutation` itself, so a wrapper that called `mutation.reset()` would\n * resolve to the wrapper and recurse until the stack blew.\n */\n const resetMutation = mutation.reset;\n\n return Object.assign(mutation, {\n relay: confirmation.progress,\n reset: () => {\n confirmation.reset();\n resetMutation();\n },\n });\n}\n"],"mappings":";;;;;;;;;AA6DA,SAAgB,EACd,IAAkD,CAAC,GACd;CACrC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAe,EAA4B,GAAY,CAAM,GAE7D,IAAU,EAAsC,CAAM,GAEtD,IAAW,EAAY;EAC3B,GAAG;EACH,YAAY,OAAO,MAAsF;GACvG,IAAM,IAAkB,EAAU,WAAW;GAC7C,IAAI;IACF,IAAM,IAAW,MAAM,EAAa,aAClC,EAAQ,WAAW;KAAE,GAAG;KAAW,SAAS;IAAgB,CAAC,CAC/D;IAYA,OAAO;KAAE;KAAU,WAAA,MAXK,EAAa,QAAQ,GAAU;MACrD,SAAS;MACT,SAAS;MACT,eAAe,EAAU;MACzB,aAAa,MACX,EACE,GACA,EAAE,WAAW,EAAO,kBAAkB,CAAe,EAAE,GACvD,EAAU,WAAW,KAAK,MAAU,EAAM,UAAU,cAAc,IAAI,CACxE;KACJ,CAAC;IAC4B;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC,GAOK,IAAgB,EAAS;CAE/B,OAAO,OAAO,OAAO,GAAU;EAC7B,OAAO,EAAa;EACpB,aAAa;GAEX,AADA,EAAa,MAAM,GACnB,EAAc;EAChB;CACF,CAAC;AACH"}