Pool Staking Network
π₯ Staking in the Bonding Curve Pool
For graduated Bonding Curve Pools, LP fees are distributed through the poolβs staking network.
π― Fetching Staker Profile
Check your staking balance, claimed rewards, and available rewards.
const stakerAccountData =
await bondingCurvePool.actions.staking.fetchStakerAccount({
staker: payer.publicKey,
});
console.log("Staker Account Data:", JSON.stringify(stakerAccountData));
π Example Response:
{
"staked": 95108188.8443,
"stakingTimestamp": "2025-02-21T09:46:03.000Z",
"claimed": {
"tokenA": 0.153621963,
"tokenB": 8530868.3904
},
"available": {
"tokenA": 0.004289379,
"tokenB": 154977.2035
}
}
βοΈ Staking Tokens
Stake tokens into the Bonding Curve Poolβs Staking Network to earn rewards.
const stakeTokensTransaction = await bondingCurvePool.actions.staking.stake({
staker: payer.publicKey,
amountUI: 112325.1425, // Staking 112,325.1425 tokens
});
const stakeTokensTxid = await sendAndConfirmTransaction(
connection,
stakeTokensTransaction,
[payer]
);
console.log(
`βοΈ Successfully staked tokens in the pool's Staking Network! TXID: ${stakeTokensTxid}`
);
π Unstaking Tokens
Unstake your Bonding Curve Pool tokens partially or fully.
const unstakeTokensTransaction =
await bondingCurvePool.actions.staking.unstake({
staker: payer.publicKey,
amountUI: 112325.1425 / 2, // Unstaking 50% of staked tokens
});
const unstakeTokensTxid = await sendAndConfirmTransaction(
connection,
unstakeTokensTransaction,
[payer]
);
console.log(
`π Successfully unstaked tokens from the pool's Staking Network! TXID: ${unstakeTokensTxid}`
);
π Claiming Staking Rewards
Claim your LP rewards from the staking network.
const claimRewardsTransaction =
await bondingCurvePool.actions.staking.claimRewards({
staker: payer.publicKey,
});
const claimRewardsTxid = await sendAndConfirmTransaction(
connection,
claimRewardsTransaction,
[payer]
);
console.log(
`π Successfully claimed staking rewards! TXID: ${claimRewardsTxid}`
);
Last updated