import { NetworkType } from "../onchain/chain/chains.js"; import "../onchain/index.js"; import { IAnalyticsByMode } from "./analytics/types.js"; import { ILiquidationsByMode } from "./liquidations/types.js"; import { IOpportunities } from "./opportunities/types.js"; import { IPositions } from "./positions/types.js"; import { IPreviewByMode } from "./preview/types.js"; import { IRewardsByMode } from "./rewards/types.js"; import { GearboxSDKOptions, IGearboxSDK, INoticesByMode, Mode, OffchainByMode, OnchainByMode } from "./types.js"; import "./analytics/index.js"; import "./liquidations/index.js"; import "./opportunities/index.js"; import "./positions/index.js"; import "./preview/index.js"; import "./rewards/index.js"; //#region src/sdk/GearboxSDK.d.ts /** * Default {@link GearboxSDKOptions.maxStateAgeSeconds}: the fastest poll an * app runs, so a 30 s tick sees state no older than itself. **/ export declare const DEFAULT_MAX_STATE_AGE = 30; /** * Entry point over both sources of Gearbox data: the chain and the Gearbox * backend. The {@link Mode} is fixed at construction and decides which methods * exist. * * ```ts * const sdk = new GearboxSDK({ * mode: "both", * networks: ["Mainnet"], * onchain: { chains: { Mainnet: { rpcURLs } } }, * offchain: { baseUrl: "https://api.gearbox.fi" }, * }); * await sdk.attach(); * * const { data, meta } = await sdk.opportunities.list({ kind: "strategy" }); * ``` * * @typeParam M - Mode the instance was built in. **/ export declare class GearboxSDK implements IGearboxSDK { #private; /** * Sources this instance reads from. **/ readonly mode: M; /** * Chains this instance covers, which every read is scoped to. **/ readonly networks: readonly NetworkType[]; /** Protocol-wide analytics. Undefined in `onchain` mode. */ readonly analytics: IAnalyticsByMode[M]; /** * Namespace for pool and strategy opportunities. **/ readonly opportunities: IOpportunities; /** * Namespace for the positions a wallet holds. **/ readonly positions: IPositions; /** * Namespace for liquidatable credit accounts and delayed-withdrawal * positions a liquidator holds. Onchain-only, hence gated by mode like * every other chain read: absent in `offchain` mode. **/ readonly liquidations: ILiquidationsByMode[M]; /** * Namespace for on-chain previews of raw operation calldata. Onchain-only, * hence gated by mode like every other chain read: absent in `offchain` * mode. **/ readonly preview: IPreviewByMode[M]; /** * Namespace for claimable rewards. Absent in `offchain` mode. **/ readonly rewards: IRewardsByMode[M]; /** * The banners the backend attaches to a pool opportunity or a strategy * position, see {@link Notice}. Top-level because the subject is either * kind of entity, so neither namespace owns it. Backend-only, hence gated * by mode like every other backend read: absent in `onchain` mode. **/ readonly notices: INoticesByMode[M]; constructor(options: GearboxSDKOptions); /** * Attaches the on-chain SDK when this instance owns one; a no-op in `offchain` * mode and when an already-attached SDK was injected. **/ attach(): Promise; /** * Whether the on-chain source is ready to be read from. Always `true` in * `offchain` mode. **/ get attached(): boolean; /** * The underlying on-chain SDK, for everything this facade does not expose * yet: markets, credit accounts, transaction building. `undefined` in * `offchain` mode, and only answers reads once {@link attach} has resolved. **/ get onchain(): OnchainByMode[M]; /** * The underlying backend client. `undefined` in `onchain` mode. **/ get offchain(): OffchainByMode[M]; } //#endregion