@coinbase/agentkit
Version:
Coinbase AgentKit core primitives
96 lines (95 loc) • 3.85 kB
TypeScript
import { Decimal } from "decimal.js";
import { Address } from "viem";
import { EvmWalletProvider } from "../../wallet-providers";
import { Network } from "../../network";
/**
* Get token decimals from contract
*
* @param wallet - The wallet provider instance
* @param tokenAddress - The address of the token contract
* @returns The number of decimals for the token
*/
export declare const getTokenDecimals: (wallet: EvmWalletProvider, tokenAddress: Address) => Promise<number>;
/**
* Get token symbol from contract
*
* @param wallet - The wallet provider instance
* @param tokenAddress - The address of the token contract
* @returns The symbol of the token
*/
export declare const getTokenSymbol: (wallet: EvmWalletProvider, tokenAddress: Address) => Promise<string>;
/**
* Get token balance for an address
*
* @param wallet - The wallet provider instance
* @param tokenAddress - The address of the token contract
* @returns The token balance as a bigint
*/
export declare const getTokenBalance: (wallet: EvmWalletProvider, tokenAddress: Address) => Promise<bigint>;
/**
* Get collateral balance for an address
*
* @param wallet - The wallet provider instance
* @param cometAddress - The address of the Comet contract
* @param tokenAddress - The address of the token contract
* @returns The collateral balance as a bigint
*/
export declare const getCollateralBalance: (wallet: EvmWalletProvider, cometAddress: Address, tokenAddress: Address) => Promise<bigint>;
/**
* Get health ratio for an account
*
* @param wallet - The wallet provider instance
* @param cometAddress - The address of the Comet contract
* @returns The health ratio as a Decimal
*/
export declare const getHealthRatio: (wallet: EvmWalletProvider, cometAddress: Address) => Promise<Decimal>;
/**
* Get health ratio after a hypothetical withdraw
*
* @param wallet - The wallet provider instance
* @param cometAddress - The address of the Comet contract
* @param tokenAddress - The address of the token contract
* @param amount - The amount to withdraw
* @returns The health ratio after withdraw as a Decimal
*/
export declare const getHealthRatioAfterWithdraw: (wallet: EvmWalletProvider, cometAddress: Address, tokenAddress: Address, amount: bigint) => Promise<Decimal>;
/**
* Get health ratio after a hypothetical borrow
*
* @param wallet - The wallet provider instance
* @param cometAddress - The address of the Comet contract
* @param amount - The amount to borrow
* @returns The health ratio after borrow as a Decimal
*/
export declare const getHealthRatioAfterBorrow: (wallet: EvmWalletProvider, cometAddress: Address, amount: bigint) => Promise<Decimal>;
/**
* Get portfolio details in markdown format
*
* @param wallet - The wallet provider instance
* @param cometAddress - The address of the Comet contract
* @returns A markdown formatted string with portfolio details
*/
export declare const getPortfolioDetailsMarkdown: (wallet: EvmWalletProvider, cometAddress: Address) => Promise<string>;
/**
* Gets the Comet address for the current network.
*
* @param network - The network instance
* @returns The Comet contract address
*/
export declare const getCometAddress: (network: Network) => Address;
/**
* Gets the asset address for a given assetId on the current network.
*
* @param network - The network instance
* @param assetId - The identifier of the asset
* @returns The asset contract address
*/
export declare const getAssetAddress: (network: Network, assetId: string) => Address;
/**
* Get the base token address for a Compound market
*
* @param wallet - The wallet provider instance
* @param cometAddress - The address of the Comet contract
* @returns The base token address
*/
export declare const getBaseTokenAddress: (wallet: EvmWalletProvider, cometAddress: Address) => Promise<Address>;