⛏️createStake

Description

The createStake function creates a new stake in a staking contract on the blockchain.

It takes in several parameters including the amount of cryptocurrency to be staked, the duration of the stake, whether the stake is a liquidity provider (LP) stake and the user's private key

Parameters

NameTypeDescription

amount

string

The amount of tokens to be staked.

duration

string

The duration of the stake in seconds

isLp

string

Whether the stake is an LP stake

privateKey

string

The private key of the user's wallet

Response

PropertyTypeDescription

receipt

object

The transaction receipt object for the stake creation transaction

Example Request and Response

Prerequisites

Before making requests with Nest SDK, you must have it installed.

You can install Nest SDK using either npm or yarn. Use the following commands to install Nest SDK:

npm install @nest25/tokenomics-lib
OR
yarn add @nest25/tokenomics-lib

Request

Here is an example of how to make a createStake request using the Nest SDK:

// import Nest 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() {
  // create a new stake
  const result = await Staking.createStake('1', '100', false, TEST_PRIVATE_KEY);
  // print the result
  console.log(result);
}
main();

Response

 {
        type: 2,
        chainId: 8888,
        nonce: 71,
        maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
        maxFeePerGas: BigNumber { _hex: '0xd09dc300', _isBigNumber: true },
        gasPrice: null,
        gasLimit: BigNumber { _hex: '0x03e562', _isBigNumber: true },
        to: '0x077e4F1496693B7c45128c436eF933ccaFe6d291',
        value: BigNumber { _hex: '0x00', _isBigNumber: true },
        data: '0x012cae390000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000',
        accessList: [],
        hash: '0x87fe62ca7a46c3bf264857c7073ae5d589ac15b237f9198023befab0b76540d9',
        v: 1,
        r: '0x6351d9d8fd124e736e1bca8142b6cd867dfa2ccfe33d284666eed512176807aa',
        s: '0x692c6c0f54976975f5159d420b5abc0ba28af70e21b457c1ba0db9af4968c488',
        from: '0x5712d28795106f0105C01e99A708d018C1d70E52',
        confirmations: 0,
        wait: [Function (anonymous)]
      }

Use Cases

  • Crypto Staking Platforms: The function can be used by crypto staking platforms to allow users to create new stakes in staking contracts on the blockchain.

  • Decentralized Finance (DeFi) Applications: The function can be used by DeFi applications to enable users to stake their cryptocurrency and earn rewards on the blockchain.

  • Cryptocurrency Wallets: The function can be used by cryptocurrency wallets to allow users to stake their cryptocurrency directly from their wallets.

Last updated