The removeStake function allows users to remove a previously staked amount from a staking contract and returns a transaction receipt upon successful execution.
Parameters
Name
Type
Description
stakeId
number
The ID of the stake to be removed
amount
string
The amount of the stake to be removed
privateKey
string
The user's private key for the staking contract
Response
Property
Type
Description
receipt
object
The transaction receipt object
Example Request and Response
Prerequisites
Before making requests with QUBIT SDK, you must have it installed.
You can install QUBIT SDK using either npm or yarn. Use the following commands to install QUBIT SDK:
Here is an example of how to make a removeStake request using the QUBIT SDK:
Response
Use Cases
Staking Platforms: The function can be used by staking platforms to allow users to remove their staked tokens and receive rewards.
DeFi Applications: The function can be used by DeFi applications that implement staking features to allow users to withdraw their staked tokens.
Blockchain-based Games: The function can be used by blockchain-based games that offer staking mechanics to enable players to remove their staked tokens as needed.
// import QUBIT SDK library
const { staking } = require('@nest25/tokenomics-lib');
// private key of the account you want to use
const TEST_PRIVATE_KEY = 'your-private-key';
// create a new instance of staking
const Staking = new staking();
async function main() {
// call removeStake function
const result = await Staking.removeStake(2, '1', TEST_PRIVATE_KEY);
// print the result
console.log(result);
}
main();