import { Replace, BaseReadAdapter, ReadAdapter, BlockIdentifier, GetBlockReturn, GetBalanceParams, GetTransactionParams, WaitForTransactionParams, TransactionReceipt, Abi, EventName, GetEventsParams, EventArgs, CallParams, Bytes, ReadWriteAdapter, GetWalletCapabilitiesParams, WalletCapabilities, HexString, WalletCallsStatus, SendTransactionParams, DeployParams, FunctionName, WriteParams, SendCallsParams, SendCallsReturn, OneOf } from '@gud/drift'; import { Client, Transport, Chain, Account, RpcSchema, PublicClient, WalletClient } from 'viem'; /** * @internal */ type AnyClient = Client; type AnyPublicClient = PublicClient; declare const requiredPublicActions: ["call", "getBalance", "getBlock", "getBlockNumber", "getChainId", "getContractEvents", "getTransaction", "sendRawTransaction", "waitForTransactionReceipt"]; type RequiredPublicActions = (typeof requiredPublicActions)[number]; type MinimumRequiredClient = Replace>; /** * @internal */ type CoercedPublicClient = T extends MinimumRequiredClient ? T : Replace; interface ViemReadAdapterParams { publicClient: TClient; } declare class ViemReadAdapter extends BaseReadAdapter implements ReadAdapter { publicClient: CoercedPublicClient; constructor({ publicClient }: ViemReadAdapterParams); getChainId(): Promise; getBlockNumber(): Promise; getBlock(blockId?: T): Promise>; getBalance({ address, block }: GetBalanceParams): Promise; getTransaction({ hash }: GetTransactionParams): Promise<{ gas: bigint; gasPrice: bigint; input: `0x${string}`; nonce: bigint; type: "0x0" | "0x1" | "0x2" | "0x3" | "0x4"; value: bigint; blockHash: `0x${string}`; blockNumber: bigint; from: `0x${string}`; chainId: number | undefined; transactionHash: `0x${string}`; to: `0x${string}` | undefined; transactionIndex: bigint; }>; waitForTransaction({ hash, timeout, }: WaitForTransactionParams): Promise; getEvents>({ abi, address, event, filter, fromBlock, toBlock, }: GetEventsParams): Promise<{ args: EventArgs; blockHash: `0x${string}` | undefined; blockNumber: bigint | undefined; data: `0x${string}`; eventName: TEventName; logIndex: number | undefined; transactionHash: `0x${string}` | undefined; }[]>; call({ block, bytecode, from, nonce, ...rest }: CallParams): Promise<`0x${string}`>; sendRawTransaction(serializedTransaction: Bytes): Promise<`0x${string}`>; } interface ViemReadWriteAdapterParams extends ViemReadAdapterParams { walletClient: TWalletClient; } declare class ViemReadWriteAdapter extends ViemReadAdapter implements ReadWriteAdapter { walletClient: TWalletClient; constructor({ walletClient, ...rest }: ViemReadWriteAdapterParams); getSignerAddress(): Promise<`0x${string}`>; getWalletCapabilities(params?: GetWalletCapabilitiesParams): Promise>; getCallsStatus(batchId: TId): Promise>; showCallsStatus(batchId: HexString): Promise; sendTransaction(params: SendTransactionParams): Promise<`0x${string}`>; deploy(params: DeployParams): Promise<`0x${string}`>; write>(params: WriteParams): Promise<`0x${string}`>; sendCalls(params: SendCallsParams): Promise; private _getAccount; } declare module "@gud/drift" { interface GetWalletCapabilitiesParams { /** * * **Important**: Only the first chain ID is used in Viem. */ chainIds?: TChainIds; chainId?: number; } } interface ViemAdapterParams { publicClient: TPublicClient; walletClient?: TWalletClient; } declare function viemAdapter({ publicClient, walletClient, }: TParams): ViemAdapter; type ViemAdapter = OneOf : ViemReadAdapter>; export { type ViemAdapter, type ViemAdapterParams, ViemReadAdapter, type ViemReadAdapterParams, ViemReadWriteAdapter, type ViemReadWriteAdapterParams, viemAdapter };