UNPKG

@bombearn/sdk

Version:

Interaction framework for the yearn protocol

106 lines (105 loc) 4.41 kB
import { ChainId } from "./chain"; import { Context, ContextValue } from "./context"; import { EarningsInterface } from "./interfaces/earnings"; import { FeesInterface } from "./interfaces/fees"; import { GaugeInterface } from "./interfaces/gauge"; import { SimulationInterface } from "./interfaces/simulation"; import { StrategyInterface } from "./interfaces/strategy"; import { TokenInterface } from "./interfaces/token"; import { VaultInterface } from "./interfaces/vault"; import { VotingEscrowInterface } from "./interfaces/votingEscrow"; import { RegistryAdapter, RegistryV2Adapter } from "./services/adapters/registry"; import { AddressProvider } from "./services/addressProvider"; import { AllowListService } from "./services/allowlist"; import { AssetService } from "./services/assets"; import { CowSwapService } from "./services/cowSwap"; import { HelperService } from "./services/helper"; import { LensService } from "./services/lens"; import { MetaService } from "./services/meta"; import { OracleService } from "./services/oracle"; import { PartnerService } from "./services/partner"; import { PickleService } from "./services/partners/pickle"; import { PortalsService } from "./services/portals"; import { PropertiesAggregatorService } from "./services/propertiesAggregator"; import { SubgraphService } from "./services/subgraph"; import { TelegramService } from "./services/telegram"; import { TransactionService } from "./services/transaction"; import { VisionService } from "./services/vision"; import { ZapEthService } from "./services/zapEth"; import { ZapperService } from "./services/zapper"; import { AssetServiceState } from "./types"; export declare type Adapters<T extends ChainId> = { vaults: { v1: RegistryAdapter; v2: RegistryV2Adapter<T>; }; }; declare type ServicesType<T extends ChainId> = { lens: LensService<T>; oracle: OracleService<T>; zapEth: ZapEthService<T>; zapper: ZapperService; portals: PortalsService; cowSwap: CowSwapService; asset: AssetService; vision: VisionService; subgraph: SubgraphService; telegram: TelegramService; meta: MetaService; allowList?: AllowListService<T>; transaction: TransactionService<T>; pickle: PickleService; helper: HelperService<T>; partner?: PartnerService<T>; propertiesAggregator: PropertiesAggregatorService<T>; }; /** * [[Yearn]] is a wrapper for all the services and interfaces of the SDK. * * Yearn namespace can be instantiated as a class or with an asynchronous * initializer, providing configuration options that will then be used by all * the services and interfaces: * * ```typescript * import { Yearn } from "@yfi/sdk"; * * const provider = new JsonRpcProvider("http://localhost:8545"); * const yearn = new Yearn(1, { provider }); * ``` */ export declare class Yearn<T extends ChainId> { _ctxValue: ContextValue; services: ServicesType<T>; adapters: Adapters<T>; vaults: VaultInterface<T>; tokens: TokenInterface<T>; earnings: EarningsInterface<T>; fees: FeesInterface<T>; simulation: SimulationInterface<T>; strategies: StrategyInterface<T>; votingEscrows: VotingEscrowInterface<T>; gauges: GaugeInterface<T>; context: Context; /** * This promise can be **optionally** awaited to assure that all services * have been correctly loaded. * * ```typescript * const yearn = new Yearn(1, { provider }); * await yearn.ready; * ``` */ ready: Promise<void[]>; addressProvider: AddressProvider<T>; /** * Create a new SDK instance. * @param chainId * @param context plain object containing all the optional configuration * @param assetServiceState the asset service does some expensive computation at initialization, passing the state from a previous sdk instance can prevent this */ constructor(chainId: T, context: ContextValue, assetServiceState?: AssetServiceState); setChainId(chainId: ChainId): void; _initServices<T extends ChainId>(chainId: ChainId, ctx: Context, addressProvider: AddressProvider<T>, allowlistService?: AllowListService<T>, assetServiceState?: AssetServiceState): ServicesType<T>; _initAdapters<T extends ChainId>(chainId: ChainId): Adapters<T>; } export {};