@symmio/trading-core 4.3.0 → 4.4.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 (576) hide show
  1. package/dist/core/chains/registry.d.ts.map +1 -1
  2. package/dist/core/chains/registry.js +4 -5
  3. package/dist/core/chains/registry.js.map +1 -1
  4. package/dist/core/chains/types.d.ts +36 -1
  5. package/dist/core/chains/types.d.ts.map +1 -1
  6. package/dist/core/chains/types.js.map +1 -1
  7. package/dist/core/config/merge-chain-config.js +6 -3
  8. package/dist/core/config/merge-chain-config.js.map +1 -1
  9. package/dist/gasless/batch/calls.d.ts +21 -7
  10. package/dist/gasless/batch/calls.d.ts.map +1 -1
  11. package/dist/gasless/batch/calls.js +17 -16
  12. package/dist/gasless/batch/calls.js.map +1 -1
  13. package/dist/gasless/batch/resolve-gasless-batch.d.ts +10 -1
  14. package/dist/gasless/batch/resolve-gasless-batch.d.ts.map +1 -1
  15. package/dist/gasless/batch/resolve-gasless-batch.js +17 -15
  16. package/dist/gasless/batch/resolve-gasless-batch.js.map +1 -1
  17. package/dist/gasless/classify-gasless-failure.d.ts +3 -1
  18. package/dist/gasless/classify-gasless-failure.d.ts.map +1 -1
  19. package/dist/gasless/classify-gasless-failure.js +10 -10
  20. package/dist/gasless/classify-gasless-failure.js.map +1 -1
  21. package/dist/gasless/confirm-gasless-request/confirm-gasless-request.js +5 -5
  22. package/dist/gasless/constants.d.ts +21 -0
  23. package/dist/gasless/constants.d.ts.map +1 -1
  24. package/dist/gasless/constants.js +2 -2
  25. package/dist/gasless/constants.js.map +1 -1
  26. package/dist/gasless/delegation-preflight.js +10 -10
  27. package/dist/gasless/deployment-key.d.ts +39 -0
  28. package/dist/gasless/deployment-key.d.ts.map +1 -0
  29. package/dist/gasless/deployment-key.js +22 -0
  30. package/dist/gasless/deployment-key.js.map +1 -0
  31. package/dist/gasless/dispatch/attempt-start.d.ts +31 -0
  32. package/dist/gasless/dispatch/attempt-start.d.ts.map +1 -0
  33. package/dist/gasless/dispatch/attempt-start.js +14 -0
  34. package/dist/gasless/dispatch/attempt-start.js.map +1 -0
  35. package/dist/gasless/dispatch/maybe-relay-as-gasless.d.ts +4 -43
  36. package/dist/gasless/dispatch/maybe-relay-as-gasless.d.ts.map +1 -1
  37. package/dist/gasless/dispatch/maybe-relay-as-gasless.js +24 -182
  38. package/dist/gasless/dispatch/maybe-relay-as-gasless.js.map +1 -1
  39. package/dist/gasless/dispatch/resolve-gasless-write.d.ts +40 -0
  40. package/dist/gasless/dispatch/resolve-gasless-write.d.ts.map +1 -0
  41. package/dist/gasless/dispatch/resolve-gasless-write.js +48 -0
  42. package/dist/gasless/dispatch/resolve-gasless-write.js.map +1 -0
  43. package/dist/gasless/dispatch/submit-gasless-write.d.ts +11 -0
  44. package/dist/gasless/dispatch/submit-gasless-write.d.ts.map +1 -0
  45. package/dist/gasless/dispatch/submit-gasless-write.js +180 -0
  46. package/dist/gasless/dispatch/submit-gasless-write.js.map +1 -0
  47. package/dist/gasless/dispatch/types.d.ts +42 -0
  48. package/dist/gasless/dispatch/types.d.ts.map +1 -0
  49. package/dist/gasless/effective-instant-selectors.d.ts +11 -0
  50. package/dist/gasless/effective-instant-selectors.d.ts.map +1 -0
  51. package/dist/gasless/effective-instant-selectors.js +25 -0
  52. package/dist/gasless/effective-instant-selectors.js.map +1 -0
  53. package/dist/gasless/fallback.d.ts +43 -0
  54. package/dist/gasless/fallback.d.ts.map +1 -1
  55. package/dist/gasless/fallback.js +27 -17
  56. package/dist/gasless/fallback.js.map +1 -1
  57. package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.d.ts +13 -5
  58. package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.d.ts.map +1 -1
  59. package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.js +88 -81
  60. package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.js.map +1 -1
  61. package/dist/gasless/get-session-key-selectors.d.ts +18 -4
  62. package/dist/gasless/get-session-key-selectors.d.ts.map +1 -1
  63. package/dist/gasless/get-session-key-selectors.js +20 -12
  64. package/dist/gasless/get-session-key-selectors.js.map +1 -1
  65. package/dist/gasless/http.d.ts +7 -7
  66. package/dist/gasless/http.d.ts.map +1 -1
  67. package/dist/gasless/http.js +70 -72
  68. package/dist/gasless/http.js.map +1 -1
  69. package/dist/gasless/idempotency-key.d.ts +33 -0
  70. package/dist/gasless/idempotency-key.d.ts.map +1 -0
  71. package/dist/gasless/idempotency-key.js +15 -0
  72. package/dist/gasless/idempotency-key.js.map +1 -0
  73. package/dist/gasless/index.d.ts +2 -0
  74. package/dist/gasless/index.d.ts.map +1 -1
  75. package/dist/gasless/nonce-lock.d.ts +55 -17
  76. package/dist/gasless/nonce-lock.d.ts.map +1 -1
  77. package/dist/gasless/nonce-lock.js +53 -26
  78. package/dist/gasless/nonce-lock.js.map +1 -1
  79. package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.d.ts +30 -0
  80. package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.d.ts.map +1 -0
  81. package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.js +67 -0
  82. package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.js.map +1 -0
  83. package/dist/gasless/relay-gasless-batch/relay-gasless-batch.d.ts +30 -9
  84. package/dist/gasless/relay-gasless-batch/relay-gasless-batch.d.ts.map +1 -1
  85. package/dist/gasless/relay-gasless-batch/relay-gasless-batch.js +99 -102
  86. package/dist/gasless/relay-gasless-batch/relay-gasless-batch.js.map +1 -1
  87. package/dist/gasless/relay-gasless-batch/resolve-batch-signers.d.ts +18 -0
  88. package/dist/gasless/relay-gasless-batch/resolve-batch-signers.d.ts.map +1 -0
  89. package/dist/gasless/relay-gasless-batch/resolve-batch-signers.js +17 -0
  90. package/dist/gasless/relay-gasless-batch/resolve-batch-signers.js.map +1 -0
  91. package/dist/gasless/relay-gasless-batch/sign-gasless-batch.d.ts +8 -5
  92. package/dist/gasless/relay-gasless-batch/sign-gasless-batch.d.ts.map +1 -1
  93. package/dist/gasless/relay-gasless-batch/sign-gasless-batch.js +22 -16
  94. package/dist/gasless/relay-gasless-batch/sign-gasless-batch.js.map +1 -1
  95. package/dist/gasless/relay-grant-delegation/relay-grant-delegation.d.ts +13 -7
  96. package/dist/gasless/relay-grant-delegation/relay-grant-delegation.d.ts.map +1 -1
  97. package/dist/gasless/relay-grant-delegation/relay-grant-delegation.js +46 -36
  98. package/dist/gasless/relay-grant-delegation/relay-grant-delegation.js.map +1 -1
  99. package/dist/gasless/relay-instant-operations/relay-instant-operations.d.ts +14 -15
  100. package/dist/gasless/relay-instant-operations/relay-instant-operations.d.ts.map +1 -1
  101. package/dist/gasless/relay-instant-operations/relay-instant-operations.js +12 -11
  102. package/dist/gasless/relay-instant-operations/relay-instant-operations.js.map +1 -1
  103. package/dist/gasless/relayable-writes.d.ts.map +1 -1
  104. package/dist/gasless/relayable-writes.js +28 -0
  105. package/dist/gasless/relayable-writes.js.map +1 -1
  106. package/dist/gasless/request-headers.d.ts +7 -0
  107. package/dist/gasless/request-headers.d.ts.map +1 -0
  108. package/dist/gasless/request-headers.js +34 -0
  109. package/dist/gasless/request-headers.js.map +1 -0
  110. package/dist/gasless/resolve-wallet-identities.js +4 -4
  111. package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.d.ts +11 -4
  112. package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.d.ts.map +1 -1
  113. package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.js +2 -2
  114. package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.js.map +1 -1
  115. package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.d.ts +10 -14
  116. package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.d.ts.map +1 -1
  117. package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.js +3 -2
  118. package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.js.map +1 -1
  119. package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.d.ts +15 -15
  120. package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.d.ts.map +1 -1
  121. package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.js +13 -12
  122. package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.js.map +1 -1
  123. package/dist/gasless/unconfirmed-submit.d.ts +12 -8
  124. package/dist/gasless/unconfirmed-submit.d.ts.map +1 -1
  125. package/dist/gasless/unconfirmed-submit.js +1 -1
  126. package/dist/gasless/unconfirmed-submit.js.map +1 -1
  127. package/dist/index.d.ts +26 -9
  128. package/dist/index.d.ts.map +1 -1
  129. package/dist/index.js +673 -615
  130. package/dist/shared/errors/symm-error.js +3 -3
  131. package/dist/shared/types/properties.d.ts +45 -8
  132. package/dist/shared/types/properties.d.ts.map +1 -1
  133. package/dist/solvers/capabilities.d.ts.map +1 -1
  134. package/dist/solvers/capabilities.js +4 -2
  135. package/dist/solvers/capabilities.js.map +1 -1
  136. package/dist/solvers/estimated-price/get-estimated-price.js +6 -6
  137. package/dist/solvers/force-close/force-close-auto.d.ts.map +1 -1
  138. package/dist/solvers/force-close/force-close-auto.js +70 -69
  139. package/dist/solvers/force-close/force-close-auto.js.map +1 -1
  140. package/dist/solvers/get-error-message/get-error-message.js +4 -4
  141. package/dist/solvers/get-party-a-upnl/get-party-a-upnl.js +4 -4
  142. package/dist/solvers/get-solver-balance-info/get-solver-balance-info.js +4 -4
  143. package/dist/solvers/get-solver-info/get-solver-info.d.ts +5 -2
  144. package/dist/solvers/get-solver-info/get-solver-info.d.ts.map +1 -1
  145. package/dist/solvers/get-solver-info/get-solver-info.js +14 -12
  146. package/dist/solvers/get-solver-info/get-solver-info.js.map +1 -1
  147. package/dist/solvers/get-solver-info/parse-timelock-info.d.ts +5 -0
  148. package/dist/solvers/get-solver-info/parse-timelock-info.d.ts.map +1 -0
  149. package/dist/solvers/get-solver-info/parse-timelock-info.js +27 -0
  150. package/dist/solvers/get-solver-info/parse-timelock-info.js.map +1 -0
  151. package/dist/solvers/get-solver-open-interest/get-solver-open-interest.js +4 -4
  152. package/dist/solvers/get-solver-price-range/get-solver-price-range.js +4 -4
  153. package/dist/solvers/get-solver-readiness/get-solver-readiness.js +4 -4
  154. package/dist/solvers/instant-open/get-instant-opens/adapters/enigma-instant-opens.js +17 -17
  155. package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.d.ts +8 -7
  156. package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.d.ts.map +1 -1
  157. package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.js +43 -39
  158. package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.js.map +1 -1
  159. package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.d.ts +16 -0
  160. package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.d.ts.map +1 -0
  161. package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.js +92 -0
  162. package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.js.map +1 -0
  163. package/dist/solvers/instant-open/instant-open/adapters/rasa-instant-open.js +1 -1
  164. package/dist/solvers/instant-open/instant-open/index.d.ts +2 -0
  165. package/dist/solvers/instant-open/instant-open/index.d.ts.map +1 -1
  166. package/dist/solvers/instant-open/instant-open/instant-open.d.ts +22 -6
  167. package/dist/solvers/instant-open/instant-open/instant-open.d.ts.map +1 -1
  168. package/dist/solvers/instant-open/instant-open/instant-open.js +35 -27
  169. package/dist/solvers/instant-open/instant-open/instant-open.js.map +1 -1
  170. package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.d.ts +12 -0
  171. package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.d.ts.map +1 -0
  172. package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.js +49 -0
  173. package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.js.map +1 -0
  174. package/dist/solvers/instant-open/instant-open/prepared/types.d.ts +20 -0
  175. package/dist/solvers/instant-open/instant-open/prepared/types.d.ts.map +1 -0
  176. package/dist/solvers/instant-open/instant-open/types.d.ts +5 -4
  177. package/dist/solvers/instant-open/instant-open/types.d.ts.map +1 -1
  178. package/dist/solvers/instant-open/shared/hedger-api.d.ts.map +1 -1
  179. package/dist/solvers/instant-open/shared/hedger-api.js +38 -26
  180. package/dist/solvers/instant-open/shared/hedger-api.js.map +1 -1
  181. package/dist/solvers/markets/adapters/enigma-markets.js +34 -34
  182. package/dist/solvers/notional-cap/get-notional-cap-page.js +4 -4
  183. package/dist/solvers/revenue/get-solver-revenue.js +10 -10
  184. package/dist/solvers/revenue-records/get-revenue-records.js +11 -11
  185. package/dist/solvers/symbols/get-symbols.js +13 -13
  186. package/dist/solvers/trade-volume/get-trade-volume.js +10 -10
  187. package/dist/symmio-contracts/abi/v0.8.6/instant-layer.d.ts +46 -0
  188. package/dist/symmio-contracts/abi/v0.8.6/instant-layer.d.ts.map +1 -1
  189. package/dist/symmio-contracts/abi/v0.8.6/instant-layer.js +53 -0
  190. package/dist/symmio-contracts/abi/v0.8.6/instant-layer.js.map +1 -1
  191. package/dist/symmio-contracts/account-layer/actions/add-margin.d.ts +3 -0
  192. package/dist/symmio-contracts/account-layer/actions/add-margin.d.ts.map +1 -1
  193. package/dist/symmio-contracts/account-layer/actions/add-margin.js +41 -27
  194. package/dist/symmio-contracts/account-layer/actions/add-margin.js.map +1 -1
  195. package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.d.ts +23 -9
  196. package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.d.ts.map +1 -1
  197. package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.js +15 -36
  198. package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.js.map +1 -1
  199. package/dist/symmio-contracts/account-layer/actions/delete-sub-account.d.ts +3 -0
  200. package/dist/symmio-contracts/account-layer/actions/delete-sub-account.d.ts.map +1 -1
  201. package/dist/symmio-contracts/account-layer/actions/delete-sub-account.js +40 -26
  202. package/dist/symmio-contracts/account-layer/actions/delete-sub-account.js.map +1 -1
  203. package/dist/symmio-contracts/account-layer/actions/edit-account-name.d.ts +1 -1
  204. package/dist/symmio-contracts/account-layer/actions/edit-account-name.d.ts.map +1 -1
  205. package/dist/symmio-contracts/account-layer/actions/edit-account-name.js +18 -37
  206. package/dist/symmio-contracts/account-layer/actions/edit-account-name.js.map +1 -1
  207. package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.d.ts +46 -0
  208. package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.d.ts.map +1 -0
  209. package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.js +20 -0
  210. package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.js.map +1 -0
  211. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.d.ts +31 -0
  212. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.d.ts.map +1 -0
  213. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.js +15 -0
  214. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.js.map +1 -0
  215. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.d.ts +54 -0
  216. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.d.ts.map +1 -0
  217. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.js +26 -0
  218. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.js.map +1 -0
  219. package/dist/symmio-contracts/account-layer/actions/remove-margin.d.ts +3 -0
  220. package/dist/symmio-contracts/account-layer/actions/remove-margin.d.ts.map +1 -1
  221. package/dist/symmio-contracts/account-layer/actions/remove-margin.js +50 -32
  222. package/dist/symmio-contracts/account-layer/actions/remove-margin.js.map +1 -1
  223. package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.d.ts +12 -0
  224. package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.d.ts.map +1 -0
  225. package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.js +10 -0
  226. package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.js.map +1 -0
  227. package/dist/symmio-contracts/account-layer/cancel-timelock-op/index.d.ts +3 -0
  228. package/dist/symmio-contracts/account-layer/cancel-timelock-op/index.d.ts.map +1 -0
  229. package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.d.ts +9 -0
  230. package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.d.ts.map +1 -0
  231. package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.js +13 -0
  232. package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.js.map +1 -0
  233. package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.d.ts +12 -0
  234. package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.d.ts.map +1 -0
  235. package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.js +10 -0
  236. package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.js.map +1 -0
  237. package/dist/symmio-contracts/account-layer/clear-timelocks/index.d.ts +3 -0
  238. package/dist/symmio-contracts/account-layer/clear-timelocks/index.d.ts.map +1 -0
  239. package/dist/symmio-contracts/account-layer/clear-timelocks/query.d.ts +9 -0
  240. package/dist/symmio-contracts/account-layer/clear-timelocks/query.d.ts.map +1 -0
  241. package/dist/symmio-contracts/account-layer/clear-timelocks/query.js +13 -0
  242. package/dist/symmio-contracts/account-layer/clear-timelocks/query.js.map +1 -0
  243. package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.d.ts +12 -0
  244. package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.d.ts.map +1 -0
  245. package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.js +9 -0
  246. package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.js.map +1 -0
  247. package/dist/symmio-contracts/account-layer/execute-timelock-op/index.d.ts +3 -0
  248. package/dist/symmio-contracts/account-layer/execute-timelock-op/index.d.ts.map +1 -0
  249. package/dist/symmio-contracts/account-layer/execute-timelock-op/query.d.ts +9 -0
  250. package/dist/symmio-contracts/account-layer/execute-timelock-op/query.d.ts.map +1 -0
  251. package/dist/symmio-contracts/account-layer/execute-timelock-op/query.js +13 -0
  252. package/dist/symmio-contracts/account-layer/execute-timelock-op/query.js.map +1 -0
  253. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.d.ts +12 -0
  254. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.d.ts.map +1 -0
  255. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.js +16 -0
  256. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.js.map +1 -0
  257. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/index.d.ts +2 -0
  258. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/index.d.ts.map +1 -0
  259. package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.d.ts +12 -0
  260. package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.d.ts.map +1 -0
  261. package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.js +22 -0
  262. package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.js.map +1 -0
  263. package/dist/symmio-contracts/account-layer/get-selector-timelock/index.d.ts +3 -0
  264. package/dist/symmio-contracts/account-layer/get-selector-timelock/index.d.ts.map +1 -0
  265. package/dist/symmio-contracts/account-layer/get-selector-timelock/query.d.ts +22 -0
  266. package/dist/symmio-contracts/account-layer/get-selector-timelock/query.d.ts.map +1 -0
  267. package/dist/symmio-contracts/account-layer/get-selector-timelock/query.js +21 -0
  268. package/dist/symmio-contracts/account-layer/get-selector-timelock/query.js.map +1 -0
  269. package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.d.ts +12 -0
  270. package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.d.ts.map +1 -0
  271. package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.js +22 -0
  272. package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.js.map +1 -0
  273. package/dist/symmio-contracts/account-layer/get-timelock-schedule/index.d.ts +2 -0
  274. package/dist/symmio-contracts/account-layer/get-timelock-schedule/index.d.ts.map +1 -0
  275. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.d.ts +13 -0
  276. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.d.ts.map +1 -0
  277. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.js +17 -0
  278. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.js.map +1 -0
  279. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/index.d.ts +2 -0
  280. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/index.d.ts.map +1 -0
  281. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.d.ts +12 -0
  282. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.d.ts.map +1 -0
  283. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.js +67 -0
  284. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.js.map +1 -0
  285. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/index.d.ts +3 -0
  286. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/index.d.ts.map +1 -0
  287. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.d.ts +21 -0
  288. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.d.ts.map +1 -0
  289. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.js +21 -0
  290. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.js.map +1 -0
  291. package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.d.ts +15 -0
  292. package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.d.ts.map +1 -0
  293. package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.js +17 -0
  294. package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.js.map +1 -0
  295. package/dist/symmio-contracts/account-layer/hash-timelock-approval/index.d.ts +2 -0
  296. package/dist/symmio-contracts/account-layer/hash-timelock-approval/index.d.ts.map +1 -0
  297. package/dist/symmio-contracts/account-layer/hook-metadata.d.ts +47 -0
  298. package/dist/symmio-contracts/account-layer/hook-metadata.d.ts.map +1 -0
  299. package/dist/symmio-contracts/account-layer/hook-metadata.js +30 -0
  300. package/dist/symmio-contracts/account-layer/hook-metadata.js.map +1 -0
  301. package/dist/symmio-contracts/account-layer/index.d.ts +21 -0
  302. package/dist/symmio-contracts/account-layer/index.d.ts.map +1 -1
  303. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/index.d.ts +2 -0
  304. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/index.d.ts.map +1 -0
  305. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.d.ts +14 -0
  306. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.d.ts.map +1 -0
  307. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.js +17 -0
  308. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.js.map +1 -0
  309. package/dist/symmio-contracts/account-layer/query/generate-account-manager-address.js +6 -6
  310. package/dist/symmio-contracts/account-layer/query/get-account-balance-info.js +6 -6
  311. package/dist/symmio-contracts/account-layer/query/get-account-balance-of.js +6 -6
  312. package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.d.ts +43 -0
  313. package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.d.ts.map +1 -0
  314. package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.js +31 -0
  315. package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.js.map +1 -0
  316. package/dist/symmio-contracts/account-layer/query/get-affiliate-state.js +6 -6
  317. package/dist/symmio-contracts/account-layer/query/get-sub-account-virtual-nonce.js +6 -6
  318. package/dist/symmio-contracts/account-layer/query/get-sub-accounts-count-of-user.js +6 -6
  319. package/dist/symmio-contracts/account-layer/query/get-user-sub-accounts-addresses.js +6 -6
  320. package/dist/symmio-contracts/account-layer/query/get-user-sub-accounts.js +6 -6
  321. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-addresses-of-sub-account.js +6 -6
  322. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.d.ts +39 -0
  323. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.d.ts.map +1 -0
  324. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.js +29 -0
  325. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.js.map +1 -0
  326. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.d.ts +39 -0
  327. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.d.ts.map +1 -0
  328. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.js +31 -0
  329. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.js.map +1 -0
  330. package/dist/symmio-contracts/account-layer/query/predict-next-virtual-account.js +6 -6
  331. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/index.d.ts +2 -0
  332. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/index.d.ts.map +1 -0
  333. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.d.ts +19 -0
  334. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.d.ts.map +1 -0
  335. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.js +10 -0
  336. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.js.map +1 -0
  337. package/dist/symmio-contracts/account-layer/schedule-timelock-op/index.d.ts +3 -0
  338. package/dist/symmio-contracts/account-layer/schedule-timelock-op/index.d.ts.map +1 -0
  339. package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.d.ts +9 -0
  340. package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.d.ts.map +1 -0
  341. package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.js +13 -0
  342. package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.js.map +1 -0
  343. package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.d.ts +12 -0
  344. package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.d.ts.map +1 -0
  345. package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.js +10 -0
  346. package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.js.map +1 -0
  347. package/dist/symmio-contracts/account-layer/setup-timelocks/index.d.ts +3 -0
  348. package/dist/symmio-contracts/account-layer/setup-timelocks/index.d.ts.map +1 -0
  349. package/dist/symmio-contracts/account-layer/setup-timelocks/query.d.ts +9 -0
  350. package/dist/symmio-contracts/account-layer/setup-timelocks/query.d.ts.map +1 -0
  351. package/dist/symmio-contracts/account-layer/setup-timelocks/query.js +13 -0
  352. package/dist/symmio-contracts/account-layer/setup-timelocks/query.js.map +1 -0
  353. package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.d.ts +13 -0
  354. package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.d.ts.map +1 -0
  355. package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.js +18 -0
  356. package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.js.map +1 -0
  357. package/dist/symmio-contracts/account-layer/timelock-selector.d.ts +4 -0
  358. package/dist/symmio-contracts/account-layer/timelock-selector.d.ts.map +1 -0
  359. package/dist/symmio-contracts/account-layer/timelock-selector.js +9 -0
  360. package/dist/symmio-contracts/account-layer/timelock-selector.js.map +1 -0
  361. package/dist/symmio-contracts/account-layer/timelock-test.d.ts +7 -0
  362. package/dist/symmio-contracts/account-layer/timelock-test.d.ts.map +1 -0
  363. package/dist/symmio-contracts/account-layer/timelock-types.d.ts +66 -0
  364. package/dist/symmio-contracts/account-layer/timelock-types.d.ts.map +1 -0
  365. package/dist/symmio-contracts/account-layer/types.d.ts +32 -2
  366. package/dist/symmio-contracts/account-layer/types.d.ts.map +1 -1
  367. package/dist/symmio-contracts/account-layer/types.js.map +1 -1
  368. package/dist/symmio-contracts/account-layer/write-timelock.d.ts +10 -0
  369. package/dist/symmio-contracts/account-layer/write-timelock.d.ts.map +1 -0
  370. package/dist/symmio-contracts/account-layer/write-timelock.js +51 -0
  371. package/dist/symmio-contracts/account-layer/write-timelock.js.map +1 -0
  372. package/dist/symmio-contracts/instant-layer/actions/grant-delegation.d.ts +4 -1
  373. package/dist/symmio-contracts/instant-layer/actions/grant-delegation.d.ts.map +1 -1
  374. package/dist/symmio-contracts/instant-layer/actions/grant-delegation.js +42 -38
  375. package/dist/symmio-contracts/instant-layer/actions/grant-delegation.js.map +1 -1
  376. package/dist/symmio-contracts/instant-layer/actions/grant-delegations.d.ts +75 -0
  377. package/dist/symmio-contracts/instant-layer/actions/grant-delegations.d.ts.map +1 -0
  378. package/dist/symmio-contracts/instant-layer/actions/grant-delegations.js +46 -0
  379. package/dist/symmio-contracts/instant-layer/actions/grant-delegations.js.map +1 -0
  380. package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.d.ts +32 -0
  381. package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.d.ts.map +1 -0
  382. package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.js +18 -0
  383. package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.js.map +1 -0
  384. package/dist/symmio-contracts/instant-layer/grant-delegations-input.d.ts +33 -0
  385. package/dist/symmio-contracts/instant-layer/grant-delegations-input.d.ts.map +1 -0
  386. package/dist/symmio-contracts/instant-layer/grant-delegations-input.js +18 -0
  387. package/dist/symmio-contracts/instant-layer/grant-delegations-input.js.map +1 -0
  388. package/dist/symmio-contracts/instant-layer/index.d.ts +4 -0
  389. package/dist/symmio-contracts/instant-layer/index.d.ts.map +1 -1
  390. package/dist/symmio-contracts/instant-layer/query/grant-delegations.d.ts +22 -0
  391. package/dist/symmio-contracts/instant-layer/query/grant-delegations.d.ts.map +1 -0
  392. package/dist/symmio-contracts/instant-layer/query/grant-delegations.js +12 -0
  393. package/dist/symmio-contracts/instant-layer/query/grant-delegations.js.map +1 -0
  394. package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.d.ts +19 -0
  395. package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.d.ts.map +1 -0
  396. package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.js +12 -0
  397. package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.js.map +1 -0
  398. package/dist/symmio-contracts/symmio/actions/allocate.d.ts +3 -0
  399. package/dist/symmio-contracts/symmio/actions/allocate.d.ts.map +1 -1
  400. package/dist/symmio-contracts/symmio/actions/allocate.js +22 -16
  401. package/dist/symmio-contracts/symmio/actions/allocate.js.map +1 -1
  402. package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.d.ts +74 -0
  403. package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.d.ts.map +1 -0
  404. package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.js +36 -0
  405. package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.js.map +1 -0
  406. package/dist/symmio-contracts/symmio/actions/approve-operational-fee.d.ts +3 -0
  407. package/dist/symmio-contracts/symmio/actions/approve-operational-fee.d.ts.map +1 -1
  408. package/dist/symmio-contracts/symmio/actions/approve-operational-fee.js +32 -29
  409. package/dist/symmio-contracts/symmio/actions/approve-operational-fee.js.map +1 -1
  410. package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.d.ts +3 -0
  411. package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.d.ts.map +1 -1
  412. package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.js +37 -28
  413. package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.js.map +1 -1
  414. package/dist/symmio-contracts/symmio/actions/deallocate.d.ts +3 -0
  415. package/dist/symmio-contracts/symmio/actions/deallocate.d.ts.map +1 -1
  416. package/dist/symmio-contracts/symmio/actions/deallocate.js +30 -20
  417. package/dist/symmio-contracts/symmio/actions/deallocate.js.map +1 -1
  418. package/dist/symmio-contracts/symmio/actions/initiate-withdraw.d.ts +5 -0
  419. package/dist/symmio-contracts/symmio/actions/initiate-withdraw.d.ts.map +1 -1
  420. package/dist/symmio-contracts/symmio/actions/initiate-withdraw.js +31 -18
  421. package/dist/symmio-contracts/symmio/actions/initiate-withdraw.js.map +1 -1
  422. package/dist/symmio-contracts/symmio/actions/withdraw-auto.d.ts +4 -0
  423. package/dist/symmio-contracts/symmio/actions/withdraw-auto.d.ts.map +1 -1
  424. package/dist/symmio-contracts/symmio/actions/withdraw-auto.js +30 -25
  425. package/dist/symmio-contracts/symmio/actions/withdraw-auto.js.map +1 -1
  426. package/dist/symmio-contracts/symmio/actions/withdraw.d.ts +4 -0
  427. package/dist/symmio-contracts/symmio/actions/withdraw.d.ts.map +1 -1
  428. package/dist/symmio-contracts/symmio/actions/withdraw.js +12 -8
  429. package/dist/symmio-contracts/symmio/actions/withdraw.js.map +1 -1
  430. package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.d.ts +48 -0
  431. package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.d.ts.map +1 -0
  432. package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.js +33 -0
  433. package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.js.map +1 -0
  434. package/dist/symmio-contracts/symmio/execute-account-calls/index.d.ts +3 -0
  435. package/dist/symmio-contracts/symmio/execute-account-calls/index.d.ts.map +1 -0
  436. package/dist/symmio-contracts/symmio/execute-account-calls/query.d.ts +23 -0
  437. package/dist/symmio-contracts/symmio/execute-account-calls/query.d.ts.map +1 -0
  438. package/dist/symmio-contracts/symmio/execute-account-calls/query.js +12 -0
  439. package/dist/symmio-contracts/symmio/execute-account-calls/query.js.map +1 -0
  440. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.d.ts +22 -0
  441. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.d.ts.map +1 -0
  442. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.js +14 -0
  443. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.js.map +1 -0
  444. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/index.d.ts +3 -0
  445. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/index.d.ts.map +1 -0
  446. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.d.ts +34 -0
  447. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.d.ts.map +1 -0
  448. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.js +21 -0
  449. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.js.map +1 -0
  450. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.d.ts +34 -0
  451. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.d.ts.map +1 -0
  452. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.js +35 -0
  453. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.js.map +1 -0
  454. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/index.d.ts +3 -0
  455. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/index.d.ts.map +1 -0
  456. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.d.ts +15 -0
  457. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.d.ts.map +1 -0
  458. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.js +20 -0
  459. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.js.map +1 -0
  460. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.d.ts +22 -0
  461. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.d.ts.map +1 -0
  462. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.js +30 -0
  463. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.js.map +1 -0
  464. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.d.ts +30 -0
  465. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.d.ts.map +1 -0
  466. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.js +15 -0
  467. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.js.map +1 -0
  468. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/index.d.ts +3 -0
  469. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/index.d.ts.map +1 -0
  470. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.d.ts +38 -0
  471. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.d.ts.map +1 -0
  472. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.js +24 -0
  473. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.js.map +1 -0
  474. package/dist/symmio-contracts/symmio/index.d.ts +6 -0
  475. package/dist/symmio-contracts/symmio/index.d.ts.map +1 -1
  476. package/dist/symmio-contracts/symmio/internal/call-as-sub-account.d.ts.map +1 -1
  477. package/dist/symmio-contracts/symmio/internal/call-as-sub-account.js +35 -34
  478. package/dist/symmio-contracts/symmio/internal/call-as-sub-account.js.map +1 -1
  479. package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.d.ts +18 -0
  480. package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.d.ts.map +1 -0
  481. package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.js +14 -0
  482. package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.js.map +1 -0
  483. package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.d.ts +18 -0
  484. package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.d.ts.map +1 -0
  485. package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.js +12 -0
  486. package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.js.map +1 -0
  487. package/dist/symmio-subgraph/executeSubgraphRequest.js +3 -3
  488. package/dist/timelock/approval.d.ts +142 -0
  489. package/dist/timelock/approval.d.ts.map +1 -0
  490. package/dist/timelock/approval.js +176 -0
  491. package/dist/timelock/approval.js.map +1 -0
  492. package/dist/timelock/attempt-outcome.d.ts +37 -0
  493. package/dist/timelock/attempt-outcome.d.ts.map +1 -0
  494. package/dist/timelock/attempt-outcome.js +70 -0
  495. package/dist/timelock/attempt-outcome.js.map +1 -0
  496. package/dist/timelock/confirm-write.d.ts +5 -0
  497. package/dist/timelock/confirm-write.d.ts.map +1 -0
  498. package/dist/timelock/confirm-write.js +18 -0
  499. package/dist/timelock/confirm-write.js.map +1 -0
  500. package/dist/timelock/early-withdraw/early-withdraw.d.ts +60 -0
  501. package/dist/timelock/early-withdraw/early-withdraw.d.ts.map +1 -0
  502. package/dist/timelock/early-withdraw/early-withdraw.js +94 -0
  503. package/dist/timelock/early-withdraw/early-withdraw.js.map +1 -0
  504. package/dist/timelock/early-withdraw/index.d.ts +2 -0
  505. package/dist/timelock/early-withdraw/index.d.ts.map +1 -0
  506. package/dist/timelock/errors.d.ts +23 -0
  507. package/dist/timelock/errors.d.ts.map +1 -0
  508. package/dist/timelock/errors.js +29 -0
  509. package/dist/timelock/errors.js.map +1 -0
  510. package/dist/timelock/execute-protected-batch.d.ts +31 -0
  511. package/dist/timelock/execute-protected-batch.d.ts.map +1 -0
  512. package/dist/timelock/execute-protected-batch.js +148 -0
  513. package/dist/timelock/execute-protected-batch.js.map +1 -0
  514. package/dist/timelock/execute-protected-call.d.ts +68 -0
  515. package/dist/timelock/execute-protected-call.d.ts.map +1 -0
  516. package/dist/timelock/execute-protected-call.js +146 -0
  517. package/dist/timelock/execute-protected-call.js.map +1 -0
  518. package/dist/timelock/execute-protected-function.d.ts +51 -0
  519. package/dist/timelock/execute-protected-function.d.ts.map +1 -0
  520. package/dist/timelock/execute-protected-function.js +37 -0
  521. package/dist/timelock/execute-protected-function.js.map +1 -0
  522. package/dist/timelock/get-timelock-policy/get-timelock-policy.d.ts +38 -0
  523. package/dist/timelock/get-timelock-policy/get-timelock-policy.d.ts.map +1 -0
  524. package/dist/timelock/get-timelock-policy/get-timelock-policy.js +49 -0
  525. package/dist/timelock/get-timelock-policy/get-timelock-policy.js.map +1 -0
  526. package/dist/timelock/get-timelock-policy/index.d.ts +3 -0
  527. package/dist/timelock/get-timelock-policy/index.d.ts.map +1 -0
  528. package/dist/timelock/get-timelock-policy/query.d.ts +13 -0
  529. package/dist/timelock/get-timelock-policy/query.d.ts.map +1 -0
  530. package/dist/timelock/get-timelock-policy/query.js +21 -0
  531. package/dist/timelock/get-timelock-policy/query.js.map +1 -0
  532. package/dist/timelock/index.d.ts +14 -0
  533. package/dist/timelock/index.d.ts.map +1 -0
  534. package/dist/timelock/normalize-timelock-revert.d.ts +3 -0
  535. package/dist/timelock/normalize-timelock-revert.d.ts.map +1 -0
  536. package/dist/timelock/normalize-timelock-revert.js +11 -0
  537. package/dist/timelock/normalize-timelock-revert.js.map +1 -0
  538. package/dist/timelock/policy-change.d.ts +72 -0
  539. package/dist/timelock/policy-change.d.ts.map +1 -0
  540. package/dist/timelock/policy-change.js +63 -0
  541. package/dist/timelock/policy-change.js.map +1 -0
  542. package/dist/timelock/policy.d.ts +19 -0
  543. package/dist/timelock/policy.d.ts.map +1 -0
  544. package/dist/timelock/policy.js +59 -0
  545. package/dist/timelock/policy.js.map +1 -0
  546. package/dist/timelock/protected-call-preflight.d.ts +10 -0
  547. package/dist/timelock/protected-call-preflight.d.ts.map +1 -0
  548. package/dist/timelock/protected-call-preflight.js +17 -0
  549. package/dist/timelock/protected-call-preflight.js.map +1 -0
  550. package/dist/timelock/root-account.d.ts +14 -0
  551. package/dist/timelock/root-account.d.ts.map +1 -0
  552. package/dist/timelock/root-account.js +9 -0
  553. package/dist/timelock/root-account.js.map +1 -0
  554. package/dist/timelock/scheduled-call-match.d.ts +4 -0
  555. package/dist/timelock/scheduled-call-match.d.ts.map +1 -0
  556. package/dist/timelock/scheduled-call-match.js +43 -0
  557. package/dist/timelock/scheduled-call-match.js.map +1 -0
  558. package/dist/timelock/setup-timelock-policy/index.d.ts +2 -0
  559. package/dist/timelock/setup-timelock-policy/index.d.ts.map +1 -0
  560. package/dist/timelock/setup-timelock-policy/setup-timelock-policy.d.ts +46 -0
  561. package/dist/timelock/setup-timelock-policy/setup-timelock-policy.d.ts.map +1 -0
  562. package/dist/timelock/setup-timelock-policy/setup-timelock-policy.js +58 -0
  563. package/dist/timelock/setup-timelock-policy/setup-timelock-policy.js.map +1 -0
  564. package/dist/timelock/support.d.ts +4 -0
  565. package/dist/timelock/support.d.ts.map +1 -0
  566. package/dist/timelock/support.js +9 -0
  567. package/dist/timelock/support.js.map +1 -0
  568. package/dist/transactions/execute-contract-write.d.ts +9 -0
  569. package/dist/transactions/execute-contract-write.d.ts.map +1 -0
  570. package/dist/transactions/execute-contract-write.js +35 -0
  571. package/dist/transactions/execute-contract-write.js.map +1 -0
  572. package/dist/transactions/execute-write.d.ts +32 -0
  573. package/dist/transactions/execute-write.d.ts.map +1 -0
  574. package/dist/transactions/execute-write.js +23 -0
  575. package/dist/transactions/execute-write.js.map +1 -0
  576. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"calls.js","names":[],"sources":["../../../src/gasless/batch/calls.ts"],"sourcesContent":["import { encodeFunctionData, size, slice, type Abi, type AbiFunction, type Hex } from \"viem\";\nimport { SymmError } from \"../../shared/errors/symm-error\";\nimport type { GaslessWalletCall } from \"../gasless-wallet-execute/calls\";\nimport { getGaslessWalletExecuteSelectors } from \"../gasless-wallet-execute/selectors\";\nimport { GASLESS_RELAYABLE_FUNCTIONS } from \"../relayable-writes\";\n\n/**\n * A relayable write named by its function, which the SDK encodes with viem's\n * `encodeFunctionData` — that throws on an arity or type mismatch, before any\n * signature prompt or network call.\n *\n * The target contract is **not** given: the SDK resolves it from the encoded\n * selector (the core diamond, the AccountLayer or the InstantLayer). The `abi`\n * is optional too — every relayable write is a known SYMMIO function, so\n * `{ functionName: \"allocate\", args: [amount] }` is enough. Pass an `abi` (the\n * SDK's own `symmioAbi`, `accountLayerAbi` or `instantLayerAbi`) when you\n * already hold it; the selector must still be a relayable write.\n *\n * `args` is deliberately `readonly unknown[]`, as for `GaslessWalletContractCall`.\n * When you want compile-time-checked arguments, encode with viem yourself and\n * pass the result as a {@link GaslessBatchRawCall}.\n */\nexport interface GaslessBatchContractCall {\n /** ABI containing `functionName`. Omit it to use the SDK's own ABI for the relayable write of that name. */\n abi?: Abi | readonly unknown[];\n /** The relayable write to run — `\"allocate\"`, `\"initiateWithdraw\"`, `\"grantDelegation\"`, … */\n functionName: string;\n /** Arguments for `functionName`, in order. Omit for a no-argument function. */\n args?: readonly unknown[];\n}\n\n/** A relayable write given as raw calldata; its selector decides the target contract. */\nexport interface GaslessBatchRawCall {\n /** Calldata of a relayable write. */\n data: Hex;\n}\n\n/**\n * A GaslessWallet `execute` entry: several calls the owner's deterministic\n * wallet makes, authorized by **one** gateway-domain signature.\n *\n * The calls run **as the wallet contract**, not as the SYMMIO account — use it to\n * move the wallet's own tokens (an ERC-20 `approve` followed by a bridge call,\n * say), exactly as with `gaslessWalletExecute`.\n */\nexport interface GaslessBatchWalletExecute {\n /** The calls the wallet makes, in order. Each is raw `data` or an `{ abi, functionName, args }` triple. */\n walletCalls: readonly GaslessWalletCall[];\n /**\n * Which of the owner's GaslessWallets makes them. Defaults to `0n`, the\n * original wallet. Each id is an independent wallet with its own address,\n * balance and nonce stream.\n */\n walletId?: bigint;\n}\n\n/**\n * One entry of a gasless batch: a relayable write — an ABI-level call\n * ({@link GaslessBatchContractCall}) or raw calldata ({@link GaslessBatchRawCall}) —\n * or a GaslessWallet `execute` ({@link GaslessBatchWalletExecute}). The forms mix\n * freely in one batch.\n *\n * @example\n * ```ts\n * import type { GaslessBatchCall } from \"@symmio/trading-core\";\n * import { erc20Abi } from \"viem\";\n *\n * const calls: GaslessBatchCall[] = [\n * { functionName: \"allocate\", args: [amount] },\n * { walletId: 1n, walletCalls: [{ target: usdc, abi: erc20Abi, functionName: \"transfer\", args: [to, value] }] },\n * ];\n * ```\n */\nexport type GaslessBatchCall = GaslessBatchContractCall | GaslessBatchRawCall | GaslessBatchWalletExecute;\n\n/**\n * Whether a batch entry is a GaslessWallet `execute`.\n *\n * @internal\n */\nexport function isGaslessBatchWalletExecute(call: GaslessBatchCall): call is GaslessBatchWalletExecute {\n return \"walletCalls\" in call;\n}\n\n/**\n * The calldata a relayable-write entry runs with — raw `data`, or the named\n * call encoded against its own `abi` or, when it has none, the SDK's ABI for\n * the relayable write of that name.\n *\n * @throws {SymmError} `GASLESS_NOT_RELAYABLE` when a call without an `abi` names no relayable write.\n * @throws Viem's encoding error when the arguments do not encode.\n *\n * @internal\n */\nexport function gaslessBatchCallData(call: GaslessBatchContractCall | GaslessBatchRawCall): Hex {\n if (\"data\" in call) return call.data;\n const abi = call.abi ?? [relayableFunction(call.functionName)];\n return encodeFunctionData({ abi: abi as Abi, functionName: call.functionName, args: call.args });\n}\n\nfunction relayableFunction(functionName: string): AbiFunction {\n const item = GASLESS_RELAYABLE_FUNCTIONS.get(functionName);\n if (!item) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_NOT_RELAYABLE\",\n `Gasless: no relayable write is named \"${functionName}\". A batch carries the writes in GASLESS_RELAYABLE_SELECTORS; run any other call from the GaslessWallet as a \\`walletCalls\\` entry.`,\n );\n }\n return item;\n}\n\n/**\n * The 4-byte selector of a calldata blob, lowercased. Calldata shorter than a\n * selector yields `0x00000000`, which no relayable write uses.\n *\n * @internal\n */\nexport function gaslessCallDataSelector(callData: Hex): Hex {\n return (size(callData) < 4 ? \"0x00000000\" : slice(callData, 0, 4)).toLowerCase() as Hex;\n}\n\n/**\n * The selectors a gasless batch runs — the delegation set a session key must\n * hold to relay it on the batch's account: each relayable write's selector, and\n * for every GaslessWallet entry the wallet-execution sentinel plus each inner\n * call's selector. Lowercased and de-duplicated in first-seen order, because\n * `grantDelegation` rejects a duplicate-bearing array.\n *\n * Selectors come from the **encoded** calldata, so an overloaded ABI resolves to\n * the function that will actually run.\n *\n * A batch that contains `grantDelegation` must be owner-signed whatever this\n * returns: the InstantLayer rejects a delegate-signed grant, so no delegation\n * makes it relayable by a session key.\n *\n * @param calls - The batch, in any order.\n * @returns The selector set, as `bytes4` hex.\n * @throws Viem's encoding error when an ABI-level call does not encode.\n *\n * @example\n * ```ts\n * await grantDelegation(config, {\n * account: { addr: subAccount, isPartyB: false },\n * delegatedSigner: sessionKey,\n * selectors: getGaslessBatchSelectors(calls),\n * expiryTimestamp,\n * });\n * ```\n */\nexport function getGaslessBatchSelectors(calls: readonly GaslessBatchCall[]): readonly Hex[] {\n const seen = new Set<Hex>();\n const unique: Hex[] = [];\n const add = (selector: Hex) => {\n const normalized = selector.toLowerCase() as Hex;\n if (seen.has(normalized)) return;\n seen.add(normalized);\n unique.push(normalized);\n };\n\n for (const call of calls) {\n if (isGaslessBatchWalletExecute(call)) {\n for (const selector of getGaslessWalletExecuteSelectors(call.walletCalls)) add(selector);\n } else {\n add(gaslessCallDataSelector(gaslessBatchCallData(call)));\n }\n }\n\n return unique;\n}\n"],"mappings":";;;;;AAgFA,SAAgB,EAA4B,GAA2D;CACrG,OAAO,iBAAiB;AAC1B;AAYA,SAAgB,EAAqB,GAA2D;CAG9F,OAFI,UAAU,IAAa,EAAK,OAEzB,EAAmB;EAAO,KADrB,EAAK,OAAO,CAAC,EAAkB,EAAK,YAAY,CAAC;EAChB,cAAc,EAAK;EAAc,MAAM,EAAK;CAAK,CAAC;AACjG;AAEA,SAAS,EAAkB,GAAmC;CAC5D,IAAM,IAAO,EAA4B,IAAI,CAAY;CACzD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,cACA,yBACA,yCAAyC,EAAa,oIACxD;CAEF,OAAO;AACT;AAQA,SAAgB,EAAwB,GAAoB;CAC1D,QAAQ,EAAK,CAAQ,IAAI,IAAI,eAAe,EAAM,GAAU,GAAG,CAAC,GAAG,YAAY;AACjF;AA8BA,SAAgB,EAAyB,GAAoD;CAC3F,IAAM,oBAAO,IAAI,IAAS,GACpB,IAAgB,CAAC,GACjB,KAAO,MAAkB;EAC7B,IAAM,IAAa,EAAS,YAAY;EACpC,EAAK,IAAI,CAAU,MACvB,EAAK,IAAI,CAAU,GACnB,EAAO,KAAK,CAAU;CACxB;CAEA,KAAK,IAAM,KAAQ,GACjB,IAAI,EAA4B,CAAI,GAClC,KAAK,IAAM,KAAY,EAAiC,EAAK,WAAW,GAAG,EAAI,CAAQ;MAEvF,EAAI,EAAwB,EAAqB,CAAI,CAAC,CAAC;CAI3D,OAAO;AACT"}
1
+ {"version":3,"file":"calls.js","names":[],"sources":["../../../src/gasless/batch/calls.ts"],"sourcesContent":["import { encodeFunctionData, size, slice, type Abi, type AbiFunction, type Address, type Hex } from \"viem\";\nimport { SymmError } from \"../../shared/errors/symm-error\";\nimport { getEffectiveInstantSelectors } from \"../effective-instant-selectors\";\nimport type { GaslessWalletCall } from \"../gasless-wallet-execute/calls\";\nimport { getGaslessWalletExecuteSelectors } from \"../gasless-wallet-execute/selectors\";\nimport { GASLESS_RELAYABLE_FUNCTIONS } from \"../relayable-writes\";\n\n/**\n * A relayable write named by its function, which the SDK encodes with viem's\n * `encodeFunctionData` — that throws on an arity or type mismatch, before any\n * signature prompt or network call.\n *\n * The target contract is **not** given: the SDK resolves it from the encoded\n * selector (the core diamond, the AccountLayer or the InstantLayer). The `abi`\n * is optional too — every relayable write is a known SYMMIO function, so\n * `{ functionName: \"allocate\", args: [amount] }` is enough. Pass an `abi` (the\n * SDK's own `symmioAbi`, `accountLayerAbi` or `instantLayerAbi`) when you\n * already hold it; the selector must still be a relayable write.\n *\n * `args` is deliberately `readonly unknown[]`, as for `GaslessWalletContractCall`.\n * When you want compile-time-checked arguments, encode with viem yourself and\n * pass the result as a {@link GaslessBatchRawCall}.\n */\nexport interface GaslessBatchContractCall {\n /** ABI containing `functionName`. Omit it to use the SDK's own ABI for the relayable write of that name. */\n abi?: Abi | readonly unknown[];\n /** The relayable write to run — `\"allocate\"`, `\"initiateWithdraw\"`, `\"grantDelegation\"`, … */\n functionName: string;\n /** Arguments for `functionName`, in order. Omit for a no-argument function. */\n args?: readonly unknown[];\n /**\n * Who signs this call. Defaults to the batch's `from` (or the connected\n * wallet). Give it to mix signers in one batch, for example a session key\n * signing a call that an owner-signed grant earlier in the same batch\n * authorizes.\n */\n from?: Address;\n}\n\n/** A relayable write given as raw calldata; its selector decides the target contract. */\nexport interface GaslessBatchRawCall {\n /** Calldata of a relayable write. */\n data: Hex;\n /** Who signs this call. Defaults to the batch's `from` (or the connected wallet). */\n from?: Address;\n}\n\n/**\n * A GaslessWallet `execute` entry: several calls the owner's deterministic\n * wallet makes, authorized by **one** gateway-domain signature.\n *\n * The calls run **as the wallet contract**, not as the SYMMIO account — use it to\n * move the wallet's own tokens (an ERC-20 `approve` followed by a bridge call,\n * say), exactly as with `gaslessWalletExecute`.\n */\nexport interface GaslessBatchWalletExecute {\n /** The calls the wallet makes, in order. Each is raw `data` or an `{ abi, functionName, args }` triple. */\n walletCalls: readonly GaslessWalletCall[];\n /**\n * Which of the owner's GaslessWallets makes them. Defaults to `0n`, the\n * original wallet. Each id is an independent wallet with its own address,\n * balance and nonce stream.\n */\n walletId?: bigint;\n /**\n * Who signs this wallet operation. Defaults to the batch's `from`, then the\n * configured wallet. The wallet contract still executes the inner calls.\n */\n from?: Address;\n}\n\n/**\n * One entry of a gasless batch: a relayable write — an ABI-level call\n * ({@link GaslessBatchContractCall}) or raw calldata ({@link GaslessBatchRawCall}) —\n * or a GaslessWallet `execute` ({@link GaslessBatchWalletExecute}). The forms mix\n * freely in one batch.\n *\n * @example\n * ```ts\n * import type { GaslessBatchCall } from \"@symmio/trading-core\";\n * import { erc20Abi } from \"viem\";\n *\n * const calls: GaslessBatchCall[] = [\n * { functionName: \"allocate\", args: [amount] },\n * { walletId: 1n, walletCalls: [{ target: usdc, abi: erc20Abi, functionName: \"transfer\", args: [to, value] }] },\n * ];\n * ```\n */\nexport type GaslessBatchCall = GaslessBatchContractCall | GaslessBatchRawCall | GaslessBatchWalletExecute;\n\n/**\n * Whether a batch entry is a GaslessWallet `execute`.\n *\n * @internal\n */\nexport function isGaslessBatchWalletExecute(call: GaslessBatchCall): call is GaslessBatchWalletExecute {\n return \"walletCalls\" in call;\n}\n\n/**\n * The calldata a relayable-write entry runs with — raw `data`, or the named\n * call encoded against its own `abi` or, when it has none, the SDK's ABI for\n * the relayable write of that name.\n *\n * @throws {SymmError} `GASLESS_NOT_RELAYABLE` when a call without an `abi` names no relayable write.\n * @throws Viem's encoding error when the arguments do not encode.\n *\n * @internal\n */\nexport function gaslessBatchCallData(call: GaslessBatchContractCall | GaslessBatchRawCall): Hex {\n if (\"data\" in call) return call.data;\n const abi = call.abi ?? [relayableFunction(call.functionName)];\n return encodeFunctionData({ abi: abi as Abi, functionName: call.functionName, args: call.args });\n}\n\nfunction relayableFunction(functionName: string): AbiFunction {\n const item = GASLESS_RELAYABLE_FUNCTIONS.get(functionName);\n if (!item) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_NOT_RELAYABLE\",\n `Gasless: no relayable write is named \"${functionName}\". A batch carries the writes in GASLESS_RELAYABLE_SELECTORS; run any other call from the GaslessWallet as a \\`walletCalls\\` entry.`,\n );\n }\n return item;\n}\n\n/**\n * The 4-byte selector of a calldata blob, lowercased. Calldata shorter than a\n * selector yields `0x00000000`, which no relayable write uses.\n *\n * @internal\n */\nexport function gaslessCallDataSelector(callData: Hex): Hex {\n return (size(callData) < 4 ? \"0x00000000\" : slice(callData, 0, 4)).toLowerCase() as Hex;\n}\n\n/**\n * The selectors a gasless batch runs — the delegation set a session key must\n * hold to relay it on the batch's account: each relayable write's selector, and\n * for every GaslessWallet entry the wallet-execution sentinel plus each inner\n * call's selector. Lowercased and de-duplicated in first-seen order.\n *\n * Selectors come from the **encoded** calldata, so an overloaded ABI resolves to\n * the function that will actually run.\n *\n * For a mixed-signer batch, pass only the calls the delegate signs. This helper\n * collects selectors without resolving `from`. A `grantDelegation` or\n * `grantDelegations` entry must itself be owner-signed: no delegation makes a\n * grant relayable by a session key.\n *\n * @param calls - The calls signed by the delegate, in any order.\n * @returns The selector set, as `bytes4` hex.\n * @throws Viem's encoding error when an ABI-level call does not encode.\n *\n * @example\n * ```ts\n * await grantDelegation(config, {\n * account: { addr: subAccount, isPartyB: false },\n * delegatedSigner: sessionKey,\n * selectors: getGaslessBatchSelectors(calls),\n * expiryTimestamp,\n * });\n * ```\n */\nexport function getGaslessBatchSelectors(calls: readonly GaslessBatchCall[]): readonly Hex[] {\n const seen = new Set<Hex>();\n const unique: Hex[] = [];\n const add = (selector: Hex) => {\n const normalized = selector.toLowerCase() as Hex;\n if (seen.has(normalized)) return;\n seen.add(normalized);\n unique.push(normalized);\n };\n\n for (const call of calls) {\n if (isGaslessBatchWalletExecute(call)) {\n for (const selector of getGaslessWalletExecuteSelectors(call.walletCalls)) add(selector);\n } else {\n for (const selector of getEffectiveInstantSelectors(gaslessBatchCallData(call))) add(selector);\n }\n }\n\n return unique;\n}\n"],"mappings":";;;;;;AA+FA,SAAgB,EAA4B,GAA2D;CACrG,OAAO,iBAAiB;AAC1B;AAYA,SAAgB,EAAqB,GAA2D;CAG9F,OAFI,UAAU,IAAa,EAAK,OAEzB,EAAmB;EAAO,KADrB,EAAK,OAAO,CAAC,EAAkB,EAAK,YAAY,CAAC;EAChB,cAAc,EAAK;EAAc,MAAM,EAAK;CAAK,CAAC;AACjG;AAEA,SAAS,EAAkB,GAAmC;CAC5D,IAAM,IAAO,EAA4B,IAAI,CAAY;CACzD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,cACA,yBACA,yCAAyC,EAAa,oIACxD;CAEF,OAAO;AACT;AAQA,SAAgB,EAAwB,GAAoB;CAC1D,QAAQ,EAAK,CAAQ,IAAI,IAAI,eAAe,EAAM,GAAU,GAAG,CAAC,GAAG,YAAY;AACjF;AA8BA,SAAgB,EAAyB,GAAoD;CAC3F,IAAM,oBAAO,IAAI,IAAS,GACpB,IAAgB,CAAC,GACjB,KAAO,MAAkB;EAC7B,IAAM,IAAa,EAAS,YAAY;EACpC,EAAK,IAAI,CAAU,MACvB,EAAK,IAAI,CAAU,GACnB,EAAO,KAAK,CAAU;CACxB;CAEA,KAAK,IAAM,KAAQ,GACjB,IAAI,EAA4B,CAAI,GAClC,KAAK,IAAM,KAAY,EAAiC,EAAK,WAAW,GAAG,EAAI,CAAQ;MAEvF,KAAK,IAAM,KAAY,EAA6B,EAAqB,CAAI,CAAC,GAAG,EAAI,CAAQ;CAIjG,OAAO;AACT"}
@@ -15,6 +15,8 @@ export interface ResolvedGaslessInstantEntry {
15
15
  selector: Hex;
16
16
  /** The write's stable workflow label (`"allocate"`, `"initiateWithdraw"`, …). */
17
17
  operationType: string;
18
+ /** The signer the call asked for with `from`; the batch's own signer when absent. */
19
+ from?: Address;
18
20
  }
19
21
  /** A GaslessWallet `execute` entry, encoded. @internal */
20
22
  export interface ResolvedGaslessWalletEntry {
@@ -25,6 +27,8 @@ export interface ResolvedGaslessWalletEntry {
25
27
  callData: Hex;
26
28
  /** The inner calls, for the delegation pre-flight. */
27
29
  walletCalls: readonly GaslessWalletCall[];
30
+ /** The signer requested by this entry; falls back to the batch's signer. */
31
+ from?: Address;
28
32
  }
29
33
  /** One batch entry, resolved and encoded, in relay order. @internal */
30
34
  export type ResolvedGaslessBatchEntry = ResolvedGaslessInstantEntry | ResolvedGaslessWalletEntry;
@@ -76,8 +80,13 @@ export declare function readGaslessBatchWalletTargets(config: Config, parameters
76
80
  }): Promise<Map<bigint, Address>>;
77
81
  /** Everything a batch's operations are built from, besides its entries. @internal */
78
82
  export interface GaslessBatchBuildContext {
79
- /** The EIP-712 signer written into every operation. */
83
+ /** The EIP-712 signer written into every operation without its own entry in `entrySigners`. */
80
84
  signer: Address;
85
+ /**
86
+ * Per-entry signer, aligned with the entries — for a batch that mixes signers.
87
+ * An entry without one is signed by `signer`.
88
+ */
89
+ entrySigners?: readonly (Address | undefined)[];
81
90
  /** The batch's account — every operation's `signerAccount.addr`. */
82
91
  account: Address;
83
92
  /** The signature deadline shared by every operation (unix seconds). */
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-gasless-batch.d.ts","sourceRoot":"","sources":["../../../src/gasless/batch/resolve-gasless-batch.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"resolve-gasless-batch.d.ts","sourceRoot":"","sources":["../../../src/gasless/batch/resolve-gasless-batch.ts"],"names":[],"mappings":"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"}
@@ -1,8 +1,8 @@
1
1
  import { gaslessWalletAbi as e } from "../../symmio-contracts/abi/v0.8.6/gasless-wallet.js";
2
2
  import { SymmError as t } from "../../shared/errors/symm-error.js";
3
3
  import { buildSignedOperation as n } from "../../solvers/instant-open/shared/operations.js";
4
- import { assertGaslessWalletId as r } from "../wallet-id.js";
5
- import { GASLESS_RELAYABLE_WRITES as i } from "../relayable-writes.js";
4
+ import { GASLESS_RELAYABLE_WRITES as r } from "../relayable-writes.js";
5
+ import { assertGaslessWalletId as i } from "../wallet-id.js";
6
6
  import { toWalletCallTuple as a } from "../gasless-wallet-execute/calls.js";
7
7
  import { gaslessBatchCallData as o, gaslessCallDataSelector as s, isGaslessBatchWalletExecute as c } from "./calls.js";
8
8
  import { getGaslessWalletAddress as l } from "../get-gasless-wallet-address/get-gasless-wallet-address.js";
@@ -22,22 +22,24 @@ function h(n, l) {
22
22
  return l.map((l, u) => {
23
23
  if (c(l)) return {
24
24
  type: "wallet",
25
- walletId: r(l.walletId ?? 0n, `calls[${u}].walletId`),
25
+ walletId: i(l.walletId ?? 0n, `calls[${u}].walletId`),
26
26
  callData: d({
27
27
  abi: e,
28
28
  functionName: "execute",
29
29
  args: [l.walletCalls.map(a)]
30
30
  }),
31
- walletCalls: l.walletCalls
31
+ walletCalls: l.walletCalls,
32
+ ...l.from === void 0 ? {} : { from: l.from }
32
33
  };
33
- let f = o(l), p = s(f), h = i.get(p);
34
+ let f = o(l), p = s(f), h = r.get(p);
34
35
  if (!h) throw new t("validation", "GASLESS_NOT_RELAYABLE", `Gasless: calls[${u}] (selector ${p}) is not a relayable write. A batch carries the writes in GASLESS_RELAYABLE_SELECTORS; run any other call from the GaslessWallet as a \`walletCalls\` entry.`);
35
36
  return {
36
37
  type: "instant",
37
38
  target: m(n, h.target),
38
39
  callData: f,
39
40
  selector: p,
40
- operationType: h.operationType
41
+ operationType: h.operationType,
42
+ ...l.from === void 0 ? {} : { from: l.from }
41
43
  };
42
44
  });
43
45
  }
@@ -58,21 +60,21 @@ async function v(e, t) {
58
60
  }
59
61
  function y(e, t) {
60
62
  let r = [], i = [], a = null, o = /* @__PURE__ */ new Map();
61
- for (let s of e) {
62
- let e, c;
63
- if (s.type === "instant") e = s.target, c = (a ?? t.instantNonce) + 1n, a = c, i.push(0n);
63
+ for (let [s, c] of e.entries()) {
64
+ let e, l;
65
+ if (c.type === "instant") e = c.target, l = (a ?? t.instantNonce) + 1n, a = l, i.push(0n);
64
66
  else {
65
- let n = t.walletTargets.get(s.walletId);
66
- if (n === void 0) throw Error(`gasless batch: no wallet address was resolved for wallet id ${s.walletId}.`);
67
- e = n, c = (o.get(s.walletId) ?? t.walletNonces.get(s.walletId) ?? 0n) + 1n, o.set(s.walletId, c), i.push(s.walletId);
67
+ let n = t.walletTargets.get(c.walletId);
68
+ if (n === void 0) throw Error(`gasless batch: no wallet address was resolved for wallet id ${c.walletId}.`);
69
+ e = n, l = (o.get(c.walletId) ?? t.walletNonces.get(c.walletId) ?? 0n) + 1n, o.set(c.walletId, l), i.push(c.walletId);
68
70
  }
69
71
  r.push(n({
70
- signer: t.signer,
72
+ signer: t.entrySigners?.[s] ?? t.signer,
71
73
  target: e,
72
- callData: s.callData,
74
+ callData: c.callData,
73
75
  signerAccount: t.account,
74
76
  deadline: t.deadline,
75
- nonce: c,
77
+ nonce: l,
76
78
  salt: t.salt()
77
79
  }));
78
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-gasless-batch.js","names":[],"sources":["../../../src/gasless/batch/resolve-gasless-batch.ts"],"sourcesContent":["import { encodeFunctionData, type Address, type Hex } from \"viem\";\nimport type { SymmioContractAddresses } from \"../../core/chains/types\";\nimport type { Config } from \"../../core/config\";\nimport { SymmError } from \"../../shared/errors/symm-error\";\nimport { buildSignedOperation } from \"../../solvers/instant-open/shared/operations\";\nimport type { SignedOperation } from \"../../solvers/instant-open/shared/types\";\nimport { gaslessWalletAbi } from \"../../symmio-contracts/abi/v0.8.6/gasless-wallet\";\nimport { toWalletCallTuple, type GaslessWalletCall } from \"../gasless-wallet-execute/calls\";\nimport { GASLESS_WALLET_EXECUTE_OPERATION_TYPE } from \"../gasless-wallet-execute/gasless-wallet-execute\";\nimport { getGaslessWalletAddress } from \"../get-gasless-wallet-address/get-gasless-wallet-address\";\nimport { GASLESS_RELAYABLE_WRITES, type GaslessRelayableTarget } from \"../relayable-writes\";\nimport { assertGaslessWalletId } from \"../wallet-id\";\nimport {\n gaslessBatchCallData,\n gaslessCallDataSelector,\n isGaslessBatchWalletExecute,\n type GaslessBatchCall,\n} from \"./calls\";\n\n/** The label a batch relays under when its entries' own labels do not fit the service's 128 characters. */\nconst GASLESS_BATCH_OPERATION_TYPE = \"gaslessBatch\";\n\n/** The service's limit on an `operationType` label. */\nconst GASLESS_OPERATION_TYPE_MAX_LENGTH = 128;\n\n/** A relayable write, resolved to the contract the InstantLayer calls. @internal */\nexport interface ResolvedGaslessInstantEntry {\n type: \"instant\";\n /** Contract the InstantLayer calls with `callData`. */\n target: Address;\n /** The write's calldata. */\n callData: Hex;\n /** The write's selector, lowercased. */\n selector: Hex;\n /** The write's stable workflow label (`\"allocate\"`, `\"initiateWithdraw\"`, …). */\n operationType: string;\n}\n\n/** A GaslessWallet `execute` entry, encoded. @internal */\nexport interface ResolvedGaslessWalletEntry {\n type: \"wallet\";\n /** The wallet id the entry executes from. */\n walletId: bigint;\n /** `GaslessWallet.execute(calls)` calldata. */\n callData: Hex;\n /** The inner calls, for the delegation pre-flight. */\n walletCalls: readonly GaslessWalletCall[];\n}\n\n/** One batch entry, resolved and encoded, in relay order. @internal */\nexport type ResolvedGaslessBatchEntry = ResolvedGaslessInstantEntry | ResolvedGaslessWalletEntry;\n\nfunction relayableTargetAddress(addresses: SymmioContractAddresses, target: GaslessRelayableTarget): Address {\n switch (target) {\n case \"symmio\":\n return addresses.symmioAddress;\n case \"accountLayer\":\n return addresses.accountLayerAddress;\n case \"instantLayer\":\n return addresses.instantLayerAddress;\n }\n}\n\n/**\n * Encode every batch entry and resolve each relayable write to its contract.\n *\n * Runs before any network call or signature prompt, so a malformed call, an\n * invalid wallet id or a write the relayer cannot carry fails up front.\n *\n * @param addresses - The chain's contract addresses.\n * @param calls - The batch, in relay order.\n * @returns The resolved entries, in the same order.\n * @throws {SymmError} `GASLESS_EMPTY_BATCH` for an empty batch.\n * @throws {SymmError} `GASLESS_NOT_RELAYABLE` for a call whose selector is not a relayable write.\n * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.\n * @throws Viem's encoding error when an ABI-level call does not encode.\n *\n * @internal\n */\nexport function resolveGaslessBatchEntries(\n addresses: SymmioContractAddresses,\n calls: readonly GaslessBatchCall[],\n): ResolvedGaslessBatchEntry[] {\n if (calls.length === 0) {\n throw new SymmError(\"validation\", \"GASLESS_EMPTY_BATCH\", \"Gasless: a batch needs at least one call.\");\n }\n\n return calls.map((call, index): ResolvedGaslessBatchEntry => {\n if (isGaslessBatchWalletExecute(call)) {\n return {\n type: \"wallet\",\n walletId: assertGaslessWalletId(call.walletId ?? 0n, `calls[${index}].walletId`),\n callData: encodeFunctionData({\n abi: gaslessWalletAbi,\n functionName: \"execute\",\n args: [call.walletCalls.map(toWalletCallTuple)],\n }),\n walletCalls: call.walletCalls,\n };\n }\n\n const callData = gaslessBatchCallData(call);\n const selector = gaslessCallDataSelector(callData);\n const write = GASLESS_RELAYABLE_WRITES.get(selector);\n if (!write) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_NOT_RELAYABLE\",\n `Gasless: calls[${index}] (selector ${selector}) is not a relayable write. A batch carries the writes in GASLESS_RELAYABLE_SELECTORS; run any other call from the GaslessWallet as a \\`walletCalls\\` entry.`,\n );\n }\n return {\n type: \"instant\",\n target: relayableTargetAddress(addresses, write.target),\n callData,\n selector,\n operationType: write.operationType,\n };\n });\n}\n\n/**\n * The label a batch relays under by default: its entries' labels joined with\n * `+` (`\"approveOperationalFee+allocate\"`), or `\"gaslessBatch\"` when that exceeds\n * the service's 128 characters.\n *\n * @internal\n */\nexport function defaultGaslessBatchOperationType(entries: readonly ResolvedGaslessBatchEntry[]): string {\n const label = entries\n .map((entry) => (entry.type === \"wallet\" ? GASLESS_WALLET_EXECUTE_OPERATION_TYPE : entry.operationType))\n .join(\"+\");\n return label.length <= GASLESS_OPERATION_TYPE_MAX_LENGTH ? label : GASLESS_BATCH_OPERATION_TYPE;\n}\n\n/**\n * The distinct wallet ids a batch's GaslessWallet entries execute from, in first-seen order.\n *\n * @internal\n */\nexport function distinctGaslessBatchWalletIds(entries: readonly ResolvedGaslessBatchEntry[]): bigint[] {\n return [...new Set(entries.flatMap((entry) => (entry.type === \"wallet\" ? [entry.walletId] : [])))];\n}\n\n/**\n * Read the address of each wallet a batch executes from — the signed `target`\n * of its GaslessWallet entries.\n *\n * @param config - The SDK config.\n * @param parameters - The chain, the wallets' owner, and the distinct wallet ids.\n * @returns Each id's wallet address.\n *\n * @internal\n */\nexport async function readGaslessBatchWalletTargets(\n config: Config,\n parameters: { chainId: number; owner: Address; walletIds: readonly bigint[] },\n): Promise<Map<bigint, Address>> {\n const { chainId, owner, walletIds } = parameters;\n const addresses = await Promise.all(\n walletIds.map((walletId) => getGaslessWalletAddress(config, { chainId, owner, walletId })),\n );\n return new Map(walletIds.map((walletId, index) => [walletId, addresses[index]!]));\n}\n\n/** Everything a batch's operations are built from, besides its entries. @internal */\nexport interface GaslessBatchBuildContext {\n /** The EIP-712 signer written into every operation. */\n signer: Address;\n /** The batch's account — every operation's `signerAccount.addr`. */\n account: Address;\n /** The signature deadline shared by every operation (unix seconds). */\n deadline: bigint;\n /** The InstantLayer nonce the account has consumed; the first relayable write signs `+ 1n`. */\n instantNonce: bigint;\n /** Each wallet id's address — the signed `target` of its entries. */\n walletTargets: ReadonlyMap<bigint, Address>;\n /** Each wallet id's consumed wallet-operation nonce; the first entry on it signs `+ 1n`. Omitted ids start at `0n`. */\n walletNonces: ReadonlyMap<bigint, bigint>;\n /** The replay salt of each operation, called once per operation in order. */\n salt: () => Hex;\n}\n\n/** A batch's operations, ready to sign. @internal */\nexport interface GaslessBatchOperations {\n /** One operation per entry, in relay order. */\n operations: SignedOperation[];\n /** One wallet id per operation — `0n` for every relayable write. */\n walletIds: bigint[];\n /** The highest InstantLayer nonce the batch signs, or `null` when it has no relayable write. */\n lastInstantNonce: bigint | null;\n /** The highest wallet-operation nonce the batch signs on each wallet id. */\n lastWalletNonces: Map<bigint, bigint>;\n}\n\n/**\n * Build a batch's operations with sequential nonces on each stream: the\n * relayable writes count up the account's InstantLayer stream, and each wallet\n * id's entries count up that wallet's own stream.\n *\n * Every operation is the full InstantLayer `SignedOperation` shape — a wallet\n * entry too, with no flex fields and `maxUses` 1, which is how the relay's ABI\n * and wire format carry it. Only its **signature** covers the five-field\n * gateway struct.\n *\n * @internal\n */\nexport function buildGaslessBatchOperations(\n entries: readonly ResolvedGaslessBatchEntry[],\n context: GaslessBatchBuildContext,\n): GaslessBatchOperations {\n const operations: SignedOperation[] = [];\n const walletIds: bigint[] = [];\n let lastInstantNonce: bigint | null = null;\n const lastWalletNonces = new Map<bigint, bigint>();\n\n for (const entry of entries) {\n let target: Address;\n let nonce: bigint;\n if (entry.type === \"instant\") {\n target = entry.target;\n nonce = (lastInstantNonce ?? context.instantNonce) + 1n;\n lastInstantNonce = nonce;\n walletIds.push(0n);\n } else {\n const walletTarget = context.walletTargets.get(entry.walletId);\n if (walletTarget === undefined) {\n throw new Error(`gasless batch: no wallet address was resolved for wallet id ${entry.walletId}.`);\n }\n target = walletTarget;\n nonce = (lastWalletNonces.get(entry.walletId) ?? context.walletNonces.get(entry.walletId) ?? 0n) + 1n;\n lastWalletNonces.set(entry.walletId, nonce);\n walletIds.push(entry.walletId);\n }\n\n operations.push(\n buildSignedOperation({\n signer: context.signer,\n target,\n callData: entry.callData,\n signerAccount: context.account,\n deadline: context.deadline,\n nonce,\n salt: context.salt(),\n }),\n );\n }\n\n return { operations, walletIds, lastInstantNonce, lastWalletNonces };\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAM,IAA+B,gBAG/B,IAAoC;AA6B1C,SAAS,EAAuB,GAAoC,GAAyC;CAC3G,QAAQ,GAAR;EACE,KAAK,UACH,OAAO,EAAU;EACnB,KAAK,gBACH,OAAO,EAAU;EACnB,KAAK,gBACH,OAAO,EAAU;CACrB;AACF;AAkBA,SAAgB,EACd,GACA,GAC6B;CAC7B,IAAI,EAAM,WAAW,GACnB,MAAM,IAAI,EAAU,cAAc,uBAAuB,2CAA2C;CAGtG,OAAO,EAAM,KAAK,GAAM,MAAqC;EAC3D,IAAI,EAA4B,CAAI,GAClC,OAAO;GACL,MAAM;GACN,UAAU,EAAsB,EAAK,YAAY,IAAI,SAAS,EAAM,WAAW;GAC/E,UAAU,EAAmB;IAC3B,KAAK;IACL,cAAc;IACd,MAAM,CAAC,EAAK,YAAY,IAAI,CAAiB,CAAC;GAChD,CAAC;GACD,aAAa,EAAK;EACpB;EAGF,IAAM,IAAW,EAAqB,CAAI,GACpC,IAAW,EAAwB,CAAQ,GAC3C,IAAQ,EAAyB,IAAI,CAAQ;EACnD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,cACA,yBACA,kBAAkB,EAAM,cAAc,EAAS,6JACjD;EAEF,OAAO;GACL,MAAM;GACN,QAAQ,EAAuB,GAAW,EAAM,MAAM;GACtD;GACA;GACA,eAAe,EAAM;EACvB;CACF,CAAC;AACH;AASA,SAAgB,EAAiC,GAAuD;CACtG,IAAM,IAAQ,EACX,KAAK,MAAW,EAAM,SAAS,WAAW,IAAwC,EAAM,aAAc,EACtG,KAAK,GAAG;CACX,OAAO,EAAM,UAAU,IAAoC,IAAQ;AACrE;AAOA,SAAgB,EAA8B,GAAyD;CACrG,OAAO,CAAC,GAAG,IAAI,IAAI,EAAQ,SAAS,MAAW,EAAM,SAAS,WAAW,CAAC,EAAM,QAAQ,IAAI,CAAC,CAAE,CAAC,CAAC;AACnG;AAYA,eAAsB,EACpB,GACA,GAC+B;CAC/B,IAAM,EAAE,YAAS,UAAO,iBAAc,GAChC,IAAY,MAAM,QAAQ,IAC9B,EAAU,KAAK,MAAa,EAAwB,GAAQ;EAAE;EAAS;EAAO;CAAS,CAAC,CAAC,CAC3F;CACA,OAAO,IAAI,IAAI,EAAU,KAAK,GAAU,MAAU,CAAC,GAAU,EAAU,EAAO,CAAC,CAAC;AAClF;AA4CA,SAAgB,EACd,GACA,GACwB;CACxB,IAAM,IAAgC,CAAC,GACjC,IAAsB,CAAC,GACzB,IAAkC,MAChC,oBAAmB,IAAI,IAAoB;CAEjD,KAAK,IAAM,KAAS,GAAS;EAC3B,IAAI,GACA;EACJ,IAAI,EAAM,SAAS,WAIjB,AAHA,IAAS,EAAM,QACf,KAAS,KAAoB,EAAQ,gBAAgB,IACrD,IAAmB,GACnB,EAAU,KAAK,EAAE;OACZ;GACL,IAAM,IAAe,EAAQ,cAAc,IAAI,EAAM,QAAQ;GAC7D,IAAI,MAAiB,KAAA,GACnB,MAAU,MAAM,+DAA+D,EAAM,SAAS,EAAE;GAKlG,AAHA,IAAS,GACT,KAAS,EAAiB,IAAI,EAAM,QAAQ,KAAK,EAAQ,aAAa,IAAI,EAAM,QAAQ,KAAK,MAAM,IACnG,EAAiB,IAAI,EAAM,UAAU,CAAK,GAC1C,EAAU,KAAK,EAAM,QAAQ;EAC/B;EAEA,EAAW,KACT,EAAqB;GACnB,QAAQ,EAAQ;GAChB;GACA,UAAU,EAAM;GAChB,eAAe,EAAQ;GACvB,UAAU,EAAQ;GAClB;GACA,MAAM,EAAQ,KAAK;EACrB,CAAC,CACH;CACF;CAEA,OAAO;EAAE;EAAY;EAAW;EAAkB;CAAiB;AACrE"}
1
+ {"version":3,"file":"resolve-gasless-batch.js","names":[],"sources":["../../../src/gasless/batch/resolve-gasless-batch.ts"],"sourcesContent":["import { encodeFunctionData, type Address, type Hex } from \"viem\";\nimport type { SymmioContractAddresses } from \"../../core/chains/types\";\nimport type { Config } from \"../../core/config\";\nimport { SymmError } from \"../../shared/errors/symm-error\";\nimport { buildSignedOperation } from \"../../solvers/instant-open/shared/operations\";\nimport type { SignedOperation } from \"../../solvers/instant-open/shared/types\";\nimport { gaslessWalletAbi } from \"../../symmio-contracts/abi/v0.8.6/gasless-wallet\";\nimport { toWalletCallTuple, type GaslessWalletCall } from \"../gasless-wallet-execute/calls\";\nimport { GASLESS_WALLET_EXECUTE_OPERATION_TYPE } from \"../gasless-wallet-execute/gasless-wallet-execute\";\nimport { getGaslessWalletAddress } from \"../get-gasless-wallet-address/get-gasless-wallet-address\";\nimport { GASLESS_RELAYABLE_WRITES, type GaslessRelayableTarget } from \"../relayable-writes\";\nimport { assertGaslessWalletId } from \"../wallet-id\";\nimport {\n gaslessBatchCallData,\n gaslessCallDataSelector,\n isGaslessBatchWalletExecute,\n type GaslessBatchCall,\n} from \"./calls\";\n\n/** The label a batch relays under when its entries' own labels do not fit the service's 128 characters. */\nconst GASLESS_BATCH_OPERATION_TYPE = \"gaslessBatch\";\n\n/** The service's limit on an `operationType` label. */\nconst GASLESS_OPERATION_TYPE_MAX_LENGTH = 128;\n\n/** A relayable write, resolved to the contract the InstantLayer calls. @internal */\nexport interface ResolvedGaslessInstantEntry {\n type: \"instant\";\n /** Contract the InstantLayer calls with `callData`. */\n target: Address;\n /** The write's calldata. */\n callData: Hex;\n /** The write's selector, lowercased. */\n selector: Hex;\n /** The write's stable workflow label (`\"allocate\"`, `\"initiateWithdraw\"`, …). */\n operationType: string;\n /** The signer the call asked for with `from`; the batch's own signer when absent. */\n from?: Address;\n}\n\n/** A GaslessWallet `execute` entry, encoded. @internal */\nexport interface ResolvedGaslessWalletEntry {\n type: \"wallet\";\n /** The wallet id the entry executes from. */\n walletId: bigint;\n /** `GaslessWallet.execute(calls)` calldata. */\n callData: Hex;\n /** The inner calls, for the delegation pre-flight. */\n walletCalls: readonly GaslessWalletCall[];\n /** The signer requested by this entry; falls back to the batch's signer. */\n from?: Address;\n}\n\n/** One batch entry, resolved and encoded, in relay order. @internal */\nexport type ResolvedGaslessBatchEntry = ResolvedGaslessInstantEntry | ResolvedGaslessWalletEntry;\n\nfunction relayableTargetAddress(addresses: SymmioContractAddresses, target: GaslessRelayableTarget): Address {\n switch (target) {\n case \"symmio\":\n return addresses.symmioAddress;\n case \"accountLayer\":\n return addresses.accountLayerAddress;\n case \"instantLayer\":\n return addresses.instantLayerAddress;\n }\n}\n\n/**\n * Encode every batch entry and resolve each relayable write to its contract.\n *\n * Runs before any network call or signature prompt, so a malformed call, an\n * invalid wallet id or a write the relayer cannot carry fails up front.\n *\n * @param addresses - The chain's contract addresses.\n * @param calls - The batch, in relay order.\n * @returns The resolved entries, in the same order.\n * @throws {SymmError} `GASLESS_EMPTY_BATCH` for an empty batch.\n * @throws {SymmError} `GASLESS_NOT_RELAYABLE` for a call whose selector is not a relayable write.\n * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.\n * @throws Viem's encoding error when an ABI-level call does not encode.\n *\n * @internal\n */\nexport function resolveGaslessBatchEntries(\n addresses: SymmioContractAddresses,\n calls: readonly GaslessBatchCall[],\n): ResolvedGaslessBatchEntry[] {\n if (calls.length === 0) {\n throw new SymmError(\"validation\", \"GASLESS_EMPTY_BATCH\", \"Gasless: a batch needs at least one call.\");\n }\n\n return calls.map((call, index): ResolvedGaslessBatchEntry => {\n if (isGaslessBatchWalletExecute(call)) {\n return {\n type: \"wallet\",\n walletId: assertGaslessWalletId(call.walletId ?? 0n, `calls[${index}].walletId`),\n callData: encodeFunctionData({\n abi: gaslessWalletAbi,\n functionName: \"execute\",\n args: [call.walletCalls.map(toWalletCallTuple)],\n }),\n walletCalls: call.walletCalls,\n ...(call.from !== undefined ? { from: call.from } : {}),\n };\n }\n\n const callData = gaslessBatchCallData(call);\n const selector = gaslessCallDataSelector(callData);\n const write = GASLESS_RELAYABLE_WRITES.get(selector);\n if (!write) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_NOT_RELAYABLE\",\n `Gasless: calls[${index}] (selector ${selector}) is not a relayable write. A batch carries the writes in GASLESS_RELAYABLE_SELECTORS; run any other call from the GaslessWallet as a \\`walletCalls\\` entry.`,\n );\n }\n return {\n type: \"instant\",\n target: relayableTargetAddress(addresses, write.target),\n callData,\n selector,\n operationType: write.operationType,\n ...(call.from !== undefined ? { from: call.from } : {}),\n };\n });\n}\n\n/**\n * The label a batch relays under by default: its entries' labels joined with\n * `+` (`\"approveOperationalFee+allocate\"`), or `\"gaslessBatch\"` when that exceeds\n * the service's 128 characters.\n *\n * @internal\n */\nexport function defaultGaslessBatchOperationType(entries: readonly ResolvedGaslessBatchEntry[]): string {\n const label = entries\n .map((entry) => (entry.type === \"wallet\" ? GASLESS_WALLET_EXECUTE_OPERATION_TYPE : entry.operationType))\n .join(\"+\");\n return label.length <= GASLESS_OPERATION_TYPE_MAX_LENGTH ? label : GASLESS_BATCH_OPERATION_TYPE;\n}\n\n/**\n * The distinct wallet ids a batch's GaslessWallet entries execute from, in first-seen order.\n *\n * @internal\n */\nexport function distinctGaslessBatchWalletIds(entries: readonly ResolvedGaslessBatchEntry[]): bigint[] {\n return [...new Set(entries.flatMap((entry) => (entry.type === \"wallet\" ? [entry.walletId] : [])))];\n}\n\n/**\n * Read the address of each wallet a batch executes from — the signed `target`\n * of its GaslessWallet entries.\n *\n * @param config - The SDK config.\n * @param parameters - The chain, the wallets' owner, and the distinct wallet ids.\n * @returns Each id's wallet address.\n *\n * @internal\n */\nexport async function readGaslessBatchWalletTargets(\n config: Config,\n parameters: { chainId: number; owner: Address; walletIds: readonly bigint[] },\n): Promise<Map<bigint, Address>> {\n const { chainId, owner, walletIds } = parameters;\n const addresses = await Promise.all(\n walletIds.map((walletId) => getGaslessWalletAddress(config, { chainId, owner, walletId })),\n );\n return new Map(walletIds.map((walletId, index) => [walletId, addresses[index]!]));\n}\n\n/** Everything a batch's operations are built from, besides its entries. @internal */\nexport interface GaslessBatchBuildContext {\n /** The EIP-712 signer written into every operation without its own entry in `entrySigners`. */\n signer: Address;\n /**\n * Per-entry signer, aligned with the entries — for a batch that mixes signers.\n * An entry without one is signed by `signer`.\n */\n entrySigners?: readonly (Address | undefined)[];\n /** The batch's account — every operation's `signerAccount.addr`. */\n account: Address;\n /** The signature deadline shared by every operation (unix seconds). */\n deadline: bigint;\n /** The InstantLayer nonce the account has consumed; the first relayable write signs `+ 1n`. */\n instantNonce: bigint;\n /** Each wallet id's address — the signed `target` of its entries. */\n walletTargets: ReadonlyMap<bigint, Address>;\n /** Each wallet id's consumed wallet-operation nonce; the first entry on it signs `+ 1n`. Omitted ids start at `0n`. */\n walletNonces: ReadonlyMap<bigint, bigint>;\n /** The replay salt of each operation, called once per operation in order. */\n salt: () => Hex;\n}\n\n/** A batch's operations, ready to sign. @internal */\nexport interface GaslessBatchOperations {\n /** One operation per entry, in relay order. */\n operations: SignedOperation[];\n /** One wallet id per operation — `0n` for every relayable write. */\n walletIds: bigint[];\n /** The highest InstantLayer nonce the batch signs, or `null` when it has no relayable write. */\n lastInstantNonce: bigint | null;\n /** The highest wallet-operation nonce the batch signs on each wallet id. */\n lastWalletNonces: Map<bigint, bigint>;\n}\n\n/**\n * Build a batch's operations with sequential nonces on each stream: the\n * relayable writes count up the account's InstantLayer stream, and each wallet\n * id's entries count up that wallet's own stream.\n *\n * Every operation is the full InstantLayer `SignedOperation` shape — a wallet\n * entry too, with no flex fields and `maxUses` 1, which is how the relay's ABI\n * and wire format carry it. Only its **signature** covers the five-field\n * gateway struct.\n *\n * @internal\n */\nexport function buildGaslessBatchOperations(\n entries: readonly ResolvedGaslessBatchEntry[],\n context: GaslessBatchBuildContext,\n): GaslessBatchOperations {\n const operations: SignedOperation[] = [];\n const walletIds: bigint[] = [];\n let lastInstantNonce: bigint | null = null;\n const lastWalletNonces = new Map<bigint, bigint>();\n\n for (const [index, entry] of entries.entries()) {\n let target: Address;\n let nonce: bigint;\n if (entry.type === \"instant\") {\n target = entry.target;\n nonce = (lastInstantNonce ?? context.instantNonce) + 1n;\n lastInstantNonce = nonce;\n walletIds.push(0n);\n } else {\n const walletTarget = context.walletTargets.get(entry.walletId);\n if (walletTarget === undefined) {\n throw new Error(`gasless batch: no wallet address was resolved for wallet id ${entry.walletId}.`);\n }\n target = walletTarget;\n nonce = (lastWalletNonces.get(entry.walletId) ?? context.walletNonces.get(entry.walletId) ?? 0n) + 1n;\n lastWalletNonces.set(entry.walletId, nonce);\n walletIds.push(entry.walletId);\n }\n\n operations.push(\n buildSignedOperation({\n signer: context.entrySigners?.[index] ?? context.signer,\n target,\n callData: entry.callData,\n signerAccount: context.account,\n deadline: context.deadline,\n nonce,\n salt: context.salt(),\n }),\n );\n }\n\n return { operations, walletIds, lastInstantNonce, lastWalletNonces };\n}\n"],"mappings":"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"}
@@ -23,7 +23,9 @@ import { Abi, DecodeErrorResultReturnType, Hex } from 'viem';
23
23
  * settlement minimum, or the funds are not visible yet.
24
24
  * - `"deposit-not-above-fees"` — the balance clears the minimum but not the
25
25
  * deposit and wallet-creation fees.
26
- * - `"idempotency-conflict"` — the key belongs to another workflow; mint a new one.
26
+ * - `"idempotency-conflict"` — a `409 IDEMPOTENCY_KEY_CONFLICT`, a safeguard:
27
+ * the current service never sends it. The action is unresolved; keep it
28
+ * pending and reconcile it, and never resend it under a new key.
27
29
  * - `"client-schema"` — a `422`: the payload's shape is wrong. A client bug.
28
30
  * - `"rate-limited"` / `"unauthorized"` / `"forbidden"` / `"unknown-instance"` /
29
31
  * `"gateway-unavailable"` — the gateway answered, before any service saw it.
@@ -1 +1 @@
1
- {"version":3,"file":"classify-gasless-failure.d.ts","sourceRoot":"","sources":["../../src/gasless/classify-gasless-failure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,GAAG,EAAE,KAAK,2BAA2B,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAM/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,oBAAoB,GAC5B,eAAe,GACf,eAAe,GACf,YAAY,GACZ,WAAW,GACX,kBAAkB,GAClB,mBAAmB,GACnB,uBAAuB,GACvB,wBAAwB,GACxB,sBAAsB,GACtB,eAAe,GACf,cAAc,GACd,cAAc,GACd,WAAW,GACX,kBAAkB,GAClB,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,SAAS,CAAC;AAyEd;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAkBzE;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,UAAU,EAAE,GAAG,CAAC;IAChB,sEAAsE;IACtE,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,8BAA8B,GAAG,IAAI,CAY3G"}
1
+ {"version":3,"file":"classify-gasless-failure.d.ts","sourceRoot":"","sources":["../../src/gasless/classify-gasless-failure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,GAAG,EAAE,KAAK,2BAA2B,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAM/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,MAAM,oBAAoB,GAC5B,eAAe,GACf,eAAe,GACf,YAAY,GACZ,WAAW,GACX,kBAAkB,GAClB,mBAAmB,GACnB,uBAAuB,GACvB,wBAAwB,GACxB,sBAAsB,GACtB,eAAe,GACf,cAAc,GACd,cAAc,GACd,WAAW,GACX,kBAAkB,GAClB,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,SAAS,CAAC;AAyEd;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAkBzE;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,UAAU,EAAE,GAAG,CAAC;IAChB,sEAAsE;IACtE,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,8BAA8B,GAAG,IAAI,CAY3G"}
@@ -1,7 +1,7 @@
1
1
  import { gaslessRevertText as e, parseGaslessErrorDetail as t } from "./errors.js";
2
- import { getGaslessUnconfirmedSubmit as n, isGaslessIdempotencyConflictError as r } from "./unconfirmed-submit.js";
3
- import { classifyGaslessHttpStatus as i } from "./http.js";
4
- import { isGaslessFreeQuotaExhaustedError as a } from "./get-gasless-fee-quote/fee-quote-errors.js";
2
+ import { isGaslessFreeQuotaExhaustedError as n } from "./get-gasless-fee-quote/fee-quote-errors.js";
3
+ import { getGaslessUnconfirmedSubmit as r, isGaslessIdempotencyConflictError as i } from "./unconfirmed-submit.js";
4
+ import { classifyGaslessHttpStatus as a } from "./http.js";
5
5
  import { decodeErrorResult as o } from "viem";
6
6
  //#region src/gasless/classify-gasless-failure.ts
7
7
  function s(e) {
@@ -17,7 +17,7 @@ function c(e) {
17
17
  }
18
18
  }
19
19
  function l(e) {
20
- switch (i(e)) {
20
+ switch (a(e)) {
21
21
  case "rate-limited": return "rate-limited";
22
22
  case "unauthorized": return "unauthorized";
23
23
  case "forbidden": return "forbidden";
@@ -29,12 +29,12 @@ function l(e) {
29
29
  default: return null;
30
30
  }
31
31
  }
32
- function u(i) {
33
- if (n(i) !== null) return "submit-unconfirmed";
34
- if (r(i)) return "idempotency-conflict";
35
- if (a(i)) return "free-quota";
36
- let o = t(i);
37
- return s(e(o)) || (o?.failedOperation ? "failed-operation" : c(o?.code ?? null) || l(i) || (o?.code === "SIMULATION_REVERTED" ? "simulation-reverted" : "unknown"));
32
+ function u(a) {
33
+ if (r(a) !== null) return "submit-unconfirmed";
34
+ if (i(a)) return "idempotency-conflict";
35
+ if (n(a)) return "free-quota";
36
+ let o = t(a);
37
+ return s(e(o)) || (o?.failedOperation ? "failed-operation" : c(o?.code ?? null) || l(a) || (o?.code === "SIMULATION_REVERTED" ? "simulation-reverted" : "unknown"));
38
38
  }
39
39
  function d(e, n) {
40
40
  let r = t(e)?.failedOperation;
@@ -1 +1 @@
1
- {"version":3,"file":"classify-gasless-failure.js","names":[],"sources":["../../src/gasless/classify-gasless-failure.ts"],"sourcesContent":["import { decodeErrorResult, type Abi, type DecodeErrorResultReturnType, type Hex } from \"viem\";\nimport { gaslessRevertText, parseGaslessErrorDetail } from \"./errors\";\nimport { isGaslessFreeQuotaExhaustedError } from \"./get-gasless-fee-quote/fee-quote-errors\";\nimport { classifyGaslessHttpStatus } from \"./http\";\nimport { getGaslessUnconfirmedSubmit, isGaslessIdempotencyConflictError } from \"./unconfirmed-submit\";\n\n/**\n * Why a gasless action failed, in terms of what a UI can do about it.\n *\n * Deliberately coarser than the vendor's codes and finer than the HTTP status:\n * `INSUFFICIENT_ALLOWANCE` and an `OperationalFee: Allowance exceeded` revert\n * are the same problem with two wire shapes, while a `404` for an unknown\n * instance and a `404` for an unknown request id are not the same problem at\n * all.\n *\n * - `\"payer-balance\"` — the billing account cannot cover the fee. Top up its\n * SYMMIO collateral; raising the allowance alone does nothing.\n * - `\"fee-allowance\"` — the payer's operational-fee allowance is too low.\n * Approve more with `approveOperationalFee`, then re-read.\n * - `\"free-quota\"` — the daily free-operations quota is spent and the\n * deployment refuses paid ones. Wait for the UTC reset or use the wallet.\n * - `\"fee-limit\"` — the fee policy refused the request for any other reason.\n * - `\"failed-operation\"` — one entry of the batch reverted; decode it with\n * {@link decodeGaslessOperationFailure} to name the real cause.\n * - `\"nonce-or-deadline\"` — the signature is stale. Refresh the nonce and\n * deadline and ask for a new one; never resend the old payload.\n * - `\"deposit-below-minimum\"` — the deposit address holds less than the\n * settlement minimum, or the funds are not visible yet.\n * - `\"deposit-not-above-fees\"` — the balance clears the minimum but not the\n * deposit and wallet-creation fees.\n * - `\"idempotency-conflict\"` — the key belongs to another workflow; mint a new one.\n * - `\"client-schema\"` — a `422`: the payload's shape is wrong. A client bug.\n * - `\"rate-limited\"` / `\"unauthorized\"` / `\"forbidden\"` / `\"unknown-instance\"` /\n * `\"gateway-unavailable\"` — the gateway answered, before any service saw it.\n * - `\"submit-unconfirmed\"` — the outcome is unknown and the request may be\n * executing. Replay it with `resubmitGaslessRequest`; never re-run the intent.\n * - `\"simulation-reverted\"` — the service simulated the batch and it reverted\n * for a reason none of the above explains. Rebuild and re-sign.\n * - `\"unknown\"` — nothing classified it.\n */\nexport type GaslessFailureReason =\n | \"payer-balance\"\n | \"fee-allowance\"\n | \"free-quota\"\n | \"fee-limit\"\n | \"failed-operation\"\n | \"nonce-or-deadline\"\n | \"deposit-below-minimum\"\n | \"deposit-not-above-fees\"\n | \"idempotency-conflict\"\n | \"client-schema\"\n | \"rate-limited\"\n | \"unauthorized\"\n | \"forbidden\"\n | \"unknown-instance\"\n | \"gateway-unavailable\"\n | \"submit-unconfirmed\"\n | \"simulation-reverted\"\n | \"unknown\";\n\n/**\n * Map a revert the service decoded onto a reason, when one of the contract's\n * own error names or require-strings is unambiguous about the cause.\n *\n * The error names come from the perps-core 0.8.6 GaslessLayer and InstantLayer\n * ABIs. The `\"OperationalFee: …\"` strings are not theirs — they are SymmioCore's\n * own `LibOperationalFee` require messages, raised when the GaslessLayer charges\n * the payer (the same ones `approveOperationalFee` documents), and they reach the\n * SDK through the service's simulation of the batch.\n */\nfunction reasonFromRevert(text: string): GaslessFailureReason | null {\n if (text.includes(\"DailyFreeOpsLimitExceeded\")) return \"free-quota\";\n if (text.includes(\"OperationalFee: Insufficient balance\")) return \"payer-balance\";\n if (text.includes(\"OperationalFee: Allowance\") || text.includes(\"OperationalFee: Insufficient allowance\")) {\n return \"fee-allowance\";\n }\n if (text.includes(\"FeeLimitExceeded\") || text.includes(\"OperationalFee:\")) return \"fee-limit\";\n if (text.includes(\"DepositAmountBelowMinimum\")) return \"deposit-below-minimum\";\n if (text.includes(\"DepositAmountNotAboveFees\") || text.includes(\"MinimumDepositNotAboveFee\")) {\n return \"deposit-not-above-fees\";\n }\n if (\n text.includes(\"InvalidNonce\") ||\n text.includes(\"DeadlineExpired\") ||\n text.includes(\"WalletOperationExpired\") ||\n text.includes(\"WalletOperationInvalidNonce\") ||\n text.includes(\"NativeGasTopUpNonceMismatch\")\n ) {\n return \"nonce-or-deadline\";\n }\n return null;\n}\n\n/** Map a vendor `detail.code` onto a reason, where the code alone decides. */\nfunction reasonFromVendorCode(code: string | null): GaslessFailureReason | null {\n switch (code) {\n case \"IDEMPOTENCY_KEY_CONFLICT\":\n return \"idempotency-conflict\";\n case \"INSUFFICIENT_ALLOWANCE\":\n return \"fee-allowance\";\n case \"FEE_POLICY_WOULD_REVERT\":\n return \"fee-limit\";\n case \"DEPOSIT_BELOW_MINIMUM\":\n return \"deposit-below-minimum\";\n default:\n return null;\n }\n}\n\n/** Map the gateway's own answer onto a reason. */\nfunction reasonFromHttpStatus(err: unknown): GaslessFailureReason | null {\n switch (classifyGaslessHttpStatus(err)) {\n case \"rate-limited\":\n return \"rate-limited\";\n case \"unauthorized\":\n return \"unauthorized\";\n case \"forbidden\":\n return \"forbidden\";\n case \"unknown-instance\":\n case \"selector-conflict\":\n return \"unknown-instance\";\n case \"client-schema\":\n return \"client-schema\";\n case \"gateway-not-ready\":\n case \"ambiguous\":\n return \"gateway-unavailable\";\n default:\n return null;\n }\n}\n\n/**\n * Classify any gasless failure into the one reason a UI should act on.\n *\n * The order is deliberate: what the request *did* (unconfirmed, conflicting)\n * outranks what the service *said*, which outranks what the gateway answered —\n * a `400 SIMULATION_REVERTED` whose revert names an allowance shortfall is an\n * allowance problem, not a \"bad request\".\n *\n * Works on the error a framework layer re-wrapped too, so a React hook's\n * `SymmioRequestError` classifies exactly like the `SymmApiError` under it.\n *\n * @param err - Anything caught from a gasless action, or a polled record error.\n * @returns The reason, or `\"unknown\"` when nothing identifies it.\n *\n * @example\n * ```ts\n * switch (classifyGaslessFailure(err)) {\n * case \"fee-allowance\":\n * return showApproveOperationalFee();\n * case \"submit-unconfirmed\":\n * return showReconcilePending(getGaslessUnconfirmedSubmit(err));\n * default:\n * return showDiagnostics(parseGaslessErrorDetail(err));\n * }\n * ```\n */\nexport function classifyGaslessFailure(err: unknown): GaslessFailureReason {\n if (getGaslessUnconfirmedSubmit(err) !== null) return \"submit-unconfirmed\";\n if (isGaslessIdempotencyConflictError(err)) return \"idempotency-conflict\";\n /** Thrown by the fee pre-flight, before any HTTP call and with no vendor detail. */\n if (isGaslessFreeQuotaExhaustedError(err)) return \"free-quota\";\n\n const detail = parseGaslessErrorDetail(err);\n const fromRevert = reasonFromRevert(gaslessRevertText(detail));\n if (fromRevert) return fromRevert;\n if (detail?.failedOperation) return \"failed-operation\";\n\n const fromCode = reasonFromVendorCode(detail?.code ?? null);\n if (fromCode) return fromCode;\n\n const fromStatus = reasonFromHttpStatus(err);\n if (fromStatus) return fromStatus;\n\n return detail?.code === \"SIMULATION_REVERTED\" ? \"simulation-reverted\" : \"unknown\";\n}\n\n/**\n * The failing batch entry of an `OperationFailed` revert, with its inner revert\n * decoded against the ABI you supplied.\n */\nexport interface GaslessDecodedOperationFailure {\n /** Zero-based position of the failing operation in the submitted batch. */\n index: number;\n /** The inner revert data, exactly as the service reported it. */\n revertData: Hex;\n /** The decoded error, or `null` when the ABI does not describe it. */\n decoded: DecodeErrorResultReturnType | null;\n}\n\n/**\n * Identify the batch entry that reverted, and decode its inner revert.\n *\n * A relayed batch is atomic, so the InstantLayer reports an inner failure as\n * `OperationFailed(operationIndex, revertData)` — which names a position, not a\n * cause. Decoding `revertData` against the ABI of the contract that operation\n * targeted turns it back into the error the user can act on\n * (`InvalidNameLength`, `InsufficientBalance`, …).\n *\n * @param err - Anything caught from a gasless submit.\n * @param abi - ABI of the contract the failing operation targeted.\n * @returns The index, the raw revert data and the decoded error, or `null` when\n * the failure was not an `OperationFailed`.\n *\n * @example\n * ```ts\n * const failure = decodeGaslessOperationFailure(err, accountLayerAbi);\n * if (failure) {\n * console.error(`operation ${failure.index} reverted:`, failure.decoded?.errorName ?? failure.revertData);\n * }\n * ```\n */\nexport function decodeGaslessOperationFailure(err: unknown, abi: Abi): GaslessDecodedOperationFailure | null {\n const failed = parseGaslessErrorDetail(err)?.failedOperation;\n if (!failed) return null;\n\n let decoded: DecodeErrorResultReturnType | null = null;\n try {\n decoded = decodeErrorResult({ abi, data: failed.revertData });\n } catch {\n /** An ABI that does not describe this error is a caller mistake, not a reason to lose the index. */\n decoded = null;\n }\n return { index: failed.index, revertData: failed.revertData, decoded };\n}\n"],"mappings":";;;;;;AAsEA,SAAS,EAAiB,GAA2C;CAoBnE,OAnBI,EAAK,SAAS,2BAA2B,IAAU,eACnD,EAAK,SAAS,sCAAsC,IAAU,kBAC9D,EAAK,SAAS,2BAA2B,KAAK,EAAK,SAAS,wCAAwC,IAC/F,kBAEL,EAAK,SAAS,kBAAkB,KAAK,EAAK,SAAS,iBAAiB,IAAU,cAC9E,EAAK,SAAS,2BAA2B,IAAU,0BACnD,EAAK,SAAS,2BAA2B,KAAK,EAAK,SAAS,2BAA2B,IAClF,2BAGP,EAAK,SAAS,cAAc,KAC5B,EAAK,SAAS,iBAAiB,KAC/B,EAAK,SAAS,wBAAwB,KACtC,EAAK,SAAS,6BAA6B,KAC3C,EAAK,SAAS,6BAA6B,IAEpC,sBAEF;AACT;AAGA,SAAS,EAAqB,GAAkD;CAC9E,QAAQ,GAAR;EACE,KAAK,4BACH,OAAO;EACT,KAAK,0BACH,OAAO;EACT,KAAK,2BACH,OAAO;EACT,KAAK,yBACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAGA,SAAS,EAAqB,GAA2C;CACvE,QAAQ,EAA0B,CAAG,GAArC;EACE,KAAK,gBACH,OAAO;EACT,KAAK,gBACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK;EACL,KAAK,qBACH,OAAO;EACT,KAAK,iBACH,OAAO;EACT,KAAK;EACL,KAAK,aACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AA4BA,SAAgB,EAAuB,GAAoC;CACzE,IAAI,EAA4B,CAAG,MAAM,MAAM,OAAO;CACtD,IAAI,EAAkC,CAAG,GAAG,OAAO;CAEnD,IAAI,EAAiC,CAAG,GAAG,OAAO;CAElD,IAAM,IAAS,EAAwB,CAAG;CAW1C,OAVmB,EAAiB,EAAkB,CAAM,CACxD,MACA,GAAQ,kBAAwB,qBAEnB,EAAqB,GAAQ,QAAQ,IAClD,KAEe,EAAqB,CACpC,MAEG,GAAQ,SAAS,wBAAwB,wBAAwB;AAC1E;AAqCA,SAAgB,EAA8B,GAAc,GAAiD;CAC3G,IAAM,IAAS,EAAwB,CAAG,GAAG;CAC7C,IAAI,CAAC,GAAQ,OAAO;CAEpB,IAAI,IAA8C;CAClD,IAAI;EACF,IAAU,EAAkB;GAAE;GAAK,MAAM,EAAO;EAAW,CAAC;CAC9D,QAAQ;EAEN,IAAU;CACZ;CACA,OAAO;EAAE,OAAO,EAAO;EAAO,YAAY,EAAO;EAAY;CAAQ;AACvE"}
1
+ {"version":3,"file":"classify-gasless-failure.js","names":[],"sources":["../../src/gasless/classify-gasless-failure.ts"],"sourcesContent":["import { decodeErrorResult, type Abi, type DecodeErrorResultReturnType, type Hex } from \"viem\";\nimport { gaslessRevertText, parseGaslessErrorDetail } from \"./errors\";\nimport { isGaslessFreeQuotaExhaustedError } from \"./get-gasless-fee-quote/fee-quote-errors\";\nimport { classifyGaslessHttpStatus } from \"./http\";\nimport { getGaslessUnconfirmedSubmit, isGaslessIdempotencyConflictError } from \"./unconfirmed-submit\";\n\n/**\n * Why a gasless action failed, in terms of what a UI can do about it.\n *\n * Deliberately coarser than the vendor's codes and finer than the HTTP status:\n * `INSUFFICIENT_ALLOWANCE` and an `OperationalFee: Allowance exceeded` revert\n * are the same problem with two wire shapes, while a `404` for an unknown\n * instance and a `404` for an unknown request id are not the same problem at\n * all.\n *\n * - `\"payer-balance\"` — the billing account cannot cover the fee. Top up its\n * SYMMIO collateral; raising the allowance alone does nothing.\n * - `\"fee-allowance\"` — the payer's operational-fee allowance is too low.\n * Approve more with `approveOperationalFee`, then re-read.\n * - `\"free-quota\"` — the daily free-operations quota is spent and the\n * deployment refuses paid ones. Wait for the UTC reset or use the wallet.\n * - `\"fee-limit\"` — the fee policy refused the request for any other reason.\n * - `\"failed-operation\"` — one entry of the batch reverted; decode it with\n * {@link decodeGaslessOperationFailure} to name the real cause.\n * - `\"nonce-or-deadline\"` — the signature is stale. Refresh the nonce and\n * deadline and ask for a new one; never resend the old payload.\n * - `\"deposit-below-minimum\"` — the deposit address holds less than the\n * settlement minimum, or the funds are not visible yet.\n * - `\"deposit-not-above-fees\"` — the balance clears the minimum but not the\n * deposit and wallet-creation fees.\n * - `\"idempotency-conflict\"` — a `409 IDEMPOTENCY_KEY_CONFLICT`, a safeguard:\n * the current service never sends it. The action is unresolved; keep it\n * pending and reconcile it, and never resend it under a new key.\n * - `\"client-schema\"` — a `422`: the payload's shape is wrong. A client bug.\n * - `\"rate-limited\"` / `\"unauthorized\"` / `\"forbidden\"` / `\"unknown-instance\"` /\n * `\"gateway-unavailable\"` — the gateway answered, before any service saw it.\n * - `\"submit-unconfirmed\"` — the outcome is unknown and the request may be\n * executing. Replay it with `resubmitGaslessRequest`; never re-run the intent.\n * - `\"simulation-reverted\"` — the service simulated the batch and it reverted\n * for a reason none of the above explains. Rebuild and re-sign.\n * - `\"unknown\"` — nothing classified it.\n */\nexport type GaslessFailureReason =\n | \"payer-balance\"\n | \"fee-allowance\"\n | \"free-quota\"\n | \"fee-limit\"\n | \"failed-operation\"\n | \"nonce-or-deadline\"\n | \"deposit-below-minimum\"\n | \"deposit-not-above-fees\"\n | \"idempotency-conflict\"\n | \"client-schema\"\n | \"rate-limited\"\n | \"unauthorized\"\n | \"forbidden\"\n | \"unknown-instance\"\n | \"gateway-unavailable\"\n | \"submit-unconfirmed\"\n | \"simulation-reverted\"\n | \"unknown\";\n\n/**\n * Map a revert the service decoded onto a reason, when one of the contract's\n * own error names or require-strings is unambiguous about the cause.\n *\n * The error names come from the perps-core 0.8.6 GaslessLayer and InstantLayer\n * ABIs. The `\"OperationalFee: …\"` strings are not theirs — they are SymmioCore's\n * own `LibOperationalFee` require messages, raised when the GaslessLayer charges\n * the payer (the same ones `approveOperationalFee` documents), and they reach the\n * SDK through the service's simulation of the batch.\n */\nfunction reasonFromRevert(text: string): GaslessFailureReason | null {\n if (text.includes(\"DailyFreeOpsLimitExceeded\")) return \"free-quota\";\n if (text.includes(\"OperationalFee: Insufficient balance\")) return \"payer-balance\";\n if (text.includes(\"OperationalFee: Allowance\") || text.includes(\"OperationalFee: Insufficient allowance\")) {\n return \"fee-allowance\";\n }\n if (text.includes(\"FeeLimitExceeded\") || text.includes(\"OperationalFee:\")) return \"fee-limit\";\n if (text.includes(\"DepositAmountBelowMinimum\")) return \"deposit-below-minimum\";\n if (text.includes(\"DepositAmountNotAboveFees\") || text.includes(\"MinimumDepositNotAboveFee\")) {\n return \"deposit-not-above-fees\";\n }\n if (\n text.includes(\"InvalidNonce\") ||\n text.includes(\"DeadlineExpired\") ||\n text.includes(\"WalletOperationExpired\") ||\n text.includes(\"WalletOperationInvalidNonce\") ||\n text.includes(\"NativeGasTopUpNonceMismatch\")\n ) {\n return \"nonce-or-deadline\";\n }\n return null;\n}\n\n/** Map a vendor `detail.code` onto a reason, where the code alone decides. */\nfunction reasonFromVendorCode(code: string | null): GaslessFailureReason | null {\n switch (code) {\n case \"IDEMPOTENCY_KEY_CONFLICT\":\n return \"idempotency-conflict\";\n case \"INSUFFICIENT_ALLOWANCE\":\n return \"fee-allowance\";\n case \"FEE_POLICY_WOULD_REVERT\":\n return \"fee-limit\";\n case \"DEPOSIT_BELOW_MINIMUM\":\n return \"deposit-below-minimum\";\n default:\n return null;\n }\n}\n\n/** Map the gateway's own answer onto a reason. */\nfunction reasonFromHttpStatus(err: unknown): GaslessFailureReason | null {\n switch (classifyGaslessHttpStatus(err)) {\n case \"rate-limited\":\n return \"rate-limited\";\n case \"unauthorized\":\n return \"unauthorized\";\n case \"forbidden\":\n return \"forbidden\";\n case \"unknown-instance\":\n case \"selector-conflict\":\n return \"unknown-instance\";\n case \"client-schema\":\n return \"client-schema\";\n case \"gateway-not-ready\":\n case \"ambiguous\":\n return \"gateway-unavailable\";\n default:\n return null;\n }\n}\n\n/**\n * Classify any gasless failure into the one reason a UI should act on.\n *\n * The order is deliberate: what the request *did* (unconfirmed, conflicting)\n * outranks what the service *said*, which outranks what the gateway answered —\n * a `400 SIMULATION_REVERTED` whose revert names an allowance shortfall is an\n * allowance problem, not a \"bad request\".\n *\n * Works on the error a framework layer re-wrapped too, so a React hook's\n * `SymmioRequestError` classifies exactly like the `SymmApiError` under it.\n *\n * @param err - Anything caught from a gasless action, or a polled record error.\n * @returns The reason, or `\"unknown\"` when nothing identifies it.\n *\n * @example\n * ```ts\n * switch (classifyGaslessFailure(err)) {\n * case \"fee-allowance\":\n * return showApproveOperationalFee();\n * case \"submit-unconfirmed\":\n * return showReconcilePending(getGaslessUnconfirmedSubmit(err));\n * default:\n * return showDiagnostics(parseGaslessErrorDetail(err));\n * }\n * ```\n */\nexport function classifyGaslessFailure(err: unknown): GaslessFailureReason {\n if (getGaslessUnconfirmedSubmit(err) !== null) return \"submit-unconfirmed\";\n if (isGaslessIdempotencyConflictError(err)) return \"idempotency-conflict\";\n /** Thrown by the fee pre-flight, before any HTTP call and with no vendor detail. */\n if (isGaslessFreeQuotaExhaustedError(err)) return \"free-quota\";\n\n const detail = parseGaslessErrorDetail(err);\n const fromRevert = reasonFromRevert(gaslessRevertText(detail));\n if (fromRevert) return fromRevert;\n if (detail?.failedOperation) return \"failed-operation\";\n\n const fromCode = reasonFromVendorCode(detail?.code ?? null);\n if (fromCode) return fromCode;\n\n const fromStatus = reasonFromHttpStatus(err);\n if (fromStatus) return fromStatus;\n\n return detail?.code === \"SIMULATION_REVERTED\" ? \"simulation-reverted\" : \"unknown\";\n}\n\n/**\n * The failing batch entry of an `OperationFailed` revert, with its inner revert\n * decoded against the ABI you supplied.\n */\nexport interface GaslessDecodedOperationFailure {\n /** Zero-based position of the failing operation in the submitted batch. */\n index: number;\n /** The inner revert data, exactly as the service reported it. */\n revertData: Hex;\n /** The decoded error, or `null` when the ABI does not describe it. */\n decoded: DecodeErrorResultReturnType | null;\n}\n\n/**\n * Identify the batch entry that reverted, and decode its inner revert.\n *\n * A relayed batch is atomic, so the InstantLayer reports an inner failure as\n * `OperationFailed(operationIndex, revertData)` — which names a position, not a\n * cause. Decoding `revertData` against the ABI of the contract that operation\n * targeted turns it back into the error the user can act on\n * (`InvalidNameLength`, `InsufficientBalance`, …).\n *\n * @param err - Anything caught from a gasless submit.\n * @param abi - ABI of the contract the failing operation targeted.\n * @returns The index, the raw revert data and the decoded error, or `null` when\n * the failure was not an `OperationFailed`.\n *\n * @example\n * ```ts\n * const failure = decodeGaslessOperationFailure(err, accountLayerAbi);\n * if (failure) {\n * console.error(`operation ${failure.index} reverted:`, failure.decoded?.errorName ?? failure.revertData);\n * }\n * ```\n */\nexport function decodeGaslessOperationFailure(err: unknown, abi: Abi): GaslessDecodedOperationFailure | null {\n const failed = parseGaslessErrorDetail(err)?.failedOperation;\n if (!failed) return null;\n\n let decoded: DecodeErrorResultReturnType | null = null;\n try {\n decoded = decodeErrorResult({ abi, data: failed.revertData });\n } catch {\n /** An ABI that does not describe this error is a caller mistake, not a reason to lose the index. */\n decoded = null;\n }\n return { index: failed.index, revertData: failed.revertData, decoded };\n}\n"],"mappings":";;;;;;AAwEA,SAAS,EAAiB,GAA2C;CAoBnE,OAnBI,EAAK,SAAS,2BAA2B,IAAU,eACnD,EAAK,SAAS,sCAAsC,IAAU,kBAC9D,EAAK,SAAS,2BAA2B,KAAK,EAAK,SAAS,wCAAwC,IAC/F,kBAEL,EAAK,SAAS,kBAAkB,KAAK,EAAK,SAAS,iBAAiB,IAAU,cAC9E,EAAK,SAAS,2BAA2B,IAAU,0BACnD,EAAK,SAAS,2BAA2B,KAAK,EAAK,SAAS,2BAA2B,IAClF,2BAGP,EAAK,SAAS,cAAc,KAC5B,EAAK,SAAS,iBAAiB,KAC/B,EAAK,SAAS,wBAAwB,KACtC,EAAK,SAAS,6BAA6B,KAC3C,EAAK,SAAS,6BAA6B,IAEpC,sBAEF;AACT;AAGA,SAAS,EAAqB,GAAkD;CAC9E,QAAQ,GAAR;EACE,KAAK,4BACH,OAAO;EACT,KAAK,0BACH,OAAO;EACT,KAAK,2BACH,OAAO;EACT,KAAK,yBACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAGA,SAAS,EAAqB,GAA2C;CACvE,QAAQ,EAA0B,CAAG,GAArC;EACE,KAAK,gBACH,OAAO;EACT,KAAK,gBACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK;EACL,KAAK,qBACH,OAAO;EACT,KAAK,iBACH,OAAO;EACT,KAAK;EACL,KAAK,aACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AA4BA,SAAgB,EAAuB,GAAoC;CACzE,IAAI,EAA4B,CAAG,MAAM,MAAM,OAAO;CACtD,IAAI,EAAkC,CAAG,GAAG,OAAO;CAEnD,IAAI,EAAiC,CAAG,GAAG,OAAO;CAElD,IAAM,IAAS,EAAwB,CAAG;CAW1C,OAVmB,EAAiB,EAAkB,CAAM,CACxD,MACA,GAAQ,kBAAwB,qBAEnB,EAAqB,GAAQ,QAAQ,IAClD,KAEe,EAAqB,CACpC,MAEG,GAAQ,SAAS,wBAAwB,wBAAwB;AAC1E;AAqCA,SAAgB,EAA8B,GAAc,GAAiD;CAC3G,IAAM,IAAS,EAAwB,CAAG,GAAG;CAC7C,IAAI,CAAC,GAAQ,OAAO;CAEpB,IAAI,IAA8C;CAClD,IAAI;EACF,IAAU,EAAkB;GAAE;GAAK,MAAM,EAAO;EAAW,CAAC;CAC9D,QAAQ;EAEN,IAAU;CACZ;CACA,OAAO;EAAE,OAAO,EAAO;EAAO,YAAY,EAAO;EAAY;CAAQ;AACvE"}
@@ -1,12 +1,12 @@
1
1
  import { SymmApiError as e, SymmError as t } from "../../shared/errors/symm-error.js";
2
- import { fireGaslessEvent as n, toGaslessRecordBody as r } from "../events.js";
3
- import { resolveGaslessService as i } from "../resolve-gasless.js";
2
+ import { resolveGaslessService as n } from "../resolve-gasless.js";
3
+ import { fireGaslessEvent as r, toGaslessRecordBody as i } from "../events.js";
4
4
  import { GaslessRequestStatus as a } from "../types.js";
5
5
  import { waitForGaslessRequest as o } from "../wait-for-gasless-request/wait-for-gasless-request.js";
6
6
  //#region src/gasless/confirm-gasless-request/confirm-gasless-request.ts
7
7
  var s = 6e4;
8
8
  async function c(c, u) {
9
- let { chainId: d, requestId: f, service: p = "operations", until: m = "terminal", receiptConfirmations: h = 1, receiptTimeoutMs: g = s, signal: _, onUpdate: v, onTransportIssue: y, transport: b } = u, x = i(c, { chainId: d }), S = x.execution?.onEvent, C = await o(c, {
9
+ let { chainId: d, requestId: f, service: p = "operations", until: m = "terminal", receiptConfirmations: h = 1, receiptTimeoutMs: g = s, signal: _, onUpdate: v, onTransportIssue: y, transport: b } = u, x = n(c, { chainId: d }), S = x.execution?.onEvent, C = await o(c, {
10
10
  chainId: d,
11
11
  requestId: f,
12
12
  service: p,
@@ -21,7 +21,7 @@ async function c(c, u) {
21
21
  onTransportIssue: y,
22
22
  transport: b
23
23
  });
24
- if (n(S, {
24
+ if (r(S, {
25
25
  type: "terminal",
26
26
  requestId: C.requestId,
27
27
  status: C.status,
@@ -32,7 +32,7 @@ async function c(c, u) {
32
32
  message: `Gasless: request ${C.requestId} ended ${C.status}${C.errorMessage ? ` — ${C.errorMessage}` : ""}.`,
33
33
  status: 200,
34
34
  statusText: "OK",
35
- responseData: r(C),
35
+ responseData: i(C),
36
36
  url: x.url,
37
37
  method: "GET"
38
38
  });
@@ -21,4 +21,25 @@ export declare const GASLESS_WALLET_EXECUTE_SELECTOR: "0x3f707e6b";
21
21
  * ```
22
22
  */
23
23
  export declare const GASLESS_WALLET_EXECUTION_SENTINEL_SELECTOR: "0x1dccecab";
24
+ /**
25
+ * The longest a signature made by an SDK gasless call stays valid: 20 minutes,
26
+ * counted from the moment the call starts. Every SDK call that signs a gasless
27
+ * operation fixes the deadline when it starts, before any read it makes first
28
+ * (a virtual account's parent, a Muon signature, a quote), so an attempt
29
+ * started at `T` (seconds) can no longer execute once the chain's latest block
30
+ * timestamp passes `T + GASLESS_SIGNATURE_LIFETIME_SECONDS`. Allow a minute of
31
+ * margin for the time between recording `T` and making the call. A call whose
32
+ * reads leave less than a minute of that lifetime stops before any prompt with
33
+ * `GASLESS_SIGNATURE_WINDOW_EXPIRED`.
34
+ *
35
+ * Gasless-wallet operations (`gaslessWalletExecute`) use a shorter lifetime, so
36
+ * this bound covers them too.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const settledAt = lastAttemptStartedAtSeconds + GASLESS_SIGNATURE_LIFETIME_SECONDS + 60;
41
+ * if (latestBlock.timestamp > BigInt(settledAt)) await reconcile(action);
42
+ * ```
43
+ */
44
+ export declare const GASLESS_SIGNATURE_LIFETIME_SECONDS: number;
24
45
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/gasless/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,EAAG,YAAqB,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0CAA0C,EAAG,YAAqB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/gasless/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,EAAG,YAAqB,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0CAA0C,EAAG,YAAqB,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kCAAkC,QAAU,CAAC"}
@@ -1,6 +1,6 @@
1
1
  //#region src/gasless/constants.ts
2
- var e = "0x3f707e6b", t = "0x1dccecab";
2
+ var e = "0x3f707e6b", t = "0x1dccecab", n = 1200;
3
3
  //#endregion
4
- export { e as GASLESS_WALLET_EXECUTE_SELECTOR, t as GASLESS_WALLET_EXECUTION_SENTINEL_SELECTOR };
4
+ export { n as GASLESS_SIGNATURE_LIFETIME_SECONDS, e as GASLESS_WALLET_EXECUTE_SELECTOR, t as GASLESS_WALLET_EXECUTION_SENTINEL_SELECTOR };
5
5
 
6
6
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../src/gasless/constants.ts"],"sourcesContent":["/**\n * 4-byte selector of `GaslessWallet.execute((address,uint256,bytes)[])` — the\n * only selector a relayed wallet operation's `callData` may start with.\n *\n * @example\n * ```ts\n * const isWalletOperation = operation.callData.slice(0, 10).toLowerCase() === GASLESS_WALLET_EXECUTE_SELECTOR;\n * ```\n */\nexport const GASLESS_WALLET_EXECUTE_SELECTOR = \"0x3f707e6b\" as const;\n\n/**\n * Sentinel selector (`bytes4(keccak256(\"GASLESSQ_WALLET_EXECUTION\"))`) a\n * session key must hold an InstantLayer delegation for before it may sign\n * **delegated** GaslessWallet executions — alongside every inner call selector.\n * Owner-signed wallet operations do not use it. The GaslessLayer exposes the\n * same value as `WALLET_EXECUTION_SENTINEL_SELECTOR()`.\n *\n * @example\n * ```ts\n * const selectors = [GASLESS_WALLET_EXECUTION_SENTINEL_SELECTOR, ...innerSelectors];\n * ```\n */\nexport const GASLESS_WALLET_EXECUTION_SENTINEL_SELECTOR = \"0x1dccecab\" as const;\n"],"mappings":";AASA,IAAa,IAAkC,cAclC,IAA6C"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../src/gasless/constants.ts"],"sourcesContent":["/**\n * 4-byte selector of `GaslessWallet.execute((address,uint256,bytes)[])` — the\n * only selector a relayed wallet operation's `callData` may start with.\n *\n * @example\n * ```ts\n * const isWalletOperation = operation.callData.slice(0, 10).toLowerCase() === GASLESS_WALLET_EXECUTE_SELECTOR;\n * ```\n */\nexport const GASLESS_WALLET_EXECUTE_SELECTOR = \"0x3f707e6b\" as const;\n\n/**\n * Sentinel selector (`bytes4(keccak256(\"GASLESSQ_WALLET_EXECUTION\"))`) a\n * session key must hold an InstantLayer delegation for before it may sign\n * **delegated** GaslessWallet executions — alongside every inner call selector.\n * Owner-signed wallet operations do not use it. The GaslessLayer exposes the\n * same value as `WALLET_EXECUTION_SENTINEL_SELECTOR()`.\n *\n * @example\n * ```ts\n * const selectors = [GASLESS_WALLET_EXECUTION_SENTINEL_SELECTOR, ...innerSelectors];\n * ```\n */\nexport const GASLESS_WALLET_EXECUTION_SENTINEL_SELECTOR = \"0x1dccecab\" as const;\n\n/**\n * The longest a signature made by an SDK gasless call stays valid: 20 minutes,\n * counted from the moment the call starts. Every SDK call that signs a gasless\n * operation fixes the deadline when it starts, before any read it makes first\n * (a virtual account's parent, a Muon signature, a quote), so an attempt\n * started at `T` (seconds) can no longer execute once the chain's latest block\n * timestamp passes `T + GASLESS_SIGNATURE_LIFETIME_SECONDS`. Allow a minute of\n * margin for the time between recording `T` and making the call. A call whose\n * reads leave less than a minute of that lifetime stops before any prompt with\n * `GASLESS_SIGNATURE_WINDOW_EXPIRED`.\n *\n * Gasless-wallet operations (`gaslessWalletExecute`) use a shorter lifetime, so\n * this bound covers them too.\n *\n * @example\n * ```ts\n * const settledAt = lastAttemptStartedAtSeconds + GASLESS_SIGNATURE_LIFETIME_SECONDS + 60;\n * if (latestBlock.timestamp > BigInt(settledAt)) await reconcile(action);\n * ```\n */\nexport const GASLESS_SIGNATURE_LIFETIME_SECONDS = 20 * 60;\n"],"mappings":";AASA,IAAa,IAAkC,cAclC,IAA6C,cAsB7C,IAAqC"}
@@ -1,15 +1,15 @@
1
- import { getVirtualAccount as e } from "../symmio-contracts/account-layer/actions/get-virtual-account.js";
2
- import { getSubAccount as t } from "../symmio-contracts/account-layer/actions/get-sub-account.js";
1
+ import { getSubAccount as e } from "../symmio-contracts/account-layer/actions/get-sub-account.js";
2
+ import { getVirtualAccount as t } from "../symmio-contracts/account-layer/actions/get-virtual-account.js";
3
3
  import { getIsDelegationActive as n } from "../symmio-contracts/instant-layer/actions/get-is-delegation-active.js";
4
4
  import { isAddressEqual as r } from "viem";
5
5
  //#region src/gasless/delegation-preflight.ts
6
6
  var i = /* @__PURE__ */ new WeakMap();
7
- function a(e, n, r) {
8
- let a = i.get(e);
9
- a || (a = /* @__PURE__ */ new Map(), i.set(e, a));
7
+ function a(t, n, r) {
8
+ let a = i.get(t);
9
+ a || (a = /* @__PURE__ */ new Map(), i.set(t, a));
10
10
  let o = a, s = `${n}:${r.toLowerCase()}`, c = o.get(s);
11
11
  if (c) return c;
12
- let l = t(e, {
12
+ let l = e(t, {
13
13
  chainId: n,
14
14
  account: r
15
15
  }).then((e) => e.isExists ? e.owner : null);
@@ -18,12 +18,12 @@ function a(e, n, r) {
18
18
  }), l;
19
19
  }
20
20
  var o = /* @__PURE__ */ new WeakMap();
21
- function s(t, n, r) {
22
- let i = o.get(t);
23
- i || (i = /* @__PURE__ */ new Map(), o.set(t, i));
21
+ function s(e, n, r) {
22
+ let i = o.get(e);
23
+ i || (i = /* @__PURE__ */ new Map(), o.set(e, i));
24
24
  let a = i, s = `${n}:${r.toLowerCase()}`, c = a.get(s);
25
25
  if (c) return c;
26
- let l = e(t, {
26
+ let l = t(e, {
27
27
  chainId: n,
28
28
  account: r
29
29
  }).then((e) => e.isExists ? e.parentAccount : r);
@@ -0,0 +1,39 @@
1
+ import { Config } from '../core/config/index.js';
2
+ import { ChainIdParameter, Compute } from '../shared/types/properties.js';
3
+ import { GaslessService } from './types.js';
4
+ /**
5
+ * Parameters for {@link getGaslessDeploymentKey}.
6
+ */
7
+ export type GetGaslessDeploymentKeyParameters = Compute<ChainIdParameter & {
8
+ /** Which sub-service the key protects actions on. Defaults to `"operations"`. */
9
+ service?: GaslessService;
10
+ }>;
11
+ /** Return type of {@link getGaslessDeploymentKey}. */
12
+ export type GetGaslessDeploymentKeyReturnType = string;
13
+ /**
14
+ * A non-secret fingerprint of the gasless deployment a call goes to: chain,
15
+ * contracts version, service URL, protocol instance, and the gasless, SYMMIO,
16
+ * AccountLayer and InstantLayer addresses.
17
+ *
18
+ * An idempotency key protects an action only inside one deployment. Store this
19
+ * value with a pending action and compare it before any retry: a different
20
+ * value means the retry would go somewhere the key does not protect it, so
21
+ * reconcile the action instead of signing it again. Credentials, headers and
22
+ * execution settings never take part.
23
+ *
24
+ * @param config - The SDK config.
25
+ * @param parameters - Optional chain id, and the service (`"operations"` by default, or `"deposits"`).
26
+ * @returns A stable string for that deployment and service.
27
+ * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION` for a chain without gasless support.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { getGaslessDeploymentKey } from "@symmio/trading-core";
32
+ *
33
+ * if (getGaslessDeploymentKey(config, { chainId }) !== action.deploymentKey) {
34
+ * return reconcile(action);
35
+ * }
36
+ * ```
37
+ */
38
+ export declare function getGaslessDeploymentKey(config: Config, parameters?: GetGaslessDeploymentKeyParameters): GetGaslessDeploymentKeyReturnType;
39
+ //# sourceMappingURL=deployment-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-key.d.ts","sourceRoot":"","sources":["../../src/gasless/deployment-key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG,OAAO,CACrD,gBAAgB,GAAG;IACjB,iFAAiF;IACjF,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,CACF,CAAC;AAEF,sDAAsD;AACtD,MAAM,MAAM,iCAAiC,GAAG,MAAM,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,iCAAsC,GACjD,iCAAiC,CAgBnC"}
@@ -0,0 +1,22 @@
1
+ import { resolveGaslessService as e } from "./resolve-gasless.js";
2
+ import { buildGaslessHttpContext as t } from "./http.js";
3
+ import { hash as n } from "ohash";
4
+ //#region src/gasless/deployment-key.ts
5
+ function r(r, i = {}) {
6
+ let { chainId: a, service: o = "operations" } = i, s = e(r, { chainId: a }), c = r.getChainConfig(a), l = t(c.chainId, s, o);
7
+ return n([
8
+ 1,
9
+ c.chainId,
10
+ c.contractsVersion,
11
+ l.baseURL,
12
+ l.protocolInstance,
13
+ s.gaslessLayerAddress.toLowerCase(),
14
+ c.addresses.symmioAddress.toLowerCase(),
15
+ c.addresses.accountLayerAddress.toLowerCase(),
16
+ c.addresses.instantLayerAddress.toLowerCase()
17
+ ]);
18
+ }
19
+ //#endregion
20
+ export { r as getGaslessDeploymentKey };
21
+
22
+ //# sourceMappingURL=deployment-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-key.js","names":[],"sources":["../../src/gasless/deployment-key.ts"],"sourcesContent":["import { hash } from \"ohash\";\nimport type { Config } from \"../core/config\";\nimport type { ChainIdParameter, Compute } from \"../shared/types/properties\";\nimport { buildGaslessHttpContext } from \"./http\";\nimport { resolveGaslessService } from \"./resolve-gasless\";\nimport type { GaslessService } from \"./types\";\n\n/**\n * Parameters for {@link getGaslessDeploymentKey}.\n */\nexport type GetGaslessDeploymentKeyParameters = Compute<\n ChainIdParameter & {\n /** Which sub-service the key protects actions on. Defaults to `\"operations\"`. */\n service?: GaslessService;\n }\n>;\n\n/** Return type of {@link getGaslessDeploymentKey}. */\nexport type GetGaslessDeploymentKeyReturnType = string;\n\n/**\n * A non-secret fingerprint of the gasless deployment a call goes to: chain,\n * contracts version, service URL, protocol instance, and the gasless, SYMMIO,\n * AccountLayer and InstantLayer addresses.\n *\n * An idempotency key protects an action only inside one deployment. Store this\n * value with a pending action and compare it before any retry: a different\n * value means the retry would go somewhere the key does not protect it, so\n * reconcile the action instead of signing it again. Credentials, headers and\n * execution settings never take part.\n *\n * @param config - The SDK config.\n * @param parameters - Optional chain id, and the service (`\"operations\"` by default, or `\"deposits\"`).\n * @returns A stable string for that deployment and service.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION` for a chain without gasless support.\n *\n * @example\n * ```ts\n * import { getGaslessDeploymentKey } from \"@symmio/trading-core\";\n *\n * if (getGaslessDeploymentKey(config, { chainId }) !== action.deploymentKey) {\n * return reconcile(action);\n * }\n * ```\n */\nexport function getGaslessDeploymentKey(\n config: Config,\n parameters: GetGaslessDeploymentKeyParameters = {},\n): GetGaslessDeploymentKeyReturnType {\n const { chainId, service = \"operations\" } = parameters;\n const gasless = resolveGaslessService(config, { chainId });\n const chain = config.getChainConfig(chainId);\n const context = buildGaslessHttpContext(chain.chainId, gasless, service);\n return hash([\n 1,\n chain.chainId,\n chain.contractsVersion,\n context.baseURL,\n context.protocolInstance,\n gasless.gaslessLayerAddress.toLowerCase(),\n chain.addresses.symmioAddress.toLowerCase(),\n chain.addresses.accountLayerAddress.toLowerCase(),\n chain.addresses.instantLayerAddress.toLowerCase(),\n ]);\n}\n"],"mappings":";;;;AA6CA,SAAgB,EACd,GACA,IAAgD,CAAC,GACd;CACnC,IAAM,EAAE,YAAS,aAAU,iBAAiB,GACtC,IAAU,EAAsB,GAAQ,EAAE,WAAQ,CAAC,GACnD,IAAQ,EAAO,eAAe,CAAO,GACrC,IAAU,EAAwB,EAAM,SAAS,GAAS,CAAO;CACvE,OAAO,EAAK;EACV;EACA,EAAM;EACN,EAAM;EACN,EAAQ;EACR,EAAQ;EACR,EAAQ,oBAAoB,YAAY;EACxC,EAAM,UAAU,cAAc,YAAY;EAC1C,EAAM,UAAU,oBAAoB,YAAY;EAChD,EAAM,UAAU,oBAAoB,YAAY;CAClD,CAAC;AACH"}
@@ -0,0 +1,31 @@
1
+ import { GaslessWriteOptions, GaslessWriteParameter } from '../../shared/types/properties.js';
2
+ /**
3
+ * Date a write's gasless signature from the moment the user's action started.
4
+ *
5
+ * An action that reads before it writes (a Muon signature, a quote, the
6
+ * account's isolation type) calls this on its first line and passes the result
7
+ * down as the write's `gasless`. The signature deadline is then counted from
8
+ * this moment, not from when the write is finally signed, so the bound in
9
+ * `GASLESS_SIGNATURE_LIFETIME_SECONDS` holds from the caller's point of view.
10
+ *
11
+ * The caller's object is never mutated: the result is a copy that relays
12
+ * exactly as the input would. Input that already carries a start time is
13
+ * returned unchanged, so the outermost action's start wins.
14
+ *
15
+ * @param gasless - The action's `gasless` parameter, verbatim.
16
+ * @param startedAtMs - The action's start, in ms since epoch.
17
+ * @returns The options to pass to the write.
18
+ *
19
+ * @internal
20
+ */
21
+ export declare function withGaslessAttemptStart(gasless: GaslessWriteParameter["gasless"], startedAtMs?: number): GaslessWriteOptions;
22
+ /**
23
+ * The start time {@link withGaslessAttemptStart} recorded for these options.
24
+ *
25
+ * @param gasless - A write's `gasless` parameter.
26
+ * @returns The action's start in ms since epoch, or `undefined` when no action recorded one.
27
+ *
28
+ * @internal
29
+ */
30
+ export declare function getGaslessAttemptStart(gasless: GaslessWriteParameter["gasless"]): number | undefined;
31
+ //# sourceMappingURL=attempt-start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attempt-start.d.ts","sourceRoot":"","sources":["../../../src/gasless/dispatch/attempt-start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAShG;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC,EACzC,WAAW,SAAa,GACvB,mBAAmB,CAKrB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAEpG"}
@@ -0,0 +1,14 @@
1
+ //#region src/gasless/dispatch/attempt-start.ts
2
+ var e = /* @__PURE__ */ new WeakMap();
3
+ function t(t, n = Date.now()) {
4
+ if (typeof t == "object" && e.has(t)) return t;
5
+ let r = typeof t == "boolean" ? { enabled: t } : { ...t };
6
+ return e.set(r, n), r;
7
+ }
8
+ function n(t) {
9
+ return typeof t == "object" ? e.get(t) : void 0;
10
+ }
11
+ //#endregion
12
+ export { n as getGaslessAttemptStart, t as withGaslessAttemptStart };
13
+
14
+ //# sourceMappingURL=attempt-start.js.map