Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Yearn<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:

import { Yearn } from "@yfi/sdk";

const provider = new JsonRpcProvider("http://localhost:8545");
const yearn = new Yearn(1, { provider });

Type parameters

Hierarchy

  • Yearn

Index

Constructors

  • Create a new SDK instance.

    Type parameters

    • T: 1 | 10 | 250 | 1337 | 42161

    Parameters

    • chainId: T
    • context: ContextValue

      plain object containing all the optional configuration

    • Optional assetServiceState: AssetServiceState

      the asset service does some expensive computation at initialization, passing the state from a previous sdk instance can prevent this

    Returns Yearn<T>

Properties

_ctxValue: ContextValue
adapters: Adapters<T>
addressProvider: AddressProvider<T>
context: Context
earnings: EarningsInterface<T>
fees: FeesInterface<T>
gauges: GaugeInterface<T>
ready: Promise<void[]>

This promise can be optionally awaited to assure that all services have been correctly loaded.

const yearn = new Yearn(1, { provider });
await yearn.ready;
services: ServicesType<T>
simulation: SimulationInterface<T>
strategies: StrategyInterface<T>
tokens: TokenInterface<T>
vaults: VaultInterface<T>
votingEscrows: VotingEscrowInterface<T>

Methods

  • _initAdapters<T>(chainId: 1 | 10 | 250 | 1337 | 42161): Adapters<T>
  • Type parameters

    • T: 1 | 10 | 250 | 1337 | 42161

    Parameters

    • chainId: 1 | 10 | 250 | 1337 | 42161

    Returns Adapters<T>

  • _initServices<T>(chainId: 1 | 10 | 250 | 1337 | 42161, ctx: Context, addressProvider: AddressProvider<T>, allowlistService?: AllowListService<T>, assetServiceState?: AssetServiceState): ServicesType<T>
  • Type parameters

    • T: 1 | 10 | 250 | 1337 | 42161

    Parameters

    • chainId: 1 | 10 | 250 | 1337 | 42161
    • ctx: Context
    • addressProvider: AddressProvider<T>
    • Optional allowlistService: AllowListService<T>
    • Optional assetServiceState: AssetServiceState

    Returns ServicesType<T>

  • setChainId(chainId: 1 | 10 | 250 | 1337 | 42161): void
  • Parameters

    • chainId: 1 | 10 | 250 | 1337 | 42161

    Returns void

Generated using TypeDoc