βοΈTypeScript SDK
Here are some code samples that are helpful in integrating BlazeStake using the stake pool TypeScript SDK!
Source code: https://github.com/solana-labs/solana-program-library/tree/master/stake-pool/js
Table of Contents
NPM Install
Browser Bundle
Development (unminified)
Production (minified)
Import
CommonJS
ES6
Browser Bundle
Setup
Note about SOL Pay API
You may notice the following block of code in many of the code snippets on this page:
This is an optional instruction that transfers 5000 lamports (0.000005 SOL, equivalent to one transaction fee) to the SOLPAY_API_ACTIVATION address. This serves two purposes:
It's a tip to the BlazeStake crank, which has to make transactions at the end of the epoch to rebalance the pool and merge pending stakes. Since the crank has to pay transaction fees when merging pending stakes at the end of each epoch, this small transfer serves as a tip to the crank to cover that fee.
It tags the transaction on-chain to give it access to our SOL Pay API in case you are interested in using this API to easily query balance changes in that transaction.
If you do not want to do either of the two items listed above, feel free to remove this optional transfer from your code!
Stake Pool Info
Standard Liquid Staking
Stake SOL
Stake SOL (with referral)
Stake SOL (from stake account)
Unstake SOL (instant)
Unstaking instantly relies on limited liquid unstake liquidity available at the stake pool source. For large unstakes, it's better to use delayed unstake or use unstake.it's SDK.
Unstake SOL (delayed)
Custom Liquid Staking
Custom Liquid Staking (CLS) allows you to liquid stake to specific validators! The SOL deposited to the pool during a CLS transaction will be delegated to the specified validator as long as the bSOL stays in the user's control (either through staying in the wallet or being used in a supported DeFi integration like Orca, Raydium, and Saber).
Make sure to query stake.solblaze.org/api/v1/cls_eligible_validators for a list of eligible validators! Other APIs are available on the Custom Liquid Staking APIs page.
Stake SOL through CLS
Stake SOL through CLS (with referral)
Stake SOL through CLS (from stake account)
Unstake SOL through CLS (instant)
Unstaking instantly relies on limited liquid unstake liquidity available at the stake pool source. For large unstakes, it's better to use delayed unstake.
Unstake SOL through CLS (delayed)
Last updated