import { c as Address } from "../../abi-Bjd7pZee.mjs"; import { a as Chain, d as WalletRpcSchema, i as WalletActions, n as Client, o as Transport, t as Account, u as RpcSchema } from "../../entryPointVersion-Cm2jyUEb.mjs"; import { S as Prettify } from "../../misc-BASHpEmW.mjs"; import { t as PublicClient } from "../../createPublicClient-B-Rn2OS7.mjs"; import { _ as WalletConnectSignerConfig, c as QueuedTransaction, d as SignMessageResult, f as SignTypedDataResult, g as TransactionRequest, h as TransactionContext, l as SendTransactionResult, m as TransactionBatch, o as TransactionRecord, p as SpendingPolicy, s as WalletState, u as SessionState } from "../../types-mW0rZolZ.mjs"; //#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_types/clients/createWalletClient.d.ts type WalletClient = Prettify>>; //#endregion //#region node_modules/.pnpm/@clawnch+sdk@2.2.1_@walletconnect+sign-client@2.23.6_typescript@6.0.2_zod@4.3.6__viem@2.47.6_typescript@6.0.2_zod@4.3.6_/node_modules/@clawnch/sdk/dist/signer.d.ts /** * WalletConnectSigner — Human-approved transaction signing for autonomous agents */ declare class WalletConnectSigner { private readonly projectId; private readonly chain; private readonly sessionPath?; private readonly policies; private readonly metadata; private readonly requestTimeout; private readonly onTransactionQueued?; private readonly onTransactionApproved?; private readonly onTransactionRejected?; private readonly onSessionChange?; private client; private session; private connectedAddress; private connectedChainId; private queue; private queueCounter; private policyUsage; private sessionResolve; private sessionReject; constructor(config: WalletConnectSignerConfig); /** * Initialize the WalletConnect client and attempt to restore a persisted session. * If no valid session exists, generates a pairing URI for the user to scan. * * @returns The pairing URI (null if session was restored from disk) */ connect(): Promise<{ uri: string | null; restored: boolean; }>; /** * Wait for the user to scan the QR code and approve the pairing. * Resolves when session is established. Rejects if user rejects or timeout. */ waitForSession(timeoutMs?: number): Promise<{ address: Address; chainId: number; }>; /** * Disconnect the current session */ disconnect(): Promise; /** * Get current session state */ getState(): SessionState; /** * Whether a session is currently active */ get isConnected(): boolean; /** * The connected wallet address (null if not connected) */ get address(): Address | null; /** * Send a transaction via the connected wallet. * * If the transaction matches a spending policy, it is auto-approved. * Otherwise, it is sent to the user's wallet for manual approval. * * @param transaction - Transaction parameters * @param context - Human-readable context for the approval UI */ sendTransaction(transaction: TransactionRequest, context?: TransactionContext): Promise; /** * Queue multiple transactions for batch review. * * Auto-approvable transactions are sent immediately. * Remaining transactions are sent sequentially to the wallet for approval. * * @returns Results for each transaction (in order) */ sendTransactionBatch(transactions: Array<{ transaction: TransactionRequest; context?: TransactionContext; }>): Promise<{ batch: TransactionBatch; results: Array; }>; /** * Sign a personal message */ signMessage(message: string): Promise; /** * Sign typed data (EIP-712) */ signTypedData(typedData: { domain: Record; types: Record; primaryType: string; message: Record; }): Promise; /** * Get the current transaction queue */ getQueue(): QueuedTransaction[]; /** * Get pending (unapproved) transactions */ getPendingTransactions(): QueuedTransaction[]; /** * Clear completed/rejected transactions from the queue */ clearQueue(): number; /** * Get current spending policies */ getPolicies(): SpendingPolicy[]; /** * Add a spending policy at runtime */ addPolicy(policy: SpendingPolicy): void; /** * Remove a spending policy by label */ removePolicy(label: string): boolean; /** * Enable or disable a policy by label */ setPolicy(label: string, enabled: boolean): boolean; /** * Check which policy (if any) a transaction would match */ checkPolicy(transaction: TransactionRequest): SpendingPolicy | null; /** * Returns a viem-compatible WalletClient that routes all signing * through this WalletConnectSigner. * * Pass this anywhere the SDK expects a WalletClient — ClawnchDeployer, * direct writeContract calls, etc. * * @param publicClient - A public client for gas estimation and chain reads * * @example * ```typescript * const signer = new WalletConnectSigner({ projectId: '...' }); * await signer.connect(); * await signer.waitForSession(); * * const deployer = new ClawnchDeployer({ * wallet: await signer.toWalletClient(publicClient), * publicClient, * network: 'mainnet', * }); * ``` */ toWalletClient(publicClient?: PublicClient): Promise>; private importSignClient; private registerEventHandlers; private handleSessionEstablished; private wcSendTransaction; private tryRestoreSession; private persistSession; private clearPersistedSession; private matchPolicy; private getPolicyUsage; private recordPolicyUsage; private enqueue; private ensureConnected; private emitSessionState; } //#endregion //#region extensions/crypto/src/services/walletconnect-service.d.ts interface WalletServiceConfig { privateKey?: string; walletConnectProjectId?: string; bankrApiKey?: string; rpcUrl?: string; network?: 'mainnet' | 'sepolia'; sessionPath?: string; policies?: SpendingPolicy[]; onSessionChange?: (state: SessionState) => void; onTransactionQueued?: (tx: QueuedTransaction) => void; onTransactionApproved?: (tx: QueuedTransaction, hash: string) => void; onTransactionRejected?: (tx: QueuedTransaction, reason: string) => void; } declare function initWalletService(config: WalletServiceConfig): Promise<{ mode: 'private_key' | 'walletconnect' | 'bankr' | 'none'; pairingUri?: string; address?: Address; solAddress?: string; }>; /** * Wait for WalletConnect session to be established (after wallet approval). */ declare function waitForWalletSession(timeoutMs?: number): Promise<{ address: Address; chainId: number; }>; declare function getWalletClient(): any; declare function getPublicClient(): any; declare function getWCSigner(): WalletConnectSigner | null; declare function getWalletState(): WalletState; /** * Check if the wallet is in Bankr custodial mode. */ declare function isBankrMode(): boolean; /** * Returns the appropriate execution context for tools that support both * local wallet and Bankr paths. */ declare function requireBankrOrWallet(): { mode: 'bankr'; } | { mode: 'local'; client: any; }; declare function getTransactionHistory(): TransactionRecord[]; declare function requireWalletClient(): any; declare function requirePublicClient(): any; /** * Get a wallet client that routes write transactions through MEV-protected RPCs * (Flashbots Protect, MEV Blocker) when available. Protects against sandwich * attacks and frontrunning by bypassing the public mempool. * * Only effective in private_key mode — WalletConnect transactions are broadcast * by the phone wallet (out of our control), and Bankr transactions are broadcast * by the Bankr API. * * Falls back to the regular wallet client if: * - MEV protection is disabled in RpcManager config * - No MEV RPCs are available for the current chain * - Mode is not private_key (WC, Bankr) */ declare function getMevWalletClient(): Promise; interface AccountTypeResult { /** Account type classification. */ accountType: 'eoa' | 'smart_account' | 'eip7702'; /** Whether the account has on-chain code deployed. */ hasCode: boolean; /** For EIP-7702: the implementation address the EOA delegates to. */ delegationDesignation?: Address; } /** * Detect the account type of the connected wallet via eth_getCode. * * - EOA: getCode returns '0x' (no code) * - Smart Account: getCode returns arbitrary bytecode (not EIP-7702 prefix) * - EIP-7702: getCode returns 0xef0100 + 20-byte implementation address * * Results are cached on the wallet state. Call with `force: true` to re-detect. * Returns null if no wallet is connected or no public client is available. */ declare function detectAccountType(opts?: { force?: boolean; }): Promise; /** * Clear the cached account type detection. Called on disconnect. */ declare function clearAccountTypeCache(): void; declare function disconnectWallet(): Promise; declare function addPolicy(policy: SpendingPolicy): void; declare function removePolicy(label: string): boolean; declare function clearPolicies(): void; //#endregion export { AccountTypeResult, addPolicy, clearAccountTypeCache, clearPolicies, detectAccountType, disconnectWallet, getMevWalletClient, getPublicClient, getTransactionHistory, getWCSigner, getWalletClient, getWalletState, initWalletService, isBankrMode, removePolicy, requireBankrOrWallet, requirePublicClient, requireWalletClient, waitForWalletSession }; //# sourceMappingURL=walletconnect-service.d.mts.map