import type { CallMsgJson, FilterLogTriggerRequestJson } from '../../../../generated/capabilities/blockchain/evm/v1alpha/client_pb'; import type { ReportRequestJson } from '../../../../generated/sdk/v1alpha/sdk_pb'; import { type BigInt as GeneratedBigInt } from '../../../../generated/values/v1/values_pb'; import type { Address, Hex } from 'viem'; /** * Protobuf BigInt structure returned by SDK methods (e.g., headerByNumber). * Uses Pick to extract just the data fields from the generated type. */ export type ProtoBigInt = Pick; /** * Converts a native JS bigint to a protobuf BigInt JSON representation. * Use this when passing bigint values to SDK methods. * * @example * const response = evmClient.callContract(runtime, { * call: encodeCallMsg({...}), * blockNumber: bigintToProtoBigInt(9768438n) * }).result() * * @param n - The native bigint, number, or string value. * @returns The protobuf BigInt JSON representation. */ export declare const bigintToProtoBigInt: (n: number | bigint | string) => import("../../../../generated/values/v1/values_pb").BigIntJson; /** * Converts a protobuf BigInt to a native JS bigint. * Use this when extracting bigint values from SDK responses. * * @example * const latestHeader = evmClient.headerByNumber(runtime, {}).result() * const latestBlockNum = protoBigIntToBigint(latestHeader.header.blockNumber!) * const customBlock = latestBlockNum - 500n * * @param pb - The protobuf BigInt object with absVal and sign fields. * @returns The native JS bigint value. */ export declare const protoBigIntToBigint: (pb: ProtoBigInt) => bigint; /** * Convenience alias for `bigintToProtoBigInt`. * Creates a block number object for EVM capability requests. * * @param n - The block number. * @returns The protobuf BigInt JSON representation. */ export declare const blockNumber: (n: number | bigint | string) => import("../../../../generated/values/v1/values_pb").BigIntJson; /** * EVM Capability Helper. * * `CallContractRequest`, used by EVM capability, has arguments for reading a contract as specified in the call message at a block height defined by blockNumber. * That blockNumber can be: * - the latest mined block (`LATEST_BLOCK_NUMBER`) (default) * - the last finalized block (`LAST_FINALIZED_BLOCK_NUMBER`) * - a specific block number (use `blockNumber(n)` or `bigintToProtoBigInt(n)`) * * Using this constant will indicate that the call should be executed at the last finalized block. */ export declare const LAST_FINALIZED_BLOCK_NUMBER: { absVal: any; sign: string; }; /** * EVM Capability Helper. * * `CallContractRequest`, used by EVM capability, has arguments for reading a contract as specified in the call message at a block height defined by blockNumber. * That blockNumber can be: * - the latest mined block (`LATEST_BLOCK_NUMBER`) (default) * - the last finalized block (`LAST_FINALIZED_BLOCK_NUMBER`) * * Using this constant will indicate that the call should be executed at the latest mined block. */ export declare const LATEST_BLOCK_NUMBER: { absVal: any; sign: string; }; export interface EncodeCallMsgPayload { from: Address; to: Address; data: Hex; } /** * Encodes a call message payload into a `CallMsgJson` protobuf structure, expected by the EVM capability. * * When creating a `CallContractRequest` 3 parameters are required: * * - `from` - The sender address. * - `to` - The contract address. * - `data` - The data to call the contract with. * * This helper wraps that data and packs into format acceptable by the EVM capability. * * @param payload - The call message payload to encode. * @returns The encoded call message payload. */ export declare const encodeCallMsg: (payload: EncodeCallMsgPayload) => CallMsgJson; /** * Default values expected by the EVM capability for report encoding. */ export declare const EVM_DEFAULT_REPORT_ENCODER: { encoderName: string; signingAlgo: string; hashingAlgo: string; }; /** * Prepares a report request for the EVM capability to pass to `.report()` function. * * @param hexEncodedPayload - The hex encoded payload to be signed. * @param reportEncoder - The report encoder to be used. Defaults to EVM_DEFAULT_REPORT_ENCODER. * @returns The prepared report request. */ export declare const prepareReportRequest: (hexEncodedPayload: Hex, reportEncoder?: Omit) => ReportRequestJson; export interface LogTriggerConfigOptions { /** EVM addresses to monitor — hex strings with 0x prefix (20 bytes each) */ addresses: Hex[]; /** Topic filters — array of up to 4 arrays of hex topic values (32 bytes each). * - topics[0]: event signatures (keccak256 hashes), at least one required * - topics[1]: possible values for first indexed arg (optional) * - topics[2]: possible values for second indexed arg (optional) * - topics[3]: possible values for third indexed arg (optional) */ topics?: Hex[][]; /** Confidence level for log finality. Defaults to SAFE. */ confidence?: 'SAFE' | 'LATEST' | 'FINALIZED'; } /** * Creates a log trigger configuration from hex-encoded addresses and topics. * * This helper converts hex addresses and topic hashes to the base64-encoded format * expected by the EVM capability's `FilterLogTriggerRequest`, and validates that * addresses are 20 bytes and topics are 32 bytes. * * @example * const WETH = '0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9' * const TRANSFER = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' * * handler( * evmClient.logTrigger(logTriggerConfig({ * addresses: [WETH], * topics: [[TRANSFER]], * confidence: 'LATEST', * })), * onLogTrigger, * ) * * @param opts - Hex-encoded addresses, topic filters, and optional confidence level. * @returns The `FilterLogTriggerRequestJson` ready to pass to `evmClient.logTrigger()`. */ export declare const logTriggerConfig: (opts: LogTriggerConfigOptions) => FilterLogTriggerRequestJson; export declare const isChainSelectorSupported: (chainSelectorName: string) => boolean;