@persistenceone/stkbnb-web-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

stkBNB-web-sdk

npm (tag) CI Codecov Libraries.io dependency status for GitHub repo styled with prettier License Contributor Covenant

SDK that makes integrating with stkBNB extremely easy.

Install

yarn

yarn add @persistenceone/stkbnb-web-sdk

npm

npm i @persistenceone/stkbnb-web-sdk

Docs

The docs are hosted at GitHub pages.

Usage

For detailed usage examples, please refer the docs on StkBNBWebSDK class . A few examples are given here:

Get stkBNB Balance

import { StkBNBWebSDK } from "@persistenceone/stkbnb-web-sdk";

const sdk = StkBNBWebSDK.getInstance();
const user: string = '...'; // address of some user
const balance = await sdk.stkBNB.balanceOf(user);
console.log(`stkBNB.balanceOf(${user}) = ${StkBNBWebSDK.format(balance)} stkBNB`);

Stake

import { StkBNBWebSDK } from "@persistenceone/stkbnb-web-sdk";
import { ethers } from 'ethers';

const sdk = StkBNBWebSDK.getInstance({ signerOrProvider: ... }); // just provide the signer here
const { transactionHash } = await sdk.stake(ethers.constants.WeiPerEther); // stake 1 BNB

Unstake

import { StkBNBWebSDK } from "@persistenceone/stkbnb-web-sdk";
import { ethers } from 'ethers';

const sdk = StkBNBWebSDK.getInstance({ signerOrProvider: ... }); // just provide the signer here
const { transactionHash } = await sdk.unstake(ethers.constants.WeiPerEther); // unstake 1 stkBNB

Claim

import { StkBNBWebSDK } from "@persistenceone/stkbnb-web-sdk";

const sdk = StkBNBWebSDK.getInstance({ signerOrProvider: ... }); // just provide the signer here
const { transactionHash } = await sdk.claimAll(); // will claim all the requests for which cooldown period has finished

Dependents (0)

Package Sidebar

Install

npm i @persistenceone/stkbnb-web-sdk

Weekly Downloads

12

Version

1.1.7

License

Apache 2.0

Unpacked Size

3.75 MB

Total Files

70

Last publish

Collaborators

  • puneet_m
  • persistenceoneadmin