import { ILogger } from "../onchain/types/logger.js"; import { ChainId } from "../model/primitives.js"; import { ChartBundle, ChartMetric, ChartRange } from "../model/charts.js"; import { ChainScopedFilter } from "../model/filters.js"; import { DataResponse } from "../model/response.js"; import { GearboxAPIOptions } from "./types.js"; import { z } from "zod/v4"; //#region src/offchain/AbstractOffchainNamespace.d.ts /** * Query parameters of a backend read. An entry set to `undefined` is a * condition that does not narrow, and is left out of the URL. **/ export type OffchainQuery = Record; /** * One backend read. * * @typeParam S - Schema the payload is decoded with. **/ export interface OffchainGetRequest { /** * Path below the base URL, e.g. `"/v2/opportunities/pools/1/0x..."`. **/ path: string; /** * Parameters to append, see {@link OffchainQuery}. **/ query?: OffchainQuery; /** * Schema the payload is decoded with. **/ schema: S; } /** * Base class of every {@link GearboxAPI} namespace: issues the requests, * decodes the responses and reports the failures, so that a namespace holds * nothing but its routes. **/ export declare abstract class AbstractOffchainNamespace { #private; protected readonly logger?: ILogger; protected constructor(name: string, options: GearboxAPIOptions); /** * Base URL every read of this namespace is issued against. **/ get baseUrl(): string | undefined; /** * Chains one read covers: the configured ones, narrowed by the filter when it * names any. A filter naming a chain this client does not cover narrows * nothing. **/ protected scopedChainIds(filter?: ChainScopedFilter): ChainId[]; /** * Reads one endpoint and decodes its payload. Timeouts, non-2xx answers and * schema skew throw, since none of them is a {@link DataResponse}. **/ protected get(request: OffchainGetRequest): Promise>>; /** * Reads one endpoint that answers with the payload alone, and returns it * unwrapped. * * A read served at no particular block has no envelope to report: the * permissionless routes either span every chain at once, or fall through to * a multicall on the chain itself, so the backend answers `{ data }` and * there is no {@link ResponseMetadata} for {@link get} to decode. The * envelope is still there, which is what keeps a payload that happens to be * an array from being mistaken for an error body. **/ protected getData(request: OffchainGetRequest): Promise>; /** * Reads the charts of one subject: one series per metric named, onto the one * grid that lets them be compared at an index. **/ protected readCharts(path: string, metrics: Metrics, range: ChartRange): Promise>>; } //#endregion