Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@solrise-finance/staking-sdk
Advanced tools
Readme
Solrise.finance SLRS token staking SDK.
This SDK allows easy fetching, parsing and staking/unstaking your SLRS tokens
Contents:
$ npm install @solrise-finance/staking-sdk
import { SolriseStaking } from '@solrise-finance/staking-sdk';
const solrise = new SolriseStaking({ publicKey: wallet.publicKey })
import { SolriseStaking } from '@solrise-finance/staking-sdk';
const solrise = new SolriseStaking({
publicKey: wallet.publicKey,
connection: web3connection
})
Get aggregate staking account (shows sum of all your stakes):
const aggregate = await solrise.getAggregateStakeAccount();
aggregate = {
pubkey: publicKey, // account public key
isInitialized: true, // account initialized
accountType: 2, // 2 means its aggregate account
version: 1, // version
owner: publicKey, // your wallet
count: 5, // number of your stake accounts
totalStake: '5000000' // total SLRS staked in your stake accounts
}
Get all staking accounts:
const accounts = await solrise.getStakingAccounts();
accounts = [
{
pubkey: publicKey, // account public key
isInitialized: true, // account initialized
accountType: 1, // 1 means its staking account
version: 1, // version
owner: publicKey, // your wallet
tier: 2, // see tiers explanation
amount: '1000000', // amount of SLRS tokens
amountUi: 1, // amount but divided by decimals
calculatedRewards: '13120', // SLRS rewards when lockup is finished
createdAt: 1652624509, // account created
lastUpdated: 1652624509, // account updated (harvest, topup, withdraw)
state: 1, // state ?
apy: 16, // APY
canWithdraw: false, // if true - you can withdraw principal + reward
pendingReward: '13120', // pending reward for harvest when tier is 1
pendingRewardUi: 0.01312, // same as above but divided with decimals
unlocksInSeconds: 2583705 // lockup expiration in seconds for tiers 2-5
},
// ...
]
Create a new staking account:
const { transaction, signers } = await solrise.createStakingAccount(
tier, // tier is number 1 - 5
amount, // number of SLRS
yourSlrsTokenPublicKey // SLRS token account owned by your wallet
);
const signature = await signAndSendTransaction(transaction, signers)
Harvest reward (for tier 1 staking accounts only):
const { transaction, signers } = await solrise.harvestStakingAccount(
stakingAccountPublicKey, // publicKey of staking account you are harvesting
yourSlrsTokenPublicKey // SLRS token account owned by your wallet
);
const signature = await signAndSendTransaction(transaction, signers)
Topup account (+ harvest reward if any):
const { transaction, signers } = await solrise.topupStakingAccount(
amount, // number of SLRS to add to staking account
stakingAccountPublicKey, // publicKey of staking account you are harvesting
yourSlrsTokenPublicKey // SLRS token account owned by your wallet
);
const signature = await signAndSendTransaction(transaction, signers)
Withdraw principal (+ harvest reward if any):
const { transaction, signers } = await solrise.withdrawPrincipal(
amount, // number of SLRS to withdraw
stakingAccountPublicKey, // publicKey of staking account you are harvesting
yourSlrsTokenPublicKey // SLRS token account owned by your wallet
);
const signature = await signAndSendTransaction(transaction, signers)
FAQs
# solrise-staking-sdk
The npm package @solrise-finance/staking-sdk receives a total of 0 weekly downloads. As such, @solrise-finance/staking-sdk popularity was classified as not popular.
We found that @solrise-finance/staking-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.