import { a as SessionKey } from '../../types-C564CfsE.mjs'; import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult, x as RegisterSessionParams, y as RevokeSessionParams, S as SessionValidationResult } from '../../types-DP2CQT8p.mjs'; import { RpcProvider } from 'starknet'; /** * Veridex Protocol SDK - Starknet Chain Client * * Production-grade implementation of ChainClient interface for Starknet. * Supports custom bridge attestation, gasless execution via Hub dispatch. * * Security: * - Native starknet::eth_signature::verify_eth_signature for validation * - Custom bridge with multi-relayer threshold attestations * - Replay protection via nonce verification on Hub * - Bridge validates source_chain == hub_chain_id (10004 = Base Sepolia) * * Architecture: * - Starknet actions MUST be dispatched via Hub (Base Sepolia) * - Hub publishes Wormhole message → relayer monitors → relayer submits attestation * - Bridge accumulates attestations → threshold reached → spoke executes * - Spoke validates source_chain == hubChainId (NOT targetChain) * * Custom Bridge: * - Bridge address: 0x30d2e7f26dc75819cfddcd7caa26a76b681d5918f219c99060c42ce1e3f69e4 * - Chain ID: 50001 (custom range 50000+, reserved for non-Wormhole chains) * - Hub Chain ID: 10004 (Base Sepolia - what bridge validates as source) */ interface StarknetClientConfig { wormholeChainId: number; rpcUrl: string; spokeContractAddress?: string; bridgeContractAddress?: string; network?: 'mainnet' | 'sepolia' | 'testnet'; hubRpcUrl?: string; hubContractAddress?: string; } declare class StarknetClient implements ChainClient { private config; private provider; private hubRpcUrl?; private hubContractAddress?; constructor(config: StarknetClientConfig); getConfig(): ChainConfig; getNonce(_userKeyHash: string): Promise; getMessageFee(): Promise; buildTransferPayload(params: TransferParams): Promise; buildExecutePayload(params: ExecuteParams): Promise; buildBridgePayload(params: BridgeParams): Promise; dispatch(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, nonce: bigint, signer: any): Promise; dispatchGasless(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, nonce: bigint, relayerUrl: string): Promise; computeVaultAddress(userKeyHash: string): string; vaultExists(userKeyHash: string): Promise; createVault(userKeyHash: string, signer: any): Promise; createVaultSponsored?(userKeyHash: string, sponsorPrivateKey: string, rpcUrl?: string): Promise; /** * Create a vault via the relayer (sponsored/gasless) * This is the recommended way to create Starknet vaults * * The relayer will dispatch a vault creation action from Hub via custom bridge to Starknet spoke */ createVaultViaRelayer(userKeyHash: string, relayerUrl: string): Promise; /** * Get vault info via relayer (includes existence check) */ getVaultViaRelayer(userKeyHash: string, relayerUrl: string): Promise<{ vaultAddress: string; exists: boolean; }>; estimateVaultCreationGas(_userKeyHash: string): Promise; getFactoryAddress(): string | undefined; getImplementationAddress(): string | undefined; getNativeBalance(address: string): Promise; getProvider(): RpcProvider; /** * Register a session key on the Hub (must be called via Hub client) * Starknet spokes validate sessions via CCQ, but registration happens on Hub * * @throws Error - Session management must be done via Hub chain */ registerSession(_params: RegisterSessionParams): Promise; /** * Revoke a session key on the Hub (must be called via Hub client) * * @throws Error - Session management must be done via Hub chain */ revokeSession(_params: RevokeSessionParams): Promise; /** * Check if a session is active by querying the Hub * This method queries the Hub contract directly for session validation * * @param userKeyHash - Hash of user's Passkey public key * @param sessionKeyHash - Hash of session key to validate * @returns Session validation result with expiry and limits */ isSessionActive(_userKeyHash: string, _sessionKeyHash: string): Promise; /** * Get all sessions for a user from the Hub * * @param userKeyHash - Hash of user's Passkey public key * @returns Array of all sessions (active and expired/revoked) */ getUserSessions(userKeyHash: string): Promise; /** * Get user state from Hub (comprehensive state query) * Returns key hash, nonce, and last action hash for CCQ validation * * @param userKeyHash - Hash of user's Passkey public key * @returns User state with nonce and last action hash */ getUserState(userKeyHash: string): Promise<{ keyHash: string; nonce: bigint; lastActionHash: string; }>; /** * Get user's last action hash from Hub * Used for optimistic execution and nonce validation * * @param userKeyHash - Hash of user's Passkey public key * @returns Last action hash (zero hash if no actions) */ getUserLastActionHash(userKeyHash: string): Promise; /** * Execute with query-based validation (faster than VAA, ~23s vs 60-90s) * Uses Wormhole CCQ to validate Hub state, then executes on Starknet * * @param params Query execution parameters with CCQ response * @returns Dispatch result with transaction hash * * @remarks * Query-based execution flow: * 1. Query Hub state via Wormhole CCQ * 2. Validate Guardian signatures on query response * 3. Execute on Starknet with validated state * 4. Hub state must be < 60s stale (enforced by QueryVerifier) */ executeWithQuery(_params: { userKeyHash: string; queryResponse: Uint8Array; actionType: number; actionPayload: Uint8Array; relayerUrl?: string; }): Promise; private computeKeyHash; /** * Get vault address by owner key hash * * @param ownerKeyHash - Owner's passkey hash * @returns Vault address on Starknet (felt252 as hex string) */ getVaultAddress(ownerKeyHash: string): Promise; /** * Check if vault exists and get basic info * * @param ownerKeyHash - Owner's passkey hash * @returns Vault info or null if not found */ getVaultInfo(ownerKeyHash: string): Promise<{ address: string; ownerKeyHash: string; } | null>; /** * Check if spoke contract is paused * * @returns Whether the protocol is paused */ isProtocolPaused(): Promise; } export { StarknetClient, type StarknetClientConfig };