@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,313 +0,0 @@
1
- [
2
- {
3
- "inputs": [
4
- {
5
- "components": [
6
- {
7
- "internalType": "address",
8
- "name": "target",
9
- "type": "address"
10
- },
11
- {
12
- "internalType": "bytes",
13
- "name": "callData",
14
- "type": "bytes"
15
- }
16
- ],
17
- "internalType": "struct Multicall2.Call[]",
18
- "name": "calls",
19
- "type": "tuple[]"
20
- }
21
- ],
22
- "name": "aggregate",
23
- "outputs": [
24
- {
25
- "internalType": "uint256",
26
- "name": "blockNumber",
27
- "type": "uint256"
28
- },
29
- {
30
- "internalType": "bytes[]",
31
- "name": "returnData",
32
- "type": "bytes[]"
33
- }
34
- ],
35
- "stateMutability": "view",
36
- "type": "function"
37
- },
38
- {
39
- "inputs": [
40
- {
41
- "components": [
42
- {
43
- "internalType": "address",
44
- "name": "target",
45
- "type": "address"
46
- },
47
- {
48
- "internalType": "bytes",
49
- "name": "callData",
50
- "type": "bytes"
51
- }
52
- ],
53
- "internalType": "struct Multicall2.Call[]",
54
- "name": "calls",
55
- "type": "tuple[]"
56
- }
57
- ],
58
- "name": "blockAndAggregate",
59
- "outputs": [
60
- {
61
- "internalType": "uint256",
62
- "name": "blockNumber",
63
- "type": "uint256"
64
- },
65
- {
66
- "internalType": "bytes32",
67
- "name": "blockHash",
68
- "type": "bytes32"
69
- },
70
- {
71
- "components": [
72
- {
73
- "internalType": "bool",
74
- "name": "success",
75
- "type": "bool"
76
- },
77
- {
78
- "internalType": "bytes",
79
- "name": "returnData",
80
- "type": "bytes"
81
- }
82
- ],
83
- "internalType": "struct Multicall2.Result[]",
84
- "name": "returnData",
85
- "type": "tuple[]"
86
- }
87
- ],
88
- "stateMutability": "nonpayable",
89
- "type": "function"
90
- },
91
- {
92
- "inputs": [
93
- {
94
- "internalType": "uint256",
95
- "name": "blockNumber",
96
- "type": "uint256"
97
- }
98
- ],
99
- "name": "getBlockHash",
100
- "outputs": [
101
- {
102
- "internalType": "bytes32",
103
- "name": "blockHash",
104
- "type": "bytes32"
105
- }
106
- ],
107
- "stateMutability": "view",
108
- "type": "function"
109
- },
110
- {
111
- "inputs": [],
112
- "name": "getBlockNumber",
113
- "outputs": [
114
- {
115
- "internalType": "uint256",
116
- "name": "blockNumber",
117
- "type": "uint256"
118
- }
119
- ],
120
- "stateMutability": "view",
121
- "type": "function"
122
- },
123
- {
124
- "inputs": [],
125
- "name": "getCurrentBlockCoinbase",
126
- "outputs": [
127
- {
128
- "internalType": "address",
129
- "name": "coinbase",
130
- "type": "address"
131
- }
132
- ],
133
- "stateMutability": "view",
134
- "type": "function"
135
- },
136
- {
137
- "inputs": [],
138
- "name": "getCurrentBlockDifficulty",
139
- "outputs": [
140
- {
141
- "internalType": "uint256",
142
- "name": "difficulty",
143
- "type": "uint256"
144
- }
145
- ],
146
- "stateMutability": "view",
147
- "type": "function"
148
- },
149
- {
150
- "inputs": [],
151
- "name": "getCurrentBlockGasLimit",
152
- "outputs": [
153
- {
154
- "internalType": "uint256",
155
- "name": "gaslimit",
156
- "type": "uint256"
157
- }
158
- ],
159
- "stateMutability": "view",
160
- "type": "function"
161
- },
162
- {
163
- "inputs": [],
164
- "name": "getCurrentBlockTimestamp",
165
- "outputs": [
166
- {
167
- "internalType": "uint256",
168
- "name": "timestamp",
169
- "type": "uint256"
170
- }
171
- ],
172
- "stateMutability": "view",
173
- "type": "function"
174
- },
175
- {
176
- "inputs": [
177
- {
178
- "internalType": "address",
179
- "name": "addr",
180
- "type": "address"
181
- }
182
- ],
183
- "name": "getEthBalance",
184
- "outputs": [
185
- {
186
- "internalType": "uint256",
187
- "name": "balance",
188
- "type": "uint256"
189
- }
190
- ],
191
- "stateMutability": "view",
192
- "type": "function"
193
- },
194
- {
195
- "inputs": [],
196
- "name": "getLastBlockHash",
197
- "outputs": [
198
- {
199
- "internalType": "bytes32",
200
- "name": "blockHash",
201
- "type": "bytes32"
202
- }
203
- ],
204
- "stateMutability": "view",
205
- "type": "function"
206
- },
207
- {
208
- "inputs": [
209
- {
210
- "internalType": "bool",
211
- "name": "requireSuccess",
212
- "type": "bool"
213
- },
214
- {
215
- "components": [
216
- {
217
- "internalType": "address",
218
- "name": "target",
219
- "type": "address"
220
- },
221
- {
222
- "internalType": "bytes",
223
- "name": "callData",
224
- "type": "bytes"
225
- }
226
- ],
227
- "internalType": "struct Multicall2.Call[]",
228
- "name": "calls",
229
- "type": "tuple[]"
230
- }
231
- ],
232
- "name": "tryAggregate",
233
- "outputs": [
234
- {
235
- "components": [
236
- {
237
- "internalType": "bool",
238
- "name": "success",
239
- "type": "bool"
240
- },
241
- {
242
- "internalType": "bytes",
243
- "name": "returnData",
244
- "type": "bytes"
245
- }
246
- ],
247
- "internalType": "struct Multicall2.Result[]",
248
- "name": "returnData",
249
- "type": "tuple[]"
250
- }
251
- ],
252
- "stateMutability": "view",
253
- "type": "function"
254
- },
255
- {
256
- "inputs": [
257
- {
258
- "internalType": "bool",
259
- "name": "requireSuccess",
260
- "type": "bool"
261
- },
262
- {
263
- "components": [
264
- {
265
- "internalType": "address",
266
- "name": "target",
267
- "type": "address"
268
- },
269
- {
270
- "internalType": "bytes",
271
- "name": "callData",
272
- "type": "bytes"
273
- }
274
- ],
275
- "internalType": "struct Multicall2.Call[]",
276
- "name": "calls",
277
- "type": "tuple[]"
278
- }
279
- ],
280
- "name": "tryBlockAndAggregate",
281
- "outputs": [
282
- {
283
- "internalType": "uint256",
284
- "name": "blockNumber",
285
- "type": "uint256"
286
- },
287
- {
288
- "internalType": "bytes32",
289
- "name": "blockHash",
290
- "type": "bytes32"
291
- },
292
- {
293
- "components": [
294
- {
295
- "internalType": "bool",
296
- "name": "success",
297
- "type": "bool"
298
- },
299
- {
300
- "internalType": "bytes",
301
- "name": "returnData",
302
- "type": "bytes"
303
- }
304
- ],
305
- "internalType": "struct Multicall2.Result[]",
306
- "name": "returnData",
307
- "type": "tuple[]"
308
- }
309
- ],
310
- "stateMutability": "view",
311
- "type": "function"
312
- }
313
- ]
@@ -1,3 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { Route } from '../types';
3
- export declare const handlePreRestart: (route: Route, signer: Signer) => Promise<void>;
@@ -1,52 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
- import { BigNumber } from 'ethers';
3
- import { LifiErrorCode } from './errors';
4
- export const handlePreRestart = async (route, signer) => {
5
- for (let index = 0; index < route.steps.length; index++) {
6
- const stepHasFailed = route.steps[index].execution?.status === 'FAILED';
7
- if (stepHasFailed) {
8
- await handleErrorType(route, index, signer);
9
- deleteFailedProcesses(route, index);
10
- deleteTransactionData(route, index);
11
- }
12
- }
13
- };
14
- const handleErrorType = async (route, index, signer) => {
15
- const isGasLimitError = route.steps[index].execution?.process.some((p) => p.error?.code === LifiErrorCode.GasLimitError);
16
- const isGasPriceError = route.steps[index].execution?.process.some((p) => p.error?.code === LifiErrorCode.TransactionUnderpriced);
17
- const { transactionRequest } = route.steps[index];
18
- if (isGasLimitError) {
19
- if (transactionRequest) {
20
- let gasLimit = transactionRequest.gasLimit;
21
- try {
22
- gasLimit = await signer.estimateGas(transactionRequest);
23
- }
24
- catch (error) { }
25
- if (gasLimit) {
26
- transactionRequest.gasLimit = BigNumber.from(`${(BigInt(gasLimit.toString()) * 125n) / 100n}`);
27
- }
28
- }
29
- route.steps[index].estimate.gasCosts?.forEach((gasCost) => (gasCost.limit = `${Math.round(Number(gasCost.limit) * 1.25)}`));
30
- }
31
- if (isGasPriceError) {
32
- if (transactionRequest) {
33
- let gasPrice = transactionRequest.gasPrice;
34
- try {
35
- gasPrice = await signer.getGasPrice();
36
- }
37
- catch (error) { }
38
- if (gasPrice) {
39
- transactionRequest.gasPrice = BigNumber.from(`${(BigInt(gasPrice.toString()) * 125n) / 100n}`);
40
- }
41
- }
42
- route.steps[index].estimate.gasCosts?.forEach((gasCost) => (gasCost.price = `${Math.round(Number(gasCost.price) * 1.25)}`));
43
- }
44
- };
45
- const deleteFailedProcesses = (route, index) => {
46
- if (route.steps[index].execution) {
47
- route.steps[index].execution.process = route.steps[index].execution.process.filter((process) => process.status === 'DONE');
48
- }
49
- };
50
- const deleteTransactionData = (route, index) => {
51
- route.steps[index].transactionRequest = undefined;
52
- };
@@ -1,25 +0,0 @@
1
- import { TransactionReceipt } from '@ethersproject/providers';
2
- import { LifiStep, Token } from '@lifi/types';
3
- import BigNumber from 'bignumber.js';
4
- import { Signer } from 'ethers';
5
- import { ChainId } from '../types';
6
- export declare const sleep: (mills: number) => Promise<undefined>;
7
- export declare const personalizeStep: (signer: Signer, step: LifiStep) => Promise<LifiStep>;
8
- export declare const splitListIntoChunks: <T>(list: T[], chunkSize: number) => T[][];
9
- export declare const formatTokenAmountOnly: (token: Token, amount: string | BigNumber | undefined) => string;
10
- /**
11
- * Repeatedly calls a given asynchronous function until it resolves with a value
12
- * @param toRepeat The function that should be repeated
13
- * @param timeout The timeout in milliseconds between retries, defaults to 5000
14
- * @returns The result of the toRepeat function
15
- */
16
- export declare const repeatUntilDone: <T>(toRepeat: () => Promise<T | undefined>, timeout?: number) => Promise<T>;
17
- /**
18
- * Loads a transaction receipt using the rpc for the given chain id
19
- * @param chainId The chain id where the transaction should be loaded from
20
- * @param txHash The hash of the transaction
21
- * @returns TransactionReceipt
22
- */
23
- export declare const loadTransactionReceipt: (chainId: ChainId, txHash: string) => Promise<TransactionReceipt>;
24
- export declare const isZeroAddress: (address: string) => boolean;
25
- export declare const isNativeTokenAddress: (address: string) => boolean;
@@ -1,99 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import { constants } from 'ethers';
3
- import { getRpcProvider } from '../connectors';
4
- export const sleep = (mills) => {
5
- return new Promise((resolve) => {
6
- setTimeout(resolve, mills);
7
- });
8
- };
9
- export const personalizeStep = async (signer, step) => {
10
- if (step.action.toAddress && step.action.fromAddress) {
11
- return step;
12
- }
13
- const address = await signer.getAddress();
14
- const fromAddress = step.action.fromAddress || address;
15
- const toAddress = step.action.toAddress || address;
16
- return {
17
- ...step,
18
- action: {
19
- ...step.action,
20
- fromAddress,
21
- toAddress,
22
- },
23
- };
24
- };
25
- export const splitListIntoChunks = (list, chunkSize) => list.reduce((resultList, item, index) => {
26
- const chunkIndex = Math.floor(index / chunkSize);
27
- if (!resultList[chunkIndex]) {
28
- resultList[chunkIndex] = []; // start a new chunk
29
- }
30
- resultList[chunkIndex].push(item);
31
- return resultList;
32
- }, []);
33
- export const formatTokenAmountOnly = (token, amount) => {
34
- if (!amount) {
35
- return '0.0';
36
- }
37
- let floated;
38
- if (typeof amount === 'string') {
39
- if (amount === '0') {
40
- return '0.0';
41
- }
42
- floated = new BigNumber(amount).shiftedBy(-token.decimals);
43
- }
44
- else {
45
- floated = amount;
46
- if (floated.isZero()) {
47
- return '0.0';
48
- }
49
- }
50
- // show at least 4 decimal places and at least two non-zero digests
51
- let decimalPlaces = 3;
52
- while (floated.lt(1 / 10 ** decimalPlaces)) {
53
- decimalPlaces++;
54
- }
55
- return floated.toFixed(decimalPlaces + 1, 1);
56
- };
57
- /**
58
- * Repeatedly calls a given asynchronous function until it resolves with a value
59
- * @param toRepeat The function that should be repeated
60
- * @param timeout The timeout in milliseconds between retries, defaults to 5000
61
- * @returns The result of the toRepeat function
62
- */
63
- export const repeatUntilDone = async (toRepeat, timeout = 5000) => {
64
- let result;
65
- while (!result) {
66
- result = await toRepeat();
67
- if (!result) {
68
- await sleep(timeout);
69
- }
70
- }
71
- return result;
72
- };
73
- /**
74
- * Loads a transaction receipt using the rpc for the given chain id
75
- * @param chainId The chain id where the transaction should be loaded from
76
- * @param txHash The hash of the transaction
77
- * @returns TransactionReceipt
78
- */
79
- export const loadTransactionReceipt = async (chainId, txHash) => {
80
- const rpc = await getRpcProvider(chainId);
81
- const tx = await rpc.getTransaction(txHash);
82
- return tx.wait();
83
- };
84
- export const isZeroAddress = (address) => {
85
- if (address === constants.AddressZero ||
86
- address === '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee') {
87
- return true;
88
- }
89
- return false;
90
- };
91
- export const isNativeTokenAddress = (address) => {
92
- if (address === constants.AddressZero ||
93
- address === '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' ||
94
- // CELO native token
95
- address === '0x471ece3750da237f93b8e339c536989b8978a438') {
96
- return true;
97
- }
98
- return false;
99
- };
package/dist/version.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const name = "@lifi/sdk";
2
- export declare const version = "2.3.1";
package/dist/version.js DELETED
@@ -1,2 +0,0 @@
1
- export const name = '@lifi/sdk';
2
- export const version = '2.3.1';