UNPKG

@coinbase/agentkit

Version:

Coinbase AgentKit core primitives

121 lines (120 loc) 3.8 kB
import { CdpClient } from "@coinbase/cdp-sdk"; import { Connection, PublicKey, RpcResponseAndContext, SignatureResult, SignatureStatus, SignatureStatusConfig, VersionedTransaction } from "@solana/web3.js"; import { Network } from "../network"; import { WalletProviderWithClient, CdpWalletProviderConfig } from "./cdpShared"; import { SvmWalletProvider } from "./svmWalletProvider"; /** * A wallet provider that uses the Coinbase SDK. */ export declare class CdpSolanaWalletProvider extends SvmWalletProvider implements WalletProviderWithClient { #private; /** * Constructs a new CdpSolanaWalletProvider. * * @param config - The configuration options for the CdpSolanaWalletProvider. */ private constructor(); /** * Configures a new CdpSolanaWalletProvider with a wallet. * * @param config - Optional configuration parameters * @returns A Promise that resolves to a new CdpSolanaWalletProvider instance * @throws Error if required environment variables are missing or wallet initialization fails */ static configureWithWallet(config?: CdpWalletProviderConfig): Promise<CdpSolanaWalletProvider>; /** * Exports the wallet. * * @returns The wallet's data. */ exportWallet(): Promise<{ name: string | undefined; address: `0x${string}`; }>; /** * Get the connection instance * * @returns The Solana connection instance */ getConnection(): Connection; /** * Get the public key of the wallet * * @returns The wallet's public key */ getPublicKey(): PublicKey; /** * Get the address of the wallet * * @returns The base58 encoded address of the wallet */ getAddress(): string; /** * Get the network * * @returns The network */ getNetwork(): Network; /** * Gets the name of the wallet provider. * * @returns The name of the wallet provider. */ getName(): string; /** * Sign a transaction * * @param transaction - The transaction to sign * @returns The signed transaction */ signTransaction(transaction: VersionedTransaction): Promise<VersionedTransaction>; /** * Send a transaction * * @param transaction - The transaction to send * @returns The signature */ sendTransaction(transaction: VersionedTransaction): Promise<string>; /** * Sign and send a transaction * * @param transaction - The transaction to sign and send * @returns The signature */ signAndSendTransaction(transaction: VersionedTransaction): Promise<string>; /** * Get the status of a transaction * * @param signature - The signature * @param options - The options for the status * @returns The status */ getSignatureStatus(signature: string, options?: SignatureStatusConfig): Promise<RpcResponseAndContext<SignatureStatus | null>>; /** * Wait for signature receipt * * @param signature - The signature * @returns The confirmation response */ waitForSignatureResult(signature: string): Promise<RpcResponseAndContext<SignatureResult>>; /** * Get the balance of the wallet * * @returns The balance of the wallet */ getBalance(): Promise<bigint>; /** * Gets the CDP client. * * @returns The CDP client. */ getClient(): CdpClient; /** * Transfer SOL from the wallet to another address * * @param to - The base58 encoded address to transfer the SOL to * @param value - The amount of SOL to transfer (as a decimal string, e.g. "0.0001") * @returns The signature */ nativeTransfer(to: string, value: string): Promise<string>; }