import { WalletBookSchema } from '@dynamic-labs/wallet-book'; import { Chain, WalletConnectorBase, WalletMetadata } from '@dynamic-labs/wallet-connector-core'; import { GenericNetwork } from '@dynamic-labs/types'; import type { ISparkProvider } from '../../types'; import { SparkWallet } from '../../wallet/SparkWallet'; /** * Configuration options for Spark wallet connectors */ export type SparkWalletConnectorOpts = { /** Wallet book schema for metadata */ walletBook: WalletBookSchema; /** Optional wallet metadata */ metadata?: WalletMetadata; /** Custom Spark networks configuration */ sparkNetworks?: GenericNetwork[]; }; /** * Abstract base class for all Spark wallet connectors. * * Provides complete Dynamic SDK wallet connector implementation for Spark wallets. * Concrete connectors only need to implement `getProvider()`. */ export declare abstract class SparkWalletConnector extends WalletConnectorBase { /** The wallet class to instantiate */ ChainWallet: typeof SparkWallet; /** Human-readable connector name */ name: string; /** Unique identifier for this connector type */ overrideKey: string; /** The blockchain this connector supports */ connectedChain: Chain; /** All supported blockchain types */ supportedChains: Chain[]; /** Available Spark networks for this connector */ protected sparkNetworks: GenericNetwork[]; /** * Creates a new Spark wallet connector * @param opts - Configuration options */ constructor(opts: SparkWalletConnectorOpts); /** * Establishes a connection to the Spark wallet * @throws {Error} If no Spark provider is available */ connect(): Promise; /** * Ends the current wallet session */ endSession(): Promise; /** * Retrieves the current wallet address * @returns The wallet address as a string, or undefined if unavailable */ getAddress(): Promise; /** * Gets the current network chain ID * @returns The network chain ID as a string (defaults to mainnet '301') */ getNetwork(): Promise; /** * Returns all enabled Spark networks for this connector * @returns Array of GenericNetwork configurations */ getEnabledNetworks(): GenericNetwork[]; /** * Attempts to switch to a different network * @note Spark wallets do not support dynamic network switching */ switchNetwork(): Promise; /** * Gets block explorer URLs for the current network * @returns Array of block explorer URLs (defaults to mempool.space) */ getBlockExplorerUrlsForCurrentNetwork(): Promise; /** * Signs a message using the connected wallet * @param message - The message to sign or signing request object * @returns The signature as a string, or undefined if signing fails */ signMessage(message: string | { message: string; isTaproot?: boolean; }): Promise; /** * Signs a message using Taproot protocol * @param message - The message to sign * @returns Promise resolving to signature result */ signMessageWithTaproot(message: string): Promise; /** * Transfers Bitcoin to another Spark address * @param params - Transfer parameters * @returns Promise resolving to transaction hash */ transferBitcoin(params: { receiverSparkAddress: string; amountSats: string | number; isTaproot?: boolean; }): Promise; /** * Transfers tokens to another Spark address * @param params - Transfer parameters * @returns Promise resolving to transaction hash */ transferTokens(params: { tokenPublicKey: string; receiverSparkAddress: string; tokenAmount: number; isTaproot?: boolean; }): Promise; /** * Proves ownership of a wallet address by signing a message * @param address - The address to prove ownership of * @param messageToSign - The message to sign for authentication * @returns The signature as a string, or undefined if authentication fails */ proveOwnership(_address: string, messageToSign: string): Promise; /** * Checks if the Spark wallet is installed in the browser * @returns True if a provider is available, false otherwise */ isInstalledOnBrowser(): boolean; /** * Abstract method that concrete connectors must implement * @returns The Spark provider instance, or undefined if not available */ abstract getProvider(): ISparkProvider | undefined; }