Lido CSM SDK is a TypeScript/JavaScript library that provides a comprehensive set of tools for interacting with Lido Community Staking Module (CSM) contracts on the Ethereum network. The SDK abstracts the complexity of direct contract interaction, offering a modular, extensible, and developer-friendly interface for building applications on top of Lido CSM.
You can install the Lido CSM SDK using npm or yarn:
yarn add @lidofinance/lido-csm-sdk @lidofinance/lido-ethereum-sdk viemor
npm install @lidofinance/lido-csm-sdk @lidofinance/lido-ethereum-sdk viemTo get started with the Lido CSM SDK, you need to import the necessary modules:
import { LidoSDKCsm } from '@lidofinance/lido-csm-sdk';
import { LidoSDKCore } from '@lidofinance/lido-ethereum-sdk';Before using the SDK, you need to create an instance of the LidoSDKCsm class:
import { LidoSDKCore } from '@lidofinance/lido-ethereum-sdk';
import { LidoSDKCsm } from '@lidofinance/lido-csm-sdk';
import { createPublicClient, http } from 'viem';
import { mainnet } from 'viem/chains';
// Initialize core SDK first
const rpcProvider = createPublicClient({
chain: mainnet
transport: http(),
});
const core = new LidoSDKCore({
chainId: mainnet.id,
rpcProvider,
});
// Then create CSM SDK instance
const sdk = new LidoSDKCsm({ core });const sdk = new LidoSDKCsm({ ... });
// Query operator information
const operatorsCount = await sdk.module.getOperatorsCount();
const operator = await sdk.operator.getInfo(69n);
// Manage keys
const keys = await sdk.keys.getKeys(operatorId);The LidoSDKCsm class aggregates the following modules:
- core: Core SDK for shared logic, configuration, and utilities.
- module: Query CSM status, share limit.
- operator: Query operator data.
- keys: Manage operator keys.
- keysCache: Pubkey caching to prevent double-submission.
- bond: Manage operator bond balance.
- rewards: Query reward distribution.
- events: Query protocol events.
- depositQueue: Query deposit queue pointers, batches.
- depositData: Parse and validate deposit data JSON.
And more - see packages/csm-sdk/README.md for the complete list.
For detailed documentation, see packages/csm-sdk/README.md.
This project is licensed under the MIT License. See the LICENSE.txt file for details.