@iloop/staking-sdk
v1.1.1
Published
iloop Staking sdk
Readme
ILoop_SDK_Staking
Initialize SDK
const walletKeyPair = web3.Keypair.fromSecretKey(bs58.decode(process.env.PRIVATE_KEY_WALLET))
const wallet = new Wallet(walletKeyPair)
const iloopSDK = new IloopStakingSDK(connection, TOKEN_PROGRAM_ID, wallet)TOKEN_PROGRAM_ID can be replaced by TOKEN_2022_PROGRAM_ID if staking token is Token 2022
Initialize Staking
const instructions = await iloopSDK.initialize(token, 25)Update Configuration
Update configuration
const instructions = await iloopSDK.updateConfiguration(25)Admin Deposit reward token
const instructions = await iloopSDK.depositRewardToken(new BN(100000000))Admin Withdraw reward token
const instructions = await iloopSDK.withdrawRewardToken(new BN(5000000))User Stake token
const instructions = await iloopSDK.stakeToken(new BN(50000000), "stake_id")User Unstake token
const instructions = await iloopSDK.unstakeToken()User Claim reward token
const instructions = await iloopSDK.claimReward()