import { EvmIngestedEvent } from '../ingestion.js' import { InputABI } from '../manifest.js' import type { BaseProvider, BlockTag } from '@ethersproject/providers' import type { BigNumber, BigNumberish, Contract } from 'ethers' export type CacheOptions = { ttlSeconds: number ignoreEmpty?: boolean forceRefresh?: boolean } export type ProviderOptions = { cache?: CacheOptions preferBatch?: boolean retryEmptyResults?: boolean globalBlockTag?: BlockTag } export type TopicsFilter = | [ string | string[] | null, string | string[] | null, string | string[] | null, string | string[] | null, ] | [ string | string[] | null, string | string[] | null, string | string[] | null, ] | [string | string[] | null, string | string[] | null] | [string | string[]] | [] export type CachableContract = T & { cached: (options?: CacheOptions) => T } export type FailoverRPCProvider = BaseProvider & { cached(options?: CacheOptions): FailoverRPCProvider buster(): FailoverRPCProvider withBlockTag(blockTag: BlockTag): FailoverRPCProvider findContractDeployBlock(contractAddress: string): Promise getNormalizedLogs(args: { fromBlock?: BigNumberish | 'latest' toBlock?: BigNumberish | 'latest' address?: string[] topics?: TopicsFilter }): Promise<{ result: EvmIngestedEvent[] }> getBlockForkIndex(blockNumber: BigNumberish): Promise } export const blockchain = { async supportsChain(chainId: number): Promise { chainId throw new Error( 'blockchain.supportsChain() is a native function implemented by the platform runtime', ) }, async getProvider( chainId: number, options?: ProviderOptions, ): Promise { chainId options throw new Error( 'blockchain.getProvider() is a native function implemented by the platform runtime', ) }, async getContract( chainId: number, address: string, abi: InputABI, options?: ProviderOptions, ): Promise> { chainId address abi options throw new Error( 'blockchain.getContract() is a native function implemented by the platform runtime', ) }, }