@lifi/composer-sdk 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/authoring/FlowBuilderCore.cjs +1 -1
- package/dist/authoring/FlowBuilderCore.cjs.map +1 -1
- package/dist/authoring/FlowBuilderCore.js +1 -1
- package/dist/authoring/FlowBuilderCore.js.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.js +1 -1
- package/dist/generated/config.generated.cjs.map +1 -1
- package/dist/generated/config.generated.d.cts +77 -35
- package/dist/generated/config.generated.d.ts +77 -35
- package/dist/generated/guards.generated.cjs +6 -0
- package/dist/generated/guards.generated.cjs.map +1 -1
- package/dist/generated/guards.generated.d.cts +1 -1
- package/dist/generated/guards.generated.d.ts +1 -1
- package/dist/generated/guards.generated.js +5 -0
- package/dist/generated/guards.generated.js.map +1 -1
- package/dist/generated/operations.generated.cjs +56 -1
- package/dist/generated/operations.generated.cjs.map +1 -1
- package/dist/generated/operations.generated.d.cts +155 -2
- package/dist/generated/operations.generated.d.ts +155 -2
- package/dist/generated/operations.generated.js +56 -1
- package/dist/generated/operations.generated.js.map +1 -1
- package/dist/{guards.generated-M3VAIevI.d.cts → guards.generated-CDCgYGZo.d.cts} +8 -3
- package/dist/{guards.generated-BPLFwe7y.d.ts → guards.generated-CdYcs4h0.d.ts} +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/authoring/FlowBuilderCore.ts +4 -1
- package/src/examples/aaveBorrow.ts +129 -0
- package/src/examples/aaveHealthFactorExplode.ts +63 -0
- package/src/examples/morphoBlueBorrow.ts +94 -0
- package/src/examples/morphoBlueRepay.ts +133 -0
- package/src/examples/run.ts +43 -0
- package/src/examples/uniswapV2AddLiquidity.ts +106 -0
- package/src/examples/uniswapV3Mint.ts +95 -0
- package/src/generated/config.generated.ts +82 -38
- package/src/generated/guards.generated.ts +9 -0
- package/src/generated/operations.generated.ts +292 -0
- package/src/index.ts +0 -3
package/README.md
CHANGED
|
@@ -472,10 +472,16 @@ Each file in `src/examples/` is a complete flow:
|
|
|
472
472
|
- **transferTokens**: transfer ERC-20 tokens from the proxy to any recipient
|
|
473
473
|
- **callContract**: call an arbitrary contract (ERC-4626 redeem, reward claim) without a typed op
|
|
474
474
|
- **flySwap**: on Base, exit a Pendle PT via `lifi.zap`, then swap all proceeds to WETH with `fly.swap`
|
|
475
|
+
- **aaveBorrow**: supply USDC to Aave v3, borrow USDC against it, and guard the health factor with `aave.getHealthFactor`
|
|
476
|
+
- **aaveHealthFactorExplode**: read the Aave v3 health factor and assert it stays above 1.0
|
|
475
477
|
- **aaveRepay**: repay Aave v3 variable debt and sweep the unspent residual to the sender
|
|
476
478
|
- **aaveRepayWithATokens**: repay Aave v3 debt by burning aTokens held by the proxy
|
|
477
479
|
- **aaveClaimRewards**: claim Aave rewards and forward them to a recipient
|
|
478
480
|
- **aaveSetEMode**: switch the proxy's Aave v3 eMode category
|
|
481
|
+
- **morphoBlueBorrow**: supply WETH collateral to a Morpho Blue market and borrow USDC
|
|
482
|
+
- **morphoBlueRepay**: open, repay and close a Morpho Blue position with `morphoBlue.repay` in `max` mode
|
|
483
|
+
- **uniswapV2AddLiquidity**: split USDC, swap half to WETH, and deposit both into the Uniswap V2 USDC/WETH pair with a `band` guard on the pool price
|
|
484
|
+
- **uniswapV3Mint**: mint a full-range Uniswap V3 USDC/WETH position with `band` and `slippage` guards
|
|
479
485
|
- **untypedOpWithTypedRef**: add a node with `untypedOp`, then use its output in typed ops via `raw.ref<T>()`
|
|
480
486
|
- **routeTokenPair**: `sdk.route(...)` with both the `exact` and `all` amount variants
|
|
481
487
|
- **supportedChains**: cache `sdk.getSupportedChains()`, then fail an unsupported chain locally with a message naming the alternatives
|
|
@@ -69,7 +69,7 @@ const createFlowBuilderCore = (chainId, options) => {
|
|
|
69
69
|
return new Proxy({}, {
|
|
70
70
|
get: (_target, prop) => {
|
|
71
71
|
if (typeof prop !== "string" || prop === "then") return void 0;
|
|
72
|
-
if (!(prop
|
|
72
|
+
if (!Object.hasOwn(outputs, prop)) {
|
|
73
73
|
throw new Error(
|
|
74
74
|
`Op "${op}" has no output port "${prop}". Valid ports: ${Object.keys(
|
|
75
75
|
outputs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/authoring/FlowBuilderCore.ts"],"sourcesContent":["import {\n type AppliedGuard,\n type BindValue,\n type Call,\n familySize,\n type Flow,\n type FlowInput,\n instancePortName,\n type Ref,\n type Resource,\n type SolType,\n} from '@lifi/compose-spec';\n\nimport type {\n InputDecl,\n InputSchema,\n OutputKind,\n TypedGuard,\n TypedLiteral,\n TypedRef,\n} from '../types.js';\n\nimport type {\n InputHandle,\n OutputHandle,\n ResourceInputHandle,\n} from './handles.js';\nimport { toBindValue } from './handles.js';\nimport { ref } from './raw.js';\n\n/**\n * Arguments for calling an operation node in a flow.\n */\nexport interface CallArgs {\n /** Maps parameter names to input/output handles or raw `$ref` pointers. */\n readonly bind: Record<string, AnyBindable>;\n /** Optional operation-specific configuration. */\n readonly config?: object;\n /** Optional guards (e.g. slippage checks) applied to this operation's outputs. */\n readonly guards?: readonly TypedGuard[];\n}\n\n/**\n * Any value that can be bound to an operation parameter: an input handle, an\n * output handle from a previous operation, a typed `$ref` pointer, a typed\n * literal, or a bare `{ $ref }` pointer.\n *\n * This is the bind type of {@link FlowBuilderInternal.call}, the entry point\n * every generated operation lowers into — not a public authoring surface. A\n * bare `Ref` belongs here because a generated op resolves its own typed binds\n * to wire refs (`toBindRef` in `./signatureArgs.js`) before calling it. Typed\n * operation slots use `Bindable<T>`, which rejects a bare `Ref`; see\n * `RefBindable` in `./handles.js`.\n *\n * Use `raw.ref<T>()` to create a typed ref from a raw path string, and\n * `raw.literal<T>()` to bake in a constant.\n */\nexport type AnyBindable =\n InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref;\n\n/**\n * Provides references to runtime context values available inside a flow.\n * Access via `builder.context`.\n */\nexport interface ContextAccessor {\n /** A `$ref` pointing to the transaction sender (signer) address. */\n readonly sender: TypedRef<'address'>;\n /** A `$ref` pointing to the on-chain execution (proxy) address. */\n readonly executionAddress: TypedRef<'address'>;\n}\n\ntype InputHandleOf<D extends InputDecl> = D extends Resource\n ? ResourceInputHandle\n : D extends SolType\n ? InputHandle<D>\n : InputHandle;\n\n/**\n * A mapped type that converts an input schema into typed handles.\n * Resource inputs produce {@link ResourceInputHandle}; scalar inputs produce {@link InputHandle}.\n *\n * @typeParam T - The flow's input schema.\n */\nexport type InputHandles<T extends InputSchema> = {\n readonly [K in keyof T]: InputHandleOf<T[K]>;\n};\n\n/**\n * Options for creating a new flow builder.\n *\n * @typeParam T - The flow's input schema.\n */\nexport interface FlowOptions<T extends InputSchema> {\n /** Optional human-readable name for the flow. Defaults to a random UUID. */\n readonly name?: string;\n /** Input declarations mapping names to resource or scalar types. */\n readonly inputs: T;\n}\n\n/**\n * A Flow document branded with its input schema for type-safe request building.\n *\n * The `__inputs` field is a phantom type — it exists only at compile time for\n * TypeScript inference and is never present at runtime.\n */\nexport type TypedFlow<T extends InputSchema = InputSchema> = Flow & {\n readonly __inputs?: T;\n};\n\n/**\n * Core flow builder interface providing low-level access to flow construction.\n *\n * For most use cases, prefer the {@link FlowBuilder} type returned by `sdk.flow()`\n * which adds generated operation methods and a `compile` method.\n *\n * @typeParam T - The flow's input schema.\n */\nexport interface FlowBuilderCore<T extends InputSchema = InputSchema> {\n /** Runtime context references (sender address, execution address). */\n readonly context: ContextAccessor;\n /** Typed handles for each declared flow input, used to bind inputs to operations. */\n readonly inputs: InputHandles<T>;\n /**\n * Appends an untyped operation node to the flow. This is an escape hatch\n * for operations not yet covered by the generated methods.\n *\n * Use `raw.ref<T>()` to reference this node's outputs in subsequent typed\n * operations.\n *\n * @param id - Unique node identifier within the flow.\n * @param op - The operation name (e.g. `\"custom.vaultQuery\"`).\n * @param args - Bind map, config, and optional guards for the node.\n * @throws Error if a node with the same `id` already exists in the flow.\n */\n readonly untypedOp: (\n id: string,\n op: string,\n args: {\n readonly bind: Record<string, BindValue>;\n readonly config: Record<string, unknown>;\n readonly guards?: readonly AppliedGuard[];\n },\n ) => void;\n /** Serialises the builder state into a {@link TypedFlow} document. */\n readonly build: () => TypedFlow<T>;\n}\n\n/** Maps output port names to their output kind for compile-time and runtime validation. */\nexport type OutputSpec = Record<string, OutputKind>;\n\n/**\n * Maps each output family's port name to the config key that sizes it: an\n * array (one instance per element) or a non-negative integer count.\n * A family port is also listed in the {@link OutputSpec}, as `'resource'`.\n */\nexport type FamilySpec = Readonly<Record<string, string>>;\n\n/** The handles `call` returns for an {@link OutputSpec} and its families. */\nexport type OutputHandles<O extends OutputSpec, F extends FamilySpec> = {\n readonly [K in keyof O & string]: K extends keyof F\n ? readonly OutputHandle<'resource'>[]\n : OutputHandle<O[K]>;\n};\n\n/** Internal interface exposed to bindGeneratedOps — not part of the public API. */\nexport interface FlowBuilderInternal<\n T extends InputSchema = InputSchema,\n> extends FlowBuilderCore<T> {\n readonly call: <\n O extends OutputSpec,\n F extends FamilySpec = Record<never, string>,\n >(\n nodeId: string,\n op: string,\n args: CallArgs,\n outputs: O,\n families?: F,\n ) => OutputHandles<O, F>;\n}\n\nconst isResource = (decl: InputDecl): decl is Resource =>\n typeof decl === 'object' && decl !== null && 'kind' in decl;\n\n/**\n * Creates a new flow builder targeting the given chain.\n *\n * @param chainId - The EVM chain ID (e.g. `1` for Ethereum mainnet).\n * @param options - Flow configuration including input declarations.\n * @returns A {@link FlowBuilderInternal} instance.\n * @internal\n */\nexport const createFlowBuilderCore = <T extends InputSchema>(\n chainId: number,\n options: FlowOptions<T>,\n): FlowBuilderInternal<T> => {\n const id = options.name ?? crypto.randomUUID();\n const flowInputs: FlowInput[] = [];\n const nodes: Call[] = [];\n const nodeIds = new Set<string>();\n\n const inputHandles = {} as Record<string, InputHandle | ResourceInputHandle>;\n for (const [name, decl] of Object.entries(options.inputs)) {\n if (isResource(decl)) {\n if (decl.chainId !== chainId) {\n throw new Error(\n `Input \"${name}\" has chainId ${decl.chainId} but flow targets chain ${chainId}`,\n );\n }\n flowInputs.push({ name, resource: decl });\n inputHandles[name] = { _tag: 'input', inputName: name, resource: decl };\n } else {\n flowInputs.push({ name, type: decl });\n inputHandles[name] = { _tag: 'input', inputName: name };\n }\n }\n\n const call = <\n O extends OutputSpec,\n F extends FamilySpec = Record<never, string>,\n >(\n nodeId: string,\n op: string,\n args: CallArgs,\n outputs: O,\n families?: F,\n ): OutputHandles<O, F> => {\n if (nodeIds.has(nodeId)) throw new Error(`Duplicate node id: \"${nodeId}\"`);\n nodeIds.add(nodeId);\n\n const bind: Record<string, BindValue> = {};\n for (const [key, val] of Object.entries(args.bind)) {\n bind[key] = toBindValue(val);\n }\n\n const config = (args.config ?? {}) as Record<string, unknown>;\n const node: Call = {\n id: nodeId,\n op,\n bind,\n config,\n ...(args.guards && args.guards.length > 0 && { guards: args.guards }),\n };\n nodes.push(node);\n\n const outputHandle = (portName: string): OutputHandle => ({\n _tag: 'output',\n nodeId,\n portName,\n });\n return new Proxy({} as OutputHandles<O, F>, {\n get: (\n _target,\n prop,\n ): OutputHandle | readonly OutputHandle[] | undefined => {\n if (typeof prop !== 'string' || prop === 'then') return undefined;\n if (!(prop in outputs)) {\n throw new Error(\n `Op \"${op}\" has no output port \"${prop}\". Valid ports: ${Object.keys(\n outputs,\n ).join(', ')}`,\n );\n }\n const countFrom = families?.[prop];\n if (countFrom === undefined) return outputHandle(prop);\n const size = familySize({ name: prop, countFrom }, config);\n return Array.from({ length: size }, (_, index) =>\n outputHandle(instancePortName(prop, index)),\n );\n },\n });\n };\n\n const untypedOp = (\n nodeId: string,\n op: string,\n args: {\n readonly bind: Record<string, BindValue>;\n readonly config: Record<string, unknown>;\n readonly guards?: readonly AppliedGuard[];\n },\n ): void => {\n if (nodeIds.has(nodeId)) throw new Error(`Duplicate node id: \"${nodeId}\"`);\n nodeIds.add(nodeId);\n const node: Call = {\n id: nodeId,\n op,\n bind: args.bind,\n config: args.config,\n ...(args.guards && args.guards.length > 0 && { guards: args.guards }),\n };\n nodes.push(node);\n };\n\n const build = (): TypedFlow<T> => ({\n version: 1,\n id,\n chainId,\n inputs: [...flowInputs],\n nodes: [...nodes],\n });\n\n const context: ContextAccessor = {\n sender: ref<'address'>('context.sender'),\n executionAddress: ref<'address'>('context.executionAddress'),\n };\n\n return {\n context,\n inputs: inputHandles as InputHandles<T>,\n call,\n untypedOp,\n build,\n };\n};\n"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/authoring/FlowBuilderCore.ts"],"sourcesContent":["import {\n type AppliedGuard,\n type BindValue,\n type Call,\n familySize,\n type Flow,\n type FlowInput,\n instancePortName,\n type Ref,\n type Resource,\n type SolType,\n} from '@lifi/compose-spec';\n\nimport type {\n InputDecl,\n InputSchema,\n OutputKind,\n TypedGuard,\n TypedLiteral,\n TypedRef,\n} from '../types.js';\n\nimport type {\n InputHandle,\n OutputHandle,\n ResourceInputHandle,\n} from './handles.js';\nimport { toBindValue } from './handles.js';\nimport { ref } from './raw.js';\n\n/**\n * Arguments for calling an operation node in a flow.\n */\nexport interface CallArgs {\n /** Maps parameter names to input/output handles or raw `$ref` pointers. */\n readonly bind: Record<string, AnyBindable>;\n /** Optional operation-specific configuration. */\n readonly config?: object;\n /** Optional guards (e.g. slippage checks) applied to this operation's outputs. */\n readonly guards?: readonly TypedGuard[];\n}\n\n/**\n * Any value that can be bound to an operation parameter: an input handle, an\n * output handle from a previous operation, a typed `$ref` pointer, a typed\n * literal, or a bare `{ $ref }` pointer.\n *\n * This is the bind type of {@link FlowBuilderInternal.call}, the entry point\n * every generated operation lowers into — not a public authoring surface. A\n * bare `Ref` belongs here because a generated op resolves its own typed binds\n * to wire refs (`toBindRef` in `./signatureArgs.js`) before calling it. Typed\n * operation slots use `Bindable<T>`, which rejects a bare `Ref`; see\n * `RefBindable` in `./handles.js`.\n *\n * Use `raw.ref<T>()` to create a typed ref from a raw path string, and\n * `raw.literal<T>()` to bake in a constant.\n */\nexport type AnyBindable =\n InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref;\n\n/**\n * Provides references to runtime context values available inside a flow.\n * Access via `builder.context`.\n */\nexport interface ContextAccessor {\n /** A `$ref` pointing to the transaction sender (signer) address. */\n readonly sender: TypedRef<'address'>;\n /** A `$ref` pointing to the on-chain execution (proxy) address. */\n readonly executionAddress: TypedRef<'address'>;\n}\n\ntype InputHandleOf<D extends InputDecl> = D extends Resource\n ? ResourceInputHandle\n : D extends SolType\n ? InputHandle<D>\n : InputHandle;\n\n/**\n * A mapped type that converts an input schema into typed handles.\n * Resource inputs produce {@link ResourceInputHandle}; scalar inputs produce {@link InputHandle}.\n *\n * @typeParam T - The flow's input schema.\n */\nexport type InputHandles<T extends InputSchema> = {\n readonly [K in keyof T]: InputHandleOf<T[K]>;\n};\n\n/**\n * Options for creating a new flow builder.\n *\n * @typeParam T - The flow's input schema.\n */\nexport interface FlowOptions<T extends InputSchema> {\n /** Optional human-readable name for the flow. Defaults to a random UUID. */\n readonly name?: string;\n /** Input declarations mapping names to resource or scalar types. */\n readonly inputs: T;\n}\n\n/**\n * A Flow document branded with its input schema for type-safe request building.\n *\n * The `__inputs` field is a phantom type — it exists only at compile time for\n * TypeScript inference and is never present at runtime.\n */\nexport type TypedFlow<T extends InputSchema = InputSchema> = Flow & {\n readonly __inputs?: T;\n};\n\n/**\n * Core flow builder interface providing low-level access to flow construction.\n *\n * For most use cases, prefer the {@link FlowBuilder} type returned by `sdk.flow()`\n * which adds generated operation methods and a `compile` method.\n *\n * @typeParam T - The flow's input schema.\n */\nexport interface FlowBuilderCore<T extends InputSchema = InputSchema> {\n /** Runtime context references (sender address, execution address). */\n readonly context: ContextAccessor;\n /** Typed handles for each declared flow input, used to bind inputs to operations. */\n readonly inputs: InputHandles<T>;\n /**\n * Appends an untyped operation node to the flow. This is an escape hatch\n * for operations not yet covered by the generated methods.\n *\n * Use `raw.ref<T>()` to reference this node's outputs in subsequent typed\n * operations.\n *\n * @param id - Unique node identifier within the flow.\n * @param op - The operation name (e.g. `\"custom.vaultQuery\"`).\n * @param args - Bind map, config, and optional guards for the node.\n * @throws Error if a node with the same `id` already exists in the flow.\n */\n readonly untypedOp: (\n id: string,\n op: string,\n args: {\n readonly bind: Record<string, BindValue>;\n readonly config: Record<string, unknown>;\n readonly guards?: readonly AppliedGuard[];\n },\n ) => void;\n /** Serialises the builder state into a {@link TypedFlow} document. */\n readonly build: () => TypedFlow<T>;\n}\n\n/** Maps output port names to their output kind for compile-time and runtime validation. */\nexport type OutputSpec = Record<string, OutputKind>;\n\n/**\n * Maps each output family's port name to the config key that sizes it: an\n * array (one instance per element) or a non-negative integer count.\n * A family port is also listed in the {@link OutputSpec}, as `'resource'`.\n */\nexport type FamilySpec = Readonly<Record<string, string>>;\n\n/** The handles `call` returns for an {@link OutputSpec} and its families. */\nexport type OutputHandles<O extends OutputSpec, F extends FamilySpec> = {\n readonly [K in keyof O & string]: K extends keyof F\n ? readonly OutputHandle<'resource'>[]\n : OutputHandle<O[K]>;\n};\n\n/** Internal interface exposed to bindGeneratedOps — not part of the public API. */\nexport interface FlowBuilderInternal<\n T extends InputSchema = InputSchema,\n> extends FlowBuilderCore<T> {\n readonly call: <\n O extends OutputSpec,\n F extends FamilySpec = Record<never, string>,\n >(\n nodeId: string,\n op: string,\n args: CallArgs,\n outputs: O,\n families?: F,\n ) => OutputHandles<O, F>;\n}\n\nconst isResource = (decl: InputDecl): decl is Resource =>\n typeof decl === 'object' && decl !== null && 'kind' in decl;\n\n/**\n * Creates a new flow builder targeting the given chain.\n *\n * @param chainId - The EVM chain ID (e.g. `1` for Ethereum mainnet).\n * @param options - Flow configuration including input declarations.\n * @returns A {@link FlowBuilderInternal} instance.\n * @internal\n */\nexport const createFlowBuilderCore = <T extends InputSchema>(\n chainId: number,\n options: FlowOptions<T>,\n): FlowBuilderInternal<T> => {\n const id = options.name ?? crypto.randomUUID();\n const flowInputs: FlowInput[] = [];\n const nodes: Call[] = [];\n const nodeIds = new Set<string>();\n\n const inputHandles = {} as Record<string, InputHandle | ResourceInputHandle>;\n for (const [name, decl] of Object.entries(options.inputs)) {\n if (isResource(decl)) {\n if (decl.chainId !== chainId) {\n throw new Error(\n `Input \"${name}\" has chainId ${decl.chainId} but flow targets chain ${chainId}`,\n );\n }\n flowInputs.push({ name, resource: decl });\n inputHandles[name] = { _tag: 'input', inputName: name, resource: decl };\n } else {\n flowInputs.push({ name, type: decl });\n inputHandles[name] = { _tag: 'input', inputName: name };\n }\n }\n\n const call = <\n O extends OutputSpec,\n F extends FamilySpec = Record<never, string>,\n >(\n nodeId: string,\n op: string,\n args: CallArgs,\n outputs: O,\n families?: F,\n ): OutputHandles<O, F> => {\n if (nodeIds.has(nodeId)) throw new Error(`Duplicate node id: \"${nodeId}\"`);\n nodeIds.add(nodeId);\n\n const bind: Record<string, BindValue> = {};\n for (const [key, val] of Object.entries(args.bind)) {\n bind[key] = toBindValue(val);\n }\n\n const config = (args.config ?? {}) as Record<string, unknown>;\n const node: Call = {\n id: nodeId,\n op,\n bind,\n config,\n ...(args.guards && args.guards.length > 0 && { guards: args.guards }),\n };\n nodes.push(node);\n\n const outputHandle = (portName: string): OutputHandle => ({\n _tag: 'output',\n nodeId,\n portName,\n });\n return new Proxy({} as OutputHandles<O, F>, {\n get: (\n _target,\n prop,\n ): OutputHandle | readonly OutputHandle[] | undefined => {\n if (typeof prop !== 'string' || prop === 'then') return undefined;\n // Own-key only: the trap sees every property a consumer reads, so `in`\n // would answer a handle for `toString` or `constructor` instead of the\n // unknown-port error.\n if (!Object.hasOwn(outputs, prop)) {\n throw new Error(\n `Op \"${op}\" has no output port \"${prop}\". Valid ports: ${Object.keys(\n outputs,\n ).join(', ')}`,\n );\n }\n const countFrom = families?.[prop];\n if (countFrom === undefined) return outputHandle(prop);\n const size = familySize({ name: prop, countFrom }, config);\n return Array.from({ length: size }, (_, index) =>\n outputHandle(instancePortName(prop, index)),\n );\n },\n });\n };\n\n const untypedOp = (\n nodeId: string,\n op: string,\n args: {\n readonly bind: Record<string, BindValue>;\n readonly config: Record<string, unknown>;\n readonly guards?: readonly AppliedGuard[];\n },\n ): void => {\n if (nodeIds.has(nodeId)) throw new Error(`Duplicate node id: \"${nodeId}\"`);\n nodeIds.add(nodeId);\n const node: Call = {\n id: nodeId,\n op,\n bind: args.bind,\n config: args.config,\n ...(args.guards && args.guards.length > 0 && { guards: args.guards }),\n };\n nodes.push(node);\n };\n\n const build = (): TypedFlow<T> => ({\n version: 1,\n id,\n chainId,\n inputs: [...flowInputs],\n nodes: [...nodes],\n });\n\n const context: ContextAccessor = {\n sender: ref<'address'>('context.sender'),\n executionAddress: ref<'address'>('context.executionAddress'),\n };\n\n return {\n context,\n inputs: inputHandles as InputHandles<T>,\n call,\n untypedOp,\n build,\n };\n};\n"],"mappings":"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","names":[]}
|
|
@@ -49,7 +49,7 @@ const createFlowBuilderCore = (chainId, options) => {
|
|
|
49
49
|
return new Proxy({}, {
|
|
50
50
|
get: (_target, prop) => {
|
|
51
51
|
if (typeof prop !== "string" || prop === "then") return void 0;
|
|
52
|
-
if (!(prop
|
|
52
|
+
if (!Object.hasOwn(outputs, prop)) {
|
|
53
53
|
throw new Error(
|
|
54
54
|
`Op "${op}" has no output port "${prop}". Valid ports: ${Object.keys(
|
|
55
55
|
outputs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/authoring/FlowBuilderCore.ts"],"sourcesContent":["import {\n type AppliedGuard,\n type BindValue,\n type Call,\n familySize,\n type Flow,\n type FlowInput,\n instancePortName,\n type Ref,\n type Resource,\n type SolType,\n} from '@lifi/compose-spec';\n\nimport type {\n InputDecl,\n InputSchema,\n OutputKind,\n TypedGuard,\n TypedLiteral,\n TypedRef,\n} from '../types.js';\n\nimport type {\n InputHandle,\n OutputHandle,\n ResourceInputHandle,\n} from './handles.js';\nimport { toBindValue } from './handles.js';\nimport { ref } from './raw.js';\n\n/**\n * Arguments for calling an operation node in a flow.\n */\nexport interface CallArgs {\n /** Maps parameter names to input/output handles or raw `$ref` pointers. */\n readonly bind: Record<string, AnyBindable>;\n /** Optional operation-specific configuration. */\n readonly config?: object;\n /** Optional guards (e.g. slippage checks) applied to this operation's outputs. */\n readonly guards?: readonly TypedGuard[];\n}\n\n/**\n * Any value that can be bound to an operation parameter: an input handle, an\n * output handle from a previous operation, a typed `$ref` pointer, a typed\n * literal, or a bare `{ $ref }` pointer.\n *\n * This is the bind type of {@link FlowBuilderInternal.call}, the entry point\n * every generated operation lowers into — not a public authoring surface. A\n * bare `Ref` belongs here because a generated op resolves its own typed binds\n * to wire refs (`toBindRef` in `./signatureArgs.js`) before calling it. Typed\n * operation slots use `Bindable<T>`, which rejects a bare `Ref`; see\n * `RefBindable` in `./handles.js`.\n *\n * Use `raw.ref<T>()` to create a typed ref from a raw path string, and\n * `raw.literal<T>()` to bake in a constant.\n */\nexport type AnyBindable =\n InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref;\n\n/**\n * Provides references to runtime context values available inside a flow.\n * Access via `builder.context`.\n */\nexport interface ContextAccessor {\n /** A `$ref` pointing to the transaction sender (signer) address. */\n readonly sender: TypedRef<'address'>;\n /** A `$ref` pointing to the on-chain execution (proxy) address. */\n readonly executionAddress: TypedRef<'address'>;\n}\n\ntype InputHandleOf<D extends InputDecl> = D extends Resource\n ? ResourceInputHandle\n : D extends SolType\n ? InputHandle<D>\n : InputHandle;\n\n/**\n * A mapped type that converts an input schema into typed handles.\n * Resource inputs produce {@link ResourceInputHandle}; scalar inputs produce {@link InputHandle}.\n *\n * @typeParam T - The flow's input schema.\n */\nexport type InputHandles<T extends InputSchema> = {\n readonly [K in keyof T]: InputHandleOf<T[K]>;\n};\n\n/**\n * Options for creating a new flow builder.\n *\n * @typeParam T - The flow's input schema.\n */\nexport interface FlowOptions<T extends InputSchema> {\n /** Optional human-readable name for the flow. Defaults to a random UUID. */\n readonly name?: string;\n /** Input declarations mapping names to resource or scalar types. */\n readonly inputs: T;\n}\n\n/**\n * A Flow document branded with its input schema for type-safe request building.\n *\n * The `__inputs` field is a phantom type — it exists only at compile time for\n * TypeScript inference and is never present at runtime.\n */\nexport type TypedFlow<T extends InputSchema = InputSchema> = Flow & {\n readonly __inputs?: T;\n};\n\n/**\n * Core flow builder interface providing low-level access to flow construction.\n *\n * For most use cases, prefer the {@link FlowBuilder} type returned by `sdk.flow()`\n * which adds generated operation methods and a `compile` method.\n *\n * @typeParam T - The flow's input schema.\n */\nexport interface FlowBuilderCore<T extends InputSchema = InputSchema> {\n /** Runtime context references (sender address, execution address). */\n readonly context: ContextAccessor;\n /** Typed handles for each declared flow input, used to bind inputs to operations. */\n readonly inputs: InputHandles<T>;\n /**\n * Appends an untyped operation node to the flow. This is an escape hatch\n * for operations not yet covered by the generated methods.\n *\n * Use `raw.ref<T>()` to reference this node's outputs in subsequent typed\n * operations.\n *\n * @param id - Unique node identifier within the flow.\n * @param op - The operation name (e.g. `\"custom.vaultQuery\"`).\n * @param args - Bind map, config, and optional guards for the node.\n * @throws Error if a node with the same `id` already exists in the flow.\n */\n readonly untypedOp: (\n id: string,\n op: string,\n args: {\n readonly bind: Record<string, BindValue>;\n readonly config: Record<string, unknown>;\n readonly guards?: readonly AppliedGuard[];\n },\n ) => void;\n /** Serialises the builder state into a {@link TypedFlow} document. */\n readonly build: () => TypedFlow<T>;\n}\n\n/** Maps output port names to their output kind for compile-time and runtime validation. */\nexport type OutputSpec = Record<string, OutputKind>;\n\n/**\n * Maps each output family's port name to the config key that sizes it: an\n * array (one instance per element) or a non-negative integer count.\n * A family port is also listed in the {@link OutputSpec}, as `'resource'`.\n */\nexport type FamilySpec = Readonly<Record<string, string>>;\n\n/** The handles `call` returns for an {@link OutputSpec} and its families. */\nexport type OutputHandles<O extends OutputSpec, F extends FamilySpec> = {\n readonly [K in keyof O & string]: K extends keyof F\n ? readonly OutputHandle<'resource'>[]\n : OutputHandle<O[K]>;\n};\n\n/** Internal interface exposed to bindGeneratedOps — not part of the public API. */\nexport interface FlowBuilderInternal<\n T extends InputSchema = InputSchema,\n> extends FlowBuilderCore<T> {\n readonly call: <\n O extends OutputSpec,\n F extends FamilySpec = Record<never, string>,\n >(\n nodeId: string,\n op: string,\n args: CallArgs,\n outputs: O,\n families?: F,\n ) => OutputHandles<O, F>;\n}\n\nconst isResource = (decl: InputDecl): decl is Resource =>\n typeof decl === 'object' && decl !== null && 'kind' in decl;\n\n/**\n * Creates a new flow builder targeting the given chain.\n *\n * @param chainId - The EVM chain ID (e.g. `1` for Ethereum mainnet).\n * @param options - Flow configuration including input declarations.\n * @returns A {@link FlowBuilderInternal} instance.\n * @internal\n */\nexport const createFlowBuilderCore = <T extends InputSchema>(\n chainId: number,\n options: FlowOptions<T>,\n): FlowBuilderInternal<T> => {\n const id = options.name ?? crypto.randomUUID();\n const flowInputs: FlowInput[] = [];\n const nodes: Call[] = [];\n const nodeIds = new Set<string>();\n\n const inputHandles = {} as Record<string, InputHandle | ResourceInputHandle>;\n for (const [name, decl] of Object.entries(options.inputs)) {\n if (isResource(decl)) {\n if (decl.chainId !== chainId) {\n throw new Error(\n `Input \"${name}\" has chainId ${decl.chainId} but flow targets chain ${chainId}`,\n );\n }\n flowInputs.push({ name, resource: decl });\n inputHandles[name] = { _tag: 'input', inputName: name, resource: decl };\n } else {\n flowInputs.push({ name, type: decl });\n inputHandles[name] = { _tag: 'input', inputName: name };\n }\n }\n\n const call = <\n O extends OutputSpec,\n F extends FamilySpec = Record<never, string>,\n >(\n nodeId: string,\n op: string,\n args: CallArgs,\n outputs: O,\n families?: F,\n ): OutputHandles<O, F> => {\n if (nodeIds.has(nodeId)) throw new Error(`Duplicate node id: \"${nodeId}\"`);\n nodeIds.add(nodeId);\n\n const bind: Record<string, BindValue> = {};\n for (const [key, val] of Object.entries(args.bind)) {\n bind[key] = toBindValue(val);\n }\n\n const config = (args.config ?? {}) as Record<string, unknown>;\n const node: Call = {\n id: nodeId,\n op,\n bind,\n config,\n ...(args.guards && args.guards.length > 0 && { guards: args.guards }),\n };\n nodes.push(node);\n\n const outputHandle = (portName: string): OutputHandle => ({\n _tag: 'output',\n nodeId,\n portName,\n });\n return new Proxy({} as OutputHandles<O, F>, {\n get: (\n _target,\n prop,\n ): OutputHandle | readonly OutputHandle[] | undefined => {\n if (typeof prop !== 'string' || prop === 'then') return undefined;\n if (!(prop in outputs)) {\n throw new Error(\n `Op \"${op}\" has no output port \"${prop}\". Valid ports: ${Object.keys(\n outputs,\n ).join(', ')}`,\n );\n }\n const countFrom = families?.[prop];\n if (countFrom === undefined) return outputHandle(prop);\n const size = familySize({ name: prop, countFrom }, config);\n return Array.from({ length: size }, (_, index) =>\n outputHandle(instancePortName(prop, index)),\n );\n },\n });\n };\n\n const untypedOp = (\n nodeId: string,\n op: string,\n args: {\n readonly bind: Record<string, BindValue>;\n readonly config: Record<string, unknown>;\n readonly guards?: readonly AppliedGuard[];\n },\n ): void => {\n if (nodeIds.has(nodeId)) throw new Error(`Duplicate node id: \"${nodeId}\"`);\n nodeIds.add(nodeId);\n const node: Call = {\n id: nodeId,\n op,\n bind: args.bind,\n config: args.config,\n ...(args.guards && args.guards.length > 0 && { guards: args.guards }),\n };\n nodes.push(node);\n };\n\n const build = (): TypedFlow<T> => ({\n version: 1,\n id,\n chainId,\n inputs: [...flowInputs],\n nodes: [...nodes],\n });\n\n const context: ContextAccessor = {\n sender: ref<'address'>('context.sender'),\n executionAddress: ref<'address'>('context.executionAddress'),\n };\n\n return {\n context,\n inputs: inputHandles as InputHandles<T>,\n call,\n untypedOp,\n build,\n };\n};\n"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/authoring/FlowBuilderCore.ts"],"sourcesContent":["import {\n type AppliedGuard,\n type BindValue,\n type Call,\n familySize,\n type Flow,\n type FlowInput,\n instancePortName,\n type Ref,\n type Resource,\n type SolType,\n} from '@lifi/compose-spec';\n\nimport type {\n InputDecl,\n InputSchema,\n OutputKind,\n TypedGuard,\n TypedLiteral,\n TypedRef,\n} from '../types.js';\n\nimport type {\n InputHandle,\n OutputHandle,\n ResourceInputHandle,\n} from './handles.js';\nimport { toBindValue } from './handles.js';\nimport { ref } from './raw.js';\n\n/**\n * Arguments for calling an operation node in a flow.\n */\nexport interface CallArgs {\n /** Maps parameter names to input/output handles or raw `$ref` pointers. */\n readonly bind: Record<string, AnyBindable>;\n /** Optional operation-specific configuration. */\n readonly config?: object;\n /** Optional guards (e.g. slippage checks) applied to this operation's outputs. */\n readonly guards?: readonly TypedGuard[];\n}\n\n/**\n * Any value that can be bound to an operation parameter: an input handle, an\n * output handle from a previous operation, a typed `$ref` pointer, a typed\n * literal, or a bare `{ $ref }` pointer.\n *\n * This is the bind type of {@link FlowBuilderInternal.call}, the entry point\n * every generated operation lowers into — not a public authoring surface. A\n * bare `Ref` belongs here because a generated op resolves its own typed binds\n * to wire refs (`toBindRef` in `./signatureArgs.js`) before calling it. Typed\n * operation slots use `Bindable<T>`, which rejects a bare `Ref`; see\n * `RefBindable` in `./handles.js`.\n *\n * Use `raw.ref<T>()` to create a typed ref from a raw path string, and\n * `raw.literal<T>()` to bake in a constant.\n */\nexport type AnyBindable =\n InputHandle | OutputHandle | TypedRef | TypedLiteral | Ref;\n\n/**\n * Provides references to runtime context values available inside a flow.\n * Access via `builder.context`.\n */\nexport interface ContextAccessor {\n /** A `$ref` pointing to the transaction sender (signer) address. */\n readonly sender: TypedRef<'address'>;\n /** A `$ref` pointing to the on-chain execution (proxy) address. */\n readonly executionAddress: TypedRef<'address'>;\n}\n\ntype InputHandleOf<D extends InputDecl> = D extends Resource\n ? ResourceInputHandle\n : D extends SolType\n ? InputHandle<D>\n : InputHandle;\n\n/**\n * A mapped type that converts an input schema into typed handles.\n * Resource inputs produce {@link ResourceInputHandle}; scalar inputs produce {@link InputHandle}.\n *\n * @typeParam T - The flow's input schema.\n */\nexport type InputHandles<T extends InputSchema> = {\n readonly [K in keyof T]: InputHandleOf<T[K]>;\n};\n\n/**\n * Options for creating a new flow builder.\n *\n * @typeParam T - The flow's input schema.\n */\nexport interface FlowOptions<T extends InputSchema> {\n /** Optional human-readable name for the flow. Defaults to a random UUID. */\n readonly name?: string;\n /** Input declarations mapping names to resource or scalar types. */\n readonly inputs: T;\n}\n\n/**\n * A Flow document branded with its input schema for type-safe request building.\n *\n * The `__inputs` field is a phantom type — it exists only at compile time for\n * TypeScript inference and is never present at runtime.\n */\nexport type TypedFlow<T extends InputSchema = InputSchema> = Flow & {\n readonly __inputs?: T;\n};\n\n/**\n * Core flow builder interface providing low-level access to flow construction.\n *\n * For most use cases, prefer the {@link FlowBuilder} type returned by `sdk.flow()`\n * which adds generated operation methods and a `compile` method.\n *\n * @typeParam T - The flow's input schema.\n */\nexport interface FlowBuilderCore<T extends InputSchema = InputSchema> {\n /** Runtime context references (sender address, execution address). */\n readonly context: ContextAccessor;\n /** Typed handles for each declared flow input, used to bind inputs to operations. */\n readonly inputs: InputHandles<T>;\n /**\n * Appends an untyped operation node to the flow. This is an escape hatch\n * for operations not yet covered by the generated methods.\n *\n * Use `raw.ref<T>()` to reference this node's outputs in subsequent typed\n * operations.\n *\n * @param id - Unique node identifier within the flow.\n * @param op - The operation name (e.g. `\"custom.vaultQuery\"`).\n * @param args - Bind map, config, and optional guards for the node.\n * @throws Error if a node with the same `id` already exists in the flow.\n */\n readonly untypedOp: (\n id: string,\n op: string,\n args: {\n readonly bind: Record<string, BindValue>;\n readonly config: Record<string, unknown>;\n readonly guards?: readonly AppliedGuard[];\n },\n ) => void;\n /** Serialises the builder state into a {@link TypedFlow} document. */\n readonly build: () => TypedFlow<T>;\n}\n\n/** Maps output port names to their output kind for compile-time and runtime validation. */\nexport type OutputSpec = Record<string, OutputKind>;\n\n/**\n * Maps each output family's port name to the config key that sizes it: an\n * array (one instance per element) or a non-negative integer count.\n * A family port is also listed in the {@link OutputSpec}, as `'resource'`.\n */\nexport type FamilySpec = Readonly<Record<string, string>>;\n\n/** The handles `call` returns for an {@link OutputSpec} and its families. */\nexport type OutputHandles<O extends OutputSpec, F extends FamilySpec> = {\n readonly [K in keyof O & string]: K extends keyof F\n ? readonly OutputHandle<'resource'>[]\n : OutputHandle<O[K]>;\n};\n\n/** Internal interface exposed to bindGeneratedOps — not part of the public API. */\nexport interface FlowBuilderInternal<\n T extends InputSchema = InputSchema,\n> extends FlowBuilderCore<T> {\n readonly call: <\n O extends OutputSpec,\n F extends FamilySpec = Record<never, string>,\n >(\n nodeId: string,\n op: string,\n args: CallArgs,\n outputs: O,\n families?: F,\n ) => OutputHandles<O, F>;\n}\n\nconst isResource = (decl: InputDecl): decl is Resource =>\n typeof decl === 'object' && decl !== null && 'kind' in decl;\n\n/**\n * Creates a new flow builder targeting the given chain.\n *\n * @param chainId - The EVM chain ID (e.g. `1` for Ethereum mainnet).\n * @param options - Flow configuration including input declarations.\n * @returns A {@link FlowBuilderInternal} instance.\n * @internal\n */\nexport const createFlowBuilderCore = <T extends InputSchema>(\n chainId: number,\n options: FlowOptions<T>,\n): FlowBuilderInternal<T> => {\n const id = options.name ?? crypto.randomUUID();\n const flowInputs: FlowInput[] = [];\n const nodes: Call[] = [];\n const nodeIds = new Set<string>();\n\n const inputHandles = {} as Record<string, InputHandle | ResourceInputHandle>;\n for (const [name, decl] of Object.entries(options.inputs)) {\n if (isResource(decl)) {\n if (decl.chainId !== chainId) {\n throw new Error(\n `Input \"${name}\" has chainId ${decl.chainId} but flow targets chain ${chainId}`,\n );\n }\n flowInputs.push({ name, resource: decl });\n inputHandles[name] = { _tag: 'input', inputName: name, resource: decl };\n } else {\n flowInputs.push({ name, type: decl });\n inputHandles[name] = { _tag: 'input', inputName: name };\n }\n }\n\n const call = <\n O extends OutputSpec,\n F extends FamilySpec = Record<never, string>,\n >(\n nodeId: string,\n op: string,\n args: CallArgs,\n outputs: O,\n families?: F,\n ): OutputHandles<O, F> => {\n if (nodeIds.has(nodeId)) throw new Error(`Duplicate node id: \"${nodeId}\"`);\n nodeIds.add(nodeId);\n\n const bind: Record<string, BindValue> = {};\n for (const [key, val] of Object.entries(args.bind)) {\n bind[key] = toBindValue(val);\n }\n\n const config = (args.config ?? {}) as Record<string, unknown>;\n const node: Call = {\n id: nodeId,\n op,\n bind,\n config,\n ...(args.guards && args.guards.length > 0 && { guards: args.guards }),\n };\n nodes.push(node);\n\n const outputHandle = (portName: string): OutputHandle => ({\n _tag: 'output',\n nodeId,\n portName,\n });\n return new Proxy({} as OutputHandles<O, F>, {\n get: (\n _target,\n prop,\n ): OutputHandle | readonly OutputHandle[] | undefined => {\n if (typeof prop !== 'string' || prop === 'then') return undefined;\n // Own-key only: the trap sees every property a consumer reads, so `in`\n // would answer a handle for `toString` or `constructor` instead of the\n // unknown-port error.\n if (!Object.hasOwn(outputs, prop)) {\n throw new Error(\n `Op \"${op}\" has no output port \"${prop}\". Valid ports: ${Object.keys(\n outputs,\n ).join(', ')}`,\n );\n }\n const countFrom = families?.[prop];\n if (countFrom === undefined) return outputHandle(prop);\n const size = familySize({ name: prop, countFrom }, config);\n return Array.from({ length: size }, (_, index) =>\n outputHandle(instancePortName(prop, index)),\n );\n },\n });\n };\n\n const untypedOp = (\n nodeId: string,\n op: string,\n args: {\n readonly bind: Record<string, BindValue>;\n readonly config: Record<string, unknown>;\n readonly guards?: readonly AppliedGuard[];\n },\n ): void => {\n if (nodeIds.has(nodeId)) throw new Error(`Duplicate node id: \"${nodeId}\"`);\n nodeIds.add(nodeId);\n const node: Call = {\n id: nodeId,\n op,\n bind: args.bind,\n config: args.config,\n ...(args.guards && args.guards.length > 0 && { guards: args.guards }),\n };\n nodes.push(node);\n };\n\n const build = (): TypedFlow<T> => ({\n version: 1,\n id,\n chainId,\n inputs: [...flowInputs],\n nodes: [...nodes],\n });\n\n const context: ContextAccessor = {\n sender: ref<'address'>('context.sender'),\n executionAddress: ref<'address'>('context.executionAddress'),\n };\n\n return {\n context,\n inputs: inputHandles as InputHandles<T>,\n call,\n untypedOp,\n build,\n };\n};\n"],"mappings":"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","names":[]}
|
package/dist/client.cjs
CHANGED
|
@@ -25,7 +25,7 @@ module.exports = __toCommonJS(client_exports);
|
|
|
25
25
|
var import_compose_spec = require("@lifi/compose-spec");
|
|
26
26
|
var import_errors = require("./errors.js");
|
|
27
27
|
var import_responseSchemas = require("./responseSchemas.js");
|
|
28
|
-
const SDK_VERSION = true ? "0.
|
|
28
|
+
const SDK_VERSION = true ? "0.8.1" : "dev";
|
|
29
29
|
const SDK_VERSION_TRIPLE = (0, import_compose_spec.parseVersion)(SDK_VERSION);
|
|
30
30
|
const bigintReplacer = (_key, value) => typeof value === "bigint" ? value.toString() : value;
|
|
31
31
|
const isNonNullObject = (v) => typeof v === "object" && v !== null;
|
package/dist/client.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
parseCompilePartialEnvelope,
|
|
10
10
|
parseSimulateResult
|
|
11
11
|
} from "./responseSchemas.js";
|
|
12
|
-
const SDK_VERSION = true ? "0.
|
|
12
|
+
const SDK_VERSION = true ? "0.8.1" : "dev";
|
|
13
13
|
const SDK_VERSION_TRIPLE = parseVersion(SDK_VERSION);
|
|
14
14
|
const bigintReplacer = (_key, value) => typeof value === "bigint" ? value.toString() : value;
|
|
15
15
|
const isNonNullObject = (v) => typeof v === "object" && v !== null;
|
|
@@ -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\n/**\n * a number between 0 and 10000\n */\nexport type Between010000 = number;\n\nexport interface CoreSplitConfig {\n bps: Between010000;\n}\n\n/**\n * an array of at most 16 item(s)\n *\n * @minItems 2\n * @maxItems 16\n */\nexport type MaxItems16 =\n | [Between19999, Between19999]\n | [Between19999, Between19999, Between19999]\n | [Between19999, Between19999, Between19999, Between19999]\n | [Between19999, Between19999, Between19999, Between19999, Between19999]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ];\n/**\n * a number between 1 and 9999\n */\nexport type Between19999 = number;\n\nexport interface CorePartitionConfig {\n bps: MaxItems16;\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\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\n/**\n * a string starting with \"0x\"\n */\nexport type StartsWith0X = string;\n/**\n * a number between 0 and 1\n */\nexport type Between01 = number;\n\nexport interface LifiBridgeConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n destination: StartsWith0X;\n slippage?: Between01;\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 bridges?: {\n allow?: MaxItems50;\n deny?: MaxItems50;\n prefer?: MaxItems50;\n };\n exchanges?: {\n allow?: MaxItems50;\n deny?: MaxItems50;\n prefer?: MaxItems50;\n };\n order?: 'FASTEST' | 'CHEAPEST';\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\n/**\n * a non-negative number\n */\nexport type NonNegative = number;\n\nexport interface CoreBpsDownConfig {\n bps: NonNegative;\n}\n\nexport interface CoreBpsUpConfig {\n bps: NonNegative;\n}\n\nexport interface CoreApproveConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n spender: Address;\n}\n\nexport interface CoreBalanceOfConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 | {\n spender: Address;\n }\n | {\n from: 'sender';\n }\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n}\n\nexport interface AaveBorrowConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n asset: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n variableDebtToken: string;\n amount: IntegerStringInput;\n referralId?: number;\n}\n\nexport type AaveRepayConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n mode: 'exact';\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n mode: 'max';\n };\n\nexport interface AaveRepayWithATokensConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n asset: string;\n}\n\nexport interface AaveClaimRewardsConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n rewardsController: string;\n assets: string[];\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n reward: string;\n amount?: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n to?: string;\n}\n\n/**\n * a number between 0 and 255\n */\nexport type Between0255 = number;\n\nexport interface AaveSetEModeConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n category: Between0255;\n}\n\nexport interface AaveGetHealthFactorConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n user?: string;\n}\n\nexport type MorphoBlueSupplyCollateralConfig =\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n mode: 'exact';\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n mode: 'all';\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueWithdrawCollateralConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueBorrowConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueRepayConfig =\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'exact';\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'max';\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueSupplyConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueWithdrawConfig =\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'exact';\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'exact';\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'max';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'max';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueGetPositionConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n user?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n user?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n };\n\nexport interface LifiFlashloanRepayConfig {\n leg: string;\n fee?: string;\n}\n\nexport type ContinuationAssertReadyConfig =\n | {\n kind: 'erc20BalanceGte';\n chainId: Positive;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n owner: Address;\n minAmount: string;\n }\n | {\n kind: 'nativeBalanceGte';\n chainId: Positive;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n owner: Address;\n minAmount: string;\n }\n | {\n kind: 'call';\n chainId: Positive;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n to: string;\n /**\n * Hex bytes: 0x followed by an even number of hex characters\n */\n calldata: string;\n comparator: 'gte' | 'eq' | 'lte';\n value: string;\n };\n\nexport interface LifiZapConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n}\n\nexport interface LifiZapAsyncConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n}\n\nexport interface ParaswapBuyConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n exactAmountOut: string;\n srcDecimals: NonNegative;\n destDecimals: NonNegative;\n maxSlippageBps?: Between010000;\n partner?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n target: Address;\n functionSignature: string;\n args?: string[];\n}\n\n/**\n * a number between 0 and 3318\n */\nexport type Between03318 = number;\n/**\n * a number between 0 and 5000\n */\nexport type Between05000 = number;\n\nexport interface FlySwapConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n inputVarianceBps?: Between03318;\n maxSlippageBps?: Between05000;\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\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\n/**\n * a number between 0 and 10000\n */\nexport type Between010000 = number;\n\nexport interface CoreSplitConfig {\n bps: Between010000;\n}\n\n/**\n * an array of at most 16 item(s)\n *\n * @minItems 2\n * @maxItems 16\n */\nexport type MaxItems16 =\n | [Between19999, Between19999]\n | [Between19999, Between19999, Between19999]\n | [Between19999, Between19999, Between19999, Between19999]\n | [Between19999, Between19999, Between19999, Between19999, Between19999]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ]\n | [\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n Between19999,\n ];\n/**\n * a number between 1 and 9999\n */\nexport type Between19999 = number;\n\nexport interface CorePartitionConfig {\n bps: MaxItems16;\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\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\n/**\n * a string starting with \"0x\"\n */\nexport type StartsWith0X = string;\n/**\n * a number between 0 and 1\n */\nexport type Between01 = number;\n\nexport interface LifiBridgeConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n destination: StartsWith0X;\n slippage?: Between01;\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 bridges?: {\n allow?: MaxItems50;\n deny?: MaxItems50;\n prefer?: MaxItems50;\n };\n exchanges?: {\n allow?: MaxItems50;\n deny?: MaxItems50;\n prefer?: MaxItems50;\n };\n order?: 'FASTEST' | 'CHEAPEST';\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\n/**\n * a non-negative number\n */\nexport type NonNegative = number;\n\nexport interface CoreBpsDownConfig {\n bps: NonNegative;\n}\n\nexport interface CoreBpsUpConfig {\n bps: NonNegative;\n}\n\nexport interface CoreApproveConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n spender: Address;\n}\n\nexport interface CoreBalanceOfConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 | {\n spender: Address;\n }\n | {\n from: 'sender';\n }\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n}\n\nexport interface AaveBorrowConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n asset: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n variableDebtToken: string;\n amount: IntegerStringInput;\n referralId?: number;\n}\n\nexport type AaveRepayConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n mode: 'exact';\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n mode: 'max';\n };\n\nexport interface AaveRepayWithATokensConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n asset: string;\n}\n\nexport interface AaveClaimRewardsConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n rewardsController: string;\n assets: string[];\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n reward: string;\n amount?: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n to?: string;\n}\n\n/**\n * a number between 0 and 255\n */\nexport type Between0255 = number;\n\nexport interface AaveSetEModeConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n category: Between0255;\n}\n\nexport interface AaveGetHealthFactorConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n user?: string;\n}\n\nexport type MorphoBlueSupplyCollateralConfig =\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n mode: 'exact';\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n mode: 'all';\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueWithdrawCollateralConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueBorrowConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueRepayConfig =\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'exact';\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'max';\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueSupplyConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n };\n\nexport type MorphoBlueWithdrawConfig =\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'exact';\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'exact';\n amount: IntegerStringInput;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n )\n | (\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'max';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n mode: 'max';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n onBehalfOf?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n receiver?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n irm: string;\n lltv: string;\n };\n }\n );\n\nexport type MorphoBlueGetPositionConfig =\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n user?: string;\n /**\n * a string matching the pattern ^0x[0-9a-fA-F]{64}$\n */\n marketId: string;\n }\n | {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n morpho?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n user?: string;\n marketParams: {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n loanToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n collateralToken: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n oracle: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n}\n\nexport interface LifiZapAsyncConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n}\n\nexport interface ParaswapBuyConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n exactAmountOut: string;\n srcDecimals: NonNegative;\n destDecimals: NonNegative;\n maxSlippageBps?: Between010000;\n partner?: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\n target: Address;\n functionSignature: string;\n args?: string[];\n}\n\n/**\n * a number between 0 and 3318\n */\nexport type Between03318 = number;\n/**\n * a number between 0 and 5000\n */\nexport type Between05000 = number;\n\nexport interface FlySwapConfig {\n resourceOut:\n | {\n kind: 'native';\n chainId: Positive;\n }\n | {\n kind: 'erc20';\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n token: Address;\n chainId: Positive;\n };\n inputVarianceBps?: Between03318;\n maxSlippageBps?: Between05000;\n}\n\nexport interface UniswapV2AddLiquidityConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n router: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n factory: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pair: string;\n}\n\nexport interface UniswapV2RemoveLiquidityConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n router: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n factory: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n tokenA: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n tokenB: string;\n}\n\n/**\n * a number between 0 and 999999\n */\nexport type Between0999999 = number;\n/**\n * a number between -887272 and 887272\n */\nexport type Between887272887272 = number;\n\nexport interface UniswapV3MintConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n positionManager: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n factory: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n fee: Between0999999;\n tickLower: Between887272887272;\n tickUpper: Between887272887272;\n}\n\nexport interface UniswapV3IncreaseLiquidityConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n positionManager: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n factory: string;\n /**\n * EVM address: 0x followed by 40 hex characters\n */\n pool: string;\n tokenId: 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 BandGuardConfig {\n port: string;\n bps: Between010000;\n}\n\nexport interface BalanceOfMaterialiserConfig {\n /**\n * EVM address: 0x followed by 40 hex characters\n */\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 /**\n * EVM address: 0x followed by 40 hex characters\n */\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":[]}
|
|
@@ -928,40 +928,6 @@ interface LifiFlashloanRepayConfig {
|
|
|
928
928
|
leg: string;
|
|
929
929
|
fee?: string;
|
|
930
930
|
}
|
|
931
|
-
type ContinuationAssertReadyConfig = {
|
|
932
|
-
kind: 'erc20BalanceGte';
|
|
933
|
-
chainId: Positive;
|
|
934
|
-
/**
|
|
935
|
-
* EVM address: 0x followed by 40 hex characters
|
|
936
|
-
*/
|
|
937
|
-
token: Address;
|
|
938
|
-
/**
|
|
939
|
-
* EVM address: 0x followed by 40 hex characters
|
|
940
|
-
*/
|
|
941
|
-
owner: Address;
|
|
942
|
-
minAmount: string;
|
|
943
|
-
} | {
|
|
944
|
-
kind: 'nativeBalanceGte';
|
|
945
|
-
chainId: Positive;
|
|
946
|
-
/**
|
|
947
|
-
* EVM address: 0x followed by 40 hex characters
|
|
948
|
-
*/
|
|
949
|
-
owner: Address;
|
|
950
|
-
minAmount: string;
|
|
951
|
-
} | {
|
|
952
|
-
kind: 'call';
|
|
953
|
-
chainId: Positive;
|
|
954
|
-
/**
|
|
955
|
-
* EVM address: 0x followed by 40 hex characters
|
|
956
|
-
*/
|
|
957
|
-
to: string;
|
|
958
|
-
/**
|
|
959
|
-
* Hex bytes: 0x followed by an even number of hex characters
|
|
960
|
-
*/
|
|
961
|
-
calldata: string;
|
|
962
|
-
comparator: 'gte' | 'eq' | 'lte';
|
|
963
|
-
value: string;
|
|
964
|
-
};
|
|
965
931
|
interface LifiZapConfig {
|
|
966
932
|
resourceOut: {
|
|
967
933
|
kind: 'native';
|
|
@@ -1045,6 +1011,78 @@ interface FlySwapConfig {
|
|
|
1045
1011
|
inputVarianceBps?: Between03318;
|
|
1046
1012
|
maxSlippageBps?: Between05000;
|
|
1047
1013
|
}
|
|
1014
|
+
interface UniswapV2AddLiquidityConfig {
|
|
1015
|
+
/**
|
|
1016
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1017
|
+
*/
|
|
1018
|
+
router: string;
|
|
1019
|
+
/**
|
|
1020
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1021
|
+
*/
|
|
1022
|
+
factory: string;
|
|
1023
|
+
/**
|
|
1024
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1025
|
+
*/
|
|
1026
|
+
pair: string;
|
|
1027
|
+
}
|
|
1028
|
+
interface UniswapV2RemoveLiquidityConfig {
|
|
1029
|
+
/**
|
|
1030
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1031
|
+
*/
|
|
1032
|
+
router: string;
|
|
1033
|
+
/**
|
|
1034
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1035
|
+
*/
|
|
1036
|
+
factory: string;
|
|
1037
|
+
/**
|
|
1038
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1039
|
+
*/
|
|
1040
|
+
tokenA: string;
|
|
1041
|
+
/**
|
|
1042
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1043
|
+
*/
|
|
1044
|
+
tokenB: string;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* a number between 0 and 999999
|
|
1048
|
+
*/
|
|
1049
|
+
type Between0999999 = number;
|
|
1050
|
+
/**
|
|
1051
|
+
* a number between -887272 and 887272
|
|
1052
|
+
*/
|
|
1053
|
+
type Between887272887272 = number;
|
|
1054
|
+
interface UniswapV3MintConfig {
|
|
1055
|
+
/**
|
|
1056
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1057
|
+
*/
|
|
1058
|
+
positionManager: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1061
|
+
*/
|
|
1062
|
+
factory: string;
|
|
1063
|
+
/**
|
|
1064
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1065
|
+
*/
|
|
1066
|
+
pool: string;
|
|
1067
|
+
fee: Between0999999;
|
|
1068
|
+
tickLower: Between887272887272;
|
|
1069
|
+
tickUpper: Between887272887272;
|
|
1070
|
+
}
|
|
1071
|
+
interface UniswapV3IncreaseLiquidityConfig {
|
|
1072
|
+
/**
|
|
1073
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1074
|
+
*/
|
|
1075
|
+
positionManager: string;
|
|
1076
|
+
/**
|
|
1077
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1078
|
+
*/
|
|
1079
|
+
factory: string;
|
|
1080
|
+
/**
|
|
1081
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1082
|
+
*/
|
|
1083
|
+
pool: string;
|
|
1084
|
+
tokenId: string;
|
|
1085
|
+
}
|
|
1048
1086
|
interface SlippageGuardConfig {
|
|
1049
1087
|
port: string;
|
|
1050
1088
|
bps: Between010000;
|
|
@@ -1054,6 +1092,10 @@ interface CoreNumericInvariantGuardConfig {
|
|
|
1054
1092
|
op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq';
|
|
1055
1093
|
threshold: IntegerStringInput;
|
|
1056
1094
|
}
|
|
1095
|
+
interface BandGuardConfig {
|
|
1096
|
+
port: string;
|
|
1097
|
+
bps: Between010000;
|
|
1098
|
+
}
|
|
1057
1099
|
interface BalanceOfMaterialiserConfig {
|
|
1058
1100
|
/**
|
|
1059
1101
|
* EVM address: 0x followed by 40 hex characters
|
|
@@ -1097,4 +1139,4 @@ interface Erc20AllowancePreconditionConfig {
|
|
|
1097
1139
|
allowance: IntegerStringInput;
|
|
1098
1140
|
}
|
|
1099
1141
|
|
|
1100
|
-
export type { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between01, Between010000, Between0255, Between03318, Between05000, Between19999,
|
|
1142
|
+
export type { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0255, Between03318, Between05000, Between0999999, Between19999, Between887272887272, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, FlySwapConfig, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, NonNegative, ParaswapBuyConfig, Positive, SlippageGuardConfig, StartsWith0X, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig };
|
|
@@ -928,40 +928,6 @@ interface LifiFlashloanRepayConfig {
|
|
|
928
928
|
leg: string;
|
|
929
929
|
fee?: string;
|
|
930
930
|
}
|
|
931
|
-
type ContinuationAssertReadyConfig = {
|
|
932
|
-
kind: 'erc20BalanceGte';
|
|
933
|
-
chainId: Positive;
|
|
934
|
-
/**
|
|
935
|
-
* EVM address: 0x followed by 40 hex characters
|
|
936
|
-
*/
|
|
937
|
-
token: Address;
|
|
938
|
-
/**
|
|
939
|
-
* EVM address: 0x followed by 40 hex characters
|
|
940
|
-
*/
|
|
941
|
-
owner: Address;
|
|
942
|
-
minAmount: string;
|
|
943
|
-
} | {
|
|
944
|
-
kind: 'nativeBalanceGte';
|
|
945
|
-
chainId: Positive;
|
|
946
|
-
/**
|
|
947
|
-
* EVM address: 0x followed by 40 hex characters
|
|
948
|
-
*/
|
|
949
|
-
owner: Address;
|
|
950
|
-
minAmount: string;
|
|
951
|
-
} | {
|
|
952
|
-
kind: 'call';
|
|
953
|
-
chainId: Positive;
|
|
954
|
-
/**
|
|
955
|
-
* EVM address: 0x followed by 40 hex characters
|
|
956
|
-
*/
|
|
957
|
-
to: string;
|
|
958
|
-
/**
|
|
959
|
-
* Hex bytes: 0x followed by an even number of hex characters
|
|
960
|
-
*/
|
|
961
|
-
calldata: string;
|
|
962
|
-
comparator: 'gte' | 'eq' | 'lte';
|
|
963
|
-
value: string;
|
|
964
|
-
};
|
|
965
931
|
interface LifiZapConfig {
|
|
966
932
|
resourceOut: {
|
|
967
933
|
kind: 'native';
|
|
@@ -1045,6 +1011,78 @@ interface FlySwapConfig {
|
|
|
1045
1011
|
inputVarianceBps?: Between03318;
|
|
1046
1012
|
maxSlippageBps?: Between05000;
|
|
1047
1013
|
}
|
|
1014
|
+
interface UniswapV2AddLiquidityConfig {
|
|
1015
|
+
/**
|
|
1016
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1017
|
+
*/
|
|
1018
|
+
router: string;
|
|
1019
|
+
/**
|
|
1020
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1021
|
+
*/
|
|
1022
|
+
factory: string;
|
|
1023
|
+
/**
|
|
1024
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1025
|
+
*/
|
|
1026
|
+
pair: string;
|
|
1027
|
+
}
|
|
1028
|
+
interface UniswapV2RemoveLiquidityConfig {
|
|
1029
|
+
/**
|
|
1030
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1031
|
+
*/
|
|
1032
|
+
router: string;
|
|
1033
|
+
/**
|
|
1034
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1035
|
+
*/
|
|
1036
|
+
factory: string;
|
|
1037
|
+
/**
|
|
1038
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1039
|
+
*/
|
|
1040
|
+
tokenA: string;
|
|
1041
|
+
/**
|
|
1042
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1043
|
+
*/
|
|
1044
|
+
tokenB: string;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* a number between 0 and 999999
|
|
1048
|
+
*/
|
|
1049
|
+
type Between0999999 = number;
|
|
1050
|
+
/**
|
|
1051
|
+
* a number between -887272 and 887272
|
|
1052
|
+
*/
|
|
1053
|
+
type Between887272887272 = number;
|
|
1054
|
+
interface UniswapV3MintConfig {
|
|
1055
|
+
/**
|
|
1056
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1057
|
+
*/
|
|
1058
|
+
positionManager: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1061
|
+
*/
|
|
1062
|
+
factory: string;
|
|
1063
|
+
/**
|
|
1064
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1065
|
+
*/
|
|
1066
|
+
pool: string;
|
|
1067
|
+
fee: Between0999999;
|
|
1068
|
+
tickLower: Between887272887272;
|
|
1069
|
+
tickUpper: Between887272887272;
|
|
1070
|
+
}
|
|
1071
|
+
interface UniswapV3IncreaseLiquidityConfig {
|
|
1072
|
+
/**
|
|
1073
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1074
|
+
*/
|
|
1075
|
+
positionManager: string;
|
|
1076
|
+
/**
|
|
1077
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1078
|
+
*/
|
|
1079
|
+
factory: string;
|
|
1080
|
+
/**
|
|
1081
|
+
* EVM address: 0x followed by 40 hex characters
|
|
1082
|
+
*/
|
|
1083
|
+
pool: string;
|
|
1084
|
+
tokenId: string;
|
|
1085
|
+
}
|
|
1048
1086
|
interface SlippageGuardConfig {
|
|
1049
1087
|
port: string;
|
|
1050
1088
|
bps: Between010000;
|
|
@@ -1054,6 +1092,10 @@ interface CoreNumericInvariantGuardConfig {
|
|
|
1054
1092
|
op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq';
|
|
1055
1093
|
threshold: IntegerStringInput;
|
|
1056
1094
|
}
|
|
1095
|
+
interface BandGuardConfig {
|
|
1096
|
+
port: string;
|
|
1097
|
+
bps: Between010000;
|
|
1098
|
+
}
|
|
1057
1099
|
interface BalanceOfMaterialiserConfig {
|
|
1058
1100
|
/**
|
|
1059
1101
|
* EVM address: 0x followed by 40 hex characters
|
|
@@ -1097,4 +1139,4 @@ interface Erc20AllowancePreconditionConfig {
|
|
|
1097
1139
|
allowance: IntegerStringInput;
|
|
1098
1140
|
}
|
|
1099
1141
|
|
|
1100
|
-
export type { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between01, Between010000, Between0255, Between03318, Between05000, Between19999,
|
|
1142
|
+
export type { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0255, Between03318, Between05000, Between0999999, Between19999, Between887272887272, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, FlySwapConfig, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, NonNegative, ParaswapBuyConfig, Positive, SlippageGuardConfig, StartsWith0X, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig };
|