Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StakingContract

Hierarchy

  • StakingContract

Index

Constructors

  • new StakingContract(algodClient: default, historicalIndexerClient: default): StakingContract
  • This is the constructor for the StakingContract class.

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

    Example

    //Correct way to instantiate new staking contract
    const newStakingContract = await StakingContract.init(algodClient, historicalIndexerClient, stakingContractInfo)

    //Incorrect way to instantiate new staking contract
    const newStakingContract = new StakingContract(algodClient, historicalIndexerClient)

    Parameters

    • algodClient: default

      algod client

    • historicalIndexerClient: default

      historical indexer client

    Returns StakingContract

Properties

algodClient: default
historicalIndexerClient: default
manager: Manager
market: Market

Methods

  • getManagerAddress(): string
  • getManagerAppId(): number
  • getMarketAddress(): string
  • getMarketAppId(): number
  • getOracleAppId(): number
  • getStaked(): number
  • getStorageAddress(address: string): Promise<string>
  • Return the staking contract storage address for given address or null if it does not exist

    Parameters

    • address: string

      address to get info for

    Returns Promise<string>

    storage account address for user

  • getStorageState(storageAddress: string): Promise<{}>
  • Return the staking contract local state for storage address

    Parameters

    • storageAddress: string

      -storage address to get info for

    Returns Promise<{}>

    staking contract local state for address

  • getUserState(address: string): Promise<{}>
  • Return the staking contract local state for address

    Parameters

    • address: string

      address to get info for

    Returns Promise<{}>

    staking contract local state for address

  • updateGlobalState(): Promise<void>
  • init(algodClient: default, historicalIndexerClient: default, stakingContractInfo: {}): Promise<StakingContract>
  • This is the function that should be called when creating a new staking contract. You pass everything you would to the constructor with an additional staking contract info dictionary, but to this function instead and this returns the new and created staking contract.

    Example

    //Correct way to instantiate new staking contract
    const newStakingContract = await StakingContract.init(algodClient, historicalIndexerClient, stakingContractInfo)

    //Incorrect way to instantiate new staking contract
    const newStakingContract = new StakingContract(algodClient, historicalIndexerClient)

    Parameters

    • algodClient: default

      algod client

    • historicalIndexerClient: default

      historical indexer client

    • stakingContractInfo: {}

      dictionary of information on staking contract

      • [key: string]: number

    Returns Promise<StakingContract>

Generated using TypeDoc