stkr js sdk to interact with stkr.io directly
npm install @ankr.com/stkr-jssdk-v2Ankr Staking JavaScript SDK
===========================
This sdk used to implement stkr.io to javascript applications.
Via npm;
```
npm install @ankr.com/stkr-jssdk-v2
Via yarn;
``
yarn add @ankr.com/stkr-jssdk-v2
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
`js`
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.
`js``
import { StkrSdk } from "@ankr.com/stkr-jssdk-v2"
const stkr = StkrSdk.getForConfig({
// ...
})
await stkr.connect()
const {transactionHash} = await stkr.stake('1')
await stkr.disconnect()