@coinbase/agentkit
Version:
Coinbase AgentKit core primitives
116 lines (115 loc) • 3.98 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, CdpSmartWalletProviderConfig } from "./cdpShared";
/**
* A wallet provider that uses the Coinbase CDP SDK smart wallets.
*/
export declare class CdpSmartWalletProvider extends EvmWalletProvider implements WalletProviderWithClient {
#private;
/**
* Constructs a new CdpSmartWalletProvider.
*
* @param config - The configuration options for the CdpSmartWalletProvider.
*/
private constructor();
/**
* Configures a new CdpSmartWalletProvider with a smart wallet.
*
* @param config - Optional configuration parameters
* @returns A Promise that resolves to a new CdpSmartWalletProvider instance
* @throws Error if required environment variables are missing or wallet initialization fails
*/
static configureWithWallet(config?: CdpSmartWalletProviderConfig): Promise<CdpSmartWalletProvider>;
/**
* Exports the wallet.
*
* @returns The wallet's data.
*/
exportWallet(): Promise<{
name: string | undefined;
address: Address;
ownerAddress: Address;
}>;
/**
* Signs a message using the owner account.
*
* @param _message - The message to sign.
* @returns The signed message.
*/
signMessage(_message: string): Promise<Hex>;
/**
* Signs a typed data object using the owner account.
*
* @param typedData - The typed data object to sign.
* @returns The signed typed data object.
*/
signTypedData(typedData: any): Promise<Hex>;
/**
* Signs a transaction using the owner account.
*
* @param _ - The transaction to sign.
* @returns The signed transaction.
*/
signTransaction(_: TransactionRequest): Promise<Hex>;
/**
* Sends a user operation through the smart wallet.
*
* @param transaction - The transaction to send.
* @returns The user operation hash.
*/
sendTransaction(transaction: TransactionRequest): Promise<Hex>;
/**
* Gets the address of the smart wallet.
*
* @returns The address of the smart 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 smart wallet.
*
* @returns The balance of the wallet in wei
*/
getBalance(): Promise<bigint>;
/**
* Waits for a user operation receipt.
*
* @param userOpHash - The user operation hash to wait for.
* @returns The user operation receipt.
*/
waitForTransactionReceipt(userOpHash: 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 using smart wallet.
*
* @param to - The destination address.
* @param value - The amount to transfer in Wei.
* @returns The user operation hash.
*/
nativeTransfer(to: Address, value: string): Promise<Hex>;
}