import { Connection, PublicKey, TransactionSignature, Keypair, Transaction } from '@solana/web3.js'; import EventEmitter from 'eventemitter3'; import { CompiledCircuit as CompiledCircuit$1 } from '@noir-lang/types'; /** * Privacy levels supported by PrivacyKit * Each level maps to different underlying privacy technologies */ declare enum PrivacyLevel { /** Amount is hidden using Bulletproofs (ShadowWire) */ AMOUNT_HIDDEN = "amount-hidden", /** Sender identity is hidden */ SENDER_HIDDEN = "sender-hidden", /** Full encryption of all transaction data (Arcium MPC) */ FULL_ENCRYPTED = "full-encrypted", /** Zero-knowledge proof based privacy (Noir) */ ZK_PROVEN = "zk-proven", /** Compliant privacy with proof of innocence (Privacy Cash) */ COMPLIANT_POOL = "compliant-pool", /** No privacy - regular Solana transaction */ NONE = "none" } /** * Supported privacy providers */ declare enum PrivacyProvider { SHADOWWIRE = "shadowwire", ARCIUM = "arcium", NOIR = "noir", PRIVACY_CASH = "privacycash", INCO = "inco" } /** * Supported tokens across providers */ interface SupportedToken { symbol: string; mint: string; decimals: number; providers: PrivacyProvider[]; } /** * Network configuration */ type NetworkCluster = 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet'; /** * Wallet interface for signing transactions */ interface WalletAdapter { publicKey: PublicKey; signTransaction: (tx: T) => Promise; signAllTransactions: (txs: T[]) => Promise; signMessage: (message: Uint8Array) => Promise; } /** * Configuration for PrivacyKit instance */ interface PrivacyKitConfig { /** Solana network cluster */ network: NetworkCluster; /** RPC endpoint URL (optional, uses default for network) */ rpcUrl?: string; /** Enabled privacy providers */ providers?: PrivacyProvider[]; /** Wallet adapter for signing */ wallet?: WalletAdapter; /** Enable debug logging */ debug?: boolean; /** Custom RPC headers (for authenticated endpoints) */ rpcHeaders?: Record; } /** * Transfer request parameters */ interface TransferRequest { /** Recipient address (public key or stealth address) */ recipient: string | PublicKey; /** Amount to transfer (in token units, not lamports) */ amount: number; /** Token symbol (e.g., 'SOL', 'USDC') */ token: string; /** Desired privacy level */ privacy: PrivacyLevel; /** Force specific provider (optional, auto-selected if not specified) */ provider?: PrivacyProvider; /** Additional options */ options?: TransferOptions; } /** * Additional transfer options */ interface TransferOptions { /** Maximum fee willing to pay (in SOL) */ maxFee?: number; /** Memo/note for the transfer */ memo?: string; /** Priority fee for faster confirmation */ priorityFee?: number; /** Custom proof data (for ZK transfers) */ customProof?: Uint8Array; } /** * Transfer result */ interface TransferResult { /** Transaction signature */ signature: TransactionSignature; /** Provider used for the transfer */ provider: PrivacyProvider; /** Privacy level achieved */ privacyLevel: PrivacyLevel; /** Fee paid (in SOL) */ fee: number; /** Block time of confirmation */ blockTime?: number; /** Anonymity set size (if applicable) */ anonymitySet?: number; } /** * Deposit request (into privacy pool) */ interface DepositRequest$1 { /** Amount to deposit */ amount: number; /** Token symbol */ token: string; /** Target provider */ provider?: PrivacyProvider; } /** * Deposit result */ interface DepositResult { signature: TransactionSignature; provider: PrivacyProvider; /** Commitment/note for future withdrawal */ commitment?: string; fee: number; } /** * Withdrawal request (from privacy pool) */ interface WithdrawRequest { /** Amount to withdraw */ amount: number; /** Token symbol */ token: string; /** Recipient address */ recipient: string | PublicKey; /** Provider to withdraw from */ provider?: PrivacyProvider; /** Commitment/note from deposit */ commitment?: string; } /** * Withdrawal result */ interface WithdrawResult { signature: TransactionSignature; provider: PrivacyProvider; fee: number; } /** * ZK Proof request */ interface ProveRequest { /** Circuit name or identifier */ circuit: string; /** Public inputs for the circuit */ publicInputs: Record; /** Private inputs (witnesses) */ privateInputs: Record; /** Provider to use for proving */ provider?: PrivacyProvider; } /** * ZK Proof result */ interface ProveResult { /** Serialized proof */ proof: Uint8Array; /** Public inputs used */ publicInputs: Record; /** Verification key (if needed for on-chain verification) */ verificationKey?: Uint8Array; /** Provider used */ provider: PrivacyProvider; } /** * Balance query result */ interface BalanceResult { /** Public (visible) balance */ public: number; /** Shielded (private) balance per provider */ shielded: Partial>; /** Total balance */ total: number; /** Token symbol */ token: string; } /** * Cost estimation request */ interface EstimateRequest { /** Type of operation */ operation: 'transfer' | 'deposit' | 'withdraw' | 'prove'; /** Amount (if applicable) */ amount?: number; /** Token */ token?: string; /** Privacy level */ privacy?: PrivacyLevel; /** Specific provider */ provider?: PrivacyProvider; } /** * Cost estimation result */ interface EstimateResult { /** Estimated fee in SOL */ fee: number; /** Estimated fee in token (if applicable) */ tokenFee?: number; /** Provider that would be used */ provider: PrivacyProvider; /** Estimated latency in milliseconds */ latencyMs: number; /** Estimated anonymity set size */ anonymitySet?: number; /** Warnings or considerations */ warnings: string[]; } /** * Provider adapter interface * All privacy providers must implement this interface */ interface PrivacyProviderAdapter { /** Provider identifier */ readonly provider: PrivacyProvider; /** Human-readable name */ readonly name: string; /** Supported privacy levels */ readonly supportedLevels: PrivacyLevel[]; /** Supported tokens */ readonly supportedTokens: string[]; /** Initialize the adapter */ initialize(connection: Connection, wallet?: WalletAdapter): Promise; /** Check if adapter is ready */ isReady(): boolean; /** Get balance for a token */ getBalance(token: string, address?: string): Promise; /** Execute a private transfer */ transfer(request: TransferRequest): Promise; /** Deposit into privacy pool */ deposit(request: DepositRequest$1): Promise; /** Withdraw from privacy pool */ withdraw(request: WithdrawRequest): Promise; /** Estimate cost for an operation */ estimate(request: EstimateRequest): Promise; /** Check if a specific operation is supported */ supports(operation: string, token: string, privacy: PrivacyLevel): boolean; } /** * Pipeline step definition */ interface PipelineStep { type: 'deposit' | 'transfer' | 'withdraw' | 'prove' | 'wait'; provider?: PrivacyProvider; params: Record; } /** * Pipeline execution result */ interface PipelineResult { steps: Array<{ type: string; result: TransferResult | DepositResult | WithdrawResult | ProveResult; provider: PrivacyProvider; }>; totalFee: number; success: boolean; } /** * Log levels for the SDK */ declare enum LogLevel { DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3, NONE = 4 } /** * Logger configuration */ interface LoggerConfig { level: LogLevel; prefix?: string; timestamps?: boolean; } /** * Simple logger for the SDK */ declare class Logger { private level; private prefix; private timestamps; constructor(config?: LoggerConfig); private formatMessage; debug(message: string, ...args: unknown[]): void; info(message: string, ...args: unknown[]): void; warn(message: string, ...args: unknown[]): void; error(message: string, ...args: unknown[]): void; setLevel(level: LogLevel): void; /** * Create a child logger with a different prefix */ child(prefix: string): Logger; } /** * Default logger instance */ declare const defaultLogger: Logger; /** * Create a debug-enabled logger */ declare function createDebugLogger(prefix?: string): Logger; /** * Selection criteria for choosing a provider */ interface SelectionCriteria { /** Desired privacy level */ privacyLevel: PrivacyLevel; /** Token being transferred */ token: string; /** Amount being transferred */ amount?: number; /** Maximum acceptable fee (in token units) */ maxFee?: number; /** Maximum acceptable latency (in ms) */ maxLatency?: number; /** Prefer specific provider if available */ preferredProvider?: PrivacyProvider; /** Require on-chain verification */ requireOnChainVerification?: boolean; /** Require compliance features */ requireCompliance?: boolean; } /** * Selection result from the router */ interface SelectionResult { /** Selected provider */ provider: PrivacyProvider; /** Adapter instance */ adapter: PrivacyProviderAdapter; /** Estimated result */ estimate: EstimateResult; /** Score (higher is better) */ score: number; /** Reasons for selection */ reasons: string[]; } /** * Privacy Router * * Intelligent routing engine that selects the optimal privacy provider * based on the requested privacy level, token, and other constraints. */ declare class PrivacyRouter { private adapters; private logger; constructor(logger?: Logger); /** * Register an adapter with the router */ registerAdapter(adapter: PrivacyProviderAdapter): void; /** * Get a registered adapter */ getAdapter(provider: PrivacyProvider): PrivacyProviderAdapter | undefined; /** * Get all registered adapters */ getAdapters(): PrivacyProviderAdapter[]; /** * Select the best provider for given criteria */ selectProvider(criteria: SelectionCriteria): Promise; /** * Get all providers that could handle the request */ private getCandidates; /** * Score a candidate provider */ private scoreCandidate; /** * Get routing recommendation for a transfer */ getRecommendation(request: TransferRequest): Promise<{ recommended: SelectionResult; alternatives: SelectionResult[]; explanation: string; }>; /** * Generate human-readable explanation for selection */ private generateExplanation; /** * Map privacy level to best default provider */ getDefaultProvider(privacyLevel: PrivacyLevel): PrivacyProvider; } /** * Event types emitted by PrivacyKit */ interface PrivacyKitEvents { initialized: (providers: PrivacyProvider[]) => void; 'wallet:connected': (publicKey: string) => void; 'wallet:disconnected': () => void; 'transfer:start': (request: TransferRequest) => void; 'transfer:complete': (result: TransferResult) => void; 'transfer:error': (error: Error, request: TransferRequest) => void; 'deposit:start': (request: DepositRequest$1) => void; 'deposit:complete': (result: DepositResult) => void; 'deposit:error': (error: Error, request: DepositRequest$1) => void; 'withdraw:start': (request: WithdrawRequest) => void; 'withdraw:complete': (result: WithdrawResult) => void; 'withdraw:error': (error: Error, request: WithdrawRequest) => void; 'prove:start': (request: ProveRequest) => void; 'prove:complete': (result: ProveResult) => void; 'prove:error': (error: Error, request: ProveRequest) => void; 'pipeline:start': (steps: PipelineStep[]) => void; 'pipeline:step': (step: PipelineStep, index: number) => void; 'pipeline:complete': (result: PipelineResult) => void; 'pipeline:error': (error: Error, stepIndex: number) => void; error: (error: Error) => void; } /** * Pipeline builder for chaining privacy operations */ declare class PipelineBuilder { private steps; private privacyKit; constructor(privacyKit: PrivacyKit); /** * Add a deposit step to the pipeline */ deposit(params: { amount: number; token: string; provider?: PrivacyProvider; }): this; /** * Add a transfer step to the pipeline */ transfer(params: { recipient: string; amount: number; token: string; privacy: PrivacyLevel; provider?: PrivacyProvider; }): this; /** * Add a withdrawal step to the pipeline */ withdraw(params: { recipient: string; amount: number; token: string; provider?: PrivacyProvider; commitment?: string; }): this; /** * Add a ZK prove step to the pipeline */ prove(params: { circuit: string; publicInputs: Record; privateInputs: Record; provider?: PrivacyProvider; }): this; /** * Add a wait/delay step to the pipeline */ wait(durationMs: number): this; /** * Get the current steps in the pipeline */ getSteps(): PipelineStep[]; /** * Clear all steps from the pipeline */ clear(): this; /** * Execute the pipeline */ execute(): Promise; /** * Estimate total costs for the pipeline */ estimate(): Promise<{ totalFee: number; totalLatencyMs: number; steps: EstimateResult[]; }>; } /** * PrivacyKit - Main SDK Entry Point * * The unified interface for privacy-preserving transactions on Solana. * Supports multiple privacy providers (ShadowWire, Arcium, Noir, PrivacyCash) * with intelligent routing to select the optimal provider for each operation. * * @example * ```typescript * import { PrivacyKit, PrivacyLevel } from '@privacykit/sdk'; * * const kit = new PrivacyKit({ * network: 'mainnet-beta', * providers: ['shadowwire', 'arcium'], * wallet: walletAdapter, * }); * * await kit.initialize(); * * // Simple private transfer * const result = await kit.transfer({ * recipient: 'recipient-address', * amount: 1.5, * token: 'SOL', * privacy: PrivacyLevel.AMOUNT_HIDDEN, * }); * ``` */ declare class PrivacyKit extends EventEmitter { private readonly config; private connection; private wallet; private router; private adapters; private logger; private initialized; /** * Create a new PrivacyKit instance */ constructor(config: PrivacyKitConfig); /** * Initialize the SDK and all enabled adapters */ initialize(): Promise; /** * Test the Solana connection */ private testConnection; /** * Ensure SDK is initialized before operations */ private ensureInitialized; /** * Ensure wallet is connected */ private ensureWallet; /** * Connect a wallet adapter */ connectWallet(wallet: WalletAdapter): void; /** * Disconnect the current wallet */ disconnectWallet(): void; /** * Get the current wallet */ getWallet(): WalletAdapter | null; /** * Get the Solana connection */ getConnection(): Connection; /** * Execute a private transfer * * @example * ```typescript * const result = await kit.transfer({ * recipient: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK', * amount: 1.5, * token: 'SOL', * privacy: PrivacyLevel.AMOUNT_HIDDEN, * }); * console.log('Transfer signature:', result.signature); * ``` */ transfer(request: TransferRequest): Promise; /** * Deposit tokens into a privacy pool * * @example * ```typescript * const result = await kit.deposit({ * amount: 10, * token: 'USDC', * provider: PrivacyProvider.SHADOWWIRE, * }); * console.log('Deposit commitment:', result.commitment); * ``` */ deposit(request: DepositRequest$1): Promise; /** * Withdraw tokens from a privacy pool * * @example * ```typescript * const result = await kit.withdraw({ * amount: 5, * token: 'USDC', * recipient: 'recipient-address', * provider: PrivacyProvider.SHADOWWIRE, * commitment: 'previous-deposit-commitment', * }); * ``` */ withdraw(request: WithdrawRequest): Promise; /** * Generate a zero-knowledge proof * * @example * ```typescript * const result = await kit.prove({ * circuit: 'balance-threshold', * publicInputs: { threshold: 1000, commitment: '...' }, * privateInputs: { balance: 5000, salt: '...' }, * }); * ``` */ prove(request: ProveRequest): Promise; /** * Get balance for a token (public and shielded) * * @example * ```typescript * const balance = await kit.getBalance('SOL'); * console.log('Public:', balance.public); * console.log('Shielded (ShadowWire):', balance.shielded.shadowwire); * console.log('Total:', balance.total); * ``` */ getBalance(token: string, address?: string): Promise; /** * Estimate costs for an operation * * @example * ```typescript * const estimate = await kit.estimate({ * operation: 'transfer', * amount: 1.5, * token: 'SOL', * privacy: PrivacyLevel.AMOUNT_HIDDEN, * }); * console.log('Estimated fee:', estimate.fee, 'SOL'); * console.log('Estimated time:', estimate.latencyMs, 'ms'); * ``` */ estimate(request: EstimateRequest): Promise; /** * Create a pipeline builder for chaining operations * * @example * ```typescript * const result = await kit.pipeline() * .deposit({ amount: 10, token: 'SOL' }) * .wait(5000) * .transfer({ * recipient: 'address', * amount: 5, * token: 'SOL', * privacy: PrivacyLevel.AMOUNT_HIDDEN, * }) * .withdraw({ recipient: 'address', amount: 5, token: 'SOL' }) * .execute(); * ``` */ pipeline(): PipelineBuilder; /** * Execute a pipeline of operations * @internal */ executePipeline(steps: PipelineStep[]): Promise; /** * Select the best adapter for a request */ private selectAdapter; /** * Get a specific adapter by provider */ getAdapter(provider: PrivacyProvider): PrivacyProviderAdapter | undefined; /** * Get all initialized adapters */ getAdapters(): PrivacyProviderAdapter[]; /** * Get the router instance */ getRouter(): PrivacyRouter; /** * Check if SDK is initialized */ isInitialized(): boolean; /** * Check if a provider is available */ isProviderAvailable(provider: PrivacyProvider): boolean; /** * Get available providers */ getAvailableProviders(): PrivacyProvider[]; /** * Get routing recommendation for a transfer */ getRecommendation(request: TransferRequest): Promise<{ recommended: { provider: PrivacyProvider; estimate: EstimateResult; reasons: string[]; }; alternatives: Array<{ provider: PrivacyProvider; estimate: EstimateResult; }>; explanation: string; }>; /** * Get SDK version information */ getVersion(): { sdk: string; protocol: string; }; /** * Get current configuration */ getConfig(): PrivacyKitConfig; /** * Get current network */ getNetwork(): NetworkCluster; /** * Destroy the SDK instance and clean up resources */ destroy(): Promise; } /** * Registry of supported tokens across all providers * This maps token symbols to their mint addresses and supported providers */ declare const SUPPORTED_TOKENS: Record; /** * Fee percentages by provider and token */ declare const PROVIDER_FEES: Record>; /** * Minimum amounts by provider and token */ declare const MINIMUM_AMOUNTS: Record>; /** * Get token info by symbol */ declare function getTokenInfo(symbol: string): SupportedToken | undefined; /** * Get fee for a provider and token */ declare function getProviderFee(provider: PrivacyProvider, token: string): number; /** * Get minimum amount for a provider and token */ declare function getMinimumAmount(provider: PrivacyProvider, token: string): number; /** * Check if a token is supported by a provider */ declare function isTokenSupported(token: string, provider: PrivacyProvider): boolean; /** * Get all providers that support a token */ declare function getProvidersForToken(token: string): PrivacyProvider[]; /** * Convert amount to smallest units (lamports for SOL, etc.) */ declare function toSmallestUnit(amount: number, token: string): bigint; /** * Convert from smallest units to token amount */ declare function fromSmallestUnit(amount: bigint, token: string): number; /** * Base class for privacy provider adapters * Provides common functionality and enforces interface implementation */ declare abstract class BaseAdapter implements PrivacyProviderAdapter { abstract readonly provider: PrivacyProvider; abstract readonly name: string; abstract readonly supportedLevels: PrivacyLevel[]; abstract readonly supportedTokens: string[]; protected connection: Connection | null; protected wallet: WalletAdapter | null; protected initialized: boolean; protected logger: Logger; constructor(logger?: Logger); /** * Initialize the adapter with connection and wallet * Accepts both WalletAdapter and raw Keypair (automatically converted) */ initialize(connection: Connection, wallet?: WalletAdapter | Keypair): Promise; /** * Hook for subclasses to perform additional initialization */ protected abstract onInitialize(): Promise; /** * Check if the adapter is ready for use */ isReady(): boolean; /** * Ensure adapter is initialized before operations */ protected ensureReady(): void; /** * Ensure wallet is connected */ protected ensureWallet(): WalletAdapter; /** * Get the connection instance */ protected getConnection(): Connection; /** * Update wallet reference * Accepts both WalletAdapter and raw Keypair (automatically converted) */ setWallet(wallet: WalletAdapter | Keypair): void; /** * Abstract methods that must be implemented by subclasses */ abstract getBalance(token: string, address?: string): Promise; abstract transfer(request: TransferRequest): Promise; abstract deposit(request: DepositRequest$1): Promise; abstract withdraw(request: WithdrawRequest): Promise; abstract estimate(request: EstimateRequest): Promise; /** * Check if an operation is supported */ supports(operation: string, token: string, privacy: PrivacyLevel): boolean; } /** * ShadowWire/ShadowPay Adapter * * Production integration with the ShadowPay API for private transfers * using Groth16 zero-knowledge proofs and ElGamal encryption on BN254. * * API Base URL: https://shadow.radr.fun/shadowpay/v1 * Documentation: https://registry.scalar.com/@radr/apis/shadowpay-api * NPM Packages: @shadowpay/core, @shadowpay/server, @shadowpay/client * * Features: * - Internal transfers: Amount hidden using ZK proofs * - External transfers: Sender anonymous, amount visible * - Supports SOL, USDC, USDT, RADR, BONK, and other SPL tokens * - x402 payment protocol integration * - ElGamal encryption for amount privacy */ /** * ShadowWire Adapter * * Real production integration with ShadowPay API for private transfers * using Groth16 ZK-SNARKs and ElGamal encryption. * * @example * ```typescript * const adapter = new ShadowWireAdapter(); * await adapter.initialize(connection, wallet); * * // Execute a private transfer (amount hidden) * const result = await adapter.transfer({ * recipient: 'recipient_address', * amount: 1.0, * token: 'SOL', * privacy: PrivacyLevel.AMOUNT_HIDDEN * }); * * // Get shielded balance * const balance = await adapter.getBalance('SOL'); * ``` */ declare class ShadowWireAdapter extends BaseAdapter { readonly provider = PrivacyProvider.SHADOWWIRE; readonly name = "ShadowWire"; readonly supportedLevels: PrivacyLevel[]; readonly supportedTokens: string[]; private apiClient; private apiBaseUrl; private apiKey?; constructor(apiKey?: string); /** * Initialize ShadowWire adapter * Verifies API connectivity */ protected onInitialize(): Promise; /** * Configure API base URL (useful for testing or custom deployments) */ setApiUrl(url: string): void; /** * Set API key for authenticated requests */ setApiKey(apiKey: string): void; /** * Get token configuration */ private getTokenConfig; /** * Get balance for a token in the ShadowWire privacy pool * * Note: The ShadowPay API may not expose a direct balance endpoint. * Balance queries may need to be done via on-chain program state. */ getBalance(token: string, address?: string): Promise; /** * Execute a private transfer via ShadowPay * * Internal transfers (AMOUNT_HIDDEN): Amount encrypted with ElGamal * External transfers (SENDER_HIDDEN): Sender identity protected */ transfer(request: TransferRequest): Promise; /** * Deposit tokens into ShadowWire privacy pool */ deposit(request: DepositRequest$1): Promise; /** * Withdraw tokens from ShadowWire privacy pool */ withdraw(request: WithdrawRequest): Promise; /** * Estimate costs for an operation */ estimate(request: EstimateRequest): Promise; /** * Get fee percentage for a token */ getFeePercentage(token: string): number; /** * Get minimum amount for a token */ getMinimumAmount(token: string): number; /** * Calculate fee breakdown for an amount */ calculateFee(amount: number, token: string): { fee: number; netAmount: number; feePercent: number; }; /** * Verify a payment access token * Used for x402 payment protocol integration */ verifyPayment(accessToken: string, requirement?: { amount: number; token: string; }): Promise<{ authorized: boolean; status: string; }>; } /** * Arcium MPC Types * * Type definitions for Arcium's Multi-Party Computation network * Based on @arcium-hq/client SDK and Arcium protocol specifications */ /** * Arcium network cluster configuration */ type ArciumCluster = 'devnet' | 'mainnet-beta' | 'testnet' | 'localnet'; /** * Arcium program addresses * The ARCIUM_ADDR constant from @arcium-hq/client represents the main program ID */ interface ArciumProgramAddresses { /** Main Arcium program ID (from IDL) */ arcium: PublicKey; /** MXE (Multi-party eXecution Environment) registry */ mxeRegistry: PublicKey; /** Computation mempool */ mempool: PublicKey; /** Fee pool for node rewards */ feePool: PublicKey; } /** * Cluster configuration with recommended offsets for devnet * Based on Arcium deployment documentation */ interface ClusterConfig { /** Cluster offset for PDA derivation */ offset: number; /** RPC endpoint URL */ rpcUrl: string; /** WebSocket endpoint for subscriptions */ wsUrl?: string; /** Commitment level */ commitment: 'processed' | 'confirmed' | 'finalized'; } /** * Default cluster offsets for Arcium devnet * From: https://docs.arcium.com/developers/deployment */ declare const CLUSTER_OFFSETS: { /** Legacy cluster (v0.5.4) */ readonly DEVNET_V054: 123; /** Recommended cluster (v0.6.3+) */ readonly DEVNET_V063: 456; /** Production mainnet - to be announced */ readonly MAINNET: 0; }; /** * MXE (Multi-party eXecution Environment) account data */ interface MXEAccount { /** MXE public key for encryption */ publicKey: Uint8Array; /** Associated cluster offset */ clusterOffset: number; /** Recovery status */ status: MXEStatus; /** Number of ARX nodes in cluster */ nodeCount: number; /** X25519 public key for key exchange */ x25519PublicKey: Uint8Array; } /** * MXE operational status */ declare enum MXEStatus { Active = "active", Recovery = "recovery", Inactive = "inactive" } /** * Computation definition account * Stores the compiled MPC bytecode for confidential instructions */ interface ComputationDefinition { /** Circuit hash (SHA-256) */ circuitHash: Uint8Array; /** Computation definition offset */ offset: number; /** Owner program */ owner: PublicKey; /** Finalized status */ finalized: boolean; } /** * Computation account for pending MPC computations */ interface ComputationAccount { /** Unique computation ID */ id: Uint8Array; /** Computation definition offset */ compDefOffset: number; /** Priority fee in lamports */ priorityFee: bigint; /** Encrypted inputs */ encryptedInputs: Uint8Array; /** Callback account address */ callbackAccount?: PublicKey; /** Computation status */ status: ComputationStatus; } /** * Computation lifecycle status */ declare enum ComputationStatus { /** Queued in mempool */ Pending = "pending", /** Being executed by ARX nodes */ Executing = "executing", /** Completed successfully */ Finalized = "finalized", /** Failed execution */ Failed = "failed" } /** * Computation result from callback */ interface ComputationResult { /** Computation ID */ id: Uint8Array; /** Decrypted output data */ output: T; /** Transaction signature */ signature: TransactionSignature; /** Block timestamp */ blockTime?: number; } /** * Encrypted value wrapper * Matches Arcium's Enc type pattern */ interface EncryptedValue { /** Ciphertext bytes */ ciphertext: Uint8Array; /** Encryption nonce */ nonce: Uint8Array; /** Original type hint for decryption */ typeHint?: string; } /** * Encryption owner type * Determines who can decrypt the data */ declare enum EncryptionOwner { /** Shared between client and MXE */ Shared = "shared", /** Only MXE can decrypt */ Mxe = "mxe", /** Client-side only */ Client = "client" } /** * X25519 key pair for ECDH */ interface X25519KeyPair { publicKey: Uint8Array; secretKey: Uint8Array; } /** * Rescue cipher parameters * Based on Arcium's RescueCipher implementation */ interface RescueCipherParams { /** Block size (m=5 for Arcium) */ blockSize: number; /** Number of rounds */ rounds: number; /** Field type - base or scalar */ field: 'base' | 'scalar'; } /** * Default Rescue cipher configuration for Arcium */ declare const RESCUE_CIPHER_CONFIG: RescueCipherParams; /** * C-SPL (Confidential SPL) token configuration */ interface CSPLTokenConfig { /** Original SPL token mint */ mint: PublicKey; /** Token decimals */ decimals: number; /** Confidential transfer adapter enabled */ confidentialTransferEnabled: boolean; /** Associated auditor (optional) */ auditorPublicKey?: PublicKey; } /** * Confidential token account data */ interface ConfidentialTokenAccount { /** Account owner */ owner: PublicKey; /** Token mint */ mint: PublicKey; /** Encrypted balance */ encryptedBalance: EncryptedValue; /** Encrypted pending balance */ encryptedPendingBalance?: EncryptedValue; /** Account state */ state: ConfidentialAccountState; } /** * Confidential account state */ declare enum ConfidentialAccountState { Uninitialized = "uninitialized", Initialized = "initialized", Frozen = "frozen" } /** * Shield (wrap) request for converting tokens to C-SPL */ interface ShieldRequest { /** Source token account */ sourceAccount: PublicKey; /** Amount to shield (in token units) */ amount: number; /** Token mint */ mint: PublicKey; } /** * Unshield (unwrap) request for converting C-SPL back to SPL */ interface UnshieldRequest { /** Destination token account */ destinationAccount: PublicKey; /** Amount to unshield (in token units) */ amount: number; /** Token mint */ mint: PublicKey; } /** * Confidential transfer request */ interface ConfidentialTransferRequest { /** Sender confidential account */ sender: PublicKey; /** Recipient confidential account */ recipient: PublicKey; /** Encrypted amount (hidden from network) */ encryptedAmount: EncryptedValue; /** Token mint */ mint: PublicKey; } /** * Mempool account for pending computations * TTL: 180 slots (~1.5 minutes) */ interface MempoolAccount { /** Pending computation references */ computations: ComputationReference[]; /** Current mempool size */ size: number; /** Maximum capacity */ capacity: number; } /** * Reference to a computation in mempool */ interface ComputationReference { /** Computation account offset */ offset: number; /** Priority fee for ordering */ priorityFee: bigint; /** Timestamp of queue entry */ queuedAt: number; } /** * Executing pool account for active computations */ interface ExecutingPoolAccount { /** Currently executing computations */ executing: ComputationReference[]; /** Locked accounts */ lockedAccounts: PublicKey[]; } /** * Priority fee statistics for mempool */ interface MempoolPriorityFeeStats { /** Minimum fee in mempool */ min: bigint; /** Maximum fee in mempool */ max: bigint; /** Average fee */ average: bigint; /** Median fee (recommended) */ median: bigint; /** Current mempool size */ mempoolSize: number; } /** * ARX node information */ interface ARXNodeInfo { /** Node offset */ offset: number; /** Node authority public key */ authority: PublicKey; /** Identity public key (Ed25519) */ identity: Uint8Array; /** BLS public key for threshold signatures */ blsPublicKey: Uint8Array; /** X25519 public key for communication */ x25519PublicKey: Uint8Array; /** Node status */ active: boolean; /** Epoch range */ epochRange: [number, number]; } /** * Cluster account information */ interface ClusterAccount { /** Cluster offset */ offset: number; /** Associated MXE */ mxe: PublicKey; /** Node count */ nodeCount: number; /** Recovery set size */ recoverySetSize: number; /** Active status */ active: boolean; } /** * Callback configuration for computation results */ interface CallbackConfig { /** Callback program ID */ programId: PublicKey; /** Callback instruction discriminator */ discriminator: Uint8Array; /** Additional accounts for callback */ remainingAccounts: PublicKey[]; } /** * Computation queue parameters */ interface QueueComputationParams { /** Computation definition offset */ compDefOffset: number; /** Encrypted inputs */ encryptedInputs: Uint8Array; /** Priority fee in lamports */ priorityFee: bigint; /** Callback configuration */ callback?: CallbackConfig; } /** * Error types from Arcium computations */ declare enum ArciumErrorType { InvalidInput = "invalid_input", EncryptionFailed = "encryption_failed", DecryptionFailed = "decryption_failed", ComputationFailed = "computation_failed", NetworkError = "network_error", TimeoutError = "timeout_error", InsufficientFunds = "insufficient_funds", ClusterNotSet = "cluster_not_set", MXENotFound = "mxe_not_found" } /** * Arcium SDK error */ declare class ArciumError extends Error { readonly type: ArciumErrorType; readonly cause?: Error | undefined; constructor(type: ArciumErrorType, message: string, cause?: Error | undefined); } /** * Curve25519 field constants * From @arcium-hq/client */ declare const CURVE25519_CONSTANTS: { /** Scalar field modulus: 2^252 + 27742317777372353535851937790883648493 */ readonly SCALAR_FIELD_MODULUS: bigint; /** Base field modulus: 2^255 - 19 */ readonly BASE_FIELD_MODULUS: bigint; }; /** * Arcium client configuration */ interface ArciumClientConfig { /** Solana cluster */ cluster: ArciumCluster; /** Cluster offset for PDA derivation */ clusterOffset: number; /** RPC endpoint URL */ rpcUrl: string; /** WebSocket endpoint */ wsUrl?: string; /** Commitment level */ commitment?: 'processed' | 'confirmed' | 'finalized'; /** Enable debug logging */ debug?: boolean; } /** * Packer interface for type-safe serialization */ interface Packer { pack(value: T): Uint8Array; unpack(data: Uint8Array): T; } /** * Field information for packer generation */ interface FieldInfo { name: string; type: 'u8' | 'u16' | 'u32' | 'u64' | 'u128' | 'bool' | 'bytes' | 'pubkey'; size?: number; encrypted?: boolean; } /** * X25519 ECDH key exchange implementation * Uses the standard Curve25519 scalar multiplication */ declare class X25519 { private static readonly BASEPOINT; /** * Generate a random X25519 secret key */ static generateSecretKey(): Uint8Array; /** * Derive public key from secret key * Uses scalar multiplication with basepoint */ static getPublicKey(secretKey: Uint8Array): Uint8Array; /** * Compute shared secret using ECDH */ static getSharedSecret(secretKey: Uint8Array, publicKey: Uint8Array): Uint8Array; /** * Generate a key pair */ static generateKeyPair(): X25519KeyPair; /** * X25519 scalar multiplication * Implements Montgomery ladder for constant-time operation */ private static scalarMult; private static decodePoint; private static encodePoint; private static cswap; private static pow; private static modInverse; } /** * Rescue-Prime Cipher implementation * Optimized for MPC environments with algebraic structure * * This is a simplified implementation - production should use * @arcium-hq/client RescueCipher class */ declare class RescueCipher { private sharedSecret; private params; private state; private readonly p; constructor(sharedSecret: Uint8Array, params?: RescueCipherParams); /** * Initialize cipher state from shared secret */ private initState; /** * Encrypt plaintext to ciphertext * Returns [u8; 32] array as specified by Arcium */ encrypt(plaintext: Uint8Array, nonce: Uint8Array): Uint8Array; /** * Decrypt ciphertext to plaintext */ decrypt(ciphertext: Uint8Array, nonce: Uint8Array): Uint8Array; /** * Absorb nonce into cipher state */ private absorbNonce; /** * Apply Rescue-Prime permutation */ private permute; /** * Apply inverse Rescue-Prime permutation */ private inversePermute; /** * Apply a single round of Rescue-Prime */ private applyRound; /** * Apply inverse round */ private applyInverseRound; /** * MDS matrix multiplication (simplified) */ private mdsMultiply; /** * Inverse MDS matrix multiplication */ private inverseMdsMultiply; /** * Get round constant */ private getRoundConstant; /** * Convert bytes to field elements */ private bytesToFieldElements; /** * Convert field elements to bytes */ private fieldElementsToBytes; private pow; private modInverse; } /** * C-SPL Rescue Cipher variant * Uses scalar field instead of base field for confidential SPL operations */ declare class CSPLRescueCipher extends RescueCipher { constructor(sharedSecret: Uint8Array); } /** * AES-GCM cipher for non-MPC operations * Uses Web Crypto API when available */ declare class AesCipher { private key; private keyBytes; private keySize; constructor(keyBytes: Uint8Array); /** * Initialize the AES key */ init(): Promise; /** * Encrypt plaintext using AES-GCM */ encrypt(plaintext: Uint8Array, nonce: Uint8Array): Promise; /** * Decrypt ciphertext using AES-GCM */ decrypt(ciphertext: Uint8Array, nonce: Uint8Array): Promise; /** * Simple XOR encryption (fallback only) */ private xorEncrypt; } /** * Arcium Encryption Manager * Coordinates encryption operations for MPC computations */ declare class ArciumEncryption { private x25519KeyPair; private mxePublicKey; private rescueCipher; private csplCipher; private aesCipher; constructor(); /** * Get client's X25519 public key */ getPublicKey(): Uint8Array; /** * Set MXE public key and derive shared secret */ setMxePublicKey(mxePublicKey: Uint8Array): Promise; /** * Derive AES-256 key from shared secret */ private deriveAesKey; /** * Encrypt value for MPC computation */ encrypt(value: T, owner?: EncryptionOwner): EncryptedValue; /** * Encrypt value for C-SPL operations */ encryptForCSPL(value: T): EncryptedValue; /** * Encrypt value using AES-GCM */ encryptAes(value: T): Promise>; /** * Decrypt value from MPC computation result */ decrypt(encrypted: EncryptedValue): T; /** * Decrypt C-SPL value */ decryptCSPL(encrypted: EncryptedValue): T; /** * Decrypt AES-GCM encrypted value */ decryptAes(encrypted: EncryptedValue): Promise; /** * Serialize value to bytes */ private serialize; /** * Deserialize bytes to value */ private deserialize; /** * Convert bigint to bytes (little-endian) */ private bigintToBytes; /** * Convert number to bytes (little-endian) */ private numberToBytes; /** * Generate random nonce */ private generateNonce; /** * Generate random field element */ generateRandomFieldElement(field?: 'base' | 'scalar'): bigint; } /** * Serialize value to little-endian bytes */ declare function serializeLE(value: bigint | number, size?: number): Uint8Array; /** * Deserialize little-endian bytes to bigint */ declare function deserializeLE(bytes: Uint8Array): bigint; /** * SHA-256 hash */ declare function sha256(data: Uint8Array): Promise; /** * Positive modulo operation */ declare function positiveModulo(a: bigint, m: bigint): bigint; /** * Arcium MPC Client * * Real production client for interacting with Arcium's Multi-Party Computation network. * Implements account derivation, computation queuing, and result handling. * * Based on @arcium-hq/client SDK patterns */ /** * Arcium Client * * Main client for interacting with Arcium's MPC network */ declare class ArciumClient { private connection; private wallet; private config; private encryption; private mxePublicKey; private programAddresses; constructor(config: ArciumClientConfig); /** * Set the wallet for signing transactions */ setWallet(wallet: WalletAdapter): void; /** * Get the Arcium program ID */ getArciumProgramId(): PublicKey; /** * Initialize the client by fetching MXE public key */ initialize(): Promise; /** * Get MXE account address */ getMXEAccAddress(programId?: PublicKey): PublicKey; /** * Get cluster account address */ getClusterAccAddress(clusterOffset?: number): PublicKey; /** * Get mempool account address */ getMempoolAccAddress(clusterOffset?: number): PublicKey; /** * Get executing pool account address */ getExecutingPoolAccAddress(clusterOffset?: number): PublicKey; /** * Get computation definition account address */ getCompDefAccAddress(compDefOffset: number, ownerProgram: PublicKey): PublicKey; /** * Get computation account address */ getComputationAccAddress(computationId: Uint8Array): PublicKey; /** * Get ARX node account address */ getARXNodeAccAddress(nodeOffset: number): PublicKey; /** * Fetch MXE public key from on-chain account */ getMXEPublicKey(): Promise; /** * Get MXE account info */ getMXEAccInfo(): Promise; /** * Get mempool account info */ getMempoolAccInfo(): Promise; /** * Get executing pool account info */ getExecutingPoolAccInfo(): Promise; /** * Get mempool priority fee statistics */ getMempoolPriorityFeeStats(): Promise; /** * Get cluster account info */ getClusterAccInfo(clusterOffset?: number): Promise; /** * Get ARX node info */ getARXNodeInfo(nodeOffset: number): Promise; /** * Get computations currently in mempool */ getComputationsInMempool(): Promise; /** * Encrypt value for MPC computation */ encrypt(value: T): EncryptedValue; /** * Decrypt value from MPC computation result */ decrypt(encrypted: EncryptedValue): T; /** * Build transaction to initialize a computation definition * This is called once per confidential instruction type */ buildInitCompDefTx(ownerProgram: PublicKey, compDefOffset: number, circuitHash: Uint8Array): Promise; /** * Build transaction to finalize a computation definition */ buildFinalizeCompDefTx(ownerProgram: PublicKey, compDefOffset: number): Promise; /** * Queue a computation for MPC execution */ queueComputation(params: QueueComputationParams): Promise; /** * Wait for computation to finalize */ awaitComputationFinalization(computationId: Uint8Array, timeoutMs?: number): Promise>; /** * Subscribe to computation events */ subscribeComputations(callback: (result: ComputationResult) => void): () => void; /** * Upload circuit bytecode */ uploadCircuit(circuitUrl: string, ownerProgram: PublicKey, compDefOffset: number): Promise; /** * Get connection instance */ getConnection(): Connection; /** * Get encryption instance */ getEncryption(): ArciumEncryption; /** * Get client X25519 public key */ getClientPublicKey(): Uint8Array; /** * Close client and clean up resources */ close(): void; } /** * Create an Arcium client with default devnet configuration */ declare function createDevnetClient(rpcUrl?: string): ArciumClient; /** * Create an Arcium client with mainnet configuration */ declare function createMainnetClient(rpcUrl?: string): ArciumClient; /** * Helper to compute comp_def_offset from function name * Matches the comp_def_offset! macro behavior */ declare function compDefOffset(functionName: string): number; /** * C-SPL (Confidential SPL) Token Module * * Implements confidential token operations using Arcium's MPC network. * C-SPL tokens support encrypted balances and confidential transfers * while maintaining composability with standard SPL tokens. * * Based on Arcium's Confidential SPL Token standard: * - Confidential Transfer Adapter * - Encrypted SPL Token * - Confidential Auditor Adapter */ /** * C-SPL Program IDs * These programs work together to provide confidential token functionality */ declare const CSPL_PROGRAM_IDS: { /** Confidential Transfer Adapter - extends Token-2022 for on-chain program support */ readonly confidentialTransferAdapter: PublicKey; /** Encrypted SPL Token - lightweight confidential token implementation */ readonly encryptedSplToken: PublicKey; /** Confidential Auditor Adapter - programmable compliance */ readonly confidentialAuditorAdapter: PublicKey; /** Confidential ATA Program - associated token accounts for confidential tokens */ readonly confidentialAta: PublicKey; /** Token Wrap Program - wrapping SPL tokens to confidential variants */ readonly tokenWrap: PublicKey; }; /** * Supported C-SPL tokens with their configurations */ declare const CSPL_TOKEN_CONFIGS: Record; /** * C-SPL Token Client * * Handles confidential SPL token operations: * - Shield (wrap) regular SPL tokens to confidential * - Unshield (unwrap) confidential tokens back to regular * - Confidential transfers between accounts * - Query encrypted balances */ declare class CSPLTokenClient { private connection; private wallet; private arciumClient; private encryption; constructor(arciumClient: ArciumClient); /** * Set wallet for signing transactions */ setWallet(wallet: WalletAdapter): void; /** * Get confidential account address for a user and mint */ getConfidentialAccountAddress(owner: PublicKey, mint: PublicKey): PublicKey; /** * Get confidential mint address for an SPL token */ getConfidentialMintAddress(mint: PublicKey): PublicKey; /** * Get shield vault address for an SPL token */ getShieldVaultAddress(mint: PublicKey): PublicKey; /** * Check if a token supports C-SPL confidential transfers */ isTokenSupported(tokenSymbol: string): boolean; /** * Get token configuration */ getTokenConfig(tokenSymbol: string): CSPLTokenConfig | null; /** * Initialize a confidential token account * Must be called before receiving confidential transfers */ initializeConfidentialAccount(mint: PublicKey): Promise; /** * Shield (wrap) regular SPL tokens into confidential tokens * Tokens are transferred to a vault and a confidential balance is created */ shield(request: ShieldRequest): Promise; /** * Unshield (unwrap) confidential tokens back to regular SPL tokens */ unshield(request: UnshieldRequest): Promise; /** * Execute a confidential transfer between accounts * Amount is encrypted and verified by MPC without revealing the value */ confidentialTransfer(request: ConfidentialTransferRequest): Promise; /** * Get encrypted balance of a confidential account * The returned balance is encrypted and can only be decrypted by the account owner */ getEncryptedBalance(owner: PublicKey, mint: PublicKey): Promise | null>; /** * Decrypt balance using owner's encryption key */ decryptBalance(encryptedBalance: EncryptedValue): bigint; /** * Get decrypted balance for the connected wallet */ getBalance(tokenSymbol: string): Promise; /** * Get confidential account info */ getConfidentialAccountInfo(owner: PublicKey, mint: PublicKey): Promise; /** * Apply pending balance to available balance * This finalizes incoming confidential transfers */ applyPendingBalance(mint: PublicKey): Promise; /** * Get decimals for a mint */ private getDecimals; /** * Encrypt amount for confidential transfer */ encryptAmount(amount: number, mint: PublicKey): EncryptedValue; } /** * Create a C-SPL token client from an Arcium client */ declare function createCSPLClient(arciumClient: ArciumClient): CSPLTokenClient; /** * Arcium Adapter * * Production integration with Arcium's Multi-Party Computation network * for fully encrypted DeFi operations on Solana. * * Features: * - C-SPL (Confidential SPL) token support with encrypted balances * - Multi-party computation for confidential state transitions * - Confidential swaps, transfers, and DeFi operations * - Compatible with Anchor development patterns * - Uses real Arcium program IDs and encryption protocols */ /** * Arcium Adapter * * Production-ready adapter for Arcium's MPC network providing: * - Confidential token transfers with hidden amounts * - Shield/unshield operations for C-SPL tokens * - Encrypted balance management * - MPC-based confidential computation */ declare class ArciumAdapter extends BaseAdapter { readonly provider = PrivacyProvider.ARCIUM; readonly name = "Arcium"; readonly supportedLevels: PrivacyLevel[]; readonly supportedTokens: string[]; private arciumClient; private csplClient; private network; private clusterOffset; /** * Initialize Arcium adapter * Establishes connection to Arcium MPC network and fetches MXE public key */ protected onInitialize(): Promise; /** * Update wallet reference */ setWallet(wallet: WalletAdapter): void; /** * Get confidential balance for a token * Uses the connected wallet's encryption key to decrypt the balance */ getBalance(token: string, address?: string): Promise; /** * Execute a confidential transfer via Arcium MPC * Amount and balance changes are hidden from observers */ transfer(request: TransferRequest): Promise; /** * Shield tokens into Arcium confidential pool * Converts regular SPL tokens to C-SPL tokens with encrypted balances */ deposit(request: DepositRequest$1): Promise; /** * Unshield tokens from Arcium confidential pool * Converts C-SPL tokens back to regular SPL tokens */ withdraw(request: WithdrawRequest): Promise; /** * Estimate costs for an operation */ estimate(request: EstimateRequest): Promise; /** * Execute a confidential computation on Arcium MPC network * Allows arbitrary encrypted computations */ confidentialCompute(compDefOffset: number, encryptedInputs: Uint8Array, priorityFee?: bigint): Promise; /** * Encrypt data for MPC computation */ encrypt(value: T): EncryptedValue; /** * Decrypt data from MPC computation result */ decrypt(encrypted: EncryptedValue): T; /** * Get the underlying Arcium client */ getArciumClient(): ArciumClient | null; /** * Get the C-SPL token client */ getCSPLClient(): CSPLTokenClient | null; /** * Get current network */ getNetwork(): 'devnet' | 'mainnet-beta'; /** * Get cluster offset */ getClusterOffset(): number; /** * Check if adapter is fully initialized with MXE connection */ isFullyInitialized(): boolean; /** * Get mempool statistics */ getMempoolStats(): Promise; /** * Apply pending confidential balance for a token * Finalizes incoming confidential transfers */ applyPendingBalance(token: string): Promise; } /** * Noir/Sunspot Adapter for PrivacyKit SDK * * Production-ready integration with Noir ZK language and Sunspot verifier * for zero-knowledge proof generation and on-chain verification. * * Features: * - Real Groth16 proof generation using Barretenberg * - Pre-built privacy circuits (transfer, threshold, ownership) * - On-chain verification via Sunspot program * - Local verification for testing */ /** * Circuit definition interface */ interface CircuitDefinition { name: string; description: string; publicInputs: string[]; privateInputs: string[]; verificationKey?: Uint8Array; } /** * Noir Adapter * * Provides production-ready ZK proof generation and verification using the Noir * language and Barretenberg proving system. */ declare class NoirAdapter extends BaseAdapter { readonly provider = PrivacyProvider.NOIR; readonly name = "Noir (Sunspot)"; readonly supportedLevels: PrivacyLevel[]; readonly supportedTokens: string[]; private circuits; private compiler; private prover; private verifier; private initializedCircuits; private verificationKeyAccounts; constructor(); /** * Initialize Noir adapter */ protected onInitialize(): Promise; /** * Initialize a specific circuit for proving * Must be called before generating proofs for that circuit */ initializeCircuit(circuitName: string, compiledCircuit?: CompiledCircuit$1): Promise; /** * Register a custom circuit */ registerCircuit(name: string, definition: CircuitDefinition): void; /** * Load circuit proving and verification keys * @deprecated Use initializeCircuit with compiled circuit instead */ loadCircuitKeys(circuitName: string, _provingKey: Uint8Array, verificationKey: Uint8Array): Promise; /** * Generate a ZK proof for a circuit */ prove(request: ProveRequest): Promise; /** * Validate circuit inputs */ private validateCircuitInputs; /** * Verify a proof on-chain using Sunspot */ verifyOnChain(proof: Uint8Array, publicInputs: Record): Promise; /** * Create Sunspot verification instruction */ private createVerifyInstruction; /** * Encode public inputs for on-chain verification */ private encodePublicInputs; /** * Convert value to BigInt */ private toBigInt; /** * Convert BigInt to 32-byte array */ private bigIntToBytes32; /** * Verify a proof locally (off-chain) */ verifyLocal(circuitName: string, proof: Uint8Array, publicInputs: string[]): Promise; /** * Get balance - not directly applicable for Noir */ getBalance(_token: string, _address?: string): Promise; /** * Transfer with ZK proof */ transfer(request: TransferRequest): Promise; /** * Generate a random field element for BN254 curve */ private generateFieldElement; /** * Compute a Pedersen-style commitment */ private computePedersenCommitment; /** * Compute a nullifier using Poseidon-style hash */ private computeNullifier; /** * Deposit - generate commitment for privacy pool */ deposit(request: DepositRequest$1): Promise; /** * Withdraw from privacy pool */ withdraw(request: WithdrawRequest): Promise; /** * Estimate costs */ estimate(request: EstimateRequest): Promise; /** * Get list of available circuits */ getAvailableCircuits(): CircuitDefinition[]; /** * Get circuit by name */ getCircuit(name: string): CircuitDefinition | undefined; /** * Get list of initialized circuits */ getInitializedCircuits(): string[]; /** * Cleanup resources */ destroy(): Promise; } /** * Privacy Cash Type Definitions * * Core types for the Privacy Cash ZK privacy pool implementation. */ /** * Poseidon hash function type */ type PoseidonFn = (inputs: bigint[]) => bigint; /** * Deposit note containing all information needed for withdrawal */ interface DepositNote { /** Commitment hash (Poseidon(secret, nullifier)) */ commitment: bigint; /** Nullifier hash for preventing double-spending */ nullifierHash: bigint; /** Secret value (kept private) */ secret: bigint; /** Nullifier value (kept private) */ nullifier: bigint; /** Deposit amount in token units */ amount: number; /** Token symbol */ token: string; /** Deposit timestamp */ timestamp: number; /** Merkle tree leaf index (once included) */ leafIndex?: number; } /** * Encoded deposit note for storage/transmission */ interface EncodedNote { /** Version for forward compatibility */ version: number; /** Commitment hex */ commitment: string; /** Nullifier hash hex */ nullifierHash: string; /** Secret hex (encrypted in production) */ secret: string; /** Nullifier hex */ nullifier: string; /** Amount */ amount: number; /** Token symbol */ token: string; /** Timestamp */ timestamp: number; /** Leaf index */ leafIndex?: number; } /** * Merkle tree proof for withdrawal verification */ interface MerkleProof { /** Current Merkle root */ root: bigint; /** Sibling hashes along the path */ pathElements: bigint[]; /** Path indices (0 = left, 1 = right) */ pathIndices: number[]; /** Leaf index in the tree */ leafIndex: number; } /** * ZK-SNARK proof structure (Groth16) */ interface Groth16Proof { /** Point A (G1) */ pi_a: [string, string, string]; /** Point B (G2) */ pi_b: [[string, string], [string, string], [string, string]]; /** Point C (G1) */ pi_c: [string, string, string]; /** Protocol type */ protocol: 'groth16'; /** Curve type */ curve: 'bn128'; } /** * Public signals for withdrawal proof */ interface WithdrawalPublicSignals { /** Merkle root */ root: string; /** Nullifier hash (to prevent double-spending) */ nullifierHash: string; /** Recipient address (as field element) */ recipient: string; /** Relayer address (optional) */ relayer: string; /** Fee amount */ fee: string; /** Refund amount */ refund: string; } /** * Complete withdrawal proof package */ interface WithdrawalProof { /** The ZK proof */ proof: Groth16Proof; /** Public signals */ publicSignals: WithdrawalPublicSignals; } /** * Circuit inputs for proof generation */ interface WithdrawalCircuitInputs { /** Private inputs */ private: { /** Secret value */ secret: bigint; /** Nullifier value */ nullifier: bigint; /** Merkle path elements */ pathElements: bigint[]; /** Merkle path indices */ pathIndices: number[]; }; /** Public inputs */ public: { /** Merkle root */ root: bigint; /** Nullifier hash */ nullifierHash: bigint; /** Recipient address */ recipient: bigint; /** Relayer address */ relayer: bigint; /** Fee */ fee: bigint; /** Refund */ refund: bigint; }; } /** * Verification key structure */ interface VerificationKey { protocol: string; curve: string; nPublic: number; vk_alpha_1: string[]; vk_beta_2: string[][]; vk_gamma_2: string[][]; vk_delta_2: string[][]; vk_alphabeta_12: string[][][]; IC: string[][]; } /** * Pool configuration for a token */ interface PoolConfig { /** Token mint address */ mint: string; /** Token decimals */ decimals: number; /** Minimum deposit amount */ minDeposit: number; /** Maximum deposit amount */ maxDeposit: number; /** Current anonymity set size */ anonymitySet: number; /** Pool PDA address */ poolAddress?: string; /** Merkle tree depth */ treeDepth: number; } /** * Pool state from on-chain */ interface PoolState { /** Current Merkle root */ currentRoot: bigint; /** Historical roots for verification */ roots: bigint[]; /** Next available leaf index */ nextLeafIndex: number; /** Total deposits count */ totalDeposits: number; /** Total withdrawals count */ totalWithdrawals: number; } /** * Circuit artifact paths */ interface CircuitArtifacts { /** Path to wasm file */ wasmPath: string; /** Path to zkey file */ zkeyPath: string; /** Path to verification key JSON */ vkeyPath: string; } /** * Prover configuration */ interface ProverConfig$1 { /** Circuit artifacts */ artifacts: CircuitArtifacts; /** Use WebWorker for proving (browser) */ useWorker?: boolean; /** Timeout in milliseconds */ timeout?: number; } /** * Relayer information */ interface RelayerInfo { /** Relayer address */ address: string; /** Fee percentage (basis points) */ feePercent: number; /** Supported tokens */ supportedTokens: string[]; /** API endpoint */ endpoint: string; } /** * Event emitted on deposit */ interface DepositEvent { /** Commitment hash */ commitment: bigint; /** Leaf index */ leafIndex: number; /** Block time */ timestamp: number; /** Transaction signature */ signature: string; } /** * Event emitted on withdrawal */ interface WithdrawalEvent { /** Nullifier hash */ nullifierHash: bigint; /** Recipient address */ recipient: string; /** Relayer address */ relayer: string; /** Fee paid */ fee: number; /** Block time */ timestamp: number; /** Transaction signature */ signature: string; } /** * Commitment Generation for Privacy Cash * * Production-ready Poseidon-based commitments following the Tornado Cash pattern: * - commitment = Poseidon(secret, nullifier) * - nullifierHash = Poseidon(nullifier) * * The commitment is stored in the Merkle tree. * The nullifierHash is revealed during withdrawal to prevent double-spending. */ /** * Generate a new deposit note with random secret and nullifier */ declare function generateDepositNote(amount: number, token: string): Promise; /** * Regenerate commitment and nullifierHash from existing secret/nullifier * Useful for note validation and recovery */ declare function regenerateCommitment(secret: bigint, nullifier: bigint): Promise<{ commitment: bigint; nullifierHash: bigint; }>; /** * Verify that a note's commitment matches its secret/nullifier */ declare function verifyNote(note: DepositNote): Promise; /** * Encode a deposit note to a string for storage * The encoded note contains all information needed for withdrawal * * Format: "privacy-cash-note-v{version}-{base64Data}" */ declare function encodeNote(note: DepositNote): string; /** * Decode an encoded note string back to a DepositNote */ declare function decodeNote(encoded: string): DepositNote; /** * Create a note from explicit parameters (for testing or recovery) */ declare function createNoteFromParams(params: { secret: bigint | string; nullifier: bigint | string; amount: number; token: string; leafIndex?: number; }): Promise; /** * Generate a deterministic note from a seed * Useful for testing and reproducible note generation */ declare function generateDeterministicNote(seed: Uint8Array, amount: number, token: string): Promise; /** * Split amount into multiple notes for better privacy * Returns notes with amounts that sum to the original */ declare function splitIntoNotes(totalAmount: number, token: string, numNotes?: number): Promise; /** * Compute commitment from public key (for stealth addresses) * This allows deposits to be made to a derived address */ declare function computeStealthCommitment(recipientPubkey: Uint8Array, ephemeralSecret: bigint): Promise; /** * Privacy Cash Adapter * * PRODUCTION-READY integration with Privacy Cash protocol for * privacy pool-based anonymous transfers on Solana. * * Features: * - Tornado Cash-style privacy pools * - Real Poseidon hash for commitments and nullifiers * - Real ZK-SNARK proofs for withdrawals (Groth16) * - Merkle tree commitment scheme with 20-level depth * - Support for SOL and major SPL tokens * * @module adapters/privacycash */ /** * Privacy Cash Adapter * * Production-ready adapter for Privacy Cash protocol integration. * Uses real Poseidon hashing and ZK-SNARK proofs for secure private transfers. */ declare class PrivacyCashAdapter extends BaseAdapter { readonly provider = PrivacyProvider.PRIVACY_CASH; readonly name = "Privacy Cash"; readonly supportedLevels: PrivacyLevel[]; readonly supportedTokens: string[]; private programId; private network; private depositNotes; private apiBaseUrl; private merkleTrees; private cryptoInitialized; /** * Initialize Privacy Cash adapter */ protected onInitialize(): Promise; /** * Initialize cryptographic primitives */ private initializeCrypto; /** * Get shielded balance in Privacy Cash pools */ getBalance(token: string, _address?: string): Promise; /** * Deposit into Privacy Cash pool * Creates a real Poseidon commitment and stores the note for later withdrawal */ deposit(request: DepositRequest$1): Promise; /** * Create deposit instruction with real commitment */ private createDepositInstruction; /** * Withdraw from Privacy Cash pool * Generates a real ZK proof to prove knowledge of the deposit without revealing it */ withdraw(request: WithdrawRequest): Promise; /** * Get Merkle proof for a commitment */ private getMerkleProof; /** * Generate placeholder proof for development/testing */ private generatePlaceholderProof; /** * Create withdrawal instruction */ private createWithdrawInstruction; /** * Transfer via Privacy Cash (atomic deposit + withdraw) */ transfer(request: TransferRequest): Promise; /** * Estimate costs for operations */ estimate(request: EstimateRequest): Promise; /** * Get pool statistics */ getPoolStats(token: string): Promise<{ totalDeposits: number; anonymitySet: number; minDeposit: number; maxDeposit: number; treeDepth: number; currentRoot: string; }>; /** * Import a deposit note from encoded string */ importNote(encodedNote: string): Promise; /** * Export all deposit notes */ exportNotes(): string[]; /** * Get prover status */ getProverInfo(): { initialized: boolean; realProvingAvailable: boolean; }; /** * Convert field element to 32 bytes (big-endian) */ private fieldToBytes32; } /** * Options for creating an adapter */ interface CreateAdapterOptions { /** * Use production adapters instead of mock/development adapters * @default false */ production?: boolean; /** * API key for ShadowWire production adapter */ shadowWireApiKey?: string; } /** * Create an adapter instance for a provider * * @param provider - The privacy provider to create an adapter for * @param options - Optional configuration for the adapter * @returns A configured adapter instance * * @example * ```typescript * // Create a development adapter * const devAdapter = createAdapter(PrivacyProvider.SHADOWWIRE); * * // Create a production adapter * const prodAdapter = createAdapter(PrivacyProvider.SHADOWWIRE, { production: true }); * * // Create a production adapter with API key * const prodAdapterWithKey = createAdapter(PrivacyProvider.SHADOWWIRE, { * production: true, * shadowWireApiKey: 'your-api-key' * }); * ``` */ declare function createAdapter(provider: PrivacyProvider, options?: CreateAdapterOptions): PrivacyProviderAdapter; /** * Options for getting all adapters */ interface GetAllAdaptersOptions { /** * Use production adapters instead of mock/development adapters * @default false */ production?: boolean; /** * API key for ShadowWire production adapter */ shadowWireApiKey?: string; } /** * Get all available adapters * * @param options - Optional configuration for the adapters * @returns An array of all available adapter instances * * @example * ```typescript * // Get all development adapters * const devAdapters = getAllAdapters(); * * // Get all production adapters * const prodAdapters = getAllAdapters({ production: true }); * ``` */ declare function getAllAdapters(options?: GetAllAdaptersOptions): PrivacyProviderAdapter[]; /** * Base error class for PrivacyKit */ declare class PrivacyKitError extends Error { readonly code: string; readonly cause?: Error | undefined; constructor(message: string, code: string, cause?: Error | undefined); } /** * Error thrown when a provider is not initialized or unavailable */ declare class ProviderNotAvailableError extends PrivacyKitError { readonly provider: PrivacyProvider; constructor(provider: PrivacyProvider, cause?: Error); } /** * Error thrown when a token is not supported */ declare class UnsupportedTokenError extends PrivacyKitError { readonly token: string; readonly provider?: PrivacyProvider | undefined; constructor(token: string, provider?: PrivacyProvider | undefined); } /** * Error thrown when privacy level is not supported */ declare class UnsupportedPrivacyLevelError extends PrivacyKitError { readonly level: PrivacyLevel; readonly provider?: PrivacyProvider | undefined; constructor(level: PrivacyLevel, provider?: PrivacyProvider | undefined); } /** * Error thrown when balance is insufficient */ declare class InsufficientBalanceError extends PrivacyKitError { readonly required: number; readonly available: number; readonly token: string; constructor(required: number, available: number, token: string); } /** * Error thrown when recipient is not found or invalid */ declare class RecipientNotFoundError extends PrivacyKitError { readonly recipient: string; constructor(recipient: string); } /** * Error thrown when a transaction fails */ declare class TransactionError extends PrivacyKitError { readonly signature?: string | undefined; constructor(message: string, signature?: string | undefined, cause?: Error); } /** * Error thrown when wallet is not connected */ declare class WalletNotConnectedError extends PrivacyKitError { constructor(); } /** * Error thrown when ZK proof generation fails */ declare class ProofGenerationError extends PrivacyKitError { readonly circuit: string; constructor(circuit: string, cause?: Error); } /** * Error thrown when ZK proof verification fails */ declare class ProofVerificationError extends PrivacyKitError { constructor(cause?: Error); } /** * Error thrown when amount is below minimum */ declare class AmountBelowMinimumError extends PrivacyKitError { readonly amount: number; readonly minimum: number; readonly token: string; readonly provider: PrivacyProvider; constructor(amount: number, minimum: number, token: string, provider: PrivacyProvider); } /** * Error thrown when network/RPC connection fails */ declare class NetworkError extends PrivacyKitError { constructor(message: string, cause?: Error); } /** * Type guard to check if error is a PrivacyKitError */ declare function isPrivacyKitError(error: unknown): error is PrivacyKitError; /** * Wrap unknown errors in PrivacyKitError */ declare function wrapError(error: unknown, defaultMessage: string): PrivacyKitError; /** * Default RPC endpoints for each network */ declare const DEFAULT_RPC_ENDPOINTS: Record; /** * Helius RPC endpoints (preferred for production) * Users should set HELIUS_API_KEY environment variable */ declare const HELIUS_RPC_ENDPOINTS: Record; /** * Provider-specific API endpoints */ declare const PROVIDER_ENDPOINTS: { shadowwire: { api: string; docs: string; }; arcium: { api: string; docs: string; }; privacycash: { api: string; docs: string; }; inco: { api: string; docs: string; }; }; /** * Native SOL mint address (wrapped SOL) */ declare const NATIVE_SOL_MINT = "So11111111111111111111111111111111111111112"; /** * Compute unit limits for different operations */ declare const COMPUTE_UNITS: { SIMPLE_TRANSFER: number; PRIVATE_TRANSFER: number; ZK_VERIFY: number; DEPOSIT: number; WITHDRAW: number; }; /** * Default transaction confirmation options */ declare const DEFAULT_CONFIRMATION: { commitment: "confirmed"; maxRetries: number; skipPreflight: boolean; }; /** * Timeout values in milliseconds */ declare const TIMEOUTS: { RPC_CALL: number; TRANSACTION_CONFIRM: number; PROOF_GENERATION: number; }; /** * Version info */ declare const VERSION: { sdk: string; protocol: string; }; /** * Validate a Solana public key string */ declare function isValidPublicKey(address: string): boolean; /** * Parse address to PublicKey */ declare function toPublicKey(address: string | PublicKey): PublicKey; /** * Sleep for a given number of milliseconds */ declare function sleep(ms: number): Promise; /** * Retry a function with exponential backoff */ declare function retry(fn: () => Promise, options?: { maxRetries?: number; baseDelayMs?: number; maxDelayMs?: number; shouldRetry?: (error: unknown) => boolean; }): Promise; /** * Generate a random bytes array */ declare function randomBytes(length: number): Uint8Array; /** * Convert bytes to base58 string */ declare function bytesToBase58(bytes: Uint8Array): string; /** * Convert base58 string to bytes */ declare function base58ToBytes(str: string): Uint8Array; /** * Convert bytes to hex string */ declare function bytesToHex(bytes: Uint8Array): string; /** * Convert hex string to bytes */ declare function hexToBytes(hex: string): Uint8Array; /** * Format SOL amount for display */ declare function formatSol(lamports: number | bigint): string; /** * Format token amount for display */ declare function formatTokenAmount(amount: number, decimals: number, symbol: string): string; /** * Truncate address for display */ declare function truncateAddress(address: string, chars?: number): string; /** * Check if running in browser environment */ declare function isBrowser(): boolean; /** * Check if WASM is supported */ declare function isWasmSupported(): boolean; /** * Noir Circuit Compiler * * Handles compilation of Noir circuits to ACIR (Abstract Circuit Intermediate Representation) * and manages compiled circuit artifacts for the PrivacyKit SDK. */ /** * Compiled circuit interface from @noir-lang/types * Defined locally for compatibility */ interface CompiledCircuit { bytecode: string; abi: { parameters: Array<{ name: string; type: { kind: string; }; visibility: string; }>; return_type: { kind: string; } | null; }; debug_symbols?: string; } /** * Input map type for circuit execution */ type InputMap = Record; /** * Circuit metadata for tracking and management */ interface CircuitMetadata { name: string; description: string; publicInputs: string[]; privateInputs: string[]; version: string; compiledAt?: number; } /** * Compiled circuit artifact with metadata */ interface CompiledCircuitArtifact { circuit: CompiledCircuit; metadata: CircuitMetadata; bytecodeHash: string; } /** * Circuit compilation options */ interface CompileOptions { /** Enable debug symbols for better error messages */ debug?: boolean; /** Optimization level (0-3) */ optimization?: number; /** Output directory for compiled artifacts */ outputDir?: string; } /** * Pre-compiled circuit definitions for PrivacyKit * These are the standard circuits included with the SDK */ declare const CIRCUIT_DEFINITIONS: Record; /** * NoirCompiler class for compiling and managing Noir circuits */ declare class NoirCompiler { private compiledCircuits; private circuitsPath; private outputPath; constructor(options?: { circuitsPath?: string; outputPath?: string; }); /** * Load a pre-compiled circuit artifact from disk */ loadCompiledCircuit(circuitName: string): Promise; /** * Load circuit from inline JSON artifact * Used for bundled circuits that are embedded in the SDK */ loadFromArtifact(circuitName: string, artifact: CompiledCircuit, metadata?: Partial): Promise; /** * Get a compiled circuit by name */ getCircuit(circuitName: string): CompiledCircuitArtifact | undefined; /** * List all loaded circuits */ listLoadedCircuits(): string[]; /** * Get circuit metadata */ getCircuitMetadata(circuitName: string): CircuitMetadata | undefined; /** * Validate inputs against circuit definition */ validateInputs(circuitName: string, publicInputs: InputMap, privateInputs: InputMap): { valid: boolean; errors: string[]; }; /** * Compute a hash of the bytecode for integrity verification */ private computeBytecodeHash; /** * Clear cached circuits */ clearCache(): void; /** * Export circuit artifact to JSON */ exportCircuit(circuitName: string): string | null; } /** * Default compiler instance */ declare const defaultCompiler: NoirCompiler; /** * Create a new compiler with custom options */ declare function createCompiler(options?: { circuitsPath?: string; outputPath?: string; }): NoirCompiler; /** * Utility to format circuit inputs for the prover */ declare function formatInputs(publicInputs: Record, privateInputs: Record): InputMap; /** * Noir Prover * * Generates real Groth16 proofs using @noir-lang/noir_js and @noir-lang/backend_barretenberg. * This is the production-ready proof generation system for PrivacyKit. */ /** * Proof generation result */ interface ProofResult { /** Serialized proof bytes */ proof: Uint8Array; /** Public inputs used in the proof */ publicInputs: string[]; /** Verification key for on-chain verification */ verificationKey: Uint8Array; /** Circuit that was proven */ circuitName: string; /** Proof generation time in milliseconds */ provingTimeMs: number; /** Proof size in bytes */ proofSize: number; } /** * Prover configuration options */ interface ProverConfig { /** Number of threads for proof generation (default: auto) */ threads?: number; /** Memory limit in MB (default: 4096) */ memoryLimitMb?: number; /** Enable recursive proof aggregation */ recursive?: boolean; /** Logger instance */ logger?: Logger; } /** * NoirProver class for generating ZK proofs * * This prover uses the Barretenberg backend which implements: * - UltraPlonk proving system * - Groth16-compatible proof format * - Efficient recursive proof composition */ declare class NoirProver { private compiler; private backends; private noirInstances; private verificationKeys; private config; private logger; private initialized; constructor(compiler?: NoirCompiler, config?: ProverConfig); /** * Initialize the prover with a circuit * Must be called before generating proofs */ initialize(circuitName: string, circuit?: CompiledCircuit): Promise; /** * Check if prover is initialized for a circuit */ isInitialized(circuitName: string): boolean; /** * Generate a proof for the given inputs */ prove(circuitName: string, publicInputs: Record, privateInputs: Record): Promise; /** * Generate multiple proofs in parallel */ proveMany(requests: Array<{ circuitName: string; publicInputs: Record; privateInputs: Record; }>): Promise; /** * Get the verification key for a circuit */ getVerificationKey(circuitName: string): Uint8Array | undefined; /** * Serialize verification key for on-chain deployment */ serializeVerificationKeyForSolana(circuitName: string): Uint8Array | null; /** * Get proof statistics */ getStats(): { initializedCircuits: string[]; totalProofsGenerated: number; averageProvingTime: number; }; /** * Cleanup resources */ destroy(): Promise; } /** * Convenience functions for common proof types */ /** * Generate a private transfer proof */ declare function generatePrivateTransferProof(prover: NoirProver, params: { amount: bigint; senderBlinding: bigint; recipientBlinding: bigint; nullifierSecret: bigint; }): Promise; /** * Generate a balance threshold proof */ declare function generateBalanceThresholdProof(prover: NoirProver, params: { balance: bigint; threshold: bigint; blinding: bigint; }): Promise; /** * Generate an ownership proof */ declare function generateOwnershipProof(prover: NoirProver, params: { asset: bigint; ownerSecret: bigint; merklePath: bigint[]; pathIndices: number[]; nullifierSecret: bigint; merkleRoot: bigint; }): Promise; /** * Get the default prover instance */ declare function getDefaultProver(): NoirProver; /** * Create a new prover with custom configuration */ declare function createProver(compiler?: NoirCompiler, config?: ProverConfig): NoirProver; /** * Noir Verifier * * Handles local and on-chain verification of Groth16 proofs generated by the Noir prover. * Supports both off-chain verification (for testing) and on-chain verification via Solana programs. */ /** * Verification result */ interface VerificationResult { /** Whether the proof is valid */ valid: boolean; /** Circuit name that was verified */ circuitName: string; /** Verification time in milliseconds */ verificationTimeMs: number; /** For on-chain verification, the transaction signature */ signature?: string; /** Any error message if verification failed */ error?: string; } /** * On-chain verifier configuration */ interface OnChainVerifierConfig { /** Solana connection */ connection: Connection; /** Wallet for signing transactions */ wallet: WalletAdapter; /** Custom verifier program ID (defaults to Sunspot) */ verifierProgramId?: PublicKey; } /** * Sunspot Groth16 Verifier Program ID * This is the production verifier deployed by Reilabs */ declare const SUNSPOT_VERIFIER_PROGRAM_ID: PublicKey; /** * NoirVerifier class for verifying ZK proofs */ declare class NoirVerifier { private compiler; private backends; private logger; constructor(compiler?: NoirCompiler, logger?: Logger); /** * Initialize the verifier for a circuit */ initialize(circuitName: string, circuit?: CompiledCircuit): Promise; /** * Check if verifier is initialized for a circuit */ isInitialized(circuitName: string): boolean; /** * Verify a proof locally (off-chain) */ verifyLocal(proofResult: ProofResult): Promise; /** * Verify a proof on-chain using Solana */ verifyOnChain(proofResult: ProofResult, config: OnChainVerifierConfig): Promise; /** * Create the verification instruction for Sunspot */ private createVerifyInstruction; /** * Encode public inputs as bytes for on-chain verification */ private encodePublicInputs; /** * Convert BigInt to 32-byte array (big-endian) */ private bigIntToBytes32; /** * Deploy a verification key on-chain for repeated use */ deployVerificationKey(circuitName: string, verificationKey: Uint8Array, config: OnChainVerifierConfig): Promise<{ address: PublicKey; signature: string; }>; /** * Verify a proof using a pre-deployed verification key */ verifyWithDeployedKey(proof: Uint8Array, publicInputs: string[], vkAccount: PublicKey, config: OnChainVerifierConfig): Promise; /** * Cleanup resources */ destroy(): Promise; } /** * Utility: Verify a proof without initializing a full verifier * Useful for one-off verifications */ declare function verifyProofQuick(circuit: CompiledCircuit, proof: Uint8Array, publicInputs: string[]): Promise; /** * Get the default verifier instance */ declare function getDefaultVerifier(): NoirVerifier; /** * Create a new verifier with custom configuration */ declare function createVerifier(compiler?: NoirCompiler, logger?: Logger): NoirVerifier; /** * ShadowPay/RADR API Types * * Type definitions matching the actual ShadowPay API at https://shadow.radr.fun * Based on @shadowpay/core, @shadowpay/server, and @shadowpay/client packages */ /** * Supported tokens for ShadowPay transactions */ type ShadowPayToken = 'SOL' | 'USDC' | 'USDT' | string; /** * Token configuration with decimals and mint addresses */ interface TokenConfig { symbol: string; decimals: number; mint?: string; fee: number; minAmount: number; } /** * Payment requirement for protecting routes/content */ interface PaymentRequirement { /** Amount required in token units */ amount: number; /** Token type (SOL, USDC, USDT, or SPL mint address) */ token: ShadowPayToken; /** Optional memo/description */ memo?: string; /** Optional expiry time in seconds */ expiresIn?: number; } /** * Payment verification result from verify-access endpoint */ interface PaymentVerification { /** Whether the payment is authorized */ authorized: boolean; /** Payment status */ status: 'paid' | 'unpaid' | 'expired' | 'invalid'; /** Amount paid (if authorized) */ amount?: number; /** Token used for payment */ token?: ShadowPayToken; /** Wallet address that made the payment */ payer?: string; /** Timestamp when payment was made */ timestamp?: number; /** Payment/transaction ID */ paymentId?: string; /** Access token expiry */ expiresAt?: number; } /** * Payment request for client-side payment creation */ interface PaymentRequest { /** Recipient/merchant public key */ to: string; /** Amount in token units */ amount: number; /** Token type */ token: ShadowPayToken; /** Optional memo */ memo?: string; /** Optional metadata */ metadata?: Record; } /** * Payment result after successful payment */ interface PaymentResult { /** Whether payment was successful */ success: boolean; /** Transaction signature on Solana */ signature?: string; /** Access token for accessing protected content */ accessToken?: string; /** Payment ID */ paymentId?: string; /** Fee paid */ fee?: number; /** Error message if failed */ error?: string; /** Error code if failed */ errorCode?: ShadowPayErrorCode; } /** * Webhook event types from ShadowPay */ type WebhookEventType = 'payment.success' | 'payment.failed' | 'payment.refunded' | 'payment.pending' | 'payment.expired'; /** * Webhook event payload */ interface WebhookEvent { /** Event type */ type: WebhookEventType; /** Event timestamp */ timestamp: number; /** Event data */ data: { paymentId: string; amount: number; token: ShadowPayToken; payer: string; recipient: string; signature?: string; error?: string; }; /** Event signature for verification */ signature: string; } /** * ShadowPay API error codes */ declare enum ShadowPayErrorCode { MISSING_API_KEY = "MISSING_API_KEY", INVALID_API_KEY = "INVALID_API_KEY", MISSING_ACCESS_TOKEN = "MISSING_ACCESS_TOKEN", INVALID_ACCESS_TOKEN = "INVALID_ACCESS_TOKEN", EXPIRED_ACCESS_TOKEN = "EXPIRED_ACCESS_TOKEN", PAYMENT_REQUIRED = "PAYMENT_REQUIRED", PAYMENT_FAILED = "PAYMENT_FAILED", INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE", AMOUNT_BELOW_MINIMUM = "AMOUNT_BELOW_MINIMUM", INVALID_AMOUNT = "INVALID_AMOUNT", INVALID_RECIPIENT = "INVALID_RECIPIENT", UNSUPPORTED_TOKEN = "UNSUPPORTED_TOKEN", INVALID_TOKEN = "INVALID_TOKEN", TRANSACTION_FAILED = "TRANSACTION_FAILED", SIGNATURE_VERIFICATION_FAILED = "SIGNATURE_VERIFICATION_FAILED", PROOF_GENERATION_FAILED = "PROOF_GENERATION_FAILED", PROOF_VERIFICATION_FAILED = "PROOF_VERIFICATION_FAILED", NETWORK_ERROR = "NETWORK_ERROR", RPC_ERROR = "RPC_ERROR", TIMEOUT = "TIMEOUT", RATE_LIMITED = "RATE_LIMITED", INTERNAL_ERROR = "INTERNAL_ERROR", UNKNOWN_ERROR = "UNKNOWN_ERROR" } /** * ShadowPay API error response */ interface ShadowPayApiError { error: string; code?: ShadowPayErrorCode; status?: string; details?: Record; } /** * ElGamal encrypted amount */ interface EncryptedAmount { /** Ciphertext component 1 (point on BN254 curve) */ c1: string; /** Ciphertext component 2 (point on BN254 curve) */ c2: string; } /** * ElGamal keypair for amount encryption */ interface ElGamalKeypair { /** Private key (scalar) */ privateKey: Uint8Array; /** Public key (point on curve) */ publicKey: string; } /** * ZK Proof for payment verification */ interface ZKProof { /** Proof data (Groth16 format) */ proof: { pi_a: string[]; pi_b: string[][]; pi_c: string[]; }; /** Public signals */ publicSignals: string[]; } /** * Payment commitment for privacy pool */ interface PaymentCommitment { /** Sender commitment hash */ senderCommitment: string; /** Receiver commitment hash */ receiverCommitment?: string; /** Payment commitment hash */ paymentCommitment: string; /** Salt used in commitment */ salt: string; /** Nullifier for double-spend prevention */ nullifier?: string; } /** * Private transfer request */ interface PrivateTransferRequest { /** Sender wallet address */ sender: string; /** Recipient address */ recipient: string; /** Amount in token units */ amount: number; /** Token type */ token: ShadowPayToken; /** Transfer type: internal (amount hidden) or external (sender hidden) */ type: 'internal' | 'external'; /** Timestamp for replay protection */ timestamp: number; /** Wallet signature */ signature: string; /** Optional ZK proof for internal transfers */ proof?: ZKProof; /** Encrypted amount for internal transfers */ encryptedAmount?: EncryptedAmount; } /** * Private transfer response */ interface PrivateTransferResponse { success: boolean; transactionId?: string; signature?: string; fee?: number; error?: string; errorCode?: ShadowPayErrorCode; } /** * Deposit request into privacy pool */ interface DepositRequest { /** Wallet address */ wallet: string; /** Amount in smallest units (lamports, etc.) */ amount: string; /** Token type */ token: ShadowPayToken; /** Timestamp */ timestamp: number; /** Wallet signature */ signature: string; /** Commitment for future withdrawal */ commitment?: PaymentCommitment; } /** * Deposit response */ interface DepositResponse { success: boolean; transactionId?: string; signature?: string; commitment?: string; fee?: number; error?: string; errorCode?: ShadowPayErrorCode; } /** * Withdrawal request from privacy pool */ interface WithdrawalRequest { /** Wallet address */ wallet: string; /** Recipient address */ recipient: string; /** Amount in smallest units */ amount: string; /** Token type */ token: ShadowPayToken; /** Timestamp */ timestamp: number; /** Wallet signature */ signature: string; /** Nullifier to prevent double-spend */ nullifier?: string; /** ZK proof of valid withdrawal */ proof?: ZKProof; } /** * Withdrawal response */ interface WithdrawalResponse { success: boolean; transactionId?: string; signature?: string; fee?: number; error?: string; errorCode?: ShadowPayErrorCode; } /** * Balance query response */ interface BalanceResponse { /** Balance in token units */ balance: number; /** Token type */ token: ShadowPayToken; /** Whether balance is shielded/private */ shielded?: boolean; /** Last updated timestamp */ updatedAt?: number; } /** * Circuit URLs for ZK proof generation */ interface CircuitUrls { /** WebAssembly circuit file */ wasm: string; /** ZKey file for proving */ zkey: string; /** Verification key */ vkey: string; } /** * ShadowPay client configuration */ interface ShadowPayClientConfig { /** API key for authentication */ apiKey?: string; /** Custom API URL (default: https://shadow.radr.fun) */ apiUrl?: string; /** Network: 'mainnet-beta' or 'devnet' */ network?: 'mainnet-beta' | 'devnet'; /** Request timeout in ms */ timeout?: number; /** Enable debug logging */ debug?: boolean; } /** * ShadowPay SDK initialization options */ interface ShadowPayInitOptions extends ShadowPayClientConfig { /** Preload ZK circuits for faster proof generation */ preloadCircuits?: boolean; /** Custom circuit URLs */ circuitUrls?: Partial; } /** * ShadowPay Authentication Module * * Handles API key authentication, message signing, and access token verification * for the ShadowPay API at https://shadow.radr.fun */ /** * Default API URL for ShadowPay */ declare const SHADOWPAY_API_URL = "https://shadow.radr.fun"; /** * API version prefix */ declare const API_VERSION = "shadowpay/v1"; /** * Authentication headers required by the API */ interface AuthHeaders { 'Content-Type': string; 'X-API-Key'?: string; 'X-Access-Token'?: string; Authorization?: string; [key: string]: string | undefined; } /** * Create authentication headers for API requests */ declare function createAuthHeaders(options: { apiKey?: string; accessToken?: string; }): AuthHeaders; /** * Create a signed message for authentication * This follows the ShadowPay signing scheme */ declare function createSignedMessage(wallet: WalletAdapter, payload: Record): Promise<{ message: string; signature: string; }>; /** * Create a transfer authentication payload */ declare function createTransferPayload(params: { action: 'transfer' | 'deposit' | 'withdraw'; sender: string; recipient?: string; amount: number; token: string; type?: 'internal' | 'external'; timestamp?: number; }): Record; /** * Verify an access token against the ShadowPay API */ declare function verifyAccessToken(accessToken: string, apiUrl?: string, requirement?: PaymentRequirement): Promise; /** * Create payment requirement header for 402 responses */ declare function createPaymentRequirementHeader(requirement: PaymentRequirement): string; /** * Parse payment requirement from header */ declare function parsePaymentRequirementHeader(header: string): PaymentRequirement | null; /** * Webhook signature verification using HMAC-SHA256 * * ShadowPay webhooks are signed with HMAC-SHA256. * The signature header format is: sha256= */ declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean; /** * Error code to HTTP status mapping */ declare function errorCodeToStatus(code: ShadowPayErrorCode): number; /** * Check if an error response indicates rate limiting */ declare function isRateLimited(response: Response): boolean; /** * Get retry-after value from rate limit response */ declare function getRetryAfter(response: Response): number | null; /** * ShadowPay API Client * * Typed API client for the ShadowPay/RADR API at https://shadow.radr.fun * Implements the official API endpoints for private payments on Solana. * * API Documentation: * - NPM: @shadowpay/core, @shadowpay/server, @shadowpay/client * - Registry: https://registry.scalar.com/@radr/apis/shadowpay-api */ /** * Default circuit URLs for ZK proof generation */ declare const DEFAULT_CIRCUIT_URLS: CircuitUrls; /** * ShadowPay Program ID on Solana mainnet */ declare const SHADOWPAY_PROGRAM_ID = "GQBqwwoikYh7p6KEUHDUu5r9dHHXx9tMGskAPubmFPzD"; /** * Token configurations for ShadowPay * Based on actual supported tokens from the ShadowPay protocol */ declare const SHADOWPAY_TOKENS: Record; /** * API error class for ShadowPay */ declare class ShadowPayApiErrorClass extends Error { readonly code: ShadowPayErrorCode; readonly status: number; readonly details?: Record | undefined; constructor(message: string, code: ShadowPayErrorCode, status: number, details?: Record | undefined); static fromResponse(error: ShadowPayApiError, status: number): ShadowPayApiErrorClass; } /** * ShadowPay API Client * * Provides typed methods for interacting with the ShadowPay API. * * @example * ```typescript * const client = new ShadowPayApiClient({ * apiKey: process.env.SHADOWPAY_API_KEY, * network: 'mainnet-beta' * }); * * // Verify a payment * const verification = await client.verifyPayment(accessToken, { * amount: 0.001, * token: 'SOL' * }); * * // Execute a private transfer * const result = await client.transfer({ * sender: walletAddress, * recipient: recipientAddress, * amount: 1.0, * token: 'SOL', * type: 'internal', * timestamp: Date.now(), * signature: signatureBase64 * }); * ``` */ declare class ShadowPayApiClient { private readonly apiUrl; private readonly apiKey?; private readonly timeout; private readonly debug; constructor(config?: ShadowPayClientConfig); /** * Build full API URL */ private buildUrl; /** * Make an authenticated API request */ private request; /** * Check API health */ health(): Promise<{ status: 'ok' | 'error'; version?: string; }>; /** * Verify a payment access token * * @param accessToken - The access token from X-Access-Token header * @param requirement - Optional payment requirement to validate against * @returns Payment verification result */ verifyPayment(accessToken: string, requirement?: PaymentRequirement): Promise; /** * Get balance for a wallet address * * Note: The actual ShadowPay API may not expose a direct balance endpoint. * Balance queries may need to be done via on-chain program queries. * * @param address - Wallet address * @param token - Token symbol */ getBalance(address: string, token: ShadowPayToken): Promise; /** * Execute a private transfer * * @param request - Transfer request with signature */ transfer(request: PrivateTransferRequest): Promise; /** * Deposit tokens into privacy pool * * @param request - Deposit request with signature */ deposit(request: DepositRequest): Promise; /** * Withdraw tokens from privacy pool * * @param request - Withdrawal request with signature and proof */ withdraw(request: WithdrawalRequest): Promise; /** * Create a payment request (for merchant integration) * * @param request - Payment request parameters */ createPayment(request: PaymentRequest): Promise; /** * Get token configuration */ getTokenConfig(token: ShadowPayToken): TokenConfig | undefined; /** * Check if a token is supported */ isTokenSupported(token: ShadowPayToken): boolean; /** * Get circuit URLs for ZK proof generation */ getCircuitUrls(): CircuitUrls; /** * Parse webhook event * * @param rawBody - Raw request body * @param signature - Webhook signature from headers * @param secret - Webhook secret for verification */ parseWebhookEvent(rawBody: string, signature: string, secret: string): WebhookEvent | null; /** * Calculate fee for a transaction * * @param amount - Amount in token units * @param token - Token symbol */ calculateFee(amount: number, token: ShadowPayToken): number; /** * Validate amount against minimum * * @param amount - Amount in token units * @param token - Token symbol */ validateAmount(amount: number, token: ShadowPayToken): { valid: boolean; error?: string; }; /** * Convert amount to smallest units (lamports, etc.) */ toSmallestUnit(amount: number, token: ShadowPayToken): bigint; /** * Convert from smallest units to token amount */ fromSmallestUnit(amount: bigint, token: ShadowPayToken): number; } /** * Create a ShadowPay API client instance * * @example * ```typescript * const client = createShadowPayClient({ * apiKey: process.env.SHADOWPAY_API_KEY * }); * ``` */ declare function createShadowPayClient(config?: ShadowPayClientConfig): ShadowPayApiClient; /** * Poseidon Hash Implementation * * Production-ready Poseidon hash function using circomlibjs. * This is the same hash function used in Tornado Cash and other * privacy protocols for ZK-SNARK friendly hashing. * * Poseidon operates over the BN254 scalar field and is optimized * for use in Groth16/PLONK circuits. */ declare const SNARK_FIELD_SIZE: bigint; /** * Initialize Poseidon hash function * Uses circomlibjs if available, otherwise uses native implementation */ declare function initPoseidon(): Promise; /** * Hash two field elements using Poseidon */ declare function poseidonHash(left: bigint, right: bigint): Promise; /** * Hash a single field element using Poseidon */ declare function poseidonHashSingle(input: bigint): Promise; /** * Hash multiple field elements using Poseidon sponge construction */ declare function poseidonHashMany(inputs: bigint[]): Promise; /** * Convert bytes to field element */ declare function bytesToField(bytes: Uint8Array): bigint; /** * Convert field element to bytes (32 bytes, big-endian) */ declare function fieldToBytes(field: bigint): Uint8Array; /** * Convert hex string to field element */ declare function hexToField(hex: string): bigint; /** * Convert field element to hex string */ declare function fieldToHex(field: bigint): string; /** * Generate a random field element */ declare function randomFieldElement(): bigint; /** * Check if a value is a valid field element */ declare function isValidFieldElement(value: bigint): boolean; /** * Merkle Tree Implementation with Poseidon Hash * * Production-ready incremental Merkle tree for Privacy Cash protocol. * Uses Poseidon hash function for ZK-SNARK friendly operations. * * Tree structure: * - 20 levels deep (supports 2^20 = ~1M leaves) * - Binary tree with Poseidon(left, right) for internal nodes * - Zero values for empty leaves (precomputed) */ /** * Default Merkle tree depth * 20 levels = 2^20 = 1,048,576 possible leaves */ declare const DEFAULT_TREE_DEPTH = 20; /** * Initialize zero values for the Merkle tree */ declare function initZeroValues(depth?: number): Promise; /** * Get zero value for a specific level */ declare function getZeroValue(level: number): Promise; /** * Incremental Merkle Tree * * An append-only binary Merkle tree that efficiently updates * when new leaves are added. Uses the "filled subtrees" optimization * to minimize hash computations. */ declare class IncrementalMerkleTree { /** Tree depth */ readonly depth: number; /** Number of leaves currently in the tree */ private nextIndex; /** Filled subtrees for efficient updates */ private filledSubtrees; /** Current Merkle root */ private currentRoot; /** All leaves in order */ private leaves; /** Historical roots */ private roots; /** Zero values for each level */ private zeros; /** Maximum number of historical roots to keep */ private maxRootsHistory; /** * Create a new incremental Merkle tree */ constructor(depth?: number); /** * Initialize the tree (must be called before use) */ initialize(): Promise; /** * Get the current Merkle root */ getRoot(): bigint; /** * Get the next available leaf index */ getNextIndex(): number; /** * Get all historical roots */ getRoots(): bigint[]; /** * Check if a root is valid (current or historical) */ isKnownRoot(root: bigint): boolean; /** * Insert a new leaf into the tree * Returns the leaf index */ insert(leaf: bigint): Promise; /** * Generate a Merkle proof for a leaf at the given index */ generateProof(leafIndex: number): Promise; /** * Get node value at a specific level * Level 0 = leaves, Level depth = root */ private getNodeAtLevel; /** * Verify a Merkle proof */ verifyProof(leaf: bigint, proof: MerkleProof): Promise; /** * Get tree statistics */ getStats(): { depth: number; leaves: number; capacity: number; utilizationPercent: number; }; /** * Export tree state for persistence */ exportState(): { depth: number; nextIndex: number; leaves: string[]; roots: string[]; filledSubtrees: string[]; }; /** * Import tree state from persistence */ importState(state: { depth: number; nextIndex: number; leaves: string[]; roots: string[]; filledSubtrees: string[]; }): Promise; } /** * Create a new initialized Merkle tree */ declare function createMerkleTree(depth?: number): Promise; /** * Verify a standalone Merkle proof (without tree instance) */ declare function verifyMerkleProof(leaf: bigint, proof: MerkleProof): Promise; /** * Compute Merkle root from leaf and proof */ declare function computeRootFromProof(leaf: bigint, proof: MerkleProof): Promise; /** * Batch insert multiple leaves efficiently */ declare function batchInsert(tree: IncrementalMerkleTree, leaves: bigint[]): Promise; /** * ZK-SNARK Proof Generator for Privacy Cash * * Production-ready Groth16 proof generation using snarkjs. * Generates withdrawal proofs that demonstrate: * 1. Knowledge of a secret and nullifier that hash to a commitment * 2. The commitment is in the Merkle tree (via valid Merkle proof) * 3. The nullifier hasn't been used before * * Without revealing the secret, nullifier, or which deposit is being withdrawn. */ /** * Initialize the prover with circuit artifacts */ declare function initProver(artifacts?: Partial): Promise; /** * Check if real proving is available */ declare function isRealProvingAvailable(): boolean; /** * Generate a withdrawal proof */ declare function generateWithdrawalProof(note: DepositNote, merkleProof: MerkleProof, recipientAddress: string, relayerAddress?: string, fee?: number, refund?: number): Promise; /** * Verify a withdrawal proof */ declare function verifyWithdrawalProof(proof: WithdrawalProof): Promise; /** * Serialize proof for on-chain submission */ declare function serializeProof(proof: WithdrawalProof): Uint8Array; /** * Deserialize proof from on-chain data */ declare function deserializeProof(data: Uint8Array): WithdrawalProof; /** * Estimate proof generation time based on environment */ declare function estimateProofTime(): number; /** * Get proof generation status */ declare function getProverStatus(): { initialized: boolean; realProvingAvailable: boolean; artifactsLoaded: { wasm: boolean; zkey: boolean; vkey: boolean; }; }; export { API_VERSION, type ARXNodeInfo, AesCipher, AmountBelowMinimumError, ArciumAdapter, ArciumClient, type ArciumClientConfig, type ArciumCluster, ArciumEncryption, ArciumError, ArciumErrorType, type ArciumProgramAddresses, type AuthHeaders, type BalanceResponse, type BalanceResult, BaseAdapter, CIRCUIT_DEFINITIONS, CLUSTER_OFFSETS, COMPUTE_UNITS, CSPLRescueCipher, CSPLTokenClient, type CSPLTokenConfig, CSPL_PROGRAM_IDS, CSPL_TOKEN_CONFIGS, CURVE25519_CONSTANTS, type CallbackConfig, type CircuitArtifacts, type CircuitMetadata, type CircuitUrls, type ClusterAccount, type ClusterConfig, type CompileOptions, type CompiledCircuitArtifact, type ComputationAccount, type ComputationDefinition, type ComputationResult, ComputationStatus, ConfidentialAccountState, type ConfidentialTokenAccount, type ConfidentialTransferRequest, DEFAULT_CIRCUIT_URLS, DEFAULT_CONFIRMATION, DEFAULT_RPC_ENDPOINTS, DEFAULT_TREE_DEPTH, type DepositEvent, type DepositRequest$1 as DepositRequest, type DepositResponse, type DepositResult, type ElGamalKeypair, type EncodedNote, type EncryptedAmount, type EncryptedValue, EncryptionOwner, type EstimateRequest, type EstimateResult, type ExecutingPoolAccount, type FieldInfo, type Groth16Proof, HELIUS_RPC_ENDPOINTS, IncrementalMerkleTree, InsufficientBalanceError, LogLevel, Logger, MINIMUM_AMOUNTS, type MXEAccount, MXEStatus, type MempoolAccount, type MempoolPriorityFeeStats, type MerkleProof, NATIVE_SOL_MINT, type NetworkCluster, NetworkError, NoirAdapter, NoirCompiler, NoirProver, NoirVerifier, type OnChainVerifierConfig, PROVIDER_ENDPOINTS, PROVIDER_FEES, type Packer, type PaymentCommitment, type PaymentRequest, type PaymentRequirement, type PaymentResult, type PaymentVerification, PipelineBuilder, type PipelineResult, type PipelineStep, type PoolState, type PoseidonFn, PrivacyCashAdapter, type DepositNote as PrivacyCashDepositNote, type PoolConfig as PrivacyCashPoolConfig, type ProverConfig$1 as PrivacyCashProverConfig, type VerificationKey as PrivacyCashVerificationKey, PrivacyKit, type PrivacyKitConfig, PrivacyKitError, type PrivacyKitEvents, PrivacyLevel, PrivacyProvider, type PrivacyProviderAdapter, PrivacyRouter, type PrivateTransferRequest, type PrivateTransferResponse, ProofGenerationError, type ProofResult, ProofVerificationError, type ProveRequest, type ProveResult, type ProverConfig, ProviderNotAvailableError, type QueueComputationParams, RESCUE_CIPHER_CONFIG, RecipientNotFoundError, type RelayerInfo, RescueCipher, type RescueCipherParams, SHADOWPAY_API_URL, SHADOWPAY_PROGRAM_ID, SHADOWPAY_TOKENS, SNARK_FIELD_SIZE, SUNSPOT_VERIFIER_PROGRAM_ID, SUPPORTED_TOKENS, type SelectionCriteria, type SelectionResult, ShadowPayApiClient, ShadowPayApiErrorClass, type ShadowPayClientConfig, type DepositRequest as ShadowPayDepositRequest, ShadowPayErrorCode, type ShadowPayInitOptions, type ShadowPayToken, ShadowWireAdapter, type ShieldRequest, type SupportedToken, TIMEOUTS, type TokenConfig, TransactionError, type TransferOptions, type TransferRequest, type TransferResult, type UnshieldRequest, UnsupportedPrivacyLevelError, UnsupportedTokenError, VERSION, type VerificationResult, type WalletAdapter, WalletNotConnectedError, type WebhookEvent, type WebhookEventType, type WithdrawRequest, type WithdrawResult, type WithdrawalCircuitInputs, type WithdrawalEvent, type WithdrawalProof, type WithdrawalPublicSignals, type WithdrawalRequest, type WithdrawalResponse, X25519, type X25519KeyPair, type ZKProof, base58ToBytes, batchInsert, bytesToBase58, bytesToField, bytesToHex, compDefOffset, computeRootFromProof, computeStealthCommitment, createAdapter, createAuthHeaders, createCSPLClient, createCompiler, createDebugLogger, createDevnetClient, createMainnetClient, createMerkleTree, createNoteFromParams, createPaymentRequirementHeader, createProver, createShadowPayClient, createSignedMessage, createTransferPayload, createVerifier, decodeNote, PrivacyKit as default, defaultCompiler, defaultLogger, deserializeLE, deserializeProof, encodeNote, errorCodeToStatus, estimateProofTime, fieldToBytes, fieldToHex, formatInputs, formatSol, formatTokenAmount, fromSmallestUnit, generateBalanceThresholdProof, generateDepositNote, generateDeterministicNote, generateOwnershipProof, generatePrivateTransferProof, generateWithdrawalProof, getAllAdapters, getDefaultProver, getDefaultVerifier, getMinimumAmount, getProverStatus, getProviderFee, getProvidersForToken, getRetryAfter, getTokenInfo, getZeroValue, hexToBytes, hexToField, initPoseidon, initProver, initZeroValues, isBrowser, isPrivacyKitError, isRateLimited, isRealProvingAvailable, isTokenSupported, isValidFieldElement, isValidPublicKey, isWasmSupported, parsePaymentRequirementHeader, poseidonHash, poseidonHashMany, poseidonHashSingle, positiveModulo, randomBytes, randomFieldElement, regenerateCommitment, retry, serializeLE, serializeProof, sha256, sleep, splitIntoNotes, toPublicKey, toSmallestUnit, truncateAddress, verifyAccessToken, verifyMerkleProof, verifyNote, verifyProofQuick, verifyWebhookSignature, verifyWithdrawalProof, wrapError };