Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Manager

Hierarchy

  • Manager

Index

Constructors

  • new Manager(algodClient: default, managerAppId: number): Manager
  • This is the constructor for the Manager class.

    Note, do not call this to create a new manager. Instead call the static method init as there are asynchronous set up steps in creating an manager and a constructor can only return an instance of the class and not a promise.

    Example

    //Correct way to instantiate new manager
    const newManager = await Manager.init(algodClient, managerAppId)

    //Incorrect way to instantiate new manager
    const newManager = new Manager(algodClient, managerAppId)

    Parameters

    • algodClient: default

      algod client

    • managerAppId: number

      id of the manager application

    Returns Manager

Properties

algod: default
managerAddress: string
managerAppId: number
rewardsProgram: RewardsProgram

Methods

  • getManagerAddress(): string
  • Return manager address

    Returns string

    manager address

  • getManagerAppId(): number
  • getStorageAddress(address: string): Promise<string>
  • Reeturns the storage addres for the client user

    Parameters

    • address: string

      address to get info for

    Returns Promise<string>

    storage account address for user

  • getStorageState(storageAddress: string): Promise<{}>
  • Returns the market local state for storage address

    Parameters

    • storageAddress: string

      storage address to get info for

    Returns Promise<{}>

    market local state for storage address

  • getStorageUnrealizedRewards(storageAddress: string, markets: Market[]): Promise<any[]>
  • Returns projected unrealized rewards for storage address

    Parameters

    • storageAddress: string

      storage address to get unrealized rewards for

    • markets: Market[]

      list of markets

    Returns Promise<any[]>

    two element list of primary and secondary unrealized rewards

  • getUserState(address: string): Promise<{}>
  • Returns the market local state for the provided address

    Parameters

    • address: string

      address to get info for

    Returns Promise<{}>

    market local state for address

  • getUserUnrealizedRewards(address: string, markets: Market[]): Promise<any[]>
  • Returns projected unrealized rewards for a user address

    Parameters

    • address: string

      address to get unrealized rewards for

    • markets: Market[]

      list of markets

    Returns Promise<any[]>

    two element list of primary and secondary unrealized rewards

  • updateGlobalState(): Promise<void>
  • Method to fetch most recent manager global state

    Returns Promise<void>

  • init(algodClient: default, managerAppId: number): Promise<Manager>
  • This is the function that should be called when creating a new manager. You pass everything you would to the constructor, but to this function instead and this returns the new and created manager.

    Example

    //Correct way to instantiate new manager
    const newManager = await Manager.init(algodClient, managerAppId)

    //Incorrect way to instantiate new manager
    const newManager = new Manager(algodClient, managerAppId)

    Parameters

    • algodClient: default

      algod client

    • managerAppId: number

      id of the manager application

    Returns Promise<Manager>

    an instance of the manager class fully constructed

Generated using TypeDoc