// AUTO-GENERATED from manifest.json — do not edit by hand.
// Regenerate with: yarn generate:composer-sdk

import type { FlowBuilderInternal } from '../authoring/FlowBuilderCore.js';
import type {
  Bindable,
  FamilyCount,
  FamilySource,
  OutputFamilyHandles,
  OutputHandle,
} from '../authoring/handles.js';
import type {
  CoreCallResult,
  SignatureBind,
  StaticCallResult,
} from '../authoring/signatureArgs.js';
import {
  buildCallWireFormat,
  buildStaticCallWireFormat,
} from '../authoring/signatureArgs.js';
import type { TypedGuard } from '../types.js';

import type {
  AaveBorrowConfig,
  AaveClaimRewardsConfig,
  AaveGetHealthFactorConfig,
  AaveRepayConfig,
  AaveRepayWithATokensConfig,
  AaveSetEModeConfig,
  AaveV4BorrowConfig,
  AaveV4GetHealthFactorConfig,
  AaveV4RepayConfig,
  AaveV4SetUsingAsCollateralConfig,
  AaveV4SupplyCollateralConfig,
  AaveV4SupplyConfig,
  AaveV4WithdrawConfig,
  ContinuationSettleConfig,
  CoreApproveConfig,
  CoreAsResourceConfig,
  CoreBalanceOfConfig,
  CoreBpsDownConfig,
  CoreBpsUpConfig,
  CoreCallConfig,
  CoreEmitEvent1Config,
  CoreEmitEvent2Config,
  CoreEmitEvent3Config,
  CoreEmitEvent4Config,
  CorePartitionConfig,
  CorePeekConfig,
  CoreRawCallConfig,
  CoreSplitAtConfig,
  CoreSplitConfig,
  CoreStaticCallConfig,
  CoreTransferConfig,
  FlySwapConfig,
  InvariantEqConfig,
  InvariantGtConfig,
  InvariantGteConfig,
  InvariantLtConfig,
  InvariantLteConfig,
  InvariantNeqConfig,
  InvariantNumericConfig,
  InvariantNumericInRangeConfig,
  LifiBridgeConfig,
  LifiFlashloanRepayConfig,
  LifiIntentsAttestNonFillConfig,
  LifiIntentsOrderConfig,
  LifiIntentsRefundConfig,
  LifiIntentsRefundOnNonFillConfig,
  LifiSwapConfig,
  LifiZapAsyncConfig,
  LifiZapConfig,
  MorphoBlueBorrowConfig,
  MorphoBlueGetPositionConfig,
  MorphoBlueRepayConfig,
  MorphoBlueSupplyCollateralConfig,
  MorphoBlueSupplyConfig,
  MorphoBlueWithdrawCollateralConfig,
  MorphoBlueWithdrawConfig,
  ParaswapBuyConfig,
  UniswapV2AddLiquidityConfig,
  UniswapV2RemoveLiquidityConfig,
  UniswapV3IncreaseLiquidityConfig,
  UniswapV3MintConfig,
} from './config.generated.js';

/** Split a resource into two outputs by basis-point ratio. Output `a` receives `bps` of the source, rounded up, and `b` takes the remainder. */
export interface CoreSplitArgs {
  readonly bind: {
    readonly source: Bindable<'resource'>;
  };
  readonly config: CoreSplitConfig;
  readonly guards?: readonly TypedGuard<'a' | 'b'>[];
}

/** Split a resource at a fixed amount. Output `head` receives `min(source, amount)`; `tail` receives the rest, and is 0 (omitted when unspent) when the source is at or below `amount`. */
export interface CoreSplitAtArgs {
  readonly bind: {
    readonly source: Bindable<'resource'>;
  };
  readonly config: CoreSplitAtConfig;
  readonly guards?: readonly TypedGuard<'head' | 'tail'>[];
}

/** Partition a resource into one output per basis-point share. `bps` lists 2 to 16 shares summing to 10000; output `parts.i` receives share i, rounded down, and the last part takes the remainder. */
export interface CorePartitionArgs<
  TBps extends FamilySource<CorePartitionConfig['bps']> = FamilySource<
    CorePartitionConfig['bps']
  >,
> {
  readonly bind: {
    readonly source: Bindable<'resource'>;
  };
  readonly config: Omit<CorePartitionConfig, 'bps'> & {
    readonly bps: TBps &
      FamilyCount<NoInfer<TBps>, Readonly<CorePartitionConfig['bps']>>;
  };
  readonly guards?: readonly TypedGuard<`parts.${number}`>[];
}

/** Merge two same-token resources into one by addition */
export interface CoreMergeArgs {
  readonly bind: {
    readonly a: Bindable<'resource'>;
    readonly b: Bindable<'resource'>;
  };
  readonly guards?: readonly TypedGuard<'merged'>[];
}

/** Swap tokens via the LI.FI aggregator API */
export interface LifiSwapArgs {
  readonly bind: {
    readonly amountIn: Bindable<'resource'>;
  };
  readonly config: LifiSwapConfig;
  readonly guards?: readonly TypedGuard<'unspentIn'>[];
}

/** Bridge tokens to another chain via the LI.FI aggregator API */
export interface LifiBridgeArgs {
  readonly bind: {
    readonly amountIn: Bindable<'resource'>;
  };
  readonly config: LifiBridgeConfig;
  readonly guards?: readonly TypedGuard<'unspentIn'>[];
}

/** Assert that an account holds at least a minimum token balance */
export interface InvariantBalanceAtLeastArgs {
  readonly bind: {
    readonly minimumAmount: Bindable<'resource'>;
    readonly account: Bindable<'address'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert that an account holds exactly an expected token balance */
export interface InvariantBalanceEqualsArgs {
  readonly bind: {
    readonly expectedAmount: Bindable<'resource'>;
    readonly account: Bindable<'address'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert that an account holds at most a maximum token balance */
export interface InvariantBalanceAtMostArgs {
  readonly bind: {
    readonly maximumAmount: Bindable<'resource'>;
    readonly account: Bindable<'address'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert that an account's token balance is between a minimum and a maximum (inclusive) */
export interface InvariantBalanceInRangeArgs {
  readonly bind: {
    readonly minimumAmount: Bindable<'resource'>;
    readonly maximumAmount: Bindable<'uint256'>;
    readonly account: Bindable<'address'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert that a spender is permitted to move at least a minimum allowance on behalf of an owner */
export interface InvariantAllowanceAtLeastArgs {
  readonly bind: {
    readonly minimumAmount: Bindable<'resource'>;
    readonly owner: Bindable<'address'>;
    readonly spender: Bindable<'address'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert that a spender's allowance on behalf of an owner exactly equals an expected amount */
export interface InvariantAllowanceEqualsArgs {
  readonly bind: {
    readonly expectedAmount: Bindable<'resource'>;
    readonly owner: Bindable<'address'>;
    readonly spender: Bindable<'address'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert that a spender is permitted to move at most a maximum allowance on behalf of an owner */
export interface InvariantAllowanceAtMostArgs {
  readonly bind: {
    readonly maximumAmount: Bindable<'resource'>;
    readonly owner: Bindable<'address'>;
    readonly spender: Bindable<'address'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert that a spender's allowance on behalf of an owner is between a minimum and a maximum (inclusive) */
export interface InvariantAllowanceInRangeArgs {
  readonly bind: {
    readonly minimumAmount: Bindable<'resource'>;
    readonly maximumAmount: Bindable<'uint256'>;
    readonly owner: Bindable<'address'>;
    readonly spender: Bindable<'address'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a uint256 value satisfies a comparison against a constant threshold; reverts on violation */
export interface InvariantNumericArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: InvariantNumericConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert min <= value <= max against constant bounds; reverts if outside the range */
export interface InvariantNumericInRangeArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: InvariantNumericInRangeConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a uint256 value is greater than or equal to a constant threshold; reverts on violation */
export interface InvariantGteArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: InvariantGteConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a uint256 value is strictly greater than a constant threshold; reverts on violation */
export interface InvariantGtArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: InvariantGtConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a uint256 value is less than or equal to a constant threshold; reverts on violation */
export interface InvariantLteArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: InvariantLteConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a uint256 value is strictly less than a constant threshold; reverts on violation */
export interface InvariantLtArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: InvariantLtConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a uint256 value equals a constant threshold; reverts on violation */
export interface InvariantEqArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: InvariantEqConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a uint256 value does not equal a constant threshold; reverts on violation */
export interface InvariantNeqArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: InvariantNeqConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Add two unsigned integers (a + b) */
export interface CoreAddArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Subtract b from a (a - b); reverts on underflow */
export interface CoreSubtractArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Multiply two unsigned integers (a * b) */
export interface CoreMultiplyArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Divide a by b, rounding toward zero */
export interface CoreDivideDownArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Divide a by b, rounding away from zero */
export interface CoreDivideUpArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Multiply value by basis points and divide by 10000, rounding down */
export interface CoreBpsDownArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: CoreBpsDownConfig;
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Multiply value by basis points and divide by 10000, rounding up */
export interface CoreBpsUpArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
  };
  readonly config: CoreBpsUpConfig;
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Assert a == b; reverts if not equal */
export interface CoreAssertEqualArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a != b; reverts if equal */
export interface CoreAssertNotEqualArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a > b; reverts if a <= b */
export interface CoreAssertGtArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a >= b; reverts if a < b */
export interface CoreAssertGteArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a < b; reverts if a >= b */
export interface CoreAssertLtArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert a <= b; reverts if a > b */
export interface CoreAssertLteArgs {
  readonly bind: {
    readonly a: Bindable<'uint256'>;
    readonly b: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Assert min <= value <= max; reverts if value is outside the range */
export interface CoreAssertInRangeArgs {
  readonly bind: {
    readonly value: Bindable<'uint256'>;
    readonly min: Bindable<'uint256'>;
    readonly max: Bindable<'uint256'>;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Approve an ERC20 spender for the given token and amount */
export interface CoreApproveArgs {
  readonly bind: {
    readonly amount: Bindable<'resource'>;
  };
  readonly config: CoreApproveConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Read an ERC20 balance, producing a resource */
export interface CoreBalanceOfArgs {
  readonly bind: Record<string, never>;
  readonly config: CoreBalanceOfConfig;
  readonly guards?: readonly TypedGuard<'balance'>[];
}

/** Transfer the whole input resource to a recipient address. To send part of a resource, split it first with `core.split` or `core.splitAt`. */
export interface CoreTransferArgs {
  readonly bind: {
    readonly amount: Bindable<'resource'>;
    readonly recipient: Bindable<'address'>;
  };
  readonly config?: CoreTransferConfig;
  readonly guards?: readonly TypedGuard<'transferred'>[];
}

/** Emit a custom on-chain event carrying 1 32-byte payload value. The value becomes a non-indexed data word in a fixed VM log event; the signature is hashed into a discriminator word (it is NOT an indexed EVM topic). */
export interface CoreEmitEvent1Args {
  readonly bind: {
    readonly value0: Bindable<'bytes32'>;
  };
  readonly config: CoreEmitEvent1Config;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Emit a custom on-chain event carrying 2 32-byte payload values. The values become non-indexed data words in a fixed VM log event; the signature is hashed into a discriminator word (it is NOT an indexed EVM topic). */
export interface CoreEmitEvent2Args {
  readonly bind: {
    readonly value0: Bindable<'bytes32'>;
    readonly value1: Bindable<'bytes32'>;
  };
  readonly config: CoreEmitEvent2Config;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Emit a custom on-chain event carrying 3 32-byte payload values. The values become non-indexed data words in a fixed VM log event; the signature is hashed into a discriminator word (it is NOT an indexed EVM topic). */
export interface CoreEmitEvent3Args {
  readonly bind: {
    readonly value0: Bindable<'bytes32'>;
    readonly value1: Bindable<'bytes32'>;
    readonly value2: Bindable<'bytes32'>;
  };
  readonly config: CoreEmitEvent3Config;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Emit a custom on-chain event carrying 4 32-byte payload values. The values become non-indexed data words in a fixed VM log event; the signature is hashed into a discriminator word (it is NOT an indexed EVM topic). */
export interface CoreEmitEvent4Args {
  readonly bind: {
    readonly value0: Bindable<'bytes32'>;
    readonly value1: Bindable<'bytes32'>;
    readonly value2: Bindable<'bytes32'>;
    readonly value3: Bindable<'bytes32'>;
  };
  readonly config: CoreEmitEvent4Config;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Invoke a smart contract function, optionally spending a token resource */
export interface CoreCallArgs<TSig extends string = string> {
  readonly resource?: Bindable<'resource'>;
  readonly bind: SignatureBind<TSig>;
  readonly config: Omit<CoreCallConfig, 'args' | 'functionSignature'> & {
    readonly functionSignature: TSig;
  };
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Read from a smart contract at runtime (StaticCall); result is fresh at execution time */
export interface CoreStaticCallArgs<TSig extends string = string> {
  readonly bind: SignatureBind<TSig>;
  readonly config: Omit<CoreStaticCallConfig, 'args' | 'functionSignature'> & {
    readonly functionSignature: TSig;
  };
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Invoke a contract with pre-encoded calldata */
export interface CoreRawCallArgs {
  readonly bind: Record<string, never>;
  readonly config: CoreRawCallConfig;
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Graduate a raw handle to a resource, enabling slippage surfacing and linearity tracking */
export interface CoreAsResourceArgs {
  readonly bind: {
    readonly handle: Bindable<'uint256'>;
  };
  readonly config: CoreAsResourceConfig;
  readonly guards?: readonly TypedGuard<'resource'>[];
}

/** Borrow an asset from an Aave v3 pool against existing collateral, exposing the borrowed asset as a Resource */
export interface AaveBorrowArgs {
  readonly bind: Record<string, never>;
  readonly config: AaveBorrowConfig;
  readonly guards?: readonly TypedGuard<'debtBalance'>[];
}

/** Repay an Aave v3 variable-rate debt position with the supplied asset. mode: 'exact' passes the input handle amount; mode: 'max' passes type(uint256).max so Aave's Pool clamps paybackAmount to userVariableDebt exactly. Any unspent input is returned through the residual port. */
export interface AaveRepayArgs {
  readonly bind: {
    readonly assetIn: Bindable<'resource'>;
    readonly onBehalfOf: Bindable<'address'>;
  };
  readonly config: AaveRepayConfig;
  readonly guards?: readonly TypedGuard<'actualRepaid' | 'residual'>[];
}

/** Repay an Aave v3 variable-rate debt by burning the caller's aToken balance, returning any unspent residual */
export interface AaveRepayWithATokensArgs {
  readonly bind: {
    readonly aTokenIn: Bindable<'resource'>;
  };
  readonly config: AaveRepayWithATokensConfig;
  readonly guards?: readonly TypedGuard<'actualRepaid' | 'residual'>[];
}

/** Claim a specific Aave v3 incentives reward token against a set of receipt-token positions, exposing the claimed amount as a Resource */
export interface AaveClaimRewardsArgs {
  readonly bind: Record<string, never>;
  readonly config: AaveClaimRewardsConfig;
  readonly guards?: readonly TypedGuard<'claimedAmount'>[];
}

/** Switch the executionAddress's Aave v3 eMode category. 0 disables eMode. The pool reverts if the switch would make the position unhealthy or if any open borrow is for an asset outside the target category. Not allowed inside a continuation leg: the category is keyed to the executing proxy. */
export interface AaveSetEModeArgs {
  readonly bind: Record<string, never>;
  readonly config: AaveSetEModeConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Read the current Aave v3 health factor (WAD-scaled, 1e18; type(uint256).max for users with no debt) by static-calling IPool.getUserAccountData and decomposing the returned tuple. Exposes the healthFactor element as a uint256 handle suitable for use with core.numericInvariant. */
export interface AaveGetHealthFactorArgs {
  readonly bind: Record<string, never>;
  readonly config: AaveGetHealthFactorConfig;
  readonly guards?: readonly TypedGuard<'healthFactor'>[];
}

/** Deposit the collateral asset of a Morpho Blue market on behalf of onBehalfOf, or of the execution proxy when it is omitted; a continuation leg must set onBehalfOf. mode: 'exact' pulls the input handle's amount. mode: 'all' reads the proxy's current ERC20 balance of the market's collateral token and pulls that amount, ignoring the input handle's literal value — note this pulls the proxy's total balance (including unrelated upstream residuals), not just the input port's delivery. Credits Position.collateral on the Morpho singleton; emits no return value and exposes no resource output (the collateral is non-transferable accounting state). */
export interface MorphoBlueSupplyCollateralArgs {
  readonly bind: {
    readonly assetIn: Bindable<'resource'>;
  };
  readonly config: MorphoBlueSupplyCollateralConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Withdraw collateral from a Morpho Blue market position to the receiver address. Exposes the withdrawn ERC20 amount as a Resource output. */
export interface MorphoBlueWithdrawCollateralArgs {
  readonly bind: Record<string, never>;
  readonly config: MorphoBlueWithdrawCollateralConfig;
  readonly guards?: readonly TypedGuard<'collateralWithdrawn'>[];
}

/** Borrow the loan asset from a Morpho Blue market against existing collateral. Exposes the borrowed amount as a Resource and the (assetsBorrowed, sharesBorrowed) tuple as handles. */
export interface MorphoBlueBorrowArgs {
  readonly bind: Record<string, never>;
  readonly config: MorphoBlueBorrowConfig;
  readonly guards?: readonly TypedGuard<'assetsBorrowed' | 'sharesBorrowed'>[];
}

/** Repay a Morpho Blue debt position with the supplied asset. mode: 'exact' repays the input handle amount; mode: 'max' reads Position.borrowShares via a precursor static call and repays in shares mode to retire the debt to the wei. Returns any unspent residual as a Resource. */
export interface MorphoBlueRepayArgs {
  readonly bind: {
    readonly assetIn: Bindable<'resource'>;
    readonly onBehalfOf: Bindable<'address'>;
  };
  readonly config: MorphoBlueRepayConfig;
  readonly guards?: readonly TypedGuard<
    'actualRepaid' | 'sharesRepaid' | 'residual'
  >[];
}

/** Supply the loan asset of a Morpho Blue market and receive supplyShares accounting credit. Returns the (assetsSupplied, sharesSupplied) tuple as handles and any unspent residual as a Resource. */
export interface MorphoBlueSupplyArgs {
  readonly bind: {
    readonly assetIn: Bindable<'resource'>;
  };
  readonly config: MorphoBlueSupplyConfig;
  readonly guards?: readonly TypedGuard<
    'assetsSupplied' | 'sharesSupplied' | 'residual'
  >[];
}

/** Withdraw the loan asset from a Morpho Blue supply position. mode: 'exact' withdraws the configured amount; mode: 'max' reads Position.supplyShares via a precursor static call and burns all shares to retire the supply to the wei. Exposes the withdrawn amount as a Resource. */
export interface MorphoBlueWithdrawArgs {
  readonly bind: Record<string, never>;
  readonly config: MorphoBlueWithdrawConfig;
  readonly guards?: readonly TypedGuard<
    'assetsWithdrawn' | 'sharesWithdrawn'
  >[];
}

/** Read a Morpho Blue Position struct via a static call on the singleton. Exposes (supplyShares, borrowShares, collateral) as handles whose kinds match the on-chain field types (uint256, uint128, uint128). */
export interface MorphoBlueGetPositionArgs {
  readonly bind: Record<string, never>;
  readonly config: MorphoBlueGetPositionConfig;
  readonly guards?: readonly TypedGuard<
    'supplyShares' | 'borrowShares' | 'collateral'
  >[];
}

/** Earmark funds of a flashloan-borrowed token that stay in the proxy; the flashloan runtime repays the lender from them after the program */
export interface LifiFlashloanRepayArgs {
  readonly bind: {
    readonly funds: Bindable<'resource'>;
  };
  readonly config?: LifiFlashloanRepayConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Route tokens into a DeFi protocol position via the edge catalog */
export interface LifiZapArgs {
  readonly bind: {
    readonly amountIn: Bindable<'resource'>;
    readonly recipient?: Bindable<'address'>;
  };
  readonly config: LifiZapConfig;
  readonly guards?: readonly TypedGuard<'amountOut'>[];
}

/** Route tokens into a DeFi protocol position whose output becomes available after the initiating transaction settles */
export interface LifiZapAsyncArgs {
  readonly bind: {
    readonly amountIn: Bindable<'resource'>;
    readonly recipient: Bindable<'address'>;
  };
  readonly config: LifiZapAsyncConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Exact-output (BUY) swap via the Paraswap/Velora Market API: produce exactly `exactAmountOut` of the destination token, pulling only the source needed and exposing the genuinely-unspent source as `unspentIn`. */
export interface ParaswapBuyArgs {
  readonly bind: {
    readonly amountIn: Bindable<'resource'>;
  };
  readonly config: ParaswapBuyConfig;
  readonly guards?: readonly TypedGuard<'unspentIn'>[];
}

/** Read a smart contract value at compile time (off-chain eth_call); result is baked as a literal */
export interface CorePeekArgs {
  readonly bind: Record<string, never>;
  readonly config: CorePeekConfig;
  readonly guards?: readonly TypedGuard<'result'>[];
}

/** Swap via Fly's DexAggregator, sized at runtime: the router calldata leaves `amountIn` unset, so an upstream op's output can feed the swap without being known at plan time. Either leg may be the chain-native coin. */
export interface FlySwapArgs {
  readonly bind: {
    readonly amountIn: Bindable<'resource'>;
  };
  readonly config: FlySwapConfig;
  readonly guards?: readonly TypedGuard<'unspentIn'>[];
}

/** Fund a deferred settlement and commit to its future outcomes; output outcomes.i reports config.outcomes[i] */
export interface ContinuationSettleArgs<
  TOutcomes extends FamilySource<ContinuationSettleConfig['outcomes']> =
    FamilySource<ContinuationSettleConfig['outcomes']>,
> {
  readonly bind: {
    readonly input: Bindable<'resource'>;
  };
  readonly config: Omit<ContinuationSettleConfig, 'outcomes'> & {
    readonly outcomes: TOutcomes &
      FamilyCount<
        NoInfer<TOutcomes>,
        Readonly<ContinuationSettleConfig['outcomes']>
      >;
  };
  readonly guards?: readonly TypedGuard<never>[];
}

/** Deposit two ERC-20 tokens into an existing Uniswap V2 pair (or an ABI-identical fork such as SushiSwap V2) through its Router02 and receive the pair's LP token; unused input returns as residuals. Asserts on chain that the router's factory is `factory`, that the factory's pair for the two tokens is `pair`, and that the pair holds non-zero reserves. Exposes the pool price read before the deposit as `poolPrice`. The deposit is protected only with a `band` guard on `poolPrice` and a `slippage` guard on `liquidity`. Fee-on-transfer tokens are unsupported. */
export interface UniswapV2AddLiquidityArgs {
  readonly bind: {
    readonly tokenA: Bindable<'resource'>;
    readonly tokenB: Bindable<'resource'>;
  };
  readonly config: UniswapV2AddLiquidityConfig;
  readonly guards?: readonly TypedGuard<
    'liquidity' | 'residualA' | 'residualB' | 'poolPrice'
  >[];
}

/** Burn a Uniswap V2 LP token (or one of an ABI-identical fork such as SushiSwap V2) through its Router02 and receive both underlying tokens. Asserts on chain that the router's factory is `factory` and that the factory's pair for `tokenA`/`tokenB` is the input LP token. The withdrawal is protected only with a `slippage` guard on each of `tokenA` and `tokenB`. Fee-on-transfer tokens are unsupported: the outputs are the amounts the router reports, which would overstate what such a token delivers. */
export interface UniswapV2RemoveLiquidityArgs {
  readonly bind: {
    readonly liquidity: Bindable<'resource'>;
  };
  readonly config: UniswapV2RemoveLiquidityConfig;
  readonly guards?: readonly TypedGuard<'tokenA' | 'tokenB'>[];
}

/** Open a Uniswap V3 concentrated-liquidity position (or one on an ABI-identical fork) for a tick range, minting the position NFT straight to `recipient`, which must not be the execution address. Exposes the new `tokenId`; unused input comes back as residuals. The deposit is protected only with a `band` guard on `sqrtPriceX96` (read before the deposit) and a `slippage` guard on `liquidity`; a band of N bps on `sqrtPriceX96` allows about 2N bps of price movement. Fee-on-transfer tokens are unsupported. */
export interface UniswapV3MintArgs {
  readonly bind: {
    readonly tokenA: Bindable<'resource'>;
    readonly tokenB: Bindable<'resource'>;
    readonly recipient: Bindable<'address'>;
  };
  readonly config: UniswapV3MintConfig;
  readonly guards?: readonly TypedGuard<
    'tokenId' | 'liquidity' | 'sqrtPriceX96' | 'residualA' | 'residualB'
  >[];
}

/** Add two tokens to an existing Uniswap V3 position (or one on an ABI-identical fork). `owner` must own `tokenId`, and the position must hold the two input tokens; both are asserted on chain, since the position manager checks neither. Unused input comes back as residuals. The deposit is protected only with a `band` guard on `sqrtPriceX96` (read before the deposit) and a `slippage` guard on `liquidity`; a band of N bps on `sqrtPriceX96` allows about 2N bps of price movement. Fee-on-transfer tokens are unsupported. */
export interface UniswapV3IncreaseLiquidityArgs {
  readonly bind: {
    readonly tokenA: Bindable<'resource'>;
    readonly tokenB: Bindable<'resource'>;
    readonly owner: Bindable<'address'>;
  };
  readonly config: UniswapV3IncreaseLiquidityConfig;
  readonly guards?: readonly TypedGuard<
    'liquidity' | 'sqrtPriceX96' | 'residualA' | 'residualB'
  >[];
}

/** Supply the input token into an Aave v4 spoke reserve on behalf of the execution proxy, without enabling it as collateral (use aaveV4.supplyCollateral or aaveV4.setUsingAsCollateral for that). The input must be the reserve's underlying token; the spoke pulls it, so the approval goes to the spoke. Exposes no resource output: the supplied position is spoke accounting state, not a token. */
export interface AaveV4SupplyArgs {
  readonly bind: {
    readonly assetIn: Bindable<'resource'>;
  };
  readonly config: AaveV4SupplyConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Supply the input token into an Aave v4 spoke reserve on behalf of the execution proxy and enable the reserve as collateral: supply, then setUsingAsCollateral(reserveId, true). Enabling is idempotent, so a reserve already used as collateral is fine. The input must be the reserve's underlying token; the spoke pulls it, so the approval goes to the spoke. Exposes no resource output: the collateral is spoke accounting state, not a token. */
export interface AaveV4SupplyCollateralArgs {
  readonly bind: {
    readonly assetIn: Bindable<'resource'>;
  };
  readonly config: AaveV4SupplyCollateralConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Enable (usingAsCollateral: true) or disable (false) an Aave v4 spoke reserve as collateral for the execution proxy's position. Enabling is idempotent and runs no health-factor check. */
export interface AaveV4SetUsingAsCollateralArgs {
  readonly bind: Record<string, never>;
  readonly config: AaveV4SetUsingAsCollateralConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Borrow `amount` of `asset` from an Aave v4 spoke reserve against the execution proxy's collateral, exposing the borrowed asset as a Resource and the position's total debt on the reserve (drawn plus premium) as `debtBalance`. Asserts on chain that the reserve's underlying is `asset`. v4 liquidates at the same collateral factor that caps borrowing, so a maximum borrow is immediately liquidatable: guard the result with aaveV4.getHealthFactor and core.numericInvariant. */
export interface AaveV4BorrowArgs {
  readonly bind: Record<string, never>;
  readonly config: AaveV4BorrowConfig;
  readonly guards?: readonly TypedGuard<'debtBalance'>[];
}

/** Read a position's current Aave v4 health factor on a spoke (WAD-scaled, 1e18; type(uint256).max with no debt) from Spoke.getUserAccountData. Exposes it as a uint256 handle for core.numericInvariant. v4 liquidates at the collateral factor that caps borrowing, so assert a buffer above 1e18 after a borrow. */
export interface AaveV4GetHealthFactorArgs {
  readonly bind: Record<string, never>;
  readonly config: AaveV4GetHealthFactorConfig;
  readonly guards?: readonly TypedGuard<'healthFactor'>[];
}

/** Repay the execution proxy's debt on an Aave v4 spoke reserve with the input token, which must be the reserve's underlying. mode: 'exact' repays the input amount; mode: 'max' passes type(uint256).max so the spoke repays the whole drawn plus premium debt. Either way the spoke caps the repayment at the debt and pulls at most the input amount, so 'max' reverts when the input does not cover the debt. actualRepaid is the amount the spoke returns; residual is the unspent input. */
export interface AaveV4RepayArgs {
  readonly bind: {
    readonly assetIn: Bindable<'resource'>;
  };
  readonly config: AaveV4RepayConfig;
  readonly guards?: readonly TypedGuard<'actualRepaid' | 'residual'>[];
}

/** Withdraw `asset` from the execution proxy's supply position on an Aave v4 spoke reserve, exposing the withdrawn amount as a Resource. mode: 'exact' withdraws `amount`; mode: 'max' passes type(uint256).max to withdraw the whole balance. The spoke caps either at the supplied balance and returns the amount it sent, which is the output. Asserts on chain that the reserve's underlying is `asset`. When the reserve is collateral, the spoke reverts if the withdrawal leaves the health factor below 1, so repay the debt first. */
export interface AaveV4WithdrawArgs {
  readonly bind: Record<string, never>;
  readonly config: AaveV4WithdrawConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Swap or bridge tokens through a LI.FI Intents order a solver fills */
export interface LifiIntentsOrderArgs {
  readonly bind: {
    readonly amountIn: Bindable<'resource'>;
  };
  readonly config: LifiIntentsOrderConfig;
  readonly guards?: readonly TypedGuard<'unspentIn'>[];
}

/** Refund a LI.FI Intents escrow order after its expiry. Anyone may call; the escrow pays the order's user. Only an order the order server reports before delivery (status Open or Signed) is refunded. */
export interface LifiIntentsRefundArgs {
  readonly bind: Record<string, never>;
  readonly config: LifiIntentsRefundConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Step 1 of the early refund of a cross-chain LI.FI Intents order: on the order's output chain, after its fill deadline, record that the output was not filled. Keep the transaction hash for lifiIntents.refundOnNonFill. */
export interface LifiIntentsAttestNonFillArgs {
  readonly bind: Record<string, never>;
  readonly config: LifiIntentsAttestNonFillConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

/** Step 2 of the early refund of a cross-chain LI.FI Intents order: on the order's input chain, prove the non-fill attestation through Polymer and refund the order's user. A resolution_error means the proof is not ready yet; retry. */
export interface LifiIntentsRefundOnNonFillArgs {
  readonly bind: Record<string, never>;
  readonly config: LifiIntentsRefundOnNonFillConfig;
  readonly guards?: readonly TypedGuard<never>[];
}

export interface CoreSplitOutputs {
  readonly a: OutputHandle<'resource'>;
  readonly b: OutputHandle<'resource'>;
}

export interface CoreSplitAtOutputs {
  readonly head: OutputHandle<'resource'>;
  readonly tail: OutputHandle<'resource'>;
}

export interface CorePartitionOutputs<
  TBps extends FamilySource<CorePartitionConfig['bps']> = FamilySource<
    CorePartitionConfig['bps']
  >,
> {
  readonly parts: OutputFamilyHandles<TBps>;
}

export interface CoreMergeOutputs {
  readonly merged: OutputHandle<'resource'>;
}

export interface LifiSwapOutputs {
  readonly amountOut: OutputHandle<'resource'>;
  readonly unspentIn: OutputHandle<'resource'>;
}

export interface LifiBridgeOutputs {
  readonly amountOut: OutputHandle<'resource'>;
  readonly unspentIn: OutputHandle<'resource'>;
}

export interface CoreAddOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface CoreSubtractOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface CoreMultiplyOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface CoreDivideDownOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface CoreDivideUpOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface CoreBpsDownOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface CoreBpsUpOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface CoreBalanceOfOutputs {
  readonly balance: OutputHandle<'resource'>;
}

export interface CoreTransferOutputs {
  readonly transferred: OutputHandle<'resource'>;
}

export interface CoreRawCallOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface CoreAsResourceOutputs {
  readonly resource: OutputHandle<'resource'>;
}

export interface AaveBorrowOutputs {
  readonly borrowed: OutputHandle<'resource'>;
  readonly debtBalance: OutputHandle<'uint256'>;
}

export interface AaveRepayOutputs {
  readonly actualRepaid: OutputHandle<'uint256'>;
  readonly residual: OutputHandle<'resource'>;
}

export interface AaveRepayWithATokensOutputs {
  readonly actualRepaid: OutputHandle<'uint256'>;
  readonly residual: OutputHandle<'resource'>;
}

export interface AaveClaimRewardsOutputs {
  readonly claimed: OutputHandle<'resource'>;
  readonly claimedAmount: OutputHandle<'uint256'>;
}

export interface AaveGetHealthFactorOutputs {
  readonly healthFactor: OutputHandle<'uint256'>;
}

export interface MorphoBlueWithdrawCollateralOutputs {
  readonly withdrawn: OutputHandle<'resource'>;
  readonly collateralWithdrawn: OutputHandle<'uint256'>;
}

export interface MorphoBlueBorrowOutputs {
  readonly borrowed: OutputHandle<'resource'>;
  readonly assetsBorrowed: OutputHandle<'uint256'>;
  readonly sharesBorrowed: OutputHandle<'uint256'>;
}

export interface MorphoBlueRepayOutputs {
  readonly actualRepaid: OutputHandle<'uint256'>;
  readonly sharesRepaid: OutputHandle<'uint256'>;
  readonly residual: OutputHandle<'resource'>;
}

export interface MorphoBlueSupplyOutputs {
  readonly assetsSupplied: OutputHandle<'uint256'>;
  readonly sharesSupplied: OutputHandle<'uint256'>;
  readonly residual: OutputHandle<'resource'>;
}

export interface MorphoBlueWithdrawOutputs {
  readonly withdrawn: OutputHandle<'resource'>;
  readonly assetsWithdrawn: OutputHandle<'uint256'>;
  readonly sharesWithdrawn: OutputHandle<'uint256'>;
}

export interface MorphoBlueGetPositionOutputs {
  readonly supplyShares: OutputHandle<'uint256'>;
  readonly borrowShares: OutputHandle<'uint128'>;
  readonly collateral: OutputHandle<'uint128'>;
}

export interface LifiZapOutputs {
  readonly amountOut: OutputHandle<'resource'>;
}

export interface LifiZapAsyncOutputs {
  readonly amountOut: OutputHandle<'resource'>;
}

export interface ParaswapBuyOutputs {
  readonly amountOut: OutputHandle<'resource'>;
  readonly unspentIn: OutputHandle<'resource'>;
}

export interface CorePeekOutputs {
  readonly result: OutputHandle<'uint256'>;
}

export interface FlySwapOutputs {
  readonly amountOut: OutputHandle<'resource'>;
  readonly unspentIn: OutputHandle<'resource'>;
}

export interface ContinuationSettleOutputs<
  TOutcomes extends FamilySource<ContinuationSettleConfig['outcomes']> =
    FamilySource<ContinuationSettleConfig['outcomes']>,
> {
  readonly outcomes: OutputFamilyHandles<TOutcomes>;
}

export interface UniswapV2AddLiquidityOutputs {
  readonly liquidity: OutputHandle<'resource'>;
  readonly residualA: OutputHandle<'resource'>;
  readonly residualB: OutputHandle<'resource'>;
  readonly poolPrice: OutputHandle<'uint256'>;
}

export interface UniswapV2RemoveLiquidityOutputs {
  readonly tokenA: OutputHandle<'resource'>;
  readonly tokenB: OutputHandle<'resource'>;
}

export interface UniswapV3MintOutputs {
  readonly tokenId: OutputHandle<'uint256'>;
  readonly liquidity: OutputHandle<'uint256'>;
  readonly sqrtPriceX96: OutputHandle<'uint256'>;
  readonly residualA: OutputHandle<'resource'>;
  readonly residualB: OutputHandle<'resource'>;
}

export interface UniswapV3IncreaseLiquidityOutputs {
  readonly liquidity: OutputHandle<'uint256'>;
  readonly sqrtPriceX96: OutputHandle<'uint256'>;
  readonly residualA: OutputHandle<'resource'>;
  readonly residualB: OutputHandle<'resource'>;
}

export interface AaveV4BorrowOutputs {
  readonly borrowed: OutputHandle<'resource'>;
  readonly debtBalance: OutputHandle<'uint256'>;
}

export interface AaveV4GetHealthFactorOutputs {
  readonly healthFactor: OutputHandle<'uint256'>;
}

export interface AaveV4RepayOutputs {
  readonly actualRepaid: OutputHandle<'uint256'>;
  readonly residual: OutputHandle<'resource'>;
}

export interface AaveV4WithdrawOutputs {
  readonly withdrawn: OutputHandle<'resource'>;
}

export interface LifiIntentsOrderOutputs {
  readonly amountOut: OutputHandle<'resource'>;
  readonly unspentIn: OutputHandle<'resource'>;
}

export type GeneratedOps = {
  readonly core: {
    /** Split a resource into two outputs by basis-point ratio. Output `a` receives `bps` of the source, rounded up, and `b` takes the remainder. — original id: "core.split" */
    readonly split: (nodeId: string, args: CoreSplitArgs) => CoreSplitOutputs;
    /** Split a resource at a fixed amount. Output `head` receives `min(source, amount)`; `tail` receives the rest, and is 0 (omitted when unspent) when the source is at or below `amount`. — original id: "core.splitAt" */
    readonly splitAt: (
      nodeId: string,
      args: CoreSplitAtArgs,
    ) => CoreSplitAtOutputs;
    /** Partition a resource into one output per basis-point share. `bps` lists 2 to 16 shares summing to 10000; output `parts.i` receives share i, rounded down, and the last part takes the remainder. — original id: "core.partition" */
    readonly partition: <
      const TBps extends FamilySource<CorePartitionConfig['bps']>,
    >(
      nodeId: string,
      args: CorePartitionArgs<TBps>,
    ) => CorePartitionOutputs<TBps>;
    /** Merge two same-token resources into one by addition — original id: "core.merge" */
    readonly merge: (nodeId: string, args: CoreMergeArgs) => CoreMergeOutputs;
    /** Add two unsigned integers (a + b) — original id: "core.add" */
    readonly add: (nodeId: string, args: CoreAddArgs) => CoreAddOutputs;
    /** Subtract b from a (a - b); reverts on underflow — original id: "core.subtract" */
    readonly subtract: (
      nodeId: string,
      args: CoreSubtractArgs,
    ) => CoreSubtractOutputs;
    /** Multiply two unsigned integers (a * b) — original id: "core.multiply" */
    readonly multiply: (
      nodeId: string,
      args: CoreMultiplyArgs,
    ) => CoreMultiplyOutputs;
    /** Divide a by b, rounding toward zero — original id: "core.divideDown" */
    readonly divideDown: (
      nodeId: string,
      args: CoreDivideDownArgs,
    ) => CoreDivideDownOutputs;
    /** Divide a by b, rounding away from zero — original id: "core.divideUp" */
    readonly divideUp: (
      nodeId: string,
      args: CoreDivideUpArgs,
    ) => CoreDivideUpOutputs;
    /** Multiply value by basis points and divide by 10000, rounding down — original id: "core.bpsDown" */
    readonly bpsDown: (
      nodeId: string,
      args: CoreBpsDownArgs,
    ) => CoreBpsDownOutputs;
    /** Multiply value by basis points and divide by 10000, rounding up — original id: "core.bpsUp" */
    readonly bpsUp: (nodeId: string, args: CoreBpsUpArgs) => CoreBpsUpOutputs;
    /** Assert a == b; reverts if not equal — original id: "core.assertEqual" */
    readonly assertEqual: (nodeId: string, args: CoreAssertEqualArgs) => void;
    /** Assert a != b; reverts if equal — original id: "core.assertNotEqual" */
    readonly assertNotEqual: (
      nodeId: string,
      args: CoreAssertNotEqualArgs,
    ) => void;
    /** Assert a > b; reverts if a <= b — original id: "core.assertGt" */
    readonly assertGt: (nodeId: string, args: CoreAssertGtArgs) => void;
    /** Assert a >= b; reverts if a < b — original id: "core.assertGte" */
    readonly assertGte: (nodeId: string, args: CoreAssertGteArgs) => void;
    /** Assert a < b; reverts if a >= b — original id: "core.assertLt" */
    readonly assertLt: (nodeId: string, args: CoreAssertLtArgs) => void;
    /** Assert a <= b; reverts if a > b — original id: "core.assertLte" */
    readonly assertLte: (nodeId: string, args: CoreAssertLteArgs) => void;
    /** Assert min <= value <= max; reverts if value is outside the range — original id: "core.assertInRange" */
    readonly assertInRange: (
      nodeId: string,
      args: CoreAssertInRangeArgs,
    ) => void;
    /** Approve an ERC20 spender for the given token and amount — original id: "core.approve" */
    readonly approve: (nodeId: string, args: CoreApproveArgs) => void;
    /** Read an ERC20 balance, producing a resource — original id: "core.balanceOf" */
    readonly balanceOf: (
      nodeId: string,
      args: CoreBalanceOfArgs,
    ) => CoreBalanceOfOutputs;
    /** Transfer the whole input resource to a recipient address. To send part of a resource, split it first with `core.split` or `core.splitAt`. — original id: "core.transfer" */
    readonly transfer: (
      nodeId: string,
      args: CoreTransferArgs,
    ) => CoreTransferOutputs;
    /** Emit a custom on-chain event carrying 1 32-byte payload value. The value becomes a non-indexed data word in a fixed VM log event; the signature is hashed into a discriminator word (it is NOT an indexed EVM topic). — original id: "core.emitEvent1" */
    readonly emitEvent1: (nodeId: string, args: CoreEmitEvent1Args) => void;
    /** Emit a custom on-chain event carrying 2 32-byte payload values. The values become non-indexed data words in a fixed VM log event; the signature is hashed into a discriminator word (it is NOT an indexed EVM topic). — original id: "core.emitEvent2" */
    readonly emitEvent2: (nodeId: string, args: CoreEmitEvent2Args) => void;
    /** Emit a custom on-chain event carrying 3 32-byte payload values. The values become non-indexed data words in a fixed VM log event; the signature is hashed into a discriminator word (it is NOT an indexed EVM topic). — original id: "core.emitEvent3" */
    readonly emitEvent3: (nodeId: string, args: CoreEmitEvent3Args) => void;
    /** Emit a custom on-chain event carrying 4 32-byte payload values. The values become non-indexed data words in a fixed VM log event; the signature is hashed into a discriminator word (it is NOT an indexed EVM topic). — original id: "core.emitEvent4" */
    readonly emitEvent4: (nodeId: string, args: CoreEmitEvent4Args) => void;
    /** Invoke a smart contract function, optionally spending a token resource — original id: "core.call" */
    readonly call: <TSig extends string>(
      nodeId: string,
      args: CoreCallArgs<TSig>,
    ) => CoreCallResult<TSig>;
    /** Read from a smart contract at runtime (StaticCall); result is fresh at execution time — original id: "core.staticCall" */
    readonly staticCall: <TSig extends string>(
      nodeId: string,
      args: CoreStaticCallArgs<TSig>,
    ) => StaticCallResult<TSig>;
    /** Invoke a contract with pre-encoded calldata — original id: "core.rawCall" */
    readonly rawCall: (
      nodeId: string,
      args: CoreRawCallArgs,
    ) => CoreRawCallOutputs;
    /** Graduate a raw handle to a resource, enabling slippage surfacing and linearity tracking — original id: "core.asResource" */
    readonly asResource: (
      nodeId: string,
      args: CoreAsResourceArgs,
    ) => CoreAsResourceOutputs;
    /** Read a smart contract value at compile time (off-chain eth_call); result is baked as a literal — original id: "core.peek" */
    readonly peek: (nodeId: string, args: CorePeekArgs) => CorePeekOutputs;
  };
  readonly lifi: {
    /** Swap tokens via the LI.FI aggregator API — original id: "lifi.swap" */
    readonly swap: (nodeId: string, args: LifiSwapArgs) => LifiSwapOutputs;
    /** Bridge tokens to another chain via the LI.FI aggregator API — original id: "lifi.bridge" */
    readonly bridge: (
      nodeId: string,
      args: LifiBridgeArgs,
    ) => LifiBridgeOutputs;
    /** Route tokens into a DeFi protocol position via the edge catalog — original id: "lifi.zap" */
    readonly zap: (nodeId: string, args: LifiZapArgs) => LifiZapOutputs;
    /** Route tokens into a DeFi protocol position whose output becomes available after the initiating transaction settles — original id: "lifi.zapAsync" */
    readonly zapAsync: (
      nodeId: string,
      args: LifiZapAsyncArgs,
    ) => LifiZapAsyncOutputs;
  };
  readonly invariant: {
    /** Assert that an account holds at least a minimum token balance — original id: "invariant.balanceAtLeast" */
    readonly balanceAtLeast: (
      nodeId: string,
      args: InvariantBalanceAtLeastArgs,
    ) => void;
    /** Assert that an account holds exactly an expected token balance — original id: "invariant.balanceEquals" */
    readonly balanceEquals: (
      nodeId: string,
      args: InvariantBalanceEqualsArgs,
    ) => void;
    /** Assert that an account holds at most a maximum token balance — original id: "invariant.balanceAtMost" */
    readonly balanceAtMost: (
      nodeId: string,
      args: InvariantBalanceAtMostArgs,
    ) => void;
    /** Assert that an account's token balance is between a minimum and a maximum (inclusive) — original id: "invariant.balanceInRange" */
    readonly balanceInRange: (
      nodeId: string,
      args: InvariantBalanceInRangeArgs,
    ) => void;
    /** Assert that a spender is permitted to move at least a minimum allowance on behalf of an owner — original id: "invariant.allowanceAtLeast" */
    readonly allowanceAtLeast: (
      nodeId: string,
      args: InvariantAllowanceAtLeastArgs,
    ) => void;
    /** Assert that a spender's allowance on behalf of an owner exactly equals an expected amount — original id: "invariant.allowanceEquals" */
    readonly allowanceEquals: (
      nodeId: string,
      args: InvariantAllowanceEqualsArgs,
    ) => void;
    /** Assert that a spender is permitted to move at most a maximum allowance on behalf of an owner — original id: "invariant.allowanceAtMost" */
    readonly allowanceAtMost: (
      nodeId: string,
      args: InvariantAllowanceAtMostArgs,
    ) => void;
    /** Assert that a spender's allowance on behalf of an owner is between a minimum and a maximum (inclusive) — original id: "invariant.allowanceInRange" */
    readonly allowanceInRange: (
      nodeId: string,
      args: InvariantAllowanceInRangeArgs,
    ) => void;
    /** Assert a uint256 value satisfies a comparison against a constant threshold; reverts on violation — original id: "invariant.numeric" */
    readonly numeric: (nodeId: string, args: InvariantNumericArgs) => void;
    /** Assert min <= value <= max against constant bounds; reverts if outside the range — original id: "invariant.numericInRange" */
    readonly numericInRange: (
      nodeId: string,
      args: InvariantNumericInRangeArgs,
    ) => void;
    /** Assert a uint256 value is greater than or equal to a constant threshold; reverts on violation — original id: "invariant.gte" */
    readonly gte: (nodeId: string, args: InvariantGteArgs) => void;
    /** Assert a uint256 value is strictly greater than a constant threshold; reverts on violation — original id: "invariant.gt" */
    readonly gt: (nodeId: string, args: InvariantGtArgs) => void;
    /** Assert a uint256 value is less than or equal to a constant threshold; reverts on violation — original id: "invariant.lte" */
    readonly lte: (nodeId: string, args: InvariantLteArgs) => void;
    /** Assert a uint256 value is strictly less than a constant threshold; reverts on violation — original id: "invariant.lt" */
    readonly lt: (nodeId: string, args: InvariantLtArgs) => void;
    /** Assert a uint256 value equals a constant threshold; reverts on violation — original id: "invariant.eq" */
    readonly eq: (nodeId: string, args: InvariantEqArgs) => void;
    /** Assert a uint256 value does not equal a constant threshold; reverts on violation — original id: "invariant.neq" */
    readonly neq: (nodeId: string, args: InvariantNeqArgs) => void;
  };
  readonly aave: {
    /** Borrow an asset from an Aave v3 pool against existing collateral, exposing the borrowed asset as a Resource — original id: "aave.borrow" */
    readonly borrow: (
      nodeId: string,
      args: AaveBorrowArgs,
    ) => AaveBorrowOutputs;
    /** Repay an Aave v3 variable-rate debt position with the supplied asset. mode: 'exact' passes the input handle amount; mode: 'max' passes type(uint256).max so Aave's Pool clamps paybackAmount to userVariableDebt exactly. Any unspent input is returned through the residual port. — original id: "aave.repay" */
    readonly repay: (nodeId: string, args: AaveRepayArgs) => AaveRepayOutputs;
    /** Repay an Aave v3 variable-rate debt by burning the caller's aToken balance, returning any unspent residual — original id: "aave.repayWithATokens" */
    readonly repayWithATokens: (
      nodeId: string,
      args: AaveRepayWithATokensArgs,
    ) => AaveRepayWithATokensOutputs;
    /** Claim a specific Aave v3 incentives reward token against a set of receipt-token positions, exposing the claimed amount as a Resource — original id: "aave.claimRewards" */
    readonly claimRewards: (
      nodeId: string,
      args: AaveClaimRewardsArgs,
    ) => AaveClaimRewardsOutputs;
    /** Switch the executionAddress's Aave v3 eMode category. 0 disables eMode. The pool reverts if the switch would make the position unhealthy or if any open borrow is for an asset outside the target category. Not allowed inside a continuation leg: the category is keyed to the executing proxy. — original id: "aave.setEMode" */
    readonly setEMode: (nodeId: string, args: AaveSetEModeArgs) => void;
    /** Read the current Aave v3 health factor (WAD-scaled, 1e18; type(uint256).max for users with no debt) by static-calling IPool.getUserAccountData and decomposing the returned tuple. Exposes the healthFactor element as a uint256 handle suitable for use with core.numericInvariant. — original id: "aave.getHealthFactor" */
    readonly getHealthFactor: (
      nodeId: string,
      args: AaveGetHealthFactorArgs,
    ) => AaveGetHealthFactorOutputs;
  };
  readonly morphoBlue: {
    /** Deposit the collateral asset of a Morpho Blue market on behalf of onBehalfOf, or of the execution proxy when it is omitted; a continuation leg must set onBehalfOf. mode: 'exact' pulls the input handle's amount. mode: 'all' reads the proxy's current ERC20 balance of the market's collateral token and pulls that amount, ignoring the input handle's literal value — note this pulls the proxy's total balance (including unrelated upstream residuals), not just the input port's delivery. Credits Position.collateral on the Morpho singleton; emits no return value and exposes no resource output (the collateral is non-transferable accounting state). — original id: "morphoBlue.supplyCollateral" */
    readonly supplyCollateral: (
      nodeId: string,
      args: MorphoBlueSupplyCollateralArgs,
    ) => void;
    /** Withdraw collateral from a Morpho Blue market position to the receiver address. Exposes the withdrawn ERC20 amount as a Resource output. — original id: "morphoBlue.withdrawCollateral" */
    readonly withdrawCollateral: (
      nodeId: string,
      args: MorphoBlueWithdrawCollateralArgs,
    ) => MorphoBlueWithdrawCollateralOutputs;
    /** Borrow the loan asset from a Morpho Blue market against existing collateral. Exposes the borrowed amount as a Resource and the (assetsBorrowed, sharesBorrowed) tuple as handles. — original id: "morphoBlue.borrow" */
    readonly borrow: (
      nodeId: string,
      args: MorphoBlueBorrowArgs,
    ) => MorphoBlueBorrowOutputs;
    /** Repay a Morpho Blue debt position with the supplied asset. mode: 'exact' repays the input handle amount; mode: 'max' reads Position.borrowShares via a precursor static call and repays in shares mode to retire the debt to the wei. Returns any unspent residual as a Resource. — original id: "morphoBlue.repay" */
    readonly repay: (
      nodeId: string,
      args: MorphoBlueRepayArgs,
    ) => MorphoBlueRepayOutputs;
    /** Supply the loan asset of a Morpho Blue market and receive supplyShares accounting credit. Returns the (assetsSupplied, sharesSupplied) tuple as handles and any unspent residual as a Resource. — original id: "morphoBlue.supply" */
    readonly supply: (
      nodeId: string,
      args: MorphoBlueSupplyArgs,
    ) => MorphoBlueSupplyOutputs;
    /** Withdraw the loan asset from a Morpho Blue supply position. mode: 'exact' withdraws the configured amount; mode: 'max' reads Position.supplyShares via a precursor static call and burns all shares to retire the supply to the wei. Exposes the withdrawn amount as a Resource. — original id: "morphoBlue.withdraw" */
    readonly withdraw: (
      nodeId: string,
      args: MorphoBlueWithdrawArgs,
    ) => MorphoBlueWithdrawOutputs;
    /** Read a Morpho Blue Position struct via a static call on the singleton. Exposes (supplyShares, borrowShares, collateral) as handles whose kinds match the on-chain field types (uint256, uint128, uint128). — original id: "morphoBlue.getPosition" */
    readonly getPosition: (
      nodeId: string,
      args: MorphoBlueGetPositionArgs,
    ) => MorphoBlueGetPositionOutputs;
  };
  readonly continuation: {
    /** Fund a deferred settlement and commit to its future outcomes; output outcomes.i reports config.outcomes[i] — original id: "continuation.settle" */
    readonly settle: <
      const TOutcomes extends FamilySource<
        ContinuationSettleConfig['outcomes']
      >,
    >(
      nodeId: string,
      args: ContinuationSettleArgs<TOutcomes>,
    ) => ContinuationSettleOutputs<TOutcomes>;
  };
  readonly paraswap: {
    /** Exact-output (BUY) swap via the Paraswap/Velora Market API: produce exactly `exactAmountOut` of the destination token, pulling only the source needed and exposing the genuinely-unspent source as `unspentIn`. — original id: "paraswap.buy" */
    readonly buy: (nodeId: string, args: ParaswapBuyArgs) => ParaswapBuyOutputs;
  };
  readonly fly: {
    /** Swap via Fly's DexAggregator, sized at runtime: the router calldata leaves `amountIn` unset, so an upstream op's output can feed the swap without being known at plan time. Either leg may be the chain-native coin. — original id: "fly.swap" */
    readonly swap: (nodeId: string, args: FlySwapArgs) => FlySwapOutputs;
  };
  readonly uniswapV2: {
    /** Deposit two ERC-20 tokens into an existing Uniswap V2 pair (or an ABI-identical fork such as SushiSwap V2) through its Router02 and receive the pair's LP token; unused input returns as residuals. Asserts on chain that the router's factory is `factory`, that the factory's pair for the two tokens is `pair`, and that the pair holds non-zero reserves. Exposes the pool price read before the deposit as `poolPrice`. The deposit is protected only with a `band` guard on `poolPrice` and a `slippage` guard on `liquidity`. Fee-on-transfer tokens are unsupported. — original id: "uniswapV2.addLiquidity" */
    readonly addLiquidity: (
      nodeId: string,
      args: UniswapV2AddLiquidityArgs,
    ) => UniswapV2AddLiquidityOutputs;
    /** Burn a Uniswap V2 LP token (or one of an ABI-identical fork such as SushiSwap V2) through its Router02 and receive both underlying tokens. Asserts on chain that the router's factory is `factory` and that the factory's pair for `tokenA`/`tokenB` is the input LP token. The withdrawal is protected only with a `slippage` guard on each of `tokenA` and `tokenB`. Fee-on-transfer tokens are unsupported: the outputs are the amounts the router reports, which would overstate what such a token delivers. — original id: "uniswapV2.removeLiquidity" */
    readonly removeLiquidity: (
      nodeId: string,
      args: UniswapV2RemoveLiquidityArgs,
    ) => UniswapV2RemoveLiquidityOutputs;
  };
  readonly uniswapV3: {
    /** Open a Uniswap V3 concentrated-liquidity position (or one on an ABI-identical fork) for a tick range, minting the position NFT straight to `recipient`, which must not be the execution address. Exposes the new `tokenId`; unused input comes back as residuals. The deposit is protected only with a `band` guard on `sqrtPriceX96` (read before the deposit) and a `slippage` guard on `liquidity`; a band of N bps on `sqrtPriceX96` allows about 2N bps of price movement. Fee-on-transfer tokens are unsupported. — original id: "uniswapV3.mint" */
    readonly mint: (
      nodeId: string,
      args: UniswapV3MintArgs,
    ) => UniswapV3MintOutputs;
    /** Add two tokens to an existing Uniswap V3 position (or one on an ABI-identical fork). `owner` must own `tokenId`, and the position must hold the two input tokens; both are asserted on chain, since the position manager checks neither. Unused input comes back as residuals. The deposit is protected only with a `band` guard on `sqrtPriceX96` (read before the deposit) and a `slippage` guard on `liquidity`; a band of N bps on `sqrtPriceX96` allows about 2N bps of price movement. Fee-on-transfer tokens are unsupported. — original id: "uniswapV3.increaseLiquidity" */
    readonly increaseLiquidity: (
      nodeId: string,
      args: UniswapV3IncreaseLiquidityArgs,
    ) => UniswapV3IncreaseLiquidityOutputs;
  };
  readonly aaveV4: {
    /** Supply the input token into an Aave v4 spoke reserve on behalf of the execution proxy, without enabling it as collateral (use aaveV4.supplyCollateral or aaveV4.setUsingAsCollateral for that). The input must be the reserve's underlying token; the spoke pulls it, so the approval goes to the spoke. Exposes no resource output: the supplied position is spoke accounting state, not a token. — original id: "aaveV4.supply" */
    readonly supply: (nodeId: string, args: AaveV4SupplyArgs) => void;
    /** Supply the input token into an Aave v4 spoke reserve on behalf of the execution proxy and enable the reserve as collateral: supply, then setUsingAsCollateral(reserveId, true). Enabling is idempotent, so a reserve already used as collateral is fine. The input must be the reserve's underlying token; the spoke pulls it, so the approval goes to the spoke. Exposes no resource output: the collateral is spoke accounting state, not a token. — original id: "aaveV4.supplyCollateral" */
    readonly supplyCollateral: (
      nodeId: string,
      args: AaveV4SupplyCollateralArgs,
    ) => void;
    /** Enable (usingAsCollateral: true) or disable (false) an Aave v4 spoke reserve as collateral for the execution proxy's position. Enabling is idempotent and runs no health-factor check. — original id: "aaveV4.setUsingAsCollateral" */
    readonly setUsingAsCollateral: (
      nodeId: string,
      args: AaveV4SetUsingAsCollateralArgs,
    ) => void;
    /** Borrow `amount` of `asset` from an Aave v4 spoke reserve against the execution proxy's collateral, exposing the borrowed asset as a Resource and the position's total debt on the reserve (drawn plus premium) as `debtBalance`. Asserts on chain that the reserve's underlying is `asset`. v4 liquidates at the same collateral factor that caps borrowing, so a maximum borrow is immediately liquidatable: guard the result with aaveV4.getHealthFactor and core.numericInvariant. — original id: "aaveV4.borrow" */
    readonly borrow: (
      nodeId: string,
      args: AaveV4BorrowArgs,
    ) => AaveV4BorrowOutputs;
    /** Read a position's current Aave v4 health factor on a spoke (WAD-scaled, 1e18; type(uint256).max with no debt) from Spoke.getUserAccountData. Exposes it as a uint256 handle for core.numericInvariant. v4 liquidates at the collateral factor that caps borrowing, so assert a buffer above 1e18 after a borrow. — original id: "aaveV4.getHealthFactor" */
    readonly getHealthFactor: (
      nodeId: string,
      args: AaveV4GetHealthFactorArgs,
    ) => AaveV4GetHealthFactorOutputs;
    /** Repay the execution proxy's debt on an Aave v4 spoke reserve with the input token, which must be the reserve's underlying. mode: 'exact' repays the input amount; mode: 'max' passes type(uint256).max so the spoke repays the whole drawn plus premium debt. Either way the spoke caps the repayment at the debt and pulls at most the input amount, so 'max' reverts when the input does not cover the debt. actualRepaid is the amount the spoke returns; residual is the unspent input. — original id: "aaveV4.repay" */
    readonly repay: (
      nodeId: string,
      args: AaveV4RepayArgs,
    ) => AaveV4RepayOutputs;
    /** Withdraw `asset` from the execution proxy's supply position on an Aave v4 spoke reserve, exposing the withdrawn amount as a Resource. mode: 'exact' withdraws `amount`; mode: 'max' passes type(uint256).max to withdraw the whole balance. The spoke caps either at the supplied balance and returns the amount it sent, which is the output. Asserts on chain that the reserve's underlying is `asset`. When the reserve is collateral, the spoke reverts if the withdrawal leaves the health factor below 1, so repay the debt first. — original id: "aaveV4.withdraw" */
    readonly withdraw: (
      nodeId: string,
      args: AaveV4WithdrawArgs,
    ) => AaveV4WithdrawOutputs;
  };
  readonly lifiIntents: {
    /** Swap or bridge tokens through a LI.FI Intents order a solver fills — original id: "lifiIntents.order" */
    readonly order: (
      nodeId: string,
      args: LifiIntentsOrderArgs,
    ) => LifiIntentsOrderOutputs;
    /** Refund a LI.FI Intents escrow order after its expiry. Anyone may call; the escrow pays the order's user. Only an order the order server reports before delivery (status Open or Signed) is refunded. — original id: "lifiIntents.refund" */
    readonly refund: (nodeId: string, args: LifiIntentsRefundArgs) => void;
    /** Step 1 of the early refund of a cross-chain LI.FI Intents order: on the order's output chain, after its fill deadline, record that the output was not filled. Keep the transaction hash for lifiIntents.refundOnNonFill. — original id: "lifiIntents.attestNonFill" */
    readonly attestNonFill: (
      nodeId: string,
      args: LifiIntentsAttestNonFillArgs,
    ) => void;
    /** Step 2 of the early refund of a cross-chain LI.FI Intents order: on the order's input chain, prove the non-fill attestation through Polymer and refund the order's user. A resolution_error means the proof is not ready yet; retry. — original id: "lifiIntents.refundOnNonFill" */
    readonly refundOnNonFill: (
      nodeId: string,
      args: LifiIntentsRefundOnNonFillArgs,
    ) => void;
  };
  /**
   * Experimental definitions, grouped like the stable ones. They carry no
   * compatibility guarantee: any release, a patch included, can change,
   * rename or remove one, or move it to its stable location. A backend that
   * does not enable one rejects the flow with `validation_error`;
   * `sdk.client.getManifest()` lists what a backend accepts.
   */
  readonly experimental: {
    readonly lifi: {
      /** Earmark funds of a flashloan-borrowed token that stay in the proxy; the flashloan runtime repays the lender from them after the program — original id: "lifi.flashloanRepay" */
      readonly flashloanRepay: (
        nodeId: string,
        args: LifiFlashloanRepayArgs,
      ) => void;
    };
  };
};

export const bindGeneratedOps = (
  builder: FlowBuilderInternal,
): GeneratedOps => ({
  core: {
    split: (nodeId: string, args: CoreSplitArgs) =>
      builder.call(nodeId, 'core.split', args, {
        a: 'resource',
        b: 'resource',
      } as const),
    splitAt: (nodeId: string, args: CoreSplitAtArgs) =>
      builder.call(nodeId, 'core.splitAt', args, {
        head: 'resource',
        tail: 'resource',
      } as const),
    partition: <const TBps extends FamilySource<CorePartitionConfig['bps']>>(
      nodeId: string,
      args: CorePartitionArgs<TBps>,
    ) =>
      builder.call(
        nodeId,
        'core.partition',
        args,
        { parts: 'resource' } as const,
        { parts: 'bps' } as const,
      ) as unknown as CorePartitionOutputs<TBps>,
    merge: (nodeId: string, args: CoreMergeArgs) =>
      builder.call(nodeId, 'core.merge', { ...args, config: {} }, {
        merged: 'resource',
      } as const),
    add: (nodeId: string, args: CoreAddArgs) =>
      builder.call(nodeId, 'core.add', { ...args, config: {} }, {
        result: 'uint256',
      } as const),
    subtract: (nodeId: string, args: CoreSubtractArgs) =>
      builder.call(nodeId, 'core.subtract', { ...args, config: {} }, {
        result: 'uint256',
      } as const),
    multiply: (nodeId: string, args: CoreMultiplyArgs) =>
      builder.call(nodeId, 'core.multiply', { ...args, config: {} }, {
        result: 'uint256',
      } as const),
    divideDown: (nodeId: string, args: CoreDivideDownArgs) =>
      builder.call(nodeId, 'core.divideDown', { ...args, config: {} }, {
        result: 'uint256',
      } as const),
    divideUp: (nodeId: string, args: CoreDivideUpArgs) =>
      builder.call(nodeId, 'core.divideUp', { ...args, config: {} }, {
        result: 'uint256',
      } as const),
    bpsDown: (nodeId: string, args: CoreBpsDownArgs) =>
      builder.call(nodeId, 'core.bpsDown', args, {
        result: 'uint256',
      } as const),
    bpsUp: (nodeId: string, args: CoreBpsUpArgs) =>
      builder.call(nodeId, 'core.bpsUp', args, { result: 'uint256' } as const),
    assertEqual: (nodeId: string, args: CoreAssertEqualArgs) =>
      builder.call(nodeId, 'core.assertEqual', { ...args, config: {} }, {}),
    assertNotEqual: (nodeId: string, args: CoreAssertNotEqualArgs) =>
      builder.call(nodeId, 'core.assertNotEqual', { ...args, config: {} }, {}),
    assertGt: (nodeId: string, args: CoreAssertGtArgs) =>
      builder.call(nodeId, 'core.assertGt', { ...args, config: {} }, {}),
    assertGte: (nodeId: string, args: CoreAssertGteArgs) =>
      builder.call(nodeId, 'core.assertGte', { ...args, config: {} }, {}),
    assertLt: (nodeId: string, args: CoreAssertLtArgs) =>
      builder.call(nodeId, 'core.assertLt', { ...args, config: {} }, {}),
    assertLte: (nodeId: string, args: CoreAssertLteArgs) =>
      builder.call(nodeId, 'core.assertLte', { ...args, config: {} }, {}),
    assertInRange: (nodeId: string, args: CoreAssertInRangeArgs) =>
      builder.call(nodeId, 'core.assertInRange', { ...args, config: {} }, {}),
    approve: (nodeId: string, args: CoreApproveArgs) =>
      builder.call(nodeId, 'core.approve', args, {}),
    balanceOf: (nodeId: string, args: CoreBalanceOfArgs) =>
      builder.call(nodeId, 'core.balanceOf', args, {
        balance: 'resource',
      } as const),
    transfer: (nodeId: string, args: CoreTransferArgs) =>
      builder.call(nodeId, 'core.transfer', args, {
        transferred: 'resource',
      } as const),
    emitEvent1: (nodeId: string, args: CoreEmitEvent1Args) =>
      builder.call(nodeId, 'core.emitEvent1', args, {}),
    emitEvent2: (nodeId: string, args: CoreEmitEvent2Args) =>
      builder.call(nodeId, 'core.emitEvent2', args, {}),
    emitEvent3: (nodeId: string, args: CoreEmitEvent3Args) =>
      builder.call(nodeId, 'core.emitEvent3', args, {}),
    emitEvent4: (nodeId: string, args: CoreEmitEvent4Args) =>
      builder.call(nodeId, 'core.emitEvent4', args, {}),
    call: <TSig extends string>(nodeId: string, args: CoreCallArgs<TSig>) => {
      const wire = buildCallWireFormat({
        resource: args.resource,
        bind: args.bind,
        config: args.config,
        guards: args.guards,
      });
      return builder.call(nodeId, wire.op, wire, {
        result: 'uint256',
      } as const) as unknown as CoreCallResult<TSig>;
    },
    staticCall: <TSig extends string>(
      nodeId: string,
      args: CoreStaticCallArgs<TSig>,
    ) =>
      builder.call(
        nodeId,
        'core.staticCall',
        buildStaticCallWireFormat({
          bind: args.bind,
          config: args.config,
          guards: args.guards,
        }),
        { result: 'uint256' } as const,
      ) as unknown as StaticCallResult<TSig>,
    rawCall: (nodeId: string, args: CoreRawCallArgs) =>
      builder.call(nodeId, 'core.rawCall', args, {
        result: 'uint256',
      } as const),
    asResource: (nodeId: string, args: CoreAsResourceArgs) =>
      builder.call(nodeId, 'core.asResource', args, {
        resource: 'resource',
      } as const),
    peek: (nodeId: string, args: CorePeekArgs) =>
      builder.call(nodeId, 'core.peek', args, { result: 'uint256' } as const),
  },
  lifi: {
    swap: (nodeId: string, args: LifiSwapArgs) =>
      builder.call(nodeId, 'lifi.swap', args, {
        amountOut: 'resource',
        unspentIn: 'resource',
      } as const),
    bridge: (nodeId: string, args: LifiBridgeArgs) =>
      builder.call(nodeId, 'lifi.bridge', args, {
        amountOut: 'resource',
        unspentIn: 'resource',
      } as const),
    zap: (nodeId: string, args: LifiZapArgs) =>
      builder.call(nodeId, 'lifi.zap', args, {
        amountOut: 'resource',
      } as const),
    zapAsync: (nodeId: string, args: LifiZapAsyncArgs) =>
      builder.call(nodeId, 'lifi.zapAsync', args, {
        amountOut: 'resource',
      } as const),
  },
  invariant: {
    balanceAtLeast: (nodeId: string, args: InvariantBalanceAtLeastArgs) =>
      builder.call(
        nodeId,
        'invariant.balanceAtLeast',
        { ...args, config: {} },
        {},
      ),
    balanceEquals: (nodeId: string, args: InvariantBalanceEqualsArgs) =>
      builder.call(
        nodeId,
        'invariant.balanceEquals',
        { ...args, config: {} },
        {},
      ),
    balanceAtMost: (nodeId: string, args: InvariantBalanceAtMostArgs) =>
      builder.call(
        nodeId,
        'invariant.balanceAtMost',
        { ...args, config: {} },
        {},
      ),
    balanceInRange: (nodeId: string, args: InvariantBalanceInRangeArgs) =>
      builder.call(
        nodeId,
        'invariant.balanceInRange',
        { ...args, config: {} },
        {},
      ),
    allowanceAtLeast: (nodeId: string, args: InvariantAllowanceAtLeastArgs) =>
      builder.call(
        nodeId,
        'invariant.allowanceAtLeast',
        { ...args, config: {} },
        {},
      ),
    allowanceEquals: (nodeId: string, args: InvariantAllowanceEqualsArgs) =>
      builder.call(
        nodeId,
        'invariant.allowanceEquals',
        { ...args, config: {} },
        {},
      ),
    allowanceAtMost: (nodeId: string, args: InvariantAllowanceAtMostArgs) =>
      builder.call(
        nodeId,
        'invariant.allowanceAtMost',
        { ...args, config: {} },
        {},
      ),
    allowanceInRange: (nodeId: string, args: InvariantAllowanceInRangeArgs) =>
      builder.call(
        nodeId,
        'invariant.allowanceInRange',
        { ...args, config: {} },
        {},
      ),
    numeric: (nodeId: string, args: InvariantNumericArgs) =>
      builder.call(nodeId, 'invariant.numeric', args, {}),
    numericInRange: (nodeId: string, args: InvariantNumericInRangeArgs) =>
      builder.call(nodeId, 'invariant.numericInRange', args, {}),
    gte: (nodeId: string, args: InvariantGteArgs) =>
      builder.call(nodeId, 'invariant.gte', args, {}),
    gt: (nodeId: string, args: InvariantGtArgs) =>
      builder.call(nodeId, 'invariant.gt', args, {}),
    lte: (nodeId: string, args: InvariantLteArgs) =>
      builder.call(nodeId, 'invariant.lte', args, {}),
    lt: (nodeId: string, args: InvariantLtArgs) =>
      builder.call(nodeId, 'invariant.lt', args, {}),
    eq: (nodeId: string, args: InvariantEqArgs) =>
      builder.call(nodeId, 'invariant.eq', args, {}),
    neq: (nodeId: string, args: InvariantNeqArgs) =>
      builder.call(nodeId, 'invariant.neq', args, {}),
  },
  aave: {
    borrow: (nodeId: string, args: AaveBorrowArgs) =>
      builder.call(nodeId, 'aave.borrow', args, {
        borrowed: 'resource',
        debtBalance: 'uint256',
      } as const),
    repay: (nodeId: string, args: AaveRepayArgs) =>
      builder.call(nodeId, 'aave.repay', args, {
        actualRepaid: 'uint256',
        residual: 'resource',
      } as const),
    repayWithATokens: (nodeId: string, args: AaveRepayWithATokensArgs) =>
      builder.call(nodeId, 'aave.repayWithATokens', args, {
        actualRepaid: 'uint256',
        residual: 'resource',
      } as const),
    claimRewards: (nodeId: string, args: AaveClaimRewardsArgs) =>
      builder.call(nodeId, 'aave.claimRewards', args, {
        claimed: 'resource',
        claimedAmount: 'uint256',
      } as const),
    setEMode: (nodeId: string, args: AaveSetEModeArgs) =>
      builder.call(nodeId, 'aave.setEMode', args, {}),
    getHealthFactor: (nodeId: string, args: AaveGetHealthFactorArgs) =>
      builder.call(nodeId, 'aave.getHealthFactor', args, {
        healthFactor: 'uint256',
      } as const),
  },
  morphoBlue: {
    supplyCollateral: (nodeId: string, args: MorphoBlueSupplyCollateralArgs) =>
      builder.call(nodeId, 'morphoBlue.supplyCollateral', args, {}),
    withdrawCollateral: (
      nodeId: string,
      args: MorphoBlueWithdrawCollateralArgs,
    ) =>
      builder.call(nodeId, 'morphoBlue.withdrawCollateral', args, {
        withdrawn: 'resource',
        collateralWithdrawn: 'uint256',
      } as const),
    borrow: (nodeId: string, args: MorphoBlueBorrowArgs) =>
      builder.call(nodeId, 'morphoBlue.borrow', args, {
        borrowed: 'resource',
        assetsBorrowed: 'uint256',
        sharesBorrowed: 'uint256',
      } as const),
    repay: (nodeId: string, args: MorphoBlueRepayArgs) =>
      builder.call(nodeId, 'morphoBlue.repay', args, {
        actualRepaid: 'uint256',
        sharesRepaid: 'uint256',
        residual: 'resource',
      } as const),
    supply: (nodeId: string, args: MorphoBlueSupplyArgs) =>
      builder.call(nodeId, 'morphoBlue.supply', args, {
        assetsSupplied: 'uint256',
        sharesSupplied: 'uint256',
        residual: 'resource',
      } as const),
    withdraw: (nodeId: string, args: MorphoBlueWithdrawArgs) =>
      builder.call(nodeId, 'morphoBlue.withdraw', args, {
        withdrawn: 'resource',
        assetsWithdrawn: 'uint256',
        sharesWithdrawn: 'uint256',
      } as const),
    getPosition: (nodeId: string, args: MorphoBlueGetPositionArgs) =>
      builder.call(nodeId, 'morphoBlue.getPosition', args, {
        supplyShares: 'uint256',
        borrowShares: 'uint128',
        collateral: 'uint128',
      } as const),
  },
  continuation: {
    settle: <
      const TOutcomes extends FamilySource<
        ContinuationSettleConfig['outcomes']
      >,
    >(
      nodeId: string,
      args: ContinuationSettleArgs<TOutcomes>,
    ) =>
      builder.call(
        nodeId,
        'continuation.settle',
        args,
        { outcomes: 'resource' } as const,
        { outcomes: 'outcomes' } as const,
      ) as unknown as ContinuationSettleOutputs<TOutcomes>,
  },
  paraswap: {
    buy: (nodeId: string, args: ParaswapBuyArgs) =>
      builder.call(nodeId, 'paraswap.buy', args, {
        amountOut: 'resource',
        unspentIn: 'resource',
      } as const),
  },
  fly: {
    swap: (nodeId: string, args: FlySwapArgs) =>
      builder.call(nodeId, 'fly.swap', args, {
        amountOut: 'resource',
        unspentIn: 'resource',
      } as const),
  },
  uniswapV2: {
    addLiquidity: (nodeId: string, args: UniswapV2AddLiquidityArgs) =>
      builder.call(nodeId, 'uniswapV2.addLiquidity', args, {
        liquidity: 'resource',
        residualA: 'resource',
        residualB: 'resource',
        poolPrice: 'uint256',
      } as const),
    removeLiquidity: (nodeId: string, args: UniswapV2RemoveLiquidityArgs) =>
      builder.call(nodeId, 'uniswapV2.removeLiquidity', args, {
        tokenA: 'resource',
        tokenB: 'resource',
      } as const),
  },
  uniswapV3: {
    mint: (nodeId: string, args: UniswapV3MintArgs) =>
      builder.call(nodeId, 'uniswapV3.mint', args, {
        tokenId: 'uint256',
        liquidity: 'uint256',
        sqrtPriceX96: 'uint256',
        residualA: 'resource',
        residualB: 'resource',
      } as const),
    increaseLiquidity: (nodeId: string, args: UniswapV3IncreaseLiquidityArgs) =>
      builder.call(nodeId, 'uniswapV3.increaseLiquidity', args, {
        liquidity: 'uint256',
        sqrtPriceX96: 'uint256',
        residualA: 'resource',
        residualB: 'resource',
      } as const),
  },
  aaveV4: {
    supply: (nodeId: string, args: AaveV4SupplyArgs) =>
      builder.call(nodeId, 'aaveV4.supply', args, {}),
    supplyCollateral: (nodeId: string, args: AaveV4SupplyCollateralArgs) =>
      builder.call(nodeId, 'aaveV4.supplyCollateral', args, {}),
    setUsingAsCollateral: (
      nodeId: string,
      args: AaveV4SetUsingAsCollateralArgs,
    ) => builder.call(nodeId, 'aaveV4.setUsingAsCollateral', args, {}),
    borrow: (nodeId: string, args: AaveV4BorrowArgs) =>
      builder.call(nodeId, 'aaveV4.borrow', args, {
        borrowed: 'resource',
        debtBalance: 'uint256',
      } as const),
    getHealthFactor: (nodeId: string, args: AaveV4GetHealthFactorArgs) =>
      builder.call(nodeId, 'aaveV4.getHealthFactor', args, {
        healthFactor: 'uint256',
      } as const),
    repay: (nodeId: string, args: AaveV4RepayArgs) =>
      builder.call(nodeId, 'aaveV4.repay', args, {
        actualRepaid: 'uint256',
        residual: 'resource',
      } as const),
    withdraw: (nodeId: string, args: AaveV4WithdrawArgs) =>
      builder.call(nodeId, 'aaveV4.withdraw', args, {
        withdrawn: 'resource',
      } as const),
  },
  lifiIntents: {
    order: (nodeId: string, args: LifiIntentsOrderArgs) =>
      builder.call(nodeId, 'lifiIntents.order', args, {
        amountOut: 'resource',
        unspentIn: 'resource',
      } as const),
    refund: (nodeId: string, args: LifiIntentsRefundArgs) =>
      builder.call(nodeId, 'lifiIntents.refund', args, {}),
    attestNonFill: (nodeId: string, args: LifiIntentsAttestNonFillArgs) =>
      builder.call(nodeId, 'lifiIntents.attestNonFill', args, {}),
    refundOnNonFill: (nodeId: string, args: LifiIntentsRefundOnNonFillArgs) =>
      builder.call(nodeId, 'lifiIntents.refundOnNonFill', args, {}),
  },
  experimental: {
    lifi: {
      flashloanRepay: (nodeId: string, args: LifiFlashloanRepayArgs) =>
        builder.call(nodeId, 'lifi.flashloanRepay', args, {}),
    },
  },
});
