import type { ServicePolicy } from "@metamask/controller-utils"; import type { Json, JsonRpcParams, JsonRpcRequest, JsonRpcResponse } from "@metamask/utils"; import type { CockatielEventToEventListenerWithData, ExcludeCockatielEventData, ExtendCockatielEventData, ExtractCockatielEventData, FetchOptions } from "./shared.cjs"; /** * The interface for a service class responsible for making a request to a * target, whether that is a single RPC endpoint or an RPC endpoint in an RPC * service chain. * * @deprecated Don't use this interface (it will be removed in an upcoming major * version). If you need to take an "RPC-service-like" argument, it's best to * declare which properties you're interested in rather than accepting the * entire RPC service interface. */ export type RpcServiceRequestable = { /** * Listens for when the RPC service retries the request. * * @param listener - The callback to be called when the retry occurs. * @returns What {@link ServicePolicy.onRetry} returns. * @see {@link createServicePolicy} */ onRetry(listener: CockatielEventToEventListenerWithData): ReturnType; /** * Listens for when the RPC service retries the request too many times in a * row. * * @param listener - The callback to be called when the circuit is broken. * @returns What {@link ServicePolicy.onBreak} returns. * @see {@link createServicePolicy} */ onBreak(listener: (data: ExcludeCockatielEventData, { endpointUrl: string; }>, 'isolated'>) => void): ReturnType; /** * Listens for when the policy underlying this RPC service detects a slow * request. * * @param listener - The callback to be called when the request is slow. * @returns What {@link ServicePolicy.onDegraded} returns. * @see {@link createServicePolicy} */ onDegraded(listener: CockatielEventToEventListenerWithData): ReturnType; /** * Listens for when the policy underlying this RPC service is available. * * @param listener - The callback to be called when the request is available. * @returns What {@link ServicePolicy.onDegraded} returns. * @see {@link createServicePolicy} */ onAvailable(listener: CockatielEventToEventListenerWithData): ReturnType; /** * Makes a request to the target. */ request(jsonRpcRequest: Readonly>, fetchOptions?: FetchOptions): Promise>; }; //# sourceMappingURL=rpc-service-requestable.d.cts.map