@coinbase/agentkit
Version:
Coinbase AgentKit core primitives
115 lines (114 loc) • 3.78 kB
TypeScript
import { CdpClient } from "@coinbase/cdp-sdk";
import { Abi, Address, ContractFunctionArgs, ContractFunctionName, Hex, ReadContractParameters, ReadContractReturnType, TransactionRequest } from "viem";
import { Network } from "../network";
import { EvmWalletProvider } from "./evmWalletProvider";
import { WalletProviderWithClient, CdpWalletProviderConfig } from "./cdpShared";
/**
* A wallet provider that uses the Coinbase SDK.
*/
export declare class CdpEvmWalletProvider extends EvmWalletProvider implements WalletProviderWithClient {
#private;
/**
* Constructs a new CdpEvmWalletProvider.
*
* @param config - The configuration options for the CdpEvmWalletProvider.
*/
private constructor();
/**
* Configures a new CdpEvmWalletProvider with a wallet.
*
* @param config - Optional configuration parameters
* @returns A Promise that resolves to a new CdpEvmWalletProvider instance
* @throws Error if required environment variables are missing or wallet initialization fails
*/
static configureWithWallet(config?: CdpWalletProviderConfig): Promise<CdpEvmWalletProvider>;
/**
* Exports the wallet.
*
* @returns The wallet's data.
*/
exportWallet(): Promise<{
name: string | undefined;
address: `0x${string}`;
}>;
/**
* Signs a message.
*
* @param message - The message to sign.
* @returns The signed message.
*/
signMessage(message: string): Promise<Hex>;
/**
* Signs a typed data object.
*
* @param typedData - The typed data object to sign.
* @returns The signed typed data object.
*/
signTypedData(typedData: any): Promise<Hex>;
/**
* Signs a transaction.
*
* @param transaction - The transaction to sign.
* @returns The signed transaction.
*/
signTransaction(transaction: TransactionRequest): Promise<Hex>;
/**
* Sends a transaction.
*
* @param transaction - The transaction to send.
* @returns The hash of the transaction.
*/
sendTransaction(transaction: TransactionRequest): Promise<Hex>;
/**
* Gets the address of the wallet.
*
* @returns The address of the wallet.
*/
getAddress(): string;
/**
* Gets the network of the wallet.
*
* @returns The network of the wallet.
*/
getNetwork(): Network;
/**
* Gets the name of the wallet provider.
*
* @returns The name of the wallet provider.
*/
getName(): string;
/**
* Gets the CDP client.
*
* @returns The CDP client.
*/
getClient(): CdpClient;
/**
* Gets the balance of the wallet.
*
* @returns The balance of the wallet in wei
*/
getBalance(): Promise<bigint>;
/**
* Waits for a transaction receipt.
*
* @param txHash - The hash of the transaction to wait for.
* @returns The transaction receipt.
*/
waitForTransactionReceipt(txHash: Hex): Promise<any>;
/**
* Reads a contract.
*
* @param params - The parameters to read the contract.
* @returns The response from the contract.
*/
readContract<const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, "pure" | "view">, const args extends ContractFunctionArgs<abi, "pure" | "view", functionName>>(params: ReadContractParameters<abi, functionName, args>): Promise<ReadContractReturnType<abi, functionName, args>>;
/**
* Transfer the native asset of the network.
*
* @param to - The destination address.
* @param value - The amount to transfer in Wei.
* @returns The transaction hash.
*/
nativeTransfer(to: Address, value: string): Promise<Hex>;
}