@lifi/sdk 4.0.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/actions/getChains.d.ts +7 -8
  3. package/dist/cjs/actions/getConnections.d.ts +6 -7
  4. package/dist/cjs/actions/getContractCallsQuote.d.ts +7 -8
  5. package/dist/cjs/actions/getGasRecommendation.d.ts +7 -8
  6. package/dist/cjs/actions/getNameServiceAddress.d.ts +6 -7
  7. package/dist/cjs/actions/getQuote.d.ts +7 -8
  8. package/dist/cjs/actions/getQuote.js +2 -1
  9. package/dist/cjs/actions/getQuote.js.map +1 -1
  10. package/dist/cjs/actions/getRelayedTransactionStatus.d.ts +7 -8
  11. package/dist/cjs/actions/getRelayerQuote.d.ts +7 -8
  12. package/dist/cjs/actions/getRoutes.d.ts +10 -10
  13. package/dist/cjs/actions/getRoutes.js.map +1 -1
  14. package/dist/cjs/actions/getStatus.d.ts +7 -8
  15. package/dist/cjs/actions/getStepTransaction.d.ts +10 -10
  16. package/dist/cjs/actions/getStepTransaction.js +2 -0
  17. package/dist/cjs/actions/getStepTransaction.js.map +1 -1
  18. package/dist/cjs/actions/getToken.d.ts +8 -9
  19. package/dist/cjs/actions/getTokenBalance.d.ts +8 -9
  20. package/dist/cjs/actions/getTokenBalances.d.ts +8 -9
  21. package/dist/cjs/actions/getTokenBalancesByChain.d.ts +8 -9
  22. package/dist/cjs/actions/getTokenBalancesByChain.js +4 -2
  23. package/dist/cjs/actions/getTokenBalancesByChain.js.map +1 -1
  24. package/dist/cjs/actions/getTokens.d.ts +6 -7
  25. package/dist/cjs/actions/getTools.d.ts +6 -7
  26. package/dist/cjs/actions/getTransactionHistory.d.ts +13 -19
  27. package/dist/cjs/actions/getWalletBalances.d.ts +7 -8
  28. package/dist/cjs/actions/index.d.ts +115 -113
  29. package/dist/cjs/actions/index.js.map +1 -1
  30. package/dist/cjs/actions/patchContractCalls.d.ts +0 -1
  31. package/dist/cjs/actions/relayTransaction.d.ts +7 -8
  32. package/dist/cjs/client/createClient.d.ts +0 -1
  33. package/dist/cjs/client/getClientStorage.d.ts +0 -1
  34. package/dist/cjs/core/BaseStepExecutionTask.d.ts +0 -1
  35. package/dist/cjs/core/BaseStepExecutor.d.ts +0 -1
  36. package/dist/cjs/core/StatusManager.d.ts +40 -51
  37. package/dist/cjs/core/TaskPipeline.d.ts +0 -1
  38. package/dist/cjs/core/actionMessages.d.ts +0 -1
  39. package/dist/cjs/core/execution.d.ts +29 -30
  40. package/dist/cjs/core/executionState.d.ts +0 -1
  41. package/dist/cjs/core/prepareRestart.d.ts +0 -1
  42. package/dist/cjs/core/tasks/CheckBalanceTask.d.ts +6 -7
  43. package/dist/cjs/core/tasks/PrepareTransactionTask.d.ts +0 -1
  44. package/dist/cjs/core/tasks/WaitForTransactionStatusTask.d.ts +0 -1
  45. package/dist/cjs/core/tasks/helpers/checkBalance.d.ts +17 -18
  46. package/dist/cjs/core/tasks/helpers/getTransactionRequestData.d.ts +0 -1
  47. package/dist/cjs/core/tasks/helpers/stepComparison.d.ts +11 -12
  48. package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.d.ts +0 -1
  49. package/dist/cjs/core/utils.d.ts +7 -8
  50. package/dist/cjs/errors/SDKError.d.ts +0 -1
  51. package/dist/cjs/errors/baseError.d.ts +0 -1
  52. package/dist/cjs/errors/errors.d.ts +4 -5
  53. package/dist/cjs/errors/httpError.d.ts +0 -1
  54. package/dist/cjs/errors/httpError.js +1 -1
  55. package/dist/cjs/errors/httpError.js.map +1 -1
  56. package/dist/cjs/errors/utils/baseErrorRootCause.d.ts +0 -1
  57. package/dist/cjs/index.d.ts +2 -1
  58. package/dist/cjs/types/actions.d.ts +23 -3
  59. package/dist/cjs/types/core.d.ts +3 -4
  60. package/dist/cjs/types/execution.d.ts +0 -1
  61. package/dist/cjs/utils/checkPackageUpdates.js +1 -1
  62. package/dist/cjs/utils/convertQuoteToRoute.d.ts +9 -10
  63. package/dist/cjs/utils/formatUnits.d.ts +2 -2
  64. package/dist/cjs/utils/getTransactionMessage.d.ts +0 -1
  65. package/dist/cjs/utils/isHex.d.ts +1 -3
  66. package/dist/cjs/utils/isRoutesRequest.d.ts +0 -1
  67. package/dist/cjs/utils/isStep.d.ts +0 -1
  68. package/dist/cjs/utils/isStep.js +2 -1
  69. package/dist/cjs/utils/isStep.js.map +1 -1
  70. package/dist/cjs/utils/isToken.d.ts +0 -1
  71. package/dist/cjs/utils/parseUnits.d.ts +2 -2
  72. package/dist/cjs/utils/request.d.ts +0 -1
  73. package/dist/cjs/utils/toQueryString.d.ts +5 -0
  74. package/dist/cjs/utils/toQueryString.js +17 -0
  75. package/dist/cjs/utils/toQueryString.js.map +1 -0
  76. package/dist/cjs/utils/waitForResult.d.ts +8 -8
  77. package/dist/cjs/utils/withDedupe.d.ts +5 -8
  78. package/dist/cjs/utils/withTimeout.d.ts +10 -16
  79. package/dist/cjs/version.d.ts +1 -1
  80. package/dist/cjs/version.js +1 -1
  81. package/dist/cjs/version.js.map +1 -1
  82. package/dist/esm/actions/getChains.d.ts +7 -8
  83. package/dist/esm/actions/getChains.d.ts.map +1 -1
  84. package/dist/esm/actions/getConnections.d.ts +6 -7
  85. package/dist/esm/actions/getConnections.d.ts.map +1 -1
  86. package/dist/esm/actions/getContractCallsQuote.d.ts +7 -8
  87. package/dist/esm/actions/getContractCallsQuote.d.ts.map +1 -1
  88. package/dist/esm/actions/getGasRecommendation.d.ts +7 -8
  89. package/dist/esm/actions/getGasRecommendation.d.ts.map +1 -1
  90. package/dist/esm/actions/getNameServiceAddress.d.ts +6 -7
  91. package/dist/esm/actions/getNameServiceAddress.d.ts.map +1 -1
  92. package/dist/esm/actions/getQuote.d.ts +7 -8
  93. package/dist/esm/actions/getQuote.d.ts.map +1 -1
  94. package/dist/esm/actions/getQuote.js +2 -1
  95. package/dist/esm/actions/getQuote.js.map +1 -1
  96. package/dist/esm/actions/getRelayedTransactionStatus.d.ts +7 -8
  97. package/dist/esm/actions/getRelayedTransactionStatus.d.ts.map +1 -1
  98. package/dist/esm/actions/getRelayerQuote.d.ts +7 -8
  99. package/dist/esm/actions/getRelayerQuote.d.ts.map +1 -1
  100. package/dist/esm/actions/getRoutes.d.ts +10 -10
  101. package/dist/esm/actions/getRoutes.d.ts.map +1 -1
  102. package/dist/esm/actions/getRoutes.js.map +1 -1
  103. package/dist/esm/actions/getStatus.d.ts +7 -8
  104. package/dist/esm/actions/getStatus.d.ts.map +1 -1
  105. package/dist/esm/actions/getStepTransaction.d.ts +10 -10
  106. package/dist/esm/actions/getStepTransaction.d.ts.map +1 -1
  107. package/dist/esm/actions/getStepTransaction.js +2 -0
  108. package/dist/esm/actions/getStepTransaction.js.map +1 -1
  109. package/dist/esm/actions/getToken.d.ts +8 -9
  110. package/dist/esm/actions/getToken.d.ts.map +1 -1
  111. package/dist/esm/actions/getTokenBalance.d.ts +8 -9
  112. package/dist/esm/actions/getTokenBalance.d.ts.map +1 -1
  113. package/dist/esm/actions/getTokenBalances.d.ts +8 -9
  114. package/dist/esm/actions/getTokenBalances.d.ts.map +1 -1
  115. package/dist/esm/actions/getTokenBalancesByChain.d.ts +8 -9
  116. package/dist/esm/actions/getTokenBalancesByChain.d.ts.map +1 -1
  117. package/dist/esm/actions/getTokenBalancesByChain.js +4 -2
  118. package/dist/esm/actions/getTokenBalancesByChain.js.map +1 -1
  119. package/dist/esm/actions/getTokens.d.ts +6 -7
  120. package/dist/esm/actions/getTokens.d.ts.map +1 -1
  121. package/dist/esm/actions/getTools.d.ts +6 -7
  122. package/dist/esm/actions/getTools.d.ts.map +1 -1
  123. package/dist/esm/actions/getTransactionHistory.d.ts +13 -19
  124. package/dist/esm/actions/getTransactionHistory.d.ts.map +1 -1
  125. package/dist/esm/actions/getWalletBalances.d.ts +7 -8
  126. package/dist/esm/actions/getWalletBalances.d.ts.map +1 -1
  127. package/dist/esm/actions/index.d.ts +115 -113
  128. package/dist/esm/actions/index.d.ts.map +1 -1
  129. package/dist/esm/actions/index.js.map +1 -1
  130. package/dist/esm/actions/patchContractCalls.d.ts +0 -1
  131. package/dist/esm/actions/patchContractCalls.d.ts.map +1 -1
  132. package/dist/esm/actions/relayTransaction.d.ts +7 -8
  133. package/dist/esm/actions/relayTransaction.d.ts.map +1 -1
  134. package/dist/esm/client/createClient.d.ts +0 -1
  135. package/dist/esm/client/createClient.d.ts.map +1 -1
  136. package/dist/esm/client/getClientStorage.d.ts +0 -1
  137. package/dist/esm/client/getClientStorage.d.ts.map +1 -1
  138. package/dist/esm/core/BaseStepExecutionTask.d.ts +0 -1
  139. package/dist/esm/core/BaseStepExecutionTask.d.ts.map +1 -1
  140. package/dist/esm/core/BaseStepExecutor.d.ts +0 -1
  141. package/dist/esm/core/BaseStepExecutor.d.ts.map +1 -1
  142. package/dist/esm/core/StatusManager.d.ts +40 -51
  143. package/dist/esm/core/StatusManager.d.ts.map +1 -1
  144. package/dist/esm/core/TaskPipeline.d.ts +0 -1
  145. package/dist/esm/core/TaskPipeline.d.ts.map +1 -1
  146. package/dist/esm/core/actionMessages.d.ts +0 -1
  147. package/dist/esm/core/actionMessages.d.ts.map +1 -1
  148. package/dist/esm/core/execution.d.ts +29 -30
  149. package/dist/esm/core/execution.d.ts.map +1 -1
  150. package/dist/esm/core/executionState.d.ts +0 -1
  151. package/dist/esm/core/executionState.d.ts.map +1 -1
  152. package/dist/esm/core/prepareRestart.d.ts +0 -1
  153. package/dist/esm/core/prepareRestart.d.ts.map +1 -1
  154. package/dist/esm/core/storage.d.ts.map +1 -1
  155. package/dist/esm/core/tasks/CheckBalanceTask.d.ts +6 -7
  156. package/dist/esm/core/tasks/CheckBalanceTask.d.ts.map +1 -1
  157. package/dist/esm/core/tasks/PrepareTransactionTask.d.ts +0 -1
  158. package/dist/esm/core/tasks/PrepareTransactionTask.d.ts.map +1 -1
  159. package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts +0 -1
  160. package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts.map +1 -1
  161. package/dist/esm/core/tasks/helpers/checkBalance.d.ts +17 -18
  162. package/dist/esm/core/tasks/helpers/checkBalance.d.ts.map +1 -1
  163. package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts +0 -1
  164. package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts.map +1 -1
  165. package/dist/esm/core/tasks/helpers/stepComparison.d.ts +11 -12
  166. package/dist/esm/core/tasks/helpers/stepComparison.d.ts.map +1 -1
  167. package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts +0 -1
  168. package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts.map +1 -1
  169. package/dist/esm/core/utils.d.ts +7 -8
  170. package/dist/esm/core/utils.d.ts.map +1 -1
  171. package/dist/esm/errors/SDKError.d.ts +0 -1
  172. package/dist/esm/errors/SDKError.d.ts.map +1 -1
  173. package/dist/esm/errors/baseError.d.ts +0 -1
  174. package/dist/esm/errors/baseError.d.ts.map +1 -1
  175. package/dist/esm/errors/constants.d.ts.map +1 -1
  176. package/dist/esm/errors/errors.d.ts +4 -5
  177. package/dist/esm/errors/errors.d.ts.map +1 -1
  178. package/dist/esm/errors/httpError.d.ts +0 -1
  179. package/dist/esm/errors/httpError.d.ts.map +1 -1
  180. package/dist/esm/errors/httpError.js +1 -1
  181. package/dist/esm/errors/httpError.js.map +1 -1
  182. package/dist/esm/errors/utils/baseErrorRootCause.d.ts +0 -1
  183. package/dist/esm/errors/utils/baseErrorRootCause.d.ts.map +1 -1
  184. package/dist/esm/errors/utils/rootCause.d.ts.map +1 -1
  185. package/dist/esm/index.d.ts +2 -1
  186. package/dist/esm/types/actions.d.ts +23 -3
  187. package/dist/esm/types/actions.d.ts.map +1 -1
  188. package/dist/esm/types/core.d.ts +3 -4
  189. package/dist/esm/types/core.d.ts.map +1 -1
  190. package/dist/esm/types/execution.d.ts +0 -1
  191. package/dist/esm/types/execution.d.ts.map +1 -1
  192. package/dist/esm/types/request.d.ts.map +1 -1
  193. package/dist/esm/utils/checkPackageUpdates.d.ts.map +1 -1
  194. package/dist/esm/utils/checkPackageUpdates.js +1 -1
  195. package/dist/esm/utils/convertQuoteToRoute.d.ts +9 -10
  196. package/dist/esm/utils/convertQuoteToRoute.d.ts.map +1 -1
  197. package/dist/esm/utils/decode.d.ts.map +1 -1
  198. package/dist/esm/utils/fetchTxErrorDetails.d.ts.map +1 -1
  199. package/dist/esm/utils/formatUnits.d.ts +2 -2
  200. package/dist/esm/utils/formatUnits.d.ts.map +1 -1
  201. package/dist/esm/utils/getTransactionMessage.d.ts +0 -1
  202. package/dist/esm/utils/getTransactionMessage.d.ts.map +1 -1
  203. package/dist/esm/utils/isHex.d.ts +1 -3
  204. package/dist/esm/utils/isHex.d.ts.map +1 -1
  205. package/dist/esm/utils/isRoutesRequest.d.ts +0 -1
  206. package/dist/esm/utils/isRoutesRequest.d.ts.map +1 -1
  207. package/dist/esm/utils/isStep.d.ts +0 -1
  208. package/dist/esm/utils/isStep.d.ts.map +1 -1
  209. package/dist/esm/utils/isStep.js +2 -1
  210. package/dist/esm/utils/isStep.js.map +1 -1
  211. package/dist/esm/utils/isToken.d.ts +0 -1
  212. package/dist/esm/utils/isToken.d.ts.map +1 -1
  213. package/dist/esm/utils/parseUnits.d.ts +2 -2
  214. package/dist/esm/utils/parseUnits.d.ts.map +1 -1
  215. package/dist/esm/utils/request.d.ts +0 -1
  216. package/dist/esm/utils/request.d.ts.map +1 -1
  217. package/dist/esm/utils/sleep.d.ts.map +1 -1
  218. package/dist/esm/utils/toQueryString.d.ts +5 -0
  219. package/dist/esm/utils/toQueryString.d.ts.map +1 -0
  220. package/dist/esm/utils/toQueryString.js +16 -0
  221. package/dist/esm/utils/toQueryString.js.map +1 -0
  222. package/dist/esm/utils/waitForResult.d.ts +8 -8
  223. package/dist/esm/utils/waitForResult.d.ts.map +1 -1
  224. package/dist/esm/utils/withDedupe.d.ts +5 -8
  225. package/dist/esm/utils/withDedupe.d.ts.map +1 -1
  226. package/dist/esm/utils/withTimeout.d.ts +10 -16
  227. package/dist/esm/utils/withTimeout.d.ts.map +1 -1
  228. package/dist/esm/version.d.ts +1 -1
  229. package/dist/esm/version.d.ts.map +1 -1
  230. package/dist/esm/version.js +1 -1
  231. package/dist/esm/version.js.map +1 -1
  232. package/package.json +1 -1
  233. package/src/actions/getQuote.ts +3 -2
  234. package/src/actions/getRoutes.ts +2 -1
  235. package/src/actions/getStepTransaction.ts +7 -2
  236. package/src/actions/index.ts +8 -5
  237. package/src/index.ts +7 -0
  238. package/src/types/actions.ts +29 -0
  239. package/src/utils/isStep.ts +4 -1
  240. package/src/utils/toQueryString.ts +35 -0
  241. package/src/version.ts +1 -1
@@ -1,47 +1,46 @@
1
1
  import { ExecutionOptions, RouteExtended, SDKClient } from "../types/core.js";
2
2
  import { Route } from "@lifi/types";
3
-
4
3
  //#region src/core/execution.d.ts
5
4
  /**
6
- * Execute a route.
7
- * @param client - The SDK client.
8
- * @param route - The route that should be executed. Cannot be an active route.
9
- * @param executionOptions - An object containing settings and callbacks.
10
- * @returns The executed route.
11
- * @throws {LiFiError} Throws a LiFiError if the execution fails.
12
- */
5
+ * Execute a route.
6
+ * @param client - The SDK client.
7
+ * @param route - The route that should be executed. Cannot be an active route.
8
+ * @param executionOptions - An object containing settings and callbacks.
9
+ * @returns The executed route.
10
+ * @throws {LiFiError} Throws a LiFiError if the execution fails.
11
+ */
13
12
  declare const executeRoute: (client: SDKClient, route: Route, executionOptions?: ExecutionOptions) => Promise<RouteExtended>;
14
13
  /**
15
- * Resume the execution of a route that has been stopped or had an error while executing.
16
- * @param client - The SDK client.
17
- * @param route - The route that is to be executed. Cannot be an active route.
18
- * @param executionOptions - An object containing settings and callbacks.
19
- * @returns The executed route.
20
- * @throws {LiFiError} Throws a LiFiError if the execution fails.
21
- */
14
+ * Resume the execution of a route that has been stopped or had an error while executing.
15
+ * @param client - The SDK client.
16
+ * @param route - The route that is to be executed. Cannot be an active route.
17
+ * @param executionOptions - An object containing settings and callbacks.
18
+ * @returns The executed route.
19
+ * @throws {LiFiError} Throws a LiFiError if the execution fails.
20
+ */
22
21
  declare const resumeRoute: (client: SDKClient, route: Route, executionOptions?: ExecutionOptions) => Promise<RouteExtended>;
23
22
  /**
24
- * Updates route execution to background or foreground state.
25
- * @param route - A route that is currently in execution.
26
- * @param options - An object with execution settings.
27
- */
23
+ * Updates route execution to background or foreground state.
24
+ * @param route - A route that is currently in execution.
25
+ * @param options - An object with execution settings.
26
+ */
28
27
  declare const updateRouteExecution: (route: Route, options: ExecutionOptions) => void;
29
28
  /**
30
- * Stops the execution of an active route.
31
- * @param route - A route that is currently in execution.
32
- * @returns The stopped route.
33
- */
29
+ * Stops the execution of an active route.
30
+ * @param route - A route that is currently in execution.
31
+ * @returns The stopped route.
32
+ */
34
33
  declare const stopRouteExecution: (route: Route) => Route;
35
34
  /**
36
- * Get the list of active routes.
37
- * @returns A list of routes.
38
- */
35
+ * Get the list of active routes.
36
+ * @returns A list of routes.
37
+ */
39
38
  declare const getActiveRoutes: () => RouteExtended[];
40
39
  /**
41
- * Return the current route information for given route. The route has to be active.
42
- * @param routeId - A route id.
43
- * @returns The updated route.
44
- */
40
+ * Return the current route information for given route. The route has to be active.
41
+ * @param routeId - A route id.
42
+ * @returns The updated route.
43
+ */
45
44
  declare const getActiveRoute: (routeId: string) => RouteExtended | undefined;
46
45
  //#endregion
47
46
  export { executeRoute, getActiveRoute, getActiveRoutes, resumeRoute, stopRouteExecution, updateRouteExecution };
@@ -1,5 +1,4 @@
1
1
  import { ExecutionOptions, RouteExtended, StepExecutor } from "../types/core.js";
2
-
3
2
  //#region src/core/executionState.d.ts
4
3
  interface ExecutionData {
5
4
  route: RouteExtended;
@@ -1,5 +1,4 @@
1
1
  import { RouteExtended } from "../types/core.js";
2
-
3
2
  //#region src/core/prepareRestart.d.ts
4
3
  declare const prepareRestart: (route: RouteExtended) => void;
5
4
  //#endregion
@@ -1,16 +1,15 @@
1
1
  import { StepExecutorContext, TaskResult } from "../../types/execution.js";
2
2
  import { BaseStepExecutionTask } from "../BaseStepExecutionTask.js";
3
3
  import { CheckBalanceOptions } from "./helpers/checkBalance.js";
4
-
5
4
  //#region src/core/tasks/CheckBalanceTask.d.ts
6
5
  declare class CheckBalanceTask extends BaseStepExecutionTask {
7
6
  /**
8
- * Per-step options hook for chain-specific subclasses (e.g. skip the
9
- * gas check for smart-contract wallets or relayed steps). Default `{}`
10
- * keeps behavior unchanged for every provider that doesn't override.
11
- * Resolved lazily inside `run()` — pipelines that resume past
12
- * `CheckBalance` pay no cost.
13
- */
7
+ * Per-step options hook for chain-specific subclasses (e.g. skip the
8
+ * gas check for smart-contract wallets or relayed steps). Default `{}`
9
+ * keeps behavior unchanged for every provider that doesn't override.
10
+ * Resolved lazily inside `run()` — pipelines that resume past
11
+ * `CheckBalance` pay no cost.
12
+ */
14
13
  protected getCheckBalanceOptions(_context: StepExecutorContext): Promise<CheckBalanceOptions>;
15
14
  run(context: StepExecutorContext): Promise<TaskResult>;
16
15
  }
@@ -1,6 +1,5 @@
1
1
  import { StepExecutorContext, TaskResult } from "../../types/execution.js";
2
2
  import { BaseStepExecutionTask } from "../BaseStepExecutionTask.js";
3
-
4
3
  //#region src/core/tasks/PrepareTransactionTask.d.ts
5
4
  declare class PrepareTransactionTask extends BaseStepExecutionTask {
6
5
  run(context: StepExecutorContext): Promise<TaskResult>;
@@ -1,7 +1,6 @@
1
1
  import { ExecutionActionType } from "../../types/core.js";
2
2
  import { StepExecutorContext, TaskResult } from "../../types/execution.js";
3
3
  import { BaseStepExecutionTask } from "../BaseStepExecutionTask.js";
4
-
5
4
  //#region src/core/tasks/WaitForTransactionStatusTask.d.ts
6
5
  declare class WaitForTransactionStatusTask extends BaseStepExecutionTask {
7
6
  readonly actionType: ExecutionActionType;
@@ -1,29 +1,28 @@
1
1
  import { SDKClient } from "../../../types/core.js";
2
2
  import { LiFiStep } from "@lifi/types";
3
-
4
3
  //#region src/core/tasks/helpers/checkBalance.d.ts
5
4
  type CheckBalanceOptions = {
6
5
  /**
7
- * Set to `false` when outer-tx gas is paid by something other than
8
- * `walletAddress` (SCA executor, 4337 bundler / paymaster, relayer):
9
- * `gasPart` is excluded from the sufficiency check and slippage rescue.
10
- * Source amount and non-included fees (e.g. LZ `msg.value`) are still
11
- * verified. Defaults to `true` (strict, today's behavior).
12
- */
6
+ * Set to `false` when outer-tx gas is paid by something other than
7
+ * `walletAddress` (SCA executor, 4337 bundler / paymaster, relayer):
8
+ * `gasPart` is excluded from the sufficiency check and slippage rescue.
9
+ * Source amount and non-included fees (e.g. LZ `msg.value`) are still
10
+ * verified. Defaults to `true` (strict, today's behavior).
11
+ */
13
12
  walletPaysGas?: boolean;
14
13
  };
15
14
  /**
16
- * Verifies that the wallet holds enough of every token required to execute
17
- * the step on its source chain — the source-token amount, any gas costs, and
18
- * any non-included fee costs. Reads all balances in one batched provider
19
- * call, retries within a bounded budget to absorb transient RPC failures and
20
- * post-confirmation propagation lag, and applies slippage to the source-token
21
- * portion only as a last resort (overhead is never trimmed).
22
- *
23
- * Throws BalanceError("The balance is too low.") on a genuine shortfall, or
24
- * BalanceError("Could not read wallet balance.") if the balance can't be read
25
- * after retries.
26
- */
15
+ * Verifies that the wallet holds enough of every token required to execute
16
+ * the step on its source chain — the source-token amount, any gas costs, and
17
+ * any non-included fee costs. Reads all balances in one batched provider
18
+ * call, retries within a bounded budget to absorb transient RPC failures and
19
+ * post-confirmation propagation lag, and applies slippage to the source-token
20
+ * portion only as a last resort (overhead is never trimmed).
21
+ *
22
+ * Throws BalanceError("The balance is too low.") on a genuine shortfall, or
23
+ * BalanceError("Could not read wallet balance.") if the balance can't be read
24
+ * after retries.
25
+ */
27
26
  declare const checkBalance: (client: SDKClient, walletAddress: string, step: LiFiStep, options?: CheckBalanceOptions) => Promise<void>;
28
27
  //#endregion
29
28
  export { CheckBalanceOptions, checkBalance };
@@ -1,5 +1,4 @@
1
1
  import { ExecutionOptions, LiFiStepExtended } from "../../../types/core.js";
2
-
3
2
  //#region src/core/tasks/helpers/getTransactionRequestData.d.ts
4
3
  declare const getTransactionRequestData: (step: LiFiStepExtended, executionOptions?: ExecutionOptions) => Promise<string>;
5
4
  //#endregion
@@ -1,20 +1,19 @@
1
1
  import { ExecutionOptions } from "../../../types/core.js";
2
2
  import { StatusManager } from "../../StatusManager.js";
3
3
  import { LiFiStep } from "@lifi/types";
4
-
5
4
  //#region src/core/tasks/helpers/stepComparison.d.ts
6
5
  /**
7
- * This method checks whether the new and updated Step meets the required exchange rate conditions.
8
- * If yes it returns the updated Step.
9
- * If no and if user interaction is allowed it triggers the acceptExchangeRateUpdateHook. If no user interaction is allowed it aborts.
10
- * @param statusManager
11
- * @param oldStep
12
- * @param newStep
13
- * @param settings
14
- * @param allowUserInteraction
15
- * @param executionOptions
16
- * @returns Return LiFiStep
17
- */
6
+ * This method checks whether the new and updated Step meets the required exchange rate conditions.
7
+ * If yes it returns the updated Step.
8
+ * If no and if user interaction is allowed it triggers the acceptExchangeRateUpdateHook. If no user interaction is allowed it aborts.
9
+ * @param statusManager
10
+ * @param oldStep
11
+ * @param newStep
12
+ * @param settings
13
+ * @param allowUserInteraction
14
+ * @param executionOptions
15
+ * @returns Return LiFiStep
16
+ */
18
17
  declare const stepComparison: (statusManager: StatusManager, oldStep: LiFiStep, newStep: LiFiStep, allowUserInteraction: boolean, executionOptions?: ExecutionOptions) => Promise<LiFiStep>;
19
18
  //#endregion
20
19
  export { stepComparison };
@@ -1,7 +1,6 @@
1
1
  import { ExecutionActionType, SDKClient } from "../../../types/core.js";
2
2
  import { StatusManager } from "../../StatusManager.js";
3
3
  import { LiFiStep, StatusResponse } from "@lifi/types";
4
-
5
4
  //#region src/core/tasks/helpers/waitForTransactionStatus.d.ts
6
5
  declare function waitForTransactionStatus(client: SDKClient, statusManager: StatusManager, txHash: string, step: LiFiStep, actionType: ExecutionActionType, interval?: number): Promise<StatusResponse>;
7
6
  //#endregion
@@ -1,15 +1,14 @@
1
1
  import { RPCUrls } from "../types/core.js";
2
2
  import { ChainId, ExtendedChain, LiFiStep } from "@lifi/types";
3
-
4
3
  //#region src/core/utils.d.ts
5
4
  /**
6
- * Used to check if changed exchange rate is in the range of slippage threshold.
7
- * We use a slippage value as a threshold to trigger the rate change hook.
8
- * This can result in almost doubled slippage for the user and need to be revisited.
9
- * @param oldStep - old step
10
- * @param newStep - new step
11
- * @returns Boolean
12
- */
5
+ * Used to check if changed exchange rate is in the range of slippage threshold.
6
+ * We use a slippage value as a threshold to trigger the rate change hook.
7
+ * This can result in almost doubled slippage for the user and need to be revisited.
8
+ * @param oldStep - old step
9
+ * @param newStep - new step
10
+ * @returns Boolean
11
+ */
13
12
  declare function checkStepSlippageThreshold(oldStep: LiFiStep, newStep: LiFiStep): boolean;
14
13
  declare function getRpcUrlsFromChains(existingRpcUrls: RPCUrls, chains: ExtendedChain[], skipChains?: ChainId[]): RPCUrls;
15
14
  //#endregion
@@ -2,7 +2,6 @@ import { ExecutionAction } from "../types/core.js";
2
2
  import { ErrorCode } from "./constants.js";
3
3
  import { BaseError } from "./baseError.js";
4
4
  import { LiFiStep } from "@lifi/types";
5
-
6
5
  //#region src/errors/SDKError.d.ts
7
6
  declare class SDKError extends Error {
8
7
  step?: LiFiStep;
@@ -1,5 +1,4 @@
1
1
  import { ErrorCode, ErrorName } from "./constants.js";
2
-
3
2
  //#region src/errors/baseError.d.ts
4
3
  declare class BaseError extends Error {
5
4
  code: ErrorCode;
@@ -1,7 +1,6 @@
1
1
  import { ExecuteStepRetryParams } from "../types/core.js";
2
2
  import { LiFiErrorCode } from "./constants.js";
3
3
  import { BaseError } from "./baseError.js";
4
-
5
4
  //#region src/errors/errors.d.ts
6
5
  declare class RPCError extends BaseError {
7
6
  constructor(code: LiFiErrorCode, message: string, cause?: Error);
@@ -25,10 +24,10 @@ declare class ValidationError extends BaseError {
25
24
  constructor(message: string);
26
25
  }
27
26
  /**
28
- * Thrown by a step executor when executeStep should be retried with the given params
29
- * (e.g. wallet rejected 7702 upgrade → retry with atomicityNotReady).
30
- * The execution layer catches this and retries executeStep(client, step, retryParams).
31
- */
27
+ * Thrown by a step executor when executeStep should be retried with the given params
28
+ * (e.g. wallet rejected 7702 upgrade → retry with atomicityNotReady).
29
+ * The execution layer catches this and retries executeStep(client, step, retryParams).
30
+ */
32
31
  declare class ExecuteStepRetryError extends BaseError {
33
32
  readonly retryParams: ExecuteStepRetryParams;
34
33
  constructor(message: string, retryParams: ExecuteStepRetryParams, cause?: Error);
@@ -2,7 +2,6 @@ import { ExtendedRequestInit } from "../types/request.js";
2
2
  import { ErrorName } from "./constants.js";
3
3
  import { BaseError } from "./baseError.js";
4
4
  import { UnavailableRoutes } from "@lifi/types";
5
-
6
5
  //#region src/errors/httpError.d.ts
7
6
  interface ServerErrorResponseBody {
8
7
  code: number;
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_errors_baseError = require("./baseError.js");
3
3
  require("./constants.js");
4
4
  //#region src/errors/httpError.ts
5
- const statusCodeToErrorClassificationMap = new Map([
5
+ const statusCodeToErrorClassificationMap = /* @__PURE__ */ new Map([
6
6
  [400, {
7
7
  type: "ValidationError",
8
8
  code: 1001
@@ -1 +1 @@
1
- {"version":3,"file":"httpError.js","names":["BaseError"],"sources":["../../../src/errors/httpError.ts"],"sourcesContent":["import type { UnavailableRoutes } from '@lifi/types'\nimport type { ExtendedRequestInit } from '../types/request.js'\nimport { BaseError } from './baseError.js'\nimport { ErrorMessage, ErrorName, LiFiErrorCode } from './constants.js'\n\ninterface ServerErrorResponseBody {\n code: number\n message: string\n errors?: UnavailableRoutes\n}\n\nconst statusCodeToErrorClassificationMap = new Map([\n [\n 400,\n { type: ErrorName.ValidationError, code: LiFiErrorCode.ValidationError },\n ],\n [404, { type: ErrorName.NotFoundError, code: LiFiErrorCode.NotFound }],\n [\n 409,\n {\n type: ErrorName.SlippageError,\n code: LiFiErrorCode.SlippageError,\n message: ErrorMessage.SlippageError,\n },\n ],\n [424, { type: ErrorName.ServerError, code: LiFiErrorCode.ThirdPartyError }],\n [429, { type: ErrorName.ServerError, code: LiFiErrorCode.RateLimitExceeded }],\n [500, { type: ErrorName.ServerError, code: LiFiErrorCode.InternalError }],\n])\n\nconst getErrorClassificationFromStatusCode = (code: number) =>\n statusCodeToErrorClassificationMap.get(code) ?? {\n type: ErrorName.ServerError,\n code: LiFiErrorCode.InternalError,\n }\n\nconst createInitialMessage = (response: Response) => {\n const statusCode =\n response.status || response.status === 0 ? response.status : ''\n const title = response.statusText || ''\n const status = `${statusCode} ${title}`.trim()\n const reason = status ? `status code ${status}` : 'an unknown error'\n return `Request failed with ${reason}`\n}\n\nexport class HTTPError extends BaseError {\n public response: Response\n public status: number\n public url: RequestInfo | URL\n public fetchOptions: ExtendedRequestInit\n public type?: ErrorName\n public responseBody?: ServerErrorResponseBody\n\n constructor(\n response: Response,\n url: RequestInfo | URL,\n options: ExtendedRequestInit\n ) {\n const errorClassification = getErrorClassificationFromStatusCode(\n response.status\n )\n const additionalMessage = errorClassification?.message\n ? `\\n${errorClassification.message}`\n : ''\n const message = createInitialMessage(response) + additionalMessage\n\n super(ErrorName.HTTPError, errorClassification.code, message)\n\n this.type = errorClassification.type\n this.response = response\n this.status = response.status\n this.message = message\n this.url = url\n this.fetchOptions = options\n }\n\n async buildAdditionalDetails(): Promise<void> {\n if (this.type) {\n this.message = `[${this.type}] ${this.message}`\n }\n\n try {\n this.responseBody = await this.response.json()\n\n if (this.responseBody?.message) {\n this.message += this.message.endsWith('.')\n ? ` ${this.responseBody.message.toString()}`\n : `. ${this.responseBody.message.toString()}`\n }\n } catch {}\n }\n}\n"],"mappings":";;;;AAWA,MAAM,qCAAqC,IAAI,IAAI;CACjD,CACE,KACA;EAAE,MAAA;EAAiC,MAAA;CAAoC,CACzE;CACA,CAAC,KAAK;EAAE,MAAA;EAA+B,MAAA;CAA6B,CAAC;CACrE,CACE,KACA;EACE,MAAA;EACA,MAAA;EACA,SAAA;CACF,CACF;CACA,CAAC,KAAK;EAAE,MAAA;EAA6B,MAAA;CAAoC,CAAC;CAC1E,CAAC,KAAK;EAAE,MAAA;EAA6B,MAAA;CAAsC,CAAC;CAC5E,CAAC,KAAK;EAAE,MAAA;EAA6B,MAAA;CAAkC,CAAC;AAC1E,CAAC;AAED,MAAM,wCAAwC,SAC5C,mCAAmC,IAAI,IAAI,KAAK;CAC9C,MAAA;CACA,MAAA;AACF;AAEF,MAAM,wBAAwB,aAAuB;CAInD,MAAM,SAAS,GAFb,SAAS,UAAU,SAAS,WAAW,IAAI,SAAS,SAAS,GAElC,GADf,SAAS,cAAc,KACG,KAAK;CAE7C,OAAO,uBADQ,SAAS,eAAe,WAAW;AAEpD;AAEA,IAAa,YAAb,cAA+BA,yBAAAA,UAAU;CACvC;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,UACA,KACA,SACA;EACA,MAAM,sBAAsB,qCAC1B,SAAS,MACX;EACA,MAAM,oBAAoB,qBAAqB,UAC3C,KAAK,oBAAoB,YACzB;EACJ,MAAM,UAAU,qBAAqB,QAAQ,IAAI;EAEjD,MAAA,aAA2B,oBAAoB,MAAM,OAAO;EAE5D,KAAK,OAAO,oBAAoB;EAChC,KAAK,WAAW;EAChB,KAAK,SAAS,SAAS;EACvB,KAAK,UAAU;EACf,KAAK,MAAM;EACX,KAAK,eAAe;CACtB;CAEA,MAAM,yBAAwC;EAC5C,IAAI,KAAK,MACP,KAAK,UAAU,IAAI,KAAK,KAAK,IAAI,KAAK;EAGxC,IAAI;GACF,KAAK,eAAe,MAAM,KAAK,SAAS,KAAK;GAE7C,IAAI,KAAK,cAAc,SACrB,KAAK,WAAW,KAAK,QAAQ,SAAS,GAAG,IACrC,IAAI,KAAK,aAAa,QAAQ,SAAS,MACvC,KAAK,KAAK,aAAa,QAAQ,SAAS;EAEhD,QAAQ,CAAC;CACX;AACF"}
1
+ {"version":3,"file":"httpError.js","names":["BaseError"],"sources":["../../../src/errors/httpError.ts"],"sourcesContent":["import type { UnavailableRoutes } from '@lifi/types'\nimport type { ExtendedRequestInit } from '../types/request.js'\nimport { BaseError } from './baseError.js'\nimport { ErrorMessage, ErrorName, LiFiErrorCode } from './constants.js'\n\ninterface ServerErrorResponseBody {\n code: number\n message: string\n errors?: UnavailableRoutes\n}\n\nconst statusCodeToErrorClassificationMap = new Map([\n [\n 400,\n { type: ErrorName.ValidationError, code: LiFiErrorCode.ValidationError },\n ],\n [404, { type: ErrorName.NotFoundError, code: LiFiErrorCode.NotFound }],\n [\n 409,\n {\n type: ErrorName.SlippageError,\n code: LiFiErrorCode.SlippageError,\n message: ErrorMessage.SlippageError,\n },\n ],\n [424, { type: ErrorName.ServerError, code: LiFiErrorCode.ThirdPartyError }],\n [429, { type: ErrorName.ServerError, code: LiFiErrorCode.RateLimitExceeded }],\n [500, { type: ErrorName.ServerError, code: LiFiErrorCode.InternalError }],\n])\n\nconst getErrorClassificationFromStatusCode = (code: number) =>\n statusCodeToErrorClassificationMap.get(code) ?? {\n type: ErrorName.ServerError,\n code: LiFiErrorCode.InternalError,\n }\n\nconst createInitialMessage = (response: Response) => {\n const statusCode =\n response.status || response.status === 0 ? response.status : ''\n const title = response.statusText || ''\n const status = `${statusCode} ${title}`.trim()\n const reason = status ? `status code ${status}` : 'an unknown error'\n return `Request failed with ${reason}`\n}\n\nexport class HTTPError extends BaseError {\n public response: Response\n public status: number\n public url: RequestInfo | URL\n public fetchOptions: ExtendedRequestInit\n public type?: ErrorName\n public responseBody?: ServerErrorResponseBody\n\n constructor(\n response: Response,\n url: RequestInfo | URL,\n options: ExtendedRequestInit\n ) {\n const errorClassification = getErrorClassificationFromStatusCode(\n response.status\n )\n const additionalMessage = errorClassification?.message\n ? `\\n${errorClassification.message}`\n : ''\n const message = createInitialMessage(response) + additionalMessage\n\n super(ErrorName.HTTPError, errorClassification.code, message)\n\n this.type = errorClassification.type\n this.response = response\n this.status = response.status\n this.message = message\n this.url = url\n this.fetchOptions = options\n }\n\n async buildAdditionalDetails(): Promise<void> {\n if (this.type) {\n this.message = `[${this.type}] ${this.message}`\n }\n\n try {\n this.responseBody = await this.response.json()\n\n if (this.responseBody?.message) {\n this.message += this.message.endsWith('.')\n ? ` ${this.responseBody.message.toString()}`\n : `. ${this.responseBody.message.toString()}`\n }\n } catch {}\n }\n}\n"],"mappings":";;;;AAWA,MAAM,qDAAqC,IAAI,IAAI;CACjD,CACE,KACA;EAAE,MAAA;EAAiC,MAAA;CAAoC,CACzE;CACA,CAAC,KAAK;EAAE,MAAA;EAA+B,MAAA;CAA6B,CAAC;CACrE,CACE,KACA;EACE,MAAA;EACA,MAAA;EACA,SAAA;CACF,CACF;CACA,CAAC,KAAK;EAAE,MAAA;EAA6B,MAAA;CAAoC,CAAC;CAC1E,CAAC,KAAK;EAAE,MAAA;EAA6B,MAAA;CAAsC,CAAC;CAC5E,CAAC,KAAK;EAAE,MAAA;EAA6B,MAAA;CAAkC,CAAC;AAC1E,CAAC;AAED,MAAM,wCAAwC,SAC5C,mCAAmC,IAAI,IAAI,KAAK;CAC9C,MAAA;CACA,MAAA;AACF;AAEF,MAAM,wBAAwB,aAAuB;CAInD,MAAM,SAAS,GAFb,SAAS,UAAU,SAAS,WAAW,IAAI,SAAS,SAAS,GAElC,GADf,SAAS,cAAc,KACG,KAAK;CAE7C,OAAO,uBADQ,SAAS,eAAe,WAAW;AAEpD;AAEA,IAAa,YAAb,cAA+BA,yBAAAA,UAAU;CACvC;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,UACA,KACA,SACA;EACA,MAAM,sBAAsB,qCAC1B,SAAS,MACX;EACA,MAAM,oBAAoB,qBAAqB,UAC3C,KAAK,oBAAoB,YACzB;EACJ,MAAM,UAAU,qBAAqB,QAAQ,IAAI;EAEjD,MAAA,aAA2B,oBAAoB,MAAM,OAAO;EAE5D,KAAK,OAAO,oBAAoB;EAChC,KAAK,WAAW;EAChB,KAAK,SAAS,SAAS;EACvB,KAAK,UAAU;EACf,KAAK,MAAM;EACX,KAAK,eAAe;CACtB;CAEA,MAAM,yBAAwC;EAC5C,IAAI,KAAK,MACP,KAAK,UAAU,IAAI,KAAK,KAAK,IAAI,KAAK;EAGxC,IAAI;GACF,KAAK,eAAe,MAAM,KAAK,SAAS,KAAK;GAE7C,IAAI,KAAK,cAAc,SACrB,KAAK,WAAW,KAAK,QAAQ,SAAS,GAAG,IACrC,IAAI,KAAK,aAAa,QAAQ,SAAS,MACvC,KAAK,KAAK,aAAa,QAAQ,SAAS;EAEhD,QAAQ,CAAC;CACX;AACF"}
@@ -1,5 +1,4 @@
1
1
  import { BaseError } from "../baseError.js";
2
-
3
2
  //#region src/errors/utils/baseErrorRootCause.d.ts
4
3
  declare const getRootCauseBaseError: (e: Error) => BaseError;
5
4
  declare const getRootCauseBaseErrorMessage: (e: Error) => string;
@@ -5,6 +5,7 @@ import { getConnections } from "./actions/getConnections.js";
5
5
  import { getContractCallsQuote } from "./actions/getContractCallsQuote.js";
6
6
  import { getGasRecommendation } from "./actions/getGasRecommendation.js";
7
7
  import { getNameServiceAddress } from "./actions/getNameServiceAddress.js";
8
+ import { GetStatusRequestExtended, LiFiStepRequest, QuoteRequest, QuoteRequestFromAmount, QuoteRequestToAmount } from "./types/actions.js";
8
9
  import { getQuote } from "./actions/getQuote.js";
9
10
  import { getRelayedTransactionStatus } from "./actions/getRelayedTransactionStatus.js";
10
11
  import { getRelayerQuote } from "./actions/getRelayerQuote.js";
@@ -52,4 +53,4 @@ import { waitForResult } from "./utils/waitForResult.js";
52
53
  import { LruMap, withDedupe } from "./utils/withDedupe.js";
53
54
  import { withTimeout } from "./utils/withTimeout.js";
54
55
  export * from "@lifi/types";
55
- export { type AcceptExchangeRateUpdateHook, type AcceptSlippageUpdateHook, type AcceptSlippageUpdateHookParams, BalanceError, BaseError, BaseStepExecutionTask, BaseStepExecutor, type CheckBalanceOptions, CheckBalanceTask, type ContractCallParams, type ContractTool, type ErrorCode, ErrorMessage, ErrorName, type ExchangeRateUpdateParams, ExecuteStepRetryError, type ExecuteStepRetryParams, type Execution, type ExecutionAction, type ExecutionActionStatus, type ExecutionActionType, type ExecutionOptions, type ExecutionStatus, type GetContractCallsHook, type GetContractCallsResult, HTTPError, InMemoryStorage, type InteractionSettings, LiFiErrorCode, type LiFiStepExtended, LocalStorageAdapter, LruMap, PrepareTransactionTask, ProviderError, RPCError, type RPCUrls, type RequestInterceptor, type RouteExecutionData, type RouteExecutionDataDictionary, type RouteExecutionDictionary, type RouteExtended, type SDKBaseConfig, type SDKClient, type SDKConfig, SDKError, type SDKProvider, type SDKStorage, ServerError, StatusManager, type StepExecutor, type StepExecutorBaseContext, type StepExecutorContext, type StepExecutorOptions, type StepExtended, TaskPipeline, type TaskResult, type TaskStatus, TransactionError, type TransactionMethodType, type TransactionParameters, type TransactionRequestParameters, type TransactionRequestUpdateHook, UnknownError, type UpdateRouteHook, ValidationError, WaitForTransactionStatusTask, actions, checkBalance, checkPackageUpdates, convertQuoteToRoute, createClient, createDefaultStorage, executeRoute, fetchTxErrorDetails, formatUnits, getActionMessage, getActiveRoute, getActiveRoutes, getChains, getConnections, getContractCallsQuote, getGasRecommendation, getNameServiceAddress, getQuote, getRelayedTransactionStatus, getRelayerQuote, getRoutes, getStatus, getStepTransaction, getSubstatusMessage, getToken, getTokenBalance, getTokenBalances, getTokenBalancesByChain, getTokens, getTools, getTransactionHistory, getTransactionRequestData, getWalletBalances, isHex, parseUnits, patchContractCalls, relayTransaction, resumeRoute, sleep, stepComparison, stopRouteExecution, updateRouteExecution, waitForResult, withDedupe, withTimeout };
56
+ export { type AcceptExchangeRateUpdateHook, type AcceptSlippageUpdateHook, type AcceptSlippageUpdateHookParams, BalanceError, BaseError, BaseStepExecutionTask, BaseStepExecutor, type CheckBalanceOptions, CheckBalanceTask, type ContractCallParams, type ContractTool, type ErrorCode, ErrorMessage, ErrorName, type ExchangeRateUpdateParams, ExecuteStepRetryError, type ExecuteStepRetryParams, type Execution, type ExecutionAction, type ExecutionActionStatus, type ExecutionActionType, type ExecutionOptions, type ExecutionStatus, type GetContractCallsHook, type GetContractCallsResult, type GetStatusRequestExtended, HTTPError, InMemoryStorage, type InteractionSettings, LiFiErrorCode, type LiFiStepExtended, type LiFiStepRequest, LocalStorageAdapter, LruMap, PrepareTransactionTask, ProviderError, type QuoteRequest, type QuoteRequestFromAmount, type QuoteRequestToAmount, RPCError, type RPCUrls, type RequestInterceptor, type RouteExecutionData, type RouteExecutionDataDictionary, type RouteExecutionDictionary, type RouteExtended, type SDKBaseConfig, type SDKClient, type SDKConfig, SDKError, type SDKProvider, type SDKStorage, ServerError, StatusManager, type StepExecutor, type StepExecutorBaseContext, type StepExecutorContext, type StepExecutorOptions, type StepExtended, TaskPipeline, type TaskResult, type TaskStatus, TransactionError, type TransactionMethodType, type TransactionParameters, type TransactionRequestParameters, type TransactionRequestUpdateHook, UnknownError, type UpdateRouteHook, ValidationError, WaitForTransactionStatusTask, actions, checkBalance, checkPackageUpdates, convertQuoteToRoute, createClient, createDefaultStorage, executeRoute, fetchTxErrorDetails, formatUnits, getActionMessage, getActiveRoute, getActiveRoutes, getChains, getConnections, getContractCallsQuote, getGasRecommendation, getNameServiceAddress, getQuote, getRelayedTransactionStatus, getRelayerQuote, getRoutes, getStatus, getStepTransaction, getSubstatusMessage, getToken, getTokenBalance, getTokenBalances, getTokenBalancesByChain, getTokens, getTools, getTransactionHistory, getTransactionRequestData, getWalletBalances, isHex, parseUnits, patchContractCalls, relayTransaction, resumeRoute, sleep, stepComparison, stopRouteExecution, updateRouteExecution, waitForResult, withDedupe, withTimeout };
@@ -1,14 +1,34 @@
1
- import { GetStatusRequest, QuoteRequest as QuoteRequest$1 } from "@lifi/types";
2
-
1
+ import { Action, GetStatusRequest, LiFiStep, QuoteRequest as QuoteRequest$1, RoutesRequest as RoutesRequest$1, SignedLiFiStep } from "@lifi/types";
3
2
  //#region src/types/actions.d.ts
4
3
  type GetStatusRequestExtended = GetStatusRequest & {
5
4
  fromAddress?: string;
6
5
  };
6
+ /**
7
+ * Optional limit-order fields. Supplying them opts a request into limit-order
8
+ * handling; resolution happens on the backend.
9
+ */
10
+ type OrderFields = {
11
+ toAmount?: string;
12
+ validUntil?: number;
13
+ partiallyFillable?: boolean;
14
+ };
15
+ type RoutesRequest = Omit<RoutesRequest$1, "options"> & OrderFields & {
16
+ options?: RoutesRequest$1["options"] & {
17
+ /** (default: false) Whether to request private routes */
18
+ private?: boolean;
19
+ };
20
+ };
21
+ /**
22
+ * A step request that may carry the optional limit-order `action` fields.
23
+ */
24
+ type LiFiStepRequest = (LiFiStep | SignedLiFiStep) & {
25
+ action: Action & OrderFields;
26
+ };
7
27
  type QuoteRequestFromAmount = QuoteRequest$1;
8
28
  type QuoteRequestToAmount = Omit<QuoteRequest$1, "fromAmount"> & {
9
29
  toAmount: string;
10
30
  };
11
31
  type QuoteRequest = QuoteRequestFromAmount | QuoteRequestToAmount;
12
32
  //#endregion
13
- export { GetStatusRequestExtended, QuoteRequest, QuoteRequestFromAmount, QuoteRequestToAmount };
33
+ export { GetStatusRequestExtended, LiFiStepRequest, QuoteRequest, QuoteRequestFromAmount, QuoteRequestToAmount, RoutesRequest };
14
34
  //# sourceMappingURL=actions.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { SDKStorage } from "../core/storage.js";
2
2
  import { ExtendedRequestInit } from "./request.js";
3
3
  import { ChainId, ChainType, CoinKey, ContractCall, ExtendedChain, FeeCost, GasCost, LiFiStep, Route, RouteOptions, Step, Substatus, Token, TokenAmount } from "@lifi/types";
4
-
5
4
  //#region src/types/core.d.ts
6
5
  type RequestInterceptor = (request: ExtendedRequestInit) => ExtendedRequestInit | Promise<ExtendedRequestInit>;
7
6
  interface SDKBaseConfig {
@@ -53,9 +52,9 @@ interface InteractionSettings {
53
52
  allowExecution?: boolean;
54
53
  }
55
54
  /**
56
- * Params passed when retrying executeStep after an ExecuteStepRetryError.
57
- * Providers can use this to pass strategy-specific retry options (e.g. atomicityNotReady for Ethereum 7702).
58
- */
55
+ * Params passed when retrying executeStep after an ExecuteStepRetryError.
56
+ * Providers can use this to pass strategy-specific retry options (e.g. atomicityNotReady for Ethereum 7702).
57
+ */
59
58
  type ExecuteStepRetryParams = Record<string, unknown>;
60
59
  interface StepExecutor {
61
60
  allowUserInteraction: boolean;
@@ -1,7 +1,6 @@
1
1
  import { ExecuteStepRetryParams, ExecutionOptions, LiFiStepExtended, SDKClient } from "./core.js";
2
2
  import { StatusManager } from "../core/StatusManager.js";
3
3
  import { ExtendedChain } from "@lifi/types";
4
-
5
4
  //#region src/types/execution.d.ts
6
5
  interface StepExecutorBaseContext {
7
6
  statusManager: StatusManager;
@@ -5,7 +5,7 @@ const checkPackageUpdates = async (packageName, packageVersion) => {
5
5
  try {
6
6
  const pkgName = packageName ?? "@lifi/sdk";
7
7
  const latestVersion = (await (await fetch(`https://registry.npmjs.org/${pkgName}/latest`)).json()).version;
8
- const currentVersion = packageVersion ?? "4.0.1";
8
+ const currentVersion = packageVersion ?? "4.2.0";
9
9
  if (latestVersion > currentVersion) console.warn(`${pkgName}: new package version is available. Please update as soon as possible to enjoy the newest features. Current version: ${currentVersion}. Latest version: ${latestVersion}.`);
10
10
  } catch (_error) {}
11
11
  };
@@ -1,21 +1,20 @@
1
1
  import { LiFiStep, Route } from "@lifi/types";
2
-
3
2
  //#region src/utils/convertQuoteToRoute.d.ts
4
3
  interface ConvertQuoteToRouteOptions {
5
4
  /**
6
- * When true, if the quote has zero output values (toAmount, toAmountMin, toAmountUSD),
7
- * use the values from the previous included step that has non-zero output.
8
- */
5
+ * When true, if the quote has zero output values (toAmount, toAmountMin, toAmountUSD),
6
+ * use the values from the previous included step that has non-zero output.
7
+ */
9
8
  adjustZeroOutputFromPreviousStep?: boolean;
10
9
  }
11
10
  declare function formatTokenPrice(amount?: string | bigint, price?: string, decimals?: number): number;
12
11
  /**
13
- * Converts a quote to Route
14
- * @param quote - Step returned from the quote endpoint.
15
- * @param options - Optional configuration for handling edge cases.
16
- * @returns - The route to be executed.
17
- * @throws {BaseError} Throws a ValidationError if the step has missing values.
18
- */
12
+ * Converts a quote to Route
13
+ * @param quote - Step returned from the quote endpoint.
14
+ * @param options - Optional configuration for handling edge cases.
15
+ * @returns - The route to be executed.
16
+ * @throws {BaseError} Throws a ValidationError if the step has missing values.
17
+ */
19
18
  declare const convertQuoteToRoute: (quote: LiFiStep, options?: ConvertQuoteToRouteOptions) => Route;
20
19
  //#endregion
21
20
  export { convertQuoteToRoute, formatTokenPrice };
@@ -1,7 +1,7 @@
1
1
  //#region src/utils/formatUnits.d.ts
2
2
  /**
3
- * Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number.
4
- */
3
+ * Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number.
4
+ */
5
5
  declare function formatUnits(value: bigint, decimals: number): string;
6
6
  //#endregion
7
7
  export { formatUnits };
@@ -1,6 +1,5 @@
1
1
  import { SDKClient } from "../types/core.js";
2
2
  import { LiFiStep } from "@lifi/types";
3
-
4
3
  //#region src/utils/getTransactionMessage.d.ts
5
4
  declare const getTransactionFailedMessage: (client: SDKClient, step: LiFiStep, txLink?: string) => Promise<string>;
6
5
  //#endregion
@@ -1,8 +1,6 @@
1
1
  //#region src/utils/isHex.d.ts
2
2
  type Hex = `0x${string}`;
3
- declare function isHex(value: unknown, {
4
- strict
5
- }?: {
3
+ declare function isHex(value: unknown, { strict }?: {
6
4
  strict?: boolean | undefined;
7
5
  }): value is Hex;
8
6
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import { RoutesRequest } from "@lifi/types";
2
-
3
2
  //#region src/utils/isRoutesRequest.d.ts
4
3
  declare const isRoutesRequest: (routesRequest: RoutesRequest) => routesRequest is RoutesRequest;
5
4
  //#endregion
@@ -1,5 +1,4 @@
1
1
  import { LiFiStep } from "@lifi/types";
2
-
3
2
  //#region src/utils/isStep.d.ts
4
3
  declare const isStep: (step: LiFiStep) => step is LiFiStep;
5
4
  //#endregion
@@ -6,6 +6,7 @@ const isAction = (action) => {
6
6
  return typeof fromChainId === "number" && typeof fromAmount === "string" && fromAmount !== "" && require_utils_isToken.isToken(fromToken) && typeof toChainId === "number" && require_utils_isToken.isToken(toToken);
7
7
  };
8
8
  const isEstimate = (estimate) => {
9
+ if (!estimate) return false;
9
10
  const { fromAmount, toAmount, toAmountMin, approvalAddress } = estimate;
10
11
  return typeof fromAmount === "string" && fromAmount !== "" && typeof toAmount === "string" && toAmount !== "" && typeof toAmountMin === "string" && toAmountMin !== "" && (typeof approvalAddress === "string" || approvalAddress === null);
11
12
  };
@@ -15,7 +16,7 @@ const isStep = (step) => {
15
16
  "swap",
16
17
  "cross",
17
18
  "lifi"
18
- ].includes(type) && typeof tool === "string" && isAction(action) && isEstimate(estimate);
19
+ ].includes(type) && typeof tool === "string" && isAction(action) && (!estimate || isEstimate(estimate));
19
20
  };
20
21
  //#endregion
21
22
  exports.isStep = isStep;
@@ -1 +1 @@
1
- {"version":3,"file":"isStep.js","names":["isToken"],"sources":["../../../src/utils/isStep.ts"],"sourcesContent":["import type { Action, Estimate, LiFiStep } from '@lifi/types'\nimport { isToken } from './isToken.js'\n\nconst isAction = (action: Action): action is Action => {\n const { fromChainId, fromAmount, fromToken, toChainId, toToken } = action\n\n return (\n typeof fromChainId === 'number' &&\n typeof fromAmount === 'string' &&\n fromAmount !== '' &&\n isToken(fromToken) &&\n typeof toChainId === 'number' &&\n isToken(toToken)\n )\n}\n\nconst isEstimate = (estimate: Estimate): estimate is Estimate => {\n const { fromAmount, toAmount, toAmountMin, approvalAddress } = estimate\n\n return (\n typeof fromAmount === 'string' &&\n fromAmount !== '' &&\n typeof toAmount === 'string' &&\n toAmount !== '' &&\n typeof toAmountMin === 'string' &&\n toAmountMin !== '' &&\n (typeof approvalAddress === 'string' || approvalAddress === null)\n )\n}\n\nexport const isStep = (step: LiFiStep): step is LiFiStep => {\n const { id, type, tool, action, estimate } = step\n\n return (\n typeof id === 'string' &&\n ['swap', 'cross', 'lifi'].includes(type) &&\n typeof tool === 'string' &&\n isAction(action) &&\n isEstimate(estimate)\n )\n}\n"],"mappings":";;;AAGA,MAAM,YAAY,WAAqC;CACrD,MAAM,EAAE,aAAa,YAAY,WAAW,WAAW,YAAY;CAEnE,OACE,OAAO,gBAAgB,YACvB,OAAO,eAAe,YACtB,eAAe,MACfA,sBAAAA,QAAQ,SAAS,KACjB,OAAO,cAAc,YACrBA,sBAAAA,QAAQ,OAAO;AAEnB;AAEA,MAAM,cAAc,aAA6C;CAC/D,MAAM,EAAE,YAAY,UAAU,aAAa,oBAAoB;CAE/D,OACE,OAAO,eAAe,YACtB,eAAe,MACf,OAAO,aAAa,YACpB,aAAa,MACb,OAAO,gBAAgB,YACvB,gBAAgB,OACf,OAAO,oBAAoB,YAAY,oBAAoB;AAEhE;AAEA,MAAa,UAAU,SAAqC;CAC1D,MAAM,EAAE,IAAI,MAAM,MAAM,QAAQ,aAAa;CAE7C,OACE,OAAO,OAAO,YACd;EAAC;EAAQ;EAAS;CAAM,CAAC,CAAC,SAAS,IAAI,KACvC,OAAO,SAAS,YAChB,SAAS,MAAM,KACf,WAAW,QAAQ;AAEvB"}
1
+ {"version":3,"file":"isStep.js","names":["isToken"],"sources":["../../../src/utils/isStep.ts"],"sourcesContent":["import type { Action, Estimate, LiFiStep } from '@lifi/types'\nimport { isToken } from './isToken.js'\n\nconst isAction = (action: Action): action is Action => {\n const { fromChainId, fromAmount, fromToken, toChainId, toToken } = action\n\n return (\n typeof fromChainId === 'number' &&\n typeof fromAmount === 'string' &&\n fromAmount !== '' &&\n isToken(fromToken) &&\n typeof toChainId === 'number' &&\n isToken(toToken)\n )\n}\n\nconst isEstimate = (estimate: Estimate): estimate is Estimate => {\n if (!estimate) {\n return false\n }\n const { fromAmount, toAmount, toAmountMin, approvalAddress } = estimate\n\n return (\n typeof fromAmount === 'string' &&\n fromAmount !== '' &&\n typeof toAmount === 'string' &&\n toAmount !== '' &&\n typeof toAmountMin === 'string' &&\n toAmountMin !== '' &&\n (typeof approvalAddress === 'string' || approvalAddress === null)\n )\n}\n\nexport const isStep = (step: LiFiStep): step is LiFiStep => {\n const { id, type, tool, action, estimate } = step\n\n return (\n typeof id === 'string' &&\n ['swap', 'cross', 'lifi'].includes(type) &&\n typeof tool === 'string' &&\n isAction(action) &&\n (!estimate || isEstimate(estimate))\n )\n}\n"],"mappings":";;;AAGA,MAAM,YAAY,WAAqC;CACrD,MAAM,EAAE,aAAa,YAAY,WAAW,WAAW,YAAY;CAEnE,OACE,OAAO,gBAAgB,YACvB,OAAO,eAAe,YACtB,eAAe,MACfA,sBAAAA,QAAQ,SAAS,KACjB,OAAO,cAAc,YACrBA,sBAAAA,QAAQ,OAAO;AAEnB;AAEA,MAAM,cAAc,aAA6C;CAC/D,IAAI,CAAC,UACH,OAAO;CAET,MAAM,EAAE,YAAY,UAAU,aAAa,oBAAoB;CAE/D,OACE,OAAO,eAAe,YACtB,eAAe,MACf,OAAO,aAAa,YACpB,aAAa,MACb,OAAO,gBAAgB,YACvB,gBAAgB,OACf,OAAO,oBAAoB,YAAY,oBAAoB;AAEhE;AAEA,MAAa,UAAU,SAAqC;CAC1D,MAAM,EAAE,IAAI,MAAM,MAAM,QAAQ,aAAa;CAE7C,OACE,OAAO,OAAO,YACd;EAAC;EAAQ;EAAS;CAAM,CAAC,CAAC,SAAS,IAAI,KACvC,OAAO,SAAS,YAChB,SAAS,MAAM,MACd,CAAC,YAAY,WAAW,QAAQ;AAErC"}
@@ -1,5 +1,4 @@
1
1
  import { StaticToken } from "@lifi/types";
2
-
3
2
  //#region src/utils/isToken.d.ts
4
3
  declare const isToken: (token: StaticToken) => token is StaticToken;
5
4
  //#endregion
@@ -1,7 +1,7 @@
1
1
  //#region src/utils/parseUnits.d.ts
2
2
  /**
3
- * Multiplies a string representation of a number by a given exponent of base 10 (10exponent).
4
- */
3
+ * Multiplies a string representation of a number by a given exponent of base 10 (10exponent).
4
+ */
5
5
  declare function parseUnits(value: string, decimals: number): bigint;
6
6
  //#endregion
7
7
  export { parseUnits };
@@ -1,6 +1,5 @@
1
1
  import { ExtendedRequestInit } from "../types/request.js";
2
2
  import { SDKBaseConfig } from "../types/core.js";
3
-
4
3
  //#region src/utils/request.d.ts
5
4
  declare const requestSettings: {
6
5
  retries: number;
@@ -0,0 +1,5 @@
1
+ //#region src/utils/toQueryString.d.ts
2
+ declare const toQueryString: (params: Record<string, unknown>) => string;
3
+ //#endregion
4
+ export { toQueryString };
5
+ //# sourceMappingURL=toQueryString.d.ts.map
@@ -0,0 +1,17 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/utils/toQueryString.ts
3
+ const isPrimitive = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint";
4
+ const serialize = (key, value) => {
5
+ if (value === void 0 || value === null) return [];
6
+ if (isPrimitive(value)) return [`${key}=${encodeURIComponent(String(value))}`];
7
+ if (Array.isArray(value)) {
8
+ if (value.every(isPrimitive)) return [`${key}=${encodeURIComponent(value.join(","))}`];
9
+ return value.flatMap((item, index) => serialize(`${key}[${index}]`, item));
10
+ }
11
+ return Object.entries(value).flatMap(([subKey, subValue]) => serialize(`${key}[${subKey}]`, subValue));
12
+ };
13
+ const toQueryString = (params) => Object.entries(params).flatMap(([key, value]) => serialize(key, value)).join("&");
14
+ //#endregion
15
+ exports.toQueryString = toQueryString;
16
+
17
+ //# sourceMappingURL=toQueryString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toQueryString.js","names":[],"sources":["../../../src/utils/toQueryString.ts"],"sourcesContent":["type QueryPrimitive = string | number | boolean | bigint\n\nconst isPrimitive = (value: unknown): value is QueryPrimitive =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'bigint'\n\n// Arrays of objects use qs indices notation (`key[0][subKey]=value`) to match\n// the backend's `qs.parse(str, { comma: true })`; only values are encoded.\nconst serialize = (key: string, value: unknown): string[] => {\n if (value === undefined || value === null) {\n return []\n }\n if (isPrimitive(value)) {\n return [`${key}=${encodeURIComponent(String(value))}`]\n }\n if (Array.isArray(value)) {\n // Scalar arrays stay comma-joined (backend splits on `comma: true`).\n if (value.every(isPrimitive)) {\n return [`${key}=${encodeURIComponent(value.join(','))}`]\n }\n return value.flatMap((item, index) => serialize(`${key}[${index}]`, item))\n }\n return Object.entries(value as Record<string, unknown>).flatMap(\n ([subKey, subValue]) => serialize(`${key}[${subKey}]`, subValue)\n )\n}\n\n// Encode params into a query string (no leading `?`). Drop-in for\n// `URLSearchParams` that handles nested array/object params; skips null/undefined.\nexport const toQueryString = (params: Record<string, unknown>): string =>\n Object.entries(params)\n .flatMap(([key, value]) => serialize(key, value))\n .join('&')\n"],"mappings":";;AAEA,MAAM,eAAe,UACnB,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU,aACjB,OAAO,UAAU;AAInB,MAAM,aAAa,KAAa,UAA6B;CAC3D,IAAI,UAAU,KAAA,KAAa,UAAU,MACnC,OAAO,CAAC;CAEV,IAAI,YAAY,KAAK,GACnB,OAAO,CAAC,GAAG,IAAI,GAAG,mBAAmB,OAAO,KAAK,CAAC,GAAG;CAEvD,IAAI,MAAM,QAAQ,KAAK,GAAG;EAExB,IAAI,MAAM,MAAM,WAAW,GACzB,OAAO,CAAC,GAAG,IAAI,GAAG,mBAAmB,MAAM,KAAK,GAAG,CAAC,GAAG;EAEzD,OAAO,MAAM,SAAS,MAAM,UAAU,UAAU,GAAG,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC;CAC3E;CACA,OAAO,OAAO,QAAQ,KAAgC,CAAC,CAAC,SACrD,CAAC,QAAQ,cAAc,UAAU,GAAG,IAAI,GAAG,OAAO,IAAI,QAAQ,CACjE;AACF;AAIA,MAAa,iBAAiB,WAC5B,OAAO,QAAQ,MAAM,CAAC,CACnB,SAAS,CAAC,KAAK,WAAW,UAAU,KAAK,KAAK,CAAC,CAAC,CAChD,KAAK,GAAG"}