@lifi/sdk 2.3.1 → 3.0.0-alpha.10

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 (379) hide show
  1. package/dist/cjs/LiFi.js +222 -250
  2. package/dist/cjs/LiFi.js.map +1 -0
  3. package/dist/cjs/allowance/getAllowance.js +82 -0
  4. package/dist/cjs/allowance/getAllowance.js.map +1 -0
  5. package/dist/cjs/allowance/index.js +5 -16
  6. package/dist/cjs/allowance/index.js.map +1 -0
  7. package/dist/cjs/allowance/setAllowance.js +71 -0
  8. package/dist/cjs/allowance/setAllowance.js.map +1 -0
  9. package/dist/cjs/{types/internal.types.js → allowance/types.js} +1 -0
  10. package/dist/cjs/allowance/types.js.map +1 -0
  11. package/dist/cjs/balance/getBalance.js +97 -0
  12. package/dist/cjs/balance/getBalance.js.map +1 -0
  13. package/dist/cjs/balance/getTokenBalance.js +7 -10
  14. package/dist/cjs/balance/getTokenBalance.js.map +1 -0
  15. package/dist/cjs/balance/index.js +4 -24
  16. package/dist/cjs/balance/index.js.map +1 -0
  17. package/dist/cjs/connectors.js +28 -48
  18. package/dist/cjs/connectors.js.map +1 -0
  19. package/dist/cjs/constants.js +7 -0
  20. package/dist/cjs/constants.js.map +1 -0
  21. package/dist/cjs/execution/BaseStepExecutor.js +54 -0
  22. package/dist/cjs/execution/BaseStepExecutor.js.map +1 -0
  23. package/dist/cjs/execution/EVMStepExecutor.js +271 -0
  24. package/dist/cjs/execution/EVMStepExecutor.js.map +1 -0
  25. package/dist/cjs/execution/RouteExecutionManager.js +196 -197
  26. package/dist/cjs/execution/RouteExecutionManager.js.map +1 -0
  27. package/dist/cjs/execution/StatusManager.js +142 -136
  28. package/dist/cjs/execution/StatusManager.js.map +1 -0
  29. package/dist/cjs/execution/StepExecutionManager.js +220 -233
  30. package/dist/cjs/execution/StepExecutionManager.js.map +1 -0
  31. package/dist/cjs/execution/checkAllowance.js +76 -0
  32. package/dist/cjs/execution/checkAllowance.js.map +1 -0
  33. package/dist/cjs/execution/checkBalance.js +42 -0
  34. package/dist/cjs/execution/checkBalance.js.map +1 -0
  35. package/dist/cjs/execution/index.js +4 -15
  36. package/dist/cjs/execution/index.js.map +1 -0
  37. package/dist/cjs/execution/multisig.js +13 -17
  38. package/dist/cjs/execution/multisig.js.map +1 -0
  39. package/dist/cjs/execution/prepareRestart.js +23 -0
  40. package/dist/cjs/execution/prepareRestart.js.map +1 -0
  41. package/dist/cjs/execution/stepComparison.js +5 -17
  42. package/dist/cjs/execution/stepComparison.js.map +1 -0
  43. package/dist/cjs/execution/switchChain.js +10 -22
  44. package/dist/cjs/execution/switchChain.js.map +1 -0
  45. package/dist/cjs/execution/types.js +3 -0
  46. package/dist/cjs/execution/types.js.map +1 -0
  47. package/dist/cjs/execution/utils.js +12 -67
  48. package/dist/cjs/execution/utils.js.map +1 -0
  49. package/dist/cjs/execution/waitForReceivingTransaction.js +56 -0
  50. package/dist/cjs/execution/waitForReceivingTransaction.js.map +1 -0
  51. package/dist/cjs/helpers.js +12 -58
  52. package/dist/cjs/helpers.js.map +1 -0
  53. package/dist/cjs/index.js +16 -22
  54. package/dist/cjs/index.js.map +1 -0
  55. package/dist/cjs/package.json +1 -0
  56. package/dist/cjs/providers/EVM.js +35 -0
  57. package/dist/cjs/providers/EVM.js.map +1 -0
  58. package/dist/cjs/providers/Solana.js +38 -0
  59. package/dist/cjs/providers/Solana.js.map +1 -0
  60. package/dist/cjs/providers/index.js +5 -0
  61. package/dist/cjs/providers/index.js.map +1 -0
  62. package/dist/cjs/providers/types.js +9 -0
  63. package/dist/cjs/providers/types.js.map +1 -0
  64. package/dist/cjs/request.js +10 -13
  65. package/dist/cjs/request.js.map +1 -0
  66. package/dist/cjs/services/ApiService.js +70 -86
  67. package/dist/cjs/services/ApiService.js.map +1 -0
  68. package/dist/cjs/services/ChainsService.js +19 -9
  69. package/dist/cjs/services/ChainsService.js.map +1 -0
  70. package/dist/cjs/services/ConfigService.js +94 -67
  71. package/dist/cjs/services/ConfigService.js.map +1 -0
  72. package/dist/cjs/typeguards.js +1 -0
  73. package/dist/cjs/typeguards.js.map +1 -0
  74. package/dist/cjs/types/abi.js +46 -0
  75. package/dist/cjs/types/abi.js.map +1 -0
  76. package/dist/cjs/types/index.js +4 -20
  77. package/dist/cjs/types/index.js.map +1 -0
  78. package/dist/cjs/types/internal.js +3 -0
  79. package/dist/cjs/types/internal.js.map +1 -0
  80. package/dist/cjs/utils/errors.js +63 -40
  81. package/dist/cjs/utils/errors.js.map +1 -0
  82. package/dist/cjs/utils/getMaxPriorityFeePerGas.js +23 -0
  83. package/dist/cjs/utils/getMaxPriorityFeePerGas.js.map +1 -0
  84. package/dist/cjs/utils/index.js +9 -0
  85. package/dist/cjs/utils/index.js.map +1 -0
  86. package/dist/cjs/utils/median.js +16 -0
  87. package/dist/cjs/utils/median.js.map +1 -0
  88. package/dist/cjs/utils/parseError.js +55 -92
  89. package/dist/cjs/utils/parseError.js.map +1 -0
  90. package/dist/cjs/utils/utils.js +10 -85
  91. package/dist/cjs/utils/utils.js.map +1 -0
  92. package/dist/cjs/version.js +2 -1
  93. package/dist/cjs/version.js.map +1 -0
  94. package/dist/esm/LiFi.js +375 -0
  95. package/dist/esm/LiFi.js.map +1 -0
  96. package/dist/esm/allowance/getAllowance.js +79 -0
  97. package/dist/esm/allowance/getAllowance.js.map +1 -0
  98. package/dist/esm/allowance/index.js +4 -0
  99. package/dist/esm/allowance/index.js.map +1 -0
  100. package/dist/esm/allowance/setAllowance.js +67 -0
  101. package/dist/esm/allowance/setAllowance.js.map +1 -0
  102. package/dist/esm/allowance/types.js +2 -0
  103. package/dist/esm/allowance/types.js.map +1 -0
  104. package/dist/esm/balance/getBalance.js +93 -0
  105. package/dist/esm/balance/getBalance.js.map +1 -0
  106. package/dist/{balance → esm/balance}/getTokenBalance.js +5 -4
  107. package/dist/esm/balance/getTokenBalance.js.map +1 -0
  108. package/dist/esm/balance/index.js +3 -0
  109. package/dist/esm/balance/index.js.map +1 -0
  110. package/dist/esm/connectors.js +42 -0
  111. package/dist/esm/connectors.js.map +1 -0
  112. package/dist/esm/constants.js +7 -0
  113. package/dist/esm/constants.js.map +1 -0
  114. package/dist/esm/execution/BaseStepExecutor.js +51 -0
  115. package/dist/esm/execution/BaseStepExecutor.js.map +1 -0
  116. package/dist/esm/execution/EVMStepExecutor.js +299 -0
  117. package/dist/esm/execution/EVMStepExecutor.js.map +1 -0
  118. package/dist/esm/execution/RouteExecutionManager.js +268 -0
  119. package/dist/esm/execution/RouteExecutionManager.js.map +1 -0
  120. package/dist/esm/execution/StatusManager.js +216 -0
  121. package/dist/esm/execution/StatusManager.js.map +1 -0
  122. package/dist/esm/execution/StepExecutionManager.js +280 -0
  123. package/dist/esm/execution/StepExecutionManager.js.map +1 -0
  124. package/dist/esm/execution/checkAllowance.js +74 -0
  125. package/dist/esm/execution/checkAllowance.js.map +1 -0
  126. package/dist/esm/execution/checkBalance.js +39 -0
  127. package/dist/esm/execution/checkBalance.js.map +1 -0
  128. package/dist/esm/execution/index.js +3 -0
  129. package/dist/esm/execution/index.js.map +1 -0
  130. package/dist/esm/execution/multisig.js +26 -0
  131. package/dist/esm/execution/multisig.js.map +1 -0
  132. package/dist/esm/execution/prepareRestart.js +64 -0
  133. package/dist/esm/execution/prepareRestart.js.map +1 -0
  134. package/dist/{execution → esm/execution}/stepComparison.js +5 -4
  135. package/dist/esm/execution/stepComparison.js.map +1 -0
  136. package/dist/{execution → esm/execution}/switchChain.js +19 -12
  137. package/dist/esm/execution/switchChain.js.map +1 -0
  138. package/dist/esm/execution/types.js +2 -0
  139. package/dist/esm/execution/types.js.map +1 -0
  140. package/dist/esm/execution/utils.js +80 -0
  141. package/dist/esm/execution/utils.js.map +1 -0
  142. package/dist/esm/execution/waitForReceivingTransaction.js +52 -0
  143. package/dist/esm/execution/waitForReceivingTransaction.js.map +1 -0
  144. package/dist/{helpers.js → esm/helpers.js} +9 -37
  145. package/dist/esm/helpers.js.map +1 -0
  146. package/dist/esm/index.js +10 -0
  147. package/dist/esm/index.js.map +1 -0
  148. package/dist/esm/package.json +1 -0
  149. package/dist/esm/providers/EVM.js +30 -0
  150. package/dist/esm/providers/EVM.js.map +1 -0
  151. package/dist/esm/providers/Solana.js +34 -0
  152. package/dist/esm/providers/Solana.js.map +1 -0
  153. package/dist/esm/providers/index.js +2 -0
  154. package/dist/esm/providers/index.js.map +1 -0
  155. package/dist/esm/providers/types.js +6 -0
  156. package/dist/esm/providers/types.js.map +1 -0
  157. package/dist/{request.js → esm/request.js} +6 -5
  158. package/dist/esm/request.js.map +1 -0
  159. package/dist/{services → esm/services}/ApiService.js +29 -26
  160. package/dist/esm/services/ApiService.js.map +1 -0
  161. package/dist/{services → esm/services}/ChainsService.js +16 -4
  162. package/dist/esm/services/ChainsService.js.map +1 -0
  163. package/dist/esm/services/ConfigService.js +143 -0
  164. package/dist/esm/services/ConfigService.js.map +1 -0
  165. package/dist/{typeguards.js → esm/typeguards.js} +1 -0
  166. package/dist/esm/typeguards.js.map +1 -0
  167. package/dist/esm/types/abi.js +43 -0
  168. package/dist/esm/types/abi.js.map +1 -0
  169. package/dist/esm/types/index.js +3 -0
  170. package/dist/esm/types/index.js.map +1 -0
  171. package/dist/esm/types/internal.js +2 -0
  172. package/dist/esm/types/internal.js.map +1 -0
  173. package/dist/{utils → esm/utils}/errors.js +61 -35
  174. package/dist/esm/utils/errors.js.map +1 -0
  175. package/dist/esm/utils/getMaxPriorityFeePerGas.js +19 -0
  176. package/dist/esm/utils/getMaxPriorityFeePerGas.js.map +1 -0
  177. package/dist/esm/utils/index.js +6 -0
  178. package/dist/esm/utils/index.js.map +1 -0
  179. package/dist/esm/utils/median.js +12 -0
  180. package/dist/esm/utils/median.js.map +1 -0
  181. package/dist/{utils → esm/utils}/parseError.js +45 -41
  182. package/dist/esm/utils/parseError.js.map +1 -0
  183. package/dist/esm/utils/utils.js +38 -0
  184. package/dist/esm/utils/utils.js.map +1 -0
  185. package/dist/esm/version.js +3 -0
  186. package/dist/esm/version.js.map +1 -0
  187. package/dist/types/LiFi.d.ts +179 -0
  188. package/dist/types/LiFi.d.ts.map +1 -0
  189. package/dist/types/allowance/getAllowance.d.ts +7 -0
  190. package/dist/types/allowance/getAllowance.d.ts.map +1 -0
  191. package/dist/types/allowance/index.d.ts +4 -0
  192. package/dist/types/allowance/index.d.ts.map +1 -0
  193. package/dist/types/allowance/setAllowance.d.ts +7 -0
  194. package/dist/types/allowance/setAllowance.d.ts.map +1 -0
  195. package/dist/types/allowance/types.d.ts +28 -0
  196. package/dist/types/allowance/types.d.ts.map +1 -0
  197. package/dist/types/balance/getBalance.d.ts +3 -0
  198. package/dist/types/balance/getBalance.d.ts.map +1 -0
  199. package/dist/{balance → types/balance}/getTokenBalance.d.ts +3 -2
  200. package/dist/types/balance/getTokenBalance.d.ts.map +1 -0
  201. package/dist/types/balance/index.d.ts +3 -0
  202. package/dist/types/balance/index.d.ts.map +1 -0
  203. package/dist/types/connectors.d.ts +9 -0
  204. package/dist/types/connectors.d.ts.map +1 -0
  205. package/dist/types/constants.d.ts +7 -0
  206. package/dist/types/constants.d.ts.map +1 -0
  207. package/dist/types/execution/BaseStepExecutor.d.ts +13 -0
  208. package/dist/types/execution/BaseStepExecutor.d.ts.map +1 -0
  209. package/dist/types/execution/EVMStepExecutor.d.ts +14 -0
  210. package/dist/types/execution/EVMStepExecutor.d.ts.map +1 -0
  211. package/dist/types/execution/RouteExecutionManager.d.ts +61 -0
  212. package/dist/types/execution/RouteExecutionManager.d.ts.map +1 -0
  213. package/dist/types/execution/StatusManager.d.ts +69 -0
  214. package/dist/types/execution/StatusManager.d.ts.map +1 -0
  215. package/dist/types/execution/StepExecutionManager.d.ts +8 -0
  216. package/dist/types/execution/StepExecutionManager.d.ts.map +1 -0
  217. package/dist/types/execution/checkAllowance.d.ts +6 -0
  218. package/dist/types/execution/checkAllowance.d.ts.map +1 -0
  219. package/dist/types/execution/checkBalance.d.ts +3 -0
  220. package/dist/types/execution/checkBalance.d.ts.map +1 -0
  221. package/dist/types/execution/index.d.ts +3 -0
  222. package/dist/types/execution/index.d.ts.map +1 -0
  223. package/dist/types/execution/multisig.d.ts +5 -0
  224. package/dist/types/execution/multisig.d.ts.map +1 -0
  225. package/dist/types/execution/prepareRestart.d.ts +3 -0
  226. package/dist/types/execution/prepareRestart.d.ts.map +1 -0
  227. package/dist/{execution → types/execution}/stepComparison.d.ts +6 -4
  228. package/dist/types/execution/stepComparison.d.ts.map +1 -0
  229. package/dist/types/execution/switchChain.d.ts +23 -0
  230. package/dist/types/execution/switchChain.d.ts.map +1 -0
  231. package/dist/types/execution/types.d.ts +83 -0
  232. package/dist/types/execution/types.d.ts.map +1 -0
  233. package/dist/types/execution/utils.d.ts +13 -0
  234. package/dist/types/execution/utils.d.ts.map +1 -0
  235. package/dist/types/execution/waitForReceivingTransaction.d.ts +4 -0
  236. package/dist/types/execution/waitForReceivingTransaction.d.ts.map +1 -0
  237. package/dist/types/helpers.d.ts +19 -0
  238. package/dist/types/helpers.d.ts.map +1 -0
  239. package/dist/types/index.d.ts +9 -3
  240. package/dist/types/index.d.ts.map +1 -0
  241. package/dist/types/providers/EVM.d.ts +11 -0
  242. package/dist/types/providers/EVM.d.ts.map +1 -0
  243. package/dist/types/providers/Solana.d.ts +10 -0
  244. package/dist/types/providers/Solana.d.ts.map +1 -0
  245. package/dist/types/providers/index.d.ts +2 -0
  246. package/dist/types/providers/index.d.ts.map +1 -0
  247. package/dist/types/providers/types.d.ts +13 -0
  248. package/dist/types/providers/types.d.ts.map +1 -0
  249. package/dist/{request.d.ts → types/request.d.ts} +1 -0
  250. package/dist/types/request.d.ts.map +1 -0
  251. package/dist/{cjs → types}/services/ApiService.d.ts +5 -5
  252. package/dist/types/services/ApiService.d.ts.map +1 -0
  253. package/dist/{services → types/services}/ChainsService.d.ts +3 -2
  254. package/dist/types/services/ChainsService.d.ts.map +1 -0
  255. package/dist/{services → types/services}/ConfigService.d.ts +10 -6
  256. package/dist/types/services/ConfigService.d.ts.map +1 -0
  257. package/dist/{cjs → types}/typeguards.d.ts +3 -2
  258. package/dist/types/typeguards.d.ts.map +1 -0
  259. package/dist/types/types/abi.d.ts +6 -0
  260. package/dist/types/types/abi.d.ts.map +1 -0
  261. package/dist/types/types/index.d.ts +3 -0
  262. package/dist/types/types/index.d.ts.map +1 -0
  263. package/dist/types/types/internal.d.ts +61 -0
  264. package/dist/types/types/internal.d.ts.map +1 -0
  265. package/dist/{cjs → types}/utils/errors.d.ts +16 -14
  266. package/dist/types/utils/errors.d.ts.map +1 -0
  267. package/dist/types/utils/getMaxPriorityFeePerGas.d.ts +3 -0
  268. package/dist/types/utils/getMaxPriorityFeePerGas.d.ts.map +1 -0
  269. package/dist/types/utils/index.d.ts +6 -0
  270. package/dist/types/utils/index.d.ts.map +1 -0
  271. package/dist/types/utils/median.d.ts +2 -0
  272. package/dist/types/utils/median.d.ts.map +1 -0
  273. package/dist/{utils → types/utils}/parseError.d.ts +7 -6
  274. package/dist/types/utils/parseError.d.ts.map +1 -0
  275. package/dist/types/utils/utils.d.ts +11 -0
  276. package/dist/types/utils/utils.d.ts.map +1 -0
  277. package/dist/types/version.d.ts +3 -0
  278. package/dist/types/version.d.ts.map +1 -0
  279. package/package.json +37 -95
  280. package/dist/LiFi.d.ts +0 -164
  281. package/dist/LiFi.js +0 -235
  282. package/dist/allowance/checkAllowance.d.ts +0 -4
  283. package/dist/allowance/checkAllowance.js +0 -96
  284. package/dist/allowance/index.d.ts +0 -2
  285. package/dist/allowance/index.js +0 -2
  286. package/dist/allowance/tokenApproval.d.ts +0 -22
  287. package/dist/allowance/tokenApproval.js +0 -59
  288. package/dist/allowance/utils.d.ts +0 -14
  289. package/dist/allowance/utils.js +0 -72
  290. package/dist/balance/checkBalance.d.ts +0 -3
  291. package/dist/balance/checkBalance.js +0 -38
  292. package/dist/balance/index.d.ts +0 -13
  293. package/dist/balance/index.js +0 -10
  294. package/dist/balance/utils.d.ts +0 -6
  295. package/dist/balance/utils.js +0 -143
  296. package/dist/cjs/LiFi.d.ts +0 -164
  297. package/dist/cjs/allowance/checkAllowance.d.ts +0 -4
  298. package/dist/cjs/allowance/checkAllowance.js +0 -103
  299. package/dist/cjs/allowance/index.d.ts +0 -2
  300. package/dist/cjs/allowance/tokenApproval.d.ts +0 -22
  301. package/dist/cjs/allowance/tokenApproval.js +0 -69
  302. package/dist/cjs/allowance/utils.d.ts +0 -14
  303. package/dist/cjs/allowance/utils.js +0 -82
  304. package/dist/cjs/balance/checkBalance.d.ts +0 -3
  305. package/dist/cjs/balance/checkBalance.js +0 -45
  306. package/dist/cjs/balance/getTokenBalance.d.ts +0 -8
  307. package/dist/cjs/balance/index.d.ts +0 -13
  308. package/dist/cjs/balance/utils.d.ts +0 -6
  309. package/dist/cjs/balance/utils.js +0 -150
  310. package/dist/cjs/connectors.d.ts +0 -6
  311. package/dist/cjs/execution/RouteExecutionManager.d.ts +0 -65
  312. package/dist/cjs/execution/StatusManager.d.ts +0 -68
  313. package/dist/cjs/execution/StepExecutionManager.d.ts +0 -7
  314. package/dist/cjs/execution/StepExecutor.d.ts +0 -15
  315. package/dist/cjs/execution/StepExecutor.js +0 -62
  316. package/dist/cjs/execution/index.d.ts +0 -1
  317. package/dist/cjs/execution/multisig.d.ts +0 -3
  318. package/dist/cjs/execution/stepComparison.d.ts +0 -14
  319. package/dist/cjs/execution/switchChain.d.ts +0 -16
  320. package/dist/cjs/execution/utils.d.ts +0 -6
  321. package/dist/cjs/helpers.d.ts +0 -28
  322. package/dist/cjs/index.d.ts +0 -5
  323. package/dist/cjs/request.d.ts +0 -9
  324. package/dist/cjs/services/ChainsService.d.ts +0 -11
  325. package/dist/cjs/services/ConfigService.d.ts +0 -23
  326. package/dist/cjs/types/ERC20.d.ts +0 -22
  327. package/dist/cjs/types/ERC20.js +0 -53
  328. package/dist/cjs/types/index.d.ts +0 -4
  329. package/dist/cjs/types/internal.types.d.ts +0 -151
  330. package/dist/cjs/utils/getProvider.d.ts +0 -3
  331. package/dist/cjs/utils/getProvider.js +0 -11
  332. package/dist/cjs/utils/multicall.d.ts +0 -10
  333. package/dist/cjs/utils/multicall.js +0 -68
  334. package/dist/cjs/utils/multicallAbi.json +0 -313
  335. package/dist/cjs/utils/parseError.d.ts +0 -37
  336. package/dist/cjs/utils/preRestart.d.ts +0 -3
  337. package/dist/cjs/utils/preRestart.js +0 -56
  338. package/dist/cjs/utils/utils.d.ts +0 -25
  339. package/dist/cjs/version.d.ts +0 -2
  340. package/dist/connectors.d.ts +0 -6
  341. package/dist/connectors.js +0 -57
  342. package/dist/execution/RouteExecutionManager.d.ts +0 -65
  343. package/dist/execution/RouteExecutionManager.js +0 -213
  344. package/dist/execution/StatusManager.d.ts +0 -68
  345. package/dist/execution/StatusManager.js +0 -168
  346. package/dist/execution/StepExecutionManager.d.ts +0 -7
  347. package/dist/execution/StepExecutionManager.js +0 -267
  348. package/dist/execution/StepExecutor.d.ts +0 -15
  349. package/dist/execution/StepExecutor.js +0 -58
  350. package/dist/execution/index.d.ts +0 -1
  351. package/dist/execution/index.js +0 -1
  352. package/dist/execution/multisig.d.ts +0 -3
  353. package/dist/execution/multisig.js +0 -27
  354. package/dist/execution/switchChain.d.ts +0 -16
  355. package/dist/execution/utils.d.ts +0 -6
  356. package/dist/execution/utils.js +0 -122
  357. package/dist/helpers.d.ts +0 -28
  358. package/dist/index.d.ts +0 -5
  359. package/dist/index.js +0 -6
  360. package/dist/services/ApiService.d.ts +0 -17
  361. package/dist/services/ConfigService.js +0 -101
  362. package/dist/typeguards.d.ts +0 -4
  363. package/dist/types/ERC20.d.ts +0 -22
  364. package/dist/types/ERC20.js +0 -50
  365. package/dist/types/index.js +0 -4
  366. package/dist/types/internal.types.d.ts +0 -151
  367. package/dist/types/internal.types.js +0 -1
  368. package/dist/utils/errors.d.ts +0 -106
  369. package/dist/utils/getProvider.d.ts +0 -3
  370. package/dist/utils/getProvider.js +0 -7
  371. package/dist/utils/multicall.d.ts +0 -10
  372. package/dist/utils/multicall.js +0 -61
  373. package/dist/utils/multicallAbi.json +0 -313
  374. package/dist/utils/preRestart.d.ts +0 -3
  375. package/dist/utils/preRestart.js +0 -52
  376. package/dist/utils/utils.d.ts +0 -25
  377. package/dist/utils/utils.js +0 -99
  378. package/dist/version.d.ts +0 -2
  379. package/dist/version.js +0 -2
@@ -1,267 +0,0 @@
1
- import { BigNumber } from 'ethers';
2
- import { checkAllowance } from '../allowance';
3
- import { checkBalance } from '../balance';
4
- import ApiService from '../services/ApiService';
5
- import ChainsService from '../services/ChainsService';
6
- import { LifiErrorCode, TransactionError, ValidationError, } from '../utils/errors';
7
- import { getProvider } from '../utils/getProvider';
8
- import { getTransactionFailedMessage, parseError } from '../utils/parseError';
9
- import { isZeroAddress, personalizeStep } from '../utils/utils';
10
- import { stepComparison } from './stepComparison';
11
- import { switchChain } from './switchChain';
12
- import { getSubstatusMessage, waitForReceivingTransaction } from './utils';
13
- import ConfigService from '../services/ConfigService';
14
- import { updateMultisigRouteProcess } from './multisig';
15
- export class StepExecutionManager {
16
- constructor() {
17
- this.allowUserInteraction = true;
18
- this.allowInteraction = (value) => {
19
- this.allowUserInteraction = value;
20
- };
21
- this.execute = async ({ signer, step, statusManager, settings, }) => {
22
- const config = ConfigService.getInstance().getConfig();
23
- const isMultisigSigner = !!config.multisigConfig?.isMultisigSigner;
24
- const multisigBatchTransactions = [];
25
- const shouldBatchTransactions = config.multisigConfig?.shouldBatchTransactions &&
26
- !!config.multisigConfig.sendBatchTransaction;
27
- step.execution = statusManager.initExecutionObject(step);
28
- const chainsService = ChainsService.getInstance();
29
- const fromChain = await chainsService.getChainById(step.action.fromChainId);
30
- const toChain = await chainsService.getChainById(step.action.toChainId);
31
- const isBridgeExecution = fromChain.id !== toChain.id;
32
- const currentProcessType = isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP';
33
- // STEP 1: Check allowance
34
- const existingProcess = step.execution.process.find((p) => p.type === currentProcessType);
35
- // Check token approval only if fromToken is not the native token => no approval needed in that case
36
- const checkForAllowance = !existingProcess?.txHash &&
37
- !isZeroAddress(step.action.fromToken.address) &&
38
- (shouldBatchTransactions || !isMultisigSigner);
39
- if (checkForAllowance) {
40
- const populatedTransaction = await checkAllowance(signer, step, statusManager, settings, fromChain, this.allowUserInteraction, shouldBatchTransactions);
41
- if (populatedTransaction) {
42
- const { to, data } = populatedTransaction;
43
- if (to && data) {
44
- // allowance doesn't need value
45
- const cleanedPopulatedTransaction = {
46
- value: BigNumber.from(0).toString(),
47
- to,
48
- data,
49
- };
50
- multisigBatchTransactions.push(cleanedPopulatedTransaction);
51
- }
52
- }
53
- }
54
- // STEP 2: Get transaction
55
- let process = statusManager.findOrCreateProcess(step, currentProcessType);
56
- if (process.status !== 'DONE') {
57
- const multisigProcess = step.execution.process.find((p) => !!p.multisigTxHash);
58
- try {
59
- if (isMultisigSigner && multisigProcess) {
60
- if (!multisigProcess) {
61
- throw new ValidationError('Multisig process is undefined.');
62
- }
63
- if (!config.multisigConfig?.getMultisigTransactionDetails) {
64
- throw new ValidationError('"getMultisigTransactionDetails()" is missing in Multisig config.');
65
- }
66
- const multisigTxHash = multisigProcess.multisigTxHash;
67
- if (!multisigTxHash) {
68
- // need to check what happens in failed tx
69
- throw new ValidationError('Multisig internal transaction hash is undefined.');
70
- }
71
- await updateMultisigRouteProcess(multisigTxHash, step, statusManager, process, fromChain);
72
- }
73
- let transaction;
74
- if (process.txHash) {
75
- // Make sure that the chain is still correct
76
- const updatedSigner = await switchChain(signer, statusManager, step, settings.switchChainHook, this.allowUserInteraction);
77
- if (!updatedSigner) {
78
- // Chain switch was not successful, stop execution here
79
- return step.execution;
80
- }
81
- signer = updatedSigner;
82
- // Load exiting transaction
83
- transaction = await getProvider(signer).getTransaction(process.txHash);
84
- }
85
- else {
86
- process = statusManager.updateProcess(step, process.type, 'STARTED');
87
- // Check balance
88
- await checkBalance(signer, step);
89
- // Create new transaction
90
- if (!step.transactionRequest) {
91
- const personalizedStep = await personalizeStep(signer, step);
92
- const updatedStep = await ApiService.getStepTransaction(personalizedStep);
93
- const comparedStep = await stepComparison(statusManager, personalizedStep, updatedStep, settings, this.allowUserInteraction);
94
- step = {
95
- ...comparedStep,
96
- execution: step.execution,
97
- };
98
- }
99
- const { transactionRequest } = step;
100
- if (!transactionRequest) {
101
- throw new TransactionError(LifiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
102
- }
103
- // STEP 3: Send the transaction
104
- // Make sure that the chain is still correct
105
- const updatedSigner = await switchChain(signer, statusManager, step, settings.switchChainHook, this.allowUserInteraction);
106
- if (!updatedSigner) {
107
- // Chain switch was not successful, stop execution here
108
- return step.execution;
109
- }
110
- signer = updatedSigner;
111
- process = statusManager.updateProcess(step, process.type, 'ACTION_REQUIRED');
112
- if (!this.allowUserInteraction) {
113
- return step.execution;
114
- }
115
- if (settings.updateTransactionRequestHook) {
116
- const customConfig = await settings.updateTransactionRequestHook(transactionRequest);
117
- transactionRequest.gasLimit = customConfig.gasLimit;
118
- transactionRequest.gasPrice = customConfig.gasPrice;
119
- transactionRequest.maxPriorityFeePerGas =
120
- customConfig.maxPriorityFeePerGas;
121
- transactionRequest.maxFeePerGas = customConfig.maxFeePerGas;
122
- }
123
- else {
124
- try {
125
- const estimatedGasLimit = await signer.estimateGas(transactionRequest);
126
- if (estimatedGasLimit) {
127
- transactionRequest.gasLimit = BigNumber.from(`${(BigInt(estimatedGasLimit.toString()) * 125n) / 100n}`);
128
- }
129
- // Fetch latest gasPrice from provider and use it
130
- const gasPrice = await signer.getGasPrice();
131
- if (gasPrice) {
132
- transactionRequest.gasPrice = gasPrice;
133
- }
134
- }
135
- catch (error) { }
136
- }
137
- // Submit the transaction
138
- if (shouldBatchTransactions &&
139
- config.multisigConfig?.sendBatchTransaction) {
140
- const { to, data, value } = await signer.populateTransaction(transactionRequest);
141
- const isValidTransaction = to && data;
142
- if (isValidTransaction) {
143
- const populatedTransaction = {
144
- value: value?.toString() ?? BigNumber.from(0).toString(),
145
- to,
146
- data: data.toString(),
147
- };
148
- multisigBatchTransactions.push(populatedTransaction);
149
- transaction = await config.multisigConfig?.sendBatchTransaction(multisigBatchTransactions);
150
- }
151
- else {
152
- throw new TransactionError(LifiErrorCode.TransactionUnprepared, 'Unable to prepare transaction.');
153
- }
154
- }
155
- else {
156
- transaction = await signer.sendTransaction(transactionRequest);
157
- }
158
- // STEP 4: Wait for the transaction
159
- if (isMultisigSigner) {
160
- process = statusManager.updateProcess(step, process.type, 'ACTION_REQUIRED', {
161
- multisigTxHash: transaction.hash,
162
- });
163
- }
164
- else {
165
- process = statusManager.updateProcess(step, process.type, 'PENDING', {
166
- txHash: transaction.hash,
167
- txLink: fromChain.metamask.blockExplorerUrls[0] +
168
- 'tx/' +
169
- transaction.hash,
170
- });
171
- }
172
- }
173
- await transaction.wait?.();
174
- // if it's multisig signer and the process is in ACTION_REQUIRED
175
- // then signatures are still needed
176
- if (isMultisigSigner &&
177
- process.status === 'ACTION_REQUIRED' &&
178
- transaction.hash) {
179
- // Return the execution object without updating the process
180
- // The execution would progress once all multisigs signer approve
181
- await updateMultisigRouteProcess(transaction.hash, step, statusManager, process, fromChain);
182
- }
183
- if (!isMultisigSigner) {
184
- process = statusManager.updateProcess(step, process.type, 'PENDING', {
185
- txHash: transaction.hash,
186
- txLink: fromChain.metamask.blockExplorerUrls[0] +
187
- 'tx/' +
188
- transaction.hash,
189
- });
190
- }
191
- if (isBridgeExecution) {
192
- process = statusManager.updateProcess(step, process.type, 'DONE');
193
- }
194
- }
195
- catch (e) {
196
- if (e.code === 'TRANSACTION_REPLACED' && e.replacement) {
197
- process = statusManager.updateProcess(step, process.type, 'DONE', {
198
- txHash: e.replacement.hash,
199
- txLink: fromChain.metamask.blockExplorerUrls[0] +
200
- 'tx/' +
201
- e.replacement.hash,
202
- });
203
- }
204
- else {
205
- const error = await parseError(e, step, process);
206
- process = statusManager.updateProcess(step, process.type, 'FAILED', {
207
- error: {
208
- message: error.message,
209
- htmlMessage: error.htmlMessage,
210
- code: error.code,
211
- },
212
- });
213
- statusManager.updateExecution(step, 'FAILED');
214
- throw error;
215
- }
216
- }
217
- }
218
- // STEP 5: Wait for the receiving chain
219
- const processTxHash = process.txHash;
220
- if (isBridgeExecution) {
221
- process = statusManager.findOrCreateProcess(step, 'RECEIVING_CHAIN', 'PENDING');
222
- }
223
- let statusResponse;
224
- try {
225
- if (!processTxHash) {
226
- throw new Error('Transaction hash is undefined.');
227
- }
228
- statusResponse = (await waitForReceivingTransaction(processTxHash, statusManager, process.type, step));
229
- const statusReceiving = statusResponse.receiving;
230
- process = statusManager.updateProcess(step, process.type, 'DONE', {
231
- substatus: statusResponse.substatus,
232
- substatusMessage: statusResponse.substatusMessage ||
233
- getSubstatusMessage(statusResponse.status, statusResponse.substatus),
234
- txHash: statusReceiving?.txHash,
235
- txLink: toChain.metamask.blockExplorerUrls[0] +
236
- 'tx/' +
237
- statusReceiving?.txHash,
238
- });
239
- statusManager.updateExecution(step, 'DONE', {
240
- fromAmount: statusResponse.sending.amount,
241
- toAmount: statusReceiving?.amount,
242
- toToken: statusReceiving?.token,
243
- gasAmount: statusResponse.sending.gasAmount,
244
- gasAmountUSD: statusResponse.sending.gasAmountUSD,
245
- gasPrice: statusResponse.sending.gasPrice,
246
- gasToken: statusResponse.sending.gasToken,
247
- gasUsed: statusResponse.sending.gasUsed,
248
- });
249
- }
250
- catch (e) {
251
- const htmlMessage = await getTransactionFailedMessage(step, process.txLink);
252
- process = statusManager.updateProcess(step, process.type, 'FAILED', {
253
- error: {
254
- code: LifiErrorCode.TransactionFailed,
255
- message: 'Failed while waiting for receiving chain.',
256
- htmlMessage,
257
- },
258
- });
259
- statusManager.updateExecution(step, 'FAILED');
260
- console.warn(e);
261
- throw e;
262
- }
263
- // DONE
264
- return step.execution;
265
- };
266
- }
267
- }
@@ -1,15 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { InteractionSettings, InternalExecutionSettings, LifiStep } from '../types';
3
- import { StatusManager } from './StatusManager';
4
- import { StepExecutionManager } from './StepExecutionManager';
5
- export declare class StepExecutor {
6
- stepExecutionManager: StepExecutionManager;
7
- statusManager: StatusManager;
8
- settings: InternalExecutionSettings;
9
- allowUserInteraction: boolean;
10
- executionStopped: boolean;
11
- constructor(statusManager: StatusManager, settings: InternalExecutionSettings);
12
- setInteraction: (settings?: InteractionSettings) => void;
13
- checkChain: () => never;
14
- executeStep: (signer: Signer, step: LifiStep) => Promise<LifiStep>;
15
- }
@@ -1,58 +0,0 @@
1
- import { StepExecutionManager } from './StepExecutionManager';
2
- import { switchChain } from './switchChain';
3
- // Please be careful when changing the defaults as it may break the behavior (e.g., background execution)
4
- const defaultInteractionSettings = {
5
- allowInteraction: true,
6
- allowUpdates: true,
7
- stopExecution: false,
8
- };
9
- export class StepExecutor {
10
- constructor(statusManager, settings) {
11
- this.allowUserInteraction = true;
12
- this.executionStopped = false;
13
- this.setInteraction = (settings) => {
14
- const interactionSettings = {
15
- ...defaultInteractionSettings,
16
- ...settings,
17
- };
18
- this.allowUserInteraction = interactionSettings.allowInteraction;
19
- this.stepExecutionManager.allowInteraction(interactionSettings.allowInteraction);
20
- this.statusManager.allowUpdates(interactionSettings.allowUpdates);
21
- this.executionStopped = interactionSettings.stopExecution;
22
- };
23
- // TODO: add checkChain method and update signer inside executors
24
- // This can come in handy when we execute multiple routes simultaneously and
25
- // should be sure that we are on the right chain when waiting for transactions.
26
- this.checkChain = () => {
27
- throw new Error('checkChain is not implemented.');
28
- };
29
- this.executeStep = async (signer, step) => {
30
- // Make sure that the chain is still correct
31
- // Find if it's bridging and the step is waiting for a transaction on the receiving chain
32
- const recievingChainProcess = step.execution?.process.find((process) => process.type === 'RECEIVING_CHAIN');
33
- // If the step is waiting for a transaction on the receiving chain, we do not switch the chain
34
- // All changes are already done from the source chain
35
- // Return the step
36
- if (recievingChainProcess?.substatus !== 'WAIT_DESTINATION_TRANSACTION' ||
37
- !recievingChainProcess) {
38
- const updatedSigner = await switchChain(signer, this.statusManager, step, this.settings.switchChainHook, this.allowUserInteraction);
39
- if (!updatedSigner) {
40
- // Chain switch was not successful, stop execution here
41
- return step;
42
- }
43
- signer = updatedSigner;
44
- }
45
- const parameters = {
46
- signer,
47
- step,
48
- settings: this.settings,
49
- statusManager: this.statusManager,
50
- };
51
- await this.stepExecutionManager.execute(parameters);
52
- return step;
53
- };
54
- this.stepExecutionManager = new StepExecutionManager();
55
- this.statusManager = statusManager;
56
- this.settings = settings;
57
- }
58
- }
@@ -1 +0,0 @@
1
- export * from './StatusManager';
@@ -1 +0,0 @@
1
- export * from './StatusManager';
@@ -1,3 +0,0 @@
1
- import { ExtendedChain, LifiStep, Process } from '@lifi/types';
2
- import { StatusManager } from '.';
3
- export declare const updateMultisigRouteProcess: (internalTxHash: string, step: LifiStep, statusManager: StatusManager, process: Process, fromChain: ExtendedChain) => Promise<void>;
@@ -1,27 +0,0 @@
1
- import ConfigService from '../services/ConfigService';
2
- import { LifiErrorCode, TransactionError } from '../utils/errors';
3
- export const updateMultisigRouteProcess = async (internalTxHash, step, statusManager, process, fromChain) => {
4
- const config = ConfigService.getInstance().getConfig();
5
- if (!config.multisigConfig?.getMultisigTransactionDetails) {
6
- throw new Error('"getMultisigTransactionDetails()" is missing in Multisig config.');
7
- }
8
- const updateIntermediateMultisigStatus = () => {
9
- process = statusManager.updateProcess(step, process.type, 'PENDING');
10
- };
11
- const multisigStatusResponse = await config.multisigConfig?.getMultisigTransactionDetails(internalTxHash, fromChain.id, updateIntermediateMultisigStatus);
12
- if (multisigStatusResponse.status === 'DONE') {
13
- process = statusManager.updateProcess(step, process.type, 'PENDING', {
14
- txHash: multisigStatusResponse.txHash,
15
- multisigTxHash: undefined,
16
- txLink: fromChain.metamask.blockExplorerUrls[0] +
17
- 'tx/' +
18
- multisigStatusResponse.txHash,
19
- });
20
- }
21
- if (multisigStatusResponse.status === 'FAILED') {
22
- throw new TransactionError(LifiErrorCode.TransactionFailed, 'Multisig transaction failed.');
23
- }
24
- if (multisigStatusResponse.status === 'CANCELLED') {
25
- throw new TransactionError(LifiErrorCode.TransactionRejected, 'Transaction was rejected by users.');
26
- }
27
- };
@@ -1,16 +0,0 @@
1
- import { LifiStep } from '@lifi/types';
2
- import { Signer } from 'ethers';
3
- import { SwitchChainHook } from '../types';
4
- import { StatusManager } from './StatusManager';
5
- /**
6
- * This method checks whether the signer is configured for the correct chain.
7
- * If yes it returns the signer.
8
- * If no and if user interaction is allowed it triggers the switchChainHook. If no user interaction is allowed it aborts.
9
- *
10
- * @param signer
11
- * @param statusManager
12
- * @param step
13
- * @param switchChainHook
14
- * @param allowUserInteraction
15
- */
16
- export declare const switchChain: (signer: Signer, statusManager: StatusManager, step: LifiStep, switchChainHook: SwitchChainHook, allowUserInteraction: boolean) => Promise<Signer | undefined>;
@@ -1,6 +0,0 @@
1
- import { LifiStep, ProcessType, Status, StatusMessage, StatusResponse, Substatus } from '@lifi/types';
2
- import { StatusManager } from '..';
3
- export declare function waitForReceivingTransaction(txHash: string, statusManager: StatusManager, processType: ProcessType, step: LifiStep): Promise<StatusResponse>;
4
- export declare function getProcessMessage(type: ProcessType, status: Status): string | undefined;
5
- export declare function getSubstatusMessage(status: StatusMessage, substatus?: Substatus): string | undefined;
6
- export declare function checkStepSlippageThreshold(oldStep: LifiStep, newStep: LifiStep): boolean;
@@ -1,122 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import ApiService from '../services/ApiService';
3
- import { ServerError } from '../utils/errors';
4
- import { repeatUntilDone } from '../utils/utils';
5
- const TRANSACTION_HASH_OBSERVERS = {};
6
- export async function waitForReceivingTransaction(txHash, statusManager, processType, step) {
7
- const getStatus = () => new Promise(async (resolve, reject) => {
8
- let statusResponse;
9
- try {
10
- statusResponse = await ApiService.getStatus({
11
- bridge: step.tool,
12
- fromChain: step.action.fromChainId,
13
- toChain: step.action.toChainId,
14
- txHash,
15
- });
16
- }
17
- catch (e) {
18
- console.debug('Fetching status from backend failed.', e);
19
- return resolve(undefined);
20
- }
21
- switch (statusResponse.status) {
22
- case 'DONE':
23
- return resolve(statusResponse);
24
- case 'PENDING':
25
- statusManager?.updateProcess(step, processType, 'PENDING', {
26
- substatus: statusResponse.substatus,
27
- substatusMessage: statusResponse.substatusMessage ||
28
- getSubstatusMessage(statusResponse.status, statusResponse.substatus),
29
- txLink: statusResponse.bridgeExplorerLink,
30
- });
31
- return resolve(undefined);
32
- case 'NOT_FOUND':
33
- return resolve(undefined);
34
- case 'FAILED':
35
- default:
36
- return reject();
37
- }
38
- });
39
- let status;
40
- if (txHash in TRANSACTION_HASH_OBSERVERS) {
41
- status = await TRANSACTION_HASH_OBSERVERS[txHash];
42
- }
43
- else {
44
- TRANSACTION_HASH_OBSERVERS[txHash] = repeatUntilDone(getStatus, 5000);
45
- status = await TRANSACTION_HASH_OBSERVERS[txHash];
46
- }
47
- if (!status.receiving) {
48
- throw new ServerError("Status doesn't contain receiving information.");
49
- }
50
- return status;
51
- }
52
- const processMessages = {
53
- TOKEN_ALLOWANCE: {
54
- STARTED: 'Setting token allowance.',
55
- PENDING: 'Waiting for token allowance.',
56
- DONE: 'Token allowance set.',
57
- },
58
- SWITCH_CHAIN: {
59
- PENDING: 'Chain switch required.',
60
- DONE: 'Chain switched successfully.',
61
- },
62
- SWAP: {
63
- STARTED: 'Preparing swap transaction.',
64
- ACTION_REQUIRED: 'Please sign the transaction.',
65
- PENDING: 'Waiting for swap transaction.',
66
- DONE: 'Swap completed.',
67
- },
68
- CROSS_CHAIN: {
69
- STARTED: 'Preparing bridge transaction.',
70
- ACTION_REQUIRED: 'Please sign the transaction.',
71
- PENDING: 'Waiting for bridge transaction.',
72
- DONE: 'Bridge transaction confirmed.',
73
- },
74
- RECEIVING_CHAIN: {
75
- PENDING: 'Waiting for destination chain.',
76
- DONE: 'Bridge completed.',
77
- },
78
- TRANSACTION: {},
79
- };
80
- const substatusMessages = {
81
- PENDING: {
82
- BRIDGE_NOT_AVAILABLE: 'Bridge communication is temporarily unavailable.',
83
- CHAIN_NOT_AVAILABLE: 'RPC communication is temporarily unavailable.',
84
- NOT_PROCESSABLE_REFUND_NEEDED: 'The transfer cannot be completed successfully. A refund operation is required.',
85
- UNKNOWN_ERROR: 'An unexpected error occurred. Please seek assistance in the LI.FI discord server.',
86
- WAIT_SOURCE_CONFIRMATIONS: 'The bridge deposit has been received. The bridge is waiting for more confirmations to start the off-chain logic.',
87
- WAIT_DESTINATION_TRANSACTION: 'The bridge off-chain logic is being executed. Wait for the transaction to appear on the destination chain.',
88
- },
89
- DONE: {
90
- PARTIAL: 'Some of the received tokens are not the requested destination tokens.',
91
- REFUNDED: 'The tokens were refunded to the sender address.',
92
- COMPLETED: 'The transfer is complete.',
93
- },
94
- FAILED: {},
95
- INVALID: {},
96
- NOT_FOUND: {},
97
- };
98
- export function getProcessMessage(type, status) {
99
- const processMessage = processMessages[type][status];
100
- return processMessage;
101
- }
102
- export function getSubstatusMessage(status, substatus) {
103
- if (!substatus) {
104
- return;
105
- }
106
- const message = substatusMessages[status][substatus];
107
- return message;
108
- }
109
- // Used to check if changed exchange rate is in the range of slippage threshold
110
- export function checkStepSlippageThreshold(oldStep, newStep) {
111
- const setSlippage = new BigNumber(oldStep.action.slippage);
112
- const oldEstimatedToAmount = new BigNumber(oldStep.estimate.toAmountMin);
113
- const newEstimatedToAmount = new BigNumber(newStep.estimate.toAmountMin);
114
- const amountDifference = oldEstimatedToAmount.minus(newEstimatedToAmount);
115
- // oldEstimatedToAmount can be 0 when we use conract calls
116
- let actualSlippage = new BigNumber(0);
117
- if (oldEstimatedToAmount.gt(0)) {
118
- actualSlippage = amountDifference.dividedBy(oldEstimatedToAmount);
119
- }
120
- return (newEstimatedToAmount.gte(oldEstimatedToAmount) &&
121
- actualSlippage.lte(setSlippage));
122
- }
package/dist/helpers.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import { LifiStep, Route, Token } from '@lifi/types';
2
- import { TenderlyResponse } from './types';
3
- /**
4
- * Predefined hook that decrypts calldata using EIP-1193 compliant wallet functions.
5
- * @param {string} walletAddress - The wallet address of the user that should decrypt the calldata.
6
- * @return {(encryptedData: string) => Promise<any>} A function that decrypts data using EIP-1193 compliant wallet functions.
7
- */
8
- export declare const getEthereumDecryptionHook: (walletAddress: string) => (encryptedData: string) => Promise<string>;
9
- /**
10
- * Predefined hook that get the public encryption key of a user using EIP-1193 compliant wallet functions.
11
- * @param {string} walletAddress - The wallet address of the user.
12
- * @return {(walletAddress: string) => () => Promise<any>} A function that return the public encryption key using EIP-1193 compliant wallet functions.
13
- */
14
- export declare const getEthereumPublicKeyHook: (walletAddress: string) => () => Promise<string>;
15
- /**
16
- * Returns a random number between min (inclusive) and max (inclusive)
17
- */
18
- export declare const getRandomNumber: (min: number, max: number) => number;
19
- export declare const isSameToken: (tokenA: Token, tokenB: Token) => boolean;
20
- export declare const checkPackageUpdates: (packageName?: string, packageVersion?: string, disableCheck?: boolean) => Promise<void>;
21
- /**
22
- * Converts a quote to Route
23
- * @param {LifiStep} step - Step returned from the quote endpoint.
24
- * @return {Route} - The route to be executed.
25
- * @throws {ValidationError} Throws a ValidationError if the step has missing values.
26
- */
27
- export declare const convertQuoteToRoute: (step: LifiStep) => Route;
28
- export declare const fetchTxErrorDetails: (txHash: string, chainId: number) => Promise<TenderlyResponse>;
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './execution';
2
- export * from './helpers';
3
- export { LiFi } from './LiFi';
4
- export * from './types';
5
- export * from './utils/errors';
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- // expose types and helpers
2
- export * from './execution';
3
- export * from './helpers';
4
- export { LiFi } from './LiFi';
5
- export * from './types';
6
- export * from './utils/errors';
@@ -1,17 +0,0 @@
1
- import { ConnectionsRequest, ConnectionsResponse, ContractCallQuoteRequest, GasRecommendationRequest, GasRecommendationResponse, GetStatusRequest, LifiStep, QuoteRequest, RequestOptions, TokensRequest, TokensResponse } from '@lifi/types';
2
- import { ChainId, ChainKey, ExtendedChain, PossibilitiesRequest, PossibilitiesResponse, RoutesRequest, RoutesResponse, StatusResponse, Token, ToolsRequest, ToolsResponse } from '../types';
3
- declare const _default: {
4
- getChains: (options?: RequestOptions | undefined) => Promise<ExtendedChain[]>;
5
- getContractCallQuote: (requestConfig: ContractCallQuoteRequest, options?: RequestOptions | undefined) => Promise<LifiStep>;
6
- getGasRecommendation: ({ chainId, fromChain, fromToken }: GasRecommendationRequest, options?: RequestOptions | undefined) => Promise<GasRecommendationResponse>;
7
- getPossibilities: (requestConfig?: PossibilitiesRequest | undefined, options?: RequestOptions | undefined) => Promise<PossibilitiesResponse>;
8
- getQuote: (requestConfig: QuoteRequest, options?: RequestOptions | undefined) => Promise<LifiStep>;
9
- getRoutes: (requestConfig: RoutesRequest, options?: RequestOptions | undefined) => Promise<RoutesResponse>;
10
- getStatus: (requestConfig: GetStatusRequest, options?: RequestOptions | undefined) => Promise<StatusResponse>;
11
- getStepTransaction: (step: LifiStep, options?: RequestOptions | undefined) => Promise<LifiStep>;
12
- getToken: (chain: ChainId | ChainKey, token: string, options?: RequestOptions | undefined) => Promise<Token>;
13
- getTokens: (requestConfig?: TokensRequest | undefined, options?: RequestOptions | undefined) => Promise<TokensResponse>;
14
- getTools: (requestConfig?: ToolsRequest | undefined, options?: RequestOptions | undefined) => Promise<ToolsResponse>;
15
- getAvailableConnections: (connectionRequest: ConnectionsRequest) => Promise<ConnectionsResponse>;
16
- };
17
- export default _default;