UNPKG

tensaikit

Version:

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

77 lines (76 loc) 3.48 kB
import { z } from "zod"; import { ActionProvider } from "../actionProvider"; import { EvmWalletProvider } from "../../walletProviders"; import { Network } from "../../network"; import { GetMarketInfoSchema, GetMarketPositionInfoSchema, GetMarketStatesSchema } from "./schemas"; /** * MorphoReadActionProvider is an action provider to read from Morpho Vault. */ export declare class MorphoReadActionProvider extends ActionProvider<EvmWalletProvider> { /** * Creates a new instance of Morpho Protocol Action Provider * */ constructor(); /** * Fetches Morpho Blue market details using a given market ID. * * @param walletProvider - Instance of EvmWalletProvider used to interact with the chain. * @param marketId - The unique bytes32 identifier for the Morpho market. * @returns Market parameters returned by the `idToMarketParams` function. * @throws Will throw an error if: * - The network or chainId is invalid. * - The market ID is invalid or returns no information. */ fetchMarketConfig(walletProvider: EvmWalletProvider, args: z.infer<typeof GetMarketInfoSchema>): Promise<string>; /** * Retrieves the wallet's current position in a specified Morpho Blue market. * * This method queries the Morpho Blue contract to determine how many supply shares, * borrow shares, and how much collateral the connected wallet currently holds. * It's useful for users tracking their DeFi lending/borrowing status. * * @param walletProvider - Connected EVM wallet instance. * @param args - Validated input containing a bytes32 `marketId` identifying the market. * * @returns A Promise resolving to a formatted string displaying: * - Market ID * - Supply Shares * - Borrow Shares * - Collateral * * @throws Will throw an error if: * - The network is not detected or invalid. * - The market ID is not recognized on-chain. * - An error occurs during contract read. */ fetchWalletPosition(walletProvider: EvmWalletProvider, args: z.infer<typeof GetMarketPositionInfoSchema>): Promise<string>; /** * Retrieves the current state of a specified Morpho Blue market. * * This method queries the Morpho Blue contract to get real-time global parameters * of a lending market — including total supply/borrowed assets, shares, protocol fee, * and the last update timestamp. It’s useful for understanding market health, * utilization, and fee configuration. * * @param walletProvider - Connected EVM wallet instance. * @param args - Validated input containing a bytes32 `marketId` identifying the market. * * @returns A Promise resolving to a formatted string displaying: * - Market ID * - Total Supply Assets * - Total Supply Shares * - Total Borrow Assets * - Total Borrow Shares * - Last Update Timestamp * - Fee * * @throws Will throw an error if: * - The network is not detected or invalid. * - The market ID is not recognized or lacks state data on-chain. * - An error occurs during the contract read operation. */ fetchMarketState(walletProvider: EvmWalletProvider, args: z.infer<typeof GetMarketStatesSchema>): Promise<string>; supportsNetwork: (network: Network) => boolean; } export declare const morphoReadActionProvider: () => MorphoReadActionProvider;