@symmio/trading-core 4.3.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (693) hide show
  1. package/dist/candles/adapters/tradingview/map-resolution.d.ts.map +1 -1
  2. package/dist/candles/adapters/tradingview/map-resolution.js +2 -0
  3. package/dist/candles/adapters/tradingview/map-resolution.js.map +1 -1
  4. package/dist/candles/adapters/tradingview/to-tradingview-datafeed.d.ts.map +1 -1
  5. package/dist/candles/adapters/tradingview/to-tradingview-datafeed.js +6 -4
  6. package/dist/candles/adapters/tradingview/to-tradingview-datafeed.js.map +1 -1
  7. package/dist/candles/history-query.d.ts +67 -0
  8. package/dist/candles/history-query.d.ts.map +1 -0
  9. package/dist/candles/history-query.js +80 -0
  10. package/dist/candles/history-query.js.map +1 -0
  11. package/dist/candles/index.d.ts +3 -0
  12. package/dist/candles/index.d.ts.map +1 -1
  13. package/dist/candles/merge-candle-pages.d.ts +5 -0
  14. package/dist/candles/merge-candle-pages.d.ts.map +1 -0
  15. package/dist/candles/merge-candle-pages.js +13 -0
  16. package/dist/candles/merge-candle-pages.js.map +1 -0
  17. package/dist/candles/query.d.ts +5 -1
  18. package/dist/candles/query.d.ts.map +1 -1
  19. package/dist/candles/query.js +3 -2
  20. package/dist/candles/query.js.map +1 -1
  21. package/dist/candles/refresh-candle-history.d.ts +31 -0
  22. package/dist/candles/refresh-candle-history.d.ts.map +1 -0
  23. package/dist/candles/refresh-candle-history.js +91 -0
  24. package/dist/candles/refresh-candle-history.js.map +1 -0
  25. package/dist/candles/resolution.d.ts +3 -3
  26. package/dist/candles/resolution.d.ts.map +1 -1
  27. package/dist/candles/resolution.js +1 -0
  28. package/dist/candles/resolution.js.map +1 -1
  29. package/dist/candles/sources/binance/create-binance-candle-source.d.ts.map +1 -1
  30. package/dist/candles/sources/binance/create-binance-candle-source.js +3 -1
  31. package/dist/candles/sources/binance/create-binance-candle-source.js.map +1 -1
  32. package/dist/candles/sources/lowcap/create-lowcap-candle-source.d.ts +35 -0
  33. package/dist/candles/sources/lowcap/create-lowcap-candle-source.d.ts.map +1 -0
  34. package/dist/candles/sources/lowcap/create-lowcap-candle-source.js +104 -0
  35. package/dist/candles/sources/lowcap/create-lowcap-candle-source.js.map +1 -0
  36. package/dist/candles/sources/lowcap/create-lowcap-symbol-loader.d.ts +4 -0
  37. package/dist/candles/sources/lowcap/create-lowcap-symbol-loader.d.ts.map +1 -0
  38. package/dist/candles/sources/lowcap/create-lowcap-symbol-loader.js +40 -0
  39. package/dist/candles/sources/lowcap/create-lowcap-symbol-loader.js.map +1 -0
  40. package/dist/candles/sources/lowcap/get-lowcap-candles.d.ts +12 -0
  41. package/dist/candles/sources/lowcap/get-lowcap-candles.d.ts.map +1 -0
  42. package/dist/candles/sources/lowcap/get-lowcap-candles.js +48 -0
  43. package/dist/candles/sources/lowcap/get-lowcap-candles.js.map +1 -0
  44. package/dist/candles/sources/lowcap/index.d.ts +2 -0
  45. package/dist/candles/sources/lowcap/index.d.ts.map +1 -0
  46. package/dist/candles/sources/lowcap/lowcap-candle-time.d.ts +9 -0
  47. package/dist/candles/sources/lowcap/lowcap-candle-time.d.ts.map +1 -0
  48. package/dist/candles/sources/lowcap/lowcap-candle-time.js +24 -0
  49. package/dist/candles/sources/lowcap/lowcap-candle-time.js.map +1 -0
  50. package/dist/candles/sources/lowcap/map-resolution.d.ts +16 -0
  51. package/dist/candles/sources/lowcap/map-resolution.d.ts.map +1 -0
  52. package/dist/candles/sources/lowcap/map-resolution.js +26 -0
  53. package/dist/candles/sources/lowcap/map-resolution.js.map +1 -0
  54. package/dist/candles/sources/lowcap/resolve-lowcap-symbol.d.ts +12 -0
  55. package/dist/candles/sources/lowcap/resolve-lowcap-symbol.d.ts.map +1 -0
  56. package/dist/candles/sources/lowcap/resolve-lowcap-symbol.js +8 -0
  57. package/dist/candles/sources/lowcap/resolve-lowcap-symbol.js.map +1 -0
  58. package/dist/candles/sources/lowcap/watch-lowcap-candles.d.ts +19 -0
  59. package/dist/candles/sources/lowcap/watch-lowcap-candles.d.ts.map +1 -0
  60. package/dist/candles/sources/lowcap/watch-lowcap-candles.js +104 -0
  61. package/dist/candles/sources/lowcap/watch-lowcap-candles.js.map +1 -0
  62. package/dist/candles/types.d.ts +32 -16
  63. package/dist/candles/types.d.ts.map +1 -1
  64. package/dist/core/chains/registry.d.ts.map +1 -1
  65. package/dist/core/chains/registry.js +4 -5
  66. package/dist/core/chains/registry.js.map +1 -1
  67. package/dist/core/chains/types.d.ts +36 -1
  68. package/dist/core/chains/types.d.ts.map +1 -1
  69. package/dist/core/chains/types.js.map +1 -1
  70. package/dist/core/config/merge-chain-config.js +6 -3
  71. package/dist/core/config/merge-chain-config.js.map +1 -1
  72. package/dist/gasless/batch/calls.d.ts +21 -7
  73. package/dist/gasless/batch/calls.d.ts.map +1 -1
  74. package/dist/gasless/batch/calls.js +17 -16
  75. package/dist/gasless/batch/calls.js.map +1 -1
  76. package/dist/gasless/batch/resolve-gasless-batch.d.ts +10 -1
  77. package/dist/gasless/batch/resolve-gasless-batch.d.ts.map +1 -1
  78. package/dist/gasless/batch/resolve-gasless-batch.js +17 -15
  79. package/dist/gasless/batch/resolve-gasless-batch.js.map +1 -1
  80. package/dist/gasless/classify-gasless-failure.d.ts +3 -1
  81. package/dist/gasless/classify-gasless-failure.d.ts.map +1 -1
  82. package/dist/gasless/classify-gasless-failure.js +10 -10
  83. package/dist/gasless/classify-gasless-failure.js.map +1 -1
  84. package/dist/gasless/confirm-gasless-request/confirm-gasless-request.js +5 -5
  85. package/dist/gasless/constants.d.ts +21 -0
  86. package/dist/gasless/constants.d.ts.map +1 -1
  87. package/dist/gasless/constants.js +2 -2
  88. package/dist/gasless/constants.js.map +1 -1
  89. package/dist/gasless/delegation-preflight.js +10 -10
  90. package/dist/gasless/deployment-key.d.ts +39 -0
  91. package/dist/gasless/deployment-key.d.ts.map +1 -0
  92. package/dist/gasless/deployment-key.js +22 -0
  93. package/dist/gasless/deployment-key.js.map +1 -0
  94. package/dist/gasless/dispatch/attempt-start.d.ts +31 -0
  95. package/dist/gasless/dispatch/attempt-start.d.ts.map +1 -0
  96. package/dist/gasless/dispatch/attempt-start.js +14 -0
  97. package/dist/gasless/dispatch/attempt-start.js.map +1 -0
  98. package/dist/gasless/dispatch/maybe-relay-as-gasless.d.ts +4 -43
  99. package/dist/gasless/dispatch/maybe-relay-as-gasless.d.ts.map +1 -1
  100. package/dist/gasless/dispatch/maybe-relay-as-gasless.js +24 -182
  101. package/dist/gasless/dispatch/maybe-relay-as-gasless.js.map +1 -1
  102. package/dist/gasless/dispatch/resolve-gasless-write.d.ts +40 -0
  103. package/dist/gasless/dispatch/resolve-gasless-write.d.ts.map +1 -0
  104. package/dist/gasless/dispatch/resolve-gasless-write.js +48 -0
  105. package/dist/gasless/dispatch/resolve-gasless-write.js.map +1 -0
  106. package/dist/gasless/dispatch/submit-gasless-write.d.ts +11 -0
  107. package/dist/gasless/dispatch/submit-gasless-write.d.ts.map +1 -0
  108. package/dist/gasless/dispatch/submit-gasless-write.js +180 -0
  109. package/dist/gasless/dispatch/submit-gasless-write.js.map +1 -0
  110. package/dist/gasless/dispatch/types.d.ts +42 -0
  111. package/dist/gasless/dispatch/types.d.ts.map +1 -0
  112. package/dist/gasless/effective-instant-selectors.d.ts +11 -0
  113. package/dist/gasless/effective-instant-selectors.d.ts.map +1 -0
  114. package/dist/gasless/effective-instant-selectors.js +25 -0
  115. package/dist/gasless/effective-instant-selectors.js.map +1 -0
  116. package/dist/gasless/fallback.d.ts +43 -0
  117. package/dist/gasless/fallback.d.ts.map +1 -1
  118. package/dist/gasless/fallback.js +27 -17
  119. package/dist/gasless/fallback.js.map +1 -1
  120. package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.d.ts +13 -5
  121. package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.d.ts.map +1 -1
  122. package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.js +88 -81
  123. package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.js.map +1 -1
  124. package/dist/gasless/get-gasless-batch-funding/batch-fee-approvals.d.ts +20 -0
  125. package/dist/gasless/get-gasless-batch-funding/batch-fee-approvals.d.ts.map +1 -0
  126. package/dist/gasless/get-gasless-batch-funding/batch-fee-approvals.js +29 -0
  127. package/dist/gasless/get-gasless-batch-funding/batch-fee-approvals.js.map +1 -0
  128. package/dist/gasless/get-gasless-batch-funding/get-gasless-batch-funding.d.ts +43 -0
  129. package/dist/gasless/get-gasless-batch-funding/get-gasless-batch-funding.d.ts.map +1 -0
  130. package/dist/gasless/get-gasless-batch-funding/get-gasless-batch-funding.js +96 -0
  131. package/dist/gasless/get-gasless-batch-funding/get-gasless-batch-funding.js.map +1 -0
  132. package/dist/gasless/get-gasless-batch-funding/index.d.ts +4 -0
  133. package/dist/gasless/get-gasless-batch-funding/index.d.ts.map +1 -0
  134. package/dist/gasless/get-gasless-batch-funding/query.d.ts +31 -0
  135. package/dist/gasless/get-gasless-batch-funding/query.d.ts.map +1 -0
  136. package/dist/gasless/get-gasless-batch-funding/query.js +22 -0
  137. package/dist/gasless/get-gasless-batch-funding/query.js.map +1 -0
  138. package/dist/gasless/get-gasless-batch-funding/types.d.ts +80 -0
  139. package/dist/gasless/get-gasless-batch-funding/types.d.ts.map +1 -0
  140. package/dist/gasless/get-gasless-margin-funding/get-gasless-margin-funding.d.ts +33 -0
  141. package/dist/gasless/get-gasless-margin-funding/get-gasless-margin-funding.d.ts.map +1 -0
  142. package/dist/gasless/get-gasless-margin-funding/get-gasless-margin-funding.js +31 -0
  143. package/dist/gasless/get-gasless-margin-funding/get-gasless-margin-funding.js.map +1 -0
  144. package/dist/gasless/get-gasless-margin-funding/index.d.ts +4 -0
  145. package/dist/gasless/get-gasless-margin-funding/index.d.ts.map +1 -0
  146. package/dist/gasless/get-gasless-margin-funding/query.d.ts +31 -0
  147. package/dist/gasless/get-gasless-margin-funding/query.d.ts.map +1 -0
  148. package/dist/gasless/get-gasless-margin-funding/query.js +22 -0
  149. package/dist/gasless/get-gasless-margin-funding/query.js.map +1 -0
  150. package/dist/gasless/get-gasless-margin-funding/types.d.ts +27 -0
  151. package/dist/gasless/get-gasless-margin-funding/types.d.ts.map +1 -0
  152. package/dist/gasless/get-session-key-selectors.d.ts +18 -4
  153. package/dist/gasless/get-session-key-selectors.d.ts.map +1 -1
  154. package/dist/gasless/get-session-key-selectors.js +20 -12
  155. package/dist/gasless/get-session-key-selectors.js.map +1 -1
  156. package/dist/gasless/http.d.ts +7 -7
  157. package/dist/gasless/http.d.ts.map +1 -1
  158. package/dist/gasless/http.js +70 -72
  159. package/dist/gasless/http.js.map +1 -1
  160. package/dist/gasless/idempotency-key.d.ts +33 -0
  161. package/dist/gasless/idempotency-key.d.ts.map +1 -0
  162. package/dist/gasless/idempotency-key.js +15 -0
  163. package/dist/gasless/idempotency-key.js.map +1 -0
  164. package/dist/gasless/index.d.ts +4 -0
  165. package/dist/gasless/index.d.ts.map +1 -1
  166. package/dist/gasless/nonce-lock.d.ts +55 -17
  167. package/dist/gasless/nonce-lock.d.ts.map +1 -1
  168. package/dist/gasless/nonce-lock.js +53 -26
  169. package/dist/gasless/nonce-lock.js.map +1 -1
  170. package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.d.ts +30 -0
  171. package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.d.ts.map +1 -0
  172. package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.js +67 -0
  173. package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.js.map +1 -0
  174. package/dist/gasless/relay-gasless-batch/relay-gasless-batch.d.ts +30 -9
  175. package/dist/gasless/relay-gasless-batch/relay-gasless-batch.d.ts.map +1 -1
  176. package/dist/gasless/relay-gasless-batch/relay-gasless-batch.js +99 -102
  177. package/dist/gasless/relay-gasless-batch/relay-gasless-batch.js.map +1 -1
  178. package/dist/gasless/relay-gasless-batch/resolve-batch-signers.d.ts +18 -0
  179. package/dist/gasless/relay-gasless-batch/resolve-batch-signers.d.ts.map +1 -0
  180. package/dist/gasless/relay-gasless-batch/resolve-batch-signers.js +17 -0
  181. package/dist/gasless/relay-gasless-batch/resolve-batch-signers.js.map +1 -0
  182. package/dist/gasless/relay-gasless-batch/sign-gasless-batch.d.ts +8 -5
  183. package/dist/gasless/relay-gasless-batch/sign-gasless-batch.d.ts.map +1 -1
  184. package/dist/gasless/relay-gasless-batch/sign-gasless-batch.js +22 -16
  185. package/dist/gasless/relay-gasless-batch/sign-gasless-batch.js.map +1 -1
  186. package/dist/gasless/relay-grant-delegation/relay-grant-delegation.d.ts +13 -7
  187. package/dist/gasless/relay-grant-delegation/relay-grant-delegation.d.ts.map +1 -1
  188. package/dist/gasless/relay-grant-delegation/relay-grant-delegation.js +46 -36
  189. package/dist/gasless/relay-grant-delegation/relay-grant-delegation.js.map +1 -1
  190. package/dist/gasless/relay-instant-operations/relay-instant-operations.d.ts +14 -15
  191. package/dist/gasless/relay-instant-operations/relay-instant-operations.d.ts.map +1 -1
  192. package/dist/gasless/relay-instant-operations/relay-instant-operations.js +12 -11
  193. package/dist/gasless/relay-instant-operations/relay-instant-operations.js.map +1 -1
  194. package/dist/gasless/relayable-writes.d.ts.map +1 -1
  195. package/dist/gasless/relayable-writes.js +28 -0
  196. package/dist/gasless/relayable-writes.js.map +1 -1
  197. package/dist/gasless/request-headers.d.ts +7 -0
  198. package/dist/gasless/request-headers.d.ts.map +1 -0
  199. package/dist/gasless/request-headers.js +34 -0
  200. package/dist/gasless/request-headers.js.map +1 -0
  201. package/dist/gasless/resolve-wallet-identities.js +4 -4
  202. package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.d.ts +11 -4
  203. package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.d.ts.map +1 -1
  204. package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.js +2 -2
  205. package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.js.map +1 -1
  206. package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.d.ts +10 -14
  207. package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.d.ts.map +1 -1
  208. package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.js +3 -2
  209. package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.js.map +1 -1
  210. package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.d.ts +15 -15
  211. package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.d.ts.map +1 -1
  212. package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.js +13 -12
  213. package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.js.map +1 -1
  214. package/dist/gasless/unconfirmed-submit.d.ts +12 -8
  215. package/dist/gasless/unconfirmed-submit.d.ts.map +1 -1
  216. package/dist/gasless/unconfirmed-submit.js +1 -1
  217. package/dist/gasless/unconfirmed-submit.js.map +1 -1
  218. package/dist/index.d.ts +27 -10
  219. package/dist/index.d.ts.map +1 -1
  220. package/dist/index.js +680 -615
  221. package/dist/pools/listing-config/to-listing-config.d.ts +10 -3
  222. package/dist/pools/listing-config/to-listing-config.d.ts.map +1 -1
  223. package/dist/pools/listing-config/to-listing-config.js +5 -1
  224. package/dist/pools/listing-config/to-listing-config.js.map +1 -1
  225. package/dist/pools/types/generated/listing-backend.d.ts +266 -1
  226. package/dist/pools/types/generated/listing-backend.d.ts.map +1 -1
  227. package/dist/pools/types/generated/listing-backend.js.map +1 -1
  228. package/dist/pools/types.d.ts +7 -0
  229. package/dist/pools/types.d.ts.map +1 -1
  230. package/dist/pools/types.js.map +1 -1
  231. package/dist/price-service/enigma/ohlcv/fetch-enigma-ohlcv.d.ts +39 -0
  232. package/dist/price-service/enigma/ohlcv/fetch-enigma-ohlcv.d.ts.map +1 -0
  233. package/dist/price-service/enigma/ohlcv/fetch-enigma-ohlcv.js +43 -0
  234. package/dist/price-service/enigma/ohlcv/fetch-enigma-ohlcv.js.map +1 -0
  235. package/dist/price-service/enigma/ohlcv/generated/enigma-price-service-ohlcv.d.ts +67 -0
  236. package/dist/price-service/enigma/ohlcv/generated/enigma-price-service-ohlcv.d.ts.map +1 -0
  237. package/dist/price-service/enigma/ohlcv/generated/enigma-price-service-ohlcv.js +15 -0
  238. package/dist/price-service/enigma/ohlcv/generated/enigma-price-service-ohlcv.js.map +1 -0
  239. package/dist/price-service/enigma/ohlcv/parse-enigma-ohlcv.d.ts +21 -0
  240. package/dist/price-service/enigma/ohlcv/parse-enigma-ohlcv.d.ts.map +1 -0
  241. package/dist/price-service/enigma/ohlcv/parse-enigma-ohlcv.js +36 -0
  242. package/dist/price-service/enigma/ohlcv/parse-enigma-ohlcv.js.map +1 -0
  243. package/dist/price-service/enigma/symbols-info/get-enigma-price-service-symbols-info.d.ts +2 -0
  244. package/dist/price-service/enigma/symbols-info/get-enigma-price-service-symbols-info.d.ts.map +1 -1
  245. package/dist/price-service/enigma/symbols-info/get-enigma-price-service-symbols-info.js +12 -8
  246. package/dist/price-service/enigma/symbols-info/get-enigma-price-service-symbols-info.js.map +1 -1
  247. package/dist/shared/errors/symm-error.js +3 -3
  248. package/dist/shared/types/properties.d.ts +45 -8
  249. package/dist/shared/types/properties.d.ts.map +1 -1
  250. package/dist/solvers/capabilities.d.ts.map +1 -1
  251. package/dist/solvers/capabilities.js +4 -2
  252. package/dist/solvers/capabilities.js.map +1 -1
  253. package/dist/solvers/estimated-price/get-estimated-price.js +6 -6
  254. package/dist/solvers/force-close/force-close-auto.d.ts.map +1 -1
  255. package/dist/solvers/force-close/force-close-auto.js +70 -69
  256. package/dist/solvers/force-close/force-close-auto.js.map +1 -1
  257. package/dist/solvers/get-error-message/get-error-message.js +4 -4
  258. package/dist/solvers/get-party-a-upnl/get-party-a-upnl.js +4 -4
  259. package/dist/solvers/get-solver-balance-info/get-solver-balance-info.js +4 -4
  260. package/dist/solvers/get-solver-info/get-solver-info.d.ts +5 -2
  261. package/dist/solvers/get-solver-info/get-solver-info.d.ts.map +1 -1
  262. package/dist/solvers/get-solver-info/get-solver-info.js +14 -12
  263. package/dist/solvers/get-solver-info/get-solver-info.js.map +1 -1
  264. package/dist/solvers/get-solver-info/parse-timelock-info.d.ts +5 -0
  265. package/dist/solvers/get-solver-info/parse-timelock-info.d.ts.map +1 -0
  266. package/dist/solvers/get-solver-info/parse-timelock-info.js +27 -0
  267. package/dist/solvers/get-solver-info/parse-timelock-info.js.map +1 -0
  268. package/dist/solvers/get-solver-open-interest/get-solver-open-interest.js +4 -4
  269. package/dist/solvers/get-solver-price-range/get-solver-price-range.js +4 -4
  270. package/dist/solvers/get-solver-readiness/get-solver-readiness.js +4 -4
  271. package/dist/solvers/instant-open/get-instant-opens/adapters/enigma-instant-opens.js +17 -17
  272. package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.d.ts +8 -7
  273. package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.d.ts.map +1 -1
  274. package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.js +43 -39
  275. package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.js.map +1 -1
  276. package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.d.ts +16 -0
  277. package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.d.ts.map +1 -0
  278. package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.js +92 -0
  279. package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.js.map +1 -0
  280. package/dist/solvers/instant-open/instant-open/adapters/rasa-instant-open.js +1 -1
  281. package/dist/solvers/instant-open/instant-open/index.d.ts +2 -0
  282. package/dist/solvers/instant-open/instant-open/index.d.ts.map +1 -1
  283. package/dist/solvers/instant-open/instant-open/instant-open.d.ts +22 -6
  284. package/dist/solvers/instant-open/instant-open/instant-open.d.ts.map +1 -1
  285. package/dist/solvers/instant-open/instant-open/instant-open.js +35 -27
  286. package/dist/solvers/instant-open/instant-open/instant-open.js.map +1 -1
  287. package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.d.ts +12 -0
  288. package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.d.ts.map +1 -0
  289. package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.js +49 -0
  290. package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.js.map +1 -0
  291. package/dist/solvers/instant-open/instant-open/prepared/types.d.ts +20 -0
  292. package/dist/solvers/instant-open/instant-open/prepared/types.d.ts.map +1 -0
  293. package/dist/solvers/instant-open/instant-open/types.d.ts +5 -4
  294. package/dist/solvers/instant-open/instant-open/types.d.ts.map +1 -1
  295. package/dist/solvers/instant-open/shared/hedger-api.d.ts.map +1 -1
  296. package/dist/solvers/instant-open/shared/hedger-api.js +38 -26
  297. package/dist/solvers/instant-open/shared/hedger-api.js.map +1 -1
  298. package/dist/solvers/markets/adapters/enigma-markets.js +34 -34
  299. package/dist/solvers/notional-cap/get-notional-cap-page.js +4 -4
  300. package/dist/solvers/revenue/get-solver-revenue.js +10 -10
  301. package/dist/solvers/revenue-records/get-revenue-records.js +11 -11
  302. package/dist/solvers/symbols/get-symbols.js +13 -13
  303. package/dist/solvers/trade-volume/get-trade-volume.js +10 -10
  304. package/dist/symmio-contracts/abi/v0.8.6/instant-layer.d.ts +46 -0
  305. package/dist/symmio-contracts/abi/v0.8.6/instant-layer.d.ts.map +1 -1
  306. package/dist/symmio-contracts/abi/v0.8.6/instant-layer.js +53 -0
  307. package/dist/symmio-contracts/abi/v0.8.6/instant-layer.js.map +1 -1
  308. package/dist/symmio-contracts/account-layer/actions/add-margin.d.ts +3 -0
  309. package/dist/symmio-contracts/account-layer/actions/add-margin.d.ts.map +1 -1
  310. package/dist/symmio-contracts/account-layer/actions/add-margin.js +41 -27
  311. package/dist/symmio-contracts/account-layer/actions/add-margin.js.map +1 -1
  312. package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.d.ts +23 -9
  313. package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.d.ts.map +1 -1
  314. package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.js +15 -36
  315. package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.js.map +1 -1
  316. package/dist/symmio-contracts/account-layer/actions/delete-sub-account.d.ts +3 -0
  317. package/dist/symmio-contracts/account-layer/actions/delete-sub-account.d.ts.map +1 -1
  318. package/dist/symmio-contracts/account-layer/actions/delete-sub-account.js +40 -26
  319. package/dist/symmio-contracts/account-layer/actions/delete-sub-account.js.map +1 -1
  320. package/dist/symmio-contracts/account-layer/actions/edit-account-name.d.ts +1 -1
  321. package/dist/symmio-contracts/account-layer/actions/edit-account-name.d.ts.map +1 -1
  322. package/dist/symmio-contracts/account-layer/actions/edit-account-name.js +18 -37
  323. package/dist/symmio-contracts/account-layer/actions/edit-account-name.js.map +1 -1
  324. package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.d.ts +46 -0
  325. package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.d.ts.map +1 -0
  326. package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.js +20 -0
  327. package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.js.map +1 -0
  328. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.d.ts +31 -0
  329. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.d.ts.map +1 -0
  330. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.js +15 -0
  331. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.js.map +1 -0
  332. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.d.ts +54 -0
  333. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.d.ts.map +1 -0
  334. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.js +26 -0
  335. package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.js.map +1 -0
  336. package/dist/symmio-contracts/account-layer/actions/remove-margin.d.ts +3 -0
  337. package/dist/symmio-contracts/account-layer/actions/remove-margin.d.ts.map +1 -1
  338. package/dist/symmio-contracts/account-layer/actions/remove-margin.js +50 -32
  339. package/dist/symmio-contracts/account-layer/actions/remove-margin.js.map +1 -1
  340. package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.d.ts +12 -0
  341. package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.d.ts.map +1 -0
  342. package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.js +10 -0
  343. package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.js.map +1 -0
  344. package/dist/symmio-contracts/account-layer/cancel-timelock-op/index.d.ts +3 -0
  345. package/dist/symmio-contracts/account-layer/cancel-timelock-op/index.d.ts.map +1 -0
  346. package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.d.ts +9 -0
  347. package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.d.ts.map +1 -0
  348. package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.js +13 -0
  349. package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.js.map +1 -0
  350. package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.d.ts +12 -0
  351. package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.d.ts.map +1 -0
  352. package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.js +10 -0
  353. package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.js.map +1 -0
  354. package/dist/symmio-contracts/account-layer/clear-timelocks/index.d.ts +3 -0
  355. package/dist/symmio-contracts/account-layer/clear-timelocks/index.d.ts.map +1 -0
  356. package/dist/symmio-contracts/account-layer/clear-timelocks/query.d.ts +9 -0
  357. package/dist/symmio-contracts/account-layer/clear-timelocks/query.d.ts.map +1 -0
  358. package/dist/symmio-contracts/account-layer/clear-timelocks/query.js +13 -0
  359. package/dist/symmio-contracts/account-layer/clear-timelocks/query.js.map +1 -0
  360. package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.d.ts +12 -0
  361. package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.d.ts.map +1 -0
  362. package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.js +9 -0
  363. package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.js.map +1 -0
  364. package/dist/symmio-contracts/account-layer/execute-timelock-op/index.d.ts +3 -0
  365. package/dist/symmio-contracts/account-layer/execute-timelock-op/index.d.ts.map +1 -0
  366. package/dist/symmio-contracts/account-layer/execute-timelock-op/query.d.ts +9 -0
  367. package/dist/symmio-contracts/account-layer/execute-timelock-op/query.d.ts.map +1 -0
  368. package/dist/symmio-contracts/account-layer/execute-timelock-op/query.js +13 -0
  369. package/dist/symmio-contracts/account-layer/execute-timelock-op/query.js.map +1 -0
  370. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.d.ts +12 -0
  371. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.d.ts.map +1 -0
  372. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.js +16 -0
  373. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.js.map +1 -0
  374. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/index.d.ts +2 -0
  375. package/dist/symmio-contracts/account-layer/get-min-timelock-delay/index.d.ts.map +1 -0
  376. package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.d.ts +12 -0
  377. package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.d.ts.map +1 -0
  378. package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.js +22 -0
  379. package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.js.map +1 -0
  380. package/dist/symmio-contracts/account-layer/get-selector-timelock/index.d.ts +3 -0
  381. package/dist/symmio-contracts/account-layer/get-selector-timelock/index.d.ts.map +1 -0
  382. package/dist/symmio-contracts/account-layer/get-selector-timelock/query.d.ts +22 -0
  383. package/dist/symmio-contracts/account-layer/get-selector-timelock/query.d.ts.map +1 -0
  384. package/dist/symmio-contracts/account-layer/get-selector-timelock/query.js +21 -0
  385. package/dist/symmio-contracts/account-layer/get-selector-timelock/query.js.map +1 -0
  386. package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.d.ts +12 -0
  387. package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.d.ts.map +1 -0
  388. package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.js +22 -0
  389. package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.js.map +1 -0
  390. package/dist/symmio-contracts/account-layer/get-timelock-schedule/index.d.ts +2 -0
  391. package/dist/symmio-contracts/account-layer/get-timelock-schedule/index.d.ts.map +1 -0
  392. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.d.ts +13 -0
  393. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.d.ts.map +1 -0
  394. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.js +17 -0
  395. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.js.map +1 -0
  396. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/index.d.ts +2 -0
  397. package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/index.d.ts.map +1 -0
  398. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.d.ts +12 -0
  399. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.d.ts.map +1 -0
  400. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.js +67 -0
  401. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.js.map +1 -0
  402. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/index.d.ts +3 -0
  403. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/index.d.ts.map +1 -0
  404. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.d.ts +21 -0
  405. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.d.ts.map +1 -0
  406. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.js +21 -0
  407. package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.js.map +1 -0
  408. package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.d.ts +15 -0
  409. package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.d.ts.map +1 -0
  410. package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.js +17 -0
  411. package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.js.map +1 -0
  412. package/dist/symmio-contracts/account-layer/hash-timelock-approval/index.d.ts +2 -0
  413. package/dist/symmio-contracts/account-layer/hash-timelock-approval/index.d.ts.map +1 -0
  414. package/dist/symmio-contracts/account-layer/hook-metadata.d.ts +47 -0
  415. package/dist/symmio-contracts/account-layer/hook-metadata.d.ts.map +1 -0
  416. package/dist/symmio-contracts/account-layer/hook-metadata.js +30 -0
  417. package/dist/symmio-contracts/account-layer/hook-metadata.js.map +1 -0
  418. package/dist/symmio-contracts/account-layer/index.d.ts +21 -0
  419. package/dist/symmio-contracts/account-layer/index.d.ts.map +1 -1
  420. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/index.d.ts +2 -0
  421. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/index.d.ts.map +1 -0
  422. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.d.ts +14 -0
  423. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.d.ts.map +1 -0
  424. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.js +17 -0
  425. package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.js.map +1 -0
  426. package/dist/symmio-contracts/account-layer/query/generate-account-manager-address.js +6 -6
  427. package/dist/symmio-contracts/account-layer/query/get-account-balance-info.js +6 -6
  428. package/dist/symmio-contracts/account-layer/query/get-account-balance-of.js +6 -6
  429. package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.d.ts +43 -0
  430. package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.d.ts.map +1 -0
  431. package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.js +31 -0
  432. package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.js.map +1 -0
  433. package/dist/symmio-contracts/account-layer/query/get-affiliate-state.js +6 -6
  434. package/dist/symmio-contracts/account-layer/query/get-sub-account-virtual-nonce.js +6 -6
  435. package/dist/symmio-contracts/account-layer/query/get-sub-accounts-count-of-user.js +6 -6
  436. package/dist/symmio-contracts/account-layer/query/get-user-sub-accounts-addresses.js +6 -6
  437. package/dist/symmio-contracts/account-layer/query/get-user-sub-accounts.js +6 -6
  438. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-addresses-of-sub-account.js +6 -6
  439. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.d.ts +39 -0
  440. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.d.ts.map +1 -0
  441. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.js +29 -0
  442. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.js.map +1 -0
  443. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.d.ts +39 -0
  444. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.d.ts.map +1 -0
  445. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.js +31 -0
  446. package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.js.map +1 -0
  447. package/dist/symmio-contracts/account-layer/query/predict-next-virtual-account.js +6 -6
  448. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/index.d.ts +2 -0
  449. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/index.d.ts.map +1 -0
  450. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.d.ts +19 -0
  451. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.d.ts.map +1 -0
  452. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.js +10 -0
  453. package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.js.map +1 -0
  454. package/dist/symmio-contracts/account-layer/schedule-timelock-op/index.d.ts +3 -0
  455. package/dist/symmio-contracts/account-layer/schedule-timelock-op/index.d.ts.map +1 -0
  456. package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.d.ts +9 -0
  457. package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.d.ts.map +1 -0
  458. package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.js +13 -0
  459. package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.js.map +1 -0
  460. package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.d.ts +12 -0
  461. package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.d.ts.map +1 -0
  462. package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.js +10 -0
  463. package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.js.map +1 -0
  464. package/dist/symmio-contracts/account-layer/setup-timelocks/index.d.ts +3 -0
  465. package/dist/symmio-contracts/account-layer/setup-timelocks/index.d.ts.map +1 -0
  466. package/dist/symmio-contracts/account-layer/setup-timelocks/query.d.ts +9 -0
  467. package/dist/symmio-contracts/account-layer/setup-timelocks/query.d.ts.map +1 -0
  468. package/dist/symmio-contracts/account-layer/setup-timelocks/query.js +13 -0
  469. package/dist/symmio-contracts/account-layer/setup-timelocks/query.js.map +1 -0
  470. package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.d.ts +13 -0
  471. package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.d.ts.map +1 -0
  472. package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.js +18 -0
  473. package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.js.map +1 -0
  474. package/dist/symmio-contracts/account-layer/timelock-selector.d.ts +4 -0
  475. package/dist/symmio-contracts/account-layer/timelock-selector.d.ts.map +1 -0
  476. package/dist/symmio-contracts/account-layer/timelock-selector.js +9 -0
  477. package/dist/symmio-contracts/account-layer/timelock-selector.js.map +1 -0
  478. package/dist/symmio-contracts/account-layer/timelock-test.d.ts +7 -0
  479. package/dist/symmio-contracts/account-layer/timelock-test.d.ts.map +1 -0
  480. package/dist/symmio-contracts/account-layer/timelock-types.d.ts +66 -0
  481. package/dist/symmio-contracts/account-layer/timelock-types.d.ts.map +1 -0
  482. package/dist/symmio-contracts/account-layer/types.d.ts +32 -2
  483. package/dist/symmio-contracts/account-layer/types.d.ts.map +1 -1
  484. package/dist/symmio-contracts/account-layer/types.js.map +1 -1
  485. package/dist/symmio-contracts/account-layer/write-timelock.d.ts +10 -0
  486. package/dist/symmio-contracts/account-layer/write-timelock.d.ts.map +1 -0
  487. package/dist/symmio-contracts/account-layer/write-timelock.js +51 -0
  488. package/dist/symmio-contracts/account-layer/write-timelock.js.map +1 -0
  489. package/dist/symmio-contracts/instant-layer/actions/grant-delegation.d.ts +4 -1
  490. package/dist/symmio-contracts/instant-layer/actions/grant-delegation.d.ts.map +1 -1
  491. package/dist/symmio-contracts/instant-layer/actions/grant-delegation.js +42 -38
  492. package/dist/symmio-contracts/instant-layer/actions/grant-delegation.js.map +1 -1
  493. package/dist/symmio-contracts/instant-layer/actions/grant-delegations.d.ts +75 -0
  494. package/dist/symmio-contracts/instant-layer/actions/grant-delegations.d.ts.map +1 -0
  495. package/dist/symmio-contracts/instant-layer/actions/grant-delegations.js +46 -0
  496. package/dist/symmio-contracts/instant-layer/actions/grant-delegations.js.map +1 -0
  497. package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.d.ts +32 -0
  498. package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.d.ts.map +1 -0
  499. package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.js +18 -0
  500. package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.js.map +1 -0
  501. package/dist/symmio-contracts/instant-layer/grant-delegations-input.d.ts +33 -0
  502. package/dist/symmio-contracts/instant-layer/grant-delegations-input.d.ts.map +1 -0
  503. package/dist/symmio-contracts/instant-layer/grant-delegations-input.js +18 -0
  504. package/dist/symmio-contracts/instant-layer/grant-delegations-input.js.map +1 -0
  505. package/dist/symmio-contracts/instant-layer/index.d.ts +4 -0
  506. package/dist/symmio-contracts/instant-layer/index.d.ts.map +1 -1
  507. package/dist/symmio-contracts/instant-layer/query/grant-delegations.d.ts +22 -0
  508. package/dist/symmio-contracts/instant-layer/query/grant-delegations.d.ts.map +1 -0
  509. package/dist/symmio-contracts/instant-layer/query/grant-delegations.js +12 -0
  510. package/dist/symmio-contracts/instant-layer/query/grant-delegations.js.map +1 -0
  511. package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.d.ts +19 -0
  512. package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.d.ts.map +1 -0
  513. package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.js +12 -0
  514. package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.js.map +1 -0
  515. package/dist/symmio-contracts/symmio/actions/allocate.d.ts +3 -0
  516. package/dist/symmio-contracts/symmio/actions/allocate.d.ts.map +1 -1
  517. package/dist/symmio-contracts/symmio/actions/allocate.js +22 -16
  518. package/dist/symmio-contracts/symmio/actions/allocate.js.map +1 -1
  519. package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.d.ts +74 -0
  520. package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.d.ts.map +1 -0
  521. package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.js +36 -0
  522. package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.js.map +1 -0
  523. package/dist/symmio-contracts/symmio/actions/approve-operational-fee.d.ts +3 -0
  524. package/dist/symmio-contracts/symmio/actions/approve-operational-fee.d.ts.map +1 -1
  525. package/dist/symmio-contracts/symmio/actions/approve-operational-fee.js +32 -29
  526. package/dist/symmio-contracts/symmio/actions/approve-operational-fee.js.map +1 -1
  527. package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.d.ts +3 -0
  528. package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.d.ts.map +1 -1
  529. package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.js +37 -28
  530. package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.js.map +1 -1
  531. package/dist/symmio-contracts/symmio/actions/deallocate.d.ts +3 -0
  532. package/dist/symmio-contracts/symmio/actions/deallocate.d.ts.map +1 -1
  533. package/dist/symmio-contracts/symmio/actions/deallocate.js +30 -20
  534. package/dist/symmio-contracts/symmio/actions/deallocate.js.map +1 -1
  535. package/dist/symmio-contracts/symmio/actions/initiate-withdraw.d.ts +5 -0
  536. package/dist/symmio-contracts/symmio/actions/initiate-withdraw.d.ts.map +1 -1
  537. package/dist/symmio-contracts/symmio/actions/initiate-withdraw.js +31 -18
  538. package/dist/symmio-contracts/symmio/actions/initiate-withdraw.js.map +1 -1
  539. package/dist/symmio-contracts/symmio/actions/withdraw-auto.d.ts +4 -0
  540. package/dist/symmio-contracts/symmio/actions/withdraw-auto.d.ts.map +1 -1
  541. package/dist/symmio-contracts/symmio/actions/withdraw-auto.js +30 -25
  542. package/dist/symmio-contracts/symmio/actions/withdraw-auto.js.map +1 -1
  543. package/dist/symmio-contracts/symmio/actions/withdraw.d.ts +4 -0
  544. package/dist/symmio-contracts/symmio/actions/withdraw.d.ts.map +1 -1
  545. package/dist/symmio-contracts/symmio/actions/withdraw.js +12 -8
  546. package/dist/symmio-contracts/symmio/actions/withdraw.js.map +1 -1
  547. package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.d.ts +48 -0
  548. package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.d.ts.map +1 -0
  549. package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.js +33 -0
  550. package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.js.map +1 -0
  551. package/dist/symmio-contracts/symmio/execute-account-calls/index.d.ts +3 -0
  552. package/dist/symmio-contracts/symmio/execute-account-calls/index.d.ts.map +1 -0
  553. package/dist/symmio-contracts/symmio/execute-account-calls/query.d.ts +23 -0
  554. package/dist/symmio-contracts/symmio/execute-account-calls/query.d.ts.map +1 -0
  555. package/dist/symmio-contracts/symmio/execute-account-calls/query.js +12 -0
  556. package/dist/symmio-contracts/symmio/execute-account-calls/query.js.map +1 -0
  557. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.d.ts +22 -0
  558. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.d.ts.map +1 -0
  559. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.js +14 -0
  560. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.js.map +1 -0
  561. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/index.d.ts +3 -0
  562. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/index.d.ts.map +1 -0
  563. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.d.ts +34 -0
  564. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.d.ts.map +1 -0
  565. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.js +21 -0
  566. package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.js.map +1 -0
  567. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.d.ts +34 -0
  568. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.d.ts.map +1 -0
  569. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.js +35 -0
  570. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.js.map +1 -0
  571. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/index.d.ts +3 -0
  572. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/index.d.ts.map +1 -0
  573. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.d.ts +15 -0
  574. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.d.ts.map +1 -0
  575. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.js +20 -0
  576. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.js.map +1 -0
  577. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.d.ts +22 -0
  578. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.d.ts.map +1 -0
  579. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.js +30 -0
  580. package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.js.map +1 -0
  581. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.d.ts +30 -0
  582. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.d.ts.map +1 -0
  583. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.js +15 -0
  584. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.js.map +1 -0
  585. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/index.d.ts +3 -0
  586. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/index.d.ts.map +1 -0
  587. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.d.ts +38 -0
  588. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.d.ts.map +1 -0
  589. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.js +24 -0
  590. package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.js.map +1 -0
  591. package/dist/symmio-contracts/symmio/index.d.ts +6 -0
  592. package/dist/symmio-contracts/symmio/index.d.ts.map +1 -1
  593. package/dist/symmio-contracts/symmio/internal/call-as-sub-account.d.ts.map +1 -1
  594. package/dist/symmio-contracts/symmio/internal/call-as-sub-account.js +35 -34
  595. package/dist/symmio-contracts/symmio/internal/call-as-sub-account.js.map +1 -1
  596. package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.d.ts +18 -0
  597. package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.d.ts.map +1 -0
  598. package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.js +14 -0
  599. package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.js.map +1 -0
  600. package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.d.ts +18 -0
  601. package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.d.ts.map +1 -0
  602. package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.js +12 -0
  603. package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.js.map +1 -0
  604. package/dist/symmio-subgraph/executeSubgraphRequest.js +3 -3
  605. package/dist/timelock/approval.d.ts +142 -0
  606. package/dist/timelock/approval.d.ts.map +1 -0
  607. package/dist/timelock/approval.js +176 -0
  608. package/dist/timelock/approval.js.map +1 -0
  609. package/dist/timelock/attempt-outcome.d.ts +37 -0
  610. package/dist/timelock/attempt-outcome.d.ts.map +1 -0
  611. package/dist/timelock/attempt-outcome.js +70 -0
  612. package/dist/timelock/attempt-outcome.js.map +1 -0
  613. package/dist/timelock/confirm-write.d.ts +5 -0
  614. package/dist/timelock/confirm-write.d.ts.map +1 -0
  615. package/dist/timelock/confirm-write.js +18 -0
  616. package/dist/timelock/confirm-write.js.map +1 -0
  617. package/dist/timelock/early-withdraw/early-withdraw.d.ts +60 -0
  618. package/dist/timelock/early-withdraw/early-withdraw.d.ts.map +1 -0
  619. package/dist/timelock/early-withdraw/early-withdraw.js +94 -0
  620. package/dist/timelock/early-withdraw/early-withdraw.js.map +1 -0
  621. package/dist/timelock/early-withdraw/index.d.ts +2 -0
  622. package/dist/timelock/early-withdraw/index.d.ts.map +1 -0
  623. package/dist/timelock/errors.d.ts +23 -0
  624. package/dist/timelock/errors.d.ts.map +1 -0
  625. package/dist/timelock/errors.js +29 -0
  626. package/dist/timelock/errors.js.map +1 -0
  627. package/dist/timelock/execute-protected-batch.d.ts +31 -0
  628. package/dist/timelock/execute-protected-batch.d.ts.map +1 -0
  629. package/dist/timelock/execute-protected-batch.js +148 -0
  630. package/dist/timelock/execute-protected-batch.js.map +1 -0
  631. package/dist/timelock/execute-protected-call.d.ts +68 -0
  632. package/dist/timelock/execute-protected-call.d.ts.map +1 -0
  633. package/dist/timelock/execute-protected-call.js +146 -0
  634. package/dist/timelock/execute-protected-call.js.map +1 -0
  635. package/dist/timelock/execute-protected-function.d.ts +51 -0
  636. package/dist/timelock/execute-protected-function.d.ts.map +1 -0
  637. package/dist/timelock/execute-protected-function.js +37 -0
  638. package/dist/timelock/execute-protected-function.js.map +1 -0
  639. package/dist/timelock/get-timelock-policy/get-timelock-policy.d.ts +38 -0
  640. package/dist/timelock/get-timelock-policy/get-timelock-policy.d.ts.map +1 -0
  641. package/dist/timelock/get-timelock-policy/get-timelock-policy.js +49 -0
  642. package/dist/timelock/get-timelock-policy/get-timelock-policy.js.map +1 -0
  643. package/dist/timelock/get-timelock-policy/index.d.ts +3 -0
  644. package/dist/timelock/get-timelock-policy/index.d.ts.map +1 -0
  645. package/dist/timelock/get-timelock-policy/query.d.ts +13 -0
  646. package/dist/timelock/get-timelock-policy/query.d.ts.map +1 -0
  647. package/dist/timelock/get-timelock-policy/query.js +21 -0
  648. package/dist/timelock/get-timelock-policy/query.js.map +1 -0
  649. package/dist/timelock/index.d.ts +14 -0
  650. package/dist/timelock/index.d.ts.map +1 -0
  651. package/dist/timelock/normalize-timelock-revert.d.ts +3 -0
  652. package/dist/timelock/normalize-timelock-revert.d.ts.map +1 -0
  653. package/dist/timelock/normalize-timelock-revert.js +11 -0
  654. package/dist/timelock/normalize-timelock-revert.js.map +1 -0
  655. package/dist/timelock/policy-change.d.ts +72 -0
  656. package/dist/timelock/policy-change.d.ts.map +1 -0
  657. package/dist/timelock/policy-change.js +63 -0
  658. package/dist/timelock/policy-change.js.map +1 -0
  659. package/dist/timelock/policy.d.ts +19 -0
  660. package/dist/timelock/policy.d.ts.map +1 -0
  661. package/dist/timelock/policy.js +59 -0
  662. package/dist/timelock/policy.js.map +1 -0
  663. package/dist/timelock/protected-call-preflight.d.ts +10 -0
  664. package/dist/timelock/protected-call-preflight.d.ts.map +1 -0
  665. package/dist/timelock/protected-call-preflight.js +17 -0
  666. package/dist/timelock/protected-call-preflight.js.map +1 -0
  667. package/dist/timelock/root-account.d.ts +14 -0
  668. package/dist/timelock/root-account.d.ts.map +1 -0
  669. package/dist/timelock/root-account.js +9 -0
  670. package/dist/timelock/root-account.js.map +1 -0
  671. package/dist/timelock/scheduled-call-match.d.ts +4 -0
  672. package/dist/timelock/scheduled-call-match.d.ts.map +1 -0
  673. package/dist/timelock/scheduled-call-match.js +43 -0
  674. package/dist/timelock/scheduled-call-match.js.map +1 -0
  675. package/dist/timelock/setup-timelock-policy/index.d.ts +2 -0
  676. package/dist/timelock/setup-timelock-policy/index.d.ts.map +1 -0
  677. package/dist/timelock/setup-timelock-policy/setup-timelock-policy.d.ts +46 -0
  678. package/dist/timelock/setup-timelock-policy/setup-timelock-policy.d.ts.map +1 -0
  679. package/dist/timelock/setup-timelock-policy/setup-timelock-policy.js +58 -0
  680. package/dist/timelock/setup-timelock-policy/setup-timelock-policy.js.map +1 -0
  681. package/dist/timelock/support.d.ts +4 -0
  682. package/dist/timelock/support.d.ts.map +1 -0
  683. package/dist/timelock/support.js +9 -0
  684. package/dist/timelock/support.js.map +1 -0
  685. package/dist/transactions/execute-contract-write.d.ts +9 -0
  686. package/dist/transactions/execute-contract-write.d.ts.map +1 -0
  687. package/dist/transactions/execute-contract-write.js +35 -0
  688. package/dist/transactions/execute-contract-write.js.map +1 -0
  689. package/dist/transactions/execute-write.d.ts +32 -0
  690. package/dist/transactions/execute-write.d.ts.map +1 -0
  691. package/dist/transactions/execute-write.js +23 -0
  692. package/dist/transactions/execute-write.js.map +1 -0
  693. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"resubmit-gasless-request.js","names":[],"sources":["../../../src/gasless/resubmit-gasless-request/resubmit-gasless-request.ts"],"sourcesContent":["import { isAddress, type Address } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport { SymmError } from \"../../shared/errors/symm-error\";\nimport { getGaslessWalletAddress } from \"../get-gasless-wallet-address/get-gasless-wallet-address\";\nimport { postGaslessSubmit, resolveGaslessHttp } from \"../http\";\nimport { assertGaslessDepositWallet, toGaslessDepositReceipt } from \"../to-gasless-deposit-receipt\";\nimport { toGaslessSubmitReceipt } from \"../to-gasless-submit-receipt\";\nimport type { GaslessDepositSubmitReceipt, GaslessSubmitReceipt } from \"../types\";\nimport type { GaslessUnconfirmedSubmit } from \"../unconfirmed-submit\";\nimport { parseGaslessWalletId } from \"../wallet-id\";\nimport type { GaslessWireDepositAccepted, GaslessWireOperationAccepted } from \"../wire-types\";\n\n/** Parameters for {@link resubmitGaslessRequest}: the recorded submit, unchanged. */\nexport type ResubmitGaslessRequestParameters = GaslessUnconfirmedSubmit;\n\n/** Return type of {@link resubmitGaslessRequest}. */\nexport type ResubmitGaslessRequestReturnType = GaslessSubmitReceipt | GaslessDepositSubmitReceipt;\n\nfunction asRecord(value: unknown): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_RESUBMIT_BODY_INVALID\",\n \"Gasless: the recorded submit has no JSON object body, so there is nothing to resend. Only a GaslessUnconfirmedSubmit taken from getGaslessUnconfirmedSubmit can be resubmitted.\",\n );\n }\n return value as Record<string, unknown>;\n}\n\n/** Read an address the recorded body must carry, without rebuilding the body. */\nfunction requireAddress(body: Record<string, unknown>, field: string): Address {\n const value = body[field];\n if (typeof value !== \"string\" || !isAddress(value)) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_RESUBMIT_BODY_INVALID\",\n `Gasless: the recorded submit body has no valid \"${field}\" address, so the acceptance could not be attributed to an owner. Resubmit only a GaslessUnconfirmedSubmit taken from getGaslessUnconfirmedSubmit.`,\n );\n }\n return value;\n}\n\n/**\n * Resend an **unconfirmed** gasless submit, byte for byte, under its original\n * idempotency key.\n *\n * This is the vendor's prescribed recovery for a lost response: the same key\n * with the same payload either lands the request or returns the record the\n * service already created, so it can never execute the intent twice. It is the\n * *only* safe response to `GASLESS_SUBMIT_UNCONFIRMED` — re-running the intent\n * through the wallet would double-execute whatever the relayer accepted.\n *\n * The body is sent exactly as recorded, never rebuilt: the signatures inside it\n * cover specific nonces and deadlines, and a regenerated payload would be a\n * different request under a key the service has already bound.\n *\n * A deposit settlement is re-verified the same way the original submit was —\n * the wallet's deterministic address is read before the POST and checked\n * against the acceptance — so a replay can never sweep a wallet you did not\n * fund.\n *\n * @param config - The SDK config.\n * @param submit - The record from `getGaslessUnconfirmedSubmit(err)`, unmodified.\n * @returns The acceptance receipt: an operation receipt for `/gateway/relay-instant`,\n * a deposit receipt for either settlement path.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION` for the recorded chain.\n * @throws {SymmError} `GASLESS_RESUBMIT_BODY_INVALID` when the record is not a submit this SDK produced.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` again when the replay is itself\n * inconclusive — keep the record and try again later.\n *\n * @example\n * ```ts\n * try {\n * await relayInstantOperations(config, parameters);\n * } catch (err) {\n * const pending = getGaslessUnconfirmedSubmit(err);\n * if (!pending) throw err;\n * await store.save(pending);\n * const receipt = await resubmitGaslessRequest(config, pending);\n * await store.clear(pending.idempotencyKey);\n * }\n * ```\n */\nexport async function resubmitGaslessRequest(\n config: Config,\n submit: ResubmitGaslessRequestParameters,\n): Promise<ResubmitGaslessRequestReturnType> {\n const { chainId, path, body, idempotencyKey } = submit;\n const context = resolveGaslessHttp(config, { chainId, service: submit.service });\n const record = asRecord(body);\n\n if (path === \"/gateway/relay-instant\") {\n const owner = requireAddress(record, \"userAddress\");\n const walletIds = Array.isArray(record.walletIds)\n ? record.walletIds.map((walletId, index) => parseGaslessWalletId(walletId, `walletIds[${index}]`))\n : [];\n const raw = await postGaslessSubmit<GaslessWireOperationAccepted>(context, path, body, idempotencyKey);\n return toGaslessSubmitReceipt(raw, {\n owner,\n walletIds,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n }\n\n const owner = requireAddress(record, \"owner\");\n const walletId =\n record.walletId === undefined || record.walletId === null ? 0n : parseGaslessWalletId(record.walletId);\n\n /** Read before the POST, exactly as the original settlement did: a failed read must not follow a 202. */\n const depositAddress = await getGaslessWalletAddress(config, { chainId, owner, walletId });\n\n const raw = await postGaslessSubmit<GaslessWireDepositAccepted>(context, path, body, idempotencyKey);\n const receipt = toGaslessDepositReceipt(raw, {\n owner,\n walletId,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n assertGaslessDepositWallet(receipt, { walletId, depositAddress, url: context.baseURL, path });\n return receipt;\n}\n"],"mappings":";;;;;;;;AAkBA,SAAS,EAAS,GAAyC;CACzD,IAAI,OAAO,KAAU,aAAY,KAAkB,MAAM,QAAQ,CAAK,GACpE,MAAM,IAAI,EACR,cACA,iCACA,iLACF;CAEF,OAAO;AACT;AAGA,SAAS,EAAe,GAA+B,GAAwB;CAC7E,IAAM,IAAQ,EAAK;CACnB,IAAI,OAAO,KAAU,YAAY,CAAC,EAAU,CAAK,GAC/C,MAAM,IAAI,EACR,cACA,iCACA,mDAAmD,EAAM,mJAC3D;CAEF,OAAO;AACT;AA2CA,eAAsB,EACpB,GACA,GAC2C;CAC3C,IAAM,EAAE,YAAS,SAAM,SAAM,sBAAmB,GAC1C,IAAU,EAAmB,GAAQ;EAAE;EAAS,SAAS,EAAO;CAAQ,CAAC,GACzE,IAAS,EAAS,CAAI;CAE5B,IAAI,MAAS,0BAA0B;EACrC,IAAM,IAAQ,EAAe,GAAQ,aAAa,GAC5C,IAAY,MAAM,QAAQ,EAAO,SAAS,IAC5C,EAAO,UAAU,KAAK,GAAU,MAAU,EAAqB,GAAU,aAAa,EAAM,EAAE,CAAC,IAC/F,CAAC;EAEL,OAAO,EAAuB,MADZ,EAAgD,GAAS,GAAM,GAAM,CAAc,GAClE;GACjC;GACA;GACA;GACA,kBAAkB,EAAQ;EAC5B,CAAC;CACH;CAEA,IAAM,IAAQ,EAAe,GAAQ,OAAO,GACtC,IACJ,EAAO,aAAa,KAAA,KAAa,EAAO,aAAa,OAAO,KAAK,EAAqB,EAAO,QAAQ,GAGjG,IAAiB,MAAM,EAAwB,GAAQ;EAAE;EAAS;EAAO;CAAS,CAAC,GAGnF,IAAU,EAAwB,MADtB,EAA8C,GAAS,GAAM,GAAM,CAAc,GACtD;EAC3C;EACA;EACA;EACA,kBAAkB,EAAQ;CAC5B,CAAC;CAED,OADA,EAA2B,GAAS;EAAE;EAAU;EAAgB,KAAK,EAAQ;EAAS;CAAK,CAAC,GACrF;AACT"}
1
+ {"version":3,"file":"resubmit-gasless-request.js","names":[],"sources":["../../../src/gasless/resubmit-gasless-request/resubmit-gasless-request.ts"],"sourcesContent":["import { isAddress, type Address } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport { SymmError } from \"../../shared/errors/symm-error\";\nimport { getGaslessWalletAddress } from \"../get-gasless-wallet-address/get-gasless-wallet-address\";\nimport { postGaslessSubmit, resolveGaslessHttp } from \"../http\";\nimport { assertGaslessDepositWallet, toGaslessDepositReceipt } from \"../to-gasless-deposit-receipt\";\nimport { toGaslessSubmitReceipt } from \"../to-gasless-submit-receipt\";\nimport type { GaslessDepositSubmitReceipt, GaslessSubmitReceipt } from \"../types\";\nimport type { GaslessUnconfirmedSubmit } from \"../unconfirmed-submit\";\nimport { parseGaslessWalletId } from \"../wallet-id\";\nimport type { GaslessWireDepositAccepted, GaslessWireOperationAccepted } from \"../wire-types\";\n\n/** Parameters for {@link resubmitGaslessRequest}: the recorded submit, unchanged. */\nexport type ResubmitGaslessRequestParameters = GaslessUnconfirmedSubmit;\n\n/** Return type of {@link resubmitGaslessRequest}. */\nexport type ResubmitGaslessRequestReturnType = GaslessSubmitReceipt | GaslessDepositSubmitReceipt;\n\nfunction asRecord(value: unknown): Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_RESUBMIT_BODY_INVALID\",\n \"Gasless: the recorded submit has no JSON object body, so there is nothing to resend. Only a GaslessUnconfirmedSubmit taken from getGaslessUnconfirmedSubmit can be resubmitted.\",\n );\n }\n return value as Record<string, unknown>;\n}\n\n/** Read an address the recorded body must carry, without rebuilding the body. */\nfunction requireAddress(body: Record<string, unknown>, field: string): Address {\n const value = body[field];\n if (typeof value !== \"string\" || !isAddress(value)) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_RESUBMIT_BODY_INVALID\",\n `Gasless: the recorded submit body has no valid \"${field}\" address, so the acceptance could not be attributed to an owner. Resubmit only a GaslessUnconfirmedSubmit taken from getGaslessUnconfirmedSubmit.`,\n );\n }\n return value;\n}\n\n/**\n * Resend an **unconfirmed** gasless submit, byte for byte, under its original\n * idempotency key.\n *\n * This is the vendor's prescribed recovery for a lost response: the same key\n * with the same payload either lands the request or returns the record the\n * service already created, so it can never execute the intent twice. Re-running\n * the intent through the wallet would double-execute whatever the relayer\n * accepted. For a write sent with a caller-owned `gasless.idempotencyKey`,\n * calling the write again under that key is the simpler recovery: it needs no\n * recorded bytes.\n *\n * The body is sent exactly as recorded, never rebuilt: the signatures inside it\n * cover specific nonces and deadlines, and a regenerated payload would be a\n * different request under a key the service has already bound.\n *\n * A refused replay stays unconfirmed: a gateway refusal or a service verdict on\n * the replay describes only the replay, while the original attempt may have\n * executed. Keep the record, and never treat that refusal as grounds for a\n * wallet-paid retry.\n *\n * A deposit settlement is re-verified the same way the original submit was —\n * the wallet's deterministic address is read before the POST and checked\n * against the acceptance — so a replay can never sweep a wallet you did not\n * fund.\n *\n * @param config - The SDK config.\n * @param submit - The record from `getGaslessUnconfirmedSubmit(err)`, unmodified.\n * @returns The acceptance receipt: an operation receipt for `/gateway/relay-instant`,\n * a deposit receipt for either settlement path.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION` for the recorded chain.\n * @throws {SymmError} `GASLESS_RESUBMIT_BODY_INVALID` when the record is not a submit this SDK produced.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` again when the replay is itself\n * inconclusive or refused — keep the record and try again later.\n *\n * @example\n * ```ts\n * try {\n * await relayInstantOperations(config, parameters);\n * } catch (err) {\n * const pending = getGaslessUnconfirmedSubmit(err);\n * if (!pending) throw err;\n * await store.save(pending);\n * const receipt = await resubmitGaslessRequest(config, pending);\n * await store.clear(pending.idempotencyKey);\n * }\n * ```\n */\nexport async function resubmitGaslessRequest(\n config: Config,\n submit: ResubmitGaslessRequestParameters,\n): Promise<ResubmitGaslessRequestReturnType> {\n const { chainId, path, body, idempotencyKey } = submit;\n const context = resolveGaslessHttp(config, { chainId, service: submit.service });\n const record = asRecord(body);\n\n if (path === \"/gateway/relay-instant\") {\n const owner = requireAddress(record, \"userAddress\");\n const walletIds = Array.isArray(record.walletIds)\n ? record.walletIds.map((walletId, index) => parseGaslessWalletId(walletId, `walletIds[${index}]`))\n : [];\n const raw = await postGaslessSubmit<GaslessWireOperationAccepted>(context, path, body, idempotencyKey, {\n replay: true,\n });\n return toGaslessSubmitReceipt(raw, {\n owner,\n walletIds,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n }\n\n const owner = requireAddress(record, \"owner\");\n const walletId =\n record.walletId === undefined || record.walletId === null ? 0n : parseGaslessWalletId(record.walletId);\n\n /** Read before the POST, exactly as the original settlement did: a failed read must not follow a 202. */\n const depositAddress = await getGaslessWalletAddress(config, { chainId, owner, walletId });\n\n const raw = await postGaslessSubmit<GaslessWireDepositAccepted>(context, path, body, idempotencyKey, {\n replay: true,\n });\n const receipt = toGaslessDepositReceipt(raw, {\n owner,\n walletId,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n assertGaslessDepositWallet(receipt, { walletId, depositAddress, url: context.baseURL, path });\n return receipt;\n}\n"],"mappings":";;;;;;;;AAkBA,SAAS,EAAS,GAAyC;CACzD,IAAI,OAAO,KAAU,aAAY,KAAkB,MAAM,QAAQ,CAAK,GACpE,MAAM,IAAI,EACR,cACA,iCACA,iLACF;CAEF,OAAO;AACT;AAGA,SAAS,EAAe,GAA+B,GAAwB;CAC7E,IAAM,IAAQ,EAAK;CACnB,IAAI,OAAO,KAAU,YAAY,CAAC,EAAU,CAAK,GAC/C,MAAM,IAAI,EACR,cACA,iCACA,mDAAmD,EAAM,mJAC3D;CAEF,OAAO;AACT;AAkDA,eAAsB,EACpB,GACA,GAC2C;CAC3C,IAAM,EAAE,YAAS,SAAM,SAAM,sBAAmB,GAC1C,IAAU,EAAmB,GAAQ;EAAE;EAAS,SAAS,EAAO;CAAQ,CAAC,GACzE,IAAS,EAAS,CAAI;CAE5B,IAAI,MAAS,0BAA0B;EACrC,IAAM,IAAQ,EAAe,GAAQ,aAAa,GAC5C,IAAY,MAAM,QAAQ,EAAO,SAAS,IAC5C,EAAO,UAAU,KAAK,GAAU,MAAU,EAAqB,GAAU,aAAa,EAAM,EAAE,CAAC,IAC/F,CAAC;EAIL,OAAO,EAAuB,MAHZ,EAAgD,GAAS,GAAM,GAAM,GAAgB,EACrG,QAAQ,GACV,CAAC,GACkC;GACjC;GACA;GACA;GACA,kBAAkB,EAAQ;EAC5B,CAAC;CACH;CAEA,IAAM,IAAQ,EAAe,GAAQ,OAAO,GACtC,IACJ,EAAO,aAAa,KAAA,KAAa,EAAO,aAAa,OAAO,KAAK,EAAqB,EAAO,QAAQ,GAGjG,IAAiB,MAAM,EAAwB,GAAQ;EAAE;EAAS;EAAO;CAAS,CAAC,GAKnF,IAAU,EAAwB,MAHtB,EAA8C,GAAS,GAAM,GAAM,GAAgB,EACnG,QAAQ,GACV,CAAC,GAC4C;EAC3C;EACA;EACA;EACA,kBAAkB,EAAQ;CAC5B,CAAC;CAED,OADA,EAA2B,GAAS;EAAE;EAAU;EAAgB,KAAK,EAAQ;EAAS;CAAK,CAAC,GACrF;AACT"}
@@ -1,11 +1,11 @@
1
1
  import { Address } from 'viem';
2
2
  import { Config } from '../../core/config/index.js';
3
- import { ChainIdParameter, Compute } from '../../shared/types/properties.js';
3
+ import { ChainIdParameter, Compute, GaslessIdempotencyKeyParameter } from '../../shared/types/properties.js';
4
4
  import { GaslessDepositSubmitReceipt } from '../types.js';
5
5
  /**
6
6
  * Parameters for {@link settleGaslessDepositExistingAccount}.
7
7
  */
8
- export type SettleGaslessDepositExistingAccountParameters = Compute<ChainIdParameter & {
8
+ export type SettleGaslessDepositExistingAccountParameters = Compute<ChainIdParameter & GaslessIdempotencyKeyParameter & {
9
9
  /**
10
10
  * Owner of the GaslessWallet whose deposit address is being settled — an
11
11
  * owner address, never a GaslessWallet address.
@@ -18,17 +18,6 @@ export type SettleGaslessDepositExistingAccountParameters = Compute<ChainIdParam
18
18
  walletId?: bigint;
19
19
  /** The existing wallet-owned sub-account to credit; the gateway verifies ownership. */
20
20
  subAccount: Address;
21
- /**
22
- * Stable retry key; defaults to a random UUID.
23
- *
24
- * **One key per settlement attempt.** Reuse it only to replay a submit
25
- * whose response was lost — the service then returns the existing record.
26
- * A **completed** settlement's key must never be reused: mint a fresh one
27
- * after any terminal status, and after any change to the wallet selection,
28
- * or the service answers `409 IDEMPOTENCY_KEY_CONFLICT`
29
- * (`isGaslessIdempotencyConflictError`).
30
- */
31
- idempotencyKey?: string;
32
21
  }>;
33
22
  /** Return type of {@link settleGaslessDepositExistingAccount}. */
34
23
  export type SettleGaslessDepositExistingAccountReturnType = GaslessDepositSubmitReceipt;
@@ -42,9 +31,16 @@ export type SettleGaslessDepositExistingAccountReturnType = GaslessDepositSubmit
42
31
  * with `service: "deposits"`. The wallet's deterministic address is read before
43
32
  * the submit and checked against the acceptance.
44
33
  *
34
+ * `idempotencyKey` is one key per **user action** (default: a random UUID per
35
+ * call). Resubmitting under it returns the existing record; a settlement that
36
+ * reached a terminal status is over, so settling again is a new action with a
37
+ * new key. A settlement carries no signature deadline: its outcome is bounded by
38
+ * the deposit wallet's balance instead.
39
+ *
45
40
  * @param config - The SDK config.
46
- * @param parameters - Owner, optional wallet id, target sub-account, retry key.
41
+ * @param parameters - Owner, optional wallet id, target sub-account, idempotency key.
47
42
  * @returns The acceptance receipt; persist `requestId`.
43
+ * @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` for a blank key or one longer than 128 characters.
48
44
  * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.
49
45
  * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.
50
46
  * @throws {SymmApiError} `GASLESS_SETTLEMENT_SUBMIT_FAILED` on HTTP failure.
@@ -1 +1 @@
1
- {"version":3,"file":"settle-gasless-deposit-existing-account.d.ts","sourceRoot":"","sources":["../../../src/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAI/E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAO5D;;GAEG;AACH,MAAM,MAAM,6CAA6C,GAAG,OAAO,CACjE,gBAAgB,GAAG;IACjB;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CACF,CAAC;AAEF,kEAAkE;AAClE,MAAM,MAAM,6CAA6C,GAAG,2BAA2B,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,mCAAmC,CACvD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,6CAA6C,GACxD,OAAO,CAAC,6CAA6C,CAAC,CAoCxD"}
1
+ {"version":3,"file":"settle-gasless-deposit-existing-account.d.ts","sourceRoot":"","sources":["../../../src/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAK/G,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAO5D;;GAEG;AACH,MAAM,MAAM,6CAA6C,GAAG,OAAO,CACjE,gBAAgB,GACd,8BAA8B,GAAG;IAC/B;;;OAGG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,UAAU,EAAE,OAAO,CAAC;CACrB,CACJ,CAAC;AAEF,kEAAkE;AAClE,MAAM,MAAM,6CAA6C,GAAG,2BAA2B,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,mCAAmC,CACvD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,6CAA6C,GACxD,OAAO,CAAC,6CAA6C,CAAC,CAoCxD"}
@@ -1,4 +1,5 @@
1
- import { generateGaslessIdempotencyKey as e, postGaslessSubmit as t, resolveGaslessHttp as n } from "../http.js";
1
+ import { resolveGaslessIdempotencyKey as e } from "../idempotency-key.js";
2
+ import { postGaslessSubmit as t, resolveGaslessHttp as n } from "../http.js";
2
3
  import { assertGaslessWalletId as r, toGaslessWalletIdWire as i } from "../wallet-id.js";
3
4
  import { getGaslessWalletAddress as a } from "../get-gasless-wallet-address/get-gasless-wallet-address.js";
4
5
  import { assertGaslessDepositWallet as o, toGaslessDepositReceipt as s } from "../to-gasless-deposit-receipt.js";
@@ -8,7 +9,7 @@ async function l(l, u) {
8
9
  let { chainId: d, owner: f, subAccount: p } = u, m = r(u.walletId ?? 0n), h = n(l, {
9
10
  chainId: d,
10
11
  service: "deposits"
11
- }), g = u.idempotencyKey ?? e(), _ = {
12
+ }), g = e(u.idempotencyKey), _ = {
12
13
  idempotencyKey: g,
13
14
  owner: f,
14
15
  walletId: i(m),
@@ -1 +1 @@
1
- {"version":3,"file":"settle-gasless-deposit-existing-account.js","names":[],"sources":["../../../src/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { getGaslessWalletAddress } from \"../get-gasless-wallet-address/get-gasless-wallet-address\";\nimport { generateGaslessIdempotencyKey, postGaslessSubmit, resolveGaslessHttp } from \"../http\";\nimport { assertGaslessDepositWallet, toGaslessDepositReceipt } from \"../to-gasless-deposit-receipt\";\nimport type { GaslessDepositSubmitReceipt } from \"../types\";\nimport { assertGaslessWalletId, toGaslessWalletIdWire } from \"../wallet-id\";\nimport type { GaslessWireDepositAccepted, GaslessWireExistingAccountSettlementRequest } from \"../wire-types\";\n\n/** Path the existing-account settlement submits to, under the deposits service base. */\nconst SETTLE_EXISTING_ACCOUNT_PATH = \"/deposit-settlements/existing-account\";\n\n/**\n * Parameters for {@link settleGaslessDepositExistingAccount}.\n */\nexport type SettleGaslessDepositExistingAccountParameters = Compute<\n ChainIdParameter & {\n /**\n * Owner of the GaslessWallet whose deposit address is being settled — an\n * owner address, never a GaslessWallet address.\n */\n owner: Address;\n /**\n * Which of the owner's GaslessWallets to sweep. Defaults to `0n`, the\n * original wallet. Each id has its own deposit address and balance.\n */\n walletId?: bigint;\n /** The existing wallet-owned sub-account to credit; the gateway verifies ownership. */\n subAccount: Address;\n /**\n * Stable retry key; defaults to a random UUID.\n *\n * **One key per settlement attempt.** Reuse it only to replay a submit\n * whose response was lost — the service then returns the existing record.\n * A **completed** settlement's key must never be reused: mint a fresh one\n * after any terminal status, and after any change to the wallet selection,\n * or the service answers `409 IDEMPOTENCY_KEY_CONFLICT`\n * (`isGaslessIdempotencyConflictError`).\n */\n idempotencyKey?: string;\n }\n>;\n\n/** Return type of {@link settleGaslessDepositExistingAccount}. */\nexport type SettleGaslessDepositExistingAccountReturnType = GaslessDepositSubmitReceipt;\n\n/**\n * Queue the sweep of an owner's deposit address into an **existing**\n * wallet-owned sub-account (a gasless top-up).\n *\n * Same lifecycle as the new-account settlement: the entire observed balance of\n * the selected wallet settles, the flat fee is deducted, and the worker's\n * pre-broadcast re-check can still turn an accepted settlement `rejected`. Poll\n * with `service: \"deposits\"`. The wallet's deterministic address is read before\n * the submit and checked against the acceptance.\n *\n * @param config - The SDK config.\n * @param parameters - Owner, optional wallet id, target sub-account, retry key.\n * @returns The acceptance receipt; persist `requestId`.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.\n * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.\n * @throws {SymmApiError} `GASLESS_SETTLEMENT_SUBMIT_FAILED` on HTTP failure.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` when the outcome could not be\n * established; `responseData` is the replayable submit, for `resubmitGaslessRequest`.\n * @throws {SymmApiError} `GASLESS_DEPOSIT_WALLET_MISMATCH` when the acceptance names\n * another wallet or deposit address, with the parsed receipt as `responseData`.\n *\n * @example\n * ```ts\n * const receipt = await settleGaslessDepositExistingAccount(config, {\n * owner,\n * walletId: 1n,\n * subAccount,\n * });\n * ```\n */\nexport async function settleGaslessDepositExistingAccount(\n config: Config,\n parameters: SettleGaslessDepositExistingAccountParameters,\n): Promise<SettleGaslessDepositExistingAccountReturnType> {\n const { chainId, owner, subAccount } = parameters;\n const walletId = assertGaslessWalletId(parameters.walletId ?? 0n);\n const context = resolveGaslessHttp(config, { chainId, service: \"deposits\" });\n const idempotencyKey = parameters.idempotencyKey ?? generateGaslessIdempotencyKey();\n\n const body: GaslessWireExistingAccountSettlementRequest = {\n idempotencyKey,\n owner,\n walletId: toGaslessWalletIdWire(walletId),\n subAccount,\n };\n\n /** Read before the submit: the acceptance is verified against it, and a failed read must not follow a 202. */\n const depositAddress = await getGaslessWalletAddress(config, { chainId, owner, walletId });\n\n const raw = await postGaslessSubmit<GaslessWireDepositAccepted>(\n context,\n SETTLE_EXISTING_ACCOUNT_PATH,\n body,\n idempotencyKey,\n );\n\n const receipt = toGaslessDepositReceipt(raw, {\n owner,\n walletId,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n assertGaslessDepositWallet(receipt, {\n walletId,\n depositAddress,\n url: context.baseURL,\n path: SETTLE_EXISTING_ACCOUNT_PATH,\n });\n return receipt;\n}\n"],"mappings":";;;;;AAWA,IAAM,IAA+B;AAkErC,eAAsB,EACpB,GACA,GACwD;CACxD,IAAM,EAAE,YAAS,UAAO,kBAAe,GACjC,IAAW,EAAsB,EAAW,YAAY,EAAE,GAC1D,IAAU,EAAmB,GAAQ;EAAE;EAAS,SAAS;CAAW,CAAC,GACrE,IAAiB,EAAW,kBAAkB,EAA8B,GAE5E,IAAoD;EACxD;EACA;EACA,UAAU,EAAsB,CAAQ;EACxC;CACF,GAGM,IAAiB,MAAM,EAAwB,GAAQ;EAAE;EAAS;EAAO;CAAS,CAAC,GASnF,IAAU,EAAwB,MAPtB,EAChB,GACA,GACA,GACA,CACF,GAE6C;EAC3C;EACA;EACA;EACA,kBAAkB,EAAQ;CAC5B,CAAC;CAOD,OANA,EAA2B,GAAS;EAClC;EACA;EACA,KAAK,EAAQ;EACb,MAAM;CACR,CAAC,GACM;AACT"}
1
+ {"version":3,"file":"settle-gasless-deposit-existing-account.js","names":[],"sources":["../../../src/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport type { ChainIdParameter, Compute, GaslessIdempotencyKeyParameter } from \"../../shared/types/properties\";\nimport { getGaslessWalletAddress } from \"../get-gasless-wallet-address/get-gasless-wallet-address\";\nimport { postGaslessSubmit, resolveGaslessHttp } from \"../http\";\nimport { resolveGaslessIdempotencyKey } from \"../idempotency-key\";\nimport { assertGaslessDepositWallet, toGaslessDepositReceipt } from \"../to-gasless-deposit-receipt\";\nimport type { GaslessDepositSubmitReceipt } from \"../types\";\nimport { assertGaslessWalletId, toGaslessWalletIdWire } from \"../wallet-id\";\nimport type { GaslessWireDepositAccepted, GaslessWireExistingAccountSettlementRequest } from \"../wire-types\";\n\n/** Path the existing-account settlement submits to, under the deposits service base. */\nconst SETTLE_EXISTING_ACCOUNT_PATH = \"/deposit-settlements/existing-account\";\n\n/**\n * Parameters for {@link settleGaslessDepositExistingAccount}.\n */\nexport type SettleGaslessDepositExistingAccountParameters = Compute<\n ChainIdParameter &\n GaslessIdempotencyKeyParameter & {\n /**\n * Owner of the GaslessWallet whose deposit address is being settled — an\n * owner address, never a GaslessWallet address.\n */\n owner: Address;\n /**\n * Which of the owner's GaslessWallets to sweep. Defaults to `0n`, the\n * original wallet. Each id has its own deposit address and balance.\n */\n walletId?: bigint;\n /** The existing wallet-owned sub-account to credit; the gateway verifies ownership. */\n subAccount: Address;\n }\n>;\n\n/** Return type of {@link settleGaslessDepositExistingAccount}. */\nexport type SettleGaslessDepositExistingAccountReturnType = GaslessDepositSubmitReceipt;\n\n/**\n * Queue the sweep of an owner's deposit address into an **existing**\n * wallet-owned sub-account (a gasless top-up).\n *\n * Same lifecycle as the new-account settlement: the entire observed balance of\n * the selected wallet settles, the flat fee is deducted, and the worker's\n * pre-broadcast re-check can still turn an accepted settlement `rejected`. Poll\n * with `service: \"deposits\"`. The wallet's deterministic address is read before\n * the submit and checked against the acceptance.\n *\n * `idempotencyKey` is one key per **user action** (default: a random UUID per\n * call). Resubmitting under it returns the existing record; a settlement that\n * reached a terminal status is over, so settling again is a new action with a\n * new key. A settlement carries no signature deadline: its outcome is bounded by\n * the deposit wallet's balance instead.\n *\n * @param config - The SDK config.\n * @param parameters - Owner, optional wallet id, target sub-account, idempotency key.\n * @returns The acceptance receipt; persist `requestId`.\n * @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` for a blank key or one longer than 128 characters.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.\n * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.\n * @throws {SymmApiError} `GASLESS_SETTLEMENT_SUBMIT_FAILED` on HTTP failure.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` when the outcome could not be\n * established; `responseData` is the replayable submit, for `resubmitGaslessRequest`.\n * @throws {SymmApiError} `GASLESS_DEPOSIT_WALLET_MISMATCH` when the acceptance names\n * another wallet or deposit address, with the parsed receipt as `responseData`.\n *\n * @example\n * ```ts\n * const receipt = await settleGaslessDepositExistingAccount(config, {\n * owner,\n * walletId: 1n,\n * subAccount,\n * });\n * ```\n */\nexport async function settleGaslessDepositExistingAccount(\n config: Config,\n parameters: SettleGaslessDepositExistingAccountParameters,\n): Promise<SettleGaslessDepositExistingAccountReturnType> {\n const { chainId, owner, subAccount } = parameters;\n const walletId = assertGaslessWalletId(parameters.walletId ?? 0n);\n const context = resolveGaslessHttp(config, { chainId, service: \"deposits\" });\n const idempotencyKey = resolveGaslessIdempotencyKey(parameters.idempotencyKey);\n\n const body: GaslessWireExistingAccountSettlementRequest = {\n idempotencyKey,\n owner,\n walletId: toGaslessWalletIdWire(walletId),\n subAccount,\n };\n\n /** Read before the submit: the acceptance is verified against it, and a failed read must not follow a 202. */\n const depositAddress = await getGaslessWalletAddress(config, { chainId, owner, walletId });\n\n const raw = await postGaslessSubmit<GaslessWireDepositAccepted>(\n context,\n SETTLE_EXISTING_ACCOUNT_PATH,\n body,\n idempotencyKey,\n );\n\n const receipt = toGaslessDepositReceipt(raw, {\n owner,\n walletId,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n assertGaslessDepositWallet(receipt, {\n walletId,\n depositAddress,\n url: context.baseURL,\n path: SETTLE_EXISTING_ACCOUNT_PATH,\n });\n return receipt;\n}\n"],"mappings":";;;;;;AAYA,IAAM,IAA+B;AA+DrC,eAAsB,EACpB,GACA,GACwD;CACxD,IAAM,EAAE,YAAS,UAAO,kBAAe,GACjC,IAAW,EAAsB,EAAW,YAAY,EAAE,GAC1D,IAAU,EAAmB,GAAQ;EAAE;EAAS,SAAS;CAAW,CAAC,GACrE,IAAiB,EAA6B,EAAW,cAAc,GAEvE,IAAoD;EACxD;EACA;EACA,UAAU,EAAsB,CAAQ;EACxC;CACF,GAGM,IAAiB,MAAM,EAAwB,GAAQ;EAAE;EAAS;EAAO;CAAS,CAAC,GASnF,IAAU,EAAwB,MAPtB,EAChB,GACA,GACA,GACA,CACF,GAE6C;EAC3C;EACA;EACA;EACA,kBAAkB,EAAQ;CAC5B,CAAC;CAOD,OANA,EAA2B,GAAS;EAClC;EACA;EACA,KAAK,EAAQ;EACb,MAAM;CACR,CAAC,GACM;AACT"}
@@ -1,6 +1,6 @@
1
1
  import { Address, Hex } from 'viem';
2
2
  import { Config } from '../../core/config/index.js';
3
- import { ChainIdParameter, Compute } from '../../shared/types/properties.js';
3
+ import { ChainIdParameter, Compute, GaslessIdempotencyKeyParameter } from '../../shared/types/properties.js';
4
4
  import { SubAccountIsolationType } from '../../symmio-contracts/account-layer/types.js';
5
5
  import { GaslessDepositSubmitReceipt } from '../types.js';
6
6
  /**
@@ -19,13 +19,17 @@ export interface GaslessDepositAccountData {
19
19
  isolationType: SubAccountIsolationType;
20
20
  /** Whether the account runs in single-VA mode — a product decision, choose explicitly. */
21
21
  singleVAMode: boolean;
22
- /** Optional hex metadata (affiliate hooks may expect a specific encoding). Defaults to `0x`. */
22
+ /**
23
+ * Metadata forwarded unchanged to the affiliate's `onAccountCreation` hook, which decides its encoding; a blob the
24
+ * hook rejects fails the settlement with `HookFailed`. Defaults to `0x`. For the chains' default affiliates, build it
25
+ * with `encodeSubAccountHookMetadata`.
26
+ */
23
27
  metadata?: Hex;
24
28
  }
25
29
  /**
26
30
  * Parameters for {@link settleGaslessDepositNewAccount}.
27
31
  */
28
- export type SettleGaslessDepositNewAccountParameters = Compute<ChainIdParameter & {
32
+ export type SettleGaslessDepositNewAccountParameters = Compute<ChainIdParameter & GaslessIdempotencyKeyParameter & {
29
33
  /**
30
34
  * Owner of the GaslessWallet whose deposit address is being settled — an
31
35
  * owner address, never a GaslessWallet address. The new sub-account is
@@ -43,17 +47,6 @@ export type SettleGaslessDepositNewAccountParameters = Compute<ChainIdParameter
43
47
  affiliate: Address;
44
48
  /** Creation data for the new wallet-owned sub-account. */
45
49
  accountData: GaslessDepositAccountData;
46
- /**
47
- * Stable retry key; defaults to a random UUID.
48
- *
49
- * **One key per settlement attempt.** Reuse it only to replay a submit
50
- * whose response was lost — the service then returns the existing record.
51
- * A **completed** settlement's key must never be reused: mint a fresh one
52
- * after any terminal status, and after any change to the wallet selection,
53
- * or the service answers `409 IDEMPOTENCY_KEY_CONFLICT`
54
- * (`isGaslessIdempotencyConflictError`).
55
- */
56
- idempotencyKey?: string;
57
50
  /** Non-secret client correlation data stored with the request. */
58
51
  metadata?: Record<string, unknown>;
59
52
  }>;
@@ -78,9 +71,16 @@ export type SettleGaslessDepositNewAccountReturnType = GaslessDepositSubmitRecei
78
71
  * silently. A sweep takes the whole balance of the selected id, so give a
79
72
  * deposit flow its own id when it must not share a balance with another flow.
80
73
  *
74
+ * `idempotencyKey` is one key per **user action** (default: a random UUID per
75
+ * call). Resubmitting under it returns the existing record; a settlement that
76
+ * reached a terminal status is over, so settling again is a new action with a
77
+ * new key. A settlement carries no signature deadline: its outcome is bounded by
78
+ * the deposit wallet's balance instead.
79
+ *
81
80
  * @param config - The SDK config.
82
- * @param parameters - Owner, optional wallet id, affiliate, account creation data, retry key.
81
+ * @param parameters - Owner, optional wallet id, affiliate, account creation data, idempotency key.
83
82
  * @returns The acceptance receipt (with the observed/credited estimates); persist `requestId`.
83
+ * @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` for a blank key or one longer than 128 characters.
84
84
  * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.
85
85
  * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.
86
86
  * @throws {SymmApiError} `GASLESS_SETTLEMENT_SUBMIT_FAILED` on HTTP failure —
@@ -1 +1 @@
1
- {"version":3,"file":"settle-gasless-deposit-new-account.d.ts","sourceRoot":"","sources":["../../../src/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAI1F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAO5D;;;;;;;;GAQG;AACH,MAAM,WAAW,yBAAyB;IACxC,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,aAAa,EAAE,uBAAuB,CAAC;IACvC,0FAA0F;IAC1F,YAAY,EAAE,OAAO,CAAC;IACtB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAAG,OAAO,CAC5D,gBAAgB,GAAG;IACjB;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,SAAS,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,WAAW,EAAE,yBAAyB,CAAC;IACvC;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CACF,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,wCAAwC,GAAG,2BAA2B,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,wCAAwC,GACnD,OAAO,CAAC,wCAAwC,CAAC,CA2CnD"}
1
+ {"version":3,"file":"settle-gasless-deposit-new-account.d.ts","sourceRoot":"","sources":["../../../src/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/G,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAK1F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAO5D;;;;;;;;GAQG;AACH,MAAM,WAAW,yBAAyB;IACxC,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,aAAa,EAAE,uBAAuB,CAAC;IACvC,0FAA0F;IAC1F,YAAY,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAAG,OAAO,CAC5D,gBAAgB,GACd,8BAA8B,GAAG;IAC/B;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,SAAS,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,WAAW,EAAE,yBAAyB,CAAC;IACvC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CACJ,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,wCAAwC,GAAG,2BAA2B,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,wCAAwC,GACnD,OAAO,CAAC,wCAAwC,CAAC,CA2CnD"}
@@ -1,17 +1,18 @@
1
- import { generateGaslessIdempotencyKey as e, postGaslessSubmit as t, resolveGaslessHttp as n } from "../http.js";
1
+ import { resolveGaslessIdempotencyKey as e } from "../idempotency-key.js";
2
+ import { postGaslessSubmit as t, resolveGaslessHttp as n } from "../http.js";
2
3
  import { assertGaslessWalletId as r, toGaslessWalletIdWire as i } from "../wallet-id.js";
3
4
  import { getGaslessWalletAddress as a } from "../get-gasless-wallet-address/get-gasless-wallet-address.js";
4
5
  import { assertGaslessDepositWallet as o, toGaslessDepositReceipt as s } from "../to-gasless-deposit-receipt.js";
5
6
  //#region src/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.ts
6
7
  var c = "/deposit-settlements/new-account";
7
8
  async function l(l, u) {
8
- let { chainId: d, owner: f, affiliate: p, accountData: m, metadata: h } = u, g = r(u.walletId ?? 0n), _ = n(l, {
9
+ let { chainId: d, owner: f, affiliate: p, accountData: m, metadata: h } = u, g = e(u.idempotencyKey), _ = r(u.walletId ?? 0n), v = n(l, {
9
10
  chainId: d,
10
11
  service: "deposits"
11
- }), v = u.idempotencyKey ?? e(), y = {
12
- idempotencyKey: v,
12
+ }), y = {
13
+ idempotencyKey: g,
13
14
  owner: f,
14
- walletId: i(g),
15
+ walletId: i(_),
15
16
  affiliate: p,
16
17
  accountData: {
17
18
  name: m.name,
@@ -23,17 +24,17 @@ async function l(l, u) {
23
24
  }, b = await a(l, {
24
25
  chainId: d,
25
26
  owner: f,
26
- walletId: g
27
- }), x = s(await t(_, c, y, v), {
27
+ walletId: _
28
+ }), x = s(await t(v, c, y, g), {
28
29
  owner: f,
29
- walletId: g,
30
- idempotencyKey: v,
31
- protocolInstance: _.protocolInstance
30
+ walletId: _,
31
+ idempotencyKey: g,
32
+ protocolInstance: v.protocolInstance
32
33
  });
33
34
  return o(x, {
34
- walletId: g,
35
+ walletId: _,
35
36
  depositAddress: b,
36
- url: _.baseURL,
37
+ url: v.baseURL,
37
38
  path: c
38
39
  }), x;
39
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"settle-gasless-deposit-new-account.js","names":[],"sources":["../../../src/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.ts"],"sourcesContent":["import type { Address, Hex } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport type { SubAccountIsolationType } from \"../../symmio-contracts/account-layer/types\";\nimport { getGaslessWalletAddress } from \"../get-gasless-wallet-address/get-gasless-wallet-address\";\nimport { generateGaslessIdempotencyKey, postGaslessSubmit, resolveGaslessHttp } from \"../http\";\nimport { assertGaslessDepositWallet, toGaslessDepositReceipt } from \"../to-gasless-deposit-receipt\";\nimport type { GaslessDepositSubmitReceipt } from \"../types\";\nimport { assertGaslessWalletId, toGaslessWalletIdWire } from \"../wallet-id\";\nimport type { GaslessWireDepositAccepted, GaslessWireNewAccountSettlementRequest } from \"../wire-types\";\n\n/** Path the new-account settlement submits to, under the deposits service base. */\nconst SETTLE_NEW_ACCOUNT_PATH = \"/deposit-settlements/new-account\";\n\n/**\n * Creation data for the sub-account a new-account settlement creates.\n *\n * `isolationType` and `singleVAMode` are deliberately **required**: they are\n * product decisions (the lowcap flow uses `MARKET_DIRECTION` with\n * `singleVAMode: true`; majors differ), and the service-side defaults would be\n * silently wrong for either product. There is no `symmioCore` field — the\n * gateway overwrites it with its configured core.\n */\nexport interface GaslessDepositAccountData {\n /** Sub-account name, 1–64 characters. */\n name: string;\n /** Sub-account isolation strategy — a product decision, choose explicitly. */\n isolationType: SubAccountIsolationType;\n /** Whether the account runs in single-VA mode — a product decision, choose explicitly. */\n singleVAMode: boolean;\n /** Optional hex metadata (affiliate hooks may expect a specific encoding). Defaults to `0x`. */\n metadata?: Hex;\n}\n\n/**\n * Parameters for {@link settleGaslessDepositNewAccount}.\n */\nexport type SettleGaslessDepositNewAccountParameters = Compute<\n ChainIdParameter & {\n /**\n * Owner of the GaslessWallet whose deposit address is being settled — an\n * owner address, never a GaslessWallet address. The new sub-account is\n * created for this owner.\n */\n owner: Address;\n /**\n * Which of the owner's GaslessWallets to sweep. Defaults to `0n`, the\n * original wallet. Each id has its own deposit address and its own balance:\n * settle the id you funded, and read that id's address with\n * `getGaslessWalletAddress` before sending anything to it.\n */\n walletId?: bigint;\n /** Affiliate passed to `settleDepositToNewAccount`; the zero address disables attribution. */\n affiliate: Address;\n /** Creation data for the new wallet-owned sub-account. */\n accountData: GaslessDepositAccountData;\n /**\n * Stable retry key; defaults to a random UUID.\n *\n * **One key per settlement attempt.** Reuse it only to replay a submit\n * whose response was lost — the service then returns the existing record.\n * A **completed** settlement's key must never be reused: mint a fresh one\n * after any terminal status, and after any change to the wallet selection,\n * or the service answers `409 IDEMPOTENCY_KEY_CONFLICT`\n * (`isGaslessIdempotencyConflictError`).\n */\n idempotencyKey?: string;\n /** Non-secret client correlation data stored with the request. */\n metadata?: Record<string, unknown>;\n }\n>;\n\n/** Return type of {@link settleGaslessDepositNewAccount}. */\nexport type SettleGaslessDepositNewAccountReturnType = GaslessDepositSubmitReceipt;\n\n/**\n * Queue the sweep of an owner's deposit address into a **new** wallet-owned\n * sub-account.\n *\n * The gateway settles the **entire observed collateral balance** at the\n * selected wallet's deposit address, deducts the flat fee, creates the\n * sub-account, and credits the net amount — paying all gas itself. The worker\n * re-checks balance, fee, and minimum before broadcast, so an accepted\n * settlement can still turn `rejected` (funds not yet visible, or moved). Poll\n * with `service: \"deposits\"`. A `succeeded` settlement is not instantly\n * readable — wait until the sub-account and its balance appear on-chain before\n * flipping the UI.\n *\n * The wallet's deterministic address is read **before** the submit and checked\n * against the acceptance, so a settlement that would sweep a different wallet\n * than the one you funded surfaces as an error instead of moving funds\n * silently. A sweep takes the whole balance of the selected id, so give a\n * deposit flow its own id when it must not share a balance with another flow.\n *\n * @param config - The SDK config.\n * @param parameters - Owner, optional wallet id, affiliate, account creation data, retry key.\n * @returns The acceptance receipt (with the observed/credited estimates); persist `requestId`.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.\n * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.\n * @throws {SymmApiError} `GASLESS_SETTLEMENT_SUBMIT_FAILED` on HTTP failure —\n * `DEPOSIT_BELOW_MINIMUM` in the vendor detail means the address is not\n * funded to the settlement minimum yet.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` when the outcome could not be\n * established; `responseData` is the replayable submit, for `resubmitGaslessRequest`.\n * @throws {SymmApiError} `GASLESS_DEPOSIT_WALLET_MISMATCH` when the acceptance names\n * another wallet or deposit address. The request is already accepted, so the\n * error carries the parsed receipt (with its `requestId`) as `responseData`.\n *\n * @example\n * ```ts\n * const receipt = await settleGaslessDepositNewAccount(config, {\n * owner,\n * walletId: 1n,\n * affiliate: zeroAddress,\n * accountData: { name: \"Main\", isolationType: SubAccountIsolationType.MARKET_DIRECTION, singleVAMode: true },\n * });\n * ```\n */\nexport async function settleGaslessDepositNewAccount(\n config: Config,\n parameters: SettleGaslessDepositNewAccountParameters,\n): Promise<SettleGaslessDepositNewAccountReturnType> {\n const { chainId, owner, affiliate, accountData, metadata } = parameters;\n const walletId = assertGaslessWalletId(parameters.walletId ?? 0n);\n const context = resolveGaslessHttp(config, { chainId, service: \"deposits\" });\n const idempotencyKey = parameters.idempotencyKey ?? generateGaslessIdempotencyKey();\n\n const body: GaslessWireNewAccountSettlementRequest = {\n idempotencyKey,\n owner,\n walletId: toGaslessWalletIdWire(walletId),\n affiliate,\n accountData: {\n name: accountData.name,\n metadata: accountData.metadata ?? \"0x\",\n isolationType: accountData.isolationType,\n singleVAMode: accountData.singleVAMode,\n },\n ...(metadata !== undefined ? { metadata } : {}),\n };\n\n /** Read before the submit: the acceptance is verified against it, and a failed read must not follow a 202. */\n const depositAddress = await getGaslessWalletAddress(config, { chainId, owner, walletId });\n\n const raw = await postGaslessSubmit<GaslessWireDepositAccepted>(\n context,\n SETTLE_NEW_ACCOUNT_PATH,\n body,\n idempotencyKey,\n );\n\n const receipt = toGaslessDepositReceipt(raw, {\n owner,\n walletId,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n assertGaslessDepositWallet(receipt, {\n walletId,\n depositAddress,\n url: context.baseURL,\n path: SETTLE_NEW_ACCOUNT_PATH,\n });\n return receipt;\n}\n"],"mappings":";;;;;AAYA,IAAM,IAA0B;AA0GhC,eAAsB,EACpB,GACA,GACmD;CACnD,IAAM,EAAE,YAAS,UAAO,cAAW,gBAAa,gBAAa,GACvD,IAAW,EAAsB,EAAW,YAAY,EAAE,GAC1D,IAAU,EAAmB,GAAQ;EAAE;EAAS,SAAS;CAAW,CAAC,GACrE,IAAiB,EAAW,kBAAkB,EAA8B,GAE5E,IAA+C;EACnD;EACA;EACA,UAAU,EAAsB,CAAQ;EACxC;EACA,aAAa;GACX,MAAM,EAAY;GAClB,UAAU,EAAY,YAAY;GAClC,eAAe,EAAY;GAC3B,cAAc,EAAY;EAC5B;EACA,GAAI,MAAa,KAAA,IAA2B,CAAC,IAAhB,EAAE,YAAS;CAC1C,GAGM,IAAiB,MAAM,EAAwB,GAAQ;EAAE;EAAS;EAAO;CAAS,CAAC,GASnF,IAAU,EAAwB,MAPtB,EAChB,GACA,GACA,GACA,CACF,GAE6C;EAC3C;EACA;EACA;EACA,kBAAkB,EAAQ;CAC5B,CAAC;CAOD,OANA,EAA2B,GAAS;EAClC;EACA;EACA,KAAK,EAAQ;EACb,MAAM;CACR,CAAC,GACM;AACT"}
1
+ {"version":3,"file":"settle-gasless-deposit-new-account.js","names":[],"sources":["../../../src/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.ts"],"sourcesContent":["import type { Address, Hex } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport type { ChainIdParameter, Compute, GaslessIdempotencyKeyParameter } from \"../../shared/types/properties\";\nimport type { SubAccountIsolationType } from \"../../symmio-contracts/account-layer/types\";\nimport { getGaslessWalletAddress } from \"../get-gasless-wallet-address/get-gasless-wallet-address\";\nimport { postGaslessSubmit, resolveGaslessHttp } from \"../http\";\nimport { resolveGaslessIdempotencyKey } from \"../idempotency-key\";\nimport { assertGaslessDepositWallet, toGaslessDepositReceipt } from \"../to-gasless-deposit-receipt\";\nimport type { GaslessDepositSubmitReceipt } from \"../types\";\nimport { assertGaslessWalletId, toGaslessWalletIdWire } from \"../wallet-id\";\nimport type { GaslessWireDepositAccepted, GaslessWireNewAccountSettlementRequest } from \"../wire-types\";\n\n/** Path the new-account settlement submits to, under the deposits service base. */\nconst SETTLE_NEW_ACCOUNT_PATH = \"/deposit-settlements/new-account\";\n\n/**\n * Creation data for the sub-account a new-account settlement creates.\n *\n * `isolationType` and `singleVAMode` are deliberately **required**: they are\n * product decisions (the lowcap flow uses `MARKET_DIRECTION` with\n * `singleVAMode: true`; majors differ), and the service-side defaults would be\n * silently wrong for either product. There is no `symmioCore` field — the\n * gateway overwrites it with its configured core.\n */\nexport interface GaslessDepositAccountData {\n /** Sub-account name, 1–64 characters. */\n name: string;\n /** Sub-account isolation strategy — a product decision, choose explicitly. */\n isolationType: SubAccountIsolationType;\n /** Whether the account runs in single-VA mode — a product decision, choose explicitly. */\n singleVAMode: boolean;\n /**\n * Metadata forwarded unchanged to the affiliate's `onAccountCreation` hook, which decides its encoding; a blob the\n * hook rejects fails the settlement with `HookFailed`. Defaults to `0x`. For the chains' default affiliates, build it\n * with `encodeSubAccountHookMetadata`.\n */\n metadata?: Hex;\n}\n\n/**\n * Parameters for {@link settleGaslessDepositNewAccount}.\n */\nexport type SettleGaslessDepositNewAccountParameters = Compute<\n ChainIdParameter &\n GaslessIdempotencyKeyParameter & {\n /**\n * Owner of the GaslessWallet whose deposit address is being settled — an\n * owner address, never a GaslessWallet address. The new sub-account is\n * created for this owner.\n */\n owner: Address;\n /**\n * Which of the owner's GaslessWallets to sweep. Defaults to `0n`, the\n * original wallet. Each id has its own deposit address and its own balance:\n * settle the id you funded, and read that id's address with\n * `getGaslessWalletAddress` before sending anything to it.\n */\n walletId?: bigint;\n /** Affiliate passed to `settleDepositToNewAccount`; the zero address disables attribution. */\n affiliate: Address;\n /** Creation data for the new wallet-owned sub-account. */\n accountData: GaslessDepositAccountData;\n /** Non-secret client correlation data stored with the request. */\n metadata?: Record<string, unknown>;\n }\n>;\n\n/** Return type of {@link settleGaslessDepositNewAccount}. */\nexport type SettleGaslessDepositNewAccountReturnType = GaslessDepositSubmitReceipt;\n\n/**\n * Queue the sweep of an owner's deposit address into a **new** wallet-owned\n * sub-account.\n *\n * The gateway settles the **entire observed collateral balance** at the\n * selected wallet's deposit address, deducts the flat fee, creates the\n * sub-account, and credits the net amount — paying all gas itself. The worker\n * re-checks balance, fee, and minimum before broadcast, so an accepted\n * settlement can still turn `rejected` (funds not yet visible, or moved). Poll\n * with `service: \"deposits\"`. A `succeeded` settlement is not instantly\n * readable — wait until the sub-account and its balance appear on-chain before\n * flipping the UI.\n *\n * The wallet's deterministic address is read **before** the submit and checked\n * against the acceptance, so a settlement that would sweep a different wallet\n * than the one you funded surfaces as an error instead of moving funds\n * silently. A sweep takes the whole balance of the selected id, so give a\n * deposit flow its own id when it must not share a balance with another flow.\n *\n * `idempotencyKey` is one key per **user action** (default: a random UUID per\n * call). Resubmitting under it returns the existing record; a settlement that\n * reached a terminal status is over, so settling again is a new action with a\n * new key. A settlement carries no signature deadline: its outcome is bounded by\n * the deposit wallet's balance instead.\n *\n * @param config - The SDK config.\n * @param parameters - Owner, optional wallet id, affiliate, account creation data, idempotency key.\n * @returns The acceptance receipt (with the observed/credited estimates); persist `requestId`.\n * @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` for a blank key or one longer than 128 characters.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.\n * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.\n * @throws {SymmApiError} `GASLESS_SETTLEMENT_SUBMIT_FAILED` on HTTP failure —\n * `DEPOSIT_BELOW_MINIMUM` in the vendor detail means the address is not\n * funded to the settlement minimum yet.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` when the outcome could not be\n * established; `responseData` is the replayable submit, for `resubmitGaslessRequest`.\n * @throws {SymmApiError} `GASLESS_DEPOSIT_WALLET_MISMATCH` when the acceptance names\n * another wallet or deposit address. The request is already accepted, so the\n * error carries the parsed receipt (with its `requestId`) as `responseData`.\n *\n * @example\n * ```ts\n * const receipt = await settleGaslessDepositNewAccount(config, {\n * owner,\n * walletId: 1n,\n * affiliate: zeroAddress,\n * accountData: { name: \"Main\", isolationType: SubAccountIsolationType.MARKET_DIRECTION, singleVAMode: true },\n * });\n * ```\n */\nexport async function settleGaslessDepositNewAccount(\n config: Config,\n parameters: SettleGaslessDepositNewAccountParameters,\n): Promise<SettleGaslessDepositNewAccountReturnType> {\n const { chainId, owner, affiliate, accountData, metadata } = parameters;\n const idempotencyKey = resolveGaslessIdempotencyKey(parameters.idempotencyKey);\n const walletId = assertGaslessWalletId(parameters.walletId ?? 0n);\n const context = resolveGaslessHttp(config, { chainId, service: \"deposits\" });\n\n const body: GaslessWireNewAccountSettlementRequest = {\n idempotencyKey,\n owner,\n walletId: toGaslessWalletIdWire(walletId),\n affiliate,\n accountData: {\n name: accountData.name,\n metadata: accountData.metadata ?? \"0x\",\n isolationType: accountData.isolationType,\n singleVAMode: accountData.singleVAMode,\n },\n ...(metadata !== undefined ? { metadata } : {}),\n };\n\n /** Read before the submit: the acceptance is verified against it, and a failed read must not follow a 202. */\n const depositAddress = await getGaslessWalletAddress(config, { chainId, owner, walletId });\n\n const raw = await postGaslessSubmit<GaslessWireDepositAccepted>(\n context,\n SETTLE_NEW_ACCOUNT_PATH,\n body,\n idempotencyKey,\n );\n\n const receipt = toGaslessDepositReceipt(raw, {\n owner,\n walletId,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n assertGaslessDepositWallet(receipt, {\n walletId,\n depositAddress,\n url: context.baseURL,\n path: SETTLE_NEW_ACCOUNT_PATH,\n });\n return receipt;\n}\n"],"mappings":";;;;;;AAaA,IAAM,IAA0B;AA2GhC,eAAsB,EACpB,GACA,GACmD;CACnD,IAAM,EAAE,YAAS,UAAO,cAAW,gBAAa,gBAAa,GACvD,IAAiB,EAA6B,EAAW,cAAc,GACvE,IAAW,EAAsB,EAAW,YAAY,EAAE,GAC1D,IAAU,EAAmB,GAAQ;EAAE;EAAS,SAAS;CAAW,CAAC,GAErE,IAA+C;EACnD;EACA;EACA,UAAU,EAAsB,CAAQ;EACxC;EACA,aAAa;GACX,MAAM,EAAY;GAClB,UAAU,EAAY,YAAY;GAClC,eAAe,EAAY;GAC3B,cAAc,EAAY;EAC5B;EACA,GAAI,MAAa,KAAA,IAA2B,CAAC,IAAhB,EAAE,YAAS;CAC1C,GAGM,IAAiB,MAAM,EAAwB,GAAQ;EAAE;EAAS;EAAO;CAAS,CAAC,GASnF,IAAU,EAAwB,MAPtB,EAChB,GACA,GACA,GACA,CACF,GAE6C;EAC3C;EACA;EACA;EACA,kBAAkB,EAAQ;CAC5B,CAAC;CAOD,OANA,EAA2B,GAAS;EAClC;EACA;EACA,KAAK,EAAQ;EACb,MAAM;CACR,CAAC,GACM;AACT"}
@@ -108,14 +108,18 @@ export declare function readGaslessErrorCode(err: unknown): string | undefined;
108
108
  */
109
109
  export declare function getGaslessUnconfirmedSubmit(err: unknown): GaslessUnconfirmedSubmit | null;
110
110
  /**
111
- * Whether an error is the gateway's `409 IDEMPOTENCY_KEY_CONFLICT` — the key
112
- * is already bound to a **different** wallet selection or workflow.
111
+ * Whether an error is a `409 IDEMPOTENCY_KEY_CONFLICT`.
113
112
  *
114
- * It is a client bug, never a transport failure: the service refused to reuse
115
- * the key for a payload that is not the one it first saw. Mint a fresh key for
116
- * the new action; re-signing with the old key cannot succeed. It is also never
117
- * grounds for a wallet-paid retry, because the workflow the key does belong to
118
- * may still be executing.
113
+ * The current service never sends it: a submit under a key that is already
114
+ * bound to a request gets that request back instead (`202`), whatever its
115
+ * body. The check is a safeguard for a deployment that adopts the conflict
116
+ * answer.
117
+ *
118
+ * Should it arrive, treat the action as unresolved: an earlier attempt may
119
+ * hold the key, and its outcome is unknown. Do not send the action again — not
120
+ * under this key, not under a new one, and never through the wallet. Keep the
121
+ * action pending and reconcile it once its last attempt can no longer execute
122
+ * (`GASLESS_SIGNATURE_LIFETIME_SECONDS`).
119
123
  *
120
124
  * @param err - Anything caught from a gasless submit, including an error a
121
125
  * framework layer re-wrapped.
@@ -124,7 +128,7 @@ export declare function getGaslessUnconfirmedSubmit(err: unknown): GaslessUnconf
124
128
  * @example
125
129
  * ```ts
126
130
  * if (isGaslessIdempotencyConflictError(err)) {
127
- * // reconcile the workflow this key already created, then rebuild with a new key
131
+ * // an earlier attempt holds the key: keep the action pending and reconcile it
128
132
  * }
129
133
  * ```
130
134
  */
@@ -1 +1 @@
1
- {"version":3,"file":"unconfirmed-submit.d.ts","sourceRoot":"","sources":["../../src/gasless/unconfirmed-submit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAK5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;CAI4C,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,wBAAwB;IACvC,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,OAAO,EAAE,cAAc,CAAC;IACxB,+CAA+C;IAC/C,IAAI,EAAE,iBAAiB,CAAC;IACxB,8DAA8D;IAC9D,IAAI,EAAE,OAAO,CAAC;IACd,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIvE;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGrE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,wBAAwB,GAAG,IAAI,CAYzF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIvE"}
1
+ {"version":3,"file":"unconfirmed-submit.d.ts","sourceRoot":"","sources":["../../src/gasless/unconfirmed-submit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,+BAA+B,CAAC;AAK5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;CAI4C,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,wBAAwB;IACvC,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,OAAO,EAAE,cAAc,CAAC;IACxB,+CAA+C;IAC/C,IAAI,EAAE,iBAAiB,CAAC;IACxB,8DAA8D;IAC9D,IAAI,EAAE,OAAO,CAAC;IACd,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIvE;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGrE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,wBAAwB,GAAG,IAAI,CAYzF;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIvE"}
@@ -44,6 +44,6 @@ function c(t) {
44
44
  return r === void 0 || r === 409;
45
45
  }
46
46
  //#endregion
47
- export { r as GASLESS_SUBMIT_ROUTES, t as GASLESS_SUBMIT_UNCONFIRMED_CODE, s as getGaslessUnconfirmedSubmit, c as isGaslessIdempotencyConflictError, a as readGaslessErrorStatus };
47
+ export { r as GASLESS_SUBMIT_ROUTES, t as GASLESS_SUBMIT_UNCONFIRMED_CODE, s as getGaslessUnconfirmedSubmit, c as isGaslessIdempotencyConflictError, o as readGaslessErrorCode, a as readGaslessErrorStatus };
48
48
 
49
49
  //# sourceMappingURL=unconfirmed-submit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unconfirmed-submit.js","names":[],"sources":["../../src/gasless/unconfirmed-submit.ts"],"sourcesContent":["import { parseGaslessErrorDetail } from \"./errors\";\nimport type { GaslessService } from \"./types\";\n\n/**\n * SDK error code of a submit whose outcome the SDK could not establish.\n *\n * @internal\n */\nexport const GASLESS_SUBMIT_UNCONFIRMED_CODE = \"GASLESS_SUBMIT_UNCONFIRMED\";\n\n/** Vendor code of a key already bound to a different wallet selection or workflow. */\nconst GASLESS_IDEMPOTENCY_CONFLICT_CODE = \"IDEMPOTENCY_KEY_CONFLICT\";\n\n/**\n * The gateway paths a gasless **submit** POSTs to, with the service that stores\n * the resulting workflow and the SDK error code its failures carry.\n *\n * A submit is the only kind of gasless request that can leave a side effect\n * behind when its response is lost, so the retry, idempotency and\n * \"unconfirmed\" machinery is keyed off this table rather than off a free-form\n * path string.\n *\n * @internal\n */\nexport const GASLESS_SUBMIT_ROUTES = {\n \"/gateway/relay-instant\": { service: \"operations\", code: \"GASLESS_RELAY_SUBMIT_FAILED\" },\n \"/deposit-settlements/new-account\": { service: \"deposits\", code: \"GASLESS_SETTLEMENT_SUBMIT_FAILED\" },\n \"/deposit-settlements/existing-account\": { service: \"deposits\", code: \"GASLESS_SETTLEMENT_SUBMIT_FAILED\" },\n} as const satisfies Record<string, { service: GaslessService; code: string }>;\n\n/**\n * One of the three gateway paths a gasless submit POSTs to.\n *\n * Closed on purpose: a resubmit replays the recorded bytes against the same\n * route, and an open string would let an arbitrary path be POSTed with a\n * signed body.\n */\nexport type GaslessSubmitPath = keyof typeof GASLESS_SUBMIT_ROUTES;\n\n/**\n * Everything needed to replay one gasless submit **byte-for-byte**, recovered\n * from a `GASLESS_SUBMIT_UNCONFIRMED` error with\n * {@link getGaslessUnconfirmedSubmit}.\n *\n * The vendor's contract is that resending the identical request under the same\n * idempotency key either lands it or returns the record it already created, so\n * a lost response is recoverable — but only if the exact JSON that was sent is\n * still available. That is what this carries: `body` is the object that was\n * serialized, not a rebuilt equivalent.\n *\n * Persist it next to the workflow you were submitting. Do **not** ship it to\n * third-party logging: `body` holds the user's signed operations, and a\n * signature the service never executed stays valid until its deadline.\n */\nexport interface GaslessUnconfirmedSubmit {\n /** The chain the submit was made on. */\n chainId: number;\n /** The service that stores the workflow, derived from {@link GaslessUnconfirmedSubmit.path}. */\n service: GaslessService;\n /** The gateway path the body was POSTed to. */\n path: GaslessSubmitPath;\n /** The exact JSON body that was sent, to resend unchanged. */\n body: unknown;\n /** The idempotency key the submit carried, and that a resend must reuse. */\n idempotencyKey: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * The HTTP status an error reports, whatever error class carries it.\n *\n * Read structurally rather than through `instanceof SymmApiError`, so the\n * gasless predicates keep working on the error a framework layer re-wrapped —\n * `@symmio/trading-react`'s `SymmioRequestError` copies `status`,\n * `responseData` and `code` off the API error and is what a hook consumer\n * actually catches.\n *\n * @internal\n */\nexport function readGaslessErrorStatus(err: unknown): number | undefined {\n if (!isRecord(err)) return undefined;\n const status = err.status;\n return typeof status === \"number\" ? status : undefined;\n}\n\n/** The SDK error code an error carries, read structurally. @internal */\nexport function readGaslessErrorCode(err: unknown): string | undefined {\n if (!isRecord(err)) return undefined;\n return typeof err.code === \"string\" ? err.code : undefined;\n}\n\n/**\n * Recover the replayable submit from a `GASLESS_SUBMIT_UNCONFIRMED` error.\n *\n * That error means the SDK could not establish whether the service accepted the\n * request: the transport failed ambiguously and the same-key resend did not land\n * either, however it was answered, or a `202` came back without a `request_id`.\n * The relayed transaction may still execute, so the only safe recovery is to\n * **resend the same bytes under the same key** with\n * {@link resubmitGaslessRequest} — never to re-run the intent through the\n * wallet.\n *\n * @param err - Anything caught from a gasless submit, including an error a\n * framework layer re-wrapped.\n * @returns The replayable submit, or `null` when `err` is not an unconfirmed submit.\n *\n * @example\n * ```ts\n * try {\n * await relayInstantOperations(config, parameters);\n * } catch (err) {\n * const submit = getGaslessUnconfirmedSubmit(err);\n * if (!submit) throw err;\n * await persistPendingSubmit(submit);\n * const receipt = await resubmitGaslessRequest(config, submit);\n * }\n * ```\n */\nexport function getGaslessUnconfirmedSubmit(err: unknown): GaslessUnconfirmedSubmit | null {\n if (readGaslessErrorCode(err) !== GASLESS_SUBMIT_UNCONFIRMED_CODE) return null;\n const data = isRecord(err) ? err.responseData : undefined;\n if (!isRecord(data)) return null;\n\n const { chainId, service, path, idempotencyKey } = data;\n if (typeof chainId !== \"number\") return null;\n if (service !== \"operations\" && service !== \"deposits\") return null;\n if (typeof path !== \"string\" || !(path in GASLESS_SUBMIT_ROUTES)) return null;\n if (typeof idempotencyKey !== \"string\" || idempotencyKey.length === 0) return null;\n\n return { chainId, service, path: path as GaslessSubmitPath, body: data.body, idempotencyKey };\n}\n\n/**\n * Whether an error is the gateway's `409 IDEMPOTENCY_KEY_CONFLICT` — the key\n * is already bound to a **different** wallet selection or workflow.\n *\n * It is a client bug, never a transport failure: the service refused to reuse\n * the key for a payload that is not the one it first saw. Mint a fresh key for\n * the new action; re-signing with the old key cannot succeed. It is also never\n * grounds for a wallet-paid retry, because the workflow the key does belong to\n * may still be executing.\n *\n * @param err - Anything caught from a gasless submit, including an error a\n * framework layer re-wrapped.\n * @returns `true` only for that conflict.\n *\n * @example\n * ```ts\n * if (isGaslessIdempotencyConflictError(err)) {\n * // reconcile the workflow this key already created, then rebuild with a new key\n * }\n * ```\n */\nexport function isGaslessIdempotencyConflictError(err: unknown): boolean {\n if (parseGaslessErrorDetail(err)?.code !== GASLESS_IDEMPOTENCY_CONFLICT_CODE) return false;\n const status = readGaslessErrorStatus(err);\n return status === undefined || status === 409;\n}\n"],"mappings":";;AAQA,IAAa,IAAkC,8BAGzC,IAAoC,4BAa7B,IAAwB;CACnC,0BAA0B;EAAE,SAAS;EAAc,MAAM;CAA8B;CACvF,oCAAoC;EAAE,SAAS;EAAY,MAAM;CAAmC;CACpG,yCAAyC;EAAE,SAAS;EAAY,MAAM;CAAmC;AAC3G;AAuCA,SAAS,EAAS,GAAkD;CAClE,OAAO,OAAO,KAAU,cAAY,KAAkB,CAAC,MAAM,QAAQ,CAAK;AAC5E;AAaA,SAAgB,EAAuB,GAAkC;CACvE,IAAI,CAAC,EAAS,CAAG,GAAG;CACpB,IAAM,IAAS,EAAI;CACnB,OAAO,OAAO,KAAW,WAAW,IAAS,KAAA;AAC/C;AAGA,SAAgB,EAAqB,GAAkC;CAChE,MAAS,CAAG,GACjB,OAAO,OAAO,EAAI,QAAS,WAAW,EAAI,OAAO,KAAA;AACnD;AA6BA,SAAgB,EAA4B,GAA+C;CACzF,IAAI,EAAqB,CAAG,MAAA,8BAAuC,OAAO;CAC1E,IAAM,IAAO,EAAS,CAAG,IAAI,EAAI,eAAe,KAAA;CAChD,IAAI,CAAC,EAAS,CAAI,GAAG,OAAO;CAE5B,IAAM,EAAE,YAAS,YAAS,SAAM,sBAAmB;CAMnD,OALI,OAAO,KAAY,YACnB,MAAY,gBAAgB,MAAY,cACxC,OAAO,KAAS,YAAY,EAAE,KAAQ,MACtC,OAAO,KAAmB,YAAY,EAAe,WAAW,IAAU,OAEvE;EAAE;EAAS;EAAe;EAA2B,MAAM,EAAK;EAAM;CAAe;AAC9F;AAuBA,SAAgB,EAAkC,GAAuB;CACvE,IAAI,EAAwB,CAAG,GAAG,SAAS,GAAmC,OAAO;CACrF,IAAM,IAAS,EAAuB,CAAG;CACzC,OAAO,MAAW,KAAA,KAAa,MAAW;AAC5C"}
1
+ {"version":3,"file":"unconfirmed-submit.js","names":[],"sources":["../../src/gasless/unconfirmed-submit.ts"],"sourcesContent":["import { parseGaslessErrorDetail } from \"./errors\";\nimport type { GaslessService } from \"./types\";\n\n/**\n * SDK error code of a submit whose outcome the SDK could not establish.\n *\n * @internal\n */\nexport const GASLESS_SUBMIT_UNCONFIRMED_CODE = \"GASLESS_SUBMIT_UNCONFIRMED\";\n\n/** Vendor code of a key already bound to an earlier request with a different payload. */\nconst GASLESS_IDEMPOTENCY_CONFLICT_CODE = \"IDEMPOTENCY_KEY_CONFLICT\";\n\n/**\n * The gateway paths a gasless **submit** POSTs to, with the service that stores\n * the resulting workflow and the SDK error code its failures carry.\n *\n * A submit is the only kind of gasless request that can leave a side effect\n * behind when its response is lost, so the retry, idempotency and\n * \"unconfirmed\" machinery is keyed off this table rather than off a free-form\n * path string.\n *\n * @internal\n */\nexport const GASLESS_SUBMIT_ROUTES = {\n \"/gateway/relay-instant\": { service: \"operations\", code: \"GASLESS_RELAY_SUBMIT_FAILED\" },\n \"/deposit-settlements/new-account\": { service: \"deposits\", code: \"GASLESS_SETTLEMENT_SUBMIT_FAILED\" },\n \"/deposit-settlements/existing-account\": { service: \"deposits\", code: \"GASLESS_SETTLEMENT_SUBMIT_FAILED\" },\n} as const satisfies Record<string, { service: GaslessService; code: string }>;\n\n/**\n * One of the three gateway paths a gasless submit POSTs to.\n *\n * Closed on purpose: a resubmit replays the recorded bytes against the same\n * route, and an open string would let an arbitrary path be POSTed with a\n * signed body.\n */\nexport type GaslessSubmitPath = keyof typeof GASLESS_SUBMIT_ROUTES;\n\n/**\n * Everything needed to replay one gasless submit **byte-for-byte**, recovered\n * from a `GASLESS_SUBMIT_UNCONFIRMED` error with\n * {@link getGaslessUnconfirmedSubmit}.\n *\n * The vendor's contract is that resending the identical request under the same\n * idempotency key either lands it or returns the record it already created, so\n * a lost response is recoverable — but only if the exact JSON that was sent is\n * still available. That is what this carries: `body` is the object that was\n * serialized, not a rebuilt equivalent.\n *\n * Persist it next to the workflow you were submitting. Do **not** ship it to\n * third-party logging: `body` holds the user's signed operations, and a\n * signature the service never executed stays valid until its deadline.\n */\nexport interface GaslessUnconfirmedSubmit {\n /** The chain the submit was made on. */\n chainId: number;\n /** The service that stores the workflow, derived from {@link GaslessUnconfirmedSubmit.path}. */\n service: GaslessService;\n /** The gateway path the body was POSTed to. */\n path: GaslessSubmitPath;\n /** The exact JSON body that was sent, to resend unchanged. */\n body: unknown;\n /** The idempotency key the submit carried, and that a resend must reuse. */\n idempotencyKey: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * The HTTP status an error reports, whatever error class carries it.\n *\n * Read structurally rather than through `instanceof SymmApiError`, so the\n * gasless predicates keep working on the error a framework layer re-wrapped —\n * `@symmio/trading-react`'s `SymmioRequestError` copies `status`,\n * `responseData` and `code` off the API error and is what a hook consumer\n * actually catches.\n *\n * @internal\n */\nexport function readGaslessErrorStatus(err: unknown): number | undefined {\n if (!isRecord(err)) return undefined;\n const status = err.status;\n return typeof status === \"number\" ? status : undefined;\n}\n\n/** The SDK error code an error carries, read structurally. @internal */\nexport function readGaslessErrorCode(err: unknown): string | undefined {\n if (!isRecord(err)) return undefined;\n return typeof err.code === \"string\" ? err.code : undefined;\n}\n\n/**\n * Recover the replayable submit from a `GASLESS_SUBMIT_UNCONFIRMED` error.\n *\n * That error means the SDK could not establish whether the service accepted the\n * request: the transport failed ambiguously and the same-key resend did not land\n * either, however it was answered, or a `202` came back without a `request_id`.\n * The relayed transaction may still execute, so the only safe recovery is to\n * **resend the same bytes under the same key** with\n * {@link resubmitGaslessRequest} — never to re-run the intent through the\n * wallet.\n *\n * @param err - Anything caught from a gasless submit, including an error a\n * framework layer re-wrapped.\n * @returns The replayable submit, or `null` when `err` is not an unconfirmed submit.\n *\n * @example\n * ```ts\n * try {\n * await relayInstantOperations(config, parameters);\n * } catch (err) {\n * const submit = getGaslessUnconfirmedSubmit(err);\n * if (!submit) throw err;\n * await persistPendingSubmit(submit);\n * const receipt = await resubmitGaslessRequest(config, submit);\n * }\n * ```\n */\nexport function getGaslessUnconfirmedSubmit(err: unknown): GaslessUnconfirmedSubmit | null {\n if (readGaslessErrorCode(err) !== GASLESS_SUBMIT_UNCONFIRMED_CODE) return null;\n const data = isRecord(err) ? err.responseData : undefined;\n if (!isRecord(data)) return null;\n\n const { chainId, service, path, idempotencyKey } = data;\n if (typeof chainId !== \"number\") return null;\n if (service !== \"operations\" && service !== \"deposits\") return null;\n if (typeof path !== \"string\" || !(path in GASLESS_SUBMIT_ROUTES)) return null;\n if (typeof idempotencyKey !== \"string\" || idempotencyKey.length === 0) return null;\n\n return { chainId, service, path: path as GaslessSubmitPath, body: data.body, idempotencyKey };\n}\n\n/**\n * Whether an error is a `409 IDEMPOTENCY_KEY_CONFLICT`.\n *\n * The current service never sends it: a submit under a key that is already\n * bound to a request gets that request back instead (`202`), whatever its\n * body. The check is a safeguard for a deployment that adopts the conflict\n * answer.\n *\n * Should it arrive, treat the action as unresolved: an earlier attempt may\n * hold the key, and its outcome is unknown. Do not send the action again — not\n * under this key, not under a new one, and never through the wallet. Keep the\n * action pending and reconcile it once its last attempt can no longer execute\n * (`GASLESS_SIGNATURE_LIFETIME_SECONDS`).\n *\n * @param err - Anything caught from a gasless submit, including an error a\n * framework layer re-wrapped.\n * @returns `true` only for that conflict.\n *\n * @example\n * ```ts\n * if (isGaslessIdempotencyConflictError(err)) {\n * // an earlier attempt holds the key: keep the action pending and reconcile it\n * }\n * ```\n */\nexport function isGaslessIdempotencyConflictError(err: unknown): boolean {\n if (parseGaslessErrorDetail(err)?.code !== GASLESS_IDEMPOTENCY_CONFLICT_CODE) return false;\n const status = readGaslessErrorStatus(err);\n return status === undefined || status === 409;\n}\n"],"mappings":";;AAQA,IAAa,IAAkC,8BAGzC,IAAoC,4BAa7B,IAAwB;CACnC,0BAA0B;EAAE,SAAS;EAAc,MAAM;CAA8B;CACvF,oCAAoC;EAAE,SAAS;EAAY,MAAM;CAAmC;CACpG,yCAAyC;EAAE,SAAS;EAAY,MAAM;CAAmC;AAC3G;AAuCA,SAAS,EAAS,GAAkD;CAClE,OAAO,OAAO,KAAU,cAAY,KAAkB,CAAC,MAAM,QAAQ,CAAK;AAC5E;AAaA,SAAgB,EAAuB,GAAkC;CACvE,IAAI,CAAC,EAAS,CAAG,GAAG;CACpB,IAAM,IAAS,EAAI;CACnB,OAAO,OAAO,KAAW,WAAW,IAAS,KAAA;AAC/C;AAGA,SAAgB,EAAqB,GAAkC;CAChE,MAAS,CAAG,GACjB,OAAO,OAAO,EAAI,QAAS,WAAW,EAAI,OAAO,KAAA;AACnD;AA6BA,SAAgB,EAA4B,GAA+C;CACzF,IAAI,EAAqB,CAAG,MAAA,8BAAuC,OAAO;CAC1E,IAAM,IAAO,EAAS,CAAG,IAAI,EAAI,eAAe,KAAA;CAChD,IAAI,CAAC,EAAS,CAAI,GAAG,OAAO;CAE5B,IAAM,EAAE,YAAS,YAAS,SAAM,sBAAmB;CAMnD,OALI,OAAO,KAAY,YACnB,MAAY,gBAAgB,MAAY,cACxC,OAAO,KAAS,YAAY,EAAE,KAAQ,MACtC,OAAO,KAAmB,YAAY,EAAe,WAAW,IAAU,OAEvE;EAAE;EAAS;EAAe;EAA2B,MAAM,EAAK;EAAM;CAAe;AAC9F;AA2BA,SAAgB,EAAkC,GAAuB;CACvE,IAAI,EAAwB,CAAG,GAAG,SAAS,GAAmC,OAAO;CACrF,IAAM,IAAS,EAAuB,CAAG;CACzC,OAAO,MAAW,KAAA,KAAa,MAAW;AAC5C"}