Skip to content
On this page

Getting Started

The Cardano wallet SDK library provides class with batch of methods that helps to manage user's stake.

Install the npm library by copying the code below.

sh
$ npm install @everstake/wallet-sdk-cardano

or you can also use yarn

sh
$ yarn add @everstake/wallet-sdk-cardano

This code example how to make Cardano instance. The paymentAddress should be in correct format - bech32. To create instance also need to get a blockFrostProjectID. More details can be found here https://blockfrost.io/ . Be careful when use network. (preview and preprod are testnets)

typescript
import {CardanoWeb3} from "cardano-web3-js"
import {Cardano} from "@everstake/wallet-sdk-cardano";

const web3 = new CardanoWeb3({network: "preview"});
const mnemonic = '...';
const account = web3.account.fromMnemonic(mnemonic);
const blockForstProjectID = '...';

const cardano = new Cardano('preview', account.__config.paymentAddress, blockForstProjectID);

(Optionally) Methods registerAndDelegateCborHexTx() and delegateCborHexTx() required information about pool. It automatically calls
selectPool() methods, that is a bit slowly. But it can be preloaded if selectPool() will be lazy loaded before delegations methods to save some time.

typescript
const cardano = new Cardano('preview', account.__config.paymentAddress, blockForstProjectID);
await cardano.selectPool(); // preloaded
const tx = await registerAndDelegateCborHexTx() // selectPool() will skipped