@lifi/composer-sdk 0.7.0 → 0.7.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.
@@ -2,7 +2,7 @@ import { FlowBuilderInternal } from '../authoring/FlowBuilderCore.cjs';
2
2
  import { Bindable, OutputHandle, FamilySource, FamilyCount, OutputFamilyHandles } from '../authoring/handles.cjs';
3
3
  import { SignatureBind, CoreCallResult, StaticCallResult } from '../authoring/signatureArgs.cjs';
4
4
  import { TypedGuard } from '../types.cjs';
5
- import { CoreSplitConfig, CorePartitionConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreApproveConfig, CoreBalanceOfConfig, CoreTransferConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreCallConfig, CoreStaticCallConfig, CoreRawCallConfig, CoreAsResourceConfig, CorePeekConfig, LifiSwapConfig, LifiBridgeConfig, LifiZapConfig, LifiZapAsyncConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, InvariantGteConfig, InvariantGtConfig, InvariantLteConfig, InvariantLtConfig, InvariantEqConfig, InvariantNeqConfig, AaveBorrowConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveClaimRewardsConfig, AaveSetEModeConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueWithdrawCollateralConfig, ParaswapBuyConfig, FlySwapConfig } from './config.generated.cjs';
5
+ import { CoreSplitConfig, CorePartitionConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreApproveConfig, CoreBalanceOfConfig, CoreTransferConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreCallConfig, CoreStaticCallConfig, CoreRawCallConfig, CoreAsResourceConfig, CorePeekConfig, LifiSwapConfig, LifiBridgeConfig, LifiZapConfig, LifiZapAsyncConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, InvariantGteConfig, InvariantGtConfig, InvariantLteConfig, InvariantLtConfig, InvariantEqConfig, InvariantNeqConfig, AaveBorrowConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveClaimRewardsConfig, AaveSetEModeConfig, AaveGetHealthFactorConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueBorrowConfig, MorphoBlueRepayConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawConfig, MorphoBlueGetPositionConfig, ParaswapBuyConfig, FlySwapConfig } from './config.generated.cjs';
6
6
  import '@lifi/compose-spec';
7
7
  import 'abitype';
8
8
 
@@ -422,6 +422,12 @@ interface AaveSetEModeArgs {
422
422
  readonly config: AaveSetEModeConfig;
423
423
  readonly guards?: readonly TypedGuard<never>[];
424
424
  }
425
+ /** 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. */
426
+ interface AaveGetHealthFactorArgs {
427
+ readonly bind: Record<string, never>;
428
+ readonly config: AaveGetHealthFactorConfig;
429
+ readonly guards?: readonly TypedGuard<'healthFactor'>[];
430
+ }
425
431
  /** Deposit the collateral asset of a Morpho Blue market on behalf of the execution proxy. 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). */
426
432
  interface MorphoBlueSupplyCollateralArgs {
427
433
  readonly bind: {
@@ -436,6 +442,41 @@ interface MorphoBlueWithdrawCollateralArgs {
436
442
  readonly config: MorphoBlueWithdrawCollateralConfig;
437
443
  readonly guards?: readonly TypedGuard<'collateralWithdrawn'>[];
438
444
  }
445
+ /** 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. */
446
+ interface MorphoBlueBorrowArgs {
447
+ readonly bind: Record<string, never>;
448
+ readonly config: MorphoBlueBorrowConfig;
449
+ readonly guards?: readonly TypedGuard<'assetsBorrowed' | 'sharesBorrowed'>[];
450
+ }
451
+ /** 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. */
452
+ interface MorphoBlueRepayArgs {
453
+ readonly bind: {
454
+ readonly assetIn: Bindable<'resource'>;
455
+ readonly onBehalfOf: Bindable<'address'>;
456
+ };
457
+ readonly config: MorphoBlueRepayConfig;
458
+ readonly guards?: readonly TypedGuard<'actualRepaid' | 'sharesRepaid' | 'residual'>[];
459
+ }
460
+ /** 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. */
461
+ interface MorphoBlueSupplyArgs {
462
+ readonly bind: {
463
+ readonly assetIn: Bindable<'resource'>;
464
+ };
465
+ readonly config: MorphoBlueSupplyConfig;
466
+ readonly guards?: readonly TypedGuard<'assetsSupplied' | 'sharesSupplied' | 'residual'>[];
467
+ }
468
+ /** 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. */
469
+ interface MorphoBlueWithdrawArgs {
470
+ readonly bind: Record<string, never>;
471
+ readonly config: MorphoBlueWithdrawConfig;
472
+ readonly guards?: readonly TypedGuard<'assetsWithdrawn' | 'sharesWithdrawn'>[];
473
+ }
474
+ /** 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). */
475
+ interface MorphoBlueGetPositionArgs {
476
+ readonly bind: Record<string, never>;
477
+ readonly config: MorphoBlueGetPositionConfig;
478
+ readonly guards?: readonly TypedGuard<'supplyShares' | 'borrowShares' | 'collateral'>[];
479
+ }
439
480
  /** Route tokens into a DeFi protocol position via the edge catalog */
440
481
  interface LifiZapArgs {
441
482
  readonly bind: {
@@ -544,10 +585,38 @@ interface AaveClaimRewardsOutputs {
544
585
  readonly claimed: OutputHandle<'resource'>;
545
586
  readonly claimedAmount: OutputHandle<'uint256'>;
546
587
  }
588
+ interface AaveGetHealthFactorOutputs {
589
+ readonly healthFactor: OutputHandle<'uint256'>;
590
+ }
547
591
  interface MorphoBlueWithdrawCollateralOutputs {
548
592
  readonly withdrawn: OutputHandle<'resource'>;
549
593
  readonly collateralWithdrawn: OutputHandle<'uint256'>;
550
594
  }
595
+ interface MorphoBlueBorrowOutputs {
596
+ readonly borrowed: OutputHandle<'resource'>;
597
+ readonly assetsBorrowed: OutputHandle<'uint256'>;
598
+ readonly sharesBorrowed: OutputHandle<'uint256'>;
599
+ }
600
+ interface MorphoBlueRepayOutputs {
601
+ readonly actualRepaid: OutputHandle<'uint256'>;
602
+ readonly sharesRepaid: OutputHandle<'uint256'>;
603
+ readonly residual: OutputHandle<'resource'>;
604
+ }
605
+ interface MorphoBlueSupplyOutputs {
606
+ readonly assetsSupplied: OutputHandle<'uint256'>;
607
+ readonly sharesSupplied: OutputHandle<'uint256'>;
608
+ readonly residual: OutputHandle<'resource'>;
609
+ }
610
+ interface MorphoBlueWithdrawOutputs {
611
+ readonly withdrawn: OutputHandle<'resource'>;
612
+ readonly assetsWithdrawn: OutputHandle<'uint256'>;
613
+ readonly sharesWithdrawn: OutputHandle<'uint256'>;
614
+ }
615
+ interface MorphoBlueGetPositionOutputs {
616
+ readonly supplyShares: OutputHandle<'uint256'>;
617
+ readonly borrowShares: OutputHandle<'uint128'>;
618
+ readonly collateral: OutputHandle<'uint128'>;
619
+ }
551
620
  interface LifiZapOutputs {
552
621
  readonly amountOut: OutputHandle<'resource'>;
553
622
  }
@@ -681,12 +750,24 @@ type GeneratedOps = {
681
750
  readonly claimRewards: (nodeId: string, args: AaveClaimRewardsArgs) => AaveClaimRewardsOutputs;
682
751
  /** 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. — original id: "aave.setEMode" */
683
752
  readonly setEMode: (nodeId: string, args: AaveSetEModeArgs) => void;
753
+ /** 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" */
754
+ readonly getHealthFactor: (nodeId: string, args: AaveGetHealthFactorArgs) => AaveGetHealthFactorOutputs;
684
755
  };
685
756
  readonly morphoBlue: {
686
757
  /** Deposit the collateral asset of a Morpho Blue market on behalf of the execution proxy. 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" */
687
758
  readonly supplyCollateral: (nodeId: string, args: MorphoBlueSupplyCollateralArgs) => void;
688
759
  /** 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" */
689
760
  readonly withdrawCollateral: (nodeId: string, args: MorphoBlueWithdrawCollateralArgs) => MorphoBlueWithdrawCollateralOutputs;
761
+ /** 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" */
762
+ readonly borrow: (nodeId: string, args: MorphoBlueBorrowArgs) => MorphoBlueBorrowOutputs;
763
+ /** 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" */
764
+ readonly repay: (nodeId: string, args: MorphoBlueRepayArgs) => MorphoBlueRepayOutputs;
765
+ /** 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" */
766
+ readonly supply: (nodeId: string, args: MorphoBlueSupplyArgs) => MorphoBlueSupplyOutputs;
767
+ /** 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" */
768
+ readonly withdraw: (nodeId: string, args: MorphoBlueWithdrawArgs) => MorphoBlueWithdrawOutputs;
769
+ /** 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" */
770
+ readonly getPosition: (nodeId: string, args: MorphoBlueGetPositionArgs) => MorphoBlueGetPositionOutputs;
690
771
  };
691
772
  readonly paraswap: {
692
773
  /** 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" */
@@ -699,4 +780,4 @@ type GeneratedOps = {
699
780
  };
700
781
  declare const bindGeneratedOps: (builder: FlowBuilderInternal) => GeneratedOps;
701
782
 
702
- export { type AaveBorrowArgs, type AaveBorrowOutputs, type AaveClaimRewardsArgs, type AaveClaimRewardsOutputs, type AaveRepayArgs, type AaveRepayOutputs, type AaveRepayWithATokensArgs, type AaveRepayWithATokensOutputs, type AaveSetEModeArgs, type CoreAddArgs, type CoreAddOutputs, type CoreApproveArgs, type CoreAsResourceArgs, type CoreAsResourceOutputs, type CoreAssertEqualArgs, type CoreAssertGtArgs, type CoreAssertGteArgs, type CoreAssertInRangeArgs, type CoreAssertLtArgs, type CoreAssertLteArgs, type CoreAssertNotEqualArgs, type CoreBalanceOfArgs, type CoreBalanceOfOutputs, type CoreBpsDownArgs, type CoreBpsDownOutputs, type CoreBpsUpArgs, type CoreBpsUpOutputs, type CoreCallArgs, type CoreDivideDownArgs, type CoreDivideDownOutputs, type CoreDivideUpArgs, type CoreDivideUpOutputs, type CoreEmitEvent1Args, type CoreEmitEvent2Args, type CoreEmitEvent3Args, type CoreEmitEvent4Args, type CoreMergeArgs, type CoreMergeOutputs, type CoreMultiplyArgs, type CoreMultiplyOutputs, type CorePartitionArgs, type CorePartitionOutputs, type CorePeekArgs, type CorePeekOutputs, type CoreRawCallArgs, type CoreRawCallOutputs, type CoreSplitArgs, type CoreSplitOutputs, type CoreStaticCallArgs, type CoreSubtractArgs, type CoreSubtractOutputs, type CoreTransferArgs, type CoreTransferOutputs, type FlySwapArgs, type FlySwapOutputs, type GeneratedOps, type InvariantAllowanceAtLeastArgs, type InvariantAllowanceAtMostArgs, type InvariantAllowanceEqualsArgs, type InvariantAllowanceInRangeArgs, type InvariantBalanceAtLeastArgs, type InvariantBalanceAtMostArgs, type InvariantBalanceEqualsArgs, type InvariantBalanceInRangeArgs, type InvariantEqArgs, type InvariantGtArgs, type InvariantGteArgs, type InvariantLtArgs, type InvariantLteArgs, type InvariantNeqArgs, type InvariantNumericArgs, type InvariantNumericInRangeArgs, type LifiBridgeArgs, type LifiBridgeOutputs, type LifiSwapArgs, type LifiSwapOutputs, type LifiZapArgs, type LifiZapAsyncArgs, type LifiZapAsyncOutputs, type LifiZapOutputs, type MorphoBlueSupplyCollateralArgs, type MorphoBlueWithdrawCollateralArgs, type MorphoBlueWithdrawCollateralOutputs, type ParaswapBuyArgs, type ParaswapBuyOutputs, bindGeneratedOps };
783
+ export { type AaveBorrowArgs, type AaveBorrowOutputs, type AaveClaimRewardsArgs, type AaveClaimRewardsOutputs, type AaveGetHealthFactorArgs, type AaveGetHealthFactorOutputs, type AaveRepayArgs, type AaveRepayOutputs, type AaveRepayWithATokensArgs, type AaveRepayWithATokensOutputs, type AaveSetEModeArgs, type CoreAddArgs, type CoreAddOutputs, type CoreApproveArgs, type CoreAsResourceArgs, type CoreAsResourceOutputs, type CoreAssertEqualArgs, type CoreAssertGtArgs, type CoreAssertGteArgs, type CoreAssertInRangeArgs, type CoreAssertLtArgs, type CoreAssertLteArgs, type CoreAssertNotEqualArgs, type CoreBalanceOfArgs, type CoreBalanceOfOutputs, type CoreBpsDownArgs, type CoreBpsDownOutputs, type CoreBpsUpArgs, type CoreBpsUpOutputs, type CoreCallArgs, type CoreDivideDownArgs, type CoreDivideDownOutputs, type CoreDivideUpArgs, type CoreDivideUpOutputs, type CoreEmitEvent1Args, type CoreEmitEvent2Args, type CoreEmitEvent3Args, type CoreEmitEvent4Args, type CoreMergeArgs, type CoreMergeOutputs, type CoreMultiplyArgs, type CoreMultiplyOutputs, type CorePartitionArgs, type CorePartitionOutputs, type CorePeekArgs, type CorePeekOutputs, type CoreRawCallArgs, type CoreRawCallOutputs, type CoreSplitArgs, type CoreSplitOutputs, type CoreStaticCallArgs, type CoreSubtractArgs, type CoreSubtractOutputs, type CoreTransferArgs, type CoreTransferOutputs, type FlySwapArgs, type FlySwapOutputs, type GeneratedOps, type InvariantAllowanceAtLeastArgs, type InvariantAllowanceAtMostArgs, type InvariantAllowanceEqualsArgs, type InvariantAllowanceInRangeArgs, type InvariantBalanceAtLeastArgs, type InvariantBalanceAtMostArgs, type InvariantBalanceEqualsArgs, type InvariantBalanceInRangeArgs, type InvariantEqArgs, type InvariantGtArgs, type InvariantGteArgs, type InvariantLtArgs, type InvariantLteArgs, type InvariantNeqArgs, type InvariantNumericArgs, type InvariantNumericInRangeArgs, type LifiBridgeArgs, type LifiBridgeOutputs, type LifiSwapArgs, type LifiSwapOutputs, type LifiZapArgs, type LifiZapAsyncArgs, type LifiZapAsyncOutputs, type LifiZapOutputs, type MorphoBlueBorrowArgs, type MorphoBlueBorrowOutputs, type MorphoBlueGetPositionArgs, type MorphoBlueGetPositionOutputs, type MorphoBlueRepayArgs, type MorphoBlueRepayOutputs, type MorphoBlueSupplyArgs, type MorphoBlueSupplyCollateralArgs, type MorphoBlueSupplyOutputs, type MorphoBlueWithdrawArgs, type MorphoBlueWithdrawCollateralArgs, type MorphoBlueWithdrawCollateralOutputs, type MorphoBlueWithdrawOutputs, type ParaswapBuyArgs, type ParaswapBuyOutputs, bindGeneratedOps };
@@ -2,7 +2,7 @@ import { FlowBuilderInternal } from '../authoring/FlowBuilderCore.js';
2
2
  import { Bindable, OutputHandle, FamilySource, FamilyCount, OutputFamilyHandles } from '../authoring/handles.js';
3
3
  import { SignatureBind, CoreCallResult, StaticCallResult } from '../authoring/signatureArgs.js';
4
4
  import { TypedGuard } from '../types.js';
5
- import { CoreSplitConfig, CorePartitionConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreApproveConfig, CoreBalanceOfConfig, CoreTransferConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreCallConfig, CoreStaticCallConfig, CoreRawCallConfig, CoreAsResourceConfig, CorePeekConfig, LifiSwapConfig, LifiBridgeConfig, LifiZapConfig, LifiZapAsyncConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, InvariantGteConfig, InvariantGtConfig, InvariantLteConfig, InvariantLtConfig, InvariantEqConfig, InvariantNeqConfig, AaveBorrowConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveClaimRewardsConfig, AaveSetEModeConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueWithdrawCollateralConfig, ParaswapBuyConfig, FlySwapConfig } from './config.generated.js';
5
+ import { CoreSplitConfig, CorePartitionConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreApproveConfig, CoreBalanceOfConfig, CoreTransferConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreCallConfig, CoreStaticCallConfig, CoreRawCallConfig, CoreAsResourceConfig, CorePeekConfig, LifiSwapConfig, LifiBridgeConfig, LifiZapConfig, LifiZapAsyncConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, InvariantGteConfig, InvariantGtConfig, InvariantLteConfig, InvariantLtConfig, InvariantEqConfig, InvariantNeqConfig, AaveBorrowConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveClaimRewardsConfig, AaveSetEModeConfig, AaveGetHealthFactorConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueBorrowConfig, MorphoBlueRepayConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawConfig, MorphoBlueGetPositionConfig, ParaswapBuyConfig, FlySwapConfig } from './config.generated.js';
6
6
  import '@lifi/compose-spec';
7
7
  import 'abitype';
8
8
 
@@ -422,6 +422,12 @@ interface AaveSetEModeArgs {
422
422
  readonly config: AaveSetEModeConfig;
423
423
  readonly guards?: readonly TypedGuard<never>[];
424
424
  }
425
+ /** 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. */
426
+ interface AaveGetHealthFactorArgs {
427
+ readonly bind: Record<string, never>;
428
+ readonly config: AaveGetHealthFactorConfig;
429
+ readonly guards?: readonly TypedGuard<'healthFactor'>[];
430
+ }
425
431
  /** Deposit the collateral asset of a Morpho Blue market on behalf of the execution proxy. 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). */
426
432
  interface MorphoBlueSupplyCollateralArgs {
427
433
  readonly bind: {
@@ -436,6 +442,41 @@ interface MorphoBlueWithdrawCollateralArgs {
436
442
  readonly config: MorphoBlueWithdrawCollateralConfig;
437
443
  readonly guards?: readonly TypedGuard<'collateralWithdrawn'>[];
438
444
  }
445
+ /** 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. */
446
+ interface MorphoBlueBorrowArgs {
447
+ readonly bind: Record<string, never>;
448
+ readonly config: MorphoBlueBorrowConfig;
449
+ readonly guards?: readonly TypedGuard<'assetsBorrowed' | 'sharesBorrowed'>[];
450
+ }
451
+ /** 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. */
452
+ interface MorphoBlueRepayArgs {
453
+ readonly bind: {
454
+ readonly assetIn: Bindable<'resource'>;
455
+ readonly onBehalfOf: Bindable<'address'>;
456
+ };
457
+ readonly config: MorphoBlueRepayConfig;
458
+ readonly guards?: readonly TypedGuard<'actualRepaid' | 'sharesRepaid' | 'residual'>[];
459
+ }
460
+ /** 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. */
461
+ interface MorphoBlueSupplyArgs {
462
+ readonly bind: {
463
+ readonly assetIn: Bindable<'resource'>;
464
+ };
465
+ readonly config: MorphoBlueSupplyConfig;
466
+ readonly guards?: readonly TypedGuard<'assetsSupplied' | 'sharesSupplied' | 'residual'>[];
467
+ }
468
+ /** 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. */
469
+ interface MorphoBlueWithdrawArgs {
470
+ readonly bind: Record<string, never>;
471
+ readonly config: MorphoBlueWithdrawConfig;
472
+ readonly guards?: readonly TypedGuard<'assetsWithdrawn' | 'sharesWithdrawn'>[];
473
+ }
474
+ /** 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). */
475
+ interface MorphoBlueGetPositionArgs {
476
+ readonly bind: Record<string, never>;
477
+ readonly config: MorphoBlueGetPositionConfig;
478
+ readonly guards?: readonly TypedGuard<'supplyShares' | 'borrowShares' | 'collateral'>[];
479
+ }
439
480
  /** Route tokens into a DeFi protocol position via the edge catalog */
440
481
  interface LifiZapArgs {
441
482
  readonly bind: {
@@ -544,10 +585,38 @@ interface AaveClaimRewardsOutputs {
544
585
  readonly claimed: OutputHandle<'resource'>;
545
586
  readonly claimedAmount: OutputHandle<'uint256'>;
546
587
  }
588
+ interface AaveGetHealthFactorOutputs {
589
+ readonly healthFactor: OutputHandle<'uint256'>;
590
+ }
547
591
  interface MorphoBlueWithdrawCollateralOutputs {
548
592
  readonly withdrawn: OutputHandle<'resource'>;
549
593
  readonly collateralWithdrawn: OutputHandle<'uint256'>;
550
594
  }
595
+ interface MorphoBlueBorrowOutputs {
596
+ readonly borrowed: OutputHandle<'resource'>;
597
+ readonly assetsBorrowed: OutputHandle<'uint256'>;
598
+ readonly sharesBorrowed: OutputHandle<'uint256'>;
599
+ }
600
+ interface MorphoBlueRepayOutputs {
601
+ readonly actualRepaid: OutputHandle<'uint256'>;
602
+ readonly sharesRepaid: OutputHandle<'uint256'>;
603
+ readonly residual: OutputHandle<'resource'>;
604
+ }
605
+ interface MorphoBlueSupplyOutputs {
606
+ readonly assetsSupplied: OutputHandle<'uint256'>;
607
+ readonly sharesSupplied: OutputHandle<'uint256'>;
608
+ readonly residual: OutputHandle<'resource'>;
609
+ }
610
+ interface MorphoBlueWithdrawOutputs {
611
+ readonly withdrawn: OutputHandle<'resource'>;
612
+ readonly assetsWithdrawn: OutputHandle<'uint256'>;
613
+ readonly sharesWithdrawn: OutputHandle<'uint256'>;
614
+ }
615
+ interface MorphoBlueGetPositionOutputs {
616
+ readonly supplyShares: OutputHandle<'uint256'>;
617
+ readonly borrowShares: OutputHandle<'uint128'>;
618
+ readonly collateral: OutputHandle<'uint128'>;
619
+ }
551
620
  interface LifiZapOutputs {
552
621
  readonly amountOut: OutputHandle<'resource'>;
553
622
  }
@@ -681,12 +750,24 @@ type GeneratedOps = {
681
750
  readonly claimRewards: (nodeId: string, args: AaveClaimRewardsArgs) => AaveClaimRewardsOutputs;
682
751
  /** 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. — original id: "aave.setEMode" */
683
752
  readonly setEMode: (nodeId: string, args: AaveSetEModeArgs) => void;
753
+ /** 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" */
754
+ readonly getHealthFactor: (nodeId: string, args: AaveGetHealthFactorArgs) => AaveGetHealthFactorOutputs;
684
755
  };
685
756
  readonly morphoBlue: {
686
757
  /** Deposit the collateral asset of a Morpho Blue market on behalf of the execution proxy. 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" */
687
758
  readonly supplyCollateral: (nodeId: string, args: MorphoBlueSupplyCollateralArgs) => void;
688
759
  /** 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" */
689
760
  readonly withdrawCollateral: (nodeId: string, args: MorphoBlueWithdrawCollateralArgs) => MorphoBlueWithdrawCollateralOutputs;
761
+ /** 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" */
762
+ readonly borrow: (nodeId: string, args: MorphoBlueBorrowArgs) => MorphoBlueBorrowOutputs;
763
+ /** 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" */
764
+ readonly repay: (nodeId: string, args: MorphoBlueRepayArgs) => MorphoBlueRepayOutputs;
765
+ /** 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" */
766
+ readonly supply: (nodeId: string, args: MorphoBlueSupplyArgs) => MorphoBlueSupplyOutputs;
767
+ /** 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" */
768
+ readonly withdraw: (nodeId: string, args: MorphoBlueWithdrawArgs) => MorphoBlueWithdrawOutputs;
769
+ /** 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" */
770
+ readonly getPosition: (nodeId: string, args: MorphoBlueGetPositionArgs) => MorphoBlueGetPositionOutputs;
690
771
  };
691
772
  readonly paraswap: {
692
773
  /** 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" */
@@ -699,4 +780,4 @@ type GeneratedOps = {
699
780
  };
700
781
  declare const bindGeneratedOps: (builder: FlowBuilderInternal) => GeneratedOps;
701
782
 
702
- export { type AaveBorrowArgs, type AaveBorrowOutputs, type AaveClaimRewardsArgs, type AaveClaimRewardsOutputs, type AaveRepayArgs, type AaveRepayOutputs, type AaveRepayWithATokensArgs, type AaveRepayWithATokensOutputs, type AaveSetEModeArgs, type CoreAddArgs, type CoreAddOutputs, type CoreApproveArgs, type CoreAsResourceArgs, type CoreAsResourceOutputs, type CoreAssertEqualArgs, type CoreAssertGtArgs, type CoreAssertGteArgs, type CoreAssertInRangeArgs, type CoreAssertLtArgs, type CoreAssertLteArgs, type CoreAssertNotEqualArgs, type CoreBalanceOfArgs, type CoreBalanceOfOutputs, type CoreBpsDownArgs, type CoreBpsDownOutputs, type CoreBpsUpArgs, type CoreBpsUpOutputs, type CoreCallArgs, type CoreDivideDownArgs, type CoreDivideDownOutputs, type CoreDivideUpArgs, type CoreDivideUpOutputs, type CoreEmitEvent1Args, type CoreEmitEvent2Args, type CoreEmitEvent3Args, type CoreEmitEvent4Args, type CoreMergeArgs, type CoreMergeOutputs, type CoreMultiplyArgs, type CoreMultiplyOutputs, type CorePartitionArgs, type CorePartitionOutputs, type CorePeekArgs, type CorePeekOutputs, type CoreRawCallArgs, type CoreRawCallOutputs, type CoreSplitArgs, type CoreSplitOutputs, type CoreStaticCallArgs, type CoreSubtractArgs, type CoreSubtractOutputs, type CoreTransferArgs, type CoreTransferOutputs, type FlySwapArgs, type FlySwapOutputs, type GeneratedOps, type InvariantAllowanceAtLeastArgs, type InvariantAllowanceAtMostArgs, type InvariantAllowanceEqualsArgs, type InvariantAllowanceInRangeArgs, type InvariantBalanceAtLeastArgs, type InvariantBalanceAtMostArgs, type InvariantBalanceEqualsArgs, type InvariantBalanceInRangeArgs, type InvariantEqArgs, type InvariantGtArgs, type InvariantGteArgs, type InvariantLtArgs, type InvariantLteArgs, type InvariantNeqArgs, type InvariantNumericArgs, type InvariantNumericInRangeArgs, type LifiBridgeArgs, type LifiBridgeOutputs, type LifiSwapArgs, type LifiSwapOutputs, type LifiZapArgs, type LifiZapAsyncArgs, type LifiZapAsyncOutputs, type LifiZapOutputs, type MorphoBlueSupplyCollateralArgs, type MorphoBlueWithdrawCollateralArgs, type MorphoBlueWithdrawCollateralOutputs, type ParaswapBuyArgs, type ParaswapBuyOutputs, bindGeneratedOps };
783
+ export { type AaveBorrowArgs, type AaveBorrowOutputs, type AaveClaimRewardsArgs, type AaveClaimRewardsOutputs, type AaveGetHealthFactorArgs, type AaveGetHealthFactorOutputs, type AaveRepayArgs, type AaveRepayOutputs, type AaveRepayWithATokensArgs, type AaveRepayWithATokensOutputs, type AaveSetEModeArgs, type CoreAddArgs, type CoreAddOutputs, type CoreApproveArgs, type CoreAsResourceArgs, type CoreAsResourceOutputs, type CoreAssertEqualArgs, type CoreAssertGtArgs, type CoreAssertGteArgs, type CoreAssertInRangeArgs, type CoreAssertLtArgs, type CoreAssertLteArgs, type CoreAssertNotEqualArgs, type CoreBalanceOfArgs, type CoreBalanceOfOutputs, type CoreBpsDownArgs, type CoreBpsDownOutputs, type CoreBpsUpArgs, type CoreBpsUpOutputs, type CoreCallArgs, type CoreDivideDownArgs, type CoreDivideDownOutputs, type CoreDivideUpArgs, type CoreDivideUpOutputs, type CoreEmitEvent1Args, type CoreEmitEvent2Args, type CoreEmitEvent3Args, type CoreEmitEvent4Args, type CoreMergeArgs, type CoreMergeOutputs, type CoreMultiplyArgs, type CoreMultiplyOutputs, type CorePartitionArgs, type CorePartitionOutputs, type CorePeekArgs, type CorePeekOutputs, type CoreRawCallArgs, type CoreRawCallOutputs, type CoreSplitArgs, type CoreSplitOutputs, type CoreStaticCallArgs, type CoreSubtractArgs, type CoreSubtractOutputs, type CoreTransferArgs, type CoreTransferOutputs, type FlySwapArgs, type FlySwapOutputs, type GeneratedOps, type InvariantAllowanceAtLeastArgs, type InvariantAllowanceAtMostArgs, type InvariantAllowanceEqualsArgs, type InvariantAllowanceInRangeArgs, type InvariantBalanceAtLeastArgs, type InvariantBalanceAtMostArgs, type InvariantBalanceEqualsArgs, type InvariantBalanceInRangeArgs, type InvariantEqArgs, type InvariantGtArgs, type InvariantGteArgs, type InvariantLtArgs, type InvariantLteArgs, type InvariantNeqArgs, type InvariantNumericArgs, type InvariantNumericInRangeArgs, type LifiBridgeArgs, type LifiBridgeOutputs, type LifiSwapArgs, type LifiSwapOutputs, type LifiZapArgs, type LifiZapAsyncArgs, type LifiZapAsyncOutputs, type LifiZapOutputs, type MorphoBlueBorrowArgs, type MorphoBlueBorrowOutputs, type MorphoBlueGetPositionArgs, type MorphoBlueGetPositionOutputs, type MorphoBlueRepayArgs, type MorphoBlueRepayOutputs, type MorphoBlueSupplyArgs, type MorphoBlueSupplyCollateralArgs, type MorphoBlueSupplyOutputs, type MorphoBlueWithdrawArgs, type MorphoBlueWithdrawCollateralArgs, type MorphoBlueWithdrawCollateralOutputs, type MorphoBlueWithdrawOutputs, type ParaswapBuyArgs, type ParaswapBuyOutputs, bindGeneratedOps };
@@ -176,13 +176,41 @@ const bindGeneratedOps = (builder) => ({
176
176
  claimed: "resource",
177
177
  claimedAmount: "uint256"
178
178
  }),
179
- setEMode: (nodeId, args) => builder.call(nodeId, "aave.setEMode", args, {})
179
+ setEMode: (nodeId, args) => builder.call(nodeId, "aave.setEMode", args, {}),
180
+ getHealthFactor: (nodeId, args) => builder.call(nodeId, "aave.getHealthFactor", args, {
181
+ healthFactor: "uint256"
182
+ })
180
183
  },
181
184
  morphoBlue: {
182
185
  supplyCollateral: (nodeId, args) => builder.call(nodeId, "morphoBlue.supplyCollateral", args, {}),
183
186
  withdrawCollateral: (nodeId, args) => builder.call(nodeId, "morphoBlue.withdrawCollateral", args, {
184
187
  withdrawn: "resource",
185
188
  collateralWithdrawn: "uint256"
189
+ }),
190
+ borrow: (nodeId, args) => builder.call(nodeId, "morphoBlue.borrow", args, {
191
+ borrowed: "resource",
192
+ assetsBorrowed: "uint256",
193
+ sharesBorrowed: "uint256"
194
+ }),
195
+ repay: (nodeId, args) => builder.call(nodeId, "morphoBlue.repay", args, {
196
+ actualRepaid: "uint256",
197
+ sharesRepaid: "uint256",
198
+ residual: "resource"
199
+ }),
200
+ supply: (nodeId, args) => builder.call(nodeId, "morphoBlue.supply", args, {
201
+ assetsSupplied: "uint256",
202
+ sharesSupplied: "uint256",
203
+ residual: "resource"
204
+ }),
205
+ withdraw: (nodeId, args) => builder.call(nodeId, "morphoBlue.withdraw", args, {
206
+ withdrawn: "resource",
207
+ assetsWithdrawn: "uint256",
208
+ sharesWithdrawn: "uint256"
209
+ }),
210
+ getPosition: (nodeId, args) => builder.call(nodeId, "morphoBlue.getPosition", args, {
211
+ supplyShares: "uint256",
212
+ borrowShares: "uint128",
213
+ collateral: "uint128"
186
214
  })
187
215
  },
188
216
  paraswap: {