import { type JsonRpcError, type JsonRpcPayload, type JsonRpcResult, JsonRpcApiProvider } from 'ethers'; import { type Chain, type PublicClient, type Transport } from 'viem'; import type { ChainContext } from '../../chain.ts'; import { EVMChain } from '../index.ts'; /** * Custom ethers provider that forwards RPC calls through viem's transport. * Works with ALL viem transports: http, webSocket, custom (injected), fallback. * * This approach is superior to extracting URLs because it supports: * - MetaMask and other injected providers (window.ethereum) * - WalletConnect * - Coinbase Wallet * - Any custom() transport */ export declare class ViemTransportProvider extends JsonRpcApiProvider { #private; /** Creates a new ViemTransportProvider wrapping the given viem client. */ constructor(client: PublicClient); /** * Forward RPC calls to viem's transport. * Handles both single and batched requests. */ _send(payload: JsonRpcPayload | Array): Promise>; } /** * Create EVMChain from a viem PublicClient. * * Supports ALL viem transport types including: * - http() - Standard HTTP transport * - webSocket() - WebSocket transport * - custom() - Injected providers (MetaMask, WalletConnect, etc.) * - fallback() - Fallback transport with multiple providers * * @param client - viem PublicClient instance with chain defined * @param ctx - Optional chain context (logger, etc.) * @returns EVMChain instance * * @example * ```typescript * import { createPublicClient, http } from 'viem' * import { mainnet } from 'viem/chains' * import { fromViemClient } from '@chainlink/ccip-sdk/viem' * * const publicClient = createPublicClient({ * chain: mainnet, * transport: http('https://eth.llamarpc.com'), * }) * * const chain = await fromViemClient(publicClient) * const messages = await chain.getMessagesInTx(tx) * ``` * * @example Browser wallet (MetaMask) * ```typescript * import { createPublicClient, custom } from 'viem' * import { mainnet } from 'viem/chains' * import { fromViemClient } from '@chainlink/ccip-sdk/viem' * * const publicClient = createPublicClient({ * chain: mainnet, * transport: custom(window.ethereum), * }) * * const chain = await fromViemClient(publicClient) * ``` */ export declare function fromViemClient(client: PublicClient, ctx?: ChainContext): Promise; //# sourceMappingURL=client-adapter.d.ts.map