@ankr.com/stkr-jssdk-v2
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

Ankr Staking JavaScript SDK

This sdk used to implement stkr.io to javascript applications.

Installation

Via npm;

npm install @ankr.com/stkr-jssdk-v2

Via yarn;

yarn add @ankr.com/stkr-jssdk-v2

Usage

Stkr sdk constructor gets web3 instance and network name (e.g. mainnet or goerli) and act like a bridge to contract with web3. And return types almost same with web3 contract calls but they may be changed / edited to provide simplicity for applications.

You can configure Stkr SDK instance by setting env REACT_APP_STKR_ENV to one of next possible values:

  • mainnet (default) - use mainnet configuration
  • goerli - use goerli configuration
  • develop - use develop configuration
  • local - use localhost configuration
import { StkrSdk } from "@ankr.com/stkr-jssdk-v2"
const stkr = StkrSdk.getForEnv()
await stkr.connect()
const {transactionHash} = await stkr.stake('1')
await stkr.disconnect()

Or if you want you can also configure Stkr SDK instance manually.

import { StkrSdk } from "@ankr.com/stkr-jssdk-v2"
const stkr = StkrSdk.getForConfig({
  // ...
})
await stkr.connect()
const {transactionHash} = await stkr.stake('1')
await stkr.disconnect()

Package Sidebar

Install

npm i @ankr.com/stkr-jssdk-v2

Weekly Downloads

1

Version

2.0.3

License

MIT

Unpacked Size

542 kB

Total Files

87

Last publish

Collaborators

  • intoskai
  • nwts0as
  • ankr_network