import { Filter, Signer, JsonRpcApiProviderOptions, JsonRpcProvider, JsonRpcPayload, JsonRpcResult, FetchRequest, Log, FilterByBlockHash, Interface, LogDescription } from 'ethers'; import { BaseConfig, NetworkName } from '@appliedblockchain/silentdatarollup-core'; declare const DEBUG_NAMESPACE = "silentdata:ethers-provider"; interface SilentDataRollupProviderConfig extends BaseConfig { rpcUrl: string; l1RpcUrl?: string; registryContract?: string; network?: NetworkName; chainId?: number; privateKey?: string; signer?: Signer; options?: JsonRpcApiProviderOptions; smartWalletAddress?: string; smartWalletType?: 'giano' | 'simple'; /** * When set to true, all eth_call requests will be signed * with authentication headers, regardless of whether they match signable contracts */ alwaysSignEthCalls?: boolean; } /** * Extended filter type that includes a special flag for private events * This flag is used to identify when a call to eth_getLogs originated from * the getAllLogs method, so we can add authentication headers */ interface PrivateEventsFilter extends Filter { /** * Internal flag to identify requests that should include auth headers * Set automatically by getAllLogs method */ _isPrivateEvent?: boolean; /** * Optional event signature for filtering private events by type * Example: "Transfer(address,address,uint256)" * Will be converted to a hash and used for topic filtering */ eventSignature?: string; } declare class SilentDataRollupProvider extends JsonRpcProvider { private config; signer: Signer; private baseProvider; constructor(config: SilentDataRollupProviderConfig); _send(payload: JsonRpcPayload | Array): Promise>; private _isRegistryContractSet; private _isNodeRuntime; /** * Get authentication headers if required for the given payload. * Returns null if no auth headers are needed. */ private _getAuthHeaders; private _sendWithoutAttestation; private _sendWithPinnedTlsAndAttest; static getRequest({ rpcUrl }: { rpcUrl: string; }): FetchRequest; clone(): SilentDataRollupProvider; /** * Helper method to configure a filter for private events * @param filter - The original filter * @param forcePrivateOnly - Whether to force filtering for only PrivateEvents * @returns The configured filter with proper topics */ private configurePrivateEventsFilter; /** * Gets logs for private events, including authentication headers * @param filter - The filter parameters for logs * @returns Array of logs matching the filter */ getAllLogs(filter?: PrivateEventsFilter): Promise>; /** * Gets only private events (PrivateEvent logs), including authentication headers * @param filter - The filter parameters for logs * @returns Array of logs matching the filter, containing only PrivateEvent logs */ getPrivateLogs(filter?: PrivateEventsFilter): Promise; /** * Override of ethers' getLogs method that preserves our custom _isPrivateEvent property * * IMPORTANT: This method mimics the behavior of ethers' original getLogs implementation * but adds a crucial step to preserve the _isPrivateEvent flag. We need this because: * * 1. Ethers' _getFilter method sanitizes filter objects, removing any non-standard properties * 2. Our _isPrivateEvent flag would be stripped by this sanitization * 3. We need the flag to reach the _send method to trigger the addition of auth headers * * The approach here is to run the normal filter processing, then re-attach our flag as a * non-enumerable property to avoid JSON serialization issues. This allows the flag to * survive until _send where we check for it to determine if auth headers are needed. * * @param _filter - The filter with our potential _isPrivateEvent property * @returns Array of logs matching the filter */ getLogs(_filter: PrivateEventsFilter | FilterByBlockHash): Promise; } /** * Extended LogDescription type that includes private event details */ interface SDLogDescription extends LogDescription { /** * Only present for PrivateEvents - contains the decoded inner log * If decoding failed, this will be null */ innerLog?: LogDescription | null; } /** * Extends ethers Interface to provide support for decoding PrivateEvent logs * Make sure to include the PrivateEvent signature in your ABI when using this class */ declare class SDInterface extends Interface { /** * Extends the parseLog method to handle PrivateEvent logs * @param log - The log to parse * @returns The parsed log description with additional private event details if applicable */ parseLog(log: Parameters[0]): SDLogDescription | null; } export { DEBUG_NAMESPACE, type PrivateEventsFilter, SDInterface, type SDLogDescription, SilentDataRollupProvider, type SilentDataRollupProviderConfig };