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

1.1.0 • Public • Published

STKR JSSDK

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

Installation

Via npm;

npm install @ankr.com/stkr-jssdk

Via yarn;

yarn add @ankr.com/stkr-jssdk

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.

import { Stkr } from "@ankr.com/stkr-jssdk"
import Web3 from "web3"

const web3 = new Web3("https://eth-api.ankr.com")
const stkr = new Stkr(web3, "goerli")

Functions

For web3 send functions, our custom functions gets SendOption interface from web3.

Make sure sending values with this interface.

interface SendOptions {
    from: string;
    gasPrice?: string;
    gas?: number;
    value?: number | string | BN;
}

claimableBalanceOf(address: string)

Returns claimable aETH balance of given user

const claimableBalance = await stkr.contracts.globalPool.claimableBalanceOf(web3.defaultAddress)

aETHPrice()

Returns current aETH price based on Ethereum

const price = await stkr.contracts.ankrETH.aETHPrice()

stake()

Stake eth for user.

await stkr.contracts.globalPool.stake(options: SendOptions)

unstake()

Stake eth for user.

await stkr.contracts.globalPool.unstake(options: SendOptions)

Package Sidebar

Install

npm i @ankr.com/stkr-jssdk

Weekly Downloads

9

Version

1.1.0

License

MIT

Unpacked Size

114 kB

Total Files

44

Last publish

Collaborators

  • intoskai
  • nwts0as
  • ankr_network