Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Stake

Hierarchy

  • Tx
    • Stake

Index

Constructors

constructor

  • new Stake(stakeProgramAddress?: string, spltProgramAddress?: string, splataProgramAddress?: string, nodeUrl: string): Stake
  • Parameters

    • stakeProgramAddress: string = ...
    • spltProgramAddress: string = ...
    • splataProgramAddress: string = ...
    • nodeUrl: string

    Returns Stake

Properties

connection

connection: Connection

nodeUrl

nodeUrl: string

splataProgramId

splataProgramId: PublicKey

spltProgramId

spltProgramId: PublicKey

stakeProgramId

stakeProgramId: PublicKey

Methods

deriveDebtAddress

  • deriveDebtAddress(index: number, ownerAddress: string, farmAddress: string): Promise<string>
  • Derive debt address

    Parameters

    • index: number

      Account index (MAX: 4294967296)

    • ownerAddress: string

      Owner address of the debt account

    • farmAddress: string

      Corresponding farm address to the debt account

    Returns Promise<string>

    Debt account address

freeze

  • freeze(farmAddress: string, wallet: WalletInterface): Promise<{ txId: string }>
  • Freeze the farm Prevent all functions such as stake, unstake, and harvest

    remarks

    Farm owner only

    Parameters

    Returns Promise<{ txId: string }>

    Transaction hash txId

getDebtData

getFarmData

harvest

  • harvest(index: number, farmAddress: string, rewardedAddress: string, wallet: WalletInterface): Promise<{ debtAddress: string; txId: string }>
  • Havest You havest rewards and send tokens to the rewarded address

    Parameters

    • index: number

      The account's index

    • farmAddress: string

      Farm address

    • rewardedAddress: string

      Rewarded address that receive havested tokens

    • wallet: WalletInterface

    Returns Promise<{ debtAddress: string; txId: string }>

    Transaction hash txId, and debt account address debtAddress

initializeFarm

  • initializeFarm(reward: bigint, period: bigint, scope: bigint, ownerAddress: string, mintStakeAddress: string, mintRewardAddress: string, wallet: WalletInterface): Promise<{ farmAddress: string; txId: string }>
  • Initialize a farm

    Parameters

    • reward: bigint

      The number of tokens per period

    • period: bigint

      The number of seconds for a reward period

    • scope: bigint

      The maximum number of periods

    • ownerAddress: string

      Farm owner address

    • mintStakeAddress: string

      Mint address for staking

    • mintRewardAddress: string

      Mint address for rewarding

    • wallet: WalletInterface

    Returns Promise<{ farmAddress: string; txId: string }>

    Transaction hash txId and the farm address farmAddress

parseDebtData

parseFarmData

seed

  • seed(amount: bigint, farmAddress: string, srcAddress: string, wallet: WalletInterface): Promise<{ txId: string }>
  • Seed more reward to the farm treasury

    remarks

    Owner only

    Parameters

    • amount: bigint

      The number of rewarded tokens that will be seeded

    • farmAddress: string

      Farm address

    • srcAddress: string

      Source address that sends the rewarded tokens to the farm treasury

    • wallet: WalletInterface

    Returns Promise<{ txId: string }>

    Transaction hash txId

stake

  • stake(index: number, amount: bigint, srcAddress: string, farmAddress: string, wallet: WalletInterface): Promise<{ debtAddress: string; txId: string }>
  • Stake Create accounts and stake tokens from the source address

    Parameters

    • index: number

      The account's index

    • amount: bigint

      The number of staked amount

    • srcAddress: string

      Source address that stakes tokens

    • farmAddress: string

      Farm address

    • wallet: WalletInterface

    Returns Promise<{ debtAddress: string; txId: string }>

    Transaction hash txId, and debt account address debtAddress

thaw

  • thaw(farmAddress: string, wallet: WalletInterface): Promise<{ txId: string }>

transferFarmOwnership

  • transferFarmOwnership(farmAddress: string, newOwnerAddress: string, wallet: WalletInterface): Promise<{ txId: string }>
  • Transfer farm's ownership

    remarks

    Farm owner only

    Parameters

    Returns Promise<{ txId: string }>

    Transaction hash txId

unseed

  • unseed(amount: bigint, farmAddress: string, dstAddress: string, wallet: WalletInterface): Promise<{ txId: string }>
  • Unseed less reward

    remarks

    Farm owner only

    Parameters

    • amount: bigint

      The number of rewarded tokens that will be unseeded

    • farmAddress: string

      Farm address

    • dstAddress: string

      Destination address that receives the rewarded tokens from the farm treasury

    • wallet: WalletInterface

    Returns Promise<{ txId: string }>

    Transaction hash txId

unstake

  • unstake(index: number, dstAddress: string, farmAddress: string, wallet: WalletInterface): Promise<{ debtAddress: string; txId: string }>
  • Unstake You unstake all tokens and send them to the destination address

    Parameters

    • index: number

      The account's index

    • dstAddress: string

      Destination address that receives unstaked tokens

    • farmAddress: string

      Farm address

    • wallet: WalletInterface

    Returns Promise<{ debtAddress: string; txId: string }>

    Transaction hash txId, and debt account address debtAddress

unwatch

  • unwatch(watchId: number): Promise<void>
  • Unwatch a watcher by watch id

    Parameters

    • watchId: number

      The watchId was returned by watch function.

    Returns Promise<void>

watch

Generated using TypeDoc