stake in farm

This section contains SDK example for staking tokens in Farm

Staking of the LP tokens in Farm

import { TonClient, toNano } from "@ton/ton";
import { FARM } from "@ston-fi/sdk";

const client = new TonClient({
  endpoint: "https://toncenter.com/api/v2/jsonRPC",
});

const farm = client.open(FARM.v3.NftMinter.create(
  "EQATBSfNArrEFmchmy1XabKmxMNp9KezscqjPzfmstCU7VXO", // STON/TON Farm v3
));

// Stake 1 STON/TON LP token in v3 farm
const txParams = await farm.getStakeTxParams({
  userWalletAddress: "", // ! replace with your address
  jettonAddress: "EQDtZHOtVWaf9UIU6rmjLPNLTGxNLNogvK5xUZlMRgZwQ4Gt", // STON/TON pool LP token address
  jettonAmount: toNano("1"),
  queryId: 12345,
});

To execute the transaction, you need to send a transaction with these parameters to the blockchain. This code will be different based on the wallet you are using to send the tx from, so please check our doc section about transaction sending guide with examples for different libraries.

Last updated