Skip to main content

LSD Wizard SDK

The LSD Wizard SDK allows users to interact with the LSD network and Giant pools. Using the SDK anyone can deploy their own LSD, interact with the new or the existing LSDs.

It is recommended to use ethers.js v5.7.2 (for compatibility) as the SDK uses it throughout.

Pre-installations

The new LSD Wizard SDK (version 3 and above) is in typescript and it can be used in both NodeJS and Typescript environment. It uses typechain to generate types for the ABIs and typescript to compile the SDK. For this reason, the SDK requires following pre-installations:

  • typescript
  • typechain
  • @typechain/ethers-v5
  • @types/lodash

These can be installed using the command shown below:

yarn add typescript typechain @typechain/ethers-v5 @types/lodash

Installation

To install the SDK use the command yarn add @blockswaplab/lsd-wizard [email protected]

Using the SDK

One of the ways to import and initialize the Wizard SDK is:

const { Wizard } = require('@blockswaplab/lsd-wizard');
// Or use import
// import { Wizard } from '@blockswaplab/lsd-wizard';

const provider = new ethers.providers.InfuraProvider('goerli', {
projectId: INFURA_PROJECT_ID,
projectSecret: INFURA_PROJECT_SECRET,
});
const signer = new ethers.Wallet(PRIV_KEY, provider);

const wizard = new Wizard({
signerOrProvider: signer, // signer or provider
liquidStakingManagerAddress: '0x1779642181f0f799582e9ebe9615f96c744e527b', // optional
savETHPoolAddress: '0x4857819f7a29c73f4a005dd907e01333383d2f81', // optional
feesAndMevPoolAddress: '0x7635c5d48b0c0b99a66628b3c1297ed5bb395bb9', // optional
});
  • signerOrProvider parameter: ethers.js signer or provider instance. With provider instance only the view functions from the smart contract are executable.
  • liquidStakingManagerAddress parameter: Address of the specific LSD to execute functions from. This is an optional parameter. When null, none of the functions from LSD's Liquid Staking Manager can be executed via the SDK.
  • savETHPoolAddress parameter: Address of the Protected Staking pool of any LSD. This is an optional parameter. When null, none of none of the functions from the LSD's Protected Staking pool can be executed via the SDK. This address can be from any LSD, which means a user can query a function from Liquid Staking Manager of LSD-1 and also execute a function from Protected Staking pool of LSD-2.
  • feesAndMevPoolAddress parameter: Address of the Fess and MEV pool of any LSD. This is an optional parameter. When null, none of the functions from the LSD's Fees and MEV pool can be executed via the SDK. This address can be from any LSD, which means a user can query a function from Liquid Staking Manager of LSD-1 and also execute a function from Fees and MEV pool of LSD-2.

To deploy a new LSD network, the SDK only needs the signer parameter.

Sub classes

The SDK exposes various sub-classes: