@lifi/sdk 4.0.0-beta.3 → 4.0.0-beta.5

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 (79) hide show
  1. package/dist/cjs/actions/getContractCallsQuote.js +10 -10
  2. package/dist/cjs/actions/getContractCallsQuote.js.map +1 -1
  3. package/dist/cjs/actions/getQuote.js +11 -11
  4. package/dist/cjs/actions/getQuote.js.map +1 -1
  5. package/dist/cjs/actions/getRelayerQuote.js +11 -11
  6. package/dist/cjs/actions/getRelayerQuote.js.map +1 -1
  7. package/dist/cjs/core/BaseStepExecutor.js +52 -53
  8. package/dist/cjs/core/BaseStepExecutor.js.map +1 -1
  9. package/dist/cjs/core/StatusManager.js +116 -133
  10. package/dist/cjs/core/StatusManager.js.map +1 -1
  11. package/dist/cjs/core/TaskPipeline.js +1 -2
  12. package/dist/cjs/core/TaskPipeline.js.map +1 -1
  13. package/dist/cjs/core/storage.js +1 -4
  14. package/dist/cjs/core/storage.js.map +1 -1
  15. package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js +1 -2
  16. package/dist/cjs/core/tasks/WaitForTransactionStatusTask.js.map +1 -1
  17. package/dist/cjs/errors/SDKError.d.ts +2 -2
  18. package/dist/cjs/errors/SDKError.js +5 -6
  19. package/dist/cjs/errors/SDKError.js.map +1 -1
  20. package/dist/cjs/errors/baseError.d.ts +1 -1
  21. package/dist/cjs/errors/baseError.js +2 -3
  22. package/dist/cjs/errors/baseError.js.map +1 -1
  23. package/dist/cjs/errors/errors.js +1 -2
  24. package/dist/cjs/errors/errors.js.map +1 -1
  25. package/dist/cjs/errors/httpError.js +6 -7
  26. package/dist/cjs/errors/httpError.js.map +1 -1
  27. package/dist/cjs/utils/checkPackageUpdates.js +1 -1
  28. package/dist/cjs/utils/withDedupe.d.ts +1 -1
  29. package/dist/cjs/utils/withDedupe.js +1 -2
  30. package/dist/cjs/utils/withDedupe.js.map +1 -1
  31. package/dist/cjs/version.d.ts +1 -1
  32. package/dist/cjs/version.js +1 -1
  33. package/dist/cjs/version.js.map +1 -1
  34. package/dist/esm/actions/getContractCallsQuote.js +10 -10
  35. package/dist/esm/actions/getContractCallsQuote.js.map +1 -1
  36. package/dist/esm/actions/getQuote.js +11 -11
  37. package/dist/esm/actions/getQuote.js.map +1 -1
  38. package/dist/esm/actions/getRelayerQuote.js +11 -11
  39. package/dist/esm/actions/getRelayerQuote.js.map +1 -1
  40. package/dist/esm/core/BaseStepExecutor.js +52 -53
  41. package/dist/esm/core/BaseStepExecutor.js.map +1 -1
  42. package/dist/esm/core/StatusManager.js +116 -133
  43. package/dist/esm/core/StatusManager.js.map +1 -1
  44. package/dist/esm/core/TaskPipeline.js +1 -2
  45. package/dist/esm/core/TaskPipeline.js.map +1 -1
  46. package/dist/esm/core/storage.js +1 -4
  47. package/dist/esm/core/storage.js.map +1 -1
  48. package/dist/esm/core/tasks/WaitForTransactionStatusTask.js +1 -2
  49. package/dist/esm/core/tasks/WaitForTransactionStatusTask.js.map +1 -1
  50. package/dist/esm/errors/SDKError.d.ts +2 -2
  51. package/dist/esm/errors/SDKError.d.ts.map +1 -1
  52. package/dist/esm/errors/SDKError.js +5 -6
  53. package/dist/esm/errors/SDKError.js.map +1 -1
  54. package/dist/esm/errors/baseError.d.ts +1 -1
  55. package/dist/esm/errors/baseError.d.ts.map +1 -1
  56. package/dist/esm/errors/baseError.js +2 -3
  57. package/dist/esm/errors/baseError.js.map +1 -1
  58. package/dist/esm/errors/errors.js +1 -2
  59. package/dist/esm/errors/errors.js.map +1 -1
  60. package/dist/esm/errors/httpError.js +6 -7
  61. package/dist/esm/errors/httpError.js.map +1 -1
  62. package/dist/esm/utils/checkPackageUpdates.js +1 -1
  63. package/dist/esm/utils/withDedupe.d.ts +1 -1
  64. package/dist/esm/utils/withDedupe.d.ts.map +1 -1
  65. package/dist/esm/utils/withDedupe.js +1 -2
  66. package/dist/esm/utils/withDedupe.js.map +1 -1
  67. package/dist/esm/version.d.ts +1 -1
  68. package/dist/esm/version.js +1 -1
  69. package/dist/esm/version.js.map +1 -1
  70. package/package.json +2 -2
  71. package/src/version.ts +1 -1
  72. package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +0 -12
  73. package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.js +0 -14
  74. package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +0 -9
  75. package/dist/cjs/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.js +0 -16
  76. package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +0 -12
  77. package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.js +0 -14
  78. package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +0 -9
  79. package/dist/esm/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.js +0 -11
@@ -22,16 +22,16 @@ const getContractCallsQuote = async (client, params, options) => {
22
22
  "contractCalls"
23
23
  ]) if (!params[requiredParameter]) throw new require_errors_SDKError.SDKError(new require_errors_errors.ValidationError(`Required parameter "${requiredParameter}" is missing.`));
24
24
  if (!(0, _lifi_types.isContractCallsRequestWithFromAmount)(params) && !(0, _lifi_types.isContractCallsRequestWithToAmount)(params)) throw new require_errors_SDKError.SDKError(new require_errors_errors.ValidationError(`Required parameter "fromAmount" or "toAmount" is missing.`));
25
- params.integrator ?? (params.integrator = client.config.integrator);
26
- params.slippage ?? (params.slippage = client.config.routeOptions?.slippage);
27
- params.referrer ?? (params.referrer = client.config.routeOptions?.referrer);
28
- params.fee ?? (params.fee = client.config.routeOptions?.fee);
29
- params.allowBridges ?? (params.allowBridges = client.config.routeOptions?.bridges?.allow);
30
- params.denyBridges ?? (params.denyBridges = client.config.routeOptions?.bridges?.deny);
31
- params.preferBridges ?? (params.preferBridges = client.config.routeOptions?.bridges?.prefer);
32
- params.allowExchanges ?? (params.allowExchanges = client.config.routeOptions?.exchanges?.allow);
33
- params.denyExchanges ?? (params.denyExchanges = client.config.routeOptions?.exchanges?.deny);
34
- params.preferExchanges ?? (params.preferExchanges = client.config.routeOptions?.exchanges?.prefer);
25
+ params.integrator ??= client.config.integrator;
26
+ params.slippage ??= client.config.routeOptions?.slippage;
27
+ params.referrer ??= client.config.routeOptions?.referrer;
28
+ params.fee ??= client.config.routeOptions?.fee;
29
+ params.allowBridges ??= client.config.routeOptions?.bridges?.allow;
30
+ params.denyBridges ??= client.config.routeOptions?.bridges?.deny;
31
+ params.preferBridges ??= client.config.routeOptions?.bridges?.prefer;
32
+ params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow;
33
+ params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny;
34
+ params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer;
35
35
  return await require_utils_request.request(client.config, `${client.config.apiUrl}/quote/contractCalls`, {
36
36
  method: "POST",
37
37
  headers: { "Content-Type": "application/json" },
@@ -1 +1 @@
1
- {"version":3,"file":"getContractCallsQuote.js","names":["SDKError","ValidationError","request"],"sources":["../../../src/actions/getContractCallsQuote.ts"],"sourcesContent":["import type {\n ContractCallsQuoteRequest,\n LiFiStep,\n RequestOptions,\n} from '@lifi/types'\nimport {\n isContractCallsRequestWithFromAmount,\n isContractCallsRequestWithToAmount,\n} from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a quote for a destination contract call\n * @param client - The SDK client\n * @param params - The configuration of the requested destination call\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns - Returns step.\n */\nexport const getContractCallsQuote = async (\n client: SDKClient,\n params: ContractCallsQuoteRequest,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n // validation\n const requiredParameters: Array<keyof ContractCallsQuoteRequest> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'toChain',\n 'toToken',\n 'contractCalls',\n ]\n for (const requiredParameter of requiredParameters) {\n if (!params[requiredParameter]) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"${requiredParameter}\" is missing.`\n )\n )\n }\n }\n if (\n !isContractCallsRequestWithFromAmount(params) &&\n !isContractCallsRequestWithToAmount(params)\n ) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"fromAmount\" or \"toAmount\" is missing.`\n )\n )\n }\n // apply defaults\n // option.order is not used in this endpoint\n params.integrator ??= client.config.integrator\n params.slippage ??= client.config.routeOptions?.slippage\n params.referrer ??= client.config.routeOptions?.referrer\n params.fee ??= client.config.routeOptions?.fee\n params.allowBridges ??= client.config.routeOptions?.bridges?.allow\n params.denyBridges ??= client.config.routeOptions?.bridges?.deny\n params.preferBridges ??= client.config.routeOptions?.bridges?.prefer\n params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow\n params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny\n params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer\n // send request\n return await request<LiFiStep>(\n client.config,\n `${client.config.apiUrl}/quote/contractCalls`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params),\n signal: options?.signal,\n }\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB,OACnC,QACA,QACA,YACsB;AAUtB,MAAK,MAAM,qBARwD;EACjE;EACA;EACA;EACA;EACA;EACA;EACD,CAEC,KAAI,CAAC,OAAO,mBACV,OAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,eAC1C,CACF;AAGL,KACE,EAAA,GAAA,YAAA,sCAAsC,OAAO,IAC7C,EAAA,GAAA,YAAA,oCAAoC,OAAO,CAE3C,OAAM,IAAID,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,4DACD,CACF;AAIH,QAAO,eAAP,OAAO,aAAe,OAAO,OAAO;AACpC,QAAO,aAAP,OAAO,WAAa,OAAO,OAAO,cAAc;AAChD,QAAO,aAAP,OAAO,WAAa,OAAO,OAAO,cAAc;AAChD,QAAO,QAAP,OAAO,MAAQ,OAAO,OAAO,cAAc;AAC3C,QAAO,iBAAP,OAAO,eAAiB,OAAO,OAAO,cAAc,SAAS;AAC7D,QAAO,gBAAP,OAAO,cAAgB,OAAO,OAAO,cAAc,SAAS;AAC5D,QAAO,kBAAP,OAAO,gBAAkB,OAAO,OAAO,cAAc,SAAS;AAC9D,QAAO,mBAAP,OAAO,iBAAmB,OAAO,OAAO,cAAc,WAAW;AACjE,QAAO,kBAAP,OAAO,gBAAkB,OAAO,OAAO,cAAc,WAAW;AAChE,QAAO,oBAAP,OAAO,kBAAoB,OAAO,OAAO,cAAc,WAAW;AAElE,QAAO,MAAMC,sBAAAA,QACX,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,uBACxB;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,oBACjB;EACD,MAAM,KAAK,UAAU,OAAO;EAC5B,QAAQ,SAAS;EAClB,CACF"}
1
+ {"version":3,"file":"getContractCallsQuote.js","names":["SDKError","ValidationError","request"],"sources":["../../../src/actions/getContractCallsQuote.ts"],"sourcesContent":["import type {\n ContractCallsQuoteRequest,\n LiFiStep,\n RequestOptions,\n} from '@lifi/types'\nimport {\n isContractCallsRequestWithFromAmount,\n isContractCallsRequestWithToAmount,\n} from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a quote for a destination contract call\n * @param client - The SDK client\n * @param params - The configuration of the requested destination call\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns - Returns step.\n */\nexport const getContractCallsQuote = async (\n client: SDKClient,\n params: ContractCallsQuoteRequest,\n options?: RequestOptions\n): Promise<LiFiStep> => {\n // validation\n const requiredParameters: Array<keyof ContractCallsQuoteRequest> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'toChain',\n 'toToken',\n 'contractCalls',\n ]\n for (const requiredParameter of requiredParameters) {\n if (!params[requiredParameter]) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"${requiredParameter}\" is missing.`\n )\n )\n }\n }\n if (\n !isContractCallsRequestWithFromAmount(params) &&\n !isContractCallsRequestWithToAmount(params)\n ) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"fromAmount\" or \"toAmount\" is missing.`\n )\n )\n }\n // apply defaults\n // option.order is not used in this endpoint\n params.integrator ??= client.config.integrator\n params.slippage ??= client.config.routeOptions?.slippage\n params.referrer ??= client.config.routeOptions?.referrer\n params.fee ??= client.config.routeOptions?.fee\n params.allowBridges ??= client.config.routeOptions?.bridges?.allow\n params.denyBridges ??= client.config.routeOptions?.bridges?.deny\n params.preferBridges ??= client.config.routeOptions?.bridges?.prefer\n params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow\n params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny\n params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer\n // send request\n return await request<LiFiStep>(\n client.config,\n `${client.config.apiUrl}/quote/contractCalls`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(params),\n signal: options?.signal,\n }\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAa,wBAAwB,OACnC,QACA,QACA,YACsB;AAUtB,MAAK,MAAM,qBARwD;EACjE;EACA;EACA;EACA;EACA;EACA;EACD,CAEC,KAAI,CAAC,OAAO,mBACV,OAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,eAC1C,CACF;AAGL,KACE,EAAA,GAAA,YAAA,sCAAsC,OAAO,IAC7C,EAAA,GAAA,YAAA,oCAAoC,OAAO,CAE3C,OAAM,IAAID,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,4DACD,CACF;AAIH,QAAO,eAAe,OAAO,OAAO;AACpC,QAAO,aAAa,OAAO,OAAO,cAAc;AAChD,QAAO,aAAa,OAAO,OAAO,cAAc;AAChD,QAAO,QAAQ,OAAO,OAAO,cAAc;AAC3C,QAAO,iBAAiB,OAAO,OAAO,cAAc,SAAS;AAC7D,QAAO,gBAAgB,OAAO,OAAO,cAAc,SAAS;AAC5D,QAAO,kBAAkB,OAAO,OAAO,cAAc,SAAS;AAC9D,QAAO,mBAAmB,OAAO,OAAO,cAAc,WAAW;AACjE,QAAO,kBAAkB,OAAO,OAAO,cAAc,WAAW;AAChE,QAAO,oBAAoB,OAAO,OAAO,cAAc,WAAW;AAElE,QAAO,MAAMC,sBAAAA,QACX,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,uBACxB;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,oBACjB;EACD,MAAM,KAAK,UAAU,OAAO;EAC5B,QAAQ,SAAS;EAClB,CACF"}
@@ -15,17 +15,17 @@ async function getQuote(client, params, options) {
15
15
  const isToAmountRequest = "toAmount" in params && params.toAmount !== void 0;
16
16
  if (!isFromAmountRequest && !isToAmountRequest) throw new require_errors_SDKError.SDKError(new require_errors_errors.ValidationError("Required parameter \"fromAmount\" or \"toAmount\" is missing."));
17
17
  if (isFromAmountRequest && isToAmountRequest) throw new require_errors_SDKError.SDKError(new require_errors_errors.ValidationError("Cannot provide both \"fromAmount\" and \"toAmount\" parameters."));
18
- params.integrator ?? (params.integrator = client.config.integrator);
19
- params.order ?? (params.order = client.config.routeOptions?.order);
20
- params.slippage ?? (params.slippage = client.config.routeOptions?.slippage);
21
- params.referrer ?? (params.referrer = client.config.routeOptions?.referrer);
22
- params.fee ?? (params.fee = client.config.routeOptions?.fee);
23
- params.allowBridges ?? (params.allowBridges = client.config.routeOptions?.bridges?.allow);
24
- params.denyBridges ?? (params.denyBridges = client.config.routeOptions?.bridges?.deny);
25
- params.preferBridges ?? (params.preferBridges = client.config.routeOptions?.bridges?.prefer);
26
- params.allowExchanges ?? (params.allowExchanges = client.config.routeOptions?.exchanges?.allow);
27
- params.denyExchanges ?? (params.denyExchanges = client.config.routeOptions?.exchanges?.deny);
28
- params.preferExchanges ?? (params.preferExchanges = client.config.routeOptions?.exchanges?.prefer);
18
+ params.integrator ??= client.config.integrator;
19
+ params.order ??= client.config.routeOptions?.order;
20
+ params.slippage ??= client.config.routeOptions?.slippage;
21
+ params.referrer ??= client.config.routeOptions?.referrer;
22
+ params.fee ??= client.config.routeOptions?.fee;
23
+ params.allowBridges ??= client.config.routeOptions?.bridges?.allow;
24
+ params.denyBridges ??= client.config.routeOptions?.bridges?.deny;
25
+ params.preferBridges ??= client.config.routeOptions?.bridges?.prefer;
26
+ params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow;
27
+ params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny;
28
+ params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer;
29
29
  for (const key of Object.keys(params)) if (params[key] === void 0 || params[key] === null) delete params[key];
30
30
  return await require_utils_request.request(client.config, `${client.config.apiUrl}/${isFromAmountRequest ? "quote" : "quote/toAmount"}?${new URLSearchParams(params)}`, { signal: options?.signal });
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getQuote.js","names":["SDKError","ValidationError","request"],"sources":["../../../src/actions/getQuote.ts"],"sourcesContent":["import type { LiFiStep, RequestOptions } from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type {\n QuoteRequest,\n QuoteRequestFromAmount,\n QuoteRequestToAmount,\n} from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a quote for a token transfer\n * @param client - The SDK client\n * @param params - The configuration of the requested quote\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Quote for a token transfer\n */\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n): Promise<LiFiStep>\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequestToAmount,\n options?: RequestOptions\n): Promise<LiFiStep>\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequest,\n options?: RequestOptions\n): Promise<LiFiStep> {\n const requiredParameters: Array<keyof QuoteRequest> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'toChain',\n 'toToken',\n ]\n\n for (const requiredParameter of requiredParameters) {\n if (!params[requiredParameter]) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"${requiredParameter}\" is missing.`\n )\n )\n }\n }\n\n const isFromAmountRequest =\n 'fromAmount' in params && params.fromAmount !== undefined\n const isToAmountRequest =\n 'toAmount' in params && params.toAmount !== undefined\n\n if (!isFromAmountRequest && !isToAmountRequest) {\n throw new SDKError(\n new ValidationError(\n 'Required parameter \"fromAmount\" or \"toAmount\" is missing.'\n )\n )\n }\n\n if (isFromAmountRequest && isToAmountRequest) {\n throw new SDKError(\n new ValidationError(\n 'Cannot provide both \"fromAmount\" and \"toAmount\" parameters.'\n )\n )\n }\n\n // apply defaults\n params.integrator ??= client.config.integrator\n params.order ??= client.config.routeOptions?.order\n params.slippage ??= client.config.routeOptions?.slippage\n params.referrer ??= client.config.routeOptions?.referrer\n params.fee ??= client.config.routeOptions?.fee\n params.allowBridges ??= client.config.routeOptions?.bridges?.allow\n params.denyBridges ??= client.config.routeOptions?.bridges?.deny\n params.preferBridges ??= client.config.routeOptions?.bridges?.prefer\n params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow\n params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny\n params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer\n\n for (const key of Object.keys(params)) {\n if (\n params[key as keyof QuoteRequest] === undefined ||\n params[key as keyof QuoteRequest] === null\n ) {\n delete params[key as keyof QuoteRequest]\n }\n }\n\n return await request<LiFiStep>(\n client.config,\n `${client.config.apiUrl}/${isFromAmountRequest ? 'quote' : 'quote/toAmount'}?${new URLSearchParams(\n params as unknown as Record<string, string>\n )}`,\n {\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AO,MAAMC,sBAAAA,QACX,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,GAAG,sBAAsB,UAAU,iBAAiB,GAAG,IAAI,gBACjF,OACD,IACD,EACE,QAAQ,SAAS,QAClB,CACF"}
1
+ {"version":3,"file":"getQuote.js","names":["SDKError","ValidationError","request"],"sources":["../../../src/actions/getQuote.ts"],"sourcesContent":["import type { LiFiStep, RequestOptions } from '@lifi/types'\nimport { ValidationError } from '../errors/errors.js'\nimport { SDKError } from '../errors/SDKError.js'\nimport type {\n QuoteRequest,\n QuoteRequestFromAmount,\n QuoteRequestToAmount,\n} from '../types/actions.js'\nimport type { SDKClient } from '../types/core.js'\nimport { request } from '../utils/request.js'\n\n/**\n * Get a quote for a token transfer\n * @param client - The SDK client\n * @param params - The configuration of the requested quote\n * @param options - Request options\n * @throws {LiFiError} - Throws a LiFiError if request fails\n * @returns Quote for a token transfer\n */\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequestFromAmount,\n options?: RequestOptions\n): Promise<LiFiStep>\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequestToAmount,\n options?: RequestOptions\n): Promise<LiFiStep>\nexport async function getQuote(\n client: SDKClient,\n params: QuoteRequest,\n options?: RequestOptions\n): Promise<LiFiStep> {\n const requiredParameters: Array<keyof QuoteRequest> = [\n 'fromChain',\n 'fromToken',\n 'fromAddress',\n 'toChain',\n 'toToken',\n ]\n\n for (const requiredParameter of requiredParameters) {\n if (!params[requiredParameter]) {\n throw new SDKError(\n new ValidationError(\n `Required parameter \"${requiredParameter}\" is missing.`\n )\n )\n }\n }\n\n const isFromAmountRequest =\n 'fromAmount' in params && params.fromAmount !== undefined\n const isToAmountRequest =\n 'toAmount' in params && params.toAmount !== undefined\n\n if (!isFromAmountRequest && !isToAmountRequest) {\n throw new SDKError(\n new ValidationError(\n 'Required parameter \"fromAmount\" or \"toAmount\" is missing.'\n )\n )\n }\n\n if (isFromAmountRequest && isToAmountRequest) {\n throw new SDKError(\n new ValidationError(\n 'Cannot provide both \"fromAmount\" and \"toAmount\" parameters.'\n )\n )\n }\n\n // apply defaults\n params.integrator ??= client.config.integrator\n params.order ??= client.config.routeOptions?.order\n params.slippage ??= client.config.routeOptions?.slippage\n params.referrer ??= client.config.routeOptions?.referrer\n params.fee ??= client.config.routeOptions?.fee\n params.allowBridges ??= client.config.routeOptions?.bridges?.allow\n params.denyBridges ??= client.config.routeOptions?.bridges?.deny\n params.preferBridges ??= client.config.routeOptions?.bridges?.prefer\n params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow\n params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny\n params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer\n\n for (const key of Object.keys(params)) {\n if (\n params[key as keyof QuoteRequest] === undefined ||\n params[key as keyof QuoteRequest] === null\n ) {\n delete params[key as keyof QuoteRequest]\n }\n }\n\n return await request<LiFiStep>(\n client.config,\n `${client.config.apiUrl}/${isFromAmountRequest ? 'quote' : 'quote/toAmount'}?${new URLSearchParams(\n params as unknown as Record<string, string>\n )}`,\n {\n signal: options?.signal,\n }\n )\n}\n"],"mappings":";;;;;AA6BA,eAAsB,SACpB,QACA,QACA,SACmB;AASnB,MAAK,MAAM,qBAR2C;EACpD;EACA;EACA;EACA;EACA;EACD,CAGC,KAAI,CAAC,OAAO,mBACV,OAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,eAC1C,CACF;CAIL,MAAM,sBACJ,gBAAgB,UAAU,OAAO,eAAe,KAAA;CAClD,MAAM,oBACJ,cAAc,UAAU,OAAO,aAAa,KAAA;AAE9C,KAAI,CAAC,uBAAuB,CAAC,kBAC3B,OAAM,IAAID,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,gEACD,CACF;AAGH,KAAI,uBAAuB,kBACzB,OAAM,IAAID,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,kEACD,CACF;AAIH,QAAO,eAAe,OAAO,OAAO;AACpC,QAAO,UAAU,OAAO,OAAO,cAAc;AAC7C,QAAO,aAAa,OAAO,OAAO,cAAc;AAChD,QAAO,aAAa,OAAO,OAAO,cAAc;AAChD,QAAO,QAAQ,OAAO,OAAO,cAAc;AAC3C,QAAO,iBAAiB,OAAO,OAAO,cAAc,SAAS;AAC7D,QAAO,gBAAgB,OAAO,OAAO,cAAc,SAAS;AAC5D,QAAO,kBAAkB,OAAO,OAAO,cAAc,SAAS;AAC9D,QAAO,mBAAmB,OAAO,OAAO,cAAc,WAAW;AACjE,QAAO,kBAAkB,OAAO,OAAO,cAAc,WAAW;AAChE,QAAO,oBAAoB,OAAO,OAAO,cAAc,WAAW;AAElE,MAAK,MAAM,OAAO,OAAO,KAAK,OAAO,CACnC,KACE,OAAO,SAA+B,KAAA,KACtC,OAAO,SAA+B,KAEtC,QAAO,OAAO;AAIlB,QAAO,MAAMC,sBAAAA,QACX,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,GAAG,sBAAsB,UAAU,iBAAiB,GAAG,IAAI,gBACjF,OACD,IACD,EACE,QAAQ,SAAS,QAClB,CACF"}
@@ -22,17 +22,17 @@ const getRelayerQuote = async (client, params, options) => {
22
22
  "toChain",
23
23
  "toToken"
24
24
  ]) if (!params[requiredParameter]) throw new require_errors_SDKError.SDKError(new require_errors_errors.ValidationError(`Required parameter "${requiredParameter}" is missing.`));
25
- params.integrator ?? (params.integrator = client.config.integrator);
26
- params.order ?? (params.order = client.config.routeOptions?.order);
27
- params.slippage ?? (params.slippage = client.config.routeOptions?.slippage);
28
- params.referrer ?? (params.referrer = client.config.routeOptions?.referrer);
29
- params.fee ?? (params.fee = client.config.routeOptions?.fee);
30
- params.allowBridges ?? (params.allowBridges = client.config.routeOptions?.bridges?.allow);
31
- params.denyBridges ?? (params.denyBridges = client.config.routeOptions?.bridges?.deny);
32
- params.preferBridges ?? (params.preferBridges = client.config.routeOptions?.bridges?.prefer);
33
- params.allowExchanges ?? (params.allowExchanges = client.config.routeOptions?.exchanges?.allow);
34
- params.denyExchanges ?? (params.denyExchanges = client.config.routeOptions?.exchanges?.deny);
35
- params.preferExchanges ?? (params.preferExchanges = client.config.routeOptions?.exchanges?.prefer);
25
+ params.integrator ??= client.config.integrator;
26
+ params.order ??= client.config.routeOptions?.order;
27
+ params.slippage ??= client.config.routeOptions?.slippage;
28
+ params.referrer ??= client.config.routeOptions?.referrer;
29
+ params.fee ??= client.config.routeOptions?.fee;
30
+ params.allowBridges ??= client.config.routeOptions?.bridges?.allow;
31
+ params.denyBridges ??= client.config.routeOptions?.bridges?.deny;
32
+ params.preferBridges ??= client.config.routeOptions?.bridges?.prefer;
33
+ params.allowExchanges ??= client.config.routeOptions?.exchanges?.allow;
34
+ params.denyExchanges ??= client.config.routeOptions?.exchanges?.deny;
35
+ params.preferExchanges ??= client.config.routeOptions?.exchanges?.prefer;
36
36
  for (const key of Object.keys(params)) if (params[key] === void 0 || params[key] === null) delete params[key];
37
37
  const result = await require_utils_request.request(client.config, `${client.config.apiUrl}/relayer/quote?${new URLSearchParams(params)}`, { signal: options?.signal });
38
38
  if (result.status === "error") throw new require_errors_baseError.BaseError(require_errors_constants.ErrorName.ServerError, result.data.code, result.data.message);
@@ -1 +1 @@
1
- {"version":3,"file":"getRelayerQuote.js","names":["SDKError","ValidationError","request","BaseError","ErrorName"],"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;AAStB,MAAK,MAAM,qBARqD;EAC9D;EACA;EACA;EACA;EACA;EACA;EACD,CAEC,KAAI,CAAC,OAAO,mBACV,OAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,eAC1C,CACF;AAKL,QAAO,eAAP,OAAO,aAAe,OAAO,OAAO;AACpC,QAAO,UAAP,OAAO,QAAU,OAAO,OAAO,cAAc;AAC7C,QAAO,aAAP,OAAO,WAAa,OAAO,OAAO,cAAc;AAChD,QAAO,aAAP,OAAO,WAAa,OAAO,OAAO,cAAc;AAChD,QAAO,QAAP,OAAO,MAAQ,OAAO,OAAO,cAAc;AAC3C,QAAO,iBAAP,OAAO,eAAiB,OAAO,OAAO,cAAc,SAAS;AAC7D,QAAO,gBAAP,OAAO,cAAgB,OAAO,OAAO,cAAc,SAAS;AAC5D,QAAO,kBAAP,OAAO,gBAAkB,OAAO,OAAO,cAAc,SAAS;AAC9D,QAAO,mBAAP,OAAO,iBAAmB,OAAO,OAAO,cAAc,WAAW;AACjE,QAAO,kBAAP,OAAO,gBAAkB,OAAO,OAAO,cAAc,WAAW;AAChE,QAAO,oBAAP,OAAO,kBAAoB,OAAO,OAAO,cAAc,WAAW;AAElE,MAAK,MAAM,OAAO,OAAO,KAAK,OAAO,CACnC,KACE,OAAO,SAA+B,KAAA,KACtC,OAAO,SAA+B,KAEtC,QAAO,OAAO;CAIlB,MAAM,SAAS,MAAMC,sBAAAA,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,iBAAiB,IAAI,gBAC3C,OACD,IACD,EACE,QAAQ,SAAS,QAClB,CACF;AAED,KAAI,OAAO,WAAW,QACpB,OAAM,IAAIC,yBAAAA,UACRC,yBAAAA,UAAU,aACV,OAAO,KAAK,MACZ,OAAO,KAAK,QACb;AAGH,QAAO,OAAO"}
1
+ {"version":3,"file":"getRelayerQuote.js","names":["SDKError","ValidationError","request","BaseError","ErrorName"],"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;AAStB,MAAK,MAAM,qBARqD;EAC9D;EACA;EACA;EACA;EACA;EACA;EACD,CAEC,KAAI,CAAC,OAAO,mBACV,OAAM,IAAIA,wBAAAA,SACR,IAAIC,sBAAAA,gBACF,uBAAuB,kBAAkB,eAC1C,CACF;AAKL,QAAO,eAAe,OAAO,OAAO;AACpC,QAAO,UAAU,OAAO,OAAO,cAAc;AAC7C,QAAO,aAAa,OAAO,OAAO,cAAc;AAChD,QAAO,aAAa,OAAO,OAAO,cAAc;AAChD,QAAO,QAAQ,OAAO,OAAO,cAAc;AAC3C,QAAO,iBAAiB,OAAO,OAAO,cAAc,SAAS;AAC7D,QAAO,gBAAgB,OAAO,OAAO,cAAc,SAAS;AAC5D,QAAO,kBAAkB,OAAO,OAAO,cAAc,SAAS;AAC9D,QAAO,mBAAmB,OAAO,OAAO,cAAc,WAAW;AACjE,QAAO,kBAAkB,OAAO,OAAO,cAAc,WAAW;AAChE,QAAO,oBAAoB,OAAO,OAAO,cAAc,WAAW;AAElE,MAAK,MAAM,OAAO,OAAO,KAAK,OAAO,CACnC,KACE,OAAO,SAA+B,KAAA,KACtC,OAAO,SAA+B,KAEtC,QAAO,OAAO;CAIlB,MAAM,SAAS,MAAMC,sBAAAA,QACnB,OAAO,QACP,GAAG,OAAO,OAAO,OAAO,iBAAiB,IAAI,gBAC3C,OACD,IACD,EACE,QAAQ,SAAS,QAClB,CACF;AAED,KAAI,OAAO,WAAW,QACpB,OAAM,IAAIC,yBAAAA,UACRC,yBAAAA,UAAU,aACV,OAAO,KAAK,MACZ,OAAO,KAAK,QACb;AAGH,QAAO,OAAO"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defineProperty = require("../_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js");
3
2
  const require_errors_errors = require("../errors/errors.js");
4
3
  const require_core_StatusManager = require("./StatusManager.js");
5
4
  //#region src/core/BaseStepExecutor.ts
@@ -9,62 +8,62 @@ const defaultInteractionSettings = {
9
8
  allowExecution: true
10
9
  };
11
10
  var BaseStepExecutor = class {
11
+ executionOptions;
12
+ statusManager;
13
+ allowUserInteraction = true;
14
+ allowExecution = true;
12
15
  constructor(options) {
13
- require_defineProperty._defineProperty(this, "executionOptions", void 0);
14
- require_defineProperty._defineProperty(this, "statusManager", void 0);
15
- require_defineProperty._defineProperty(this, "allowUserInteraction", true);
16
- require_defineProperty._defineProperty(this, "allowExecution", true);
17
- require_defineProperty._defineProperty(this, "setInteraction", (settings) => {
18
- const interactionSettings = {
19
- ...defaultInteractionSettings,
20
- ...settings
21
- };
22
- this.allowUserInteraction = interactionSettings.allowInteraction;
23
- this.statusManager.allowUpdates(interactionSettings.allowUpdates);
24
- this.allowExecution = interactionSettings.allowExecution;
25
- });
26
- require_defineProperty._defineProperty(this, "createBaseContext", async (client, step, retryParams) => {
27
- const fromChain = await client.getChainById(step.action.fromChainId);
28
- const toChain = await client.getChainById(step.action.toChainId);
29
- return {
30
- client,
31
- step,
32
- fromChain,
33
- toChain,
34
- isBridgeExecution: fromChain.id !== toChain.id,
35
- retryParams,
36
- statusManager: this.statusManager,
37
- executionOptions: this.executionOptions,
38
- allowUserInteraction: this.allowUserInteraction
39
- };
40
- });
41
- require_defineProperty._defineProperty(this, "executeStep", async (client, step, retryParams) => {
42
- try {
43
- step.execution = this.statusManager.initializeExecution(step);
44
- const baseContext = await this.createBaseContext(client, step, retryParams);
45
- const context = await this.createContext(baseContext);
46
- await this.createPipeline(context).run(context);
47
- return step;
48
- } catch (error) {
49
- const action = step.execution?.actions?.at(-1);
50
- const parsed = await this.parseErrors(error, step, action, retryParams);
51
- if (!(parsed instanceof require_errors_errors.ExecuteStepRetryError)) if (action) this.statusManager.updateAction(step, action.type, "FAILED", { error: {
52
- message: parsed.cause?.message,
53
- code: parsed.code
54
- } });
55
- else this.statusManager.updateExecution(step, {
56
- status: "FAILED",
57
- error: {
58
- message: parsed.cause?.message,
59
- code: parsed.code
60
- }
61
- });
62
- throw parsed;
63
- }
64
- });
65
16
  this.statusManager = new require_core_StatusManager.StatusManager(options.routeId);
66
17
  this.executionOptions = options.executionOptions;
67
18
  }
19
+ setInteraction = (settings) => {
20
+ const interactionSettings = {
21
+ ...defaultInteractionSettings,
22
+ ...settings
23
+ };
24
+ this.allowUserInteraction = interactionSettings.allowInteraction;
25
+ this.statusManager.allowUpdates(interactionSettings.allowUpdates);
26
+ this.allowExecution = interactionSettings.allowExecution;
27
+ };
28
+ createBaseContext = async (client, step, retryParams) => {
29
+ const fromChain = await client.getChainById(step.action.fromChainId);
30
+ const toChain = await client.getChainById(step.action.toChainId);
31
+ return {
32
+ client,
33
+ step,
34
+ fromChain,
35
+ toChain,
36
+ isBridgeExecution: fromChain.id !== toChain.id,
37
+ retryParams,
38
+ statusManager: this.statusManager,
39
+ executionOptions: this.executionOptions,
40
+ allowUserInteraction: this.allowUserInteraction
41
+ };
42
+ };
43
+ executeStep = async (client, step, retryParams) => {
44
+ try {
45
+ step.execution = this.statusManager.initializeExecution(step);
46
+ const baseContext = await this.createBaseContext(client, step, retryParams);
47
+ const context = await this.createContext(baseContext);
48
+ await this.createPipeline(context).run(context);
49
+ return step;
50
+ } catch (error) {
51
+ const action = step.execution?.actions?.at(-1);
52
+ const parsed = await this.parseErrors(error, step, action, retryParams);
53
+ if (!(parsed instanceof require_errors_errors.ExecuteStepRetryError)) if (action) this.statusManager.updateAction(step, action.type, "FAILED", { error: {
54
+ message: parsed.cause?.message,
55
+ code: parsed.code
56
+ } });
57
+ else this.statusManager.updateExecution(step, {
58
+ status: "FAILED",
59
+ error: {
60
+ message: parsed.cause?.message,
61
+ code: parsed.code
62
+ }
63
+ });
64
+ throw parsed;
65
+ }
66
+ };
68
67
  };
69
68
  //#endregion
70
69
  exports.BaseStepExecutor = BaseStepExecutor;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseStepExecutor.js","names":["ExecuteStepRetryError","StatusManager"],"sources":["../../../src/core/BaseStepExecutor.ts"],"sourcesContent":["import { ExecuteStepRetryError } from '../errors/errors.js'\nimport type { SDKError } from '../errors/SDKError.js'\nimport type {\n ExecuteStepRetryParams,\n ExecutionAction,\n ExecutionOptions,\n InteractionSettings,\n LiFiStepExtended,\n SDKClient,\n StepExecutor,\n StepExecutorOptions,\n} from '../types/core.js'\nimport type {\n StepExecutorBaseContext,\n StepExecutorContext,\n} from '../types/execution.js'\nimport { StatusManager } from './StatusManager.js'\nimport type { TaskPipeline } from './TaskPipeline.js'\n\n// Please be careful when changing the defaults as it may break the behavior (e.g., background execution)\nconst defaultInteractionSettings = {\n allowInteraction: true,\n allowUpdates: true,\n allowExecution: true,\n}\n\nexport abstract class BaseStepExecutor implements StepExecutor {\n protected executionOptions?: ExecutionOptions\n protected statusManager: StatusManager\n\n public allowUserInteraction = true\n public allowExecution = true\n\n constructor(options: StepExecutorOptions) {\n this.statusManager = new StatusManager(options.routeId)\n this.executionOptions = options.executionOptions\n }\n\n setInteraction = (settings?: InteractionSettings): void => {\n const interactionSettings = {\n ...defaultInteractionSettings,\n ...settings,\n }\n this.allowUserInteraction = interactionSettings.allowInteraction\n this.statusManager.allowUpdates(interactionSettings.allowUpdates)\n this.allowExecution = interactionSettings.allowExecution\n }\n\n private createBaseContext = async (\n client: SDKClient,\n step: LiFiStepExtended,\n retryParams?: ExecuteStepRetryParams\n ): Promise<StepExecutorBaseContext> => {\n const fromChain = await client.getChainById(step.action.fromChainId)\n const toChain = await client.getChainById(step.action.toChainId)\n\n const isBridgeExecution = fromChain.id !== toChain.id\n\n return {\n client,\n step,\n fromChain,\n toChain,\n isBridgeExecution,\n retryParams,\n statusManager: this.statusManager,\n executionOptions: this.executionOptions,\n allowUserInteraction: this.allowUserInteraction,\n }\n }\n\n abstract createContext(\n baseContext: StepExecutorBaseContext\n ): Promise<StepExecutorContext>\n\n abstract createPipeline(context: StepExecutorContext): TaskPipeline\n\n abstract parseErrors(\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction,\n retryParams?: ExecuteStepRetryParams\n ): Promise<SDKError | ExecuteStepRetryError>\n\n executeStep = async (\n client: SDKClient,\n step: LiFiStepExtended,\n retryParams?: ExecuteStepRetryParams\n ): Promise<LiFiStepExtended> => {\n try {\n step.execution = this.statusManager.initializeExecution(step)\n\n const baseContext = await this.createBaseContext(\n client,\n step,\n retryParams\n )\n const context = await this.createContext(baseContext)\n const pipeline = this.createPipeline(context)\n\n await pipeline.run(context)\n\n return step\n } catch (error: any) {\n // Derive failing action from last in execution.actions\n const action = step.execution?.actions?.at(-1)\n const parsed = await this.parseErrors(error, step, action, retryParams)\n if (!(parsed instanceof ExecuteStepRetryError)) {\n if (action) {\n this.statusManager.updateAction(step, action.type, 'FAILED', {\n error: {\n message: parsed.cause?.message,\n code: parsed.code,\n },\n })\n } else {\n this.statusManager.updateExecution(step, {\n status: 'FAILED',\n error: {\n message: parsed.cause?.message,\n code: parsed.code,\n },\n })\n }\n }\n throw parsed\n }\n }\n}\n"],"mappings":";;;;;AAoBA,MAAM,6BAA6B;CACjC,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CACjB;AAED,IAAsB,mBAAtB,MAA+D;CAO7D,YAAY,SAA8B;+CANhC,oBAAA,KAAA,EAAmC;+CACnC,iBAAA,KAAA,EAA4B;+CAE/B,wBAAuB,KAAI;+CAC3B,kBAAiB,KAAI;+CAO5B,mBAAkB,aAAyC;GACzD,MAAM,sBAAsB;IAC1B,GAAG;IACH,GAAG;IACJ;AACD,QAAK,uBAAuB,oBAAoB;AAChD,QAAK,cAAc,aAAa,oBAAoB,aAAa;AACjE,QAAK,iBAAiB,oBAAoB;IAC3C;+CAEO,qBAAoB,OAC1B,QACA,MACA,gBACqC;GACrC,MAAM,YAAY,MAAM,OAAO,aAAa,KAAK,OAAO,YAAY;GACpE,MAAM,UAAU,MAAM,OAAO,aAAa,KAAK,OAAO,UAAU;AAIhE,UAAO;IACL;IACA;IACA;IACA;IACA,mBAPwB,UAAU,OAAO,QAAQ;IAQjD;IACA,eAAe,KAAK;IACpB,kBAAkB,KAAK;IACvB,sBAAsB,KAAK;IAC5B;IACF;+CAeD,eAAc,OACZ,QACA,MACA,gBAC8B;AAC9B,OAAI;AACF,SAAK,YAAY,KAAK,cAAc,oBAAoB,KAAK;IAE7D,MAAM,cAAc,MAAM,KAAK,kBAC7B,QACA,MACA,YACD;IACD,MAAM,UAAU,MAAM,KAAK,cAAc,YAAY;AAGrD,UAFiB,KAAK,eAAe,QAAQ,CAE9B,IAAI,QAAQ;AAE3B,WAAO;YACA,OAAY;IAEnB,MAAM,SAAS,KAAK,WAAW,SAAS,GAAG,GAAG;IAC9C,MAAM,SAAS,MAAM,KAAK,YAAY,OAAO,MAAM,QAAQ,YAAY;AACvE,QAAI,EAAE,kBAAkBA,sBAAAA,uBACtB,KAAI,OACF,MAAK,cAAc,aAAa,MAAM,OAAO,MAAM,UAAU,EAC3D,OAAO;KACL,SAAS,OAAO,OAAO;KACvB,MAAM,OAAO;KACd,EACF,CAAC;QAEF,MAAK,cAAc,gBAAgB,MAAM;KACvC,QAAQ;KACR,OAAO;MACL,SAAS,OAAO,OAAO;MACvB,MAAM,OAAO;MACd;KACF,CAAC;AAGN,UAAM;;IAET;AA7FC,OAAK,gBAAgB,IAAIC,2BAAAA,cAAc,QAAQ,QAAQ;AACvD,OAAK,mBAAmB,QAAQ"}
1
+ {"version":3,"file":"BaseStepExecutor.js","names":["StatusManager","ExecuteStepRetryError"],"sources":["../../../src/core/BaseStepExecutor.ts"],"sourcesContent":["import { ExecuteStepRetryError } from '../errors/errors.js'\nimport type { SDKError } from '../errors/SDKError.js'\nimport type {\n ExecuteStepRetryParams,\n ExecutionAction,\n ExecutionOptions,\n InteractionSettings,\n LiFiStepExtended,\n SDKClient,\n StepExecutor,\n StepExecutorOptions,\n} from '../types/core.js'\nimport type {\n StepExecutorBaseContext,\n StepExecutorContext,\n} from '../types/execution.js'\nimport { StatusManager } from './StatusManager.js'\nimport type { TaskPipeline } from './TaskPipeline.js'\n\n// Please be careful when changing the defaults as it may break the behavior (e.g., background execution)\nconst defaultInteractionSettings = {\n allowInteraction: true,\n allowUpdates: true,\n allowExecution: true,\n}\n\nexport abstract class BaseStepExecutor implements StepExecutor {\n protected executionOptions?: ExecutionOptions\n protected statusManager: StatusManager\n\n public allowUserInteraction = true\n public allowExecution = true\n\n constructor(options: StepExecutorOptions) {\n this.statusManager = new StatusManager(options.routeId)\n this.executionOptions = options.executionOptions\n }\n\n setInteraction = (settings?: InteractionSettings): void => {\n const interactionSettings = {\n ...defaultInteractionSettings,\n ...settings,\n }\n this.allowUserInteraction = interactionSettings.allowInteraction\n this.statusManager.allowUpdates(interactionSettings.allowUpdates)\n this.allowExecution = interactionSettings.allowExecution\n }\n\n private createBaseContext = async (\n client: SDKClient,\n step: LiFiStepExtended,\n retryParams?: ExecuteStepRetryParams\n ): Promise<StepExecutorBaseContext> => {\n const fromChain = await client.getChainById(step.action.fromChainId)\n const toChain = await client.getChainById(step.action.toChainId)\n\n const isBridgeExecution = fromChain.id !== toChain.id\n\n return {\n client,\n step,\n fromChain,\n toChain,\n isBridgeExecution,\n retryParams,\n statusManager: this.statusManager,\n executionOptions: this.executionOptions,\n allowUserInteraction: this.allowUserInteraction,\n }\n }\n\n abstract createContext(\n baseContext: StepExecutorBaseContext\n ): Promise<StepExecutorContext>\n\n abstract createPipeline(context: StepExecutorContext): TaskPipeline\n\n abstract parseErrors(\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction,\n retryParams?: ExecuteStepRetryParams\n ): Promise<SDKError | ExecuteStepRetryError>\n\n executeStep = async (\n client: SDKClient,\n step: LiFiStepExtended,\n retryParams?: ExecuteStepRetryParams\n ): Promise<LiFiStepExtended> => {\n try {\n step.execution = this.statusManager.initializeExecution(step)\n\n const baseContext = await this.createBaseContext(\n client,\n step,\n retryParams\n )\n const context = await this.createContext(baseContext)\n const pipeline = this.createPipeline(context)\n\n await pipeline.run(context)\n\n return step\n } catch (error: any) {\n // Derive failing action from last in execution.actions\n const action = step.execution?.actions?.at(-1)\n const parsed = await this.parseErrors(error, step, action, retryParams)\n if (!(parsed instanceof ExecuteStepRetryError)) {\n if (action) {\n this.statusManager.updateAction(step, action.type, 'FAILED', {\n error: {\n message: parsed.cause?.message,\n code: parsed.code,\n },\n })\n } else {\n this.statusManager.updateExecution(step, {\n status: 'FAILED',\n error: {\n message: parsed.cause?.message,\n code: parsed.code,\n },\n })\n }\n }\n throw parsed\n }\n }\n}\n"],"mappings":";;;;AAoBA,MAAM,6BAA6B;CACjC,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CACjB;AAED,IAAsB,mBAAtB,MAA+D;CAC7D;CACA;CAEA,uBAA8B;CAC9B,iBAAwB;CAExB,YAAY,SAA8B;AACxC,OAAK,gBAAgB,IAAIA,2BAAAA,cAAc,QAAQ,QAAQ;AACvD,OAAK,mBAAmB,QAAQ;;CAGlC,kBAAkB,aAAyC;EACzD,MAAM,sBAAsB;GAC1B,GAAG;GACH,GAAG;GACJ;AACD,OAAK,uBAAuB,oBAAoB;AAChD,OAAK,cAAc,aAAa,oBAAoB,aAAa;AACjE,OAAK,iBAAiB,oBAAoB;;CAG5C,oBAA4B,OAC1B,QACA,MACA,gBACqC;EACrC,MAAM,YAAY,MAAM,OAAO,aAAa,KAAK,OAAO,YAAY;EACpE,MAAM,UAAU,MAAM,OAAO,aAAa,KAAK,OAAO,UAAU;AAIhE,SAAO;GACL;GACA;GACA;GACA;GACA,mBAPwB,UAAU,OAAO,QAAQ;GAQjD;GACA,eAAe,KAAK;GACpB,kBAAkB,KAAK;GACvB,sBAAsB,KAAK;GAC5B;;CAgBH,cAAc,OACZ,QACA,MACA,gBAC8B;AAC9B,MAAI;AACF,QAAK,YAAY,KAAK,cAAc,oBAAoB,KAAK;GAE7D,MAAM,cAAc,MAAM,KAAK,kBAC7B,QACA,MACA,YACD;GACD,MAAM,UAAU,MAAM,KAAK,cAAc,YAAY;AAGrD,SAFiB,KAAK,eAAe,QAAQ,CAE9B,IAAI,QAAQ;AAE3B,UAAO;WACA,OAAY;GAEnB,MAAM,SAAS,KAAK,WAAW,SAAS,GAAG,GAAG;GAC9C,MAAM,SAAS,MAAM,KAAK,YAAY,OAAO,MAAM,QAAQ,YAAY;AACvE,OAAI,EAAE,kBAAkBC,sBAAAA,uBACtB,KAAI,OACF,MAAK,cAAc,aAAa,MAAM,OAAO,MAAM,UAAU,EAC3D,OAAO;IACL,SAAS,OAAO,OAAO;IACvB,MAAM,OAAO;IACd,EACF,CAAC;OAEF,MAAK,cAAc,gBAAgB,MAAM;IACvC,QAAQ;IACR,OAAO;KACL,SAAS,OAAO,OAAO;KACvB,MAAM,OAAO;KACd;IACF,CAAC;AAGN,SAAM"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defineProperty = require("../_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js");
3
2
  const require_core_actionMessages = require("./actionMessages.js");
4
3
  const require_core_executionState = require("./executionState.js");
5
4
  //#region src/core/StatusManager.ts
@@ -7,142 +6,35 @@ const require_core_executionState = require("./executionState.js");
7
6
  * Manages status updates of a route and provides various functions for tracking actions.
8
7
  */
9
8
  var StatusManager = class {
9
+ routeId;
10
+ shouldUpdate = true;
10
11
  constructor(routeId) {
11
- require_defineProperty._defineProperty(this, "routeId", void 0);
12
- require_defineProperty._defineProperty(this, "shouldUpdate", true);
13
- require_defineProperty._defineProperty(
14
- this,
15
- /**
16
- * Initializes the execution object of a Step.
17
- * @param step The current step in execution
18
- * @returns The initialized execution object for this step
19
- */
20
- "initializeExecution",
21
- (step) => {
22
- if (!step.execution) {
23
- step.execution = {
24
- startedAt: Date.now(),
25
- status: "PENDING",
26
- actions: []
27
- };
28
- this.updateStepInRoute(step);
29
- }
30
- if (step.execution.status === "FAILED") {
31
- step.execution.startedAt = Date.now();
32
- step.execution.status = "PENDING";
33
- step.execution.signedAt = void 0;
34
- step.execution.error = void 0;
35
- this.updateStepInRoute(step);
36
- }
37
- return step.execution;
38
- }
39
- );
40
- require_defineProperty._defineProperty(
41
- this,
42
- /**
43
- * Create and push a new action into the execution.
44
- * Caller is responsible for ensuring an action of this type does not already exist.
45
- * @param step The step that should contain the new action.
46
- * @param type Type of the action.
47
- * @param chainId Chain Id of the action.
48
- * @param status The initial status for the new action.
49
- * @returns The created action.
50
- */
51
- "createAction",
52
- ({ step, type, chainId, status }) => {
53
- if (!step.execution) throw new Error("Execution hasn't been initialized.");
54
- const newAction = {
55
- type,
56
- message: require_core_actionMessages.getActionMessage(type, status),
57
- status,
58
- chainId
59
- };
60
- step.execution.actions.push(newAction);
61
- this.updateStepInRoute(step);
62
- return newAction;
63
- }
64
- );
65
- require_defineProperty._defineProperty(
66
- this,
67
- /**
68
- * Find an existing action by type and update it, or create a new one if none exists.
69
- * @param step The step that should contain the action.
70
- * @param type Type of the action. Used to identify already existing actions.
71
- * @param chainId Chain Id of the action (used when creating).
72
- * @param status The status to set on the found or newly created action.
73
- * @returns The updated or newly created action.
74
- */
75
- "initializeAction",
76
- ({ step, type, chainId, status }) => {
77
- if (this.findAction(step, type)) return this.updateAction(step, type, status, { error: void 0 });
78
- return this.createAction({
79
- step,
80
- type,
81
- chainId,
82
- status
83
- });
84
- }
85
- );
86
- require_defineProperty._defineProperty(
87
- this,
88
- /**
89
- * Update an action object.
90
- * @param step The step where the action should be updated
91
- * @param type The action type to update
92
- * @param status The status the action gets.
93
- * @param [params] Additional parameters to append to the action.
94
- * @returns The updated action
95
- */
96
- "updateAction",
97
- (step, type, status, params) => {
98
- if (!step.execution) throw new Error("Can't update an empty step execution.");
99
- const currentAction = this.findAction(step, type);
100
- if (!currentAction) throw new Error("Can't find an action for the given type.");
101
- switch (status) {
102
- case "CANCELLED": break;
103
- case "FAILED":
104
- step.execution.status = "FAILED";
105
- if (params?.error) step.execution.error = params.error;
106
- break;
107
- case "DONE": break;
108
- case "PENDING":
109
- step.execution.status = "PENDING";
110
- if (params?.signedAt) step.execution.signedAt = params.signedAt;
111
- break;
112
- case "RESET_REQUIRED":
113
- case "MESSAGE_REQUIRED":
114
- case "ACTION_REQUIRED":
115
- step.execution.status = "ACTION_REQUIRED";
116
- break;
117
- default: break;
118
- }
119
- currentAction.status = status;
120
- currentAction.message = require_core_actionMessages.getActionMessage(type, status);
121
- if (params) {
122
- const { signedAt: _signedAt, ...rest } = params;
123
- Object.assign(currentAction, rest);
124
- }
125
- step.execution.actions = [...step.execution.actions.filter((action) => action.status === "DONE"), ...step.execution.actions.filter((action) => action.status !== "DONE")];
126
- this.updateStepInRoute(step);
127
- return currentAction;
128
- }
129
- );
130
- require_defineProperty._defineProperty(this, "updateStepInRoute", (step) => {
131
- if (!this.shouldUpdate) return step;
132
- const data = require_core_executionState.executionState.get(this.routeId);
133
- if (!data) throw new Error("Execution data not found.");
134
- const stepIndex = data.route.steps.findIndex((routeStep) => routeStep.id === step.id);
135
- if (stepIndex === -1) throw new Error("Couldn't find a step to update.");
136
- data.route.steps[stepIndex] = {
137
- ...data.route.steps[stepIndex],
138
- ...step
139
- };
140
- data.executionOptions?.updateRouteHook?.(data.route);
141
- return data.route.steps[stepIndex];
142
- });
143
12
  this.routeId = routeId;
144
13
  }
145
14
  /**
15
+ * Initializes the execution object of a Step.
16
+ * @param step The current step in execution
17
+ * @returns The initialized execution object for this step
18
+ */
19
+ initializeExecution = (step) => {
20
+ if (!step.execution) {
21
+ step.execution = {
22
+ startedAt: Date.now(),
23
+ status: "PENDING",
24
+ actions: []
25
+ };
26
+ this.updateStepInRoute(step);
27
+ }
28
+ if (step.execution.status === "FAILED") {
29
+ step.execution.startedAt = Date.now();
30
+ step.execution.status = "PENDING";
31
+ step.execution.signedAt = void 0;
32
+ step.execution.error = void 0;
33
+ this.updateStepInRoute(step);
34
+ }
35
+ return step.execution;
36
+ };
37
+ /**
146
38
  * Updates the execution object of a Step.
147
39
  * @param step The current step in execution
148
40
  * @param execution Partial execution data to merge
@@ -167,6 +59,97 @@ var StatusManager = class {
167
59
  if (!step.execution?.actions) throw new Error("Execution hasn't been initialized.");
168
60
  return step.execution.actions.find((p) => p.type === type);
169
61
  }
62
+ /**
63
+ * Create and push a new action into the execution.
64
+ * Caller is responsible for ensuring an action of this type does not already exist.
65
+ * @param step The step that should contain the new action.
66
+ * @param type Type of the action.
67
+ * @param chainId Chain Id of the action.
68
+ * @param status The initial status for the new action.
69
+ * @returns The created action.
70
+ */
71
+ createAction = ({ step, type, chainId, status }) => {
72
+ if (!step.execution) throw new Error("Execution hasn't been initialized.");
73
+ const newAction = {
74
+ type,
75
+ message: require_core_actionMessages.getActionMessage(type, status),
76
+ status,
77
+ chainId
78
+ };
79
+ step.execution.actions.push(newAction);
80
+ this.updateStepInRoute(step);
81
+ return newAction;
82
+ };
83
+ /**
84
+ * Find an existing action by type and update it, or create a new one if none exists.
85
+ * @param step The step that should contain the action.
86
+ * @param type Type of the action. Used to identify already existing actions.
87
+ * @param chainId Chain Id of the action (used when creating).
88
+ * @param status The status to set on the found or newly created action.
89
+ * @returns The updated or newly created action.
90
+ */
91
+ initializeAction = ({ step, type, chainId, status }) => {
92
+ if (this.findAction(step, type)) return this.updateAction(step, type, status, { error: void 0 });
93
+ return this.createAction({
94
+ step,
95
+ type,
96
+ chainId,
97
+ status
98
+ });
99
+ };
100
+ /**
101
+ * Update an action object.
102
+ * @param step The step where the action should be updated
103
+ * @param type The action type to update
104
+ * @param status The status the action gets.
105
+ * @param [params] Additional parameters to append to the action.
106
+ * @returns The updated action
107
+ */
108
+ updateAction = (step, type, status, params) => {
109
+ if (!step.execution) throw new Error("Can't update an empty step execution.");
110
+ const currentAction = this.findAction(step, type);
111
+ if (!currentAction) throw new Error("Can't find an action for the given type.");
112
+ switch (status) {
113
+ case "CANCELLED": break;
114
+ case "FAILED":
115
+ step.execution.status = "FAILED";
116
+ if (params?.error) step.execution.error = params.error;
117
+ break;
118
+ case "DONE": break;
119
+ case "PENDING":
120
+ step.execution.status = "PENDING";
121
+ if (params?.signedAt) step.execution.signedAt = params.signedAt;
122
+ break;
123
+ case "RESET_REQUIRED":
124
+ case "MESSAGE_REQUIRED":
125
+ case "ACTION_REQUIRED":
126
+ step.execution.status = "ACTION_REQUIRED";
127
+ break;
128
+ default: break;
129
+ }
130
+ currentAction.status = status;
131
+ currentAction.message = require_core_actionMessages.getActionMessage(type, status);
132
+ if (params) {
133
+ const { signedAt: _signedAt, ...rest } = params;
134
+ Object.assign(currentAction, rest);
135
+ }
136
+ step.execution.actions = [...step.execution.actions.filter((action) => action.status === "DONE"), ...step.execution.actions.filter((action) => action.status !== "DONE")];
137
+ this.updateStepInRoute(step);
138
+ return currentAction;
139
+ };
140
+ updateStepInRoute = (step) => {
141
+ if (!this.shouldUpdate) return step;
142
+ const data = require_core_executionState.executionState.get(this.routeId);
143
+ if (!data) throw new Error("Execution data not found.");
144
+ const stepIndex = data.route.steps.findIndex((routeStep) => routeStep.id === step.id);
145
+ if (stepIndex === -1) throw new Error("Couldn't find a step to update.");
146
+ data.route.steps[stepIndex] = {
147
+ ...data.route.steps[stepIndex],
148
+ ...step
149
+ };
150
+ data.executionOptions?.updateRouteHook?.(data.route);
151
+ return data.route.steps[stepIndex];
152
+ };
170
153
  allowUpdates(value) {
171
154
  this.shouldUpdate = value;
172
155
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StatusManager.js","names":["getActionMessage","executionState"],"sources":["../../../src/core/StatusManager.ts"],"sourcesContent":["import type { ChainId, LiFiStep } from '@lifi/types'\nimport type {\n Execution,\n ExecutionAction,\n ExecutionActionStatus,\n ExecutionActionType,\n LiFiStepExtended,\n} from '../types/core.js'\nimport { getActionMessage } from './actionMessages.js'\nimport { executionState } from './executionState.js'\n\ntype ActionProps = {\n step: LiFiStepExtended\n type: ExecutionActionType\n chainId: ChainId\n status: ExecutionActionStatus\n}\n\n/**\n * Manages status updates of a route and provides various functions for tracking actions.\n */\nexport class StatusManager {\n private readonly routeId: string\n private shouldUpdate = true\n\n constructor(routeId: string) {\n this.routeId = routeId\n }\n\n /**\n * Initializes the execution object of a Step.\n * @param step The current step in execution\n * @returns The initialized execution object for this step\n */\n initializeExecution = (step: LiFiStepExtended): Execution => {\n if (!step.execution) {\n step.execution = {\n startedAt: Date.now(),\n status: 'PENDING',\n actions: [],\n }\n this.updateStepInRoute(step)\n }\n\n // Change status to PENDING after resuming from FAILED\n if (step.execution.status === 'FAILED') {\n step.execution.startedAt = Date.now()\n step.execution.status = 'PENDING'\n step.execution.signedAt = undefined\n step.execution.error = undefined\n this.updateStepInRoute(step)\n }\n\n return step.execution\n }\n\n /**\n * Updates the execution object of a Step.\n * @param step The current step in execution\n * @param execution Partial execution data to merge\n * @returns The step with the updated execution object\n */\n updateExecution(\n step: LiFiStepExtended,\n execution: Partial<Execution>\n ): LiFiStep {\n if (!step.execution) {\n throw Error(\"Can't update empty execution.\")\n }\n step.execution = {\n ...step.execution,\n ...execution,\n }\n this.updateStepInRoute(step)\n return step\n }\n\n /**\n * Finds an action of the specified type in the step's execution\n * @param step The step to search in\n * @param type The action type to find\n * @returns The found action or undefined if not found\n */\n findAction(\n step: LiFiStepExtended,\n type: ExecutionActionType\n ): ExecutionAction | undefined {\n if (!step.execution?.actions) {\n throw new Error(\"Execution hasn't been initialized.\")\n }\n\n const action = step.execution.actions.find((p) => p.type === type)\n\n return action\n }\n\n /**\n * Create and push a new action into the execution.\n * Caller is responsible for ensuring an action of this type does not already exist.\n * @param step The step that should contain the new action.\n * @param type Type of the action.\n * @param chainId Chain Id of the action.\n * @param status The initial status for the new action.\n * @returns The created action.\n */\n createAction = ({\n step,\n type,\n chainId,\n status,\n }: ActionProps): ExecutionAction => {\n if (!step.execution) {\n throw new Error(\"Execution hasn't been initialized.\")\n }\n\n const newAction: ExecutionAction = {\n type,\n message: getActionMessage(type, status),\n status,\n chainId,\n }\n\n step.execution.actions.push(newAction)\n this.updateStepInRoute(step)\n return newAction\n }\n\n /**\n * Find an existing action by type and update it, or create a new one if none exists.\n * @param step The step that should contain the action.\n * @param type Type of the action. Used to identify already existing actions.\n * @param chainId Chain Id of the action (used when creating).\n * @param status The status to set on the found or newly created action.\n * @returns The updated or newly created action.\n */\n initializeAction = ({\n step,\n type,\n chainId,\n status,\n }: ActionProps): ExecutionAction => {\n const action = this.findAction(step, type)\n\n if (action) {\n return this.updateAction(step, type, status, {\n error: undefined,\n })\n }\n\n return this.createAction({ step, type, chainId, status })\n }\n\n /**\n * Update an action object.\n * @param step The step where the action should be updated\n * @param type The action type to update\n * @param status The status the action gets.\n * @param [params] Additional parameters to append to the action.\n * @returns The updated action\n */\n updateAction = (\n step: LiFiStepExtended,\n type: ExecutionActionType,\n status: ExecutionActionStatus,\n params?: Partial<ExecutionAction & { signedAt?: number }>\n ): ExecutionAction => {\n if (!step.execution) {\n throw new Error(\"Can't update an empty step execution.\")\n }\n const currentAction = this.findAction(step, type)\n\n if (!currentAction) {\n throw new Error(\"Can't find an action for the given type.\")\n }\n\n switch (status) {\n case 'CANCELLED':\n break\n case 'FAILED':\n step.execution.status = 'FAILED'\n if (params?.error) {\n step.execution.error = params.error\n }\n break\n case 'DONE':\n break\n case 'PENDING':\n step.execution.status = 'PENDING'\n if (params?.signedAt) {\n step.execution.signedAt = params.signedAt\n }\n break\n case 'RESET_REQUIRED':\n case 'MESSAGE_REQUIRED':\n case 'ACTION_REQUIRED':\n step.execution.status = 'ACTION_REQUIRED'\n break\n default:\n break\n }\n\n currentAction.status = status\n currentAction.message = getActionMessage(type, status)\n // set extra parameters or overwrite the standard params set in the switch statement\n if (params) {\n const { signedAt: _signedAt, ...rest } = params\n Object.assign(currentAction, rest)\n }\n // Sort actions, the ones with DONE status go first\n step.execution.actions = [\n ...step.execution.actions.filter((action) => action.status === 'DONE'),\n ...step.execution.actions.filter((action) => action.status !== 'DONE'),\n ]\n this.updateStepInRoute(step) // updates the step in the route\n return currentAction\n }\n\n updateStepInRoute = (step: LiFiStep): LiFiStep => {\n if (!this.shouldUpdate) {\n return step\n }\n const data = executionState.get(this.routeId)\n\n if (!data) {\n throw new Error('Execution data not found.')\n }\n\n const stepIndex = data.route.steps.findIndex(\n (routeStep) => routeStep.id === step.id\n )\n\n if (stepIndex === -1) {\n throw new Error(\"Couldn't find a step to update.\")\n }\n\n data.route.steps[stepIndex] = { ...data.route.steps[stepIndex], ...step }\n\n data.executionOptions?.updateRouteHook?.(data.route)\n return data.route.steps[stepIndex]\n }\n\n allowUpdates(value: boolean): void {\n this.shouldUpdate = value\n }\n}\n"],"mappings":";;;;;;;;AAqBA,IAAa,gBAAb,MAA2B;CAIzB,YAAY,SAAiB;+CAHZ,WAAA,KAAA,EAAe;+CACxB,gBAAe,KAAI;;;;;;;;GAW3B;IAAuB,SAAsC;AAC3D,QAAI,CAAC,KAAK,WAAW;AACnB,UAAK,YAAY;MACf,WAAW,KAAK,KAAK;MACrB,QAAQ;MACR,SAAS,EAAE;MACZ;AACD,UAAK,kBAAkB,KAAK;;AAI9B,QAAI,KAAK,UAAU,WAAW,UAAU;AACtC,UAAK,UAAU,YAAY,KAAK,KAAK;AACrC,UAAK,UAAU,SAAS;AACxB,UAAK,UAAU,WAAW,KAAA;AAC1B,UAAK,UAAU,QAAQ,KAAA;AACvB,UAAK,kBAAkB,KAAK;;AAG9B,WAAO,KAAK;;GACb;;;;;;;;;;;;GAmDD;IAAgB,EACd,MACA,MACA,SACA,aACkC;AAClC,QAAI,CAAC,KAAK,UACR,OAAM,IAAI,MAAM,qCAAqC;IAGvD,MAAM,YAA6B;KACjC;KACA,SAASA,4BAAAA,iBAAiB,MAAM,OAAO;KACvC;KACA;KACD;AAED,SAAK,UAAU,QAAQ,KAAK,UAAU;AACtC,SAAK,kBAAkB,KAAK;AAC5B,WAAO;;GACR;;;;;;;;;;;GAUD;IAAoB,EAClB,MACA,MACA,SACA,aACkC;AAGlC,QAFe,KAAK,WAAW,MAAM,KAAK,CAGxC,QAAO,KAAK,aAAa,MAAM,MAAM,QAAQ,EAC3C,OAAO,KAAA,GACR,CAAC;AAGJ,WAAO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;IAAE,GAAG,KAAK,MAAM,MAAM;IAAY,GAAG;IAAM;AAEzE,QAAK,kBAAkB,kBAAkB,KAAK,MAAM;AACpD,UAAO,KAAK,MAAM,MAAM;IACzB;AArNC,OAAK,UAAU;;;;;;;;CAoCjB,gBACE,MACA,WACU;AACV,MAAI,CAAC,KAAK,UACR,OAAM,MAAM,gCAAgC;AAE9C,OAAK,YAAY;GACf,GAAG,KAAK;GACR,GAAG;GACJ;AACD,OAAK,kBAAkB,KAAK;AAC5B,SAAO;;;;;;;;CAST,WACE,MACA,MAC6B;AAC7B,MAAI,CAAC,KAAK,WAAW,QACnB,OAAM,IAAI,MAAM,qCAAqC;AAKvD,SAFe,KAAK,UAAU,QAAQ,MAAM,MAAM,EAAE,SAAS,KAAK;;CAsJpE,aAAa,OAAsB;AACjC,OAAK,eAAe"}
1
+ {"version":3,"file":"StatusManager.js","names":["getActionMessage","executionState"],"sources":["../../../src/core/StatusManager.ts"],"sourcesContent":["import type { ChainId, LiFiStep } from '@lifi/types'\nimport type {\n Execution,\n ExecutionAction,\n ExecutionActionStatus,\n ExecutionActionType,\n LiFiStepExtended,\n} from '../types/core.js'\nimport { getActionMessage } from './actionMessages.js'\nimport { executionState } from './executionState.js'\n\ntype ActionProps = {\n step: LiFiStepExtended\n type: ExecutionActionType\n chainId: ChainId\n status: ExecutionActionStatus\n}\n\n/**\n * Manages status updates of a route and provides various functions for tracking actions.\n */\nexport class StatusManager {\n private readonly routeId: string\n private shouldUpdate = true\n\n constructor(routeId: string) {\n this.routeId = routeId\n }\n\n /**\n * Initializes the execution object of a Step.\n * @param step The current step in execution\n * @returns The initialized execution object for this step\n */\n initializeExecution = (step: LiFiStepExtended): Execution => {\n if (!step.execution) {\n step.execution = {\n startedAt: Date.now(),\n status: 'PENDING',\n actions: [],\n }\n this.updateStepInRoute(step)\n }\n\n // Change status to PENDING after resuming from FAILED\n if (step.execution.status === 'FAILED') {\n step.execution.startedAt = Date.now()\n step.execution.status = 'PENDING'\n step.execution.signedAt = undefined\n step.execution.error = undefined\n this.updateStepInRoute(step)\n }\n\n return step.execution\n }\n\n /**\n * Updates the execution object of a Step.\n * @param step The current step in execution\n * @param execution Partial execution data to merge\n * @returns The step with the updated execution object\n */\n updateExecution(\n step: LiFiStepExtended,\n execution: Partial<Execution>\n ): LiFiStep {\n if (!step.execution) {\n throw Error(\"Can't update empty execution.\")\n }\n step.execution = {\n ...step.execution,\n ...execution,\n }\n this.updateStepInRoute(step)\n return step\n }\n\n /**\n * Finds an action of the specified type in the step's execution\n * @param step The step to search in\n * @param type The action type to find\n * @returns The found action or undefined if not found\n */\n findAction(\n step: LiFiStepExtended,\n type: ExecutionActionType\n ): ExecutionAction | undefined {\n if (!step.execution?.actions) {\n throw new Error(\"Execution hasn't been initialized.\")\n }\n\n const action = step.execution.actions.find((p) => p.type === type)\n\n return action\n }\n\n /**\n * Create and push a new action into the execution.\n * Caller is responsible for ensuring an action of this type does not already exist.\n * @param step The step that should contain the new action.\n * @param type Type of the action.\n * @param chainId Chain Id of the action.\n * @param status The initial status for the new action.\n * @returns The created action.\n */\n createAction = ({\n step,\n type,\n chainId,\n status,\n }: ActionProps): ExecutionAction => {\n if (!step.execution) {\n throw new Error(\"Execution hasn't been initialized.\")\n }\n\n const newAction: ExecutionAction = {\n type,\n message: getActionMessage(type, status),\n status,\n chainId,\n }\n\n step.execution.actions.push(newAction)\n this.updateStepInRoute(step)\n return newAction\n }\n\n /**\n * Find an existing action by type and update it, or create a new one if none exists.\n * @param step The step that should contain the action.\n * @param type Type of the action. Used to identify already existing actions.\n * @param chainId Chain Id of the action (used when creating).\n * @param status The status to set on the found or newly created action.\n * @returns The updated or newly created action.\n */\n initializeAction = ({\n step,\n type,\n chainId,\n status,\n }: ActionProps): ExecutionAction => {\n const action = this.findAction(step, type)\n\n if (action) {\n return this.updateAction(step, type, status, {\n error: undefined,\n })\n }\n\n return this.createAction({ step, type, chainId, status })\n }\n\n /**\n * Update an action object.\n * @param step The step where the action should be updated\n * @param type The action type to update\n * @param status The status the action gets.\n * @param [params] Additional parameters to append to the action.\n * @returns The updated action\n */\n updateAction = (\n step: LiFiStepExtended,\n type: ExecutionActionType,\n status: ExecutionActionStatus,\n params?: Partial<ExecutionAction & { signedAt?: number }>\n ): ExecutionAction => {\n if (!step.execution) {\n throw new Error(\"Can't update an empty step execution.\")\n }\n const currentAction = this.findAction(step, type)\n\n if (!currentAction) {\n throw new Error(\"Can't find an action for the given type.\")\n }\n\n switch (status) {\n case 'CANCELLED':\n break\n case 'FAILED':\n step.execution.status = 'FAILED'\n if (params?.error) {\n step.execution.error = params.error\n }\n break\n case 'DONE':\n break\n case 'PENDING':\n step.execution.status = 'PENDING'\n if (params?.signedAt) {\n step.execution.signedAt = params.signedAt\n }\n break\n case 'RESET_REQUIRED':\n case 'MESSAGE_REQUIRED':\n case 'ACTION_REQUIRED':\n step.execution.status = 'ACTION_REQUIRED'\n break\n default:\n break\n }\n\n currentAction.status = status\n currentAction.message = getActionMessage(type, status)\n // set extra parameters or overwrite the standard params set in the switch statement\n if (params) {\n const { signedAt: _signedAt, ...rest } = params\n Object.assign(currentAction, rest)\n }\n // Sort actions, the ones with DONE status go first\n step.execution.actions = [\n ...step.execution.actions.filter((action) => action.status === 'DONE'),\n ...step.execution.actions.filter((action) => action.status !== 'DONE'),\n ]\n this.updateStepInRoute(step) // updates the step in the route\n return currentAction\n }\n\n updateStepInRoute = (step: LiFiStep): LiFiStep => {\n if (!this.shouldUpdate) {\n return step\n }\n const data = executionState.get(this.routeId)\n\n if (!data) {\n throw new Error('Execution data not found.')\n }\n\n const stepIndex = data.route.steps.findIndex(\n (routeStep) => routeStep.id === step.id\n )\n\n if (stepIndex === -1) {\n throw new Error(\"Couldn't find a step to update.\")\n }\n\n data.route.steps[stepIndex] = { ...data.route.steps[stepIndex], ...step }\n\n data.executionOptions?.updateRouteHook?.(data.route)\n return data.route.steps[stepIndex]\n }\n\n allowUpdates(value: boolean): void {\n this.shouldUpdate = value\n }\n}\n"],"mapp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