@lifi/sdk 0.0.0-preview-a846771 → 0.0.0-preview-5e098f3
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.
- package/CHANGELOG.md +27 -1
- package/README.md +88 -5
- package/dist/cjs/actions/getChains.d.ts +7 -8
- package/dist/cjs/actions/getChains.js.map +1 -1
- package/dist/cjs/actions/getConnections.d.ts +6 -7
- package/dist/cjs/actions/getContractCallsQuote.d.ts +7 -8
- package/dist/cjs/actions/getContractCallsQuote.js.map +1 -1
- package/dist/cjs/actions/getGasRecommendation.d.ts +7 -8
- package/dist/cjs/actions/getNameServiceAddress.d.ts +6 -7
- package/dist/cjs/actions/getQuote.d.ts +7 -8
- package/dist/cjs/actions/getQuote.js +2 -1
- package/dist/cjs/actions/getQuote.js.map +1 -1
- package/dist/cjs/actions/getRelayedTransactionStatus.d.ts +7 -8
- package/dist/cjs/actions/getRelayedTransactionStatus.js.map +1 -1
- package/dist/cjs/actions/getRelayerQuote.d.ts +7 -8
- package/dist/cjs/actions/getRoutes.d.ts +10 -10
- package/dist/cjs/actions/getRoutes.js.map +1 -1
- package/dist/cjs/actions/getStatus.d.ts +7 -8
- package/dist/cjs/actions/getStepTransaction.d.ts +10 -10
- package/dist/cjs/actions/getStepTransaction.js.map +1 -1
- package/dist/cjs/actions/getToken.d.ts +8 -9
- package/dist/cjs/actions/getTokenBalance.d.ts +8 -9
- package/dist/cjs/actions/getTokenBalances.d.ts +8 -9
- package/dist/cjs/actions/getTokenBalances.js.map +1 -1
- package/dist/cjs/actions/getTokenBalancesByChain.d.ts +8 -9
- package/dist/cjs/actions/getTokenBalancesByChain.js +4 -2
- package/dist/cjs/actions/getTokenBalancesByChain.js.map +1 -1
- package/dist/cjs/actions/getTokens.d.ts +6 -7
- package/dist/cjs/actions/getTokens.js.map +1 -1
- package/dist/cjs/actions/getTools.d.ts +6 -7
- package/dist/cjs/actions/getTransactionHistory.d.ts +13 -19
- package/dist/cjs/actions/getWalletBalances.d.ts +7 -8
- package/dist/cjs/actions/getWalletBalances.js.map +1 -1
- package/dist/cjs/actions/index.d.ts +115 -113
- package/dist/cjs/actions/index.js.map +1 -1
- package/dist/cjs/actions/patchContractCalls.d.ts +0 -1
- package/dist/cjs/actions/relayTransaction.d.ts +7 -8
- package/dist/cjs/client/createClient.d.ts +0 -1
- package/dist/cjs/client/createClient.js.map +1 -1
- package/dist/cjs/client/getClientStorage.d.ts +0 -1
- package/dist/cjs/client/getClientStorage.js +2 -1
- package/dist/cjs/client/getClientStorage.js.map +1 -1
- package/dist/cjs/core/BaseStepExecutionTask.d.ts +0 -1
- package/dist/cjs/core/BaseStepExecutor.d.ts +0 -1
- package/dist/cjs/core/BaseStepExecutor.js.map +1 -1
- package/dist/cjs/core/StatusManager.d.ts +40 -51
- package/dist/cjs/core/TaskPipeline.d.ts +0 -1
- package/dist/cjs/core/actionMessages.d.ts +0 -1
- package/dist/cjs/core/actionMessages.js.map +1 -1
- package/dist/cjs/core/execution.d.ts +29 -30
- package/dist/cjs/core/execution.js.map +1 -1
- package/dist/cjs/core/executionState.d.ts +0 -1
- package/dist/cjs/core/executionState.js.map +1 -1
- package/dist/cjs/core/prepareRestart.d.ts +0 -1
- package/dist/cjs/core/prepareRestart.js.map +1 -1
- package/dist/cjs/core/tasks/CheckBalanceTask.d.ts +6 -7
- package/dist/cjs/core/tasks/PrepareTransactionTask.d.ts +0 -1
- package/dist/cjs/core/tasks/WaitForTransactionStatusTask.d.ts +0 -1
- package/dist/cjs/core/tasks/helpers/checkBalance.d.ts +17 -18
- package/dist/cjs/core/tasks/helpers/checkBalance.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/getTransactionRequestData.d.ts +0 -1
- package/dist/cjs/core/tasks/helpers/stepComparison.d.ts +11 -12
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.d.ts +0 -1
- package/dist/cjs/core/tasks/helpers/waitForTransactionStatus.js.map +1 -1
- package/dist/cjs/core/utils.d.ts +7 -8
- package/dist/cjs/core/utils.js.map +1 -1
- package/dist/cjs/errors/SDKError.d.ts +0 -1
- package/dist/cjs/errors/baseError.d.ts +0 -1
- package/dist/cjs/errors/errors.d.ts +4 -5
- package/dist/cjs/errors/httpError.d.ts +0 -1
- package/dist/cjs/errors/httpError.js +1 -1
- package/dist/cjs/errors/httpError.js.map +1 -1
- package/dist/cjs/errors/utils/baseErrorRootCause.d.ts +0 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/types/actions.d.ts +23 -3
- package/dist/cjs/types/core.d.ts +3 -4
- package/dist/cjs/types/execution.d.ts +0 -1
- package/dist/cjs/utils/checkPackageUpdates.js +1 -1
- package/dist/cjs/utils/checkPackageUpdates.js.map +1 -1
- package/dist/cjs/utils/convertQuoteToRoute.d.ts +9 -10
- package/dist/cjs/utils/convertQuoteToRoute.js.map +1 -1
- package/dist/cjs/utils/decode.js.map +1 -1
- package/dist/cjs/utils/fetchTxErrorDetails.js.map +1 -1
- package/dist/cjs/utils/formatUnits.d.ts +2 -2
- package/dist/cjs/utils/getTransactionMessage.d.ts +0 -1
- package/dist/cjs/utils/getTransactionMessage.js.map +1 -1
- package/dist/cjs/utils/isHex.d.ts +1 -3
- package/dist/cjs/utils/isRoutesRequest.d.ts +0 -1
- package/dist/cjs/utils/isStep.d.ts +0 -1
- package/dist/cjs/utils/isStep.js +2 -1
- package/dist/cjs/utils/isStep.js.map +1 -1
- package/dist/cjs/utils/isToken.d.ts +0 -1
- package/dist/cjs/utils/parseUnits.d.ts +2 -2
- package/dist/cjs/utils/request.d.ts +0 -1
- package/dist/cjs/utils/toQueryString.d.ts +5 -0
- package/dist/cjs/utils/toQueryString.js +17 -0
- package/dist/cjs/utils/toQueryString.js.map +1 -0
- package/dist/cjs/utils/waitForResult.d.ts +8 -8
- package/dist/cjs/utils/withDedupe.d.ts +5 -8
- package/dist/cjs/utils/withDedupe.js +1 -1
- package/dist/cjs/utils/withDedupe.js.map +1 -1
- package/dist/cjs/utils/withTimeout.d.ts +10 -16
- package/dist/cjs/utils/withTimeout.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/actions/getChains.d.ts +7 -8
- package/dist/esm/actions/getChains.d.ts.map +1 -1
- package/dist/esm/actions/getChains.js.map +1 -1
- package/dist/esm/actions/getConnections.d.ts +6 -7
- package/dist/esm/actions/getConnections.d.ts.map +1 -1
- package/dist/esm/actions/getContractCallsQuote.d.ts +7 -8
- package/dist/esm/actions/getContractCallsQuote.d.ts.map +1 -1
- package/dist/esm/actions/getGasRecommendation.d.ts +7 -8
- package/dist/esm/actions/getGasRecommendation.d.ts.map +1 -1
- package/dist/esm/actions/getNameServiceAddress.d.ts +6 -7
- package/dist/esm/actions/getNameServiceAddress.d.ts.map +1 -1
- package/dist/esm/actions/getQuote.d.ts +7 -8
- package/dist/esm/actions/getQuote.d.ts.map +1 -1
- package/dist/esm/actions/getQuote.js +2 -1
- package/dist/esm/actions/getQuote.js.map +1 -1
- package/dist/esm/actions/getRelayedTransactionStatus.d.ts +7 -8
- package/dist/esm/actions/getRelayedTransactionStatus.d.ts.map +1 -1
- package/dist/esm/actions/getRelayedTransactionStatus.js.map +1 -1
- package/dist/esm/actions/getRelayerQuote.d.ts +7 -8
- package/dist/esm/actions/getRelayerQuote.d.ts.map +1 -1
- package/dist/esm/actions/getRoutes.d.ts +10 -10
- package/dist/esm/actions/getRoutes.d.ts.map +1 -1
- package/dist/esm/actions/getRoutes.js.map +1 -1
- package/dist/esm/actions/getStatus.d.ts +7 -8
- package/dist/esm/actions/getStatus.d.ts.map +1 -1
- package/dist/esm/actions/getStepTransaction.d.ts +10 -10
- package/dist/esm/actions/getStepTransaction.d.ts.map +1 -1
- package/dist/esm/actions/getStepTransaction.js.map +1 -1
- package/dist/esm/actions/getToken.d.ts +8 -9
- package/dist/esm/actions/getToken.d.ts.map +1 -1
- package/dist/esm/actions/getTokenBalance.d.ts +8 -9
- package/dist/esm/actions/getTokenBalance.d.ts.map +1 -1
- package/dist/esm/actions/getTokenBalances.d.ts +8 -9
- package/dist/esm/actions/getTokenBalances.d.ts.map +1 -1
- package/dist/esm/actions/getTokenBalances.js.map +1 -1
- package/dist/esm/actions/getTokenBalancesByChain.d.ts +8 -9
- package/dist/esm/actions/getTokenBalancesByChain.d.ts.map +1 -1
- package/dist/esm/actions/getTokenBalancesByChain.js +4 -2
- package/dist/esm/actions/getTokenBalancesByChain.js.map +1 -1
- package/dist/esm/actions/getTokens.d.ts +6 -7
- package/dist/esm/actions/getTokens.d.ts.map +1 -1
- package/dist/esm/actions/getTokens.js.map +1 -1
- package/dist/esm/actions/getTools.d.ts +6 -7
- package/dist/esm/actions/getTools.d.ts.map +1 -1
- package/dist/esm/actions/getTransactionHistory.d.ts +13 -19
- package/dist/esm/actions/getTransactionHistory.d.ts.map +1 -1
- package/dist/esm/actions/getWalletBalances.d.ts +7 -8
- package/dist/esm/actions/getWalletBalances.d.ts.map +1 -1
- package/dist/esm/actions/getWalletBalances.js.map +1 -1
- package/dist/esm/actions/index.d.ts +115 -113
- package/dist/esm/actions/index.d.ts.map +1 -1
- package/dist/esm/actions/index.js.map +1 -1
- package/dist/esm/actions/patchContractCalls.d.ts +0 -1
- package/dist/esm/actions/patchContractCalls.d.ts.map +1 -1
- package/dist/esm/actions/relayTransaction.d.ts +7 -8
- package/dist/esm/actions/relayTransaction.d.ts.map +1 -1
- package/dist/esm/client/createClient.d.ts +0 -1
- package/dist/esm/client/createClient.d.ts.map +1 -1
- package/dist/esm/client/createClient.js.map +1 -1
- package/dist/esm/client/getClientStorage.d.ts +0 -1
- package/dist/esm/client/getClientStorage.d.ts.map +1 -1
- package/dist/esm/client/getClientStorage.js +2 -1
- package/dist/esm/client/getClientStorage.js.map +1 -1
- package/dist/esm/core/BaseStepExecutionTask.d.ts +0 -1
- package/dist/esm/core/BaseStepExecutionTask.d.ts.map +1 -1
- package/dist/esm/core/BaseStepExecutor.d.ts +0 -1
- package/dist/esm/core/BaseStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/BaseStepExecutor.js.map +1 -1
- package/dist/esm/core/StatusManager.d.ts +40 -51
- package/dist/esm/core/StatusManager.d.ts.map +1 -1
- package/dist/esm/core/TaskPipeline.d.ts +0 -1
- package/dist/esm/core/TaskPipeline.d.ts.map +1 -1
- package/dist/esm/core/actionMessages.d.ts +0 -1
- package/dist/esm/core/actionMessages.d.ts.map +1 -1
- package/dist/esm/core/actionMessages.js.map +1 -1
- package/dist/esm/core/execution.d.ts +29 -30
- package/dist/esm/core/execution.d.ts.map +1 -1
- package/dist/esm/core/execution.js.map +1 -1
- package/dist/esm/core/executionState.d.ts +0 -1
- package/dist/esm/core/executionState.d.ts.map +1 -1
- package/dist/esm/core/executionState.js.map +1 -1
- package/dist/esm/core/prepareRestart.d.ts +0 -1
- package/dist/esm/core/prepareRestart.d.ts.map +1 -1
- package/dist/esm/core/prepareRestart.js.map +1 -1
- package/dist/esm/core/storage.d.ts.map +1 -1
- package/dist/esm/core/tasks/CheckBalanceTask.d.ts +6 -7
- package/dist/esm/core/tasks/CheckBalanceTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/PrepareTransactionTask.d.ts +0 -1
- package/dist/esm/core/tasks/PrepareTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts +0 -1
- package/dist/esm/core/tasks/WaitForTransactionStatusTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/checkBalance.d.ts +17 -18
- package/dist/esm/core/tasks/helpers/checkBalance.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/checkBalance.js.map +1 -1
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts +0 -1
- package/dist/esm/core/tasks/helpers/getTransactionRequestData.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/stepComparison.d.ts +11 -12
- package/dist/esm/core/tasks/helpers/stepComparison.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts +0 -1
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/waitForTransactionStatus.js.map +1 -1
- package/dist/esm/core/utils.d.ts +7 -8
- package/dist/esm/core/utils.d.ts.map +1 -1
- package/dist/esm/core/utils.js.map +1 -1
- package/dist/esm/errors/SDKError.d.ts +0 -1
- package/dist/esm/errors/SDKError.d.ts.map +1 -1
- package/dist/esm/errors/baseError.d.ts +0 -1
- package/dist/esm/errors/baseError.d.ts.map +1 -1
- package/dist/esm/errors/constants.d.ts.map +1 -1
- package/dist/esm/errors/errors.d.ts +4 -5
- package/dist/esm/errors/errors.d.ts.map +1 -1
- package/dist/esm/errors/httpError.d.ts +0 -1
- package/dist/esm/errors/httpError.d.ts.map +1 -1
- package/dist/esm/errors/httpError.js +1 -1
- package/dist/esm/errors/httpError.js.map +1 -1
- package/dist/esm/errors/utils/baseErrorRootCause.d.ts +0 -1
- package/dist/esm/errors/utils/baseErrorRootCause.d.ts.map +1 -1
- package/dist/esm/errors/utils/rootCause.d.ts.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/types/actions.d.ts +23 -3
- package/dist/esm/types/actions.d.ts.map +1 -1
- package/dist/esm/types/core.d.ts +3 -4
- package/dist/esm/types/core.d.ts.map +1 -1
- package/dist/esm/types/execution.d.ts +0 -1
- package/dist/esm/types/execution.d.ts.map +1 -1
- package/dist/esm/types/request.d.ts.map +1 -1
- package/dist/esm/utils/checkPackageUpdates.d.ts.map +1 -1
- package/dist/esm/utils/checkPackageUpdates.js +1 -1
- package/dist/esm/utils/checkPackageUpdates.js.map +1 -1
- package/dist/esm/utils/convertQuoteToRoute.d.ts +9 -10
- package/dist/esm/utils/convertQuoteToRoute.d.ts.map +1 -1
- package/dist/esm/utils/convertQuoteToRoute.js.map +1 -1
- package/dist/esm/utils/decode.d.ts.map +1 -1
- package/dist/esm/utils/decode.js.map +1 -1
- package/dist/esm/utils/fetchTxErrorDetails.d.ts.map +1 -1
- package/dist/esm/utils/fetchTxErrorDetails.js.map +1 -1
- package/dist/esm/utils/formatUnits.d.ts +2 -2
- package/dist/esm/utils/formatUnits.d.ts.map +1 -1
- package/dist/esm/utils/getTransactionMessage.d.ts +0 -1
- package/dist/esm/utils/getTransactionMessage.d.ts.map +1 -1
- package/dist/esm/utils/getTransactionMessage.js.map +1 -1
- package/dist/esm/utils/isHex.d.ts +1 -3
- package/dist/esm/utils/isHex.d.ts.map +1 -1
- package/dist/esm/utils/isRoutesRequest.d.ts +0 -1
- package/dist/esm/utils/isRoutesRequest.d.ts.map +1 -1
- package/dist/esm/utils/isStep.d.ts +0 -1
- package/dist/esm/utils/isStep.d.ts.map +1 -1
- package/dist/esm/utils/isStep.js +2 -1
- package/dist/esm/utils/isStep.js.map +1 -1
- package/dist/esm/utils/isToken.d.ts +0 -1
- package/dist/esm/utils/isToken.d.ts.map +1 -1
- package/dist/esm/utils/parseUnits.d.ts +2 -2
- package/dist/esm/utils/parseUnits.d.ts.map +1 -1
- package/dist/esm/utils/request.d.ts +0 -1
- package/dist/esm/utils/request.d.ts.map +1 -1
- package/dist/esm/utils/sleep.d.ts.map +1 -1
- package/dist/esm/utils/toQueryString.d.ts +5 -0
- package/dist/esm/utils/toQueryString.d.ts.map +1 -0
- package/dist/esm/utils/toQueryString.js +16 -0
- package/dist/esm/utils/toQueryString.js.map +1 -0
- package/dist/esm/utils/waitForResult.d.ts +8 -8
- package/dist/esm/utils/waitForResult.d.ts.map +1 -1
- package/dist/esm/utils/withDedupe.d.ts +5 -8
- package/dist/esm/utils/withDedupe.d.ts.map +1 -1
- package/dist/esm/utils/withDedupe.js +1 -1
- package/dist/esm/utils/withDedupe.js.map +1 -1
- package/dist/esm/utils/withTimeout.d.ts +10 -16
- package/dist/esm/utils/withTimeout.d.ts.map +1 -1
- package/dist/esm/utils/withTimeout.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +2 -2
- package/src/actions/getQuote.ts +3 -2
- package/src/actions/getRoutes.ts +2 -1
- package/src/actions/getStepTransaction.ts +3 -2
- package/src/actions/index.ts +8 -5
- package/src/client/getClientStorage.ts +1 -0
- package/src/index.ts +7 -0
- package/src/types/actions.ts +29 -0
- package/src/utils/isStep.ts +4 -1
- package/src/utils/toQueryString.ts +35 -0
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
# @lifi/sdk
|
|
2
2
|
|
|
3
|
-
## 0.0.0-preview-
|
|
3
|
+
## 0.0.0-preview-5e098f3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#427](https://github.com/lifinance/sdk/pull/427) [`03c1562`](https://github.com/lifinance/sdk/commit/03c15625c7d5515f91e24a555ec3b6b5e99dd6b5) Thanks [@chybisov](https://github.com/chybisov)! - Add Stellar (STL) ecosystem support. Introduces the `@lifi/sdk-provider-stellar` package (address validation, Federation resolution, and SAC-based balance reads) and registers `ChainType.STL` in the SDK client's chain fetching so Stellar chains and RPC URLs load. Transaction execution is not yet implemented and will follow once backend transaction generation lands.
|
|
8
|
+
|
|
9
|
+
## 4.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#411](https://github.com/lifinance/sdk/pull/411) [`82b6c17`](https://github.com/lifinance/sdk/commit/82b6c17ceadfe3968e27e2c7bb3b8a1a0ded1840) Thanks [@effie-ms](https://github.com/effie-ms)! - Add an optional `private` flag to `getRoutes` route options, allowing callers to request private routes.
|
|
14
|
+
|
|
15
|
+
- [#410](https://github.com/lifinance/sdk/pull/410) [`6e1b100`](https://github.com/lifinance/sdk/commit/6e1b1009700561571d0dca864f539129951c162b) Thanks [@effie-ms](https://github.com/effie-ms)! - Add optional limit-order fields (`toAmount`, `validUntil`, `partiallyFillable`) to `getRoutes` and to a step's `action` in `getStepTransaction`. The fields are passed through and resolved on the backend; classic calls are unchanged. Steps without an `estimate` no longer fail validation. New exported type: `LiFiStepRequest`.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#414](https://github.com/lifinance/sdk/pull/414) [`e8c8b69`](https://github.com/lifinance/sdk/commit/e8c8b6999ba8ffc127d47ba4a648d0a2792a4870) Thanks [@chybisov](https://github.com/chybisov)! - Export `getStatus`/`getQuote` param types from the entrypoint: `GetStatusRequestExtended`, `QuoteRequest`, `QuoteRequestFromAmount`, `QuoteRequestToAmount`.
|
|
20
|
+
|
|
21
|
+
- [#415](https://github.com/lifinance/sdk/pull/415) [`2ced1e4`](https://github.com/lifinance/sdk/commit/2ced1e4881923ac14e110b3009150a5bd4f9d318) Thanks [@chybisov](https://github.com/chybisov)! - Fix `getQuote` dropping `distributionFees` (and other nested array/object params). `getQuote` built its GET query string with `URLSearchParams`, which stringifies an array of objects to `[object Object]`, so multi-recipient fee splits never reached the backend (which parses query params with `qs.parse(..., { comma: true })`). A new `toQueryString` util encodes nested params in qs indices notation (`distributionFees[0][receiver]=...`), so `distributionFees` now serializes correctly on `/quote` and `/quote/toAmount`. Scalar and scalar-array params are unchanged.
|
|
22
|
+
|
|
23
|
+
## 4.0.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- [#402](https://github.com/lifinance/sdk/pull/402) [`bf3d047`](https://github.com/lifinance/sdk/commit/bf3d047ebdc9a8b3a5a6362f65d25aa1eb652ffa) Thanks [@chybisov](https://github.com/chybisov)! - Bump runtime dependencies: @lifi/types to 17.85.0, viem to 2.52.2, @solana/kit to 6.10.0 (with @solana/wallet-standard-features and @wallet-standard/base), @mysten/sui to 2.19.0, and @tronweb3/tronwallet-abstract-adapter to 1.2.0.
|
|
28
|
+
|
|
29
|
+
## 4.0.0
|
|
4
30
|
|
|
5
31
|
> **Pre-Changesets history (aggregated, repo-wide).** The entries below are
|
|
6
32
|
> inherited verbatim from the repository root `CHANGELOG.md`, which aggregated
|
package/README.md
CHANGED
|
@@ -13,18 +13,23 @@
|
|
|
13
13
|
|
|
14
14
|
[**LI.FI SDK**](https://docs.li.fi/sdk/overview) features include:
|
|
15
15
|
|
|
16
|
+
- **Modular architecture** - Install only the provider packages you need for your supported blockchain ecosystems (EVM, Solana, Bitcoin, Sui, Tron)
|
|
16
17
|
- All ecosystems, chains, bridges, exchanges, and solvers that [LI.FI](https://docs.li.fi/introduction/chains) supports
|
|
17
18
|
- Complete functionality covering full-cycle from obtaining routes/quotes to executing transactions
|
|
18
19
|
- Easy tracking of the route and quote execution through the robust event and hooks handling
|
|
19
20
|
- Highly customizable settings to tailor the SDK to your specific needs including configuration of RPCs and options to allow or deny certain chains, tokens, bridges, exchanges, solvers
|
|
20
21
|
- Supports widely adopted industry standards, including [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792), [ERC-2612](https://eips.ethereum.org/EIPS/eip-2612), [EIP-712](https://eips.ethereum.org/EIPS/eip-712), and [Permit2](https://github.com/Uniswap/permit2)
|
|
21
|
-
- SDK ecosystem providers are based on industry-standard libraries ([Viem](https://viem.sh/), [
|
|
22
|
+
- SDK ecosystem providers are based on industry-standard libraries ([Viem](https://viem.sh/) for EVM, [Solana Kit](https://github.com/solana-labs/solana-web3.js) for Solana, [Bigmi](https://github.com/lifinance/bigmi) for Bitcoin, [Mysten Sui SDK](https://github.com/MystenLabs/sui/tree/main/sdk) for Sui, [TronWeb](https://tronweb.network/) for Tron)
|
|
22
23
|
- Support for arbitrary contract calls on the destination chain
|
|
23
24
|
- Designed for optimal performance with tree-shaking and dead-code elimination, ensuring minimal bundle sizes and faster page load times in front-end environments
|
|
24
25
|
- Compatibility tested with Node.js and popular front-end tools like Vite
|
|
25
26
|
|
|
26
27
|
## Installation
|
|
27
28
|
|
|
29
|
+
The LI.FI SDK follows a modular architecture. Install the core SDK package and the provider packages for the blockchain ecosystems you need:
|
|
30
|
+
|
|
31
|
+
### Core SDK
|
|
32
|
+
|
|
28
33
|
```bash
|
|
29
34
|
pnpm add @lifi/sdk
|
|
30
35
|
```
|
|
@@ -35,17 +40,95 @@ or
|
|
|
35
40
|
npm install --save @lifi/sdk
|
|
36
41
|
```
|
|
37
42
|
|
|
43
|
+
### Provider Packages
|
|
44
|
+
|
|
45
|
+
Install provider packages based on the blockchain ecosystems you want to support:
|
|
46
|
+
|
|
47
|
+
**EVM Chains (Ethereum, Polygon, Arbitrum, Optimism, etc.)**
|
|
48
|
+
```bash
|
|
49
|
+
pnpm add @lifi/sdk-provider-ethereum
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Solana**
|
|
53
|
+
```bash
|
|
54
|
+
pnpm add @lifi/sdk-provider-solana
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Bitcoin**
|
|
58
|
+
```bash
|
|
59
|
+
pnpm add @lifi/sdk-provider-bitcoin
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Sui**
|
|
63
|
+
```bash
|
|
64
|
+
pnpm add @lifi/sdk-provider-sui
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Tron**
|
|
68
|
+
```bash
|
|
69
|
+
pnpm add @lifi/sdk-provider-tron
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Architecture
|
|
73
|
+
|
|
74
|
+
The LI.FI SDK uses a modular provider architecture:
|
|
75
|
+
|
|
76
|
+
- **`@lifi/sdk`** - Core SDK package containing shared functionality, actions, and execution logic
|
|
77
|
+
- **Provider packages** - Ecosystem-specific packages that handle wallet interactions and transaction execution for different blockchain types
|
|
78
|
+
|
|
79
|
+
This architecture allows you to:
|
|
80
|
+
- Install only the providers you need, reducing bundle size
|
|
81
|
+
- Use ecosystem-specific libraries optimized for each blockchain
|
|
82
|
+
- Maintain clean separation between core SDK logic and blockchain-specific implementations
|
|
83
|
+
|
|
38
84
|
## Quick Start
|
|
39
85
|
|
|
40
86
|
### Set up the SDK
|
|
41
87
|
|
|
42
|
-
|
|
88
|
+
Create SDK config with your integrator string and configure the providers for the blockchain ecosystems you want to support.
|
|
43
89
|
|
|
90
|
+
**For EVM chains:**
|
|
44
91
|
```ts
|
|
45
|
-
import {
|
|
92
|
+
import { createClient } from '@lifi/sdk'
|
|
93
|
+
import { EthereumProvider } from '@lifi/sdk-provider-ethereum'
|
|
94
|
+
import { createWalletClient, http } from 'viem'
|
|
95
|
+
import { mainnet } from 'viem/chains'
|
|
96
|
+
|
|
97
|
+
// Add your account (e.g. privateKeyToAccount, mnemonicToAccount)
|
|
98
|
+
const walletClient = createWalletClient({
|
|
99
|
+
account,
|
|
100
|
+
chain: mainnet,
|
|
101
|
+
transport: http(),
|
|
102
|
+
})
|
|
46
103
|
|
|
47
|
-
|
|
104
|
+
const client = createClient({
|
|
105
|
+
integrator: 'Your dApp/company name',
|
|
106
|
+
providers: [
|
|
107
|
+
EthereumProvider({
|
|
108
|
+
getWalletClient: () => Promise.resolve(walletClient),
|
|
109
|
+
}),
|
|
110
|
+
],
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**For multiple ecosystems:**
|
|
115
|
+
```ts
|
|
116
|
+
import { createClient } from '@lifi/sdk'
|
|
117
|
+
import { EthereumProvider } from '@lifi/sdk-provider-ethereum'
|
|
118
|
+
import { SolanaProvider } from '@lifi/sdk-provider-solana'
|
|
119
|
+
import { BitcoinProvider } from '@lifi/sdk-provider-bitcoin'
|
|
120
|
+
import { SuiProvider } from '@lifi/sdk-provider-sui'
|
|
121
|
+
import { TronProvider } from '@lifi/sdk-provider-tron'
|
|
122
|
+
|
|
123
|
+
const client = createClient({
|
|
48
124
|
integrator: 'Your dApp/company name',
|
|
125
|
+
providers: [
|
|
126
|
+
EthereumProvider({ /* options */ }),
|
|
127
|
+
SolanaProvider({ /* options */ }),
|
|
128
|
+
BitcoinProvider({ /* options */ }),
|
|
129
|
+
SuiProvider({ /* options */ }),
|
|
130
|
+
TronProvider({ /* options */ }),
|
|
131
|
+
],
|
|
49
132
|
})
|
|
50
133
|
```
|
|
51
134
|
|
|
@@ -56,7 +139,7 @@ Now you can interact with the SDK and for example request a quote.
|
|
|
56
139
|
```ts
|
|
57
140
|
import { ChainId, getQuote } from '@lifi/sdk'
|
|
58
141
|
|
|
59
|
-
const quote = await getQuote({
|
|
142
|
+
const quote = await getQuote(client, {
|
|
60
143
|
fromAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
|
|
61
144
|
fromChain: ChainId.ARB,
|
|
62
145
|
toChain: ChainId.OPT,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { SDKBaseConfig, SDKClient } from "../types/core.js";
|
|
2
2
|
import { ChainsRequest, ExtendedChain, RequestOptions } from "@lifi/types";
|
|
3
|
-
|
|
4
3
|
//#region src/actions/getChains.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Get all available chains
|
|
7
|
-
* @param client - The SDK client
|
|
8
|
-
* @param params - The configuration of the requested chains
|
|
9
|
-
* @param options - Request options
|
|
10
|
-
* @returns A list of all available chains
|
|
11
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
12
|
-
*/
|
|
5
|
+
* Get all available chains
|
|
6
|
+
* @param client - The SDK client
|
|
7
|
+
* @param params - The configuration of the requested chains
|
|
8
|
+
* @param options - Request options
|
|
9
|
+
* @returns A list of all available chains
|
|
10
|
+
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
11
|
+
*/
|
|
13
12
|
declare const getChains: (client: SDKClient, params?: ChainsRequest, options?: RequestOptions) => Promise<ExtendedChain[]>;
|
|
14
13
|
declare const _getChains: (config: SDKBaseConfig, params?: ChainsRequest, options?: RequestOptions) => Promise<ExtendedChain[]>;
|
|
15
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getChains.js","names":["withDedupe","request"],"sources":["../../../src/actions/getChains.ts"],"sourcesContent":["import type {\n ChainsRequest,\n ChainsResponse,\n ExtendedChain,\n RequestOptions,\n} from '@lifi/types'\nimport type { SDKBaseConfig, SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\nimport { withDedupe } from '../utils/withDedupe.js'\n\n/**\n * Get all available chains\n * @param client - The SDK client\n * @param params - The configuration of the requested chains\n * @param options - Request options\n * @returns A list of all available chains\n * @throws {LiFiError} Throws a LiFiError if request fails.\n */\nexport const getChains = async (\n client: SDKClient,\n params?: ChainsRequest,\n options?: RequestOptions\n): Promise<ExtendedChain[]> => {\n return await _getChains(client.config, params, options)\n}\n\nexport const _getChains = async (\n config: SDKBaseConfig,\n params?: ChainsRequest,\n options?: RequestOptions\n): Promise<ExtendedChain[]> => {\n if (params) {\n for (const key of Object.keys(params)) {\n const value = params[key as keyof ChainsRequest]\n if (value === undefined || value === null) {\n delete params[key as keyof ChainsRequest]\n }\n }\n }\n const urlSearchParams = new URLSearchParams(\n params as Record<string, string>\n ).toString()\n const response = await withDedupe(\n () =>\n request<ChainsResponse>(\n config,\n `${config.apiUrl}/chains?${urlSearchParams}`,\n {\n signal: options?.signal,\n }\n ),\n { id: `${getChains.name}.${urlSearchParams}` }\n )\n return response.chains\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,YAAY,OACvB,QACA,QACA,YAC6B;CAC7B,OAAO,MAAM,WAAW,OAAO,QAAQ,QAAQ,OAAO;AACxD;AAEA,MAAa,aAAa,OACxB,QACA,QACA,YAC6B;CAC7B,IAAI,QACF,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAAG;EACrC,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAA,KAAa,UAAU,MACnC,OAAO,OAAO;CAElB;CAEF,MAAM,kBAAkB,IAAI,gBAC1B,MACF,
|
|
1
|
+
{"version":3,"file":"getChains.js","names":["withDedupe","request"],"sources":["../../../src/actions/getChains.ts"],"sourcesContent":["import type {\n ChainsRequest,\n ChainsResponse,\n ExtendedChain,\n RequestOptions,\n} from '@lifi/types'\nimport type { SDKBaseConfig, SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\nimport { withDedupe } from '../utils/withDedupe.js'\n\n/**\n * Get all available chains\n * @param client - The SDK client\n * @param params - The configuration of the requested chains\n * @param options - Request options\n * @returns A list of all available chains\n * @throws {LiFiError} Throws a LiFiError if request fails.\n */\nexport const getChains = async (\n client: SDKClient,\n params?: ChainsRequest,\n options?: RequestOptions\n): Promise<ExtendedChain[]> => {\n return await _getChains(client.config, params, options)\n}\n\nexport const _getChains = async (\n config: SDKBaseConfig,\n params?: ChainsRequest,\n options?: RequestOptions\n): Promise<ExtendedChain[]> => {\n if (params) {\n for (const key of Object.keys(params)) {\n const value = params[key as keyof ChainsRequest]\n if (value === undefined || value === null) {\n delete params[key as keyof ChainsRequest]\n }\n }\n }\n const urlSearchParams = new URLSearchParams(\n params as Record<string, string>\n ).toString()\n const response = await withDedupe(\n () =>\n request<ChainsResponse>(\n config,\n `${config.apiUrl}/chains?${urlSearchParams}`,\n {\n signal: options?.signal,\n }\n ),\n { id: `${getChains.name}.${urlSearchParams}` }\n )\n return response.chains\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,YAAY,OACvB,QACA,QACA,YAC6B;CAC7B,OAAO,MAAM,WAAW,OAAO,QAAQ,QAAQ,OAAO;AACxD;AAEA,MAAa,aAAa,OACxB,QACA,QACA,YAC6B;CAC7B,IAAI,QACF,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAAG;EACrC,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAA,KAAa,UAAU,MACnC,OAAO,OAAO;CAElB;CAEF,MAAM,kBAAkB,IAAI,gBAC1B,MACF,CAAC,CAAC,SAAS;CAYX,QAAO,MAXgBA,yBAAAA,iBAEnBC,sBAAAA,QACE,QACA,GAAG,OAAO,OAAO,UAAU,mBAC3B,EACE,QAAQ,SAAS,OACnB,CACF,GACF,EAAE,IAAI,GAAG,UAAU,KAAK,GAAG,kBAAkB,CAC/C,EAAA,CACgB;AAClB"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { ConnectionsRequest, ConnectionsResponse, RequestOptions } from "@lifi/types";
|
|
3
|
-
|
|
4
3
|
//#region src/actions/getConnections.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Get all the available connections for swap/bridging tokens
|
|
7
|
-
* @param client - The SDK client
|
|
8
|
-
* @param connectionRequest ConnectionsRequest
|
|
9
|
-
* @param options - Request options
|
|
10
|
-
* @returns ConnectionsResponse
|
|
11
|
-
*/
|
|
5
|
+
* Get all the available connections for swap/bridging tokens
|
|
6
|
+
* @param client - The SDK client
|
|
7
|
+
* @param connectionRequest ConnectionsRequest
|
|
8
|
+
* @param options - Request options
|
|
9
|
+
* @returns ConnectionsResponse
|
|
10
|
+
*/
|
|
12
11
|
declare const getConnections: (client: SDKClient, connectionRequest: ConnectionsRequest, options?: RequestOptions) => Promise<ConnectionsResponse>;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { getConnections };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { ContractCallsQuoteRequest, LiFiStep, RequestOptions } from "@lifi/types";
|
|
3
|
-
|
|
4
3
|
//#region src/actions/getContractCallsQuote.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Get a quote for a destination contract call
|
|
7
|
-
* @param client - The SDK client
|
|
8
|
-
* @param params - The configuration of the requested destination call
|
|
9
|
-
* @param options - Request options
|
|
10
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
11
|
-
* @returns - Returns step.
|
|
12
|
-
*/
|
|
5
|
+
* Get a quote for a destination contract call
|
|
6
|
+
* @param client - The SDK client
|
|
7
|
+
* @param params - The configuration of the requested destination call
|
|
8
|
+
* @param options - Request options
|
|
9
|
+
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
10
|
+
* @returns - Returns step.
|
|
11
|
+
*/
|
|
13
12
|
declare const getContractCallsQuote: (client: SDKClient, params: ContractCallsQuoteRequest, options?: RequestOptions) => Promise<LiFiStep>;
|
|
14
13
|
//#endregion
|
|
15
14
|
export { getContractCallsQuote };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContractCallsQuote.js","names":["SDKError","ValidationError","request"],"sources":["../../../src/actions/getContractCallsQuote.ts"],"sourcesContent":["import type {\n ContractCallsQuoteRequest,\n LiFiStep,\n RequestOptions,\n} from '@lifi/types'\nimport {\n isContractCallsRequestWithFromAmount,\n isContractCallsRequestWithToAmount,\n} from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a quote for a destination contract call\n * @param client - The SDK client\n * @param params - The configuration of the requested destination call\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns - Returns step.\n */\nexport const getContractCallsQuote = async (\n client: SDKClient,\n params: ContractCallsQuoteRequest,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n // validation\n const requiredParameters: Array<keyof ContractCallsQuoteRequest> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'toChain',\n 'toToken',\n 'contractCalls',\n ]\n for (const requiredParameter of requiredParameters) {\n if (!params[requiredParameter]) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"${requiredParameter}\" is missing.`\n )\n )\n }\n }\n if (\n !isContractCallsRequestWithFromAmount(params) &&\n !isContractCallsRequestWithToAmount(params)\n ) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"fromAmount\" or \"toAmount\" is missing.`\n )\n )\n }\n // apply defaults\n // option.order is not used in this endpoint\n params.integrator ??= client.config.integrator\n params.slippage ??= client.config.routeOptions?.slippage\n params.referrer ??= client.config.routeOptions?.referrer\n params.fee ??= client.config.routeOptions?.fee\n params.allowBridges ??= client.config.routeOptions?.bridges?.allow\n params.denyBridges ??= client.config.routeOptions?.bridges?.deny\n params.preferBridges ??= client.config.routeOptions?.bridges?.prefer\n params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow\n params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny\n params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer\n // send request\n return await request<LiFiStep>(\n client.config,\n `${client.config.apiUrl}/quote/contractCalls`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params),\n signal: options?.signal,\n }\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB,OACnC,QACA,QACA,YACsB;CAUtB,KAAK,MAAM,qBAAqB;EAP9B;EACA;EACA;EACA;EACA;EACA;CAE+C,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAGJ,IACE,EAAA,GAAA,YAAA,
|
|
1
|
+
{"version":3,"file":"getContractCallsQuote.js","names":["SDKError","ValidationError","request"],"sources":["../../../src/actions/getContractCallsQuote.ts"],"sourcesContent":["import type {\n ContractCallsQuoteRequest,\n LiFiStep,\n RequestOptions,\n} from '@lifi/types'\nimport {\n isContractCallsRequestWithFromAmount,\n isContractCallsRequestWithToAmount,\n} from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a quote for a destination contract call\n * @param client - The SDK client\n * @param params - The configuration of the requested destination call\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns - Returns step.\n */\nexport const getContractCallsQuote = async (\n client: SDKClient,\n params: ContractCallsQuoteRequest,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n // validation\n const requiredParameters: Array<keyof ContractCallsQuoteRequest> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'toChain',\n 'toToken',\n 'contractCalls',\n ]\n for (const requiredParameter of requiredParameters) {\n if (!params[requiredParameter]) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"${requiredParameter}\" is missing.`\n )\n )\n }\n }\n if (\n !isContractCallsRequestWithFromAmount(params) &&\n !isContractCallsRequestWithToAmount(params)\n ) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"fromAmount\" or \"toAmount\" is missing.`\n )\n )\n }\n // apply defaults\n // option.order is not used in this endpoint\n params.integrator ??= client.config.integrator\n params.slippage ??= client.config.routeOptions?.slippage\n params.referrer ??= client.config.routeOptions?.referrer\n params.fee ??= client.config.routeOptions?.fee\n params.allowBridges ??= client.config.routeOptions?.bridges?.allow\n params.denyBridges ??= client.config.routeOptions?.bridges?.deny\n params.preferBridges ??= client.config.routeOptions?.bridges?.prefer\n params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow\n params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny\n params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer\n // send request\n return await request<LiFiStep>(\n client.config,\n `${client.config.apiUrl}/quote/contractCalls`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params),\n signal: options?.signal,\n }\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB,OACnC,QACA,QACA,YACsB;CAUtB,KAAK,MAAM,qBAAqB;EAP9B;EACA;EACA;EACA;EACA;EACA;CAE+C,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAGJ,IACE,EAAA,GAAA,YAAA,qCAAA,CAAsC,MAAM,KAC5C,EAAA,GAAA,YAAA,mCAAA,CAAoC,MAAM,GAE1C,MAAM,IAAID,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,2DACF,CACF;CAIF,OAAO,eAAe,OAAO,OAAO;CACpC,OAAO,aAAa,OAAO,OAAO,cAAc;CAChD,OAAO,aAAa,OAAO,OAAO,cAAc;CAChD,OAAO,QAAQ,OAAO,OAAO,cAAc;CAC3C,OAAO,iBAAiB,OAAO,OAAO,cAAc,SAAS;CAC7D,OAAO,gBAAgB,OAAO,OAAO,cAAc,SAAS;CAC5D,OAAO,kBAAkB,OAAO,OAAO,cAAc,SAAS;CAC9D,OAAO,mBAAmB,OAAO,OAAO,cAAc,WAAW;CACjE,OAAO,kBAAkB,OAAO,OAAO,cAAc,WAAW;CAChE,OAAO,oBAAoB,OAAO,OAAO,cAAc,WAAW;CAElE,OAAO,MAAMC,sBAAAA,QACX,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,uBACxB;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,mBAClB;EACA,MAAM,KAAK,UAAU,MAAM;EAC3B,QAAQ,SAAS;CACnB,CACF;AACF"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { GasRecommendationRequest, GasRecommendationResponse, RequestOptions } from "@lifi/types";
|
|
3
|
-
|
|
4
3
|
//#region src/actions/getGasRecommendation.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Get gas recommendation for a certain chain
|
|
7
|
-
* @param client - The SDK client
|
|
8
|
-
* @param params - Configuration of the requested gas recommendation.
|
|
9
|
-
* @param options - Request options
|
|
10
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
11
|
-
* @returns Gas recommendation response.
|
|
12
|
-
*/
|
|
5
|
+
* Get gas recommendation for a certain chain
|
|
6
|
+
* @param client - The SDK client
|
|
7
|
+
* @param params - Configuration of the requested gas recommendation.
|
|
8
|
+
* @param options - Request options
|
|
9
|
+
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
10
|
+
* @returns Gas recommendation response.
|
|
11
|
+
*/
|
|
13
12
|
declare const getGasRecommendation: (client: SDKClient, params: GasRecommendationRequest, options?: RequestOptions) => Promise<GasRecommendationResponse>;
|
|
14
13
|
//#endregion
|
|
15
14
|
export { getGasRecommendation };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { ChainType } from "@lifi/types";
|
|
3
|
-
|
|
4
3
|
//#region src/actions/getNameServiceAddress.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Get the address of a name service
|
|
7
|
-
* @param client - The SDK client
|
|
8
|
-
* @param name - The name to resolve
|
|
9
|
-
* @param chainType - The chain type to resolve the name on
|
|
10
|
-
* @returns The address of the name service
|
|
11
|
-
*/
|
|
5
|
+
* Get the address of a name service
|
|
6
|
+
* @param client - The SDK client
|
|
7
|
+
* @param name - The name to resolve
|
|
8
|
+
* @param chainType - The chain type to resolve the name on
|
|
9
|
+
* @returns The address of the name service
|
|
10
|
+
*/
|
|
12
11
|
declare const getNameServiceAddress: (client: SDKClient, name: string, chainType?: ChainType) => Promise<string | undefined>;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { getNameServiceAddress };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { QuoteRequestFromAmount, QuoteRequestToAmount } from "../types/actions.js";
|
|
3
3
|
import { LiFiStep, RequestOptions } from "@lifi/types";
|
|
4
|
-
|
|
5
4
|
//#region src/actions/getQuote.d.ts
|
|
6
5
|
/**
|
|
7
|
-
* Get a quote for a token transfer
|
|
8
|
-
* @param client - The SDK client
|
|
9
|
-
* @param params - The configuration of the requested quote
|
|
10
|
-
* @param options - Request options
|
|
11
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
12
|
-
* @returns Quote for a token transfer
|
|
13
|
-
*/
|
|
6
|
+
* Get a quote for a token transfer
|
|
7
|
+
* @param client - The SDK client
|
|
8
|
+
* @param params - The configuration of the requested quote
|
|
9
|
+
* @param options - Request options
|
|
10
|
+
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
11
|
+
* @returns Quote for a token transfer
|
|
12
|
+
*/
|
|
14
13
|
declare function getQuote(client: SDKClient, params: QuoteRequestFromAmount, options?: RequestOptions): Promise<LiFiStep>;
|
|
15
14
|
declare function getQuote(client: SDKClient, params: QuoteRequestToAmount, options?: RequestOptions): Promise<LiFiStep>;
|
|
16
15
|
//#endregion
|
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_errors_errors = require("../errors/errors.js");
|
|
3
3
|
const require_errors_SDKError = require("../errors/SDKError.js");
|
|
4
4
|
const require_utils_request = require("../utils/request.js");
|
|
5
|
+
const require_utils_toQueryString = require("../utils/toQueryString.js");
|
|
5
6
|
//#region src/actions/getQuote.ts
|
|
6
7
|
async function getQuote(client, params, options) {
|
|
7
8
|
for (const requiredParameter of [
|
|
@@ -27,7 +28,7 @@ async function getQuote(client, params, options) {
|
|
|
27
28
|
params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny;
|
|
28
29
|
params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer;
|
|
29
30
|
for (const key of Object.keys(params)) if (params[key] === void 0 || params[key] === null) delete params[key];
|
|
30
|
-
return await require_utils_request.request(client.config, `${client.config.apiUrl}/${isFromAmountRequest ? "quote" : "quote/toAmount"}?${
|
|
31
|
+
return await require_utils_request.request(client.config, `${client.config.apiUrl}/${isFromAmountRequest ? "quote" : "quote/toAmount"}?${require_utils_toQueryString.toQueryString(params)}`, { signal: options?.signal });
|
|
31
32
|
}
|
|
32
33
|
//#endregion
|
|
33
34
|
exports.getQuote = getQuote;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQuote.js","names":["SDKError","ValidationError","request"],"sources":["../../../src/actions/getQuote.ts"],"sourcesContent":["import type { LiFiStep, RequestOptions } from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type {\n QuoteRequest,\n QuoteRequestFromAmount,\n QuoteRequestToAmount,\n} from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a quote for a token transfer\n * @param client - The SDK client\n * @param params - The configuration of the requested quote\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Quote for a token transfer\n */\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n): Promise<LiFiStep>\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequestToAmount,\n options?: RequestOptions\n): Promise<LiFiStep>\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequest,\n options?: RequestOptions\n): Promise<LiFiStep> {\n const requiredParameters: Array<keyof QuoteRequest> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'toChain',\n 'toToken',\n ]\n\n for (const requiredParameter of requiredParameters) {\n if (!params[requiredParameter]) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"${requiredParameter}\" is missing.`\n )\n )\n }\n }\n\n const isFromAmountRequest =\n 'fromAmount' in params && params.fromAmount !== undefined\n const isToAmountRequest =\n 'toAmount' in params && params.toAmount !== undefined\n\n if (!isFromAmountRequest && !isToAmountRequest) {\n throw new SDKError(\n new ValidationError(\n 'Required parameter \"fromAmount\" or \"toAmount\" is missing.'\n )\n )\n }\n\n if (isFromAmountRequest && isToAmountRequest) {\n throw new SDKError(\n new ValidationError(\n 'Cannot provide both \"fromAmount\" and \"toAmount\" parameters.'\n )\n )\n }\n\n // apply defaults\n params.integrator ??= client.config.integrator\n params.order ??= client.config.routeOptions?.order\n params.slippage ??= client.config.routeOptions?.slippage\n params.referrer ??= client.config.routeOptions?.referrer\n params.fee ??= client.config.routeOptions?.fee\n params.allowBridges ??= client.config.routeOptions?.bridges?.allow\n params.denyBridges ??= client.config.routeOptions?.bridges?.deny\n params.preferBridges ??= client.config.routeOptions?.bridges?.prefer\n params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow\n params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny\n params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer\n\n for (const key of Object.keys(params)) {\n if (\n params[key as keyof QuoteRequest] === undefined ||\n params[key as keyof QuoteRequest] === null\n ) {\n delete params[key as keyof QuoteRequest]\n }\n }\n\n return await request<LiFiStep>(\n client.config,\n `${client.config.apiUrl}/${isFromAmountRequest ? 'quote' : 'quote/toAmount'}?${
|
|
1
|
+
{"version":3,"file":"getQuote.js","names":["SDKError","ValidationError","request","toQueryString"],"sources":["../../../src/actions/getQuote.ts"],"sourcesContent":["import type { LiFiStep, RequestOptions } from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type {\n QuoteRequest,\n QuoteRequestFromAmount,\n QuoteRequestToAmount,\n} from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\nimport { toQueryString } from '../utils/toQueryString.js'\n\n/**\n * Get a quote for a token transfer\n * @param client - The SDK client\n * @param params - The configuration of the requested quote\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Quote for a token transfer\n */\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n): Promise<LiFiStep>\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequestToAmount,\n options?: RequestOptions\n): Promise<LiFiStep>\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequest,\n options?: RequestOptions\n): Promise<LiFiStep> {\n const requiredParameters: Array<keyof QuoteRequest> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'toChain',\n 'toToken',\n ]\n\n for (const requiredParameter of requiredParameters) {\n if (!params[requiredParameter]) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"${requiredParameter}\" is missing.`\n )\n )\n }\n }\n\n const isFromAmountRequest =\n 'fromAmount' in params && params.fromAmount !== undefined\n const isToAmountRequest =\n 'toAmount' in params && params.toAmount !== undefined\n\n if (!isFromAmountRequest && !isToAmountRequest) {\n throw new SDKError(\n new ValidationError(\n 'Required parameter \"fromAmount\" or \"toAmount\" is missing.'\n )\n )\n }\n\n if (isFromAmountRequest && isToAmountRequest) {\n throw new SDKError(\n new ValidationError(\n 'Cannot provide both \"fromAmount\" and \"toAmount\" parameters.'\n )\n )\n }\n\n // apply defaults\n params.integrator ??= client.config.integrator\n params.order ??= client.config.routeOptions?.order\n params.slippage ??= client.config.routeOptions?.slippage\n params.referrer ??= client.config.routeOptions?.referrer\n params.fee ??= client.config.routeOptions?.fee\n params.allowBridges ??= client.config.routeOptions?.bridges?.allow\n params.denyBridges ??= client.config.routeOptions?.bridges?.deny\n params.preferBridges ??= client.config.routeOptions?.bridges?.prefer\n params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow\n params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny\n params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer\n\n for (const key of Object.keys(params)) {\n if (\n params[key as keyof QuoteRequest] === undefined ||\n params[key as keyof QuoteRequest] === null\n ) {\n delete params[key as keyof QuoteRequest]\n }\n }\n\n return await request<LiFiStep>(\n client.config,\n `${client.config.apiUrl}/${isFromAmountRequest ? 'quote' : 'quote/toAmount'}?${toQueryString(\n params as Record<string, unknown>\n )}`,\n {\n signal: options?.signal,\n }\n )\n}\n"],"mappings":";;;;;;AA8BA,eAAsB,SACpB,QACA,QACA,SACmB;CASnB,KAAK,MAAM,qBAAqB;EAP9B;EACA;EACA;EACA;EACA;CAG+C,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAIJ,MAAM,sBACJ,gBAAgB,UAAU,OAAO,eAAe,KAAA;CAClD,MAAM,oBACJ,cAAc,UAAU,OAAO,aAAa,KAAA;CAE9C,IAAI,CAAC,uBAAuB,CAAC,mBAC3B,MAAM,IAAID,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,+DACF,CACF;CAGF,IAAI,uBAAuB,mBACzB,MAAM,IAAID,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,iEACF,CACF;CAIF,OAAO,eAAe,OAAO,OAAO;CACpC,OAAO,UAAU,OAAO,OAAO,cAAc;CAC7C,OAAO,aAAa,OAAO,OAAO,cAAc;CAChD,OAAO,aAAa,OAAO,OAAO,cAAc;CAChD,OAAO,QAAQ,OAAO,OAAO,cAAc;CAC3C,OAAO,iBAAiB,OAAO,OAAO,cAAc,SAAS;CAC7D,OAAO,gBAAgB,OAAO,OAAO,cAAc,SAAS;CAC5D,OAAO,kBAAkB,OAAO,OAAO,cAAc,SAAS;CAC9D,OAAO,mBAAmB,OAAO,OAAO,cAAc,WAAW;CACjE,OAAO,kBAAkB,OAAO,OAAO,cAAc,WAAW;CAChE,OAAO,oBAAoB,OAAO,OAAO,cAAc,WAAW;CAElE,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAClC,IACE,OAAO,SAA+B,KAAA,KACtC,OAAO,SAA+B,MAEtC,OAAO,OAAO;CAIlB,OAAO,MAAMC,sBAAAA,QACX,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,GAAG,sBAAsB,UAAU,iBAAiB,GAAGC,4BAAAA,cAC7E,MACF,KACA,EACE,QAAQ,SAAS,OACnB,CACF;AACF"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { RelayStatusRequest, RelayStatusResponseData, RequestOptions } from "@lifi/types";
|
|
3
|
-
|
|
4
3
|
//#region src/actions/getRelayedTransactionStatus.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Get the status of a relayed transaction
|
|
7
|
-
* @param client - The SDK client
|
|
8
|
-
* @param params - Parameters for the relay status request
|
|
9
|
-
* @param options - Request options
|
|
10
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
11
|
-
* @returns Status of the relayed transaction
|
|
12
|
-
*/
|
|
5
|
+
* Get the status of a relayed transaction
|
|
6
|
+
* @param client - The SDK client
|
|
7
|
+
* @param params - Parameters for the relay status request
|
|
8
|
+
* @param options - Request options
|
|
9
|
+
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
10
|
+
* @returns Status of the relayed transaction
|
|
11
|
+
*/
|
|
13
12
|
declare const getRelayedTransactionStatus: (client: SDKClient, params: RelayStatusRequest, options?: RequestOptions) => Promise<RelayStatusResponseData>;
|
|
14
13
|
//#endregion
|
|
15
14
|
export { getRelayedTransactionStatus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRelayedTransactionStatus.js","names":["SDKError","ValidationError","decodeTaskId","getStatus","request","BaseError"],"sources":["../../../src/actions/getRelayedTransactionStatus.ts"],"sourcesContent":["import type {\n RelayStatusRequest,\n RelayStatusResponse,\n RelayStatusResponseData,\n RequestOptions,\n} from '@lifi/types'\nimport { BaseError } from '../errors/baseError.js'\nimport { ErrorName } from '../errors/constants.js'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type { SDKClient } from '../types/core.js'\nimport { decodeTaskId } from '../utils/decode.js'\nimport { request } from '../utils/request.js'\nimport { getStatus } from './getStatus.js'\n\n/**\n * Get the status of a relayed transaction\n * @param client - The SDK client\n * @param params - Parameters for the relay status request\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Status of the relayed transaction\n */\nexport const getRelayedTransactionStatus = async (\n client: SDKClient,\n params: RelayStatusRequest,\n options?: RequestOptions\n): Promise<RelayStatusResponseData> => {\n if (!params.taskId) {\n throw new SDKError(\n new ValidationError('Required parameter \"taskId\" is missing.')\n )\n }\n\n const { taskId, ...otherParams } = params\n const queryParams = new URLSearchParams(\n otherParams as unknown as Record<string, string>\n )\n\n const decodedTaskId = decodeTaskId(taskId)\n // Temporary solution during the transition between status endpoints\n if (decodedTaskId.length >= 3) {\n return (await getStatus(\n client,\n params,\n options\n )) as unknown as RelayStatusResponseData\n }\n\n const result = await request<RelayStatusResponse>(\n client.config,\n `${client.config.apiUrl}/relayer/status/${taskId}?${queryParams}`,\n {\n signal: options?.signal,\n }\n )\n\n if (result.status === 'error') {\n throw new BaseError(\n ErrorName.ServerError,\n result.data.code,\n result.data.message\n )\n }\n\n return result.data\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAa,8BAA8B,OACzC,QACA,QACA,YACqC;CACrC,IAAI,CAAC,OAAO,QACV,MAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBAAgB,2CAAyC,CAC/D;CAGF,MAAM,EAAE,QAAQ,GAAG,gBAAgB;CACnC,MAAM,cAAc,IAAI,gBACtB,WACF;CAIA,IAFsBC,qBAAAA,aAAa,MAEnB,
|
|
1
|
+
{"version":3,"file":"getRelayedTransactionStatus.js","names":["SDKError","ValidationError","decodeTaskId","getStatus","request","BaseError"],"sources":["../../../src/actions/getRelayedTransactionStatus.ts"],"sourcesContent":["import type {\n RelayStatusRequest,\n RelayStatusResponse,\n RelayStatusResponseData,\n RequestOptions,\n} from '@lifi/types'\nimport { BaseError } from '../errors/baseError.js'\nimport { ErrorName } from '../errors/constants.js'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type { SDKClient } from '../types/core.js'\nimport { decodeTaskId } from '../utils/decode.js'\nimport { request } from '../utils/request.js'\nimport { getStatus } from './getStatus.js'\n\n/**\n * Get the status of a relayed transaction\n * @param client - The SDK client\n * @param params - Parameters for the relay status request\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Status of the relayed transaction\n */\nexport const getRelayedTransactionStatus = async (\n client: SDKClient,\n params: RelayStatusRequest,\n options?: RequestOptions\n): Promise<RelayStatusResponseData> => {\n if (!params.taskId) {\n throw new SDKError(\n new ValidationError('Required parameter \"taskId\" is missing.')\n )\n }\n\n const { taskId, ...otherParams } = params\n const queryParams = new URLSearchParams(\n otherParams as unknown as Record<string, string>\n )\n\n const decodedTaskId = decodeTaskId(taskId)\n // Temporary solution during the transition between status endpoints\n if (decodedTaskId.length >= 3) {\n return (await getStatus(\n client,\n params,\n options\n )) as unknown as RelayStatusResponseData\n }\n\n const result = await request<RelayStatusResponse>(\n client.config,\n `${client.config.apiUrl}/relayer/status/${taskId}?${queryParams}`,\n {\n signal: options?.signal,\n }\n )\n\n if (result.status === 'error') {\n throw new BaseError(\n ErrorName.ServerError,\n result.data.code,\n result.data.message\n )\n }\n\n return result.data\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAa,8BAA8B,OACzC,QACA,QACA,YACqC;CACrC,IAAI,CAAC,OAAO,QACV,MAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBAAgB,2CAAyC,CAC/D;CAGF,MAAM,EAAE,QAAQ,GAAG,gBAAgB;CACnC,MAAM,cAAc,IAAI,gBACtB,WACF;CAIA,IAFsBC,qBAAAA,aAAa,MAEnB,CAAC,CAAC,UAAU,GAC1B,OAAQ,MAAMC,0BAAAA,UACZ,QACA,QACA,OACF;CAGF,MAAM,SAAS,MAAMC,sBAAAA,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,kBAAkB,OAAO,GAAG,eACpD,EACE,QAAQ,SAAS,OACnB,CACF;CAEA,IAAI,OAAO,WAAW,SACpB,MAAM,IAAIC,yBAAAA,UAAAA,eAER,OAAO,KAAK,MACZ,OAAO,KAAK,OACd;CAGF,OAAO,OAAO;AAChB"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { QuoteRequestFromAmount } from "../types/actions.js";
|
|
3
3
|
import { LiFiStep, RequestOptions } from "@lifi/types";
|
|
4
|
-
|
|
5
4
|
//#region src/actions/getRelayerQuote.d.ts
|
|
6
5
|
/**
|
|
7
|
-
* Get a relayer quote for a token transfer
|
|
8
|
-
* @param client - The SDK client
|
|
9
|
-
* @param params - The configuration of the requested quote
|
|
10
|
-
* @param options - Request options
|
|
11
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
12
|
-
* @returns Relayer quote for a token transfer
|
|
13
|
-
*/
|
|
6
|
+
* Get a relayer quote for a token transfer
|
|
7
|
+
* @param client - The SDK client
|
|
8
|
+
* @param params - The configuration of the requested quote
|
|
9
|
+
* @param options - Request options
|
|
10
|
+
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
11
|
+
* @returns Relayer quote for a token transfer
|
|
12
|
+
*/
|
|
14
13
|
declare const getRelayerQuote: (client: SDKClient, params: QuoteRequestFromAmount, options?: RequestOptions) => Promise<LiFiStep>;
|
|
15
14
|
//#endregion
|
|
16
15
|
export { getRelayerQuote };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { RoutesRequest as RoutesRequest$1 } from "../types/actions.js";
|
|
3
|
+
import { RequestOptions, RoutesResponse } from "@lifi/types";
|
|
4
4
|
//#region src/actions/getRoutes.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* Get a set of routes for a request that describes a transfer of tokens.
|
|
7
|
-
* @param client - The SDK client.
|
|
8
|
-
* @param params - A description of the transfer.
|
|
9
|
-
* @param options - Request options
|
|
10
|
-
* @returns The resulting routes that can be used to realize the described transfer of tokens.
|
|
11
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
12
|
-
*/
|
|
13
|
-
declare const getRoutes: (client: SDKClient, params: RoutesRequest, options?: RequestOptions) => Promise<RoutesResponse>;
|
|
6
|
+
* Get a set of routes for a request that describes a transfer of tokens.
|
|
7
|
+
* @param client - The SDK client.
|
|
8
|
+
* @param params - A description of the transfer.
|
|
9
|
+
* @param options - Request options
|
|
10
|
+
* @returns The resulting routes that can be used to realize the described transfer of tokens.
|
|
11
|
+
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
12
|
+
*/
|
|
13
|
+
declare const getRoutes: (client: SDKClient, params: RoutesRequest$1, options?: RequestOptions) => Promise<RoutesResponse>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { getRoutes };
|
|
16
16
|
//# sourceMappingURL=getRoutes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRoutes.js","names":["isRoutesRequest","SDKError","ValidationError","request"],"sources":["../../../src/actions/getRoutes.ts"],"sourcesContent":["import type { RequestOptions,
|
|
1
|
+
{"version":3,"file":"getRoutes.js","names":["isRoutesRequest","SDKError","ValidationError","request"],"sources":["../../../src/actions/getRoutes.ts"],"sourcesContent":["import type { RequestOptions, RoutesResponse } from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type { RoutesRequest } from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { isRoutesRequest } from '../utils/isRoutesRequest.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a set of routes for a request that describes a transfer of tokens.\n * @param client - The SDK client.\n * @param params - A description of the transfer.\n * @param options - Request options\n * @returns The resulting routes that can be used to realize the described transfer of tokens.\n * @throws {LiFiError} Throws a LiFiError if request fails.\n */\nexport const getRoutes = async (\n client: SDKClient,\n params: RoutesRequest,\n options?: RequestOptions\n): Promise<RoutesResponse> => {\n if (!isRoutesRequest(params)) {\n throw new SDKError(new ValidationError('Invalid routes request.'))\n }\n // apply defaults\n params.options = {\n integrator: client.config.integrator,\n ...client.config.routeOptions,\n ...params.options,\n }\n\n return await request<RoutesResponse>(\n client.config,\n `${client.config.apiUrl}/advanced/routes`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params),\n signal: options?.signal,\n }\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAa,YAAY,OACvB,QACA,QACA,YAC4B;CAC5B,IAAI,CAACA,8BAAAA,gBAAgB,MAAM,GACzB,MAAM,IAAIC,wBAAAA,SAAS,IAAIC,sBAAAA,gBAAgB,yBAAyB,CAAC;CAGnE,OAAO,UAAU;EACf,YAAY,OAAO,OAAO;EAC1B,GAAG,OAAO,OAAO;EACjB,GAAG,OAAO;CACZ;CAEA,OAAO,MAAMC,sBAAAA,QACX,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,mBACxB;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,mBAClB;EACA,MAAM,KAAK,UAAU,MAAM;EAC3B,QAAQ,SAAS;CACnB,CACF;AACF"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { GetStatusRequestExtended } from "../types/actions.js";
|
|
3
3
|
import { RequestOptions, StatusResponse } from "@lifi/types";
|
|
4
|
-
|
|
5
4
|
//#region src/actions/getStatus.d.ts
|
|
6
5
|
/**
|
|
7
|
-
* Check the status of a transfer. For cross chain transfers, the "bridge" parameter is required.
|
|
8
|
-
* @param client - The SDK client
|
|
9
|
-
* @param params - Configuration of the requested status
|
|
10
|
-
* @param options - Request options.
|
|
11
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
12
|
-
* @returns Returns status response.
|
|
13
|
-
*/
|
|
6
|
+
* Check the status of a transfer. For cross chain transfers, the "bridge" parameter is required.
|
|
7
|
+
* @param client - The SDK client
|
|
8
|
+
* @param params - Configuration of the requested status
|
|
9
|
+
* @param options - Request options.
|
|
10
|
+
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
11
|
+
* @returns Returns status response.
|
|
12
|
+
*/
|
|
14
13
|
declare const getStatus: (client: SDKClient, params: GetStatusRequestExtended, options?: RequestOptions) => Promise<StatusResponse>;
|
|
15
14
|
//#endregion
|
|
16
15
|
export { getStatus };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { LiFiStepRequest } from "../types/actions.js";
|
|
3
|
+
import { LiFiStep, RequestOptions } from "@lifi/types";
|
|
4
4
|
//#region src/actions/getStepTransaction.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* Get the transaction data for a single step of a route
|
|
7
|
-
* @param client - The SDK client
|
|
8
|
-
* @param step - The step object.
|
|
9
|
-
* @param options - Request options
|
|
10
|
-
* @returns The step populated with the transaction data.
|
|
11
|
-
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
12
|
-
*/
|
|
13
|
-
declare const getStepTransaction: (client: SDKClient, step:
|
|
6
|
+
* Get the transaction data for a single step of a route
|
|
7
|
+
* @param client - The SDK client
|
|
8
|
+
* @param step - The step object.
|
|
9
|
+
* @param options - Request options
|
|
10
|
+
* @returns The step populated with the transaction data.
|
|
11
|
+
* @throws {LiFiError} Throws a LiFiError if request fails.
|
|
12
|
+
*/
|
|
13
|
+
declare const getStepTransaction: (client: SDKClient, step: LiFiStepRequest, options?: RequestOptions) => Promise<LiFiStep>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { getStepTransaction };
|
|
16
16
|
//# sourceMappingURL=getStepTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStepTransaction.js","names":["isStep","ChainId","request"],"sources":["../../../src/actions/getStepTransaction.ts"],"sourcesContent":["import type { LiFiStep, RequestOptions
|
|
1
|
+
{"version":3,"file":"getStepTransaction.js","names":["isStep","ChainId","request"],"sources":["../../../src/actions/getStepTransaction.ts"],"sourcesContent":["import type { LiFiStep, RequestOptions } from '@lifi/types'\nimport { ChainId } from '@lifi/types'\nimport type { LiFiStepRequest } from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { isStep } from '../utils/isStep.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get the transaction data for a single step of a route\n * @param client - The SDK client\n * @param step - The step object.\n * @param options - Request options\n * @returns The step populated with the transaction data.\n * @throws {LiFiError} Throws a LiFiError if request fails.\n */\nexport const getStepTransaction = async (\n client: SDKClient,\n step: LiFiStepRequest,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n if (!isStep(step)) {\n // While the validation fails for some users we should not enforce it\n console.warn('SDK Validation: Invalid Step', step)\n }\n\n const { config } = client\n\n let requestUrl = `${config.apiUrl}/advanced/stepTransaction`\n const jitoBundle = config.routeOptions?.jitoBundle\n const svmSponsor = config.routeOptions?.svmSponsor\n\n if (step.action.fromChainId === ChainId.SOL) {\n const queryParams = new URLSearchParams()\n if (jitoBundle) {\n queryParams.set('jitoBundle', jitoBundle.toString())\n }\n if (svmSponsor) {\n queryParams.set('svmSponsor', svmSponsor)\n }\n if (queryParams.size > 0) {\n requestUrl = `${requestUrl}?${queryParams}`\n }\n }\n\n return await request<LiFiStep>(config, requestUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(step),\n signal: options?.signal,\n })\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,qBAAqB,OAChC,QACA,MACA,YACsB;CACtB,IAAI,CAACA,qBAAAA,OAAO,IAAI,GAEd,QAAQ,KAAK,gCAAgC,IAAI;CAGnD,MAAM,EAAE,WAAW;CAEnB,IAAI,aAAa,GAAG,OAAO,OAAO;CAClC,MAAM,aAAa,OAAO,cAAc;CACxC,MAAM,aAAa,OAAO,cAAc;CAExC,IAAI,KAAK,OAAO,gBAAgBC,YAAAA,QAAQ,KAAK;EAC3C,MAAM,cAAc,IAAI,gBAAgB;EACxC,IAAI,YACF,YAAY,IAAI,cAAc,WAAW,SAAS,CAAC;EAErD,IAAI,YACF,YAAY,IAAI,cAAc,UAAU;EAE1C,IAAI,YAAY,OAAO,GACrB,aAAa,GAAG,WAAW,GAAG;CAElC;CAEA,OAAO,MAAMC,sBAAAA,QAAkB,QAAQ,YAAY;EACjD,QAAQ;EACR,SAAS,EACP,gBAAgB,mBAClB;EACA,MAAM,KAAK,UAAU,IAAI;EACzB,QAAQ,SAAS;CACnB,CAAC;AACH"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { ChainId, ChainKey, RequestOptions, TokenExtended } from "@lifi/types";
|
|
3
|
-
|
|
4
3
|
//#region src/actions/getToken.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Fetch information about a Token
|
|
7
|
-
* @param client - The SDK client
|
|
8
|
-
* @param chain - Id or key of the chain that contains the token
|
|
9
|
-
* @param token - Address or symbol of the token on the requested chain
|
|
10
|
-
* @param options - Request options
|
|
11
|
-
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
12
|
-
* @returns Token information
|
|
13
|
-
*/
|
|
5
|
+
* Fetch information about a Token
|
|
6
|
+
* @param client - The SDK client
|
|
7
|
+
* @param chain - Id or key of the chain that contains the token
|
|
8
|
+
* @param token - Address or symbol of the token on the requested chain
|
|
9
|
+
* @param options - Request options
|
|
10
|
+
* @throws {LiFiError} - Throws a LiFiError if request fails
|
|
11
|
+
* @returns Token information
|
|
12
|
+
*/
|
|
14
13
|
declare const getToken: (client: SDKClient, chain: ChainKey | ChainId, token: string, options?: RequestOptions) => Promise<TokenExtended>;
|
|
15
14
|
//#endregion
|
|
16
15
|
export { getToken };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SDKClient } from "../types/core.js";
|
|
2
2
|
import { Token, TokenAmount } from "@lifi/types";
|
|
3
|
-
|
|
4
3
|
//#region src/actions/getTokenBalance.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* Returns the balances of a specific token a wallet holds across all aggregated chains.
|
|
7
|
-
* @param client - The SDK client.
|
|
8
|
-
* @param walletAddress - A wallet address.
|
|
9
|
-
* @param token - A Token object.
|
|
10
|
-
* @returns An object containing the token and the amounts on different chains.
|
|
11
|
-
* @throws {ValidationError} Throws a ValidationError if validation fails.
|
|
12
|
-
* @throws {Error} Throws an Error if the SDK Provider for the wallet address is not found.
|
|
13
|
-
*/
|
|
5
|
+
* Returns the balances of a specific token a wallet holds across all aggregated chains.
|
|
6
|
+
* @param client - The SDK client.
|
|
7
|
+
* @param walletAddress - A wallet address.
|
|
8
|
+
* @param token - A Token object.
|
|
9
|
+
* @returns An object containing the token and the amounts on different chains.
|
|
10
|
+
* @throws {ValidationError} Throws a ValidationError if validation fails.
|
|
11
|
+
* @throws {Error} Throws an Error if the SDK Provider for the wallet address is not found.
|
|
12
|
+
*/
|
|
14
13
|
declare const getTokenBalance: (client: SDKClient, walletAddress: string, token: Token) => Promise<TokenAmount | null>;
|
|
15
14
|
//#endregion
|
|
16
15
|
export { getTokenBalance };
|