UNPKG

tensaikit

Version:

An autonomous DeFi AI Agent Kit on Katana enabling AI agents to plan and execute on-chain financial operations.

120 lines (119 loc) 5.92 kB
import { z } from "zod"; import { ActionProvider } from "../actionProvider"; import { EvmWalletProvider } from "../../walletProviders"; import { Network } from "../../network"; import { BorrowSchema, RepaySchema, SupplyCollateralSchema, SupplySchema, WithdrawCollateralSchema, WithdrawSchema } from "./schemas"; /** * MorphoWriteActionProvider is an action provider to write into Morpho Vault. */ export declare class MorphoWriteActionProvider extends ActionProvider<EvmWalletProvider> { /** * Creates a new instance of Morpho Protocol Action Provider * */ constructor(); /** * Supplies loanToken assets to a Morpho Blue market using a specific market ID. * * @param walletProvider - Instance of EvmWalletProvider used to interact with the chain. * @param args - Contains: * - marketId: The unique bytes32 identifier for the Morpho market. * - assets: The amount of loanToken to be supplied, provided as a decimal string (e.g., "1.0", "0.5"). * * @returns A string summarizing the transaction, including the hash and receipt. * * @throws Will throw an error if: * - The asset amount is zero or negative. * - Network information is invalid or missing. * - Market ID is invalid or returns no information. * - The approve or transaction functions fail. */ supplyLoanAsset(walletProvider: EvmWalletProvider, args: z.infer<typeof SupplySchema>): Promise<string>; /** * Withdraws loanToken assets from a Morpho Blue market using a specific market ID. * * @param walletProvider - Instance of EvmWalletProvider used to interact with the chain. * @param args - Contains: * - marketId: The unique bytes32 identifier for the Morpho market. * - assets: The amount of loanToken to be withdrawn, provided as a decimal string. * * @returns A string summarizing the transaction, including the hash and receipt. * * @throws Will throw an error if: * - The asset amount is zero or negative. * - Network information is invalid or missing. * - Market ID is invalid or returns no information. * - The transaction fails. */ withdrawLoanAsset(walletProvider: EvmWalletProvider, args: z.infer<typeof WithdrawSchema>): Promise<string>; /** * Supplies collateralToken assets to a Morpho Blue market using a specific market ID. * * @param walletProvider - Instance of EvmWalletProvider used to interact with the chain. * @param args - Contains: * - marketId: The unique bytes32 identifier for the Morpho market. * - assets: The amount of collateralToken to be supplied, provided as a decimal string. * * @returns A string summarizing the transaction, including the hash and receipt. * * @throws Will throw an error if: * - The asset amount is zero or negative. * - Network information is invalid or missing. * - Market ID is invalid or returns no information. * - The approve or transaction functions fail. */ supplyCollateralLoanAsset(walletProvider: EvmWalletProvider, args: z.infer<typeof SupplyCollateralSchema>): Promise<string>; /** * Withdraws collateralToken assets from a Morpho Blue market using a specific market ID. * * @param walletProvider - Instance of EvmWalletProvider used to interact with the chain. * @param args - Contains: * - marketId: The unique bytes32 identifier for the Morpho market. * - assets: The amount of collateralToken to be withdrawn, provided as a decimal string. * * @returns A string summarizing the transaction, including the hash and receipt. * * @throws Will throw an error if: * - The asset amount is zero or negative. * - Network information is invalid or missing. * - Market ID is invalid or returns no information. * - The transaction fails. */ withdrawCollateralLoanAsset(walletProvider: EvmWalletProvider, args: z.infer<typeof WithdrawCollateralSchema>): Promise<string>; /** * Borrows loanToken assets from a Morpho Blue market using a specific market ID. * * @param walletProvider - Instance of EvmWalletProvider used to interact with the chain. * @param args - Contains: * - marketId: The unique bytes32 identifier for the Morpho market. * - assets: The amount of loanToken to be borrowed, provided as a decimal string. * * @returns A string summarizing the transaction, including the hash and receipt. * * @throws Will throw an error if: * - The asset amount is zero or negative. * - Network information is invalid or missing. * - Market ID is invalid or returns no information. * - The transaction fails. */ borrowLoanAsset(walletProvider: EvmWalletProvider, args: z.infer<typeof BorrowSchema>): Promise<string>; /** * Repays loanToken debt in a Morpho Blue market using a specific market ID. * * @param walletProvider - Instance of EvmWalletProvider used to interact with the chain. * @param args - Contains: * - marketId: The unique bytes32 identifier for the Morpho market. * - assets: The amount of loanToken to be repaid, provided as a decimal string. * * @returns A string summarizing the transaction, including the hash and receipt. * * @throws Will throw an error if: * - The asset amount is zero or negative. * - Network information is invalid or missing. * - Market ID is invalid or returns no information. * - The approve or transaction functions fail. */ repay(walletProvider: EvmWalletProvider, args: z.infer<typeof RepaySchema>): Promise<string>; supportsNetwork: (network: Network) => boolean; } export declare const morphoWriteActionProvider: () => MorphoWriteActionProvider;