UNPKG

@coinbase/agentkit

Version:

Coinbase AgentKit core primitives

63 lines (62 loc) 2.88 kB
import { z } from "zod"; import { ActionProvider } from "../actionProvider"; import { Network } from "../../network"; import { GetBalanceSchema, TransferSchema, GetTokenAddressSchema, ApproveSchema, AllowanceSchema } from "./schemas"; import { EvmWalletProvider } from "../../wallet-providers"; /** * ERC20ActionProvider is an action provider for ERC20 tokens. */ export declare class ERC20ActionProvider extends ActionProvider<EvmWalletProvider> { /** * Constructor for the ERC20ActionProvider. */ constructor(); /** * Gets the balance of an ERC20 token. * * @param walletProvider - The wallet provider to get the balance from. * @param args - The input arguments for the action. * @returns A message containing the balance. */ getBalance(walletProvider: EvmWalletProvider, args: z.infer<typeof GetBalanceSchema>): Promise<string>; /** * Transfers a specified amount of an ERC20 token to a destination onchain. * * @param walletProvider - The wallet provider to transfer the asset from. * @param args - The input arguments for the action. * @returns A message containing the transfer details. */ transfer(walletProvider: EvmWalletProvider, args: z.infer<typeof TransferSchema>): Promise<string>; /** * Approves a spender to transfer a specified amount of tokens. * * @param walletProvider - The wallet provider to approve from. * @param args - The input arguments for the action. * @returns A message containing the approval details. */ approve(walletProvider: EvmWalletProvider, args: z.infer<typeof ApproveSchema>): Promise<string>; /** * Checks the allowance for a spender of an ERC20 token. * * @param walletProvider - The wallet provider to check the allowance from. * @param args - The input arguments containing tokenAddress and spender. * @returns A message containing the allowance amount for the spender. */ getAllowance(walletProvider: EvmWalletProvider, args: z.infer<typeof AllowanceSchema>): Promise<string>; /** * Gets the contract address for a token symbol on the current network. * * @param walletProvider - The wallet provider to get the network from. * @param args - The input arguments for the action. * @returns A message containing the token address or an error if not found. */ getTokenAddress(walletProvider: EvmWalletProvider, args: z.infer<typeof GetTokenAddressSchema>): Promise<string>; /** * Checks if the ERC20 action provider supports the given network. * * @param network - The network to check. * @returns True if the ERC20 action provider supports the network, false otherwise. */ supportsNetwork: (network: Network) => boolean; } export declare const erc20ActionProvider: () => ERC20ActionProvider;