Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Farming

Hierarchy

  • Tx
    • Farming

Index

Constructors

constructor

  • new Farming(farmingProgramAddress?: string, spltProgramAddress?: string, splataProgramAddress?: string, nodeUrl: string): Farming
  • Parameters

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

    Returns Farming

Properties

connection

connection: Connection

farmingProgramId

farmingProgramId: PublicKey

nodeUrl

nodeUrl: string

splataProgramId

splataProgramId: PublicKey

spltProgramId

spltProgramId: PublicKey

Methods

closeDebt

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

closeFarm

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

deriveDebtAddress

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

    Parameters

    • 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

  • getDebtData(debtAddress: string): Promise<DebtData>

getFarmData

  • getFarmData(farmAddress: string): Promise<FarmData>

harvest

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

    Parameters

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

    Transaction hash txId, and debt account address debtAddress

initializeAccounts

  • initializeAccounts(farmAddress: string, ownerAddress: string, wallet: WalletInterface): Promise<{ debtAddress: string; rewardedAddress: string; txId: string }>
  • Initialize accounts including rewarded and debt

    Parameters

    • farmAddress: string

      Farm account address

    • ownerAddress: string

      Onwer address for the accounts (your wallet address usually)

    • wallet: WalletInterface

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

    Transaction hash txId, associated account address to wallet for rewarding rewardedAddress, and debt account address debtAddress

initializeFarm

  • initializeFarm(reward: bigint, period: 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

    • 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 Farm address farmAddress

parseDebtData

parseFarmData

rid

  • rid(dstAddress: string, rewardedAddress: string, farmAddress: string, wallet: WalletInterface): Promise<{ debtAddress: string; txId: string }>
  • Rid Give up on reward, get rid of the farm

    Parameters

    • dstAddress: string

      Destination address that receives unstaked tokens

    • rewardedAddress: string

      Rewarded address that receive havested tokens (for strict procedure)

    • farmAddress: string

      Farm address

    • wallet: WalletInterface

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

    Transaction hash txId, and debt account address debtAddress

seed

  • seed(amount: bigint, farmAddress: string, srcAddress: string, wallet: WalletInterface): Promise<{ txId: string }>
  • Seed more reward tot 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(amount: bigint, srcAddress: string, rewardedAddress: string, farmAddress: string, wallet: WalletInterface): Promise<{ debtAddress: string; txId: string }>
  • Stake You stake tokens from the source address, and havest tokens to rewarded address

    Parameters

    • amount: bigint

      The number of staked amount

    • srcAddress: string

      Source address that stakes tokens

    • rewardedAddress: string

      Rewarded address that receive havested 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(amount: bigint, dstAddress: string, rewardedAddress: string, farmAddress: string, wallet: WalletInterface): Promise<{ debtAddress: string; txId: string }>
  • Unstake You unstake tokens and send them to the destination address, and havest tokens to rewarded address

    Parameters

    • amount: bigint

      The number of unstaked amount

    • dstAddress: string

      Destination address that receives unstaked tokens

    • rewardedAddress: string

      Rewarded address that receive havested 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