import { Hash, BaseReadAdapter, ReadAdapter, BlockIdentifier, GetBlockReturn, GetBalanceParams, GetTransactionParams, Transaction, WaitForTransactionParams, TransactionReceipt, CallParams, Bytes, Abi, EventName, GetEventsParams, EventLog, ReadWriteAdapter, GetWalletCapabilitiesParams, WalletCapabilities, HexString, WalletCallsStatus, SendTransactionParams, DeployParams, FunctionName, WriteParams, SendCallsParams, SendCallsReturn, OneOf } from '@gud/drift'; import { Provider, Signer } from 'ethers'; interface EthersReadAdapterParams { /** * Ethers Provider instance or RPC URL. */ provider?: TProvider | string; } declare class EthersReadAdapter extends BaseReadAdapter implements ReadAdapter { provider: TProvider; constructor({ provider, }?: EthersReadAdapterParams); getChainId(): Promise; getBlockNumber(): Promise; getBlock(blockId?: T): Promise>; getBalance({ address, block }: GetBalanceParams): Promise; getTransaction({ hash }: GetTransactionParams): Promise; waitForTransaction({ hash, timeout }: WaitForTransactionParams): Promise; call({ accessList, blobs, blobVersionedHashes, block, bytecode, chainId, data, from, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, to, type, value, }: CallParams): Promise; sendRawTransaction(transaction: Bytes): Promise; getEvents>({ abi, address, event: eventName, filter, fromBlock, toBlock, }: GetEventsParams): Promise[]>; } declare module "@gud/drift" { interface BlockOverrides { /** * Unavailable in ethers.js. */ mixHash: undefined; /** * Possibly undefined in ethers.js. */ receiptsRoot: Hash | undefined; /** * Unavailable in ethers.js. */ sha3Uncles: undefined; /** * Unavailable in ethers.js. */ size: undefined; /** * Unavailable in ethers.js. */ transactionsRoot: undefined; } interface TransactionReceipt { /** * ___ * __Note:__ The ethers.js implementation of this field maps to the * `gasPrice` field of a {@linkcode TransactionResponse} object. * * @see [Ethers.js - TransactionResponse - gasPrice](https://docs.ethers.org/v6/api/providers/#TransactionResponse-gasPrice) */ effectiveGasPrice: bigint; } } declare module "@gud/drift" { interface BaseTypeOverrides { HexString: string; } } interface EthersReadWriteAdapterParams extends EthersReadAdapterParams { signer: TSigner; } declare class EthersReadWriteAdapter extends EthersReadAdapter implements ReadWriteAdapter { signer: TSigner; constructor({ provider, signer, }: EthersReadWriteAdapterParams); getSignerAddress(): Promise; /** * @throws A {@linkcode NotImplementedError} if the provider is not a * {@linkcode JsonRpcProvider} or {@linkcode BrowserProvider}. */ getWalletCapabilities(params?: GetWalletCapabilitiesParams): Promise>; /** * @throws A {@linkcode NotImplementedError} if the provider is not a * {@linkcode JsonRpcProvider} or {@linkcode BrowserProvider}. */ getCallsStatus(batchId: TId): Promise>; /** * @throws A {@linkcode NotImplementedError} if the provider is not a * {@linkcode JsonRpcProvider} or {@linkcode BrowserProvider}. */ showCallsStatus(batchId: HexString): Promise; sendTransaction({ data, to, from, onMined, onMinedTimeout, ...options }: SendTransactionParams): Promise; deploy({ abi, args, bytecode, from, onMined, ...options }: DeployParams): Promise; write>({ abi, address, args, fn, from, onMined, ...options }: WriteParams): Promise; /** * @throws A {@linkcode NotImplementedError} if the provider is not a * {@linkcode JsonRpcProvider} or {@linkcode BrowserProvider}. */ sendCalls(params: SendCallsParams): Promise; } interface EthersAdapterParams { provider?: TProvider; signer?: TSigner; } declare function ethersAdapter>({ provider, signer }?: TParams): EthersAdapter; type EthersAdapter = (TProvider extends Provider ? TProvider : Provider) extends infer TProvider extends Provider ? OneOf : EthersReadAdapter> : never; export { type EthersAdapter, type EthersAdapterParams, EthersReadAdapter, type EthersReadAdapterParams, EthersReadWriteAdapter, type EthersReadWriteAdapterParams, ethersAdapter };