UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

288 lines 13.7 kB
import { WalletClient as ViemWalletClient, PublicClient as ViemPublicClient, Address } from "viem"; import { TwitterPostTweetSchema, TwitterAccountMentionsSchema, TwitterPostTweetReplySchema } from '../tools'; import { type RedeemTakaraParams } from '../tools/takara'; import { ModelProviderName } from '../types'; import { z } from 'zod'; export declare class SeiAgentKit { publicClient: ViemPublicClient; walletClient: ViemWalletClient; wallet_address: Address; token: string | undefined; /** * Creates a new SeiAgentKit instance * @param private_key The private key for the wallet * @param provider The model provider to use */ constructor(private_key: string, provider: ModelProviderName); /** * Gets the ERC20 token balance * @param contract_address Optional ERC-20 token contract address. If not provided, gets native SEI balance * @returns Promise with formatted balance as string */ getERC20Balance(contract_address?: Address): Promise<string>; /** * Transfers SEI tokens or ERC-20 tokens * @param amount Amount to transfer as a string (e.g., "1.5" for 1.5 tokens) * @param recipient Recipient address * @param ticker Optional token ticker (if not provided, transfers native SEI) * @returns Promise with transaction result */ ERC20Transfer(amount: string, recipient: Address, ticker?: string): Promise<string>; /** * Gets the ERC721 token balance * @param tokenAddress The ERC-721 token contract address * @returns Promise with balance as string */ getERC721Balance(tokenAddress: Address): Promise<string>; /** * Transfers an ERC721 token * @param amount Deprecated parameter (kept for compatibility) * @param recipient The recipient address * @param tokenAddress The ERC-721 token contract address * @param tokenId The token ID to transfer * @returns Promise with transaction details or error message */ ERC721Transfer(amount: string, recipient: Address, tokenAddress: Address, tokenId: string): Promise<string>; /** * Mints an ERC721 token * @param recipient The recipient address that will receive the minted token * @param tokenAddress The ERC-721 token contract address * @param tokenId The token ID to mint * @returns Promise with transaction details or error message */ ERC721Mint(recipient: Address, tokenAddress: Address, tokenId: bigint): Promise<string>; /** * Gets a token address from its ticker symbol * @param ticker The token ticker symbol (e.g., "SEI", "USDC") * @returns Promise with token address or null if not found */ getTokenAddressFromTicker(ticker: string): Promise<Address | null>; /** * Stakes SEI tokens on the network * @param amount Amount of SEI to stake as a string (e.g., "1.5" for 1.5 SEI) * @returns Promise with transaction hash or error message */ stake(amount: string): Promise<string>; /** * Unstakes SEI tokens from the network * @param amount Amount of SEI to unstake as a string (e.g., "1.5" for 1.5 SEI) * @returns Promise with transaction hash or error message */ unstake(amount: string): Promise<string>; /** * Swaps tokens using the Symphony aggregator * @param amount The amount of tokens to swap as a string (e.g., "1.5") * @param tokenIn The address of the token to swap from * @param tokenOut The address of the token to swap to * @returns Transaction details as a string */ swap(amount: string, tokenIn: Address, tokenOut: Address): Promise<string>; /** * Mints tTokens by depositing underlying tokens into the Takara Protocol * @param ticker The token ticker (e.g., "USDC") * @param mintAmount The amount to mint in human-readable format * @returns Transaction hash and expected tToken amount */ mintTakara(ticker: string, mintAmount: string): Promise<`0x${string}`>; /** * Borrows underlying tokens from the Takara Protocol using tTokens as collateral * @param ticker The token ticker (e.g., "USDC") * @param borrowAmount The amount to borrow in human-readable format * @returns Transaction hash and borrowed amount */ borrowTakara(ticker: string, borrowAmount: string): Promise<`0x${string}`>; /** * Repays borrowed tokens to the Takara Protocol * @param ticker The token ticker (e.g., "USDC") * @param repayAmount The amount to repay in human-readable format, or "MAX" to repay full balance * @returns Transaction hash and amount repaid */ repayTakara(ticker: string, repayAmount: string): Promise<{ txHash: import("viem").Hash; repaidAmount: string; }>; /** * Redeems tTokens from the Takara Protocol to get underlying tokens back * @param ticker The token ticker (e.g., "USDC") * @param redeemAmount The amount to redeem in human-readable format, or "MAX" to redeem all * @param redeemType Whether to redeem underlying tokens or tTokens * @returns Transaction details and redemption status */ redeemTakara(ticker: string, redeemAmount: string, redeemType?: RedeemTakaraParams['redeemType']): Promise<{ txHash: import("viem").Hash; redeemedAmount: string; expected: string; actual: string; success: boolean; }>; /** * Calculates the amount of underlying tokens that can be redeemed by a user * @param ticker The token ticker (e.g., "USDC") * @param userAddress Optional address of the user to check * @returns Information about redeemable amounts */ getRedeemableAmount(ticker: string, userAddress?: Address): Promise<{ tTokenBalance: string; exchangeRate: string; redeemableUnderlying: string; safeMaxRedeemable: string; underlyingDecimals: number; underlyingTokenAddress: Address; }>; /** * Retrieves the current borrow balance for a user * @param ticker The token ticker (e.g., "USDC") * @param userAddress Optional address of the user to check * @returns Information about the borrow balance */ getBorrowBalance(ticker: string, userAddress?: Address): Promise<{ borrowBalance: string; underlyingDecimals: number; underlyingTokenAddress: Address; }>; /** * Posts a tweet to Twitter * @param tweet The tweet to post * @returns Transaction hash and tweet details */ postTweet(tweet: z.infer<typeof TwitterPostTweetSchema>): Promise<string>; /** * Retrieves details about the authenticated user's Twitter account * @returns Account details as a string */ getAccountDetails(): Promise<string>; /** * Retrieves mentions for the authenticated user's Twitter account * @returns Mentions as a string */ getAccountMentions(args: z.infer<typeof TwitterAccountMentionsSchema>): Promise<string>; /** * Posts a reply to a tweet on Twitter * @param args The arguments for posting a reply * @returns Transaction hash and reply details */ postTweetReply(args: z.infer<typeof TwitterPostTweetReplySchema>): Promise<string>; /** * Deposits USDC tokens into the Citrex Protocol * @param amount The amount of USDC to deposit as a string (e.g., "1.5" for 1.5 USDC) * @returns Promise with transaction hash or error message */ citrexDeposit(amount: string): Promise<string>; /** * Withdraws USDC tokens from the Citrex Protocol * @param amount The amount of USDC to withdraw as a string (e.g., "1.5" for 1.5 USDC) * @returns Promise with transaction hash or error message */ citrexWithdraw(amount: string): Promise<"Withdrawal successful" | "Withdrawal failed">; /** * Retrieves all products from the Citrex Protocol * @returns Promise with products or error message */ citrexGetProducts(): Promise<import("../tools").productParsed | undefined>; /** * Retrieves the order book for a product from the Citrex Protocol * @param symbol The symbol of the product (e.g., "ethperp") * @returns Promise with order book or error message */ citrexGetOrderBook(symbol: string): Promise<import("citrex-sdk/lib/types").OrderBookReturnType | undefined>; /** * Retrieves the account health for the Citrex Protocol * @returns Promise with account health or error message */ citrexGetAccountHealth(): Promise<import("citrex-sdk/lib/types").AccountHealthReturnType | undefined>; /** * Retrieves the tickers for the Citrex Protocol * @returns Promise with tickers or error message */ citrexGetTickers(symbol?: `${string}perp`): Promise<import("citrex-sdk/lib/types").TickerReturnType | undefined>; /** * Calculates the required margin for a new order on Citrex Protocol * @param isBuy Whether to buy (true) or sell (false) * @param price The price of the asset for the order * @param productId The product ID of the asset * @param quantity The quantity of the asset to order * @returns Promise with the required margin calculation result */ citrexCalculateMarginRequirement(isBuy: boolean, price: number, productId: number, quantity: number): Promise<import("citrex-sdk/lib/types").CalculateMarginRequirementReturnType | undefined>; /** * Retrieves K-line (candlestick) chart data for a product on Citrex Protocol * @param productSymbol The product symbol (e.g., 'btcperp', 'ethperp') * @param optionalArgs Optional arguments for the query * @returns Promise with K-line data */ citrexGetKlines(productSymbol: `${string}perp`, optionalArgs?: any): Promise<import("citrex-sdk/lib/types").KlinesReturnType | undefined>; /** * Retrieves information about a specific product on Citrex Protocol * @param identifier The product ID or symbol * @returns Promise with product information */ citrexGetProduct(identifier: number | string): Promise<import("citrex-sdk/lib/types").ProductReturnType | undefined>; /** * Retrieves the current server time from Citrex Protocol * @returns Promise with server time information */ citrexGetServerTime(): Promise<import("citrex-sdk/lib/types").ServerTimeReturnType | undefined>; /** * Retrieves trade history for a product on Citrex Protocol * @param productSymbol The product symbol (e.g., 'btcperp', 'ethperp') * @param quantity Optional number of trades to fetch * @returns Promise with trade history data */ citrexGetTradeHistory(productSymbol: `${string}perp`, quantity?: number): Promise<import("citrex-sdk/lib/types").TradeHistoryReturnType | undefined>; /** * Cancels and replaces an order on Citrex Protocol * @param orderId The unique ID of the order to replace * @param orderArgs The new order arguments * @returns Promise with the new order information */ citrexCancelAndReplaceOrder(orderId: `0x${string}`, orderArgs: any): Promise<import("citrex-sdk/lib/types").PlaceOrderReturnType | undefined>; /** * Cancels all open orders for a specific product on Citrex Protocol * @param productId The product ID to cancel orders for * @returns Promise with cancellation status */ citrexCancelOpenOrdersForProduct(productId: number): Promise<import("citrex-sdk/lib/types").CancelOrdersReturnType | undefined>; /** * Cancels a specific order on Citrex Protocol * @param orderId The unique ID of the order to cancel * @param productId The product ID of the order * @returns Promise with cancellation status */ citrexCancelOrder(orderId: `0x${string}`, productId: number): Promise<import("citrex-sdk/lib/types").CancelOrderReturnType | undefined>; /** * Cancels multiple orders on Citrex Protocol * @param ordersArgs Array of [orderId, productId] pairs to cancel * @returns Promise with array of cancellation statuses */ citrexCancelOrders(ordersArgs: [`0x${string}`, number][]): Promise<import("citrex-sdk/lib/types").CancelOrderReturnType[] | undefined>; /** * Lists all margin balances for the account on Citrex Protocol * @returns Promise with balance information */ citrexListBalances(): Promise<import("citrex-sdk/lib/types").BalancesReturnType | undefined>; /** * Lists all open orders for the account on Citrex Protocol * @param productSymbol Optional product symbol to filter by * @returns Promise with open orders information */ citrexListOpenOrders(productSymbol?: `${string}perp`): Promise<import("citrex-sdk/lib/types").OpenOrdersReturnType | undefined>; /** * Lists all positions for the account on Citrex Protocol * @param productSymbol Optional product symbol to filter by * @returns Promise with positions information */ citrexListPositions(productSymbol?: `${string}perp`): Promise<import("citrex-sdk/lib/types").PositionsReturnType | undefined>; /** * Places an order on Citrex Protocol * @param orderArgs The order arguments * @returns Promise with order information */ citrexPlaceOrder(orderArgs: any): Promise<import("citrex-sdk/lib/types").PlaceOrderReturnType | undefined>; /** * Places multiple orders on Citrex Protocol * @param ordersArgs Array of order arguments * @returns Promise with array of order information */ citrexPlaceOrders(ordersArgs: any[]): Promise<import("citrex-sdk/lib/types").PlaceOrderReturnType[] | undefined>; } //# sourceMappingURL=index.d.ts.map