// Prepare Unstake params
// Staker Address
const stakerAddress = Address.parse("stake-address");
// Burn 0.1 stgUSD to get tgUSD
// Your stgUSD will be burned and converted to tgUSD based on the conversion rate in the staking contract.
const burnAmount = 100000n;
const unstakePayload = await staking.getUnstakePayload(stakerAddress, burnAmount);
After calling Unstake, a 7-day cooldown period is required. You can only claim your tgUSD after the cooldown period ends.
Step 3: Claim tgUSD After Cooldown
// Remember to import RedeemAccount from the SDK.
import { RedeemAccount } from '@torch-finance/tgusd-sdk';
// Unstaker Address
const unstakerAddress = Address.parse("unstaker-address");
// Get the address of the associated unstake account
const unstakeAccountAddress = await staking.getUnstakeAccountAddress(unstakerAddress);
// Initialize the unstake account contract
const unstakeAccount = tonClient.open(
RedeemAccount.createFromAddress(unstakeAccountAddress)
);
// Build claim payload for redeeming tgUSD
const claimPayload = await unstakeAccount.getClaimPayload(unstakerAddress);