import { RegisterSessionParams, SessionValidationResult, RevokeSessionParams, SessionKey, IdentityState } from './types.mjs'; import { ethers } from 'ethers'; 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 } from './types-DP2CQT8p.mjs'; interface EVMClientConfig { chainId: number; wormholeChainId: number; rpcUrl: string; hubContractAddress: string; wormholeCoreBridge: string; name?: string; explorerUrl?: string; vaultFactory?: string; vaultImplementation?: string; tokenBridge?: string; } /** * EVM implementation of the ChainClient interface */ declare class EVMClient implements ChainClient { private config; private provider; private hubContract; private factoryContract; private cachedImplementation; private cachedWormholeAddress; private cachedMessageFee; constructor(config: EVMClientConfig); getConfig(): ChainConfig; getNonce(userKeyHash: string): Promise; /** * Get user state from Hub (Issue #9/#10) * Returns comprehensive state including last action hash */ getUserState(userKeyHash: string): Promise<{ keyHash: string; nonce: bigint; lastActionHash: string; }>; /** * Get user's last action hash from Hub (Issue #9/#10) * Returns zero hash if user has no actions yet */ getUserLastActionHash(userKeyHash: string): Promise; /** * Register a new session key for temporary authentication * Enables native L1 speed for repeat transactions without biometric auth * * @param params Session registration parameters * @param signer Ethereum signer to pay gas * @returns Transaction receipt */ registerSession(params: RegisterSessionParams, signer: ethers.Signer): Promise; /** * Check if a session is currently active (queryable via Wormhole CCQ) * * @param userKeyHash Hash of the user's Passkey public key * @param sessionKeyHash Hash of the session key to check * @returns Session validation result */ isSessionActive(userKeyHash: string, sessionKeyHash: string): Promise; /** * Revoke a session key immediately * * @param params Session revocation parameters * @param signer Ethereum signer to pay gas * @returns Transaction receipt */ revokeSession(params: RevokeSessionParams, signer: ethers.Signer): Promise; /** * Get all sessions for a user * * @param userKeyHash Hash of the user's Passkey public key * @returns Array of all sessions (active and expired/revoked) */ getUserSessions(userKeyHash: string): Promise; /** * Get the number of sessions for a user * * @param userKeyHash Hash of the user's Passkey public key * @returns Number of sessions */ getUserSessionCount(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: ethers.Signer): Promise; /** * Dispatch an action to the Hub via relayer (gasless) * The relayer pays for gas and submits the transaction on behalf of the user */ dispatchGasless(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, nonce: bigint, relayerUrl: string): Promise; getVaultAddress(userKeyHash: string): Promise; /** * Compute vault address deterministically without querying the chain * Uses CREATE2 with EIP-1167 minimal proxy pattern */ computeVaultAddress(userKeyHash: string): string; /** * Build EIP-1167 minimal proxy initcode */ private buildProxyInitCode; vaultExists(userKeyHash: string): Promise; createVault(userKeyHash: string, signer: ethers.Signer): Promise; /** * Create a vault with a sponsor wallet paying for gas * * @param userKeyHash - The user's passkey hash * @param sponsorPrivateKey - Private key of the wallet that will pay gas * @param rpcUrl - Optional RPC URL to use (defaults to client's RPC) * @returns VaultCreationResult with address and transaction details */ createVaultSponsored(userKeyHash: string, sponsorPrivateKey: string, rpcUrl?: string): Promise; estimateVaultCreationGas(userKeyHash: string): Promise; getFactoryAddress(): string | undefined; getImplementationAddress(): string | undefined; /** * Fetch implementation address from factory contract */ fetchImplementationAddress(): Promise; /** * Get the provider instance */ getProvider(): ethers.JsonRpcProvider; /** * Get native token balance for an address */ getNativeBalance(address: string): Promise; /** * Get ERC20 token balance for an address */ getTokenBalance(tokenAddress: string, ownerAddress: string): Promise; /** * Get token allowance */ getTokenAllowance(tokenAddress: string, ownerAddress: string, spenderAddress: string): Promise; /** * Estimate gas for a dispatch transaction */ estimateDispatchGas(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, nonce: bigint): Promise; /** * Get current gas price */ getGasPrice(): Promise; /** * Get current block number */ getBlockNumber(): Promise; /** * Get transaction receipt */ getTransactionReceipt(hash: string): Promise; /** * Wait for transaction confirmation */ waitForTransaction(hash: string, confirmations?: number): Promise; /** * Get the identity for a given key hash * Returns zero hash if key is not registered to any identity * * @param keyHash Hash of the passkey to look up * @returns Identity (first passkey's keyHash) or zero hash */ getIdentityForKey(keyHash: string): Promise; /** * Get all authorized keys for an identity * * @param identity The identity key hash (first passkey's keyHash) * @returns Array of authorized key hashes */ getAuthorizedKeys(identity: string): Promise; /** * Get count of authorized keys for an identity * * @param identity The identity key hash * @returns Number of authorized keys */ getAuthorizedKeyCount(identity: string): Promise; /** * Check if a key is authorized for an identity * * @param identity The identity key hash * @param keyHash The key hash to check * @returns Whether the key is authorized */ isAuthorizedForIdentity(identity: string, keyHash: string): Promise; /** * Check if a key is the root identity key * * @param keyHash The key hash to check * @returns Whether the key is a root identity */ isIdentityRootKey(keyHash: string): Promise; /** * Get comprehensive identity state for a key * * @param keyHash Hash of any key in the identity * @returns Identity state including count, max, and root status */ getIdentityState(keyHash: string): Promise; /** * Register a new identity with the first passkey * This makes the passkey the root identity key * * @param signature WebAuthn signature * @param publicKeyX Passkey public key X coordinate * @param publicKeyY Passkey public key Y coordinate * @param signer Ethereum signer to pay gas * @returns Transaction receipt and identity hash */ registerIdentity(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; identity: string; }>; /** * Add a backup passkey to an existing identity * Requires WebAuthn signature from an authorized key * * @param signature WebAuthn signature from existing authorized key * @param publicKeyX Existing key's X coordinate * @param publicKeyY Existing key's Y coordinate * @param newPublicKeyX New backup key's X coordinate * @param newPublicKeyY New backup key's Y coordinate * @param nonce Current nonce for the signing key * @param signer Ethereum signer to pay gas * @returns Transaction receipt and sequence number */ addBackupKey(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, newPublicKeyX: bigint, newPublicKeyY: bigint, nonce: bigint, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Remove a passkey from an identity * Cannot remove the last remaining key * * @param signature WebAuthn signature from an authorized key * @param publicKeyX Signing key's X coordinate * @param publicKeyY Signing key's Y coordinate * @param keyToRemove Hash of the key to remove * @param nonce Current nonce for the signing key * @param signer Ethereum signer to pay gas * @returns Transaction receipt and sequence number */ removeKey(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, keyToRemove: string, nonce: bigint, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Setup guardians for an identity * @param signature WebAuthn signature from owner * @param publicKeyX Owner's public key X coordinate * @param publicKeyY Owner's public key Y coordinate * @param guardians Array of guardian key hashes * @param threshold Required approvals for recovery * @param signer Ethers signer for transaction */ setupGuardians(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, guardians: string[], threshold: bigint, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Add a guardian to an identity */ addGuardian(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, guardianKeyHash: string, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Remove a guardian from an identity */ removeGuardian(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, guardianKeyHash: string, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Initiate recovery as a guardian */ initiateRecovery(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, identityToRecover: string, newOwnerKeyHash: string, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Approve recovery as a guardian */ approveRecovery(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, identityToRecover: string, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Execute recovery after timelock (anyone can call) */ executeRecovery(identityToRecover: string, newPublicKeyX: bigint, newPublicKeyY: bigint, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Cancel recovery as owner */ cancelRecovery(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, signer: ethers.Signer): Promise<{ receipt: ethers.TransactionReceipt; sequence: bigint; }>; /** * Get guardians for an identity */ getGuardians(identityKeyHash: string): Promise<{ guardians: string[]; threshold: bigint; isConfigured: boolean; }>; /** * Get recovery status for an identity */ getRecoveryStatus(identityKeyHash: string): Promise<{ isActive: boolean; newOwnerKeyHash: string; initiatedAt: bigint; approvalCount: bigint; threshold: bigint; canExecuteAt: bigint; expiresAt: bigint; }>; /** * Check if a guardian has approved recovery */ hasGuardianApproved(identityKeyHash: string, guardianKeyHash: string): Promise; configureTransactionPolicy(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, threshold: number, protectedActionMask: number, proposalTtl: number, disableSessions: boolean, signer: unknown): Promise<{ receipt: unknown; }>; getTransactionPolicy(identityKeyHash: string): Promise<{ enabled: boolean; threshold: number; protectedActionMask: number; proposalTtl: number; disableSessions: boolean; }>; createTransactionProposal(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, targetChain: number, actionPayload: string, signer: unknown): Promise<{ proposalId: string; receipt: unknown; sequence: bigint; }>; approveTransactionProposal(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, proposalId: string, signer: unknown): Promise<{ receipt: unknown; approvalCount: number; thresholdReached: boolean; }>; cancelTransactionProposal(signature: WebAuthnSignature, publicKeyX: bigint, publicKeyY: bigint, proposalId: string, signer: unknown): Promise<{ receipt: unknown; }>; executeTransactionProposal(proposalId: string, signer: unknown): Promise<{ receipt: unknown; sequence: bigint; }>; getTransactionProposal(proposalId: string): Promise<{ identityKeyHash: string; proposerKeyHash: string; targetChain: number; actionType: number; actionHash: string; createdAt: bigint; expiresAt: bigint; approvalCount: number; requiredThreshold: number; state: number; }>; hasApprovedTransactionProposal(proposalId: string, keyHash: string): Promise; /** * Convert a WebAuthnSignature to the struct tuple expected by the Hub contract */ private _toAuthTuple; /** * Helper to extract sequence from transaction receipt */ private _extractSequenceFromReceipt; } export { EVMClient as E, type EVMClientConfig as a };