@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,14 +0,0 @@
1
- import { StatusManager } from '.';
2
- import { InternalExecutionSettings, LifiStep } from '../types';
3
- /**
4
- * This method checks whether the new and updated Step meets the required exchange rate conditions.
5
- * If yes it returns the updated Step.
6
- * If no and if user interaction is allowed it triggers the acceptExchangeRateUpdateHook. If no user interaction is allowed it aborts.
7
- *
8
- * @param statusManager
9
- * @param oldStep
10
- * @param newStep
11
- * @param settings
12
- * @param allowUserInteraction
13
- */
14
- export declare const stepComparison: (statusManager: StatusManager, oldStep: LifiStep, newStep: LifiStep, settings: InternalExecutionSettings, allowUserInteraction: boolean) => Promise<LifiStep>;
@@ -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,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>;
@@ -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';
@@ -1,9 +0,0 @@
1
- export declare const requestSettings: {
2
- retries: number;
3
- };
4
- interface ExtendedRequestInit extends RequestInit {
5
- retries?: number;
6
- skipTrackingHeaders?: boolean;
7
- }
8
- export declare const request: <T = Response>(url: RequestInfo | URL, options?: ExtendedRequestInit) => Promise<T>;
9
- export {};
@@ -1,11 +0,0 @@
1
- import { ChainId, ExtendedChain } from '@lifi/types';
2
- export default class ChainsService {
3
- private static instance;
4
- private readonly loadingPromise;
5
- private chains;
6
- constructor();
7
- private loadAvailableChains;
8
- static getInstance(): ChainsService;
9
- getChainById(chainId: ChainId): Promise<ExtendedChain>;
10
- getChains(): Promise<ExtendedChain[]>;
11
- }
@@ -1,23 +0,0 @@
1
- import { Chain, Config, ConfigUpdate } from '../types';
2
- export default class ConfigService {
3
- private static instance;
4
- private readonly config;
5
- private readonly setupPromise;
6
- private resolveSetupPromise;
7
- constructor();
8
- private static chainIdToObject;
9
- private static getDefaultConfig;
10
- static getInstance(): ConfigService;
11
- /**
12
- * This call immediately returns the current config. It does not make sure that all chain data is already loaded
13
- * Use this if you need access to basic information like API urls or settings
14
- */
15
- getConfig: () => Config;
16
- /**
17
- * This call waits for all setup promises to be done.
18
- * Use this if you need access to chain data (RPCs or multicalls)
19
- */
20
- getConfigAsync: () => Promise<Config>;
21
- updateConfig: (configUpdate: Partial<ConfigUpdate>) => Config;
22
- updateChains: (chains: Chain[]) => Config;
23
- }
@@ -1,22 +0,0 @@
1
- import { BaseContract, BigNumber, BigNumberish, CallOverrides, ContractTransaction, Overrides } from 'ethers';
2
- export declare const ERC20_ABI: {
3
- name: string;
4
- inputs: {
5
- internalType: string;
6
- name: string;
7
- type: string;
8
- }[];
9
- outputs: {
10
- internalType: string;
11
- name: string;
12
- type: string;
13
- }[];
14
- stateMutability: string;
15
- type: string;
16
- }[];
17
- export interface ERC20Contract extends BaseContract {
18
- allowance(owner: string, spender: string, overrides?: CallOverrides): Promise<BigNumber>;
19
- approve(spender: string, amount: BigNumberish, overrides?: Overrides & {
20
- from?: string | Promise<string>;
21
- }): Promise<ContractTransaction>;
22
- }
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ERC20_ABI = void 0;
4
- exports.ERC20_ABI = [
5
- {
6
- name: 'approve',
7
- inputs: [
8
- {
9
- internalType: 'address',
10
- name: 'spender',
11
- type: 'address',
12
- },
13
- {
14
- internalType: 'uint256',
15
- name: 'amount',
16
- type: 'uint256',
17
- },
18
- ],
19
- outputs: [
20
- {
21
- internalType: 'bool',
22
- name: '',
23
- type: 'bool',
24
- },
25
- ],
26
- stateMutability: 'nonpayable',
27
- type: 'function',
28
- },
29
- {
30
- name: 'allowance',
31
- inputs: [
32
- {
33
- internalType: 'address',
34
- name: 'owner',
35
- type: 'address',
36
- },
37
- {
38
- internalType: 'address',
39
- name: 'spender',
40
- type: 'address',
41
- },
42
- ],
43
- outputs: [
44
- {
45
- internalType: 'uint256',
46
- name: '',
47
- type: 'uint256',
48
- },
49
- ],
50
- stateMutability: 'view',
51
- type: 'function',
52
- },
53
- ];
@@ -1,4 +0,0 @@
1
- export * from '@lifi/types';
2
- export { ErrorCode, LifiError } from '../utils/errors';
3
- export * from './ERC20';
4
- export * from './internal.types';
@@ -1,151 +0,0 @@
1
- import { TransactionRequest } from '@ethersproject/abstract-provider';
2
- import { LifiStep, Route, RouteOptions, Token } from '@lifi/types';
3
- import BigNumber from 'bignumber.js';
4
- import { Signer } from 'ethers';
5
- import { ChainId } from '.';
6
- import { StatusManager } from '../execution/StatusManager';
7
- import { StepExecutor } from '../execution/StepExecutor';
8
- export interface TokenWithAmounts extends Token {
9
- amount?: BigNumber;
10
- amountRendered?: string;
11
- }
12
- export type ParsedReceipt = {
13
- fromAmount?: string;
14
- toAmount: string;
15
- gasUsed: string;
16
- gasPrice: string;
17
- gasFee: string;
18
- toTokenAddress?: string;
19
- };
20
- export interface ExecutionParams {
21
- signer: Signer;
22
- step: LifiStep;
23
- statusManager: StatusManager;
24
- settings: InternalExecutionSettings;
25
- }
26
- export type UpdateRouteHook = (updatedRoute: Route) => void;
27
- export type TransactionRequestUpdateHook = (updatedTxRequest: TransactionRequest) => Promise<TransactionRequest>;
28
- export type Config = {
29
- apiUrl: string;
30
- apiKey?: string;
31
- rpcs: Record<ChainId, string[]>;
32
- multicallAddresses: Record<ChainId, string | undefined>;
33
- defaultExecutionSettings: InternalExecutionSettings;
34
- defaultRouteOptions: RouteOptions;
35
- disableVersionCheck?: boolean;
36
- userId?: string;
37
- integrator: string;
38
- widgetVersion?: string;
39
- multisigConfig?: MultisigConfig;
40
- };
41
- export interface MultisigTxDetails {
42
- status: 'DONE' | 'FAILED' | 'PENDING' | 'CANCELLED';
43
- txHash?: string;
44
- }
45
- export interface MultisigTransactionResponse {
46
- hash: string;
47
- }
48
- export interface BaseTransaction {
49
- to: string;
50
- value: string;
51
- data: string;
52
- }
53
- export interface MultisigConfig {
54
- isMultisigSigner?: boolean;
55
- getMultisigTransactionDetails?: (txHash: string, fromChainId: number, updateIntermediateStatus?: () => void) => Promise<MultisigTxDetails>;
56
- sendBatchTransaction?: (batchTransactions: BaseTransaction[]) => Promise<MultisigTransactionResponse>;
57
- shouldBatchTransactions?: boolean;
58
- }
59
- export type ConfigUpdate = {
60
- apiUrl?: string;
61
- apiKey?: string;
62
- rpcs?: Record<number, string[]>;
63
- multicallAddresses?: Record<number, string | undefined>;
64
- defaultExecutionSettings?: ExecutionSettings;
65
- defaultRouteOptions?: RouteOptions;
66
- disableVersionCheck?: boolean;
67
- userId?: string;
68
- integrator: string;
69
- widgetVersion?: string;
70
- multisigConfig?: MultisigConfig;
71
- };
72
- export type SwitchChainHook = (requiredChainId: number) => Promise<Signer | undefined>;
73
- export interface AcceptSlippageUpdateHookParams {
74
- toToken: Token;
75
- oldToAmount: string;
76
- newToAmount: string;
77
- oldSlippage: number;
78
- newSlippage: number;
79
- }
80
- export type AcceptSlippageUpdateHook = (params: AcceptSlippageUpdateHookParams) => Promise<boolean | undefined>;
81
- export interface ExchangeRateUpdateParams {
82
- toToken: Token;
83
- oldToAmount: string;
84
- newToAmount: string;
85
- }
86
- export type AcceptExchangeRateUpdateHook = (params: ExchangeRateUpdateParams) => Promise<boolean | undefined>;
87
- export interface RouteExecutionData {
88
- route: Route;
89
- executors: StepExecutor[];
90
- settings: InternalExecutionSettings;
91
- }
92
- export type ExecutionSettings = Partial<InternalExecutionSettings>;
93
- export interface InternalExecutionSettings {
94
- acceptExchangeRateUpdateHook: AcceptExchangeRateUpdateHook;
95
- switchChainHook: SwitchChainHook;
96
- updateRouteHook: UpdateRouteHook;
97
- updateTransactionRequestHook?: TransactionRequestUpdateHook;
98
- executeInBackground: boolean;
99
- infiniteApproval: boolean;
100
- }
101
- export type RouteExecutionDictionary = Partial<Record<string, RouteExecutionData>>;
102
- export type RouteExecutionPromiseDictionary = Partial<Record<string, Promise<Route>>>;
103
- export type RevokeTokenData = {
104
- token: Token;
105
- approvalAddress: string;
106
- };
107
- export interface InteractionSettings {
108
- allowInteraction?: boolean;
109
- allowUpdates?: boolean;
110
- stopExecution?: boolean;
111
- }
112
- export interface TenderlyResponse {
113
- hash: string;
114
- block_hash: string;
115
- block_number: number;
116
- from: string;
117
- gas: number;
118
- gas_price: number;
119
- gas_fee_cap: number;
120
- gas_tip_cap: number;
121
- cumulative_gas_used: number;
122
- gas_used: number;
123
- effective_gas_price: number;
124
- input: string;
125
- nonce: number;
126
- to: string;
127
- index: number;
128
- value: string;
129
- access_list: any;
130
- status: boolean;
131
- addresses: string[];
132
- contract_ids: string[];
133
- network_id: string;
134
- timestamp: string;
135
- function_selector: string;
136
- l1_block_number: number;
137
- l1_timestamp: number;
138
- deposit_tx: boolean;
139
- system_tx: boolean;
140
- mint: number;
141
- sig: Signature;
142
- error_message: string;
143
- method: string;
144
- decoded_input: any;
145
- call_trace: any;
146
- }
147
- export interface Signature {
148
- v: string;
149
- r: string;
150
- s: string;
151
- }
@@ -1,3 +0,0 @@
1
- import { Provider } from '@ethersproject/abstract-provider';
2
- import { Signer } from 'ethers';
3
- export declare const getProvider: (signer: Signer) => Provider;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProvider = void 0;
4
- const errors_1 = require("./errors");
5
- const getProvider = (signer) => {
6
- if (!signer.provider) {
7
- throw new errors_1.ProviderError(errors_1.LifiErrorCode.ProviderUnavailable, 'No provider available in signer.');
8
- }
9
- return signer.provider;
10
- };
11
- exports.getProvider = getProvider;
@@ -1,10 +0,0 @@
1
- import { Fragment, JsonFragment } from '@ethersproject/abi';
2
- export type MultiCallData = {
3
- address: string;
4
- name: string;
5
- params?: any[];
6
- };
7
- export declare const fetchDataUsingMulticall: (calls: Array<MultiCallData>, abi: ReadonlyArray<Fragment | JsonFragment | string>, chainId: number, multicallAddress: string, requireSuccess?: boolean) => Promise<{
8
- data: unknown;
9
- blockNumber: number;
10
- }[]>;
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fetchDataUsingMulticall = void 0;
7
- const abi_1 = require("@ethersproject/abi");
8
- const contracts_1 = require("@ethersproject/contracts");
9
- const connectors_1 = require("../connectors");
10
- const utils_1 = require("./utils");
11
- const multicallAbi_json_1 = __importDefault(require("./multicallAbi.json"));
12
- const MAX_MULTICALL_SIZE = 100;
13
- const fetchDataUsingMulticall = async (calls, abi, chainId, multicallAddress, requireSuccess = false) => {
14
- // 1. create contract using multicall contract address and abi...
15
- const provider = await (0, connectors_1.getRpcProvider)(chainId);
16
- const multicallContract = new contracts_1.Contract(multicallAddress, multicallAbi_json_1.default, provider);
17
- const abiInterface = new abi_1.Interface(abi);
18
- // split up lists into chunks to stay below multicall limit
19
- const chunkedList = (0, utils_1.splitListIntoChunks)(calls, MAX_MULTICALL_SIZE);
20
- const chunkedResults = await Promise.all(chunkedList.map(async (chunkedCalls) => {
21
- const callData = chunkedCalls.map((call) => [
22
- call.address.toLowerCase(),
23
- abiInterface.encodeFunctionData(call.name, call.params),
24
- ]);
25
- try {
26
- // 3. get bytes array from multicall contract by process aggregate method...
27
- const { blockNumber, returnData } = await multicallContract.tryBlockAndAggregate(requireSuccess, callData);
28
- // 4. decode bytes array to useful data array...
29
- return returnData
30
- .map(({ success, returnData }, i) => {
31
- if (!success) {
32
- // requested function failed
33
- console.error(`Multicall unsuccessful for address "${chunkedCalls[i].address}", ` +
34
- `function "${chunkedCalls[i].name}", chainId "${chainId}"`);
35
- return [];
36
- }
37
- if (returnData.toString() === '0x') {
38
- // requested function does probably not exist
39
- console.error(`Multicall no response for address "${chunkedCalls[i].address}", ` +
40
- `function "${chunkedCalls[i].name}", chainId "${chainId}"`);
41
- return [];
42
- }
43
- try {
44
- return abiInterface.decodeFunctionResult(chunkedCalls[i].name, returnData);
45
- }
46
- catch (e) {
47
- // requested function returns other data than expected
48
- console.error(`Multicall parsing unsuccessful for address "${chunkedCalls[i].address}", ` +
49
- `function "${chunkedCalls[i].name}", chainId "${chainId}"`);
50
- return [];
51
- }
52
- })
53
- .map((data) => {
54
- return {
55
- data: data[0],
56
- blockNumber: blockNumber.toNumber(),
57
- };
58
- });
59
- }
60
- catch (e) {
61
- // whole rpc call failed, probably an rpc issue
62
- console.error(`Multicall failed on chainId "${chainId}"`, chunkedList, e);
63
- return [];
64
- }
65
- }));
66
- return chunkedResults.flat();
67
- };
68
- exports.fetchDataUsingMulticall = fetchDataUsingMulticall;