Migrating from 3.x.x to 4.x.x
The Datil-test and Datil-dev testnets are now live and are superseding the Manzano and Cayenne testnet respectively.
The Datil mainnet is now live and superseding the Habanero mainnet, ready to store real world assets.
Check out the migration docs to learn how you can start building on the Datil networks today.
This migration guide is outdated and refers to a previous version of the Lit SDK. If you are looking for the most updated version of the Lit SDK, you can view it on GitHub.
V4 release is packed with several improvements, new features, and critical changes aimed at enhancing the robustness, usability, and overall performance of the Lit SDK. Here's everything you need to know about key changes and additions:.
Possible Breaking Changes
Improved Error Handling for connect()
In an effort to streamline error handling and improve the developer experience, connect()
will now throw an error if connecting to the LIT network fails. This is a change from previous behavior, where failures to connect resulted in an UnhandledRejection
or a dangling rejected Promise. If you have error handling already in place for connect()
, this change should not impact your workflow.
Introduction of disconnect()
We've added a new disconnect()
method that effectively detaches our listeners for contract changes and network polling state. This is a step towards ensuring cleaner disconnections and better resource management.
Renaming of networkSyncInterval
The networkSyncInterval
property within lit-core (thus, in the lit-node-client) has been renamed to _networkSyncInterval
and marked explicitly as private. This adjustment is crucial for those who previously relied on manually clearing the networkSyncInterval
on the node client to allow their Node.js process to exit cleanly. Moving forward, please use the disconnect()
method for this purpose.
Enhancements and Fixes
Core Improvements
We've ensured that multiple concurrent calls to connect()
on the same instance do not trigger multiple handshakes. This optimization is expected to yield significant performance improvements.
The connect()
logic has been refined to collect server keys and build a list of connected nodes in memory before updating the core configuration. This change addresses and eliminates a range of non-deterministic behavior previously encountered.
Complete overhaul of the serverKeys
handling: Now, server keys are entirely replaced post-handshake with nodes, removing outdated keys and ensuring up-to-date connectivity.
Bug Fixes
- Addressed several critical bugs identified during our rigorous testing phase.
- Resolved an issue with an incorrect key being set in
config.retryTolerance
— it's now correctly set tomaxRetryCount
. - Fixed naming discrepancies in config properties for Manzano and Habanero, correcting
checkSevSnpAttestation
to the accuratecheckNodeAttestation
. - Enhanced config mutation in the constructor for type safety, avoiding the use of
any
and as type coercion. - Made
checkNodeAttestation
optional, acknowledging its varying relevance based on the LitNetwork network name provided.
Type Enhancements
- Addressed some overly generic types by introducing more specific alternatives, thereby improving type safety and developer experience.
- Modified
LitNodeClientConfig
properties previously marked as required to be optional, catering to a broader range of use cases and configurations.
A comprehensive list of changes can be viewed here.
Installation
The V6 SDK is now the default for developers building on Lit. Please view newer guides for the latest information.
Install the @lit-protocol/lit-node-client
package, which can be used in both browser and Node environments:
yarn add @lit-protocol/lit-node-client
Use the Lit JS SDK:
import * as LitJsSdk from "@lit-protocol/lit-node-client";
Get started here.
Not finding the answer you're looking for? Share your feedback on these docs by creating an issue in our GitHub Issues and Reports repository or get support by visiting our Support page.