@lifi/sdk 4.0.0-alpha.2 → 4.0.0-alpha.20

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 (338) hide show
  1. package/dist/cjs/actions/getChains.d.ts +1 -1
  2. package/dist/cjs/actions/getChains.js +4 -4
  3. package/dist/cjs/actions/getChains.js.map +1 -1
  4. package/dist/cjs/actions/getRelayedTransactionStatus.js +1 -1
  5. package/dist/cjs/actions/getRelayedTransactionStatus.js.map +1 -1
  6. package/dist/cjs/actions/getStepTransaction.js +9 -1
  7. package/dist/cjs/actions/getStepTransaction.js.map +1 -1
  8. package/dist/cjs/actions/index.d.ts +3 -1
  9. package/dist/cjs/actions/index.js +2 -0
  10. package/dist/cjs/actions/index.js.map +1 -1
  11. package/dist/cjs/actions/patchContractCalls.d.ts +10 -0
  12. package/dist/cjs/actions/patchContractCalls.js +16 -0
  13. package/dist/cjs/actions/patchContractCalls.js.map +1 -0
  14. package/dist/cjs/client/createClient.js +4 -0
  15. package/dist/cjs/client/createClient.js.map +1 -1
  16. package/dist/cjs/client/getClientStorage.d.ts +1 -0
  17. package/dist/cjs/client/getClientStorage.js +17 -6
  18. package/dist/cjs/client/getClientStorage.js.map +1 -1
  19. package/dist/cjs/core/BaseStepExecutionTask.d.ts +5 -0
  20. package/dist/cjs/core/BaseStepExecutionTask.js +10 -0
  21. package/dist/cjs/core/BaseStepExecutionTask.js.map +1 -0
  22. package/dist/cjs/core/BaseStepExecutor.d.ts +10 -3
  23. package/dist/cjs/core/BaseStepExecutor.js +53 -0
  24. package/dist/cjs/core/BaseStepExecutor.js.map +1 -1
  25. package/dist/cjs/core/StatusManager.d.ts +13 -12
  26. package/dist/cjs/core/StatusManager.js +55 -61
  27. package/dist/cjs/core/StatusManager.js.map +1 -1
  28. package/dist/cjs/core/TaskPipeline.d.ts +7 -0
  29. package/dist/cjs/core/TaskPipeline.js +27 -0
  30. package/dist/cjs/core/TaskPipeline.js.map +1 -0
  31. package/dist/cjs/core/actionMessages.d.ts +4 -0
  32. package/dist/cjs/core/{processMessages.js → actionMessages.js} +25 -9
  33. package/dist/cjs/core/actionMessages.js.map +1 -0
  34. package/dist/cjs/core/execution.js +13 -1
  35. package/dist/cjs/core/execution.js.map +1 -1
  36. package/dist/cjs/core/prepareRestart.js +6 -6
  37. package/dist/cjs/core/prepareRestart.js.map +1 -1
  38. package/dist/cjs/core/storage.d.ts +17 -0
  39. package/dist/cjs/core/storage.js +36 -0
  40. package/dist/cjs/core/storage.js.map +1 -0
  41. package/dist/cjs/core/tasks/CheckBalanceTask.d.ts +5 -0
  42. package/dist/cjs/core/tasks/CheckBalanceTask.js +26 -0
  43. package/dist/cjs/core/tasks/CheckBalanceTask.js.map +1 -0
  44. package/dist/cjs/core/tasks/PrepareTransactionTask.d.ts +5 -0
  45. package/dist/cjs/core/tasks/PrepareTransactionTask.js +36 -0
  46. package/dist/cjs/core/tasks/PrepareTransactionTask.js.map +1 -0
  47. package/dist/cjs/core/tasks/WaitForTransactionStatusTask.d.ts +8 -0
  48. package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js +73 -0
  49. package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js.map +1 -0
  50. package/dist/cjs/core/{checkBalance.d.ts → tasks/helpers/checkBalance.d.ts} +1 -1
  51. package/dist/cjs/core/{checkBalance.js → tasks/helpers/checkBalance.js} +6 -6
  52. package/dist/cjs/core/tasks/helpers/checkBalance.js.map +1 -0
  53. package/dist/cjs/core/tasks/helpers/getTransactionRequestData.d.ts +2 -0
  54. package/dist/cjs/core/tasks/helpers/getTransactionRequestData.js +30 -0
  55. package/dist/cjs/core/tasks/helpers/getTransactionRequestData.js.map +1 -0
  56. package/dist/cjs/core/{stepComparison.d.ts → tasks/helpers/stepComparison.d.ts} +2 -2
  57. package/dist/cjs/core/{stepComparison.js → tasks/helpers/stepComparison.js} +3 -3
  58. package/dist/cjs/core/tasks/helpers/stepComparison.js.map +1 -0
  59. package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.d.ts +4 -0
  60. package/dist/cjs/core/{waitForTransactionStatus.js → tasks/helpers/waitForTransactionStatus.js} +10 -8
  61. package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.js.map +1 -0
  62. package/dist/cjs/core/utils.d.ts +9 -3
  63. package/dist/cjs/core/utils.js +0 -5
  64. package/dist/cjs/core/utils.js.map +1 -1
  65. package/dist/cjs/errors/SDKError.d.ts +3 -3
  66. package/dist/cjs/errors/SDKError.js +3 -3
  67. package/dist/cjs/errors/SDKError.js.map +1 -1
  68. package/dist/cjs/errors/constants.d.ts +5 -2
  69. package/dist/cjs/errors/constants.js +3 -0
  70. package/dist/cjs/errors/constants.js.map +1 -1
  71. package/dist/cjs/errors/errors.d.ts +5 -0
  72. package/dist/cjs/errors/errors.js +9 -1
  73. package/dist/cjs/errors/errors.js.map +1 -1
  74. package/dist/cjs/index.d.ts +20 -10
  75. package/dist/cjs/index.js +34 -14
  76. package/dist/cjs/index.js.map +1 -1
  77. package/dist/cjs/types/core.d.ts +51 -21
  78. package/dist/cjs/types/execution.d.ts +22 -0
  79. package/dist/cjs/types/execution.js +3 -0
  80. package/dist/cjs/types/execution.js.map +1 -0
  81. package/dist/cjs/utils/convertQuoteToRoute.d.ts +6 -1
  82. package/dist/cjs/utils/convertQuoteToRoute.js +73 -5
  83. package/dist/cjs/utils/convertQuoteToRoute.js.map +1 -1
  84. package/dist/cjs/utils/formatUnits.d.ts +1 -0
  85. package/dist/cjs/utils/formatUnits.js +18 -0
  86. package/dist/cjs/utils/formatUnits.js.map +1 -0
  87. package/dist/cjs/utils/isHex.d.ts +4 -0
  88. package/dist/cjs/utils/isHex.js +13 -0
  89. package/dist/cjs/utils/isHex.js.map +1 -0
  90. package/dist/cjs/utils/parseUnits.d.ts +1 -0
  91. package/dist/cjs/utils/parseUnits.js +44 -0
  92. package/dist/cjs/utils/parseUnits.js.map +1 -0
  93. package/dist/cjs/utils/request.js +7 -6
  94. package/dist/cjs/utils/request.js.map +1 -1
  95. package/dist/cjs/utils/waitForResult.d.ts +1 -1
  96. package/dist/cjs/utils/waitForResult.js +6 -2
  97. package/dist/cjs/utils/waitForResult.js.map +1 -1
  98. package/dist/cjs/utils/withDedupe.d.ts +5 -0
  99. package/dist/cjs/utils/withDedupe.js +2 -0
  100. package/dist/cjs/utils/withDedupe.js.map +1 -1
  101. package/dist/cjs/version.d.ts +1 -1
  102. package/dist/cjs/version.js +1 -1
  103. package/dist/cjs/version.js.map +1 -1
  104. package/dist/esm/actions/getChains.d.ts +1 -1
  105. package/dist/esm/actions/getChains.js +2 -2
  106. package/dist/esm/actions/getChains.js.map +1 -1
  107. package/dist/esm/actions/getRelayedTransactionStatus.js +1 -1
  108. package/dist/esm/actions/getRelayedTransactionStatus.js.map +1 -1
  109. package/dist/esm/actions/getStepTransaction.js +10 -1
  110. package/dist/esm/actions/getStepTransaction.js.map +1 -1
  111. package/dist/esm/actions/index.d.ts +9 -1
  112. package/dist/esm/actions/index.js +2 -0
  113. package/dist/esm/actions/index.js.map +1 -1
  114. package/dist/esm/actions/patchContractCalls.d.ts +10 -0
  115. package/dist/esm/actions/patchContractCalls.js +12 -0
  116. package/dist/esm/actions/patchContractCalls.js.map +1 -0
  117. package/dist/esm/client/createClient.js +4 -0
  118. package/dist/esm/client/createClient.js.map +1 -1
  119. package/dist/esm/client/getClientStorage.d.ts +1 -0
  120. package/dist/esm/client/getClientStorage.js +21 -7
  121. package/dist/esm/client/getClientStorage.js.map +1 -1
  122. package/dist/esm/core/BaseStepExecutionTask.d.ts +5 -0
  123. package/dist/esm/core/BaseStepExecutionTask.js +6 -0
  124. package/dist/esm/core/BaseStepExecutionTask.js.map +1 -0
  125. package/dist/esm/core/BaseStepExecutor.d.ts +10 -3
  126. package/dist/esm/core/BaseStepExecutor.js +53 -0
  127. package/dist/esm/core/BaseStepExecutor.js.map +1 -1
  128. package/dist/esm/core/StatusManager.d.ts +40 -39
  129. package/dist/esm/core/StatusManager.js +86 -92
  130. package/dist/esm/core/StatusManager.js.map +1 -1
  131. package/dist/esm/core/TaskPipeline.d.ts +7 -0
  132. package/dist/esm/core/TaskPipeline.js +23 -0
  133. package/dist/esm/core/TaskPipeline.js.map +1 -0
  134. package/dist/esm/core/actionMessages.d.ts +4 -0
  135. package/dist/esm/core/{processMessages.js → actionMessages.js} +24 -8
  136. package/dist/esm/core/actionMessages.js.map +1 -0
  137. package/dist/esm/core/execution.js +14 -3
  138. package/dist/esm/core/execution.js.map +1 -1
  139. package/dist/esm/core/prepareRestart.js +10 -9
  140. package/dist/esm/core/prepareRestart.js.map +1 -1
  141. package/dist/esm/core/storage.d.ts +17 -0
  142. package/dist/esm/core/storage.js +30 -0
  143. package/dist/esm/core/storage.js.map +1 -0
  144. package/dist/esm/core/tasks/CheckBalanceTask.d.ts +5 -0
  145. package/dist/esm/core/tasks/CheckBalanceTask.js +22 -0
  146. package/dist/esm/core/tasks/CheckBalanceTask.js.map +1 -0
  147. package/dist/esm/core/tasks/PrepareTransactionTask.d.ts +5 -0
  148. package/dist/esm/core/tasks/PrepareTransactionTask.js +32 -0
  149. package/dist/esm/core/tasks/PrepareTransactionTask.js.map +1 -0
  150. package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts +8 -0
  151. package/dist/esm/core/tasks/WaitForTransactionStatusTask.js +74 -0
  152. package/dist/esm/core/tasks/WaitForTransactionStatusTask.js.map +1 -0
  153. package/dist/esm/core/{checkBalance.d.ts → tasks/helpers/checkBalance.d.ts} +1 -1
  154. package/dist/esm/core/{checkBalance.js → tasks/helpers/checkBalance.js} +4 -4
  155. package/dist/esm/core/tasks/helpers/checkBalance.js.map +1 -0
  156. package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts +2 -0
  157. package/dist/esm/core/tasks/helpers/getTransactionRequestData.js +26 -0
  158. package/dist/esm/core/tasks/helpers/getTransactionRequestData.js.map +1 -0
  159. package/dist/esm/core/{stepComparison.d.ts → tasks/helpers/stepComparison.d.ts} +2 -2
  160. package/dist/esm/core/{stepComparison.js → tasks/helpers/stepComparison.js} +3 -3
  161. package/dist/esm/core/tasks/helpers/stepComparison.js.map +1 -0
  162. package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts +4 -0
  163. package/dist/esm/core/{waitForTransactionStatus.js → tasks/helpers/waitForTransactionStatus.js} +9 -7
  164. package/dist/esm/core/tasks/helpers/waitForTransactionStatus.js.map +1 -0
  165. package/dist/esm/core/utils.d.ts +9 -11
  166. package/dist/esm/core/utils.js +0 -11
  167. package/dist/esm/core/utils.js.map +1 -1
  168. package/dist/esm/errors/SDKError.d.ts +3 -3
  169. package/dist/esm/errors/SDKError.js +4 -4
  170. package/dist/esm/errors/SDKError.js.map +1 -1
  171. package/dist/esm/errors/constants.d.ts +5 -2
  172. package/dist/esm/errors/constants.js +3 -0
  173. package/dist/esm/errors/constants.js.map +1 -1
  174. package/dist/esm/errors/errors.d.ts +10 -0
  175. package/dist/esm/errors/errors.js +12 -0
  176. package/dist/esm/errors/errors.js.map +1 -1
  177. package/dist/esm/index.d.ts +20 -10
  178. package/dist/esm/index.js +17 -8
  179. package/dist/esm/index.js.map +1 -1
  180. package/dist/esm/types/core.d.ts +55 -21
  181. package/dist/esm/types/execution.d.ts +23 -0
  182. package/dist/esm/types/execution.js +2 -0
  183. package/dist/esm/types/execution.js.map +1 -0
  184. package/dist/esm/utils/convertQuoteToRoute.d.ts +11 -3
  185. package/dist/esm/utils/convertQuoteToRoute.js +76 -7
  186. package/dist/esm/utils/convertQuoteToRoute.js.map +1 -1
  187. package/dist/esm/utils/formatUnits.d.ts +4 -0
  188. package/dist/esm/utils/formatUnits.js +18 -0
  189. package/dist/esm/utils/formatUnits.js.map +1 -0
  190. package/dist/esm/utils/isHex.d.ts +4 -0
  191. package/dist/esm/utils/isHex.js +10 -0
  192. package/dist/esm/utils/isHex.js.map +1 -0
  193. package/dist/esm/utils/parseUnits.d.ts +4 -0
  194. package/dist/esm/utils/parseUnits.js +46 -0
  195. package/dist/esm/utils/parseUnits.js.map +1 -0
  196. package/dist/esm/utils/request.js +7 -6
  197. package/dist/esm/utils/request.js.map +1 -1
  198. package/dist/esm/utils/waitForResult.d.ts +2 -2
  199. package/dist/esm/utils/waitForResult.js +7 -3
  200. package/dist/esm/utils/waitForResult.js.map +1 -1
  201. package/dist/esm/utils/withDedupe.d.ts +10 -0
  202. package/dist/esm/utils/withDedupe.js +1 -1
  203. package/dist/esm/utils/withDedupe.js.map +1 -1
  204. package/dist/esm/version.d.ts +1 -1
  205. package/dist/esm/version.js +1 -1
  206. package/dist/esm/version.js.map +1 -1
  207. package/dist/types/actions/getChains.d.ts +1 -1
  208. package/dist/types/actions/getChains.d.ts.map +1 -1
  209. package/dist/types/actions/getStepTransaction.d.ts.map +1 -1
  210. package/dist/types/actions/index.d.ts +9 -1
  211. package/dist/types/actions/index.d.ts.map +1 -1
  212. package/dist/types/actions/patchContractCalls.d.ts +11 -0
  213. package/dist/types/actions/patchContractCalls.d.ts.map +1 -0
  214. package/dist/types/client/createClient.d.ts.map +1 -1
  215. package/dist/types/client/getClientStorage.d.ts +1 -0
  216. package/dist/types/client/getClientStorage.d.ts.map +1 -1
  217. package/dist/types/core/BaseStepExecutionTask.d.ts +6 -0
  218. package/dist/types/core/BaseStepExecutionTask.d.ts.map +1 -0
  219. package/dist/types/core/BaseStepExecutor.d.ts +10 -3
  220. package/dist/types/core/BaseStepExecutor.d.ts.map +1 -1
  221. package/dist/types/core/StatusManager.d.ts +40 -39
  222. package/dist/types/core/StatusManager.d.ts.map +1 -1
  223. package/dist/types/core/TaskPipeline.d.ts +8 -0
  224. package/dist/types/core/TaskPipeline.d.ts.map +1 -0
  225. package/dist/types/core/actionMessages.d.ts +5 -0
  226. package/dist/types/core/actionMessages.d.ts.map +1 -0
  227. package/dist/types/core/execution.d.ts.map +1 -1
  228. package/dist/types/core/prepareRestart.d.ts.map +1 -1
  229. package/dist/types/core/storage.d.ts +18 -0
  230. package/dist/types/core/storage.d.ts.map +1 -0
  231. package/dist/types/core/tasks/CheckBalanceTask.d.ts +6 -0
  232. package/dist/types/core/tasks/CheckBalanceTask.d.ts.map +1 -0
  233. package/dist/types/core/tasks/PrepareTransactionTask.d.ts +6 -0
  234. package/dist/types/core/tasks/PrepareTransactionTask.d.ts.map +1 -0
  235. package/dist/types/core/tasks/WaitForTransactionStatusTask.d.ts +9 -0
  236. package/dist/types/core/tasks/WaitForTransactionStatusTask.d.ts.map +1 -0
  237. package/dist/types/core/{checkBalance.d.ts → tasks/helpers/checkBalance.d.ts} +1 -1
  238. package/dist/types/core/tasks/helpers/checkBalance.d.ts.map +1 -0
  239. package/dist/types/core/tasks/helpers/getTransactionRequestData.d.ts +3 -0
  240. package/dist/types/core/tasks/helpers/getTransactionRequestData.d.ts.map +1 -0
  241. package/dist/types/core/{stepComparison.d.ts → tasks/helpers/stepComparison.d.ts} +2 -2
  242. package/dist/types/core/tasks/helpers/stepComparison.d.ts.map +1 -0
  243. package/dist/types/core/tasks/helpers/waitForTransactionStatus.d.ts +5 -0
  244. package/dist/types/core/tasks/helpers/waitForTransactionStatus.d.ts.map +1 -0
  245. package/dist/types/core/utils.d.ts +9 -11
  246. package/dist/types/core/utils.d.ts.map +1 -1
  247. package/dist/types/errors/SDKError.d.ts +3 -3
  248. package/dist/types/errors/SDKError.d.ts.map +1 -1
  249. package/dist/types/errors/constants.d.ts +5 -2
  250. package/dist/types/errors/constants.d.ts.map +1 -1
  251. package/dist/types/errors/errors.d.ts +10 -0
  252. package/dist/types/errors/errors.d.ts.map +1 -1
  253. package/dist/types/index.d.ts +20 -10
  254. package/dist/types/index.d.ts.map +1 -1
  255. package/dist/types/types/core.d.ts +55 -21
  256. package/dist/types/types/core.d.ts.map +1 -1
  257. package/dist/types/types/execution.d.ts +24 -0
  258. package/dist/types/types/execution.d.ts.map +1 -0
  259. package/dist/types/utils/convertQuoteToRoute.d.ts +11 -3
  260. package/dist/types/utils/convertQuoteToRoute.d.ts.map +1 -1
  261. package/dist/types/utils/formatUnits.d.ts +5 -0
  262. package/dist/types/utils/formatUnits.d.ts.map +1 -0
  263. package/dist/types/utils/isHex.d.ts +5 -0
  264. package/dist/types/utils/isHex.d.ts.map +1 -0
  265. package/dist/types/utils/parseUnits.d.ts +5 -0
  266. package/dist/types/utils/parseUnits.d.ts.map +1 -0
  267. package/dist/types/utils/request.d.ts.map +1 -1
  268. package/dist/types/utils/waitForResult.d.ts +2 -2
  269. package/dist/types/utils/waitForResult.d.ts.map +1 -1
  270. package/dist/types/utils/withDedupe.d.ts +10 -0
  271. package/dist/types/utils/withDedupe.d.ts.map +1 -1
  272. package/dist/types/version.d.ts +1 -1
  273. package/dist/types/version.d.ts.map +1 -1
  274. package/package.json +2 -3
  275. package/src/actions/getChains.ts +2 -2
  276. package/src/actions/getRelayedTransactionStatus.ts +1 -1
  277. package/src/actions/getStepTransaction.ts +20 -12
  278. package/src/actions/index.ts +18 -0
  279. package/src/actions/patchContractCalls.ts +30 -0
  280. package/src/client/createClient.ts +5 -1
  281. package/src/client/getClientStorage.ts +24 -7
  282. package/src/core/BaseStepExecutionTask.ts +9 -0
  283. package/src/core/BaseStepExecutor.ts +91 -2
  284. package/src/core/StatusManager.ts +108 -113
  285. package/src/core/TaskPipeline.ts +28 -0
  286. package/src/core/{processMessages.ts → actionMessages.ts} +32 -12
  287. package/src/core/execution.ts +17 -3
  288. package/src/core/prepareRestart.ts +12 -11
  289. package/src/core/storage.ts +42 -0
  290. package/src/core/tasks/CheckBalanceTask.ts +29 -0
  291. package/src/core/tasks/PrepareTransactionTask.ts +62 -0
  292. package/src/core/tasks/WaitForTransactionStatusTask.ts +114 -0
  293. package/src/core/{checkBalance.ts → tasks/helpers/checkBalance.ts} +5 -5
  294. package/src/core/tasks/helpers/getTransactionRequestData.ts +47 -0
  295. package/src/core/{stepComparison.ts → tasks/helpers/stepComparison.ts} +5 -5
  296. package/src/core/{waitForTransactionStatus.ts → tasks/helpers/waitForTransactionStatus.ts} +11 -9
  297. package/src/core/utils.ts +1 -13
  298. package/src/errors/SDKError.ts +5 -5
  299. package/src/errors/constants.ts +3 -0
  300. package/src/errors/errors.ts +24 -0
  301. package/src/index.ts +37 -12
  302. package/src/types/core.ts +69 -29
  303. package/src/types/execution.ts +32 -0
  304. package/src/utils/convertQuoteToRoute.ts +117 -8
  305. package/src/utils/formatUnits.ts +22 -0
  306. package/src/utils/isHex.ts +14 -0
  307. package/src/utils/parseUnits.ts +50 -0
  308. package/src/utils/request.ts +9 -6
  309. package/src/utils/waitForResult.ts +9 -4
  310. package/src/utils/withDedupe.ts +1 -1
  311. package/src/version.ts +1 -1
  312. package/dist/cjs/core/checkBalance.js.map +0 -1
  313. package/dist/cjs/core/processMessages.d.ts +0 -4
  314. package/dist/cjs/core/processMessages.js.map +0 -1
  315. package/dist/cjs/core/stepComparison.js.map +0 -1
  316. package/dist/cjs/core/waitForDestinationChainTransaction.d.ts +0 -4
  317. package/dist/cjs/core/waitForDestinationChainTransaction.js +0 -69
  318. package/dist/cjs/core/waitForDestinationChainTransaction.js.map +0 -1
  319. package/dist/cjs/core/waitForTransactionStatus.d.ts +0 -4
  320. package/dist/cjs/core/waitForTransactionStatus.js.map +0 -1
  321. package/dist/esm/core/checkBalance.js.map +0 -1
  322. package/dist/esm/core/processMessages.d.ts +0 -4
  323. package/dist/esm/core/processMessages.js.map +0 -1
  324. package/dist/esm/core/stepComparison.js.map +0 -1
  325. package/dist/esm/core/waitForDestinationChainTransaction.d.ts +0 -4
  326. package/dist/esm/core/waitForDestinationChainTransaction.js +0 -71
  327. package/dist/esm/core/waitForDestinationChainTransaction.js.map +0 -1
  328. package/dist/esm/core/waitForTransactionStatus.d.ts +0 -4
  329. package/dist/esm/core/waitForTransactionStatus.js.map +0 -1
  330. package/dist/types/core/checkBalance.d.ts.map +0 -1
  331. package/dist/types/core/processMessages.d.ts +0 -5
  332. package/dist/types/core/processMessages.d.ts.map +0 -1
  333. package/dist/types/core/stepComparison.d.ts.map +0 -1
  334. package/dist/types/core/waitForDestinationChainTransaction.d.ts +0 -5
  335. package/dist/types/core/waitForDestinationChainTransaction.d.ts.map +0 -1
  336. package/dist/types/core/waitForTransactionStatus.d.ts +0 -5
  337. package/dist/types/core/waitForTransactionStatus.d.ts.map +0 -1
  338. package/src/core/waitForDestinationChainTransaction.ts +0 -106
@@ -1,15 +1,27 @@
1
1
  import type { StatusMessage, Substatus } from '@lifi/types'
2
- import type { ProcessStatus, ProcessType } from '../types/core.js'
2
+ import type {
3
+ ExecutionActionStatus,
4
+ ExecutionActionType,
5
+ } from '../types/core.js'
3
6
 
4
- const processMessages: Record<
5
- ProcessType,
6
- Partial<Record<ProcessStatus, string>>
7
+ const actionMessages: Record<
8
+ ExecutionActionType,
9
+ Partial<Record<ExecutionActionStatus, string>>
7
10
  > = {
8
- TOKEN_ALLOWANCE: {
11
+ CHECK_ALLOWANCE: {
12
+ STARTED: 'Checking token allowance',
13
+ PENDING: 'Waiting for token allowance check',
14
+ DONE: 'Token allowance checked',
15
+ },
16
+ RESET_ALLOWANCE: {
17
+ STARTED: 'Resetting token allowance',
18
+ RESET_REQUIRED: 'Resetting token allowance',
19
+ PENDING: 'Waiting for token allowance reset',
20
+ DONE: 'Token allowance reset',
21
+ },
22
+ SET_ALLOWANCE: {
9
23
  STARTED: 'Setting token allowance',
10
24
  ACTION_REQUIRED: 'Set token allowance',
11
- RESET_REQUIRED: 'Resetting token allowance',
12
- MESSAGE_REQUIRED: 'Sign token allowance message',
13
25
  PENDING: 'Waiting for token allowance',
14
26
  DONE: 'Token allowance set',
15
27
  },
@@ -28,6 +40,7 @@ const processMessages: Record<
28
40
  DONE: 'Bridge transaction confirmed',
29
41
  },
30
42
  RECEIVING_CHAIN: {
43
+ STARTED: 'Waiting for destination chain',
31
44
  PENDING: 'Waiting for destination chain',
32
45
  DONE: 'Bridge completed',
33
46
  },
@@ -37,7 +50,14 @@ const processMessages: Record<
37
50
  PENDING: 'Waiting for permit message',
38
51
  DONE: 'Permit message signed',
39
52
  },
53
+ NATIVE_PERMIT: {
54
+ STARTED: 'Preparing transaction',
55
+ ACTION_REQUIRED: 'Sign permit message',
56
+ PENDING: 'Waiting for permit message',
57
+ DONE: 'Permit message signed',
58
+ },
40
59
  }
60
+
41
61
  const substatusMessages: Record<
42
62
  StatusMessage,
43
63
  Partial<Record<Substatus, string>>
@@ -63,12 +83,12 @@ const substatusMessages: Record<
63
83
  NOT_FOUND: {},
64
84
  }
65
85
 
66
- export function getProcessMessage(
67
- type: ProcessType,
68
- status: ProcessStatus
86
+ export function getActionMessage(
87
+ type: ExecutionActionType,
88
+ status: ExecutionActionStatus
69
89
  ): string | undefined {
70
- const processMessage = processMessages[type][status]
71
- return processMessage
90
+ const actionMessage = actionMessages[type][status]
91
+ return actionMessage
72
92
  }
73
93
 
74
94
  export function getSubstatusMessage(
@@ -1,8 +1,9 @@
1
1
  import type { Route } from '@lifi/types'
2
2
  import { LiFiErrorCode } from '../errors/constants.js'
3
- import { ProviderError } from '../errors/errors.js'
3
+ import { ExecuteStepRetryError, ProviderError } from '../errors/errors.js'
4
4
  import type {
5
5
  ExecutionOptions,
6
+ LiFiStepExtended,
6
7
  RouteExtended,
7
8
  SDKClient,
8
9
  SDKProvider,
@@ -94,7 +95,6 @@ const executeSteps = async (
94
95
  const step = route.steps[index]
95
96
  const previousStep = route.steps[index - 1]
96
97
  // Check if the step is already done
97
- //
98
98
  if (step.execution?.status === 'DONE') {
99
99
  continue
100
100
  }
@@ -136,7 +136,21 @@ const executeSteps = async (
136
136
  updateRouteExecution(route, execution.executionOptions)
137
137
  }
138
138
 
139
- const executedStep = await stepExecutor.executeStep(client, step)
139
+ let executedStep: LiFiStepExtended
140
+ try {
141
+ executedStep = await stepExecutor.executeStep(client, step)
142
+ } catch (e) {
143
+ if (e instanceof ExecuteStepRetryError) {
144
+ step.execution = undefined
145
+ executedStep = await stepExecutor.executeStep(
146
+ client,
147
+ step,
148
+ e.retryParams
149
+ )
150
+ } else {
151
+ throw e
152
+ }
153
+ }
140
154
 
141
155
  // We may reach this point if user interaction isn't allowed. We want to stop execution until we resume it
142
156
  if (executedStep.execution?.status !== 'DONE') {
@@ -4,25 +4,26 @@ export const prepareRestart = (route: RouteExtended) => {
4
4
  for (let index = 0; index < route.steps.length; index++) {
5
5
  const step = route.steps[index]
6
6
  if (step.execution) {
7
- // Find the index of the last process that has tx hash, taskId, or signed messages
8
- const lastValidIndex = step.execution.process.findLastIndex(
9
- (process) =>
10
- (!!process.txHash ||
11
- !!process.taskId ||
12
- !!process.signedTypedData?.length) &&
13
- process.status !== 'FAILED'
7
+ // Find the index of the last action that has tx hash, taskId, or signed messages
8
+ const lastValidIndex = step.execution.actions.findLastIndex(
9
+ (action) =>
10
+ ['SWAP', 'CROSS_CHAIN', 'RECEIVING_CHAIN'].includes(action.type) &&
11
+ (!!action.txHash || !!action.taskId) &&
12
+ action.status !== 'FAILED'
14
13
  )
15
14
 
16
- // Keep all processes up to the one with tx hash
15
+ // Keep all actions up to the one with tx hash
17
16
  if (lastValidIndex >= 0) {
18
- step.execution.process = step.execution.process.slice(
17
+ step.execution.actions = step.execution.actions.slice(
19
18
  0,
20
19
  lastValidIndex + 1
21
20
  )
22
21
  } else {
23
- // If no tx hash exists, reset the process array
24
- step.execution.process = []
22
+ // If no tx hash exists, reset the actions array
23
+ step.execution.actions = []
25
24
  }
25
+ // Reset the last action type
26
+ step.execution.lastActionType = undefined
26
27
  }
27
28
  step.transactionRequest = undefined
28
29
  }
@@ -0,0 +1,42 @@
1
+ export interface SDKStorage {
2
+ get(key: string): string | null | Promise<string | null>
3
+ set(key: string, value: string): void | Promise<void>
4
+ remove(key: string): void | Promise<void>
5
+ }
6
+
7
+ export class LocalStorageAdapter implements SDKStorage {
8
+ get(key: string): string | null {
9
+ return window.localStorage.getItem(key)
10
+ }
11
+
12
+ set(key: string, value: string): void {
13
+ window.localStorage.setItem(key, value)
14
+ }
15
+
16
+ remove(key: string): void {
17
+ window.localStorage.removeItem(key)
18
+ }
19
+ }
20
+
21
+ export class InMemoryStorage implements SDKStorage {
22
+ private store = new Map<string, string>()
23
+
24
+ get(key: string): string | null {
25
+ return this.store.get(key) ?? null
26
+ }
27
+
28
+ set(key: string, value: string): void {
29
+ this.store.set(key, value)
30
+ }
31
+
32
+ remove(key: string): void {
33
+ this.store.delete(key)
34
+ }
35
+ }
36
+
37
+ export function createDefaultStorage(): SDKStorage {
38
+ if (typeof window !== 'undefined' && window.localStorage) {
39
+ return new LocalStorageAdapter()
40
+ }
41
+ return new InMemoryStorage()
42
+ }
@@ -0,0 +1,29 @@
1
+ import { LiFiErrorCode } from '../../errors/constants.js'
2
+ import { TransactionError } from '../../errors/errors.js'
3
+ import type { StepExecutorContext, TaskResult } from '../../types/execution.js'
4
+ import { BaseStepExecutionTask } from '../BaseStepExecutionTask.js'
5
+ import { checkBalance } from './helpers/checkBalance.js'
6
+
7
+ export class CheckBalanceTask extends BaseStepExecutionTask {
8
+ async run(context: StepExecutorContext): Promise<TaskResult> {
9
+ const { client, step, statusManager, isBridgeExecution } = context
10
+
11
+ statusManager.initializeAction({
12
+ step,
13
+ type: isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP',
14
+ chainId: step.action.fromChainId,
15
+ status: 'STARTED',
16
+ })
17
+
18
+ const walletAddress = step.action.fromAddress
19
+ if (!walletAddress) {
20
+ throw new TransactionError(
21
+ LiFiErrorCode.InternalError,
22
+ 'The wallet address is undefined.'
23
+ )
24
+ }
25
+
26
+ await checkBalance(client, walletAddress, step)
27
+ return { status: 'COMPLETED' }
28
+ }
29
+ }
@@ -0,0 +1,62 @@
1
+ import { getStepTransaction } from '../../actions/getStepTransaction.js'
2
+ import { LiFiErrorCode } from '../../errors/constants.js'
3
+ import { TransactionError } from '../../errors/errors.js'
4
+ import type { StepExecutorContext, TaskResult } from '../../types/execution.js'
5
+ import { BaseStepExecutionTask } from '../BaseStepExecutionTask.js'
6
+ import { stepComparison } from './helpers/stepComparison.js'
7
+
8
+ export class PrepareTransactionTask extends BaseStepExecutionTask {
9
+ async run(context: StepExecutorContext): Promise<TaskResult> {
10
+ const {
11
+ client,
12
+ step,
13
+ statusManager,
14
+ allowUserInteraction,
15
+ executionOptions,
16
+ isBridgeExecution,
17
+ } = context
18
+
19
+ const action = statusManager.findAction(
20
+ step,
21
+ isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
22
+ )
23
+
24
+ if (!action) {
25
+ throw new TransactionError(
26
+ LiFiErrorCode.TransactionUnprepared,
27
+ 'Unable to prepare transaction. Action not found.'
28
+ )
29
+ }
30
+
31
+ if (!step.transactionRequest) {
32
+ const { execution, ...stepBase } = step
33
+ const updatedStep = await getStepTransaction(client, stepBase)
34
+ const comparedStep = await stepComparison(
35
+ statusManager,
36
+ step,
37
+ updatedStep,
38
+ allowUserInteraction,
39
+ executionOptions
40
+ )
41
+ Object.assign(step, {
42
+ ...comparedStep,
43
+ execution: step.execution,
44
+ })
45
+ }
46
+
47
+ if (!step.transactionRequest?.data) {
48
+ throw new TransactionError(
49
+ LiFiErrorCode.TransactionUnprepared,
50
+ 'Unable to prepare transaction. Transaction request data is not found.'
51
+ )
52
+ }
53
+
54
+ statusManager.updateAction(step, action.type, 'ACTION_REQUIRED')
55
+
56
+ if (!allowUserInteraction) {
57
+ return { status: 'PAUSED' }
58
+ }
59
+
60
+ return { status: 'COMPLETED' }
61
+ }
62
+ }
@@ -0,0 +1,114 @@
1
+ import type { ExtendedTransactionInfo, FullStatusData } from '@lifi/types'
2
+ import { LiFiErrorCode } from '../../errors/constants.js'
3
+ import { TransactionError } from '../../errors/errors.js'
4
+ import type { ExecutionActionType } from '../../types/core.js'
5
+ import type { StepExecutorContext, TaskResult } from '../../types/execution.js'
6
+ import { getTransactionFailedMessage } from '../../utils/getTransactionMessage.js'
7
+ import { BaseStepExecutionTask } from '../BaseStepExecutionTask.js'
8
+ import { waitForTransactionStatus } from './helpers/waitForTransactionStatus.js'
9
+
10
+ export class WaitForTransactionStatusTask extends BaseStepExecutionTask {
11
+ readonly actionType: ExecutionActionType
12
+
13
+ constructor(actionType: ExecutionActionType) {
14
+ super()
15
+ this.actionType = actionType
16
+ }
17
+
18
+ async run(context: StepExecutorContext): Promise<TaskResult> {
19
+ const {
20
+ client,
21
+ step,
22
+ statusManager,
23
+ pollingIntervalMs,
24
+ toChain,
25
+ isBridgeExecution,
26
+ } = context
27
+
28
+ // At this point, we should have a txHash or taskId
29
+ // taskId is used for custom integrations that don't use the standard transaction hash
30
+ let transactionHash: string | undefined
31
+ try {
32
+ const swapOrBridgeAction = statusManager.findAction(
33
+ step,
34
+ isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
35
+ )
36
+ transactionHash = swapOrBridgeAction?.txHash || swapOrBridgeAction?.taskId
37
+
38
+ // Wait for the transaction status on the destination chain
39
+ if (!transactionHash) {
40
+ throw new Error('Transaction hash is undefined.')
41
+ }
42
+
43
+ const action = statusManager.initializeAction({
44
+ step,
45
+ type: this.actionType,
46
+ chainId:
47
+ this.actionType === 'RECEIVING_CHAIN'
48
+ ? step.action.toChainId
49
+ : step.action.fromChainId,
50
+ status: 'PENDING',
51
+ })
52
+
53
+ const statusResponse = (await waitForTransactionStatus(
54
+ client,
55
+ statusManager,
56
+ transactionHash,
57
+ step,
58
+ action.type,
59
+ pollingIntervalMs
60
+ )) as FullStatusData
61
+
62
+ const statusReceiving =
63
+ statusResponse.receiving as ExtendedTransactionInfo
64
+
65
+ // Update action status
66
+ statusManager.updateAction(step, action.type, 'DONE', {
67
+ chainId: statusReceiving?.chainId || toChain.id,
68
+ substatus: statusResponse.substatus,
69
+ substatusMessage: statusResponse.substatusMessage,
70
+ txHash: statusReceiving?.txHash,
71
+ txLink:
72
+ statusReceiving?.txLink ||
73
+ `${toChain.metamask.blockExplorerUrls[0]}tx/${statusReceiving?.txHash}`,
74
+ })
75
+
76
+ // Update execution status
77
+ statusManager.updateExecution(step, {
78
+ status: 'DONE',
79
+ ...(statusResponse.sending.amount && {
80
+ fromAmount: statusResponse.sending.amount,
81
+ }),
82
+ ...(statusReceiving?.amount && { toAmount: statusReceiving.amount }),
83
+ ...(statusReceiving?.token && { toToken: statusReceiving.token }),
84
+ internalTxLink: statusResponse?.lifiExplorerLink,
85
+ externalTxLink: statusResponse?.bridgeExplorerLink,
86
+ gasCosts: [
87
+ {
88
+ amount: statusResponse.sending.gasAmount,
89
+ amountUSD: statusResponse.sending.gasAmountUSD,
90
+ token: statusResponse.sending.gasToken,
91
+ estimate: statusResponse.sending.gasUsed,
92
+ limit: statusResponse.sending.gasUsed,
93
+ price: statusResponse.sending.gasPrice,
94
+ type: 'SEND',
95
+ },
96
+ ],
97
+ })
98
+
99
+ return { status: 'COMPLETED' }
100
+ } catch (e: any) {
101
+ const htmlMessage = await getTransactionFailedMessage(
102
+ client,
103
+ step,
104
+ `${toChain.metamask.blockExplorerUrls[0]}tx/${transactionHash}`
105
+ )
106
+ throw new TransactionError(
107
+ LiFiErrorCode.TransactionFailed,
108
+ htmlMessage ??
109
+ 'Failed while waiting for status of destination chain transaction.',
110
+ e
111
+ )
112
+ }
113
+ }
114
+ }
@@ -1,9 +1,9 @@
1
1
  import type { LiFiStep } from '@lifi/types'
2
- import { formatUnits } from 'viem'
3
- import { getTokenBalance } from '../actions/getTokenBalance.js'
4
- import { BalanceError } from '../errors/errors.js'
5
- import type { SDKClient } from '../types/core.js'
6
- import { sleep } from '../utils/sleep.js'
2
+ import { getTokenBalance } from '../../../actions/getTokenBalance.js'
3
+ import { BalanceError } from '../../../errors/errors.js'
4
+ import type { SDKClient } from '../../../types/core.js'
5
+ import { formatUnits } from '../../../utils/formatUnits.js'
6
+ import { sleep } from '../../../utils/sleep.js'
7
7
 
8
8
  export const checkBalance = async (
9
9
  client: SDKClient,
@@ -0,0 +1,47 @@
1
+ import { LiFiErrorCode } from '../../../errors/constants.js'
2
+ import { TransactionError } from '../../../errors/errors.js'
3
+ import type {
4
+ ExecutionOptions,
5
+ LiFiStepExtended,
6
+ TransactionParameters,
7
+ } from '../../../types/core.js'
8
+
9
+ export const getTransactionRequestData = async (
10
+ step: LiFiStepExtended,
11
+ executionOptions?: ExecutionOptions
12
+ ): Promise<string> => {
13
+ if (!step.transactionRequest?.data) {
14
+ throw new TransactionError(
15
+ LiFiErrorCode.TransactionUnprepared,
16
+ 'Unable to prepare transaction. Transaction request data is not found.'
17
+ )
18
+ }
19
+
20
+ let transactionRequest: TransactionParameters = {
21
+ data: step.transactionRequest.data,
22
+ }
23
+
24
+ if (executionOptions?.updateTransactionRequestHook) {
25
+ const customizedTransactionRequest: TransactionParameters =
26
+ await executionOptions.updateTransactionRequestHook({
27
+ requestType: 'transaction',
28
+ ...transactionRequest,
29
+ })
30
+
31
+ transactionRequest = {
32
+ ...transactionRequest,
33
+ ...customizedTransactionRequest,
34
+ }
35
+ }
36
+
37
+ const transactionRequestData = transactionRequest.data
38
+
39
+ if (!transactionRequestData) {
40
+ throw new TransactionError(
41
+ LiFiErrorCode.TransactionUnprepared,
42
+ 'Unable to prepare transaction. Transaction request data is not found.'
43
+ )
44
+ }
45
+
46
+ return transactionRequestData
47
+ }
@@ -1,9 +1,9 @@
1
1
  import type { LiFiStep } from '@lifi/types'
2
- import { LiFiErrorCode } from '../errors/constants.js'
3
- import { TransactionError } from '../errors/errors.js'
4
- import type { ExecutionOptions } from '../types/core.js'
5
- import type { StatusManager } from './StatusManager.js'
6
- import { checkStepSlippageThreshold } from './utils.js'
2
+ import type { StatusManager } from '../../../core/StatusManager.js'
3
+ import { checkStepSlippageThreshold } from '../../../core/utils.js'
4
+ import { LiFiErrorCode } from '../../../errors/constants.js'
5
+ import { TransactionError } from '../../../errors/errors.js'
6
+ import type { ExecutionOptions } from '../../../types/core.js'
7
7
 
8
8
  /**
9
9
  * This method checks whether the new and updated Step meets the required exchange rate conditions.
@@ -1,10 +1,10 @@
1
1
  import type { FullStatusData, LiFiStep, StatusResponse } from '@lifi/types'
2
- import { getStatus } from '../actions/getStatus.js'
3
- import { ServerError } from '../errors/errors.js'
4
- import type { ProcessType, SDKClient } from '../types/core.js'
5
- import { waitForResult } from '../utils/waitForResult.js'
6
- import { getSubstatusMessage } from './processMessages.js'
7
- import type { StatusManager } from './StatusManager.js'
2
+ import { getStatus } from '../../../actions/getStatus.js'
3
+ import { ServerError } from '../../../errors/errors.js'
4
+ import type { ExecutionActionType, SDKClient } from '../../../types/core.js'
5
+ import { waitForResult } from '../../../utils/waitForResult.js'
6
+ import { getSubstatusMessage } from '../../actionMessages.js'
7
+ import type { StatusManager } from '../../StatusManager.js'
8
8
 
9
9
  const TRANSACTION_HASH_OBSERVERS: Record<string, Promise<StatusResponse>> = {}
10
10
 
@@ -13,7 +13,7 @@ export async function waitForTransactionStatus(
13
13
  statusManager: StatusManager,
14
14
  txHash: string,
15
15
  step: LiFiStep,
16
- processType: ProcessType,
16
+ actionType: ExecutionActionType,
17
17
  interval = 5_000
18
18
  ): Promise<StatusResponse> {
19
19
  const _getStatus = (): Promise<StatusResponse | undefined> => {
@@ -29,7 +29,7 @@ export async function waitForTransactionStatus(
29
29
  case 'DONE':
30
30
  return statusResponse
31
31
  case 'PENDING':
32
- statusManager?.updateProcess(step, processType, 'PENDING', {
32
+ statusManager?.updateAction(step, actionType, 'PENDING', {
33
33
  substatus: statusResponse.substatus,
34
34
  substatusMessage:
35
35
  statusResponse.substatusMessage ||
@@ -57,7 +57,9 @@ export async function waitForTransactionStatus(
57
57
  let status = TRANSACTION_HASH_OBSERVERS[txHash]
58
58
 
59
59
  if (!status) {
60
- status = waitForResult(_getStatus, interval)
60
+ status = waitForResult(_getStatus, interval).finally(() => {
61
+ delete TRANSACTION_HASH_OBSERVERS[txHash]
62
+ })
61
63
  TRANSACTION_HASH_OBSERVERS[txHash] = status
62
64
  }
63
65
 
package/src/core/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ChainId, ExtendedChain, LiFiStep, Token } from '@lifi/types'
1
+ import type { ChainId, ExtendedChain, LiFiStep } from '@lifi/types'
2
2
  import type { RPCUrls } from '../types/core.js'
3
3
 
4
4
  // Standard threshold for destination amount difference (0.5%)
@@ -57,15 +57,3 @@ export function getRpcUrlsFromChains(
57
57
  }
58
58
  return result
59
59
  }
60
-
61
- /**
62
- * Checks whether a given token is eligible for message signing.
63
- * Tokens with '₮' symbol in their name are disallowed,
64
- * since such tokens may have non-standard signing requirements or compatibility issues with hardware wallets.
65
- *
66
- * @param token - The token object to check.
67
- * @returns true if the token is allowed for message signing, false otherwise.
68
- */
69
- export const isTokenMessageSigningAllowed = (token: Token): boolean => {
70
- return !token.name?.includes('₮') && !token.symbol?.includes('₮')
71
- }
@@ -1,24 +1,24 @@
1
1
  import type { LiFiStep } from '@lifi/types'
2
- import type { Process } from '../types/core.js'
2
+ import type { ExecutionAction } from '../types/core.js'
3
3
  import { version } from '../version.js'
4
4
  import type { BaseError } from './baseError.js'
5
5
  import type { ErrorCode } from './constants.js'
6
6
 
7
7
  // Note: SDKError is used to wrapper and present errors at the top level
8
- // Where opportunity allows we also add the step and the process related to the error
8
+ // Where opportunity allows we also add the step and the action related to the error
9
9
  export class SDKError extends Error {
10
10
  step?: LiFiStep
11
- process?: Process
11
+ action?: ExecutionAction
12
12
  code: ErrorCode
13
13
  override name = 'SDKError'
14
14
  override cause: BaseError
15
15
 
16
- constructor(cause: BaseError, step?: LiFiStep, process?: Process) {
16
+ constructor(cause: BaseError, step?: LiFiStep, action?: ExecutionAction) {
17
17
  const errorMessage = `${cause.message ? `[${cause.name}] ${cause.message}` : 'Unknown error occurred'}\nLI.FI SDK version: ${version}`
18
18
  super(errorMessage)
19
19
  this.name = 'SDKError'
20
20
  this.step = step
21
- this.process = process
21
+ this.action = action
22
22
  this.cause = cause
23
23
  this.stack = this.cause.stack
24
24
  this.code = cause.code
@@ -9,6 +9,8 @@ export enum ErrorName {
9
9
  UnknownError = 'UnknownError',
10
10
  SlippageError = 'SlippageError',
11
11
  HTTPError = 'HTTPError',
12
+ ConfigError = 'ConfigError',
13
+ ExecuteStepRetryError = 'ExecuteStepRetryError',
12
14
  }
13
15
 
14
16
  export type ErrorCode = LiFiErrorCode
@@ -40,6 +42,7 @@ export enum LiFiErrorCode {
40
42
  RateLimitExceeded = 1023,
41
43
  ThirdPartyError = 1024,
42
44
  InsufficientGas = 1025,
45
+ ConfigError = 1026,
43
46
  }
44
47
 
45
48
  export enum ErrorMessage {
@@ -1,3 +1,4 @@
1
+ import type { ExecuteStepRetryParams } from '../types/core.js'
1
2
  import { BaseError } from './baseError.js'
2
3
  import { ErrorName, LiFiErrorCode } from './constants.js'
3
4
 
@@ -42,3 +43,26 @@ export class ValidationError extends BaseError {
42
43
  super(ErrorName.ValidationError, LiFiErrorCode.ValidationError, message)
43
44
  }
44
45
  }
46
+
47
+ /**
48
+ * Thrown by a step executor when executeStep should be retried with the given params
49
+ * (e.g. wallet rejected 7702 upgrade → retry with atomicityNotReady).
50
+ * The execution layer catches this and retries executeStep(client, step, retryParams).
51
+ */
52
+ export class ExecuteStepRetryError extends BaseError {
53
+ readonly retryParams: ExecuteStepRetryParams
54
+
55
+ constructor(
56
+ message: string,
57
+ retryParams: ExecuteStepRetryParams,
58
+ cause?: Error
59
+ ) {
60
+ super(
61
+ ErrorName.ExecuteStepRetryError,
62
+ LiFiErrorCode.InternalError,
63
+ message,
64
+ cause
65
+ )
66
+ this.retryParams = retryParams
67
+ }
68
+ }