@lifi/composer-sdk 0.2.0-staging.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +81 -0
  2. package/dist/authoring/handles.cjs.map +1 -1
  3. package/dist/authoring/handles.d.cts +13 -6
  4. package/dist/authoring/handles.d.ts +13 -6
  5. package/dist/authoring/handles.js.map +1 -1
  6. package/dist/client.cjs +38 -6
  7. package/dist/client.cjs.map +1 -1
  8. package/dist/client.d.cts +25 -1
  9. package/dist/client.d.ts +25 -1
  10. package/dist/client.js +41 -6
  11. package/dist/client.js.map +1 -1
  12. package/dist/errors.cjs +4 -1
  13. package/dist/errors.cjs.map +1 -1
  14. package/dist/errors.js +6 -1
  15. package/dist/errors.js.map +1 -1
  16. package/dist/generated/config.generated.cjs.map +1 -1
  17. package/dist/generated/config.generated.d.cts +82 -7
  18. package/dist/generated/config.generated.d.ts +82 -7
  19. package/dist/generated/materialisers.generated.cjs +2 -8
  20. package/dist/generated/materialisers.generated.cjs.map +1 -1
  21. package/dist/generated/materialisers.generated.d.cts +1 -1
  22. package/dist/generated/materialisers.generated.d.ts +1 -1
  23. package/dist/generated/materialisers.generated.js +1 -6
  24. package/dist/generated/materialisers.generated.js.map +1 -1
  25. package/dist/generated/operations.generated.cjs +56 -31
  26. package/dist/generated/operations.generated.cjs.map +1 -1
  27. package/dist/generated/operations.generated.d.cts +204 -94
  28. package/dist/generated/operations.generated.d.ts +204 -94
  29. package/dist/generated/operations.generated.js +56 -31
  30. package/dist/generated/operations.generated.js.map +1 -1
  31. package/dist/index.cjs +8 -0
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +4 -3
  34. package/dist/index.d.ts +4 -3
  35. package/dist/index.js +8 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/{materialisers.generated-BfWJ-g7t.d.ts → materialisers.generated-BMkBQgWZ.d.ts} +3 -8
  38. package/dist/{materialisers.generated-DaJRwiRe.d.cts → materialisers.generated-BWq5oePO.d.cts} +3 -8
  39. package/dist/responseSchemas.cjs +110 -0
  40. package/dist/responseSchemas.cjs.map +1 -0
  41. package/dist/responseSchemas.d.cts +36 -0
  42. package/dist/responseSchemas.d.ts +36 -0
  43. package/dist/responseSchemas.js +74 -0
  44. package/dist/responseSchemas.js.map +1 -0
  45. package/dist/run/simulate.cjs +41 -0
  46. package/dist/run/simulate.cjs.map +1 -0
  47. package/dist/run/simulate.d.cts +59 -0
  48. package/dist/run/simulate.d.ts +59 -0
  49. package/dist/run/simulate.js +17 -0
  50. package/dist/run/simulate.js.map +1 -0
  51. package/dist/sdk.cjs +6 -1
  52. package/dist/sdk.cjs.map +1 -1
  53. package/dist/sdk.d.cts +13 -1
  54. package/dist/sdk.d.ts +13 -1
  55. package/dist/sdk.js +6 -1
  56. package/dist/sdk.js.map +1 -1
  57. package/package.json +7 -5
  58. package/src/authoring/handles.ts +19 -10
  59. package/src/client.ts +86 -11
  60. package/src/errors.ts +8 -10
  61. package/src/examples/aaveRepay.ts +55 -16
  62. package/src/examples/aaveRepayWithATokens.ts +41 -30
  63. package/src/examples/aaveRounding.ts +42 -0
  64. package/src/examples/aaveSetEMode.ts +0 -1
  65. package/src/examples/config.ts +1 -1
  66. package/src/examples/emitCustomEvent.ts +75 -0
  67. package/src/examples/invariantChecks.ts +96 -0
  68. package/src/examples/run.ts +20 -18
  69. package/src/examples/simulateCompiledSwap.ts +76 -0
  70. package/src/examples/simulateRawTransaction.ts +39 -0
  71. package/src/examples/untypedOpWithTypedRef.ts +26 -20
  72. package/src/generated/config.generated.ts +229 -6
  73. package/src/generated/materialisers.generated.ts +0 -12
  74. package/src/generated/operations.generated.ts +330 -177
  75. package/src/index.ts +19 -0
  76. package/src/responseSchemas.ts +143 -0
  77. package/src/run/simulate.ts +78 -0
  78. package/src/sdk.ts +20 -1
  79. package/src/examples/staged/aaveBorrow.ts +0 -104
  80. package/src/examples/staged/aaveDebtRebalanceExactOut.ts +0 -301
  81. package/src/examples/staged/aaveHealthFactorExplode.ts +0 -70
  82. package/src/examples/staged/aaveToMorphoDebtMigration.ts +0 -190
  83. package/src/examples/staged/aaveToMorphoDebtMigrationWithSwap.ts +0 -221
  84. package/src/examples/staged/aaveToMorphoDebtMigrationWithSwapExactOut.ts +0 -302
  85. package/src/examples/staged/flashloanRepay.ts +0 -138
  86. package/src/examples/staged/morphoBlueBorrow.ts +0 -89
  87. package/src/examples/staged/morphoBlueRepay.ts +0 -91
  88. package/src/examples/staged/registry.ts +0 -78
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts"],"sourcesContent":["import type { ComposeErrorKind, SimulationRevert } from '@lifi/compose-spec';\n\n/**\n * Machine-readable error codes returned by the SDK.\n *\n * - `NETWORK_ERROR` — The HTTP request failed (DNS, timeout, connection refused).\n * - `VALIDATION_ERROR` — The server rejected the request (HTTP 400/422).\n * - `UNAUTHENTICATED` — The request lacks valid authentication credentials (HTTP 401).\n * - `FORBIDDEN` — The server understood the request but refuses to authorise it (HTTP 403).\n * - `SERVER_ERROR` — The server returned a 5xx status.\n * - `RATE_LIMITED` — The server returned HTTP 429.\n * - `NOT_FOUND` — The requested resource does not exist (HTTP 404).\n * - `UNKNOWN_ERROR` — An unexpected error that doesn't fit other categories.\n */\nexport type ComposeErrorCode =\n | 'NETWORK_ERROR'\n | 'VALIDATION_ERROR'\n | 'UNAUTHENTICATED'\n | 'FORBIDDEN'\n | 'SERVER_ERROR'\n | 'RATE_LIMITED'\n | 'NOT_FOUND'\n | 'UNKNOWN_ERROR';\n\n/**\n * Error class for all failures originating from the Compose SDK or API.\n *\n * Includes structured metadata beyond the error message to support\n * programmatic error handling.\n *\n * @example\n * ```ts\n * try {\n * await builder.compile(run);\n * } catch (e) {\n * if (isComposeError(e) && e.code === 'VALIDATION_ERROR') {\n * console.error('Invalid request:', e.message, e.path);\n * }\n * }\n * ```\n */\nexport class ComposeError extends Error {\n override readonly name = 'ComposeError';\n /** Machine-readable error category. */\n readonly code: ComposeErrorCode;\n /** HTTP status code, when the error originated from an HTTP response. */\n readonly status?: number;\n /** The request URL that produced the error. */\n readonly url?: string;\n /** Server-provided error kind for finer-grained classification. */\n readonly kind?: ComposeErrorKind;\n /** JSON-pointer path to the field that caused a validation error. */\n readonly path?: string;\n /**\n * Simulation revert diagnostics attached to `simulation_revert` errors.\n * Contains the raw error bytes and decoded error candidates when the\n * backend can parse the revert reason.\n */\n readonly details?: SimulationRevert;\n\n constructor(\n code: ComposeErrorCode,\n message: string,\n options?: {\n status?: number;\n url?: string;\n cause?: unknown;\n kind?: ComposeErrorKind;\n path?: string;\n details?: SimulationRevert;\n },\n ) {\n super(message, { cause: options?.cause });\n this.code = code;\n this.status = options?.status;\n this.url = options?.url;\n this.kind = options?.kind;\n this.path = options?.path;\n this.details = options?.details;\n }\n}\n\n/**\n * Type guard that narrows an unknown error to {@link ComposeError}.\n * @param e - The value to check.\n * @returns `true` if `e` is an instance of `ComposeError`.\n */\nexport const isComposeError = (e: unknown): e is ComposeError =>\n e instanceof ComposeError ||\n (e instanceof Error && e.name === 'ComposeError' && 'code' in e);\n\nconst STATUS_TO_CODE: ReadonlyMap<number, ComposeErrorCode> = new Map<\n number,\n ComposeErrorCode\n>([\n [400, 'VALIDATION_ERROR'],\n [401, 'UNAUTHENTICATED'],\n [403, 'FORBIDDEN'],\n [404, 'NOT_FOUND'],\n [422, 'VALIDATION_ERROR'],\n [429, 'RATE_LIMITED'],\n]);\n\ninterface ServerErrorBody {\n readonly error?: {\n readonly kind?: string;\n readonly message?: string;\n readonly path?: string;\n readonly details?: SimulationRevert;\n };\n}\n\nconst tryParseErrorBody = (body: string): ServerErrorBody | null => {\n try {\n return JSON.parse(body) as ServerErrorBody;\n } catch {\n return null;\n }\n};\n\n/**\n * Constructs a {@link ComposeError} from an HTTP error response, extracting\n * structured error details from the response body when available.\n *\n * @param status - The HTTP status code.\n * @param body - The raw response body text.\n * @param url - The request URL that produced the error.\n * @returns A `ComposeError` with the appropriate error code and metadata.\n */\nexport const errorFromHttpResponse = (\n status: number,\n body: string,\n url: string,\n): ComposeError => {\n const parsed = tryParseErrorBody(body);\n const serverError = parsed?.error;\n\n return new ComposeError(\n STATUS_TO_CODE.get(status) ??\n (status >= 500 ? 'SERVER_ERROR' : 'UNKNOWN_ERROR'),\n (serverError?.message ?? body) || `HTTP ${status}`,\n {\n status,\n url,\n kind: serverError?.kind as ComposeErrorKind | undefined,\n path: serverError?.path,\n details: serverError?.details,\n },\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCO,MAAM,qBAAqB,MAAM;AAAA,EACpB,OAAO;AAAA;AAAA,EAEhB;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AAAA,EAET,YACE,MACA,SACA,SAQA;AACA,UAAM,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC;AACxC,SAAK,OAAO;AACZ,SAAK,SAAS,SAAS;AACvB,SAAK,MAAM,SAAS;AACpB,SAAK,OAAO,SAAS;AACrB,SAAK,OAAO,SAAS;AACrB,SAAK,UAAU,SAAS;AAAA,EAC1B;AACF;AAOO,MAAM,iBAAiB,CAAC,MAC7B,aAAa,gBACZ,aAAa,SAAS,EAAE,SAAS,kBAAkB,UAAU;AAEhE,MAAM,iBAAwD,oBAAI,IAGhE;AAAA,EACA,CAAC,KAAK,kBAAkB;AAAA,EACxB,CAAC,KAAK,iBAAiB;AAAA,EACvB,CAAC,KAAK,WAAW;AAAA,EACjB,CAAC,KAAK,WAAW;AAAA,EACjB,CAAC,KAAK,kBAAkB;AAAA,EACxB,CAAC,KAAK,cAAc;AACtB,CAAC;AAWD,MAAM,oBAAoB,CAAC,SAAyC;AAClE,MAAI;AACF,WAAO,KAAK,MAAM,IAAI;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAWO,MAAM,wBAAwB,CACnC,QACA,MACA,QACiB;AACjB,QAAM,SAAS,kBAAkB,IAAI;AACrC,QAAM,cAAc,QAAQ;AAE5B,SAAO,IAAI;AAAA,IACT,eAAe,IAAI,MAAM,MACtB,UAAU,MAAM,iBAAiB;AAAA,KACnC,aAAa,WAAW,SAAS,QAAQ,MAAM;AAAA,IAChD;AAAA,MACE;AAAA,MACA;AAAA,MACA,MAAM,aAAa;AAAA,MACnB,MAAM,aAAa;AAAA,MACnB,SAAS,aAAa;AAAA,IACxB;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/errors.ts"],"sourcesContent":["import type { ComposeErrorKind, SimulationRevert } from '@lifi/compose-spec';\n\nimport {\n parseServerErrorBody,\n type ServerErrorBody,\n} from './responseSchemas.js';\n\n/**\n * Machine-readable error codes returned by the SDK.\n *\n * - `NETWORK_ERROR` — The HTTP request failed (DNS, timeout, connection refused).\n * - `VALIDATION_ERROR` — The server rejected the request (HTTP 400/422).\n * - `UNAUTHENTICATED` — The request lacks valid authentication credentials (HTTP 401).\n * - `FORBIDDEN` — The server understood the request but refuses to authorise it (HTTP 403).\n * - `SERVER_ERROR` — The server returned a 5xx status.\n * - `RATE_LIMITED` — The server returned HTTP 429.\n * - `NOT_FOUND` — The requested resource does not exist (HTTP 404).\n * - `UNKNOWN_ERROR` — An unexpected error that doesn't fit other categories.\n */\nexport type ComposeErrorCode =\n | 'NETWORK_ERROR'\n | 'VALIDATION_ERROR'\n | 'UNAUTHENTICATED'\n | 'FORBIDDEN'\n | 'SERVER_ERROR'\n | 'RATE_LIMITED'\n | 'NOT_FOUND'\n | 'UNKNOWN_ERROR';\n\n/**\n * Error class for all failures originating from the Compose SDK or API.\n *\n * Includes structured metadata beyond the error message to support\n * programmatic error handling.\n *\n * @example\n * ```ts\n * try {\n * await builder.compile(run);\n * } catch (e) {\n * if (isComposeError(e) && e.code === 'VALIDATION_ERROR') {\n * console.error('Invalid request:', e.message, e.path);\n * }\n * }\n * ```\n */\nexport class ComposeError extends Error {\n override readonly name = 'ComposeError';\n /** Machine-readable error category. */\n readonly code: ComposeErrorCode;\n /** HTTP status code, when the error originated from an HTTP response. */\n readonly status?: number;\n /** The request URL that produced the error. */\n readonly url?: string;\n /** Server-provided error kind for finer-grained classification. */\n readonly kind?: ComposeErrorKind;\n /** JSON-pointer path to the field that caused a validation error. */\n readonly path?: string;\n /**\n * Simulation revert diagnostics attached to `simulation_revert` errors.\n * Contains the raw error bytes and decoded error candidates when the\n * backend can parse the revert reason.\n */\n readonly details?: SimulationRevert;\n\n constructor(\n code: ComposeErrorCode,\n message: string,\n options?: {\n status?: number;\n url?: string;\n cause?: unknown;\n kind?: ComposeErrorKind;\n path?: string;\n details?: SimulationRevert;\n },\n ) {\n super(message, { cause: options?.cause });\n this.code = code;\n this.status = options?.status;\n this.url = options?.url;\n this.kind = options?.kind;\n this.path = options?.path;\n this.details = options?.details;\n }\n}\n\n/**\n * Type guard that narrows an unknown error to {@link ComposeError}.\n * @param e - The value to check.\n * @returns `true` if `e` is an instance of `ComposeError`.\n */\nexport const isComposeError = (e: unknown): e is ComposeError =>\n e instanceof ComposeError ||\n (e instanceof Error && e.name === 'ComposeError' && 'code' in e);\n\nconst STATUS_TO_CODE: ReadonlyMap<number, ComposeErrorCode> = new Map<\n number,\n ComposeErrorCode\n>([\n [400, 'VALIDATION_ERROR'],\n [401, 'UNAUTHENTICATED'],\n [403, 'FORBIDDEN'],\n [404, 'NOT_FOUND'],\n [422, 'VALIDATION_ERROR'],\n [429, 'RATE_LIMITED'],\n]);\n\nconst tryParseErrorBody = (body: string): ServerErrorBody | null => {\n let json: unknown;\n try {\n json = JSON.parse(body);\n } catch {\n return null;\n }\n return parseServerErrorBody(json);\n};\n\n/**\n * Constructs a {@link ComposeError} from an HTTP error response, extracting\n * structured error details from the response body when available.\n *\n * @param status - The HTTP status code.\n * @param body - The raw response body text.\n * @param url - The request URL that produced the error.\n * @returns A `ComposeError` with the appropriate error code and metadata.\n */\nexport const errorFromHttpResponse = (\n status: number,\n body: string,\n url: string,\n): ComposeError => {\n const parsed = tryParseErrorBody(body);\n const serverError = parsed?.error;\n\n return new ComposeError(\n STATUS_TO_CODE.get(status) ??\n (status >= 500 ? 'SERVER_ERROR' : 'UNKNOWN_ERROR'),\n (serverError?.message ?? body) || `HTTP ${status}`,\n {\n status,\n url,\n kind: serverError?.kind as ComposeErrorKind | undefined,\n path: serverError?.path,\n details: serverError?.details,\n },\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,6BAGO;AAyCA,MAAM,qBAAqB,MAAM;AAAA,EACpB,OAAO;AAAA;AAAA,EAEhB;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AAAA,EAET,YACE,MACA,SACA,SAQA;AACA,UAAM,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC;AACxC,SAAK,OAAO;AACZ,SAAK,SAAS,SAAS;AACvB,SAAK,MAAM,SAAS;AACpB,SAAK,OAAO,SAAS;AACrB,SAAK,OAAO,SAAS;AACrB,SAAK,UAAU,SAAS;AAAA,EAC1B;AACF;AAOO,MAAM,iBAAiB,CAAC,MAC7B,aAAa,gBACZ,aAAa,SAAS,EAAE,SAAS,kBAAkB,UAAU;AAEhE,MAAM,iBAAwD,oBAAI,IAGhE;AAAA,EACA,CAAC,KAAK,kBAAkB;AAAA,EACxB,CAAC,KAAK,iBAAiB;AAAA,EACvB,CAAC,KAAK,WAAW;AAAA,EACjB,CAAC,KAAK,WAAW;AAAA,EACjB,CAAC,KAAK,kBAAkB;AAAA,EACxB,CAAC,KAAK,cAAc;AACtB,CAAC;AAED,MAAM,oBAAoB,CAAC,SAAyC;AAClE,MAAI;AACJ,MAAI;AACF,WAAO,KAAK,MAAM,IAAI;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,aAAO,6CAAqB,IAAI;AAClC;AAWO,MAAM,wBAAwB,CACnC,QACA,MACA,QACiB;AACjB,QAAM,SAAS,kBAAkB,IAAI;AACrC,QAAM,cAAc,QAAQ;AAE5B,SAAO,IAAI;AAAA,IACT,eAAe,IAAI,MAAM,MACtB,UAAU,MAAM,iBAAiB;AAAA,KACnC,aAAa,WAAW,SAAS,QAAQ,MAAM;AAAA,IAChD;AAAA,MACE;AAAA,MACA;AAAA,MACA,MAAM,aAAa;AAAA,MACnB,MAAM,aAAa;AAAA,MACnB,SAAS,aAAa;AAAA,IACxB;AAAA,EACF;AACF;","names":[]}
package/dist/errors.js CHANGED
@@ -1,3 +1,6 @@
1
+ import {
2
+ parseServerErrorBody
3
+ } from "./responseSchemas.js";
1
4
  class ComposeError extends Error {
2
5
  name = "ComposeError";
3
6
  /** Machine-readable error category. */
@@ -36,11 +39,13 @@ const STATUS_TO_CODE = /* @__PURE__ */ new Map([
36
39
  [429, "RATE_LIMITED"]
37
40
  ]);
38
41
  const tryParseErrorBody = (body) => {
42
+ let json;
39
43
  try {
40
- return JSON.parse(body);
44
+ json = JSON.parse(body);
41
45
  } catch {
42
46
  return null;
43
47
  }
48
+ return parseServerErrorBody(json);
44
49
  };
45
50
  const errorFromHttpResponse = (status, body, url) => {
46
51
  const parsed = tryParseErrorBody(body);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts"],"sourcesContent":["import type { ComposeErrorKind, SimulationRevert } from '@lifi/compose-spec';\n\n/**\n * Machine-readable error codes returned by the SDK.\n *\n * - `NETWORK_ERROR` — The HTTP request failed (DNS, timeout, connection refused).\n * - `VALIDATION_ERROR` — The server rejected the request (HTTP 400/422).\n * - `UNAUTHENTICATED` — The request lacks valid authentication credentials (HTTP 401).\n * - `FORBIDDEN` — The server understood the request but refuses to authorise it (HTTP 403).\n * - `SERVER_ERROR` — The server returned a 5xx status.\n * - `RATE_LIMITED` — The server returned HTTP 429.\n * - `NOT_FOUND` — The requested resource does not exist (HTTP 404).\n * - `UNKNOWN_ERROR` — An unexpected error that doesn't fit other categories.\n */\nexport type ComposeErrorCode =\n | 'NETWORK_ERROR'\n | 'VALIDATION_ERROR'\n | 'UNAUTHENTICATED'\n | 'FORBIDDEN'\n | 'SERVER_ERROR'\n | 'RATE_LIMITED'\n | 'NOT_FOUND'\n | 'UNKNOWN_ERROR';\n\n/**\n * Error class for all failures originating from the Compose SDK or API.\n *\n * Includes structured metadata beyond the error message to support\n * programmatic error handling.\n *\n * @example\n * ```ts\n * try {\n * await builder.compile(run);\n * } catch (e) {\n * if (isComposeError(e) && e.code === 'VALIDATION_ERROR') {\n * console.error('Invalid request:', e.message, e.path);\n * }\n * }\n * ```\n */\nexport class ComposeError extends Error {\n override readonly name = 'ComposeError';\n /** Machine-readable error category. */\n readonly code: ComposeErrorCode;\n /** HTTP status code, when the error originated from an HTTP response. */\n readonly status?: number;\n /** The request URL that produced the error. */\n readonly url?: string;\n /** Server-provided error kind for finer-grained classification. */\n readonly kind?: ComposeErrorKind;\n /** JSON-pointer path to the field that caused a validation error. */\n readonly path?: string;\n /**\n * Simulation revert diagnostics attached to `simulation_revert` errors.\n * Contains the raw error bytes and decoded error candidates when the\n * backend can parse the revert reason.\n */\n readonly details?: SimulationRevert;\n\n constructor(\n code: ComposeErrorCode,\n message: string,\n options?: {\n status?: number;\n url?: string;\n cause?: unknown;\n kind?: ComposeErrorKind;\n path?: string;\n details?: SimulationRevert;\n },\n ) {\n super(message, { cause: options?.cause });\n this.code = code;\n this.status = options?.status;\n this.url = options?.url;\n this.kind = options?.kind;\n this.path = options?.path;\n this.details = options?.details;\n }\n}\n\n/**\n * Type guard that narrows an unknown error to {@link ComposeError}.\n * @param e - The value to check.\n * @returns `true` if `e` is an instance of `ComposeError`.\n */\nexport const isComposeError = (e: unknown): e is ComposeError =>\n e instanceof ComposeError ||\n (e instanceof Error && e.name === 'ComposeError' && 'code' in e);\n\nconst STATUS_TO_CODE: ReadonlyMap<number, ComposeErrorCode> = new Map<\n number,\n ComposeErrorCode\n>([\n [400, 'VALIDATION_ERROR'],\n [401, 'UNAUTHENTICATED'],\n [403, 'FORBIDDEN'],\n [404, 'NOT_FOUND'],\n [422, 'VALIDATION_ERROR'],\n [429, 'RATE_LIMITED'],\n]);\n\ninterface ServerErrorBody {\n readonly error?: {\n readonly kind?: string;\n readonly message?: string;\n readonly path?: string;\n readonly details?: SimulationRevert;\n };\n}\n\nconst tryParseErrorBody = (body: string): ServerErrorBody | null => {\n try {\n return JSON.parse(body) as ServerErrorBody;\n } catch {\n return null;\n }\n};\n\n/**\n * Constructs a {@link ComposeError} from an HTTP error response, extracting\n * structured error details from the response body when available.\n *\n * @param status - The HTTP status code.\n * @param body - The raw response body text.\n * @param url - The request URL that produced the error.\n * @returns A `ComposeError` with the appropriate error code and metadata.\n */\nexport const errorFromHttpResponse = (\n status: number,\n body: string,\n url: string,\n): ComposeError => {\n const parsed = tryParseErrorBody(body);\n const serverError = parsed?.error;\n\n return new ComposeError(\n STATUS_TO_CODE.get(status) ??\n (status >= 500 ? 'SERVER_ERROR' : 'UNKNOWN_ERROR'),\n (serverError?.message ?? body) || `HTTP ${status}`,\n {\n status,\n url,\n kind: serverError?.kind as ComposeErrorKind | undefined,\n path: serverError?.path,\n details: serverError?.details,\n },\n );\n};\n"],"mappings":"AAyCO,MAAM,qBAAqB,MAAM;AAAA,EACpB,OAAO;AAAA;AAAA,EAEhB;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AAAA,EAET,YACE,MACA,SACA,SAQA;AACA,UAAM,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC;AACxC,SAAK,OAAO;AACZ,SAAK,SAAS,SAAS;AACvB,SAAK,MAAM,SAAS;AACpB,SAAK,OAAO,SAAS;AACrB,SAAK,OAAO,SAAS;AACrB,SAAK,UAAU,SAAS;AAAA,EAC1B;AACF;AAOO,MAAM,iBAAiB,CAAC,MAC7B,aAAa,gBACZ,aAAa,SAAS,EAAE,SAAS,kBAAkB,UAAU;AAEhE,MAAM,iBAAwD,oBAAI,IAGhE;AAAA,EACA,CAAC,KAAK,kBAAkB;AAAA,EACxB,CAAC,KAAK,iBAAiB;AAAA,EACvB,CAAC,KAAK,WAAW;AAAA,EACjB,CAAC,KAAK,WAAW;AAAA,EACjB,CAAC,KAAK,kBAAkB;AAAA,EACxB,CAAC,KAAK,cAAc;AACtB,CAAC;AAWD,MAAM,oBAAoB,CAAC,SAAyC;AAClE,MAAI;AACF,WAAO,KAAK,MAAM,IAAI;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAWO,MAAM,wBAAwB,CACnC,QACA,MACA,QACiB;AACjB,QAAM,SAAS,kBAAkB,IAAI;AACrC,QAAM,cAAc,QAAQ;AAE5B,SAAO,IAAI;AAAA,IACT,eAAe,IAAI,MAAM,MACtB,UAAU,MAAM,iBAAiB;AAAA,KACnC,aAAa,WAAW,SAAS,QAAQ,MAAM;AAAA,IAChD;AAAA,MACE;AAAA,MACA;AAAA,MACA,MAAM,aAAa;AAAA,MACnB,MAAM,aAAa;AAAA,MACnB,SAAS,aAAa;AAAA,IACxB;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/errors.ts"],"sourcesContent":["import type { ComposeErrorKind, SimulationRevert } from '@lifi/compose-spec';\n\nimport {\n parseServerErrorBody,\n type ServerErrorBody,\n} from './responseSchemas.js';\n\n/**\n * Machine-readable error codes returned by the SDK.\n *\n * - `NETWORK_ERROR` — The HTTP request failed (DNS, timeout, connection refused).\n * - `VALIDATION_ERROR` — The server rejected the request (HTTP 400/422).\n * - `UNAUTHENTICATED` — The request lacks valid authentication credentials (HTTP 401).\n * - `FORBIDDEN` — The server understood the request but refuses to authorise it (HTTP 403).\n * - `SERVER_ERROR` — The server returned a 5xx status.\n * - `RATE_LIMITED` — The server returned HTTP 429.\n * - `NOT_FOUND` — The requested resource does not exist (HTTP 404).\n * - `UNKNOWN_ERROR` — An unexpected error that doesn't fit other categories.\n */\nexport type ComposeErrorCode =\n | 'NETWORK_ERROR'\n | 'VALIDATION_ERROR'\n | 'UNAUTHENTICATED'\n | 'FORBIDDEN'\n | 'SERVER_ERROR'\n | 'RATE_LIMITED'\n | 'NOT_FOUND'\n | 'UNKNOWN_ERROR';\n\n/**\n * Error class for all failures originating from the Compose SDK or API.\n *\n * Includes structured metadata beyond the error message to support\n * programmatic error handling.\n *\n * @example\n * ```ts\n * try {\n * await builder.compile(run);\n * } catch (e) {\n * if (isComposeError(e) && e.code === 'VALIDATION_ERROR') {\n * console.error('Invalid request:', e.message, e.path);\n * }\n * }\n * ```\n */\nexport class ComposeError extends Error {\n override readonly name = 'ComposeError';\n /** Machine-readable error category. */\n readonly code: ComposeErrorCode;\n /** HTTP status code, when the error originated from an HTTP response. */\n readonly status?: number;\n /** The request URL that produced the error. */\n readonly url?: string;\n /** Server-provided error kind for finer-grained classification. */\n readonly kind?: ComposeErrorKind;\n /** JSON-pointer path to the field that caused a validation error. */\n readonly path?: string;\n /**\n * Simulation revert diagnostics attached to `simulation_revert` errors.\n * Contains the raw error bytes and decoded error candidates when the\n * backend can parse the revert reason.\n */\n readonly details?: SimulationRevert;\n\n constructor(\n code: ComposeErrorCode,\n message: string,\n options?: {\n status?: number;\n url?: string;\n cause?: unknown;\n kind?: ComposeErrorKind;\n path?: string;\n details?: SimulationRevert;\n },\n ) {\n super(message, { cause: options?.cause });\n this.code = code;\n this.status = options?.status;\n this.url = options?.url;\n this.kind = options?.kind;\n this.path = options?.path;\n this.details = options?.details;\n }\n}\n\n/**\n * Type guard that narrows an unknown error to {@link ComposeError}.\n * @param e - The value to check.\n * @returns `true` if `e` is an instance of `ComposeError`.\n */\nexport const isComposeError = (e: unknown): e is ComposeError =>\n e instanceof ComposeError ||\n (e instanceof Error && e.name === 'ComposeError' && 'code' in e);\n\nconst STATUS_TO_CODE: ReadonlyMap<number, ComposeErrorCode> = new Map<\n number,\n ComposeErrorCode\n>([\n [400, 'VALIDATION_ERROR'],\n [401, 'UNAUTHENTICATED'],\n [403, 'FORBIDDEN'],\n [404, 'NOT_FOUND'],\n [422, 'VALIDATION_ERROR'],\n [429, 'RATE_LIMITED'],\n]);\n\nconst tryParseErrorBody = (body: string): ServerErrorBody | null => {\n let json: unknown;\n try {\n json = JSON.parse(body);\n } catch {\n return null;\n }\n return parseServerErrorBody(json);\n};\n\n/**\n * Constructs a {@link ComposeError} from an HTTP error response, extracting\n * structured error details from the response body when available.\n *\n * @param status - The HTTP status code.\n * @param body - The raw response body text.\n * @param url - The request URL that produced the error.\n * @returns A `ComposeError` with the appropriate error code and metadata.\n */\nexport const errorFromHttpResponse = (\n status: number,\n body: string,\n url: string,\n): ComposeError => {\n const parsed = tryParseErrorBody(body);\n const serverError = parsed?.error;\n\n return new ComposeError(\n STATUS_TO_CODE.get(status) ??\n (status >= 500 ? 'SERVER_ERROR' : 'UNKNOWN_ERROR'),\n (serverError?.message ?? body) || `HTTP ${status}`,\n {\n status,\n url,\n kind: serverError?.kind as ComposeErrorKind | undefined,\n path: serverError?.path,\n details: serverError?.details,\n },\n );\n};\n"],"mappings":"AAEA;AAAA,EACE;AAAA,OAEK;AAyCA,MAAM,qBAAqB,MAAM;AAAA,EACpB,OAAO;AAAA;AAAA,EAEhB;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AAAA,EAET,YACE,MACA,SACA,SAQA;AACA,UAAM,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC;AACxC,SAAK,OAAO;AACZ,SAAK,SAAS,SAAS;AACvB,SAAK,MAAM,SAAS;AACpB,SAAK,OAAO,SAAS;AACrB,SAAK,OAAO,SAAS;AACrB,SAAK,UAAU,SAAS;AAAA,EAC1B;AACF;AAOO,MAAM,iBAAiB,CAAC,MAC7B,aAAa,gBACZ,aAAa,SAAS,EAAE,SAAS,kBAAkB,UAAU;AAEhE,MAAM,iBAAwD,oBAAI,IAGhE;AAAA,EACA,CAAC,KAAK,kBAAkB;AAAA,EACxB,CAAC,KAAK,iBAAiB;AAAA,EACvB,CAAC,KAAK,WAAW;AAAA,EACjB,CAAC,KAAK,WAAW;AAAA,EACjB,CAAC,KAAK,kBAAkB;AAAA,EACxB,CAAC,KAAK,cAAc;AACtB,CAAC;AAED,MAAM,oBAAoB,CAAC,SAAyC;AAClE,MAAI;AACJ,MAAI;AACF,WAAO,KAAK,MAAM,IAAI;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,SAAO,qBAAqB,IAAI;AAClC;AAWO,MAAM,wBAAwB,CACnC,QACA,MACA,QACiB;AACjB,QAAM,SAAS,kBAAkB,IAAI;AACrC,QAAM,cAAc,QAAQ;AAE5B,SAAO,IAAI;AAAA,IACT,eAAe,IAAI,MAAM,MACtB,UAAU,MAAM,iBAAiB;AAAA,KACnC,aAAa,WAAW,SAAS,QAAQ,MAAM;AAAA,IAChD;AAAA,MACE;AAAA,MACA;AAAA,MACA,MAAM,aAAa;AAAA,MACnB,MAAM,aAAa;AAAA,MACnB,SAAS,aAAa;AAAA,IACxB;AAAA,EACF;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/generated/config.generated.ts"],"sourcesContent":["// AUTO-GENERATED from manifest.json — do not edit by hand.\n// Regenerate with: yarn workspace @lifi/composer-sdk generate\n\nimport type { Address, IntegerStringInput } from '../types.js';\n\nexport interface CoreSplitConfig {\n bps: number;\n}\n\n/**\n * a positive number\n */\nexport type Positive = number;\n/**\n * a string at most 64 character(s) long\n */\nexport type MaxLength64 = string;\n/**\n * an array of at most 50 item(s)\n *\n * @maxItems 50\n */\nexport type MaxItems50 = MaxLength64[];\n\nexport interface LifiSwapConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n token: Address;\n chainId: Positive;\n };\n slippage?: number;\n timing?: {\n swapStepTimingStrategies?: {\n strategy: 'minWaitTime';\n minWaitTimeMs: number;\n startingExpectedResults: number;\n reduceEveryMs: number;\n }[];\n routeTimingStrategies?: {\n strategy: 'minWaitTime';\n minWaitTimeMs: number;\n startingExpectedResults: number;\n reduceEveryMs: number;\n }[];\n };\n exchanges?: {\n allow?: MaxItems50;\n deny?: MaxItems50;\n prefer?: MaxItems50;\n };\n}\n\nexport interface CoreBpsDownConfig {\n bps: number;\n}\n\nexport interface CoreBpsUpConfig {\n bps: number;\n}\n\nexport interface CoreApproveConfig {\n spender: Address;\n}\n\nexport interface CoreBalanceOfConfig {\n token: Address;\n owner?: Address;\n}\n\nexport interface CoreTransferConfig {\n amount?: IntegerStringInput;\n}\n\nexport interface CoreCallConfig {\n target: Address;\n functionSignature: string;\n callType?: 'Call' | 'ValueCall';\n args?: Unknown[];\n approvals?: {\n spender: Address;\n }[];\n}\nexport interface Unknown {\n [k: string]: unknown;\n}\n\nexport interface CoreStaticCallConfig {\n target: Address;\n functionSignature: string;\n args?: Unknown[];\n}\n\nexport interface CoreRawCallConfig {\n target: Address;\n calldata: string;\n callType?: 'Call' | 'StaticCall' | 'ValueCall' | 'DelegateCall';\n resultType?: string;\n}\n\nexport interface CoreInvokeConfig {\n target: Address;\n functionSignature: string;\n callType?: 'Call' | 'ValueCall';\n args?: Unknown[];\n}\n\nexport interface CoreAsResourceConfig {\n resource:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n token: Address;\n chainId: Positive;\n };\n}\n\nexport interface AaveBorrowConfig {\n pool: string;\n asset: string;\n variableDebtToken: string;\n amount: IntegerStringInput;\n referralId?: number;\n}\n\nexport type AaveRepayConfig =\n | {\n pool: string;\n mode: 'exact';\n }\n | {\n pool: string;\n mode: 'max';\n };\n\nexport interface AaveRepayWithATokensConfig {\n pool: string;\n asset: string;\n}\n\nexport interface AaveClaimRewardsConfig {\n rewardsController: string;\n assets: string[];\n reward: string;\n amount?: IntegerStringInput;\n to?: string;\n}\n\n/**\n * a number between 0 and 255\n */\nexport type Between0255 = number;\n\nexport interface AaveSetEModeConfig {\n pool: string;\n category: Between0255;\n}\n\nexport interface AaveGetHealthFactorConfig {\n pool: string;\n user?: string;\n}\n\nexport type MorphoBlueSupplyCollateralConfig =\n | (\n | {\n morpho?: string;\n onBehalfOf?: string;\n mode: 'exact';\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n onBehalfOf?: string;\n mode: 'exact';\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n morpho?: string;\n onBehalfOf?: string;\n mode: 'all';\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n onBehalfOf?: string;\n mode: 'all';\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueWithdrawCollateralConfig =\n | {\n morpho?: string;\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueBorrowConfig =\n | {\n morpho?: string;\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueRepayConfig =\n | (\n | {\n morpho?: string;\n mode: 'exact';\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n mode: 'exact';\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n morpho?: string;\n mode: 'max';\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n mode: 'max';\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueSupplyConfig =\n | {\n morpho?: string;\n onBehalfOf?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n onBehalfOf?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueWithdrawConfig =\n | (\n | {\n morpho?: string;\n mode: 'exact';\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n mode: 'exact';\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n morpho?: string;\n mode: 'max';\n onBehalfOf?: string;\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n mode: 'max';\n onBehalfOf?: string;\n receiver?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueGetPositionConfig =\n | {\n morpho?: string;\n user?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n user?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n };\n\nexport interface LifiFlashloanRepayConfig {\n leg: string;\n fee?: string;\n}\n\nexport interface LifiZapConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n token: Address;\n chainId: Positive;\n };\n}\n\n/**\n * a non-negative number\n */\nexport type GreaterThanOrEqualTo0 = number;\n/**\n * a number between 0 and 10000\n */\nexport type Between010000 = number;\n\nexport interface ParaswapBuyConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n token: Address;\n chainId: Positive;\n };\n exactAmountOut: string;\n srcDecimals: GreaterThanOrEqualTo0;\n destDecimals: GreaterThanOrEqualTo0;\n maxSlippageBps?: Between010000;\n partner?: string;\n partnerAddress?: string;\n /**\n * Integrator fee in basis points; non-negative integer string capped at 9000.\n */\n partnerFeeBps?: string;\n}\n\nexport interface CorePeekConfig {\n target: Address;\n functionSignature: string;\n args?: string[];\n}\n\nexport interface SlippageGuardConfig {\n port: string;\n bps: Between010000;\n}\n\nexport interface CoreNumericInvariantGuardConfig {\n port: string;\n op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq';\n threshold: IntegerStringInput;\n}\n\nexport interface BalanceOfMaterialiserConfig {\n owner: Address;\n}\n\nexport type DirectDepositMaterialiserConfig =\n | {\n amount: IntegerStringInput;\n allowNonExact?: false;\n }\n | {\n amount: IntegerStringInput;\n allowNonExact: true;\n }\n | {\n allowNonExact: true;\n simAmount?: string;\n };\n\nexport interface CallMaterialiserConfig {\n target: Address;\n calldata: string;\n}\n\nexport interface FlashloanMaterialiserConfig {\n providerKind: 'aave-v3' | 'erc3156' | 'balancer-v2' | 'morpho-blue';\n amount: IntegerStringInput;\n}\n\nexport interface Erc20BalancePreconditionConfig {\n wallet: Address;\n token: Address;\n balance: IntegerStringInput;\n}\n\nexport interface NativeBalancePreconditionConfig {\n wallet: Address;\n balance: IntegerStringInput;\n}\n\nexport interface Erc20AllowancePreconditionConfig {\n owner: Address;\n spender: Address;\n token: Address;\n allowance: IntegerStringInput;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/generated/config.generated.ts"],"sourcesContent":["// AUTO-GENERATED from manifest.json — do not edit by hand.\n// Regenerate with: yarn workspace @lifi/composer-sdk generate\n\nimport type { Address, IntegerStringInput } from '../types.js';\n\nexport interface CoreSplitConfig {\n bps: number;\n}\n\n/**\n * a positive number\n */\nexport type Positive = number;\n/**\n * a string at most 64 character(s) long\n */\nexport type MaxLength64 = string;\n/**\n * an array of at most 50 item(s)\n *\n * @maxItems 50\n */\nexport type MaxItems50 = MaxLength64[];\n\nexport interface LifiSwapConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n token: Address;\n chainId: Positive;\n };\n slippage?: number;\n timing?: {\n swapStepTimingStrategies?: {\n strategy: 'minWaitTime';\n minWaitTimeMs: number;\n startingExpectedResults: number;\n reduceEveryMs: number;\n }[];\n routeTimingStrategies?: {\n strategy: 'minWaitTime';\n minWaitTimeMs: number;\n startingExpectedResults: number;\n reduceEveryMs: number;\n }[];\n };\n exchanges?: {\n allow?: MaxItems50;\n deny?: MaxItems50;\n prefer?: MaxItems50;\n };\n}\n\nexport interface InvariantNumericConfig {\n op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq';\n threshold: IntegerStringInput;\n}\n\nexport interface InvariantNumericInRangeConfig {\n min: IntegerStringInput;\n max: IntegerStringInput;\n}\n\nexport interface InvariantGteConfig {\n threshold: IntegerStringInput;\n}\n\nexport interface InvariantGtConfig {\n threshold: IntegerStringInput;\n}\n\nexport interface InvariantLteConfig {\n threshold: IntegerStringInput;\n}\n\nexport interface InvariantLtConfig {\n threshold: IntegerStringInput;\n}\n\nexport interface InvariantEqConfig {\n threshold: IntegerStringInput;\n}\n\nexport interface InvariantNeqConfig {\n threshold: IntegerStringInput;\n}\n\nexport interface CoreBpsDownConfig {\n bps: number;\n}\n\nexport interface CoreBpsUpConfig {\n bps: number;\n}\n\nexport interface CoreApproveConfig {\n spender: Address;\n}\n\nexport interface CoreBalanceOfConfig {\n token: Address;\n owner?: Address;\n}\n\nexport interface CoreTransferConfig {\n amount?: IntegerStringInput;\n}\n\nexport interface CoreEmitEvent1Config {\n signature: string;\n}\n\nexport interface CoreEmitEvent2Config {\n signature: string;\n}\n\nexport interface CoreEmitEvent3Config {\n signature: string;\n}\n\nexport interface CoreEmitEvent4Config {\n signature: string;\n}\n\n/**\n * a string at most 65536 character(s) long\n */\nexport type MaxLength65536 = string;\n\nexport interface CoreCallConfig {\n target: Address;\n functionSignature: string;\n callType?: 'Call' | 'ValueCall';\n args?: (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )[]\n )[]\n )[]\n )[]\n )[]\n )[];\n approvals?: {\n spender: Address;\n }[];\n}\n\nexport interface CoreStaticCallConfig {\n target: Address;\n functionSignature: string;\n args?: (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )[]\n )[]\n )[]\n )[]\n )[]\n )[];\n}\n\nexport interface CoreRawCallConfig {\n target: Address;\n calldata: string;\n callType?: 'Call' | 'StaticCall' | 'ValueCall' | 'DelegateCall';\n resultType?: string;\n}\n\nexport interface CoreInvokeConfig {\n target: Address;\n functionSignature: string;\n callType?: 'Call' | 'ValueCall';\n args?: (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )\n | (\n | MaxLength65536\n | number\n | boolean\n | {\n $ref: string;\n }\n )[]\n )[]\n )[]\n )[]\n )[]\n )[];\n}\n\nexport interface CoreAsResourceConfig {\n resource:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n token: Address;\n chainId: Positive;\n };\n}\n\nexport interface AaveBorrowConfig {\n pool: string;\n asset: string;\n variableDebtToken: string;\n amount: IntegerStringInput;\n referralId?: number;\n}\n\nexport type AaveRepayConfig =\n | {\n pool: string;\n mode: 'exact';\n }\n | {\n pool: string;\n mode: 'max';\n };\n\nexport interface AaveRepayWithATokensConfig {\n pool: string;\n asset: string;\n}\n\nexport interface AaveClaimRewardsConfig {\n rewardsController: string;\n assets: string[];\n reward: string;\n amount?: IntegerStringInput;\n to?: string;\n}\n\n/**\n * a number between 0 and 255\n */\nexport type Between0255 = number;\n\nexport interface AaveSetEModeConfig {\n pool: string;\n category: Between0255;\n}\n\nexport interface AaveGetHealthFactorConfig {\n pool: string;\n user?: string;\n}\n\nexport type MorphoBlueSupplyCollateralConfig =\n | (\n | {\n morpho?: string;\n onBehalfOf?: string;\n mode: 'exact';\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n onBehalfOf?: string;\n mode: 'exact';\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n morpho?: string;\n onBehalfOf?: string;\n mode: 'all';\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n onBehalfOf?: string;\n mode: 'all';\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueWithdrawCollateralConfig =\n | {\n morpho?: string;\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueBorrowConfig =\n | {\n morpho?: string;\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueRepayConfig =\n | (\n | {\n morpho?: string;\n mode: 'exact';\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n mode: 'exact';\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n morpho?: string;\n mode: 'max';\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n mode: 'max';\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueSupplyConfig =\n | {\n morpho?: string;\n onBehalfOf?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n onBehalfOf?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueWithdrawConfig =\n | (\n | {\n morpho?: string;\n mode: 'exact';\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n mode: 'exact';\n amount: IntegerStringInput;\n onBehalfOf?: string;\n receiver?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n morpho?: string;\n mode: 'max';\n onBehalfOf?: string;\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n mode: 'max';\n onBehalfOf?: string;\n receiver?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueGetPositionConfig =\n | {\n morpho?: string;\n user?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n morpho?: string;\n user?: string;\n marketParams: {\n loanToken: string;\n collateralToken: string;\n oracle: string;\n irm: string;\n lltv: string;\n };\n };\n\nexport interface LifiFlashloanRepayConfig {\n leg: string;\n fee?: string;\n}\n\nexport interface LifiZapConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n token: Address;\n chainId: Positive;\n };\n}\n\n/**\n * a non-negative number\n */\nexport type GreaterThanOrEqualTo0 = number;\n/**\n * a number between 0 and 10000\n */\nexport type Between010000 = number;\n\nexport interface ParaswapBuyConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n token: Address;\n chainId: Positive;\n };\n exactAmountOut: string;\n srcDecimals: GreaterThanOrEqualTo0;\n destDecimals: GreaterThanOrEqualTo0;\n maxSlippageBps?: Between010000;\n partner?: string;\n partnerAddress?: string;\n /**\n * Integrator fee in basis points; non-negative integer string capped at 9000.\n */\n partnerFeeBps?: string;\n}\n\nexport interface CorePeekConfig {\n target: Address;\n functionSignature: string;\n args?: string[];\n}\n\nexport interface SlippageGuardConfig {\n port: string;\n bps: Between010000;\n}\n\nexport interface CoreNumericInvariantGuardConfig {\n port: string;\n op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq';\n threshold: IntegerStringInput;\n}\n\nexport interface BalanceOfMaterialiserConfig {\n owner: Address;\n}\n\nexport type DirectDepositMaterialiserConfig =\n | {\n amount: IntegerStringInput;\n allowNonExact?: false;\n }\n | {\n amount: IntegerStringInput;\n allowNonExact: true;\n }\n | {\n allowNonExact: true;\n simAmount?: string;\n };\n\nexport interface CallMaterialiserConfig {\n target: Address;\n calldata: string;\n}\n\nexport interface FlashloanMaterialiserConfig {\n providerKind: 'aave-v3' | 'erc3156' | 'balancer-v2' | 'morpho-blue';\n amount: IntegerStringInput;\n}\n\nexport interface Erc20BalancePreconditionConfig {\n wallet: Address;\n token: Address;\n balance: IntegerStringInput;\n}\n\nexport interface NativeBalancePreconditionConfig {\n wallet: Address;\n balance: IntegerStringInput;\n}\n\nexport interface Erc20AllowancePreconditionConfig {\n owner: Address;\n spender: Address;\n token: Address;\n allowance: IntegerStringInput;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -48,6 +48,32 @@ interface LifiSwapConfig {
48
48
  prefer?: MaxItems50;
49
49
  };
50
50
  }
51
+ interface InvariantNumericConfig {
52
+ op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq';
53
+ threshold: IntegerStringInput;
54
+ }
55
+ interface InvariantNumericInRangeConfig {
56
+ min: IntegerStringInput;
57
+ max: IntegerStringInput;
58
+ }
59
+ interface InvariantGteConfig {
60
+ threshold: IntegerStringInput;
61
+ }
62
+ interface InvariantGtConfig {
63
+ threshold: IntegerStringInput;
64
+ }
65
+ interface InvariantLteConfig {
66
+ threshold: IntegerStringInput;
67
+ }
68
+ interface InvariantLtConfig {
69
+ threshold: IntegerStringInput;
70
+ }
71
+ interface InvariantEqConfig {
72
+ threshold: IntegerStringInput;
73
+ }
74
+ interface InvariantNeqConfig {
75
+ threshold: IntegerStringInput;
76
+ }
51
77
  interface CoreBpsDownConfig {
52
78
  bps: number;
53
79
  }
@@ -64,22 +90,59 @@ interface CoreBalanceOfConfig {
64
90
  interface CoreTransferConfig {
65
91
  amount?: IntegerStringInput;
66
92
  }
93
+ interface CoreEmitEvent1Config {
94
+ signature: string;
95
+ }
96
+ interface CoreEmitEvent2Config {
97
+ signature: string;
98
+ }
99
+ interface CoreEmitEvent3Config {
100
+ signature: string;
101
+ }
102
+ interface CoreEmitEvent4Config {
103
+ signature: string;
104
+ }
105
+ /**
106
+ * a string at most 65536 character(s) long
107
+ */
108
+ type MaxLength65536 = string;
67
109
  interface CoreCallConfig {
68
110
  target: Address;
69
111
  functionSignature: string;
70
112
  callType?: 'Call' | 'ValueCall';
71
- args?: Unknown[];
113
+ args?: ((MaxLength65536 | number | boolean | {
114
+ $ref: string;
115
+ }) | ((MaxLength65536 | number | boolean | {
116
+ $ref: string;
117
+ }) | ((MaxLength65536 | number | boolean | {
118
+ $ref: string;
119
+ }) | ((MaxLength65536 | number | boolean | {
120
+ $ref: string;
121
+ }) | ((MaxLength65536 | number | boolean | {
122
+ $ref: string;
123
+ }) | (MaxLength65536 | number | boolean | {
124
+ $ref: string;
125
+ })[])[])[])[])[])[];
72
126
  approvals?: {
73
127
  spender: Address;
74
128
  }[];
75
129
  }
76
- interface Unknown {
77
- [k: string]: unknown;
78
- }
79
130
  interface CoreStaticCallConfig {
80
131
  target: Address;
81
132
  functionSignature: string;
82
- args?: Unknown[];
133
+ args?: ((MaxLength65536 | number | boolean | {
134
+ $ref: string;
135
+ }) | ((MaxLength65536 | number | boolean | {
136
+ $ref: string;
137
+ }) | ((MaxLength65536 | number | boolean | {
138
+ $ref: string;
139
+ }) | ((MaxLength65536 | number | boolean | {
140
+ $ref: string;
141
+ }) | ((MaxLength65536 | number | boolean | {
142
+ $ref: string;
143
+ }) | (MaxLength65536 | number | boolean | {
144
+ $ref: string;
145
+ })[])[])[])[])[])[];
83
146
  }
84
147
  interface CoreRawCallConfig {
85
148
  target: Address;
@@ -91,7 +154,19 @@ interface CoreInvokeConfig {
91
154
  target: Address;
92
155
  functionSignature: string;
93
156
  callType?: 'Call' | 'ValueCall';
94
- args?: Unknown[];
157
+ args?: ((MaxLength65536 | number | boolean | {
158
+ $ref: string;
159
+ }) | ((MaxLength65536 | number | boolean | {
160
+ $ref: string;
161
+ }) | ((MaxLength65536 | number | boolean | {
162
+ $ref: string;
163
+ }) | ((MaxLength65536 | number | boolean | {
164
+ $ref: string;
165
+ }) | ((MaxLength65536 | number | boolean | {
166
+ $ref: string;
167
+ }) | (MaxLength65536 | number | boolean | {
168
+ $ref: string;
169
+ })[])[])[])[])[])[];
95
170
  }
96
171
  interface CoreAsResourceConfig {
97
172
  resource: {
@@ -432,4 +507,4 @@ interface Erc20AllowancePreconditionConfig {
432
507
  allowance: IntegerStringInput;
433
508
  }
434
509
 
435
- export type { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between010000, Between0255, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, GreaterThanOrEqualTo0, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapConfig, MaxItems50, MaxLength64, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, ParaswapBuyConfig, Positive, SlippageGuardConfig, Unknown };
510
+ export type { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between010000, Between0255, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, GreaterThanOrEqualTo0, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapConfig, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, ParaswapBuyConfig, Positive, SlippageGuardConfig };
@@ -48,6 +48,32 @@ interface LifiSwapConfig {
48
48
  prefer?: MaxItems50;
49
49
  };
50
50
  }
51
+ interface InvariantNumericConfig {
52
+ op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq';
53
+ threshold: IntegerStringInput;
54
+ }
55
+ interface InvariantNumericInRangeConfig {
56
+ min: IntegerStringInput;
57
+ max: IntegerStringInput;
58
+ }
59
+ interface InvariantGteConfig {
60
+ threshold: IntegerStringInput;
61
+ }
62
+ interface InvariantGtConfig {
63
+ threshold: IntegerStringInput;
64
+ }
65
+ interface InvariantLteConfig {
66
+ threshold: IntegerStringInput;
67
+ }
68
+ interface InvariantLtConfig {
69
+ threshold: IntegerStringInput;
70
+ }
71
+ interface InvariantEqConfig {
72
+ threshold: IntegerStringInput;
73
+ }
74
+ interface InvariantNeqConfig {
75
+ threshold: IntegerStringInput;
76
+ }
51
77
  interface CoreBpsDownConfig {
52
78
  bps: number;
53
79
  }
@@ -64,22 +90,59 @@ interface CoreBalanceOfConfig {
64
90
  interface CoreTransferConfig {
65
91
  amount?: IntegerStringInput;
66
92
  }
93
+ interface CoreEmitEvent1Config {
94
+ signature: string;
95
+ }
96
+ interface CoreEmitEvent2Config {
97
+ signature: string;
98
+ }
99
+ interface CoreEmitEvent3Config {
100
+ signature: string;
101
+ }
102
+ interface CoreEmitEvent4Config {
103
+ signature: string;
104
+ }
105
+ /**
106
+ * a string at most 65536 character(s) long
107
+ */
108
+ type MaxLength65536 = string;
67
109
  interface CoreCallConfig {
68
110
  target: Address;
69
111
  functionSignature: string;
70
112
  callType?: 'Call' | 'ValueCall';
71
- args?: Unknown[];
113
+ args?: ((MaxLength65536 | number | boolean | {
114
+ $ref: string;
115
+ }) | ((MaxLength65536 | number | boolean | {
116
+ $ref: string;
117
+ }) | ((MaxLength65536 | number | boolean | {
118
+ $ref: string;
119
+ }) | ((MaxLength65536 | number | boolean | {
120
+ $ref: string;
121
+ }) | ((MaxLength65536 | number | boolean | {
122
+ $ref: string;
123
+ }) | (MaxLength65536 | number | boolean | {
124
+ $ref: string;
125
+ })[])[])[])[])[])[];
72
126
  approvals?: {
73
127
  spender: Address;
74
128
  }[];
75
129
  }
76
- interface Unknown {
77
- [k: string]: unknown;
78
- }
79
130
  interface CoreStaticCallConfig {
80
131
  target: Address;
81
132
  functionSignature: string;
82
- args?: Unknown[];
133
+ args?: ((MaxLength65536 | number | boolean | {
134
+ $ref: string;
135
+ }) | ((MaxLength65536 | number | boolean | {
136
+ $ref: string;
137
+ }) | ((MaxLength65536 | number | boolean | {
138
+ $ref: string;
139
+ }) | ((MaxLength65536 | number | boolean | {
140
+ $ref: string;
141
+ }) | ((MaxLength65536 | number | boolean | {
142
+ $ref: string;
143
+ }) | (MaxLength65536 | number | boolean | {
144
+ $ref: string;
145
+ })[])[])[])[])[])[];
83
146
  }
84
147
  interface CoreRawCallConfig {
85
148
  target: Address;
@@ -91,7 +154,19 @@ interface CoreInvokeConfig {
91
154
  target: Address;
92
155
  functionSignature: string;
93
156
  callType?: 'Call' | 'ValueCall';
94
- args?: Unknown[];
157
+ args?: ((MaxLength65536 | number | boolean | {
158
+ $ref: string;
159
+ }) | ((MaxLength65536 | number | boolean | {
160
+ $ref: string;
161
+ }) | ((MaxLength65536 | number | boolean | {
162
+ $ref: string;
163
+ }) | ((MaxLength65536 | number | boolean | {
164
+ $ref: string;
165
+ }) | ((MaxLength65536 | number | boolean | {
166
+ $ref: string;
167
+ }) | (MaxLength65536 | number | boolean | {
168
+ $ref: string;
169
+ })[])[])[])[])[])[];
95
170
  }
96
171
  interface CoreAsResourceConfig {
97
172
  resource: {
@@ -432,4 +507,4 @@ interface Erc20AllowancePreconditionConfig {
432
507
  allowance: IntegerStringInput;
433
508
  }
434
509
 
435
- export type { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between010000, Between0255, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, GreaterThanOrEqualTo0, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapConfig, MaxItems50, MaxLength64, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, ParaswapBuyConfig, Positive, SlippageGuardConfig, Unknown };
510
+ export type { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between010000, Between0255, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, GreaterThanOrEqualTo0, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapConfig, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, ParaswapBuyConfig, Positive, SlippageGuardConfig };
@@ -20,8 +20,7 @@ var materialisers_generated_exports = {};
20
20
  __export(materialisers_generated_exports, {
21
21
  balanceOf: () => balanceOf,
22
22
  call: () => call,
23
- directDeposit: () => directDeposit,
24
- flashloan: () => flashloan
23
+ directDeposit: () => directDeposit
25
24
  });
26
25
  module.exports = __toCommonJS(materialisers_generated_exports);
27
26
  const balanceOf = (config) => ({
@@ -36,15 +35,10 @@ const call = (config) => ({
36
35
  kind: "call",
37
36
  ...config
38
37
  });
39
- const flashloan = (config) => ({
40
- kind: "flashloan",
41
- ...config
42
- });
43
38
  // Annotate the CommonJS export names for ESM import in node:
44
39
  0 && (module.exports = {
45
40
  balanceOf,
46
41
  call,
47
- directDeposit,
48
- flashloan
42
+ directDeposit
49
43
  });
50
44
  //# sourceMappingURL=materialisers.generated.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/generated/materialisers.generated.ts"],"sourcesContent":["// AUTO-GENERATED from manifest.json — do not edit by hand.\n// Regenerate with: yarn workspace @lifi/composer-sdk generate\n\nimport type {\n MaterialiserConfigOf,\n MaterialiserInput,\n} from '@lifi/compose-spec';\n\nimport type {\n BalanceOfMaterialiserConfig as BalanceOfMaterialiserConfigSchema,\n CallMaterialiserConfig as CallMaterialiserConfigSchema,\n DirectDepositMaterialiserConfig as DirectDepositMaterialiserConfigSchema,\n FlashloanMaterialiserConfig as FlashloanMaterialiserConfigSchema,\n} from './config.generated.js';\n\nexport type BalanceOfMaterialiserConfig =\n MaterialiserConfigOf<BalanceOfMaterialiserConfigSchema>;\n\n/** Read the on-chain token balance of an address as the input amount — accepts: resource */\nexport const balanceOf = (\n config: BalanceOfMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'balanceOf',\n ...config,\n});\n\nexport type DirectDepositMaterialiserConfig =\n MaterialiserConfigOf<DirectDepositMaterialiserConfigSchema>;\n\n/** Deposit tokens into the VM — native via msg.value, ERC-20 via transferFrom — accepts: resource */\nexport const directDeposit = (\n config: DirectDepositMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'directDeposit',\n ...config,\n});\n\nexport type CallMaterialiserConfig =\n MaterialiserConfigOf<CallMaterialiserConfigSchema>;\n\n/** Execute an arbitrary contract call and measure the resulting token balance diff — accepts: resource */\nexport const call = (config: CallMaterialiserConfig): MaterialiserInput => ({\n kind: 'call',\n ...config,\n});\n\nexport type FlashloanMaterialiserConfig =\n MaterialiserConfigOf<FlashloanMaterialiserConfigSchema>;\n\n/** Borrow tokens from a flashloan provider; amount becomes a register populated by the proxy at callback time — accepts: resource */\nexport const flashloan = (\n config: FlashloanMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'flashloan',\n ...config,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,MAAM,YAAY,CACvB,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,gBAAgB,CAC3B,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,OAAO,CAAC,YAAuD;AAAA,EAC1E,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,YAAY,CACvB,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;","names":[]}
1
+ {"version":3,"sources":["../../src/generated/materialisers.generated.ts"],"sourcesContent":["// AUTO-GENERATED from manifest.json — do not edit by hand.\n// Regenerate with: yarn workspace @lifi/composer-sdk generate\n\nimport type {\n MaterialiserConfigOf,\n MaterialiserInput,\n} from '@lifi/compose-spec';\n\nimport type {\n BalanceOfMaterialiserConfig as BalanceOfMaterialiserConfigSchema,\n CallMaterialiserConfig as CallMaterialiserConfigSchema,\n DirectDepositMaterialiserConfig as DirectDepositMaterialiserConfigSchema,\n} from './config.generated.js';\n\nexport type BalanceOfMaterialiserConfig =\n MaterialiserConfigOf<BalanceOfMaterialiserConfigSchema>;\n\n/** Read the on-chain token balance of an address as the input amount — accepts: resource */\nexport const balanceOf = (\n config: BalanceOfMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'balanceOf',\n ...config,\n});\n\nexport type DirectDepositMaterialiserConfig =\n MaterialiserConfigOf<DirectDepositMaterialiserConfigSchema>;\n\n/** Deposit tokens into the VM — native via msg.value, ERC-20 via transferFrom — accepts: resource */\nexport const directDeposit = (\n config: DirectDepositMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'directDeposit',\n ...config,\n});\n\nexport type CallMaterialiserConfig =\n MaterialiserConfigOf<CallMaterialiserConfigSchema>;\n\n/** Execute an arbitrary contract call and measure the resulting token balance diff — accepts: resource */\nexport const call = (config: CallMaterialiserConfig): MaterialiserInput => ({\n kind: 'call',\n ...config,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBO,MAAM,YAAY,CACvB,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,gBAAgB,CAC3B,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,OAAO,CAAC,YAAuD;AAAA,EAC1E,MAAM;AAAA,EACN,GAAG;AACL;","names":[]}
@@ -1,4 +1,4 @@
1
1
  import '@lifi/compose-spec';
2
2
  import './config.generated.cjs';
3
- export { B as BalanceOfMaterialiserConfig, C as CallMaterialiserConfig, D as DirectDepositMaterialiserConfig, F as FlashloanMaterialiserConfig, b as balanceOf, c as call, d as directDeposit, f as flashloan } from '../materialisers.generated-DaJRwiRe.cjs';
3
+ export { B as BalanceOfMaterialiserConfig, C as CallMaterialiserConfig, D as DirectDepositMaterialiserConfig, b as balanceOf, c as call, d as directDeposit } from '../materialisers.generated-BWq5oePO.cjs';
4
4
  import '../types.cjs';
@@ -1,4 +1,4 @@
1
1
  import '@lifi/compose-spec';
2
2
  import './config.generated.js';
3
- export { B as BalanceOfMaterialiserConfig, C as CallMaterialiserConfig, D as DirectDepositMaterialiserConfig, F as FlashloanMaterialiserConfig, b as balanceOf, c as call, d as directDeposit, f as flashloan } from '../materialisers.generated-BfWJ-g7t.js';
3
+ export { B as BalanceOfMaterialiserConfig, C as CallMaterialiserConfig, D as DirectDepositMaterialiserConfig, b as balanceOf, c as call, d as directDeposit } from '../materialisers.generated-BMkBQgWZ.js';
4
4
  import '../types.js';
@@ -10,14 +10,9 @@ const call = (config) => ({
10
10
  kind: "call",
11
11
  ...config
12
12
  });
13
- const flashloan = (config) => ({
14
- kind: "flashloan",
15
- ...config
16
- });
17
13
  export {
18
14
  balanceOf,
19
15
  call,
20
- directDeposit,
21
- flashloan
16
+ directDeposit
22
17
  };
23
18
  //# sourceMappingURL=materialisers.generated.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/generated/materialisers.generated.ts"],"sourcesContent":["// AUTO-GENERATED from manifest.json — do not edit by hand.\n// Regenerate with: yarn workspace @lifi/composer-sdk generate\n\nimport type {\n MaterialiserConfigOf,\n MaterialiserInput,\n} from '@lifi/compose-spec';\n\nimport type {\n BalanceOfMaterialiserConfig as BalanceOfMaterialiserConfigSchema,\n CallMaterialiserConfig as CallMaterialiserConfigSchema,\n DirectDepositMaterialiserConfig as DirectDepositMaterialiserConfigSchema,\n FlashloanMaterialiserConfig as FlashloanMaterialiserConfigSchema,\n} from './config.generated.js';\n\nexport type BalanceOfMaterialiserConfig =\n MaterialiserConfigOf<BalanceOfMaterialiserConfigSchema>;\n\n/** Read the on-chain token balance of an address as the input amount — accepts: resource */\nexport const balanceOf = (\n config: BalanceOfMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'balanceOf',\n ...config,\n});\n\nexport type DirectDepositMaterialiserConfig =\n MaterialiserConfigOf<DirectDepositMaterialiserConfigSchema>;\n\n/** Deposit tokens into the VM — native via msg.value, ERC-20 via transferFrom — accepts: resource */\nexport const directDeposit = (\n config: DirectDepositMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'directDeposit',\n ...config,\n});\n\nexport type CallMaterialiserConfig =\n MaterialiserConfigOf<CallMaterialiserConfigSchema>;\n\n/** Execute an arbitrary contract call and measure the resulting token balance diff — accepts: resource */\nexport const call = (config: CallMaterialiserConfig): MaterialiserInput => ({\n kind: 'call',\n ...config,\n});\n\nexport type FlashloanMaterialiserConfig =\n MaterialiserConfigOf<FlashloanMaterialiserConfigSchema>;\n\n/** Borrow tokens from a flashloan provider; amount becomes a register populated by the proxy at callback time — accepts: resource */\nexport const flashloan = (\n config: FlashloanMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'flashloan',\n ...config,\n});\n"],"mappings":"AAmBO,MAAM,YAAY,CACvB,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,gBAAgB,CAC3B,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,OAAO,CAAC,YAAuD;AAAA,EAC1E,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,YAAY,CACvB,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;","names":[]}
1
+ {"version":3,"sources":["../../src/generated/materialisers.generated.ts"],"sourcesContent":["// AUTO-GENERATED from manifest.json — do not edit by hand.\n// Regenerate with: yarn workspace @lifi/composer-sdk generate\n\nimport type {\n MaterialiserConfigOf,\n MaterialiserInput,\n} from '@lifi/compose-spec';\n\nimport type {\n BalanceOfMaterialiserConfig as BalanceOfMaterialiserConfigSchema,\n CallMaterialiserConfig as CallMaterialiserConfigSchema,\n DirectDepositMaterialiserConfig as DirectDepositMaterialiserConfigSchema,\n} from './config.generated.js';\n\nexport type BalanceOfMaterialiserConfig =\n MaterialiserConfigOf<BalanceOfMaterialiserConfigSchema>;\n\n/** Read the on-chain token balance of an address as the input amount — accepts: resource */\nexport const balanceOf = (\n config: BalanceOfMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'balanceOf',\n ...config,\n});\n\nexport type DirectDepositMaterialiserConfig =\n MaterialiserConfigOf<DirectDepositMaterialiserConfigSchema>;\n\n/** Deposit tokens into the VM — native via msg.value, ERC-20 via transferFrom — accepts: resource */\nexport const directDeposit = (\n config: DirectDepositMaterialiserConfig,\n): MaterialiserInput => ({\n kind: 'directDeposit',\n ...config,\n});\n\nexport type CallMaterialiserConfig =\n MaterialiserConfigOf<CallMaterialiserConfigSchema>;\n\n/** Execute an arbitrary contract call and measure the resulting token balance diff — accepts: resource */\nexport const call = (config: CallMaterialiserConfig): MaterialiserInput => ({\n kind: 'call',\n ...config,\n});\n"],"mappings":"AAkBO,MAAM,YAAY,CACvB,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,gBAAgB,CAC3B,YACuB;AAAA,EACvB,MAAM;AAAA,EACN,GAAG;AACL;AAMO,MAAM,OAAO,CAAC,YAAuD;AAAA,EAC1E,MAAM;AAAA,EACN,GAAG;AACL;","names":[]}
@@ -65,6 +65,10 @@ const bindGeneratedOps = (builder) => ({
65
65
  transferred: "resource",
66
66
  remainder: "resource"
67
67
  }),
68
+ emitEvent1: (nodeId, args) => builder.call(nodeId, "core.emitEvent1", args, {}),
69
+ emitEvent2: (nodeId, args) => builder.call(nodeId, "core.emitEvent2", args, {}),
70
+ emitEvent3: (nodeId, args) => builder.call(nodeId, "core.emitEvent3", args, {}),
71
+ emitEvent4: (nodeId, args) => builder.call(nodeId, "core.emitEvent4", args, {}),
68
72
  call: (nodeId, args) => {
69
73
  const wire = (0, import_signatureArgs.buildCallWireFormat)({
70
74
  resource: args.resource,
@@ -99,7 +103,6 @@ const bindGeneratedOps = (builder) => ({
99
103
  amountOut: "resource",
100
104
  unspentIn: "resource"
101
105
  }),
102
- flashloanRepay: (nodeId, args) => builder.call(nodeId, "lifi.flashloanRepay", args, {}),
103
106
  zap: (nodeId, args) => builder.call(nodeId, "lifi.zap", args, {
104
107
  amountOut: "resource"
105
108
  })
@@ -110,7 +113,57 @@ const bindGeneratedOps = (builder) => ({
110
113
  "invariant.balanceAtLeast",
111
114
  { ...args, config: {} },
112
115
  {}
113
- )
116
+ ),
117
+ balanceEquals: (nodeId, args) => builder.call(
118
+ nodeId,
119
+ "invariant.balanceEquals",
120
+ { ...args, config: {} },
121
+ {}
122
+ ),
123
+ balanceAtMost: (nodeId, args) => builder.call(
124
+ nodeId,
125
+ "invariant.balanceAtMost",
126
+ { ...args, config: {} },
127
+ {}
128
+ ),
129
+ balanceInRange: (nodeId, args) => builder.call(
130
+ nodeId,
131
+ "invariant.balanceInRange",
132
+ { ...args, config: {} },
133
+ {}
134
+ ),
135
+ allowanceAtLeast: (nodeId, args) => builder.call(
136
+ nodeId,
137
+ "invariant.allowanceAtLeast",
138
+ { ...args, config: {} },
139
+ {}
140
+ ),
141
+ allowanceEquals: (nodeId, args) => builder.call(
142
+ nodeId,
143
+ "invariant.allowanceEquals",
144
+ { ...args, config: {} },
145
+ {}
146
+ ),
147
+ allowanceAtMost: (nodeId, args) => builder.call(
148
+ nodeId,
149
+ "invariant.allowanceAtMost",
150
+ { ...args, config: {} },
151
+ {}
152
+ ),
153
+ allowanceInRange: (nodeId, args) => builder.call(
154
+ nodeId,
155
+ "invariant.allowanceInRange",
156
+ { ...args, config: {} },
157
+ {}
158
+ ),
159
+ numeric: (nodeId, args) => builder.call(nodeId, "invariant.numeric", args, {}),
160
+ numericInRange: (nodeId, args) => builder.call(nodeId, "invariant.numericInRange", args, {}),
161
+ gte: (nodeId, args) => builder.call(nodeId, "invariant.gte", args, {}),
162
+ gt: (nodeId, args) => builder.call(nodeId, "invariant.gt", args, {}),
163
+ lte: (nodeId, args) => builder.call(nodeId, "invariant.lte", args, {}),
164
+ lt: (nodeId, args) => builder.call(nodeId, "invariant.lt", args, {}),
165
+ eq: (nodeId, args) => builder.call(nodeId, "invariant.eq", args, {}),
166
+ neq: (nodeId, args) => builder.call(nodeId, "invariant.neq", args, {})
114
167
  },
115
168
  aave: {
116
169
  borrow: (nodeId, args) => builder.call(nodeId, "aave.borrow", args, {
@@ -129,41 +182,13 @@ const bindGeneratedOps = (builder) => ({
129
182
  claimed: "resource",
130
183
  claimedAmount: "uint256"
131
184
  }),
132
- setEMode: (nodeId, args) => builder.call(nodeId, "aave.setEMode", args, {}),
133
- getHealthFactor: (nodeId, args) => builder.call(nodeId, "aave.getHealthFactor", args, {
134
- healthFactor: "uint256"
135
- })
185
+ setEMode: (nodeId, args) => builder.call(nodeId, "aave.setEMode", args, {})
136
186
  },
137
187
  morphoBlue: {
138
188
  supplyCollateral: (nodeId, args) => builder.call(nodeId, "morphoBlue.supplyCollateral", args, {}),
139
189
  withdrawCollateral: (nodeId, args) => builder.call(nodeId, "morphoBlue.withdrawCollateral", args, {
140
190
  withdrawn: "resource",
141
191
  collateralWithdrawn: "uint256"
142
- }),
143
- borrow: (nodeId, args) => builder.call(nodeId, "morphoBlue.borrow", args, {
144
- borrowed: "resource",
145
- assetsBorrowed: "uint256",
146
- sharesBorrowed: "uint256"
147
- }),
148
- repay: (nodeId, args) => builder.call(nodeId, "morphoBlue.repay", args, {
149
- actualRepaid: "uint256",
150
- sharesRepaid: "uint256",
151
- residual: "resource"
152
- }),
153
- supply: (nodeId, args) => builder.call(nodeId, "morphoBlue.supply", args, {
154
- assetsSupplied: "uint256",
155
- sharesSupplied: "uint256",
156
- residual: "resource"
157
- }),
158
- withdraw: (nodeId, args) => builder.call(nodeId, "morphoBlue.withdraw", args, {
159
- withdrawn: "resource",
160
- assetsWithdrawn: "uint256",
161
- sharesWithdrawn: "uint256"
162
- }),
163
- getPosition: (nodeId, args) => builder.call(nodeId, "morphoBlue.getPosition", args, {
164
- supplyShares: "uint256",
165
- borrowShares: "uint128",
166
- collateral: "uint128"
167
192
  })
168
193
  },
169
194
  paraswap: {