@lifi/sdk 0.0.0-preview-c996a5fb → 0.0.0-preview-9b9526be

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 (48) hide show
  1. package/CHANGELOG.md +1 -23
  2. package/dist/cjs/actions/getRelayerQuote.d.ts +0 -3
  3. package/dist/cjs/actions/getRelayerQuote.js +0 -3
  4. package/dist/cjs/actions/getRelayerQuote.js.map +1 -1
  5. package/dist/cjs/actions/index.d.ts +0 -2
  6. package/dist/cjs/actions/index.js.map +1 -1
  7. package/dist/cjs/actions/relayTransaction.js +2 -1
  8. package/dist/cjs/actions/relayTransaction.js.map +1 -1
  9. package/dist/cjs/core/tasks/CheckBalanceTask.js.map +1 -1
  10. package/dist/cjs/index.d.ts +1 -2
  11. package/dist/cjs/index.js +0 -3
  12. package/dist/cjs/utils/checkPackageUpdates.js +1 -1
  13. package/dist/cjs/version.d.ts +1 -1
  14. package/dist/cjs/version.js +1 -1
  15. package/dist/cjs/version.js.map +1 -1
  16. package/dist/esm/actions/getRelayerQuote.d.ts +0 -3
  17. package/dist/esm/actions/getRelayerQuote.d.ts.map +1 -1
  18. package/dist/esm/actions/getRelayerQuote.js +0 -3
  19. package/dist/esm/actions/getRelayerQuote.js.map +1 -1
  20. package/dist/esm/actions/index.d.ts +0 -2
  21. package/dist/esm/actions/index.d.ts.map +1 -1
  22. package/dist/esm/actions/index.js.map +1 -1
  23. package/dist/esm/actions/relayTransaction.js +2 -1
  24. package/dist/esm/actions/relayTransaction.js.map +1 -1
  25. package/dist/esm/core/tasks/CheckBalanceTask.js.map +1 -1
  26. package/dist/esm/index.d.ts +1 -2
  27. package/dist/esm/index.js +1 -2
  28. package/dist/esm/types/core.d.ts.map +1 -1
  29. package/dist/esm/utils/checkPackageUpdates.js +1 -1
  30. package/dist/esm/version.d.ts +1 -1
  31. package/dist/esm/version.js +1 -1
  32. package/dist/esm/version.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/actions/getRelayerQuote.ts +0 -3
  35. package/src/actions/index.ts +1 -3
  36. package/src/actions/relayTransaction.ts +9 -1
  37. package/src/core/tasks/CheckBalanceTask.ts +1 -1
  38. package/src/index.ts +1 -6
  39. package/src/types/core.ts +3 -2
  40. package/src/version.ts +1 -1
  41. package/dist/cjs/utils/isGaslessStep.d.ts +0 -13
  42. package/dist/cjs/utils/isGaslessStep.js +0 -20
  43. package/dist/cjs/utils/isGaslessStep.js.map +0 -1
  44. package/dist/esm/utils/isGaslessStep.d.ts +0 -14
  45. package/dist/esm/utils/isGaslessStep.d.ts.map +0 -1
  46. package/dist/esm/utils/isGaslessStep.js +0 -18
  47. package/dist/esm/utils/isGaslessStep.js.map +0 -1
  48. package/src/utils/isGaslessStep.ts +0 -21
package/CHANGELOG.md CHANGED
@@ -1,28 +1,6 @@
1
1
  # @lifi/sdk
2
2
 
3
- ## 0.0.0-preview-c996a5fb
4
-
5
- ### Minor Changes
6
-
7
- - [#548](https://github.com/lifinance/sdk/pull/548) [`de384d3`](https://github.com/lifinance/sdk/commit/de384d3fffbe0f87f73f268529b8f528cf2c4a8b) Thanks [@chybisov](https://github.com/chybisov)! - Support the new LI.FI gasless flow, and stop calling the legacy gasless service.
8
-
9
- Request a gasless route with `options.gasless: true`. The `LIFI Gasless Relay Fee` entry in `estimate.feeCosts` marks its step. The new `isGaslessStep(step)` in `@lifi/sdk` checks for this marker, and `GASLESS_RELAY_FEE_NAME` holds its name.
10
-
11
- For a gasless step, the EVM provider now does the following:
12
-
13
- - It executes the step through the relayer from the start.
14
- - It does not check native gas, does not approve, and does not sign its own permit. The relayer pays the gas, and the backend handles the allowance.
15
- - It re-quotes through `/advanced/stepTransaction` without the old typed data.
16
- - It relays every typed-data step through `/advanced/relay`, including `PermitWitnessTransferFrom`.
17
- - It tracks the relay on `/v1/status?taskId=`, with the same wait as other relayed steps. Other relayed steps keep `getRelayedTransactionStatus`. On a bridge route, the wait ends when the relayed source transaction has landed. A later bridge failure then does not cause a second signature. After a `FAILED` answer, the SDK reads the source receipt to find out if the source landed.
18
- - It fails before signing when `disableMessageSigning` is set, or when the step needs an EIP-7702 authorization.
19
-
20
- For all relayed steps, the wait now ends after five status errors in a row, not after three errors in total. A status answer resets the count. A failed request, `NOT_FOUND` and 422/1004 count as errors. The error is not final, so a resume waits for the same task and asks for no new signature.
21
-
22
- Deprecated (still exported, so that published consumers keep building):
23
-
24
- - `getRelayerQuote` in `@lifi/sdk` and in the client actions. The legacy relayer endpoint is shut down. Use `getRoutes` with `options.gasless: true`.
25
- - `isGaslessStep(step, chain)` in `@lifi/sdk-provider-ethereum`. It detects only the legacy typed data. Use `isGaslessStep(step)` from `@lifi/sdk`.
3
+ ## 0.0.0-preview-9b9526be
26
4
 
27
5
  ### Patch Changes
28
6
 
@@ -8,8 +8,5 @@ import { LiFiStep, RequestOptions } from "@lifi/types";
8
8
  * @param options - Request options
9
9
  * @throws {LiFiError} - Throws a LiFiError if request fails
10
10
  * @returns Relayer quote for a token transfer
11
- * @deprecated The legacy gasless relayer service is shut down. Request
12
- * gasless routes with `options.gasless: true` on `getRoutes`, or
13
- * `gasless: true` on `getQuote`, and detect them with `isGaslessStep`.
14
11
  */
15
12
  export declare const getRelayerQuote: (client: SDKClient, params: QuoteRequestFromAmount, options?: RequestOptions) => Promise<LiFiStep>;
@@ -12,9 +12,6 @@ const require_utils_request = require("../utils/request.js");
12
12
  * @param options - Request options
13
13
  * @throws {LiFiError} - Throws a LiFiError if request fails
14
14
  * @returns Relayer quote for a token transfer
15
- * @deprecated The legacy gasless relayer service is shut down. Request
16
- * gasless routes with `options.gasless: true` on `getRoutes`, or
17
- * `gasless: true` on `getQuote`, and detect them with `isGaslessStep`.
18
15
  */
19
16
  const getRelayerQuote = async (client, params, options) => {
20
17
  for (const requiredParameter of [
@@ -1 +1 @@
1
- {"version":3,"file":"getRelayerQuote.js","names":["SDKError","ValidationError","request","BaseError"],"sources":["../../../src/actions/getRelayerQuote.ts"],"sourcesContent":["import type {\n LiFiStep,\n RelayerQuoteResponse,\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 { QuoteRequest, QuoteRequestFromAmount } from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a relayer 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 Relayer quote for a token transfer\n * @deprecated The legacy gasless relayer service is shut down. Request\n * gasless routes with `options.gasless: true` on `getRoutes`, or\n * `gasless: true` on `getQuote`, and detect them with `isGaslessStep`.\n */\nexport const getRelayerQuote = async (\n client: SDKClient,\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n const requiredParameters: Array<keyof QuoteRequestFromAmount> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'fromAmount',\n 'toChain',\n 'toToken',\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 // 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 const result = await request<RelayerQuoteResponse>(\n client.config,\n `${client.config.apiUrl}/relayer/quote?${new URLSearchParams(\n params as unknown as Record<string, string>\n )}`,\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":";;;;;;;;;;;;;;;;;;AAwBA,MAAa,kBAAkB,OAC7B,QACA,QACA,YACsB;CAStB,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;CAKJ,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,MAAM,SAAS,MAAMC,sBAAAA,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,iBAAiB,IAAI,gBAC3C,MACF,KACA,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
+ {"version":3,"file":"getRelayerQuote.js","names":["SDKError","ValidationError","request","BaseError"],"sources":["../../../src/actions/getRelayerQuote.ts"],"sourcesContent":["import type {\n LiFiStep,\n RelayerQuoteResponse,\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 { QuoteRequest, QuoteRequestFromAmount } from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a relayer 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 Relayer quote for a token transfer\n */\nexport const getRelayerQuote = async (\n client: SDKClient,\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n const requiredParameters: Array<keyof QuoteRequestFromAmount> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'fromAmount',\n 'toChain',\n 'toToken',\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 // 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 const result = await request<RelayerQuoteResponse>(\n client.config,\n `${client.config.apiUrl}/relayer/quote?${new URLSearchParams(\n params as unknown as Record<string, string>\n )}`,\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":";;;;;;;;;;;;;;;AAqBA,MAAa,kBAAkB,OAC7B,QACA,QACA,YACsB;CAStB,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;CAKJ,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,MAAM,SAAS,MAAMC,sBAAAA,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,iBAAiB,IAAI,gBAC3C,MACF,KACA,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"}
@@ -58,8 +58,6 @@ export type Actions = {
58
58
  * @param params - The configuration of the requested relayer quote
59
59
  * @param options - Request options
60
60
  * @returns Quote from a relayer
61
- * @deprecated The legacy gasless relayer service is shut down. Use
62
- * `getRoutes` with `options.gasless: true`.
63
61
  */
64
62
  getRelayerQuote: (params: QuoteRequestFromAmount, options?: RequestOptions) => Promise<LiFiStep>;
65
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getChains","getConnections","getContractCallsQuote","getGasRecommendation","getNameServiceAddress","getTokens","getTools","getQuote","getRelayedTransactionStatus","getRelayerQuote","getRoutes","getStatus","getStepTransaction","getToken","getTokenBalance","getTokenBalances","getTokenBalancesByChain","getTransactionHistory","relayTransaction","patchContractCalls"],"sources":["../../../src/actions/index.ts"],"sourcesContent":["import type {\n ChainId,\n ChainKey,\n ChainsRequest,\n ChainType,\n ConnectionsRequest,\n ConnectionsResponse,\n ContractCallsQuoteRequest,\n ExtendedChain,\n GasRecommendationRequest,\n GasRecommendationResponse,\n LiFiStep,\n PatchCallDataRequest,\n RelayRequest,\n RelayResponseData,\n RelayStatusRequest,\n RelayStatusResponseData,\n RequestOptions,\n RoutesResponse,\n StatusResponse,\n Token,\n TokenAmount,\n TokenExtended,\n TokensExtendedResponse,\n TokensRequest,\n TokensResponse,\n ToolsRequest,\n ToolsResponse,\n TransactionAnalyticsRequest,\n TransactionAnalyticsResponse,\n} from '@lifi/types'\nimport type {\n GetStatusRequestExtended,\n LiFiStepRequest,\n QuoteRequestFromAmount,\n RoutesRequest,\n} from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { getChains } from './getChains.js'\nimport { getConnections } from './getConnections.js'\nimport { getContractCallsQuote } from './getContractCallsQuote.js'\nimport { getGasRecommendation } from './getGasRecommendation.js'\nimport { getNameServiceAddress } from './getNameServiceAddress.js'\nimport { getQuote } from './getQuote.js'\nimport { getRelayedTransactionStatus } from './getRelayedTransactionStatus.js'\nimport { getRelayerQuote } from './getRelayerQuote.js'\nimport { getRoutes } from './getRoutes.js'\nimport { getStatus } from './getStatus.js'\nimport { getStepTransaction } from './getStepTransaction.js'\nimport { getToken } from './getToken.js'\nimport { getTokenBalance } from './getTokenBalance.js'\nimport { getTokenBalances } from './getTokenBalances.js'\nimport { getTokenBalancesByChain } from './getTokenBalancesByChain.js'\nimport { getTokens } from './getTokens.js'\nimport { getTools } from './getTools.js'\nimport { getTransactionHistory } from './getTransactionHistory.js'\nimport {\n type PatchContractCallsResponse,\n patchContractCalls,\n} from './patchContractCalls.js'\nimport { relayTransaction } from './relayTransaction.js'\n\nexport type Actions = {\n /**\n * Get all available chains\n * @param params - The configuration of the requested chains\n * @param options - Request options\n * @returns A list of all available chains\n */\n getChains: (\n params?: ChainsRequest,\n options?: RequestOptions\n ) => Promise<ExtendedChain[]>\n\n /**\n * Get connections between chains\n * @param params - The configuration of the requested connections\n * @param options - Request options\n * @returns A list of connections\n */\n getConnections: (\n params: ConnectionsRequest,\n options?: RequestOptions\n ) => Promise<ConnectionsResponse>\n\n /**\n * Get a quote for contract calls\n * @param params - The configuration of the requested contract calls quote\n * @param options - Request options\n * @returns Quote for contract calls\n */\n getContractCallsQuote: (\n params: ContractCallsQuoteRequest,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get gas recommendation for a chain\n * @param params - The configuration of the requested gas recommendation\n * @param options - Request options\n * @returns Gas recommendation\n */\n getGasRecommendation: (\n params: GasRecommendationRequest,\n options?: RequestOptions\n ) => Promise<GasRecommendationResponse>\n\n /**\n * Get the address of a name service\n * @param name - The name to resolve\n * @param chainType - The chain type to resolve the name on\n * @returns The address of the name service\n */\n getNameServiceAddress: (\n name: string,\n chainType?: ChainType\n ) => Promise<string | undefined>\n\n /**\n * Get a quote for a token transfer\n * @param params - The configuration of the requested quote\n * @param options - Request options\n * @returns Quote for a token transfer\n */\n getQuote: (\n params: Parameters<typeof getQuote>[1],\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get the status of a relayed transaction\n * @param params - The configuration of the requested relay status\n * @param options - Request options\n * @returns Status of the relayed transaction\n */\n getRelayedTransactionStatus: (\n params: RelayStatusRequest,\n options?: RequestOptions\n ) => Promise<RelayStatusResponseData>\n\n /**\n * Get a quote from a relayer\n * @param params - The configuration of the requested relayer quote\n * @param options - Request options\n * @returns Quote from a relayer\n * @deprecated The legacy gasless relayer service is shut down. Use\n * `getRoutes` with `options.gasless: true`.\n */\n getRelayerQuote: (\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get a set of routes for a request that describes a transfer of tokens.\n * Optional limit-order fields (`toAmount`, `validUntil`, `partiallyFillable`)\n * may be supplied and are resolved on the backend.\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\n */\n getRoutes: (\n params: RoutesRequest,\n options?: RequestOptions\n ) => Promise<RoutesResponse>\n\n /**\n * Get the status of a transaction\n * @param params - The configuration of the requested status\n * @param options - Request options\n * @returns Status of the transaction\n */\n getStatus: (\n params: GetStatusRequestExtended,\n options?: RequestOptions\n ) => Promise<StatusResponse>\n\n /**\n * Get a step transaction. The step's `action` may carry the optional\n * limit-order fields, which are resolved on the backend.\n * @param params - The configuration of the requested step transaction\n * @param options - Request options\n * @returns Step transaction\n */\n getStepTransaction: (\n params: LiFiStepRequest,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get a specific token\n * @param chain - Id or key of the chain that contains the token\n * @param token - Address or symbol of the token on the requested chain\n * @param options - Request options\n * @returns Token information\n */\n getToken: (\n chain: ChainKey | ChainId,\n token: string,\n options?: RequestOptions\n ) => Promise<TokenExtended>\n\n /**\n * Get token balance for a specific token\n * @param walletAddress - A wallet address\n * @param token - A Token object\n * @returns Token balance\n */\n getTokenBalance: (\n walletAddress: string,\n token: Token\n ) => Promise<TokenAmount | null>\n\n /**\n * Get token balances for multiple tokens\n * @param walletAddress - A wallet address\n * @param tokens - A list of Token objects\n * @returns Token balances\n */\n getTokenBalances: (\n walletAddress: string,\n tokens: Token[]\n ) => Promise<TokenAmount[]>\n\n /**\n * Get token balances by chain\n * @param walletAddress - A wallet address\n * @param tokensByChain - A list of token objects organized by chain ids\n * @returns Token balances by chain\n */\n getTokenBalancesByChain: (\n walletAddress: string,\n tokensByChain: { [chainId: number]: Token[] }\n ) => Promise<{\n [chainId: number]: TokenAmount[]\n }>\n\n /**\n * Get all available tokens\n * @param params - The configuration of the requested tokens\n * @param options - Request options\n * @returns A list of all available tokens\n */\n getTokens: {\n (\n params?: TokensRequest & { extended?: false | undefined },\n options?: RequestOptions\n ): Promise<TokensResponse>\n (\n params: TokensRequest & { extended: true },\n options?: RequestOptions\n ): Promise<TokensExtendedResponse>\n }\n\n /**\n * Get all available tools (bridges and exchanges)\n * @param params - The configuration of the requested tools\n * @param options - Request options\n * @returns A list of all available tools\n */\n getTools: (\n params?: ToolsRequest,\n options?: RequestOptions\n ) => Promise<ToolsResponse>\n\n /**\n * Get transaction history\n * @param params - The configuration of the requested transaction history\n * @param options - Request options\n * @returns Transaction history\n */\n getTransactionHistory: (\n params: TransactionAnalyticsRequest,\n options?: RequestOptions\n ) => Promise<TransactionAnalyticsResponse>\n\n /**\n * Relay a transaction through the relayer service\n * @param params - The configuration for the relay request\n * @param options - Request options\n * @returns Task ID and transaction link for the relayed transaction\n */\n relayTransaction: (\n params: RelayRequest,\n options?: RequestOptions\n ) => Promise<RelayResponseData>\n\n /**\n * Patch contract calls\n * @param params - The configuration for the patch contract calls request\n * @param options - Request options\n * @returns Patched contract calls\n */\n patchContractCalls: (\n params: PatchCallDataRequest,\n options?: RequestOptions\n ) => Promise<PatchContractCallsResponse[]>\n}\n\nexport function actions(client: SDKClient): Actions {\n return {\n getChains: (params, options) => getChains(client, params, options),\n getConnections: (params, options) =>\n getConnections(client, params, options),\n getContractCallsQuote: (params, options) =>\n getContractCallsQuote(client, params, options),\n getGasRecommendation: (params, options) =>\n getGasRecommendation(client, params, options),\n getNameServiceAddress: (name, chainType) =>\n getNameServiceAddress(client, name, chainType),\n getTokens: (params, options) => getTokens(client, params as any, options),\n getTools: (params, options) => getTools(client, params, options),\n getQuote: (params, options) => getQuote(client, params, options),\n getRelayedTransactionStatus: (params, options) =>\n getRelayedTransactionStatus(client, params, options),\n getRelayerQuote: (params, options) =>\n getRelayerQuote(client, params, options),\n getRoutes: (params, options) => getRoutes(client, params, options),\n getStatus: (params, options) => getStatus(client, params, options),\n getStepTransaction: (params, options) =>\n getStepTransaction(client, params, options),\n getToken: (chain, token, options) =>\n getToken(client, chain, token, options),\n getTokenBalance: (walletAddress, token) =>\n getTokenBalance(client, walletAddress, token),\n getTokenBalances: (walletAddress, tokens) =>\n getTokenBalances(client, walletAddress, tokens),\n getTokenBalancesByChain: (walletAddress, tokensByChain) =>\n getTokenBalancesByChain(client, walletAddress, tokensByChain),\n getTransactionHistory: (params, options) =>\n getTransactionHistory(client, params, options),\n relayTransaction: (params, options) =>\n relayTransaction(client, params, options),\n patchContractCalls: (params, options) =>\n patchContractCalls(client, params, options),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2SA,SAAgB,QAAQ,QAA4B;CAClD,OAAO;EACL,YAAY,QAAQ,YAAYA,0BAAAA,UAAU,QAAQ,QAAQ,OAAO;EACjE,iBAAiB,QAAQ,YACvBC,+BAAAA,eAAe,QAAQ,QAAQ,OAAO;EACxC,wBAAwB,QAAQ,YAC9BC,sCAAAA,sBAAsB,QAAQ,QAAQ,OAAO;EAC/C,uBAAuB,QAAQ,YAC7BC,qCAAAA,qBAAqB,QAAQ,QAAQ,OAAO;EAC9C,wBAAwB,MAAM,cAC5BC,sCAAAA,sBAAsB,QAAQ,MAAM,SAAS;EAC/C,YAAY,QAAQ,YAAYC,0BAAAA,UAAU,QAAQ,QAAe,OAAO;EACxE,WAAW,QAAQ,YAAYC,yBAAAA,SAAS,QAAQ,QAAQ,OAAO;EAC/D,WAAW,QAAQ,YAAYC,yBAAAA,SAAS,QAAQ,QAAQ,OAAO;EAC/D,8BAA8B,QAAQ,YACpCC,4CAAAA,4BAA4B,QAAQ,QAAQ,OAAO;EACrD,kBAAkB,QAAQ,YACxBC,gCAAAA,gBAAgB,QAAQ,QAAQ,OAAO;EACzC,YAAY,QAAQ,YAAYC,0BAAAA,UAAU,QAAQ,QAAQ,OAAO;EACjE,YAAY,QAAQ,YAAYC,0BAAAA,UAAU,QAAQ,QAAQ,OAAO;EACjE,qBAAqB,QAAQ,YAC3BC,mCAAAA,mBAAmB,QAAQ,QAAQ,OAAO;EAC5C,WAAW,OAAO,OAAO,YACvBC,yBAAAA,SAAS,QAAQ,OAAO,OAAO,OAAO;EACxC,kBAAkB,eAAe,UAC/BC,gCAAAA,gBAAgB,QAAQ,eAAe,KAAK;EAC9C,mBAAmB,eAAe,WAChCC,iCAAAA,iBAAiB,QAAQ,eAAe,MAAM;EAChD,0BAA0B,eAAe,kBACvCC,wCAAAA,wBAAwB,QAAQ,eAAe,aAAa;EAC9D,wBAAwB,QAAQ,YAC9BC,sCAAAA,sBAAsB,QAAQ,QAAQ,OAAO;EAC/C,mBAAmB,QAAQ,YACzBC,iCAAAA,iBAAiB,QAAQ,QAAQ,OAAO;EAC1C,qBAAqB,QAAQ,YAC3BC,mCAAAA,mBAAmB,QAAQ,QAAQ,OAAO;CAC9C;AACF"}
1
+ {"version":3,"file":"index.js","names":["getChains","getConnections","getContractCallsQuote","getGasRecommendation","getNameServiceAddress","getTokens","getTools","getQuote","getRelayedTransactionStatus","getRelayerQuote","getRoutes","getStatus","getStepTransaction","getToken","getTokenBalance","getTokenBalances","getTokenBalancesByChain","getTransactionHistory","relayTransaction","patchContractCalls"],"sources":["../../../src/actions/index.ts"],"sourcesContent":["import type {\n ChainId,\n ChainKey,\n ChainsRequest,\n ChainType,\n ConnectionsRequest,\n ConnectionsResponse,\n ContractCallsQuoteRequest,\n ExtendedChain,\n GasRecommendationRequest,\n GasRecommendationResponse,\n LiFiStep,\n PatchCallDataRequest,\n RelayRequest,\n RelayResponseData,\n RelayStatusRequest,\n RelayStatusResponseData,\n RequestOptions,\n RoutesResponse,\n StatusResponse,\n Token,\n TokenAmount,\n TokenExtended,\n TokensExtendedResponse,\n TokensRequest,\n TokensResponse,\n ToolsRequest,\n ToolsResponse,\n TransactionAnalyticsRequest,\n TransactionAnalyticsResponse,\n} from '@lifi/types'\nimport type {\n GetStatusRequestExtended,\n LiFiStepRequest,\n QuoteRequestFromAmount,\n RoutesRequest,\n} from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { getChains } from './getChains.js'\nimport { getConnections } from './getConnections.js'\nimport { getContractCallsQuote } from './getContractCallsQuote.js'\nimport { getGasRecommendation } from './getGasRecommendation.js'\nimport { getNameServiceAddress } from './getNameServiceAddress.js'\nimport { getQuote } from './getQuote.js'\nimport { getRelayedTransactionStatus } from './getRelayedTransactionStatus.js'\nimport { getRelayerQuote } from './getRelayerQuote.js'\nimport { getRoutes } from './getRoutes.js'\nimport { getStatus } from './getStatus.js'\nimport { getStepTransaction } from './getStepTransaction.js'\nimport { getToken } from './getToken.js'\nimport { getTokenBalance } from './getTokenBalance.js'\nimport { getTokenBalances } from './getTokenBalances.js'\nimport { getTokenBalancesByChain } from './getTokenBalancesByChain.js'\nimport { getTokens } from './getTokens.js'\nimport { getTools } from './getTools.js'\nimport { getTransactionHistory } from './getTransactionHistory.js'\nimport {\n patchContractCalls,\n type PatchContractCallsResponse,\n} from './patchContractCalls.js'\nimport { relayTransaction } from './relayTransaction.js'\n\nexport type Actions = {\n /**\n * Get all available chains\n * @param params - The configuration of the requested chains\n * @param options - Request options\n * @returns A list of all available chains\n */\n getChains: (\n params?: ChainsRequest,\n options?: RequestOptions\n ) => Promise<ExtendedChain[]>\n\n /**\n * Get connections between chains\n * @param params - The configuration of the requested connections\n * @param options - Request options\n * @returns A list of connections\n */\n getConnections: (\n params: ConnectionsRequest,\n options?: RequestOptions\n ) => Promise<ConnectionsResponse>\n\n /**\n * Get a quote for contract calls\n * @param params - The configuration of the requested contract calls quote\n * @param options - Request options\n * @returns Quote for contract calls\n */\n getContractCallsQuote: (\n params: ContractCallsQuoteRequest,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get gas recommendation for a chain\n * @param params - The configuration of the requested gas recommendation\n * @param options - Request options\n * @returns Gas recommendation\n */\n getGasRecommendation: (\n params: GasRecommendationRequest,\n options?: RequestOptions\n ) => Promise<GasRecommendationResponse>\n\n /**\n * Get the address of a name service\n * @param name - The name to resolve\n * @param chainType - The chain type to resolve the name on\n * @returns The address of the name service\n */\n getNameServiceAddress: (\n name: string,\n chainType?: ChainType\n ) => Promise<string | undefined>\n\n /**\n * Get a quote for a token transfer\n * @param params - The configuration of the requested quote\n * @param options - Request options\n * @returns Quote for a token transfer\n */\n getQuote: (\n params: Parameters<typeof getQuote>[1],\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get the status of a relayed transaction\n * @param params - The configuration of the requested relay status\n * @param options - Request options\n * @returns Status of the relayed transaction\n */\n getRelayedTransactionStatus: (\n params: RelayStatusRequest,\n options?: RequestOptions\n ) => Promise<RelayStatusResponseData>\n\n /**\n * Get a quote from a relayer\n * @param params - The configuration of the requested relayer quote\n * @param options - Request options\n * @returns Quote from a relayer\n */\n getRelayerQuote: (\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get a set of routes for a request that describes a transfer of tokens.\n * Optional limit-order fields (`toAmount`, `validUntil`, `partiallyFillable`)\n * may be supplied and are resolved on the backend.\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\n */\n getRoutes: (\n params: RoutesRequest,\n options?: RequestOptions\n ) => Promise<RoutesResponse>\n\n /**\n * Get the status of a transaction\n * @param params - The configuration of the requested status\n * @param options - Request options\n * @returns Status of the transaction\n */\n getStatus: (\n params: GetStatusRequestExtended,\n options?: RequestOptions\n ) => Promise<StatusResponse>\n\n /**\n * Get a step transaction. The step's `action` may carry the optional\n * limit-order fields, which are resolved on the backend.\n * @param params - The configuration of the requested step transaction\n * @param options - Request options\n * @returns Step transaction\n */\n getStepTransaction: (\n params: LiFiStepRequest,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get a specific token\n * @param chain - Id or key of the chain that contains the token\n * @param token - Address or symbol of the token on the requested chain\n * @param options - Request options\n * @returns Token information\n */\n getToken: (\n chain: ChainKey | ChainId,\n token: string,\n options?: RequestOptions\n ) => Promise<TokenExtended>\n\n /**\n * Get token balance for a specific token\n * @param walletAddress - A wallet address\n * @param token - A Token object\n * @returns Token balance\n */\n getTokenBalance: (\n walletAddress: string,\n token: Token\n ) => Promise<TokenAmount | null>\n\n /**\n * Get token balances for multiple tokens\n * @param walletAddress - A wallet address\n * @param tokens - A list of Token objects\n * @returns Token balances\n */\n getTokenBalances: (\n walletAddress: string,\n tokens: Token[]\n ) => Promise<TokenAmount[]>\n\n /**\n * Get token balances by chain\n * @param walletAddress - A wallet address\n * @param tokensByChain - A list of token objects organized by chain ids\n * @returns Token balances by chain\n */\n getTokenBalancesByChain: (\n walletAddress: string,\n tokensByChain: { [chainId: number]: Token[] }\n ) => Promise<{\n [chainId: number]: TokenAmount[]\n }>\n\n /**\n * Get all available tokens\n * @param params - The configuration of the requested tokens\n * @param options - Request options\n * @returns A list of all available tokens\n */\n getTokens: {\n (\n params?: TokensRequest & { extended?: false | undefined },\n options?: RequestOptions\n ): Promise<TokensResponse>\n (\n params: TokensRequest & { extended: true },\n options?: RequestOptions\n ): Promise<TokensExtendedResponse>\n }\n\n /**\n * Get all available tools (bridges and exchanges)\n * @param params - The configuration of the requested tools\n * @param options - Request options\n * @returns A list of all available tools\n */\n getTools: (\n params?: ToolsRequest,\n options?: RequestOptions\n ) => Promise<ToolsResponse>\n\n /**\n * Get transaction history\n * @param params - The configuration of the requested transaction history\n * @param options - Request options\n * @returns Transaction history\n */\n getTransactionHistory: (\n params: TransactionAnalyticsRequest,\n options?: RequestOptions\n ) => Promise<TransactionAnalyticsResponse>\n\n /**\n * Relay a transaction through the relayer service\n * @param params - The configuration for the relay request\n * @param options - Request options\n * @returns Task ID and transaction link for the relayed transaction\n */\n relayTransaction: (\n params: RelayRequest,\n options?: RequestOptions\n ) => Promise<RelayResponseData>\n\n /**\n * Patch contract calls\n * @param params - The configuration for the patch contract calls request\n * @param options - Request options\n * @returns Patched contract calls\n */\n patchContractCalls: (\n params: PatchCallDataRequest,\n options?: RequestOptions\n ) => Promise<PatchContractCallsResponse[]>\n}\n\nexport function actions(client: SDKClient): Actions {\n return {\n getChains: (params, options) => getChains(client, params, options),\n getConnections: (params, options) =>\n getConnections(client, params, options),\n getContractCallsQuote: (params, options) =>\n getContractCallsQuote(client, params, options),\n getGasRecommendation: (params, options) =>\n getGasRecommendation(client, params, options),\n getNameServiceAddress: (name, chainType) =>\n getNameServiceAddress(client, name, chainType),\n getTokens: (params, options) => getTokens(client, params as any, options),\n getTools: (params, options) => getTools(client, params, options),\n getQuote: (params, options) => getQuote(client, params, options),\n getRelayedTransactionStatus: (params, options) =>\n getRelayedTransactionStatus(client, params, options),\n getRelayerQuote: (params, options) =>\n getRelayerQuote(client, params, options),\n getRoutes: (params, options) => getRoutes(client, params, options),\n getStatus: (params, options) => getStatus(client, params, options),\n getStepTransaction: (params, options) =>\n getStepTransaction(client, params, options),\n getToken: (chain, token, options) =>\n getToken(client, chain, token, options),\n getTokenBalance: (walletAddress, token) =>\n getTokenBalance(client, walletAddress, token),\n getTokenBalances: (walletAddress, tokens) =>\n getTokenBalances(client, walletAddress, tokens),\n getTokenBalancesByChain: (walletAddress, tokensByChain) =>\n getTokenBalancesByChain(client, walletAddress, tokensByChain),\n getTransactionHistory: (params, options) =>\n getTransactionHistory(client, params, options),\n relayTransaction: (params, options) =>\n relayTransaction(client, params, options),\n patchContractCalls: (params, options) =>\n patchContractCalls(client, params, options),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAySA,SAAgB,QAAQ,QAA4B;CAClD,OAAO;EACL,YAAY,QAAQ,YAAYA,0BAAAA,UAAU,QAAQ,QAAQ,OAAO;EACjE,iBAAiB,QAAQ,YACvBC,+BAAAA,eAAe,QAAQ,QAAQ,OAAO;EACxC,wBAAwB,QAAQ,YAC9BC,sCAAAA,sBAAsB,QAAQ,QAAQ,OAAO;EAC/C,uBAAuB,QAAQ,YAC7BC,qCAAAA,qBAAqB,QAAQ,QAAQ,OAAO;EAC9C,wBAAwB,MAAM,cAC5BC,sCAAAA,sBAAsB,QAAQ,MAAM,SAAS;EAC/C,YAAY,QAAQ,YAAYC,0BAAAA,UAAU,QAAQ,QAAe,OAAO;EACxE,WAAW,QAAQ,YAAYC,yBAAAA,SAAS,QAAQ,QAAQ,OAAO;EAC/D,WAAW,QAAQ,YAAYC,yBAAAA,SAAS,QAAQ,QAAQ,OAAO;EAC/D,8BAA8B,QAAQ,YACpCC,4CAAAA,4BAA4B,QAAQ,QAAQ,OAAO;EACrD,kBAAkB,QAAQ,YACxBC,gCAAAA,gBAAgB,QAAQ,QAAQ,OAAO;EACzC,YAAY,QAAQ,YAAYC,0BAAAA,UAAU,QAAQ,QAAQ,OAAO;EACjE,YAAY,QAAQ,YAAYC,0BAAAA,UAAU,QAAQ,QAAQ,OAAO;EACjE,qBAAqB,QAAQ,YAC3BC,mCAAAA,mBAAmB,QAAQ,QAAQ,OAAO;EAC5C,WAAW,OAAO,OAAO,YACvBC,yBAAAA,SAAS,QAAQ,OAAO,OAAO,OAAO;EACxC,kBAAkB,eAAe,UAC/BC,gCAAAA,gBAAgB,QAAQ,eAAe,KAAK;EAC9C,mBAAmB,eAAe,WAChCC,iCAAAA,iBAAiB,QAAQ,eAAe,MAAM;EAChD,0BAA0B,eAAe,kBACvCC,wCAAAA,wBAAwB,QAAQ,eAAe,aAAa;EAC9D,wBAAwB,QAAQ,YAC9BC,sCAAAA,sBAAsB,QAAQ,QAAQ,OAAO;EAC/C,mBAAmB,QAAQ,YACzBC,iCAAAA,iBAAiB,QAAQ,QAAQ,OAAO;EAC1C,qBAAqB,QAAQ,YAC3BC,mCAAAA,mBAAmB,QAAQ,QAAQ,OAAO;CAC9C;AACF"}
@@ -15,7 +15,8 @@ const require_utils_request = require("../utils/request.js");
15
15
  */
16
16
  const relayTransaction = async (client, params, options) => {
17
17
  for (const requiredParameter of ["typedData"]) if (!params[requiredParameter]) throw new require_errors_SDKError.SDKError(new require_errors_errors.ValidationError(`Required parameter "${requiredParameter}" is missing.`));
18
- const result = await require_utils_request.request(client.config, `${client.config.apiUrl}/advanced/relay`, {
18
+ const relayerPath = params.typedData.some((t) => t.primaryType === "PermitWitnessTransferFrom") ? "/relayer/relay" : "/advanced/relay";
19
+ const result = await require_utils_request.request(client.config, `${client.config.apiUrl}${relayerPath}`, {
19
20
  method: "POST",
20
21
  headers: { "Content-Type": "application/json" },
21
22
  body: JSON.stringify(params, (_, value) => {
@@ -1 +1 @@
1
- {"version":3,"file":"relayTransaction.js","names":["SDKError","ValidationError","request","BaseError"],"sources":["../../../src/actions/relayTransaction.ts"],"sourcesContent":["import type {\n RelayRequest,\n RelayResponse,\n RelayResponseData,\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 { request } from '../utils/request.js'\n\n/**\n * Relay a transaction through the relayer service\n * @param client - The SDK client\n * @param params - The configuration for the relay request\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Task ID and transaction link for the relayed transaction\n */\nexport const relayTransaction = async (\n client: SDKClient,\n params: RelayRequest,\n options?: RequestOptions\n): Promise<RelayResponseData> => {\n const requiredParameters: Array<keyof RelayRequest> = ['typedData']\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 result = await request<RelayResponse>(\n client.config,\n `${client.config.apiUrl}/advanced/relay`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params, (_, value) => {\n if (typeof value === 'bigint') {\n return value.toString()\n }\n return value\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":";;;;;;;;;;;;;;;AAqBA,MAAa,mBAAmB,OAC9B,QACA,QACA,YAC+B;CAG/B,KAAK,MAAM,qBAAqB,CAFuB,WAEN,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAIJ,MAAM,SAAS,MAAMC,sBAAAA,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,kBACxB;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,mBAClB;EACA,MAAM,KAAK,UAAU,SAAS,GAAG,UAAU;GACzC,IAAI,OAAO,UAAU,UACnB,OAAO,MAAM,SAAS;GAExB,OAAO;EACT,CAAC;EACD,QAAQ,SAAS;CACnB,CACF;CAEA,IAAI,OAAO,WAAW,SACpB,MAAM,IAAIC,yBAAAA,UAAAA,eAER,OAAO,KAAK,MACZ,OAAO,KAAK,OACd;CAGF,OAAO,OAAO;AAChB"}
1
+ {"version":3,"file":"relayTransaction.js","names":["SDKError","ValidationError","request","BaseError"],"sources":["../../../src/actions/relayTransaction.ts"],"sourcesContent":["import type {\n RelayRequest,\n RelayResponse,\n RelayResponseData,\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 { request } from '../utils/request.js'\n\n/**\n * Relay a transaction through the relayer service\n * @param client - The SDK client\n * @param params - The configuration for the relay request\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Task ID and transaction link for the relayed transaction\n */\nexport const relayTransaction = async (\n client: SDKClient,\n params: RelayRequest,\n options?: RequestOptions\n): Promise<RelayResponseData> => {\n const requiredParameters: Array<keyof RelayRequest> = ['typedData']\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 // Determine if the request is for a gasless relayer service or advanced relayer service\n // We will use the same endpoint for both after the gasless relayer service is deprecated\n const relayerPath = params.typedData.some(\n (t) => t.primaryType === 'PermitWitnessTransferFrom'\n )\n ? '/relayer/relay'\n : '/advanced/relay'\n\n const result = await request<RelayResponse>(\n client.config,\n `${client.config.apiUrl}${relayerPath}`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params, (_, value) => {\n if (typeof value === 'bigint') {\n return value.toString()\n }\n return value\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":";;;;;;;;;;;;;;;AAqBA,MAAa,mBAAmB,OAC9B,QACA,QACA,YAC+B;CAG/B,KAAK,MAAM,qBAAqB,CAFuB,WAEN,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAMJ,MAAM,cAAc,OAAO,UAAU,MAClC,MAAM,EAAE,gBAAgB,2BAC3B,IACI,mBACA;CAEJ,MAAM,SAAS,MAAMC,sBAAAA,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,SAAS,eAC1B;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,mBAClB;EACA,MAAM,KAAK,UAAU,SAAS,GAAG,UAAU;GACzC,IAAI,OAAO,UAAU,UACnB,OAAO,MAAM,SAAS;GAExB,OAAO;EACT,CAAC;EACD,QAAQ,SAAS;CACnB,CACF;CAEA,IAAI,OAAO,WAAW,SACpB,MAAM,IAAIC,yBAAAA,UAAAA,eAER,OAAO,KAAK,MACZ,OAAO,KAAK,OACd;CAGF,OAAO,OAAO;AAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckBalanceTask.js","names":["BaseStepExecutionTask","TransactionError","checkBalance"],"sources":["../../../../src/core/tasks/CheckBalanceTask.ts"],"sourcesContent":["import { LiFiErrorCode } from '../../errors/constants.js'\nimport { TransactionError } from '../../errors/errors.js'\nimport type { StepExecutorContext, TaskResult } from '../../types/execution.js'\nimport { BaseStepExecutionTask } from '../BaseStepExecutionTask.js'\nimport {\n type CheckBalanceOptions,\n checkBalance,\n} from './helpers/checkBalance.js'\n\nexport class CheckBalanceTask extends BaseStepExecutionTask {\n /**\n * Per-step options hook for chain-specific subclasses (e.g. skip the\n * gas check for smart-contract wallets or relayed steps). Default `{}`\n * keeps behavior unchanged for every provider that doesn't override.\n * Resolved lazily inside `run()` — pipelines that resume past\n * `CheckBalance` pay no cost.\n */\n protected getCheckBalanceOptions(\n _context: StepExecutorContext\n ): Promise<CheckBalanceOptions> {\n return Promise.resolve({})\n }\n\n async run(context: StepExecutorContext): Promise<TaskResult> {\n const { client, step, statusManager, isBridgeExecution } = context\n\n statusManager.initializeAction({\n step,\n type: isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n const walletAddress = step.action.fromAddress\n if (!walletAddress) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'The wallet address is undefined.'\n )\n }\n\n const options = await this.getCheckBalanceOptions(context)\n await checkBalance(client, walletAddress, step, options)\n return { status: 'COMPLETED' }\n }\n}\n"],"mappings":";;;;;;AASA,IAAa,mBAAb,cAAsCA,mCAAAA,sBAAsB;;;;;;;;CAQ1D,uBACE,UAC8B;EAC9B,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;CAEA,MAAM,IAAI,SAAmD;EAC3D,MAAM,EAAE,QAAQ,MAAM,eAAe,sBAAsB;EAE3D,cAAc,iBAAiB;GAC7B;GACA,MAAM,oBAAoB,gBAAgB;GAC1C,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,MAAM,gBAAgB,KAAK,OAAO;EAClC,IAAI,CAAC,eACH,MAAM,IAAIC,sBAAAA,iBAAAA,KAER,kCACF;EAGF,MAAM,UAAU,MAAM,KAAK,uBAAuB,OAAO;EACzD,MAAMC,wCAAAA,aAAa,QAAQ,eAAe,MAAM,OAAO;EACvD,OAAO,EAAE,QAAQ,YAAY;CAC/B;AACF"}
1
+ {"version":3,"file":"CheckBalanceTask.js","names":["BaseStepExecutionTask","TransactionError","checkBalance"],"sources":["../../../../src/core/tasks/CheckBalanceTask.ts"],"sourcesContent":["import { LiFiErrorCode } from '../../errors/constants.js'\nimport { TransactionError } from '../../errors/errors.js'\nimport type { StepExecutorContext, TaskResult } from '../../types/execution.js'\nimport { BaseStepExecutionTask } from '../BaseStepExecutionTask.js'\nimport {\n checkBalance,\n type CheckBalanceOptions,\n} from './helpers/checkBalance.js'\n\nexport class CheckBalanceTask extends BaseStepExecutionTask {\n /**\n * Per-step options hook for chain-specific subclasses (e.g. skip the\n * gas check for smart-contract wallets or relayed steps). Default `{}`\n * keeps behavior unchanged for every provider that doesn't override.\n * Resolved lazily inside `run()` — pipelines that resume past\n * `CheckBalance` pay no cost.\n */\n protected getCheckBalanceOptions(\n _context: StepExecutorContext\n ): Promise<CheckBalanceOptions> {\n return Promise.resolve({})\n }\n\n async run(context: StepExecutorContext): Promise<TaskResult> {\n const { client, step, statusManager, isBridgeExecution } = context\n\n statusManager.initializeAction({\n step,\n type: isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n const walletAddress = step.action.fromAddress\n if (!walletAddress) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'The wallet address is undefined.'\n )\n }\n\n const options = await this.getCheckBalanceOptions(context)\n await checkBalance(client, walletAddress, step, options)\n return { status: 'COMPLETED' }\n }\n}\n"],"mappings":";;;;;;AASA,IAAa,mBAAb,cAAsCA,mCAAAA,sBAAsB;;;;;;;;CAQ1D,uBACE,UAC8B;EAC9B,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;CAEA,MAAM,IAAI,SAAmD;EAC3D,MAAM,EAAE,QAAQ,MAAM,eAAe,sBAAsB;EAE3D,cAAc,iBAAiB;GAC7B;GACA,MAAM,oBAAoB,gBAAgB;GAC1C,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,MAAM,gBAAgB,KAAK,OAAO;EAClC,IAAI,CAAC,eACH,MAAM,IAAIC,sBAAAA,iBAAAA,KAER,kCACF;EAGF,MAAM,UAAU,MAAM,KAAK,uBAAuB,OAAO;EACzD,MAAMC,wCAAAA,aAAa,QAAQ,eAAe,MAAM,OAAO;EACvD,OAAO,EAAE,QAAQ,YAAY;CAC/B;AACF"}
@@ -48,7 +48,6 @@ import { checkPackageUpdates } from "./utils/checkPackageUpdates.js";
48
48
  import { convertQuoteToRoute } from "./utils/convertQuoteToRoute.js";
49
49
  import { fetchTxErrorDetails } from "./utils/fetchTxErrorDetails.js";
50
50
  import { formatUnits } from "./utils/formatUnits.js";
51
- import { GASLESS_RELAY_FEE_NAME, isGaslessStep } from "./utils/isGaslessStep.js";
52
51
  import { isHex } from "./utils/isHex.js";
53
52
  import { LruMap } from "./utils/lru.js";
54
53
  import { parseUnits } from "./utils/parseUnits.js";
@@ -58,4 +57,4 @@ import { withDedupe } from "./utils/withDedupe.js";
58
57
  import { withTimeout } from "./utils/withTimeout.js";
59
58
  import { name, version } from "./version.js";
60
59
  export * from "@lifi/types";
61
- export { type AcceptExchangeRateUpdateHook, type AcceptSlippageUpdateHook, type AcceptSlippageUpdateHookParams, BalanceError, BaseError, BaseStepExecutionTask, BaseStepExecutor, CLEARED_TRANSACTION_FIELDS, CLOCK_SKEW_MARGIN_MS, type CheckBalanceOptions, CheckBalanceTask, type ContractCallParams, type ContractTool, DROPPED_FALLBACK_AGE_MS, type ErrorCode, ErrorMessage, ErrorName, type ExchangeRateUpdateParams, ExecuteStepRetryError, type ExecuteStepRetryParams, type Execution, type ExecutionAction, type ExecutionActionStatus, type ExecutionActionType, type ExecutionOptions, type ExecutionStatus, GASLESS_RELAY_FEE_NAME, type GetContractCallsHook, type GetContractCallsResult, type GetStatusRequestExtended, HTTPError, InMemoryStorage, type InteractionSettings, LiFiErrorCode, type LiFiStepExtended, type LiFiStepRequest, LocalStorageAdapter, LruMap, MAX_RESEND_AGE_MS, PrepareTransactionTask, ProviderError, type QuoteRequest, type QuoteRequestFromAmount, type QuoteRequestToAmount, RPCError, type RPCUrls, type RPCUrlsByRole, type RPCUrlsConfig, 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 TransactionErrorOptions, type TransactionMethodType, type TransactionParameters, type TransactionRequestParameters, type TransactionRequestUpdateHook, UnknownError, type UpdateRouteHook, ValidationError, WaitForTransactionStatusTask, actions, assertNoOpenTransaction, checkBalance, checkPackageUpdates, convertQuoteToRoute, createClient, createDefaultStorage, executeRoute, fetchTxErrorDetails, findProvider, formatUnits, getActionMessage, getActiveRoute, getActiveRoutes, getChains, getConnections, getContractCallsQuote, getGasRecommendation, getNameServiceAddress, getQuote, getRelayedTransactionStatus, getRelayerQuote, getRoutes, getStatus, getStepTransaction, getSubstatusMessage, getToken, getTokenBalance, getTokenBalances, getTokenBalancesByChain, getTokens, getTools, getTransactionHistory, getTransactionRequestData, hasOpenTransaction, isFinalTransactionError, isGaslessStep, isHex, isKnownToStatusApi, isOldEnoughToDrop, isResendAllowed, name, parseUnits, patchContractCalls, relayTransaction, resumeRoute, sleep, stepComparison, stopRouteExecution, updateRouteExecution, version, waitForResult, withDedupe, withTimeout };
60
+ export { type AcceptExchangeRateUpdateHook, type AcceptSlippageUpdateHook, type AcceptSlippageUpdateHookParams, BalanceError, BaseError, BaseStepExecutionTask, BaseStepExecutor, CLEARED_TRANSACTION_FIELDS, CLOCK_SKEW_MARGIN_MS, type CheckBalanceOptions, CheckBalanceTask, type ContractCallParams, type ContractTool, DROPPED_FALLBACK_AGE_MS, 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, MAX_RESEND_AGE_MS, PrepareTransactionTask, ProviderError, type QuoteRequest, type QuoteRequestFromAmount, type QuoteRequestToAmount, RPCError, type RPCUrls, type RPCUrlsByRole, type RPCUrlsConfig, 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 TransactionErrorOptions, type TransactionMethodType, type TransactionParameters, type TransactionRequestParameters, type TransactionRequestUpdateHook, UnknownError, type UpdateRouteHook, ValidationError, WaitForTransactionStatusTask, actions, assertNoOpenTransaction, checkBalance, checkPackageUpdates, convertQuoteToRoute, createClient, createDefaultStorage, executeRoute, fetchTxErrorDetails, findProvider, formatUnits, getActionMessage, getActiveRoute, getActiveRoutes, getChains, getConnections, getContractCallsQuote, getGasRecommendation, getNameServiceAddress, getQuote, getRelayedTransactionStatus, getRelayerQuote, getRoutes, getStatus, getStepTransaction, getSubstatusMessage, getToken, getTokenBalance, getTokenBalances, getTokenBalancesByChain, getTokens, getTools, getTransactionHistory, getTransactionRequestData, hasOpenTransaction, isFinalTransactionError, isHex, isKnownToStatusApi, isOldEnoughToDrop, isResendAllowed, name, parseUnits, patchContractCalls, relayTransaction, resumeRoute, sleep, stepComparison, stopRouteExecution, updateRouteExecution, version, waitForResult, withDedupe, withTimeout };
package/dist/cjs/index.js CHANGED
@@ -46,7 +46,6 @@ const require_utils_checkPackageUpdates = require("./utils/checkPackageUpdates.j
46
46
  const require_utils_convertQuoteToRoute = require("./utils/convertQuoteToRoute.js");
47
47
  const require_utils_fetchTxErrorDetails = require("./utils/fetchTxErrorDetails.js");
48
48
  const require_utils_formatUnits = require("./utils/formatUnits.js");
49
- const require_utils_isGaslessStep = require("./utils/isGaslessStep.js");
50
49
  const require_utils_isHex = require("./utils/isHex.js");
51
50
  const require_utils_lru = require("./utils/lru.js");
52
51
  const require_utils_parseUnits = require("./utils/parseUnits.js");
@@ -66,7 +65,6 @@ exports.DROPPED_FALLBACK_AGE_MS = require_core_transactionState.DROPPED_FALLBACK
66
65
  exports.ErrorMessage = require_errors_constants.ErrorMessage;
67
66
  exports.ErrorName = require_errors_constants.ErrorName;
68
67
  exports.ExecuteStepRetryError = require_errors_errors.ExecuteStepRetryError;
69
- exports.GASLESS_RELAY_FEE_NAME = require_utils_isGaslessStep.GASLESS_RELAY_FEE_NAME;
70
68
  exports.HTTPError = require_errors_httpError.HTTPError;
71
69
  exports.InMemoryStorage = require_core_storage.InMemoryStorage;
72
70
  exports.LiFiErrorCode = require_errors_constants.LiFiErrorCode;
@@ -120,7 +118,6 @@ exports.getTransactionHistory = require_actions_getTransactionHistory.getTransac
120
118
  exports.getTransactionRequestData = require_core_tasks_helpers_getTransactionRequestData.getTransactionRequestData;
121
119
  exports.hasOpenTransaction = require_core_transactionState.hasOpenTransaction;
122
120
  exports.isFinalTransactionError = require_core_transactionState.isFinalTransactionError;
123
- exports.isGaslessStep = require_utils_isGaslessStep.isGaslessStep;
124
121
  exports.isHex = require_utils_isHex.isHex;
125
122
  exports.isKnownToStatusApi = require_core_tasks_helpers_isKnownToStatusApi.isKnownToStatusApi;
126
123
  exports.isOldEnoughToDrop = require_core_transactionState.isOldEnoughToDrop;
@@ -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 ?? "0.0.0-preview-c996a5fb";
8
+ const currentVersion = packageVersion ?? "0.0.0-preview-9b9526be";
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,2 +1,2 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "0.0.0-preview-c996a5fb";
2
+ export declare const version = "0.0.0-preview-9b9526be";
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  // src/version.ts
3
3
  const name = "@lifi/sdk";
4
- const version = "0.0.0-preview-c996a5fb";
4
+ const version = "0.0.0-preview-9b9526be";
5
5
  exports.name = name;
6
6
  exports.version = version;
7
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk'\nexport const version = '0.0.0-preview-c996a5fb'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk'\nexport const version = '0.0.0-preview-9b9526be'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
@@ -8,9 +8,6 @@ import { LiFiStep, RequestOptions } from "@lifi/types";
8
8
  * @param options - Request options
9
9
  * @throws {LiFiError} - Throws a LiFiError if request fails
10
10
  * @returns Relayer quote for a token transfer
11
- * @deprecated The legacy gasless relayer service is shut down. Request
12
- * gasless routes with `options.gasless: true` on `getRoutes`, or
13
- * `gasless: true` on `getQuote`, and detect them with `isGaslessStep`.
14
11
  */
15
12
  export declare const getRelayerQuote: (client: SDKClient, params: QuoteRequestFromAmount, options?: RequestOptions) => Promise<LiFiStep>;
16
13
  //# sourceMappingURL=getRelayerQuote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRelayerQuote.d.ts","names":[],"sources":["../../../src/actions/getRelayerQuote.ts"],"mappings":";;;;;;;;;;;;;;qBAwBa,kBACX,QAAQ,WACR,QAAQ,wBACR,UAAU,mBACT,QAAQ"}
1
+ {"version":3,"file":"getRelayerQuote.d.ts","names":[],"sources":["../../../src/actions/getRelayerQuote.ts"],"mappings":";;;;;;;;;;;qBAqBa,kBACX,QAAQ,WACR,QAAQ,wBACR,UAAU,mBACT,QAAQ"}
@@ -11,9 +11,6 @@ import { request } from "../utils/request.js";
11
11
  * @param options - Request options
12
12
  * @throws {LiFiError} - Throws a LiFiError if request fails
13
13
  * @returns Relayer quote for a token transfer
14
- * @deprecated The legacy gasless relayer service is shut down. Request
15
- * gasless routes with `options.gasless: true` on `getRoutes`, or
16
- * `gasless: true` on `getQuote`, and detect them with `isGaslessStep`.
17
14
  */
18
15
  const getRelayerQuote = async (client, params, options) => {
19
16
  for (const requiredParameter of [
@@ -1 +1 @@
1
- {"version":3,"file":"getRelayerQuote.js","names":[],"sources":["../../../src/actions/getRelayerQuote.ts"],"sourcesContent":["import type {\n LiFiStep,\n RelayerQuoteResponse,\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 { QuoteRequest, QuoteRequestFromAmount } from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a relayer 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 Relayer quote for a token transfer\n * @deprecated The legacy gasless relayer service is shut down. Request\n * gasless routes with `options.gasless: true` on `getRoutes`, or\n * `gasless: true` on `getQuote`, and detect them with `isGaslessStep`.\n */\nexport const getRelayerQuote = async (\n client: SDKClient,\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n const requiredParameters: Array<keyof QuoteRequestFromAmount> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'fromAmount',\n 'toChain',\n 'toToken',\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 // 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 const result = await request<RelayerQuoteResponse>(\n client.config,\n `${client.config.apiUrl}/relayer/quote?${new URLSearchParams(\n params as unknown as Record<string, string>\n )}`,\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":";;;;;;;;;;;;;;;;;AAwBA,MAAa,kBAAkB,OAC7B,QACA,QACA,YACsB;CAStB,KAAK,MAAM,qBAAqB;EAP9B;EACA;EACA;EACA;EACA;EACA;CAE+C,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAI,SACR,IAAI,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAKJ,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,MAAM,SAAS,MAAM,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,iBAAiB,IAAI,gBAC3C,MACF,KACA,EACE,QAAQ,SAAS,OACnB,CACF;CAEA,IAAI,OAAO,WAAW,SACpB,MAAM,IAAI,UAAA,eAER,OAAO,KAAK,MACZ,OAAO,KAAK,OACd;CAGF,OAAO,OAAO;AAChB"}
1
+ {"version":3,"file":"getRelayerQuote.js","names":[],"sources":["../../../src/actions/getRelayerQuote.ts"],"sourcesContent":["import type {\n LiFiStep,\n RelayerQuoteResponse,\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 { QuoteRequest, QuoteRequestFromAmount } from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a relayer 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 Relayer quote for a token transfer\n */\nexport const getRelayerQuote = async (\n client: SDKClient,\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n const requiredParameters: Array<keyof QuoteRequestFromAmount> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'fromAmount',\n 'toChain',\n 'toToken',\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 // 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 const result = await request<RelayerQuoteResponse>(\n client.config,\n `${client.config.apiUrl}/relayer/quote?${new URLSearchParams(\n params as unknown as Record<string, string>\n )}`,\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":";;;;;;;;;;;;;;AAqBA,MAAa,kBAAkB,OAC7B,QACA,QACA,YACsB;CAStB,KAAK,MAAM,qBAAqB;EAP9B;EACA;EACA;EACA;EACA;EACA;CAE+C,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAI,SACR,IAAI,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAKJ,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,MAAM,SAAS,MAAM,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,iBAAiB,IAAI,gBAC3C,MACF,KACA,EACE,QAAQ,SAAS,OACnB,CACF;CAEA,IAAI,OAAO,WAAW,SACpB,MAAM,IAAI,UAAA,eAER,OAAO,KAAK,MACZ,OAAO,KAAK,OACd;CAGF,OAAO,OAAO;AAChB"}
@@ -58,8 +58,6 @@ export type Actions = {
58
58
  * @param params - The configuration of the requested relayer quote
59
59
  * @param options - Request options
60
60
  * @returns Quote from a relayer
61
- * @deprecated The legacy gasless relayer service is shut down. Use
62
- * `getRoutes` with `options.gasless: true`.
63
61
  */
64
62
  getRelayerQuote: (params: QuoteRequestFromAmount, options?: RequestOptions) => Promise<LiFiStep>;
65
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["RoutesRequest"],"sources":["../../../src/actions/index.ts"],"mappings":";;;;;YA8DY;;;;;;;EAOV,YACE,SAAS,eACT,UAAU,mBACP,QAAQ;;;;;;;EAQb,iBACE,QAAQ,oBACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,wBACE,QAAQ,2BACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,uBACE,QAAQ,0BACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,wBACE,cACA,YAAY,cACT;;;;;;;EAQL,WACE,QAAQ,kBAAkB,cAC1B,UAAU,mBACP,QAAQ;;;;;;;EAQb,8BACE,QAAQ,oBACR,UAAU,mBACP,QAAQ;;;;;;;;;EAUb,kBACE,QAAQ,wBACR,UAAU,mBACP,QAAQ;;;;;;;;;EAUb,YACE,QAAQA,iBACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,YACE,QAAQ,0BACR,UAAU,mBACP,QAAQ;;;;;;;;EASb,qBACE,QAAQ,iBACR,UAAU,mBACP,QAAQ;;;;;;;;EASb,WACE,OAAO,WAAW,SAClB,eACA,UAAU,mBACP,QAAQ;;;;;;;EAQb,kBACE,uBACA,OAAO,UACJ,QAAQ;;;;;;;EAQb,mBACE,uBACA,QAAQ,YACL,QAAQ;;;;;;;EAQb,0BACE,uBACA;KAAoC,kBAAA;QACjC;KACgB,kBAAA;;;;;;;;EASrB;KAEI,SAAS;MAAkB;OAC3B,UAAU,iBACT,QAAQ;KAET,QAAQ;MAAkB;OAC1B,UAAU,iBACT,QAAQ;;;;;;;;EASb,WACE,SAAS,cACT,UAAU,mBACP,QAAQ;;;;;;;EAQb,wBACE,QAAQ,6BACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,mBACE,QAAQ,cACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,qBACE,QAAQ,sBACR,UAAU,mBACP,QAAQ;;wBAGC,QAAQ,QAAQ,YAAY"}
1
+ {"version":3,"file":"index.d.ts","names":["RoutesRequest"],"sources":["../../../src/actions/index.ts"],"mappings":";;;;;YA8DY;;;;;;;EAOV,YACE,SAAS,eACT,UAAU,mBACP,QAAQ;;;;;;;EAQb,iBACE,QAAQ,oBACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,wBACE,QAAQ,2BACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,uBACE,QAAQ,0BACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,wBACE,cACA,YAAY,cACT;;;;;;;EAQL,WACE,QAAQ,kBAAkB,cAC1B,UAAU,mBACP,QAAQ;;;;;;;EAQb,8BACE,QAAQ,oBACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,kBACE,QAAQ,wBACR,UAAU,mBACP,QAAQ;;;;;;;;;EAUb,YACE,QAAQA,iBACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,YACE,QAAQ,0BACR,UAAU,mBACP,QAAQ;;;;;;;;EASb,qBACE,QAAQ,iBACR,UAAU,mBACP,QAAQ;;;;;;;;EASb,WACE,OAAO,WAAW,SAClB,eACA,UAAU,mBACP,QAAQ;;;;;;;EAQb,kBACE,uBACA,OAAO,UACJ,QAAQ;;;;;;;EAQb,mBACE,uBACA,QAAQ,YACL,QAAQ;;;;;;;EAQb,0BACE,uBACA;KAAoC,kBAAA;QACjC;KACgB,kBAAA;;;;;;;;EASrB;KAEI,SAAS;MAAkB;OAC3B,UAAU,iBACT,QAAQ;KAET,QAAQ;MAAkB;OAC1B,UAAU,iBACT,QAAQ;;;;;;;;EASb,WACE,SAAS,cACT,UAAU,mBACP,QAAQ;;;;;;;EAQb,wBACE,QAAQ,6BACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,mBACE,QAAQ,cACR,UAAU,mBACP,QAAQ;;;;;;;EAQb,qBACE,QAAQ,sBACR,UAAU,mBACP,QAAQ;;wBAGC,QAAQ,QAAQ,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/actions/index.ts"],"sourcesContent":["import type {\n ChainId,\n ChainKey,\n ChainsRequest,\n ChainType,\n ConnectionsRequest,\n ConnectionsResponse,\n ContractCallsQuoteRequest,\n ExtendedChain,\n GasRecommendationRequest,\n GasRecommendationResponse,\n LiFiStep,\n PatchCallDataRequest,\n RelayRequest,\n RelayResponseData,\n RelayStatusRequest,\n RelayStatusResponseData,\n RequestOptions,\n RoutesResponse,\n StatusResponse,\n Token,\n TokenAmount,\n TokenExtended,\n TokensExtendedResponse,\n TokensRequest,\n TokensResponse,\n ToolsRequest,\n ToolsResponse,\n TransactionAnalyticsRequest,\n TransactionAnalyticsResponse,\n} from '@lifi/types'\nimport type {\n GetStatusRequestExtended,\n LiFiStepRequest,\n QuoteRequestFromAmount,\n RoutesRequest,\n} from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { getChains } from './getChains.js'\nimport { getConnections } from './getConnections.js'\nimport { getContractCallsQuote } from './getContractCallsQuote.js'\nimport { getGasRecommendation } from './getGasRecommendation.js'\nimport { getNameServiceAddress } from './getNameServiceAddress.js'\nimport { getQuote } from './getQuote.js'\nimport { getRelayedTransactionStatus } from './getRelayedTransactionStatus.js'\nimport { getRelayerQuote } from './getRelayerQuote.js'\nimport { getRoutes } from './getRoutes.js'\nimport { getStatus } from './getStatus.js'\nimport { getStepTransaction } from './getStepTransaction.js'\nimport { getToken } from './getToken.js'\nimport { getTokenBalance } from './getTokenBalance.js'\nimport { getTokenBalances } from './getTokenBalances.js'\nimport { getTokenBalancesByChain } from './getTokenBalancesByChain.js'\nimport { getTokens } from './getTokens.js'\nimport { getTools } from './getTools.js'\nimport { getTransactionHistory } from './getTransactionHistory.js'\nimport {\n type PatchContractCallsResponse,\n patchContractCalls,\n} from './patchContractCalls.js'\nimport { relayTransaction } from './relayTransaction.js'\n\nexport type Actions = {\n /**\n * Get all available chains\n * @param params - The configuration of the requested chains\n * @param options - Request options\n * @returns A list of all available chains\n */\n getChains: (\n params?: ChainsRequest,\n options?: RequestOptions\n ) => Promise<ExtendedChain[]>\n\n /**\n * Get connections between chains\n * @param params - The configuration of the requested connections\n * @param options - Request options\n * @returns A list of connections\n */\n getConnections: (\n params: ConnectionsRequest,\n options?: RequestOptions\n ) => Promise<ConnectionsResponse>\n\n /**\n * Get a quote for contract calls\n * @param params - The configuration of the requested contract calls quote\n * @param options - Request options\n * @returns Quote for contract calls\n */\n getContractCallsQuote: (\n params: ContractCallsQuoteRequest,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get gas recommendation for a chain\n * @param params - The configuration of the requested gas recommendation\n * @param options - Request options\n * @returns Gas recommendation\n */\n getGasRecommendation: (\n params: GasRecommendationRequest,\n options?: RequestOptions\n ) => Promise<GasRecommendationResponse>\n\n /**\n * Get the address of a name service\n * @param name - The name to resolve\n * @param chainType - The chain type to resolve the name on\n * @returns The address of the name service\n */\n getNameServiceAddress: (\n name: string,\n chainType?: ChainType\n ) => Promise<string | undefined>\n\n /**\n * Get a quote for a token transfer\n * @param params - The configuration of the requested quote\n * @param options - Request options\n * @returns Quote for a token transfer\n */\n getQuote: (\n params: Parameters<typeof getQuote>[1],\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get the status of a relayed transaction\n * @param params - The configuration of the requested relay status\n * @param options - Request options\n * @returns Status of the relayed transaction\n */\n getRelayedTransactionStatus: (\n params: RelayStatusRequest,\n options?: RequestOptions\n ) => Promise<RelayStatusResponseData>\n\n /**\n * Get a quote from a relayer\n * @param params - The configuration of the requested relayer quote\n * @param options - Request options\n * @returns Quote from a relayer\n * @deprecated The legacy gasless relayer service is shut down. Use\n * `getRoutes` with `options.gasless: true`.\n */\n getRelayerQuote: (\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get a set of routes for a request that describes a transfer of tokens.\n * Optional limit-order fields (`toAmount`, `validUntil`, `partiallyFillable`)\n * may be supplied and are resolved on the backend.\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\n */\n getRoutes: (\n params: RoutesRequest,\n options?: RequestOptions\n ) => Promise<RoutesResponse>\n\n /**\n * Get the status of a transaction\n * @param params - The configuration of the requested status\n * @param options - Request options\n * @returns Status of the transaction\n */\n getStatus: (\n params: GetStatusRequestExtended,\n options?: RequestOptions\n ) => Promise<StatusResponse>\n\n /**\n * Get a step transaction. The step's `action` may carry the optional\n * limit-order fields, which are resolved on the backend.\n * @param params - The configuration of the requested step transaction\n * @param options - Request options\n * @returns Step transaction\n */\n getStepTransaction: (\n params: LiFiStepRequest,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get a specific token\n * @param chain - Id or key of the chain that contains the token\n * @param token - Address or symbol of the token on the requested chain\n * @param options - Request options\n * @returns Token information\n */\n getToken: (\n chain: ChainKey | ChainId,\n token: string,\n options?: RequestOptions\n ) => Promise<TokenExtended>\n\n /**\n * Get token balance for a specific token\n * @param walletAddress - A wallet address\n * @param token - A Token object\n * @returns Token balance\n */\n getTokenBalance: (\n walletAddress: string,\n token: Token\n ) => Promise<TokenAmount | null>\n\n /**\n * Get token balances for multiple tokens\n * @param walletAddress - A wallet address\n * @param tokens - A list of Token objects\n * @returns Token balances\n */\n getTokenBalances: (\n walletAddress: string,\n tokens: Token[]\n ) => Promise<TokenAmount[]>\n\n /**\n * Get token balances by chain\n * @param walletAddress - A wallet address\n * @param tokensByChain - A list of token objects organized by chain ids\n * @returns Token balances by chain\n */\n getTokenBalancesByChain: (\n walletAddress: string,\n tokensByChain: { [chainId: number]: Token[] }\n ) => Promise<{\n [chainId: number]: TokenAmount[]\n }>\n\n /**\n * Get all available tokens\n * @param params - The configuration of the requested tokens\n * @param options - Request options\n * @returns A list of all available tokens\n */\n getTokens: {\n (\n params?: TokensRequest & { extended?: false | undefined },\n options?: RequestOptions\n ): Promise<TokensResponse>\n (\n params: TokensRequest & { extended: true },\n options?: RequestOptions\n ): Promise<TokensExtendedResponse>\n }\n\n /**\n * Get all available tools (bridges and exchanges)\n * @param params - The configuration of the requested tools\n * @param options - Request options\n * @returns A list of all available tools\n */\n getTools: (\n params?: ToolsRequest,\n options?: RequestOptions\n ) => Promise<ToolsResponse>\n\n /**\n * Get transaction history\n * @param params - The configuration of the requested transaction history\n * @param options - Request options\n * @returns Transaction history\n */\n getTransactionHistory: (\n params: TransactionAnalyticsRequest,\n options?: RequestOptions\n ) => Promise<TransactionAnalyticsResponse>\n\n /**\n * Relay a transaction through the relayer service\n * @param params - The configuration for the relay request\n * @param options - Request options\n * @returns Task ID and transaction link for the relayed transaction\n */\n relayTransaction: (\n params: RelayRequest,\n options?: RequestOptions\n ) => Promise<RelayResponseData>\n\n /**\n * Patch contract calls\n * @param params - The configuration for the patch contract calls request\n * @param options - Request options\n * @returns Patched contract calls\n */\n patchContractCalls: (\n params: PatchCallDataRequest,\n options?: RequestOptions\n ) => Promise<PatchContractCallsResponse[]>\n}\n\nexport function actions(client: SDKClient): Actions {\n return {\n getChains: (params, options) => getChains(client, params, options),\n getConnections: (params, options) =>\n getConnections(client, params, options),\n getContractCallsQuote: (params, options) =>\n getContractCallsQuote(client, params, options),\n getGasRecommendation: (params, options) =>\n getGasRecommendation(client, params, options),\n getNameServiceAddress: (name, chainType) =>\n getNameServiceAddress(client, name, chainType),\n getTokens: (params, options) => getTokens(client, params as any, options),\n getTools: (params, options) => getTools(client, params, options),\n getQuote: (params, options) => getQuote(client, params, options),\n getRelayedTransactionStatus: (params, options) =>\n getRelayedTransactionStatus(client, params, options),\n getRelayerQuote: (params, options) =>\n getRelayerQuote(client, params, options),\n getRoutes: (params, options) => getRoutes(client, params, options),\n getStatus: (params, options) => getStatus(client, params, options),\n getStepTransaction: (params, options) =>\n getStepTransaction(client, params, options),\n getToken: (chain, token, options) =>\n getToken(client, chain, token, options),\n getTokenBalance: (walletAddress, token) =>\n getTokenBalance(client, walletAddress, token),\n getTokenBalances: (walletAddress, tokens) =>\n getTokenBalances(client, walletAddress, tokens),\n getTokenBalancesByChain: (walletAddress, tokensByChain) =>\n getTokenBalancesByChain(client, walletAddress, tokensByChain),\n getTransactionHistory: (params, options) =>\n getTransactionHistory(client, params, options),\n relayTransaction: (params, options) =>\n relayTransaction(client, params, options),\n patchContractCalls: (params, options) =>\n patchContractCalls(client, params, options),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2SA,SAAgB,QAAQ,QAA4B;CAClD,OAAO;EACL,YAAY,QAAQ,YAAY,UAAU,QAAQ,QAAQ,OAAO;EACjE,iBAAiB,QAAQ,YACvB,eAAe,QAAQ,QAAQ,OAAO;EACxC,wBAAwB,QAAQ,YAC9B,sBAAsB,QAAQ,QAAQ,OAAO;EAC/C,uBAAuB,QAAQ,YAC7B,qBAAqB,QAAQ,QAAQ,OAAO;EAC9C,wBAAwB,MAAM,cAC5B,sBAAsB,QAAQ,MAAM,SAAS;EAC/C,YAAY,QAAQ,YAAY,UAAU,QAAQ,QAAe,OAAO;EACxE,WAAW,QAAQ,YAAY,SAAS,QAAQ,QAAQ,OAAO;EAC/D,WAAW,QAAQ,YAAY,SAAS,QAAQ,QAAQ,OAAO;EAC/D,8BAA8B,QAAQ,YACpC,4BAA4B,QAAQ,QAAQ,OAAO;EACrD,kBAAkB,QAAQ,YACxB,gBAAgB,QAAQ,QAAQ,OAAO;EACzC,YAAY,QAAQ,YAAY,UAAU,QAAQ,QAAQ,OAAO;EACjE,YAAY,QAAQ,YAAY,UAAU,QAAQ,QAAQ,OAAO;EACjE,qBAAqB,QAAQ,YAC3B,mBAAmB,QAAQ,QAAQ,OAAO;EAC5C,WAAW,OAAO,OAAO,YACvB,SAAS,QAAQ,OAAO,OAAO,OAAO;EACxC,kBAAkB,eAAe,UAC/B,gBAAgB,QAAQ,eAAe,KAAK;EAC9C,mBAAmB,eAAe,WAChC,iBAAiB,QAAQ,eAAe,MAAM;EAChD,0BAA0B,eAAe,kBACvC,wBAAwB,QAAQ,eAAe,aAAa;EAC9D,wBAAwB,QAAQ,YAC9B,sBAAsB,QAAQ,QAAQ,OAAO;EAC/C,mBAAmB,QAAQ,YACzB,iBAAiB,QAAQ,QAAQ,OAAO;EAC1C,qBAAqB,QAAQ,YAC3B,mBAAmB,QAAQ,QAAQ,OAAO;CAC9C;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/actions/index.ts"],"sourcesContent":["import type {\n ChainId,\n ChainKey,\n ChainsRequest,\n ChainType,\n ConnectionsRequest,\n ConnectionsResponse,\n ContractCallsQuoteRequest,\n ExtendedChain,\n GasRecommendationRequest,\n GasRecommendationResponse,\n LiFiStep,\n PatchCallDataRequest,\n RelayRequest,\n RelayResponseData,\n RelayStatusRequest,\n RelayStatusResponseData,\n RequestOptions,\n RoutesResponse,\n StatusResponse,\n Token,\n TokenAmount,\n TokenExtended,\n TokensExtendedResponse,\n TokensRequest,\n TokensResponse,\n ToolsRequest,\n ToolsResponse,\n TransactionAnalyticsRequest,\n TransactionAnalyticsResponse,\n} from '@lifi/types'\nimport type {\n GetStatusRequestExtended,\n LiFiStepRequest,\n QuoteRequestFromAmount,\n RoutesRequest,\n} from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { getChains } from './getChains.js'\nimport { getConnections } from './getConnections.js'\nimport { getContractCallsQuote } from './getContractCallsQuote.js'\nimport { getGasRecommendation } from './getGasRecommendation.js'\nimport { getNameServiceAddress } from './getNameServiceAddress.js'\nimport { getQuote } from './getQuote.js'\nimport { getRelayedTransactionStatus } from './getRelayedTransactionStatus.js'\nimport { getRelayerQuote } from './getRelayerQuote.js'\nimport { getRoutes } from './getRoutes.js'\nimport { getStatus } from './getStatus.js'\nimport { getStepTransaction } from './getStepTransaction.js'\nimport { getToken } from './getToken.js'\nimport { getTokenBalance } from './getTokenBalance.js'\nimport { getTokenBalances } from './getTokenBalances.js'\nimport { getTokenBalancesByChain } from './getTokenBalancesByChain.js'\nimport { getTokens } from './getTokens.js'\nimport { getTools } from './getTools.js'\nimport { getTransactionHistory } from './getTransactionHistory.js'\nimport {\n patchContractCalls,\n type PatchContractCallsResponse,\n} from './patchContractCalls.js'\nimport { relayTransaction } from './relayTransaction.js'\n\nexport type Actions = {\n /**\n * Get all available chains\n * @param params - The configuration of the requested chains\n * @param options - Request options\n * @returns A list of all available chains\n */\n getChains: (\n params?: ChainsRequest,\n options?: RequestOptions\n ) => Promise<ExtendedChain[]>\n\n /**\n * Get connections between chains\n * @param params - The configuration of the requested connections\n * @param options - Request options\n * @returns A list of connections\n */\n getConnections: (\n params: ConnectionsRequest,\n options?: RequestOptions\n ) => Promise<ConnectionsResponse>\n\n /**\n * Get a quote for contract calls\n * @param params - The configuration of the requested contract calls quote\n * @param options - Request options\n * @returns Quote for contract calls\n */\n getContractCallsQuote: (\n params: ContractCallsQuoteRequest,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get gas recommendation for a chain\n * @param params - The configuration of the requested gas recommendation\n * @param options - Request options\n * @returns Gas recommendation\n */\n getGasRecommendation: (\n params: GasRecommendationRequest,\n options?: RequestOptions\n ) => Promise<GasRecommendationResponse>\n\n /**\n * Get the address of a name service\n * @param name - The name to resolve\n * @param chainType - The chain type to resolve the name on\n * @returns The address of the name service\n */\n getNameServiceAddress: (\n name: string,\n chainType?: ChainType\n ) => Promise<string | undefined>\n\n /**\n * Get a quote for a token transfer\n * @param params - The configuration of the requested quote\n * @param options - Request options\n * @returns Quote for a token transfer\n */\n getQuote: (\n params: Parameters<typeof getQuote>[1],\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get the status of a relayed transaction\n * @param params - The configuration of the requested relay status\n * @param options - Request options\n * @returns Status of the relayed transaction\n */\n getRelayedTransactionStatus: (\n params: RelayStatusRequest,\n options?: RequestOptions\n ) => Promise<RelayStatusResponseData>\n\n /**\n * Get a quote from a relayer\n * @param params - The configuration of the requested relayer quote\n * @param options - Request options\n * @returns Quote from a relayer\n */\n getRelayerQuote: (\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get a set of routes for a request that describes a transfer of tokens.\n * Optional limit-order fields (`toAmount`, `validUntil`, `partiallyFillable`)\n * may be supplied and are resolved on the backend.\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\n */\n getRoutes: (\n params: RoutesRequest,\n options?: RequestOptions\n ) => Promise<RoutesResponse>\n\n /**\n * Get the status of a transaction\n * @param params - The configuration of the requested status\n * @param options - Request options\n * @returns Status of the transaction\n */\n getStatus: (\n params: GetStatusRequestExtended,\n options?: RequestOptions\n ) => Promise<StatusResponse>\n\n /**\n * Get a step transaction. The step's `action` may carry the optional\n * limit-order fields, which are resolved on the backend.\n * @param params - The configuration of the requested step transaction\n * @param options - Request options\n * @returns Step transaction\n */\n getStepTransaction: (\n params: LiFiStepRequest,\n options?: RequestOptions\n ) => Promise<LiFiStep>\n\n /**\n * Get a specific token\n * @param chain - Id or key of the chain that contains the token\n * @param token - Address or symbol of the token on the requested chain\n * @param options - Request options\n * @returns Token information\n */\n getToken: (\n chain: ChainKey | ChainId,\n token: string,\n options?: RequestOptions\n ) => Promise<TokenExtended>\n\n /**\n * Get token balance for a specific token\n * @param walletAddress - A wallet address\n * @param token - A Token object\n * @returns Token balance\n */\n getTokenBalance: (\n walletAddress: string,\n token: Token\n ) => Promise<TokenAmount | null>\n\n /**\n * Get token balances for multiple tokens\n * @param walletAddress - A wallet address\n * @param tokens - A list of Token objects\n * @returns Token balances\n */\n getTokenBalances: (\n walletAddress: string,\n tokens: Token[]\n ) => Promise<TokenAmount[]>\n\n /**\n * Get token balances by chain\n * @param walletAddress - A wallet address\n * @param tokensByChain - A list of token objects organized by chain ids\n * @returns Token balances by chain\n */\n getTokenBalancesByChain: (\n walletAddress: string,\n tokensByChain: { [chainId: number]: Token[] }\n ) => Promise<{\n [chainId: number]: TokenAmount[]\n }>\n\n /**\n * Get all available tokens\n * @param params - The configuration of the requested tokens\n * @param options - Request options\n * @returns A list of all available tokens\n */\n getTokens: {\n (\n params?: TokensRequest & { extended?: false | undefined },\n options?: RequestOptions\n ): Promise<TokensResponse>\n (\n params: TokensRequest & { extended: true },\n options?: RequestOptions\n ): Promise<TokensExtendedResponse>\n }\n\n /**\n * Get all available tools (bridges and exchanges)\n * @param params - The configuration of the requested tools\n * @param options - Request options\n * @returns A list of all available tools\n */\n getTools: (\n params?: ToolsRequest,\n options?: RequestOptions\n ) => Promise<ToolsResponse>\n\n /**\n * Get transaction history\n * @param params - The configuration of the requested transaction history\n * @param options - Request options\n * @returns Transaction history\n */\n getTransactionHistory: (\n params: TransactionAnalyticsRequest,\n options?: RequestOptions\n ) => Promise<TransactionAnalyticsResponse>\n\n /**\n * Relay a transaction through the relayer service\n * @param params - The configuration for the relay request\n * @param options - Request options\n * @returns Task ID and transaction link for the relayed transaction\n */\n relayTransaction: (\n params: RelayRequest,\n options?: RequestOptions\n ) => Promise<RelayResponseData>\n\n /**\n * Patch contract calls\n * @param params - The configuration for the patch contract calls request\n * @param options - Request options\n * @returns Patched contract calls\n */\n patchContractCalls: (\n params: PatchCallDataRequest,\n options?: RequestOptions\n ) => Promise<PatchContractCallsResponse[]>\n}\n\nexport function actions(client: SDKClient): Actions {\n return {\n getChains: (params, options) => getChains(client, params, options),\n getConnections: (params, options) =>\n getConnections(client, params, options),\n getContractCallsQuote: (params, options) =>\n getContractCallsQuote(client, params, options),\n getGasRecommendation: (params, options) =>\n getGasRecommendation(client, params, options),\n getNameServiceAddress: (name, chainType) =>\n getNameServiceAddress(client, name, chainType),\n getTokens: (params, options) => getTokens(client, params as any, options),\n getTools: (params, options) => getTools(client, params, options),\n getQuote: (params, options) => getQuote(client, params, options),\n getRelayedTransactionStatus: (params, options) =>\n getRelayedTransactionStatus(client, params, options),\n getRelayerQuote: (params, options) =>\n getRelayerQuote(client, params, options),\n getRoutes: (params, options) => getRoutes(client, params, options),\n getStatus: (params, options) => getStatus(client, params, options),\n getStepTransaction: (params, options) =>\n getStepTransaction(client, params, options),\n getToken: (chain, token, options) =>\n getToken(client, chain, token, options),\n getTokenBalance: (walletAddress, token) =>\n getTokenBalance(client, walletAddress, token),\n getTokenBalances: (walletAddress, tokens) =>\n getTokenBalances(client, walletAddress, tokens),\n getTokenBalancesByChain: (walletAddress, tokensByChain) =>\n getTokenBalancesByChain(client, walletAddress, tokensByChain),\n getTransactionHistory: (params, options) =>\n getTransactionHistory(client, params, options),\n relayTransaction: (params, options) =>\n relayTransaction(client, params, options),\n patchContractCalls: (params, options) =>\n patchContractCalls(client, params, options),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAySA,SAAgB,QAAQ,QAA4B;CAClD,OAAO;EACL,YAAY,QAAQ,YAAY,UAAU,QAAQ,QAAQ,OAAO;EACjE,iBAAiB,QAAQ,YACvB,eAAe,QAAQ,QAAQ,OAAO;EACxC,wBAAwB,QAAQ,YAC9B,sBAAsB,QAAQ,QAAQ,OAAO;EAC/C,uBAAuB,QAAQ,YAC7B,qBAAqB,QAAQ,QAAQ,OAAO;EAC9C,wBAAwB,MAAM,cAC5B,sBAAsB,QAAQ,MAAM,SAAS;EAC/C,YAAY,QAAQ,YAAY,UAAU,QAAQ,QAAe,OAAO;EACxE,WAAW,QAAQ,YAAY,SAAS,QAAQ,QAAQ,OAAO;EAC/D,WAAW,QAAQ,YAAY,SAAS,QAAQ,QAAQ,OAAO;EAC/D,8BAA8B,QAAQ,YACpC,4BAA4B,QAAQ,QAAQ,OAAO;EACrD,kBAAkB,QAAQ,YACxB,gBAAgB,QAAQ,QAAQ,OAAO;EACzC,YAAY,QAAQ,YAAY,UAAU,QAAQ,QAAQ,OAAO;EACjE,YAAY,QAAQ,YAAY,UAAU,QAAQ,QAAQ,OAAO;EACjE,qBAAqB,QAAQ,YAC3B,mBAAmB,QAAQ,QAAQ,OAAO;EAC5C,WAAW,OAAO,OAAO,YACvB,SAAS,QAAQ,OAAO,OAAO,OAAO;EACxC,kBAAkB,eAAe,UAC/B,gBAAgB,QAAQ,eAAe,KAAK;EAC9C,mBAAmB,eAAe,WAChC,iBAAiB,QAAQ,eAAe,MAAM;EAChD,0BAA0B,eAAe,kBACvC,wBAAwB,QAAQ,eAAe,aAAa;EAC9D,wBAAwB,QAAQ,YAC9B,sBAAsB,QAAQ,QAAQ,OAAO;EAC/C,mBAAmB,QAAQ,YACzB,iBAAiB,QAAQ,QAAQ,OAAO;EAC1C,qBAAqB,QAAQ,YAC3B,mBAAmB,QAAQ,QAAQ,OAAO;CAC9C;AACF"}
@@ -14,7 +14,8 @@ import { request } from "../utils/request.js";
14
14
  */
15
15
  const relayTransaction = async (client, params, options) => {
16
16
  for (const requiredParameter of ["typedData"]) if (!params[requiredParameter]) throw new SDKError(new ValidationError(`Required parameter "${requiredParameter}" is missing.`));
17
- const result = await request(client.config, `${client.config.apiUrl}/advanced/relay`, {
17
+ const relayerPath = params.typedData.some((t) => t.primaryType === "PermitWitnessTransferFrom") ? "/relayer/relay" : "/advanced/relay";
18
+ const result = await request(client.config, `${client.config.apiUrl}${relayerPath}`, {
18
19
  method: "POST",
19
20
  headers: { "Content-Type": "application/json" },
20
21
  body: JSON.stringify(params, (_, value) => {
@@ -1 +1 @@
1
- {"version":3,"file":"relayTransaction.js","names":[],"sources":["../../../src/actions/relayTransaction.ts"],"sourcesContent":["import type {\n RelayRequest,\n RelayResponse,\n RelayResponseData,\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 { request } from '../utils/request.js'\n\n/**\n * Relay a transaction through the relayer service\n * @param client - The SDK client\n * @param params - The configuration for the relay request\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Task ID and transaction link for the relayed transaction\n */\nexport const relayTransaction = async (\n client: SDKClient,\n params: RelayRequest,\n options?: RequestOptions\n): Promise<RelayResponseData> => {\n const requiredParameters: Array<keyof RelayRequest> = ['typedData']\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 result = await request<RelayResponse>(\n client.config,\n `${client.config.apiUrl}/advanced/relay`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params, (_, value) => {\n if (typeof value === 'bigint') {\n return value.toString()\n }\n return value\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":";;;;;;;;;;;;;;AAqBA,MAAa,mBAAmB,OAC9B,QACA,QACA,YAC+B;CAG/B,KAAK,MAAM,qBAAqB,CAFuB,WAEN,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAI,SACR,IAAI,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAIJ,MAAM,SAAS,MAAM,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,kBACxB;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,mBAClB;EACA,MAAM,KAAK,UAAU,SAAS,GAAG,UAAU;GACzC,IAAI,OAAO,UAAU,UACnB,OAAO,MAAM,SAAS;GAExB,OAAO;EACT,CAAC;EACD,QAAQ,SAAS;CACnB,CACF;CAEA,IAAI,OAAO,WAAW,SACpB,MAAM,IAAI,UAAA,eAER,OAAO,KAAK,MACZ,OAAO,KAAK,OACd;CAGF,OAAO,OAAO;AAChB"}
1
+ {"version":3,"file":"relayTransaction.js","names":[],"sources":["../../../src/actions/relayTransaction.ts"],"sourcesContent":["import type {\n RelayRequest,\n RelayResponse,\n RelayResponseData,\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 { request } from '../utils/request.js'\n\n/**\n * Relay a transaction through the relayer service\n * @param client - The SDK client\n * @param params - The configuration for the relay request\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Task ID and transaction link for the relayed transaction\n */\nexport const relayTransaction = async (\n client: SDKClient,\n params: RelayRequest,\n options?: RequestOptions\n): Promise<RelayResponseData> => {\n const requiredParameters: Array<keyof RelayRequest> = ['typedData']\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 // Determine if the request is for a gasless relayer service or advanced relayer service\n // We will use the same endpoint for both after the gasless relayer service is deprecated\n const relayerPath = params.typedData.some(\n (t) => t.primaryType === 'PermitWitnessTransferFrom'\n )\n ? '/relayer/relay'\n : '/advanced/relay'\n\n const result = await request<RelayResponse>(\n client.config,\n `${client.config.apiUrl}${relayerPath}`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params, (_, value) => {\n if (typeof value === 'bigint') {\n return value.toString()\n }\n return value\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":";;;;;;;;;;;;;;AAqBA,MAAa,mBAAmB,OAC9B,QACA,QACA,YAC+B;CAG/B,KAAK,MAAM,qBAAqB,CAFuB,WAEN,GAC/C,IAAI,CAAC,OAAO,oBACV,MAAM,IAAI,SACR,IAAI,gBACF,uBAAuB,kBAAkB,cAC3C,CACF;CAMJ,MAAM,cAAc,OAAO,UAAU,MAClC,MAAM,EAAE,gBAAgB,2BAC3B,IACI,mBACA;CAEJ,MAAM,SAAS,MAAM,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,SAAS,eAC1B;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,mBAClB;EACA,MAAM,KAAK,UAAU,SAAS,GAAG,UAAU;GACzC,IAAI,OAAO,UAAU,UACnB,OAAO,MAAM,SAAS;GAExB,OAAO;EACT,CAAC;EACD,QAAQ,SAAS;CACnB,CACF;CAEA,IAAI,OAAO,WAAW,SACpB,MAAM,IAAI,UAAA,eAER,OAAO,KAAK,MACZ,OAAO,KAAK,OACd;CAGF,OAAO,OAAO;AAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckBalanceTask.js","names":[],"sources":["../../../../src/core/tasks/CheckBalanceTask.ts"],"sourcesContent":["import { LiFiErrorCode } from '../../errors/constants.js'\nimport { TransactionError } from '../../errors/errors.js'\nimport type { StepExecutorContext, TaskResult } from '../../types/execution.js'\nimport { BaseStepExecutionTask } from '../BaseStepExecutionTask.js'\nimport {\n type CheckBalanceOptions,\n checkBalance,\n} from './helpers/checkBalance.js'\n\nexport class CheckBalanceTask extends BaseStepExecutionTask {\n /**\n * Per-step options hook for chain-specific subclasses (e.g. skip the\n * gas check for smart-contract wallets or relayed steps). Default `{}`\n * keeps behavior unchanged for every provider that doesn't override.\n * Resolved lazily inside `run()` — pipelines that resume past\n * `CheckBalance` pay no cost.\n */\n protected getCheckBalanceOptions(\n _context: StepExecutorContext\n ): Promise<CheckBalanceOptions> {\n return Promise.resolve({})\n }\n\n async run(context: StepExecutorContext): Promise<TaskResult> {\n const { client, step, statusManager, isBridgeExecution } = context\n\n statusManager.initializeAction({\n step,\n type: isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n const walletAddress = step.action.fromAddress\n if (!walletAddress) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'The wallet address is undefined.'\n )\n }\n\n const options = await this.getCheckBalanceOptions(context)\n await checkBalance(client, walletAddress, step, options)\n return { status: 'COMPLETED' }\n }\n}\n"],"mappings":";;;;;AASA,IAAa,mBAAb,cAAsC,sBAAsB;;;;;;;;CAQ1D,uBACE,UAC8B;EAC9B,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;CAEA,MAAM,IAAI,SAAmD;EAC3D,MAAM,EAAE,QAAQ,MAAM,eAAe,sBAAsB;EAE3D,cAAc,iBAAiB;GAC7B;GACA,MAAM,oBAAoB,gBAAgB;GAC1C,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,MAAM,gBAAgB,KAAK,OAAO;EAClC,IAAI,CAAC,eACH,MAAM,IAAI,iBAAA,KAER,kCACF;EAGF,MAAM,UAAU,MAAM,KAAK,uBAAuB,OAAO;EACzD,MAAM,aAAa,QAAQ,eAAe,MAAM,OAAO;EACvD,OAAO,EAAE,QAAQ,YAAY;CAC/B;AACF"}
1
+ {"version":3,"file":"CheckBalanceTask.js","names":[],"sources":["../../../../src/core/tasks/CheckBalanceTask.ts"],"sourcesContent":["import { LiFiErrorCode } from '../../errors/constants.js'\nimport { TransactionError } from '../../errors/errors.js'\nimport type { StepExecutorContext, TaskResult } from '../../types/execution.js'\nimport { BaseStepExecutionTask } from '../BaseStepExecutionTask.js'\nimport {\n checkBalance,\n type CheckBalanceOptions,\n} from './helpers/checkBalance.js'\n\nexport class CheckBalanceTask extends BaseStepExecutionTask {\n /**\n * Per-step options hook for chain-specific subclasses (e.g. skip the\n * gas check for smart-contract wallets or relayed steps). Default `{}`\n * keeps behavior unchanged for every provider that doesn't override.\n * Resolved lazily inside `run()` — pipelines that resume past\n * `CheckBalance` pay no cost.\n */\n protected getCheckBalanceOptions(\n _context: StepExecutorContext\n ): Promise<CheckBalanceOptions> {\n return Promise.resolve({})\n }\n\n async run(context: StepExecutorContext): Promise<TaskResult> {\n const { client, step, statusManager, isBridgeExecution } = context\n\n statusManager.initializeAction({\n step,\n type: isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP',\n chainId: step.action.fromChainId,\n status: 'STARTED',\n })\n\n const walletAddress = step.action.fromAddress\n if (!walletAddress) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'The wallet address is undefined.'\n )\n }\n\n const options = await this.getCheckBalanceOptions(context)\n await checkBalance(client, walletAddress, step, options)\n return { status: 'COMPLETED' }\n }\n}\n"],"mappings":";;;;;AASA,IAAa,mBAAb,cAAsC,sBAAsB;;;;;;;;CAQ1D,uBACE,UAC8B;EAC9B,OAAO,QAAQ,QAAQ,CAAC,CAAC;CAC3B;CAEA,MAAM,IAAI,SAAmD;EAC3D,MAAM,EAAE,QAAQ,MAAM,eAAe,sBAAsB;EAE3D,cAAc,iBAAiB;GAC7B;GACA,MAAM,oBAAoB,gBAAgB;GAC1C,SAAS,KAAK,OAAO;GACrB,QAAQ;EACV,CAAC;EAED,MAAM,gBAAgB,KAAK,OAAO;EAClC,IAAI,CAAC,eACH,MAAM,IAAI,iBAAA,KAER,kCACF;EAGF,MAAM,UAAU,MAAM,KAAK,uBAAuB,OAAO;EACzD,MAAM,aAAa,QAAQ,eAAe,MAAM,OAAO;EACvD,OAAO,EAAE,QAAQ,YAAY;CAC/B;AACF"}
@@ -48,7 +48,6 @@ import { checkPackageUpdates } from "./utils/checkPackageUpdates.js";
48
48
  import { convertQuoteToRoute } from "./utils/convertQuoteToRoute.js";
49
49
  import { fetchTxErrorDetails } from "./utils/fetchTxErrorDetails.js";
50
50
  import { formatUnits } from "./utils/formatUnits.js";
51
- import { GASLESS_RELAY_FEE_NAME, isGaslessStep } from "./utils/isGaslessStep.js";
52
51
  import { isHex } from "./utils/isHex.js";
53
52
  import { LruMap } from "./utils/lru.js";
54
53
  import { parseUnits } from "./utils/parseUnits.js";
@@ -58,4 +57,4 @@ import { withDedupe } from "./utils/withDedupe.js";
58
57
  import { withTimeout } from "./utils/withTimeout.js";
59
58
  import { name, version } from "./version.js";
60
59
  export * from "@lifi/types";
61
- export { type AcceptExchangeRateUpdateHook, type AcceptSlippageUpdateHook, type AcceptSlippageUpdateHookParams, BalanceError, BaseError, BaseStepExecutionTask, BaseStepExecutor, CLEARED_TRANSACTION_FIELDS, CLOCK_SKEW_MARGIN_MS, type CheckBalanceOptions, CheckBalanceTask, type ContractCallParams, type ContractTool, DROPPED_FALLBACK_AGE_MS, type ErrorCode, ErrorMessage, ErrorName, type ExchangeRateUpdateParams, ExecuteStepRetryError, type ExecuteStepRetryParams, type Execution, type ExecutionAction, type ExecutionActionStatus, type ExecutionActionType, type ExecutionOptions, type ExecutionStatus, GASLESS_RELAY_FEE_NAME, type GetContractCallsHook, type GetContractCallsResult, type GetStatusRequestExtended, HTTPError, InMemoryStorage, type InteractionSettings, LiFiErrorCode, type LiFiStepExtended, type LiFiStepRequest, LocalStorageAdapter, LruMap, MAX_RESEND_AGE_MS, PrepareTransactionTask, ProviderError, type QuoteRequest, type QuoteRequestFromAmount, type QuoteRequestToAmount, RPCError, type RPCUrls, type RPCUrlsByRole, type RPCUrlsConfig, 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 TransactionErrorOptions, type TransactionMethodType, type TransactionParameters, type TransactionRequestParameters, type TransactionRequestUpdateHook, UnknownError, type UpdateRouteHook, ValidationError, WaitForTransactionStatusTask, actions, assertNoOpenTransaction, checkBalance, checkPackageUpdates, convertQuoteToRoute, createClient, createDefaultStorage, executeRoute, fetchTxErrorDetails, findProvider, formatUnits, getActionMessage, getActiveRoute, getActiveRoutes, getChains, getConnections, getContractCallsQuote, getGasRecommendation, getNameServiceAddress, getQuote, getRelayedTransactionStatus, getRelayerQuote, getRoutes, getStatus, getStepTransaction, getSubstatusMessage, getToken, getTokenBalance, getTokenBalances, getTokenBalancesByChain, getTokens, getTools, getTransactionHistory, getTransactionRequestData, hasOpenTransaction, isFinalTransactionError, isGaslessStep, isHex, isKnownToStatusApi, isOldEnoughToDrop, isResendAllowed, name, parseUnits, patchContractCalls, relayTransaction, resumeRoute, sleep, stepComparison, stopRouteExecution, updateRouteExecution, version, waitForResult, withDedupe, withTimeout };
60
+ export { type AcceptExchangeRateUpdateHook, type AcceptSlippageUpdateHook, type AcceptSlippageUpdateHookParams, BalanceError, BaseError, BaseStepExecutionTask, BaseStepExecutor, CLEARED_TRANSACTION_FIELDS, CLOCK_SKEW_MARGIN_MS, type CheckBalanceOptions, CheckBalanceTask, type ContractCallParams, type ContractTool, DROPPED_FALLBACK_AGE_MS, 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, MAX_RESEND_AGE_MS, PrepareTransactionTask, ProviderError, type QuoteRequest, type QuoteRequestFromAmount, type QuoteRequestToAmount, RPCError, type RPCUrls, type RPCUrlsByRole, type RPCUrlsConfig, 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 TransactionErrorOptions, type TransactionMethodType, type TransactionParameters, type TransactionRequestParameters, type TransactionRequestUpdateHook, UnknownError, type UpdateRouteHook, ValidationError, WaitForTransactionStatusTask, actions, assertNoOpenTransaction, checkBalance, checkPackageUpdates, convertQuoteToRoute, createClient, createDefaultStorage, executeRoute, fetchTxErrorDetails, findProvider, formatUnits, getActionMessage, getActiveRoute, getActiveRoutes, getChains, getConnections, getContractCallsQuote, getGasRecommendation, getNameServiceAddress, getQuote, getRelayedTransactionStatus, getRelayerQuote, getRoutes, getStatus, getStepTransaction, getSubstatusMessage, getToken, getTokenBalance, getTokenBalances, getTokenBalancesByChain, getTokens, getTools, getTransactionHistory, getTransactionRequestData, hasOpenTransaction, isFinalTransactionError, isHex, isKnownToStatusApi, isOldEnoughToDrop, isResendAllowed, name, parseUnits, patchContractCalls, relayTransaction, resumeRoute, sleep, stepComparison, stopRouteExecution, updateRouteExecution, version, waitForResult, withDedupe, withTimeout };
package/dist/esm/index.js CHANGED
@@ -45,7 +45,6 @@ import { checkPackageUpdates } from "./utils/checkPackageUpdates.js";
45
45
  import { convertQuoteToRoute } from "./utils/convertQuoteToRoute.js";
46
46
  import { fetchTxErrorDetails } from "./utils/fetchTxErrorDetails.js";
47
47
  import { formatUnits } from "./utils/formatUnits.js";
48
- import { GASLESS_RELAY_FEE_NAME, isGaslessStep } from "./utils/isGaslessStep.js";
49
48
  import { isHex } from "./utils/isHex.js";
50
49
  import { LruMap } from "./utils/lru.js";
51
50
  import { parseUnits } from "./utils/parseUnits.js";
@@ -55,4 +54,4 @@ import { withDedupe } from "./utils/withDedupe.js";
55
54
  import { withTimeout } from "./utils/withTimeout.js";
56
55
  import { name, version } from "./version.js";
57
56
  export * from "@lifi/types";
58
- export { BalanceError, BaseError, BaseStepExecutionTask, BaseStepExecutor, CLEARED_TRANSACTION_FIELDS, CLOCK_SKEW_MARGIN_MS, CheckBalanceTask, DROPPED_FALLBACK_AGE_MS, ErrorMessage, ErrorName, ExecuteStepRetryError, GASLESS_RELAY_FEE_NAME, HTTPError, InMemoryStorage, LiFiErrorCode, LocalStorageAdapter, LruMap, MAX_RESEND_AGE_MS, PrepareTransactionTask, ProviderError, RPCError, SDKError, ServerError, StatusManager, TaskPipeline, TransactionError, UnknownError, ValidationError, WaitForTransactionStatusTask, actions, assertNoOpenTransaction, checkBalance, checkPackageUpdates, convertQuoteToRoute, createClient, createDefaultStorage, executeRoute, fetchTxErrorDetails, findProvider, formatUnits, getActionMessage, getActiveRoute, getActiveRoutes, getChains, getConnections, getContractCallsQuote, getGasRecommendation, getNameServiceAddress, getQuote, getRelayedTransactionStatus, getRelayerQuote, getRoutes, getStatus, getStepTransaction, getSubstatusMessage, getToken, getTokenBalance, getTokenBalances, getTokenBalancesByChain, getTokens, getTools, getTransactionHistory, getTransactionRequestData, hasOpenTransaction, isFinalTransactionError, isGaslessStep, isHex, isKnownToStatusApi, isOldEnoughToDrop, isResendAllowed, name, parseUnits, patchContractCalls, relayTransaction, resumeRoute, sleep, stepComparison, stopRouteExecution, updateRouteExecution, version, waitForResult, withDedupe, withTimeout };
57
+ export { BalanceError, BaseError, BaseStepExecutionTask, BaseStepExecutor, CLEARED_TRANSACTION_FIELDS, CLOCK_SKEW_MARGIN_MS, CheckBalanceTask, DROPPED_FALLBACK_AGE_MS, ErrorMessage, ErrorName, ExecuteStepRetryError, HTTPError, InMemoryStorage, LiFiErrorCode, LocalStorageAdapter, LruMap, MAX_RESEND_AGE_MS, PrepareTransactionTask, ProviderError, RPCError, SDKError, ServerError, StatusManager, TaskPipeline, TransactionError, UnknownError, ValidationError, WaitForTransactionStatusTask, actions, assertNoOpenTransaction, checkBalance, checkPackageUpdates, convertQuoteToRoute, createClient, createDefaultStorage, executeRoute, fetchTxErrorDetails, findProvider, formatUnits, getActionMessage, getActiveRoute, getActiveRoutes, getChains, getConnections, getContractCallsQuote, getGasRecommendation, getNameServiceAddress, getQuote, getRelayedTransactionStatus, getRelayerQuote, getRoutes, getStatus, getStepTransaction, getSubstatusMessage, getToken, getTokenBalance, getTokenBalances, getTokenBalancesByChain, getTokens, getTools, getTransactionHistory, getTransactionRequestData, hasOpenTransaction, isFinalTransactionError, isHex, isKnownToStatusApi, isOldEnoughToDrop, isResendAllowed, name, parseUnits, patchContractCalls, relayTransaction, resumeRoute, sleep, stepComparison, stopRouteExecution, updateRouteExecution, version, waitForResult, withDedupe, withTimeout };
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","names":[],"sources":["../../../src/types/core.ts"],"mappings":";;;YAmBY,sBACV,SAAS,wBACN,sBAAsB,QAAQ;iBAElB;EACf;EACA;EACA;EACA;EACA,eAAe;EACf,mBAAmB;EACnB,SAAS;EACT;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB,UAAU;;iBAGK,kBACP,QAAQ,KAAK;EACrB;;;;;;EAMA,UAAU;EACV,YAAY;;;;;iBAMG;;;;;EAKf;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;;;YAOU,gBAAgB,QAAQ,OAAO,oBAAoB;;YAGnD,UAAU,QAAQ,OAAO;iBAEpB;WACN,MAAM;;;;;WAKN,oBAAoB;;;;;;;EAO7B,UAAU,iBAAiB,UAAU;;;;;;EAMrC,gBAAgB;EAChB,eACE,cACA,QAAQ,WACR,UAAU,SACV,QAAQ,UACP;EACH,gBAAgB,SAAS,sBAAsB,QAAQ;EACvD,WACE,QAAQ,WACR,uBACA,QAAQ,UACP,QAAQ;;iBAGI;EACf,QAAQ;EACR,WAAW;EACX,YAAY,MAAM,WAAW,UAAU,UAAU;EACjD,aAAa,WAAW;EACxB,UAAU,QAAQ;EAClB,aAAa,QAAQ;EACrB,aAAa,SAAS,UAAU,QAAQ;EACxC,cAAc,QAAQ;EACtB,oBAAoB,SAAS,UAAU;;;;;;;;EAQvC,0BAA0B,SAAS,UAAU;;;;;;EAM7C,2BAA2B,SAAS,UAAU;;iBAG/B;EACf;EACA,mBAAmB;;iBAGJ;EACf;EACA;EACA;;;;;;YAOU,yBAAyB;iBAEpB;EACf;EACA;EACA,eAAe,WAAW;;;;;EAK1B,YACE,QAAQ,WACR,MAAM,kBACN,cAAc,wBACd,SAAS,cACR,QAAQ;;iBAGI;EACf,OAAO;EACP,WAAW;EACX,mBAAmB;;YAGT,+BAA+B,QACzC,eAAe;iBAGA,sBAAsB,KAAK;EAC1C,OAAO;;iBAGQ,yBAAyB;EACxC,YAAY;;YAGF,eAAe;EACzB,YAAY;;YAGF;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU,2BAA2B,QAAQ,eAAe,QAAQ;;;;;;;;;;;;;YAc1D,mBAAmB,cAAc;iBAE5B,qCAAqC;EACpD;;YAGU,gCACV,kBAAkB,iCACf,QAAQ;iBAEI;EACf,SAAS;EACT;EACA;EACA;EACA;;YAGU,4BACV,QAAQ,mCACL;iBAEY;EACf,SAAS;EACT;EACA;;YAGU,gCACV,QAAQ,6BACL;iBAEY;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;;iBAGe;EACf,eAAe;EACf;EACA,eAAe;;YAGL,wBACV,QAAQ,uBACL,QAAQ;iBAEI;EACf,+BAA+B;;;;;;EAM/B,kBAAkB;EAClB,+BAA+B;EAC/B,mBAAmB;EACnB;EACA;;YAGU;YAEA;YAUA;YAUA;EACV,MAAM;EACN,QAAQ;EACR;EACA,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA,SAAS;;;;;;EAMT;;;;;;;EAOA;;;;;;;;;EASA;EAEA;IAAU;IAAuB;IAAiB;;;iBAGnC;EACf;EACA;EACA,QAAQ;EACR,SAAS,MAAM;EACf;EACA;EACA,UAAU;EACV,WAAW;EACX,WAAW;EACX;EACA;EAEA;IAAU;IAAuB;IAAiB;;;YAGxC"}
1
+ {"version":3,"file":"core.d.ts","names":[],"sources":["../../../src/types/core.ts"],"mappings":";;;YAmBY,sBACV,SAAS,wBACN,sBAAsB,QAAQ;iBAElB;EACf;EACA;EACA;EACA;EACA,eAAe;EACf,mBAAmB;EACnB,SAAS;EACT;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB,UAAU;;iBAGK,kBAAkB,QACjC,KAAK;EAEL;;;;;;EAMA,UAAU;EACV,YAAY;;;;;iBAMG;;;;;EAKf;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;;;YAOU,gBAAgB,QAAQ,OAAO,oBAAoB;;YAGnD,UAAU,QAAQ,OAAO;iBAEpB;WACN,MAAM;;;;;WAKN,oBAAoB;;;;;;;EAO7B,UAAU,iBAAiB,UAAU;;;;;;EAMrC,gBAAgB;EAChB,eACE,cACA,QAAQ,WACR,UAAU,SACV,QAAQ,UACP;EACH,gBAAgB,SAAS,sBAAsB,QAAQ;EACvD,WACE,QAAQ,WACR,uBACA,QAAQ,UACP,QAAQ;;iBAGI;EACf,QAAQ;EACR,WAAW;EACX,YAAY,MAAM,WAAW,UAAU,UAAU;EACjD,aAAa,WAAW;EACxB,UAAU,QAAQ;EAClB,aAAa,QAAQ;EACrB,aAAa,SAAS,UAAU,QAAQ;EACxC,cAAc,QAAQ;EACtB,oBAAoB,SAAS,UAAU;;;;;;;;EAQvC,0BAA0B,SAAS,UAAU;;;;;;EAM7C,2BAA2B,SAAS,UAAU;;iBAG/B;EACf;EACA,mBAAmB;;iBAGJ;EACf;EACA;EACA;;;;;;YAOU,yBAAyB;iBAEpB;EACf;EACA;EACA,eAAe,WAAW;;;;;EAK1B,YACE,QAAQ,WACR,MAAM,kBACN,cAAc,wBACd,SAAS,cACR,QAAQ;;iBAGI;EACf,OAAO;EACP,WAAW;EACX,mBAAmB;;YAGT,+BAA+B,QACzC,eAAe;iBAGA,sBAAsB,KAAK;EAC1C,OAAO;;iBAGQ,yBAAyB;EACxC,YAAY;;YAGF,eAAe;EACzB,YAAY;;YAGF;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU,2BAA2B,QAAQ,eAAe,QAAQ;;;;;;;;;;;;;YAc1D,mBAAmB,cAAc;iBAE5B,qCAAqC;EACpD;;YAGU,gCACV,kBAAkB,iCACf,QAAQ;iBAEI;EACf,SAAS;EACT;EACA;EACA;EACA;;YAGU,4BACV,QAAQ,mCACL;iBAEY;EACf,SAAS;EACT;EACA;;YAGU,gCACV,QAAQ,6BACL;iBAEY;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;;iBAGe;EACf,eAAe;EACf;EACA,eAAe;;YAGL,wBACV,QAAQ,uBACL,QAAQ;iBAEI;EACf,+BAA+B;;;;;;EAM/B,kBAAkB;EAClB,+BAA+B;EAC/B,mBAAmB;EACnB;EACA;;YAGU;YAEA;YAUA;YAUA;EACV,MAAM;EACN,QAAQ;EACR;EACA,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA,SAAS;;;;;;EAMT;;;;;;;EAOA;;;;;;;;;EASA;EAEA;IAAU;IAAuB;IAAiB;;;iBAGnC;EACf;EACA;EACA,QAAQ;EACR,SAAS,MAAM;EACf;EACA;EACA,UAAU;EACV,WAAW;EACX,WAAW;EACX;EACA;EAEA;IAAU;IAAuB;IAAiB;;;YAGxC"}
@@ -4,7 +4,7 @@ const checkPackageUpdates = async (packageName, packageVersion) => {
4
4
  try {
5
5
  const pkgName = packageName ?? "@lifi/sdk";
6
6
  const latestVersion = (await (await fetch(`https://registry.npmjs.org/${pkgName}/latest`)).json()).version;
7
- const currentVersion = packageVersion ?? "0.0.0-preview-c996a5fb";
7
+ const currentVersion = packageVersion ?? "0.0.0-preview-9b9526be";
8
8
  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}.`);
9
9
  } catch (_error) {}
10
10
  };
@@ -1,3 +1,3 @@
1
1
  export declare const name = "@lifi/sdk";
2
- export declare const version = "0.0.0-preview-c996a5fb";
2
+ export declare const version = "0.0.0-preview-9b9526be";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1,6 +1,6 @@
1
1
  // src/version.ts
2
2
  const name = "@lifi/sdk";
3
- const version = "0.0.0-preview-c996a5fb";
3
+ const version = "0.0.0-preview-9b9526be";
4
4
  export { name, version };
5
5
 
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk'\nexport const version = '0.0.0-preview-c996a5fb'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk'\nexport const version = '0.0.0-preview-9b9526be'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/sdk",
3
- "version": "0.0.0-preview-c996a5fb",
3
+ "version": "0.0.0-preview-9b9526be",
4
4
  "description": "LI.FI SDK for Any-to-Any Cross-Chain-Swap",
5
5
  "homepage": "https://github.com/lifinance/sdk",
6
6
  "bugs": {
@@ -18,9 +18,6 @@ import { request } from '../utils/request.js'
18
18
  * @param options - Request options
19
19
  * @throws {LiFiError} - Throws a LiFiError if request fails
20
20
  * @returns Relayer quote for a token transfer
21
- * @deprecated The legacy gasless relayer service is shut down. Request
22
- * gasless routes with `options.gasless: true` on `getRoutes`, or
23
- * `gasless: true` on `getQuote`, and detect them with `isGaslessStep`.
24
21
  */
25
22
  export const getRelayerQuote = async (
26
23
  client: SDKClient,
@@ -55,8 +55,8 @@ import { getTokens } from './getTokens.js'
55
55
  import { getTools } from './getTools.js'
56
56
  import { getTransactionHistory } from './getTransactionHistory.js'
57
57
  import {
58
- type PatchContractCallsResponse,
59
58
  patchContractCalls,
59
+ type PatchContractCallsResponse,
60
60
  } from './patchContractCalls.js'
61
61
  import { relayTransaction } from './relayTransaction.js'
62
62
 
@@ -143,8 +143,6 @@ export type Actions = {
143
143
  * @param params - The configuration of the requested relayer quote
144
144
  * @param options - Request options
145
145
  * @returns Quote from a relayer
146
- * @deprecated The legacy gasless relayer service is shut down. Use
147
- * `getRoutes` with `options.gasless: true`.
148
146
  */
149
147
  getRelayerQuote: (
150
148
  params: QuoteRequestFromAmount,
@@ -36,9 +36,17 @@ export const relayTransaction = async (
36
36
  }
37
37
  }
38
38
 
39
+ // Determine if the request is for a gasless relayer service or advanced relayer service
40
+ // We will use the same endpoint for both after the gasless relayer service is deprecated
41
+ const relayerPath = params.typedData.some(
42
+ (t) => t.primaryType === 'PermitWitnessTransferFrom'
43
+ )
44
+ ? '/relayer/relay'
45
+ : '/advanced/relay'
46
+
39
47
  const result = await request<RelayResponse>(
40
48
  client.config,
41
- `${client.config.apiUrl}/advanced/relay`,
49
+ `${client.config.apiUrl}${relayerPath}`,
42
50
  {
43
51
  method: 'POST',
44
52
  headers: {
@@ -3,8 +3,8 @@ import { TransactionError } from '../../errors/errors.js'
3
3
  import type { StepExecutorContext, TaskResult } from '../../types/execution.js'
4
4
  import { BaseStepExecutionTask } from '../BaseStepExecutionTask.js'
5
5
  import {
6
- type CheckBalanceOptions,
7
6
  checkBalance,
7
+ type CheckBalanceOptions,
8
8
  } from './helpers/checkBalance.js'
9
9
 
10
10
  export class CheckBalanceTask extends BaseStepExecutionTask {
package/src/index.ts CHANGED
@@ -1,5 +1,4 @@
1
- // biome-ignore lint/performance/noBarrelFile: module entrypoint
2
- // biome-ignore lint/performance/noReExportAll: types
1
+ // oxlint-disable-next-line oxc/no-barrel-file -- module entrypoint
3
2
  export * from '@lifi/types'
4
3
  export { getChains } from './actions/getChains.js'
5
4
  export { getConnections } from './actions/getConnections.js'
@@ -136,10 +135,6 @@ export { checkPackageUpdates } from './utils/checkPackageUpdates.js'
136
135
  export { convertQuoteToRoute } from './utils/convertQuoteToRoute.js'
137
136
  export { fetchTxErrorDetails } from './utils/fetchTxErrorDetails.js'
138
137
  export { formatUnits } from './utils/formatUnits.js'
139
- export {
140
- GASLESS_RELAY_FEE_NAME,
141
- isGaslessStep,
142
- } from './utils/isGaslessStep.js'
143
138
  export { isHex } from './utils/isHex.js'
144
139
  export { LruMap } from './utils/lru.js'
145
140
  export { parseUnits } from './utils/parseUnits.js'
package/src/types/core.ts CHANGED
@@ -38,8 +38,9 @@ export interface SDKBaseConfig {
38
38
  storage?: SDKStorage
39
39
  }
40
40
 
41
- export interface SDKConfig
42
- extends Partial<Omit<SDKBaseConfig, 'integrator' | 'rpcUrls'>> {
41
+ export interface SDKConfig extends Partial<
42
+ Omit<SDKBaseConfig, 'integrator' | 'rpcUrls'>
43
+ > {
43
44
  integrator: string
44
45
  /**
45
46
  * Per chain, one list for reads and sends, or lists by role. The client
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk'
2
- export const version = '0.0.0-preview-c996a5fb'
2
+ export const version = '0.0.0-preview-9b9526be'
@@ -1,13 +0,0 @@
1
- import { LiFiStep } from "@lifi/types";
2
- /**
3
- * The `feeCosts` name of the gasless relay fee. The backend marks every
4
- * gasless step with it and guarantees that the name does not change.
5
- */
6
- export declare const GASLESS_RELAY_FEE_NAME = "LIFI Gasless Relay Fee";
7
- /**
8
- * Whether the step executes gasless: the user signs typed data and the LI.FI
9
- * relayer submits it and pays the gas. The relay fee is the only marker that
10
- * exists already at routes time, before `/advanced/stepTransaction` adds the
11
- * typed data.
12
- */
13
- export declare function isGaslessStep(step: Pick<LiFiStep, "estimate">): boolean;
@@ -1,20 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- // src/utils/isGaslessStep.ts
3
- /**
4
- * The `feeCosts` name of the gasless relay fee. The backend marks every
5
- * gasless step with it and guarantees that the name does not change.
6
- */
7
- const GASLESS_RELAY_FEE_NAME = "LIFI Gasless Relay Fee";
8
- /**
9
- * Whether the step executes gasless: the user signs typed data and the LI.FI
10
- * relayer submits it and pays the gas. The relay fee is the only marker that
11
- * exists already at routes time, before `/advanced/stepTransaction` adds the
12
- * typed data.
13
- */
14
- function isGaslessStep(step) {
15
- return step.estimate?.feeCosts?.some((feeCost) => feeCost.name === "LIFI Gasless Relay Fee") ?? false;
16
- }
17
- exports.GASLESS_RELAY_FEE_NAME = GASLESS_RELAY_FEE_NAME;
18
- exports.isGaslessStep = isGaslessStep;
19
-
20
- //# sourceMappingURL=isGaslessStep.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isGaslessStep.js","names":[],"sources":["../../../src/utils/isGaslessStep.ts"],"sourcesContent":["import type { LiFiStep } from '@lifi/types'\n\n/**\n * The `feeCosts` name of the gasless relay fee. The backend marks every\n * gasless step with it and guarantees that the name does not change.\n */\nexport const GASLESS_RELAY_FEE_NAME = 'LIFI Gasless Relay Fee'\n\n/**\n * Whether the step executes gasless: the user signs typed data and the LI.FI\n * relayer submits it and pays the gas. The relay fee is the only marker that\n * exists already at routes time, before `/advanced/stepTransaction` adds the\n * typed data.\n */\nexport function isGaslessStep(step: Pick<LiFiStep, 'estimate'>): boolean {\n return (\n step.estimate?.feeCosts?.some(\n (feeCost) => feeCost.name === GASLESS_RELAY_FEE_NAME\n ) ?? false\n )\n}\n"],"mappings":";;;;;;AAMA,MAAa,yBAAyB;;;;;;;AAQtC,SAAgB,cAAc,MAA2C;CACvE,OACE,KAAK,UAAU,UAAU,MACtB,YAAY,QAAQ,SAAA,wBACvB,KAAK;AAET"}
@@ -1,14 +0,0 @@
1
- import { LiFiStep } from "@lifi/types";
2
- /**
3
- * The `feeCosts` name of the gasless relay fee. The backend marks every
4
- * gasless step with it and guarantees that the name does not change.
5
- */
6
- export declare const GASLESS_RELAY_FEE_NAME = "LIFI Gasless Relay Fee";
7
- /**
8
- * Whether the step executes gasless: the user signs typed data and the LI.FI
9
- * relayer submits it and pays the gas. The relay fee is the only marker that
10
- * exists already at routes time, before `/advanced/stepTransaction` adds the
11
- * typed data.
12
- */
13
- export declare function isGaslessStep(step: Pick<LiFiStep, "estimate">): boolean;
14
- //# sourceMappingURL=isGaslessStep.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isGaslessStep.d.ts","names":[],"sources":["../../../src/utils/isGaslessStep.ts"],"mappings":";;;;;qBAMa;;;;;;;wBAQG,cAAc,MAAM,KAAK"}
@@ -1,18 +0,0 @@
1
- // src/utils/isGaslessStep.ts
2
- /**
3
- * The `feeCosts` name of the gasless relay fee. The backend marks every
4
- * gasless step with it and guarantees that the name does not change.
5
- */
6
- const GASLESS_RELAY_FEE_NAME = "LIFI Gasless Relay Fee";
7
- /**
8
- * Whether the step executes gasless: the user signs typed data and the LI.FI
9
- * relayer submits it and pays the gas. The relay fee is the only marker that
10
- * exists already at routes time, before `/advanced/stepTransaction` adds the
11
- * typed data.
12
- */
13
- function isGaslessStep(step) {
14
- return step.estimate?.feeCosts?.some((feeCost) => feeCost.name === "LIFI Gasless Relay Fee") ?? false;
15
- }
16
- export { GASLESS_RELAY_FEE_NAME, isGaslessStep };
17
-
18
- //# sourceMappingURL=isGaslessStep.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isGaslessStep.js","names":[],"sources":["../../../src/utils/isGaslessStep.ts"],"sourcesContent":["import type { LiFiStep } from '@lifi/types'\n\n/**\n * The `feeCosts` name of the gasless relay fee. The backend marks every\n * gasless step with it and guarantees that the name does not change.\n */\nexport const GASLESS_RELAY_FEE_NAME = 'LIFI Gasless Relay Fee'\n\n/**\n * Whether the step executes gasless: the user signs typed data and the LI.FI\n * relayer submits it and pays the gas. The relay fee is the only marker that\n * exists already at routes time, before `/advanced/stepTransaction` adds the\n * typed data.\n */\nexport function isGaslessStep(step: Pick<LiFiStep, 'estimate'>): boolean {\n return (\n step.estimate?.feeCosts?.some(\n (feeCost) => feeCost.name === GASLESS_RELAY_FEE_NAME\n ) ?? false\n )\n}\n"],"mappings":";;;;;AAMA,MAAa,yBAAyB;;;;;;;AAQtC,SAAgB,cAAc,MAA2C;CACvE,OACE,KAAK,UAAU,UAAU,MACtB,YAAY,QAAQ,SAAA,wBACvB,KAAK;AAET"}
@@ -1,21 +0,0 @@
1
- import type { LiFiStep } from '@lifi/types'
2
-
3
- /**
4
- * The `feeCosts` name of the gasless relay fee. The backend marks every
5
- * gasless step with it and guarantees that the name does not change.
6
- */
7
- export const GASLESS_RELAY_FEE_NAME = 'LIFI Gasless Relay Fee'
8
-
9
- /**
10
- * Whether the step executes gasless: the user signs typed data and the LI.FI
11
- * relayer submits it and pays the gas. The relay fee is the only marker that
12
- * exists already at routes time, before `/advanced/stepTransaction` adds the
13
- * typed data.
14
- */
15
- export function isGaslessStep(step: Pick<LiFiStep, 'estimate'>): boolean {
16
- return (
17
- step.estimate?.feeCosts?.some(
18
- (feeCost) => feeCost.name === GASLESS_RELAY_FEE_NAME
19
- ) ?? false
20
- )
21
- }