Skip to content

LIT-Protocol/js-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisite

  • node (v20.x or above)
  • rust (v1.70.00 or above)
  • wasm-pack

Getting started

pnpm install && pnpm build 

Running E2E Tests

Required Environment Variables

# (Optional) Request a private rpc url from # https://hub.conduit.xyz/chronicle-yellowstone-testnet-9qgmzfcohk LIT_YELLOWSTONE_PRIVATE_RPC_URL=<private-rpc-url> # For live networks (naga-dev, naga-staging) LIVE_MASTER_ACCOUNT=<master-account-private-key> # For local network (naga-local) (default Anvil account) LOCAL_MASTER_ACCOUNT=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

Command

// eg. naga-dev NETWORK=<network-name> pnpm run test:e2e all

Target a specific spec

Use test:target when you only need to exercise one file:

pnpm run test:target packages/e2e/src/tickets/delegation.spec.ts

Append additional Jest flags after the path if you need finer filtering.

QA Starter Kit workflow

When you need to validate SDK integrations against backend or node features, lean on the QA Starter Kit. That repo installs published packages, so it mirrors how downstream teams will consume the SDK.

  1. The node team opens a feature branch for their service.
  2. Create a matching SDK branch and build the integration for that node change.
  3. Publish a snapshot (prerelease) of the SDK packages so the QA Starter Kit can install them from npm.
  4. Point the QA Starter Kit to that snapshot to perform the e2e flow before promoting the release.

This keeps QA aligned with the packages that will actually ship and avoids the drift that comes with local linking.

Running it against a local network

Generate a fresh networkContext.json for local nodes with pnpm run gen:local-network-context before running the e2e tests against the naga-local local network.

Required Environment Variables

# path to the networkContext.json file NETWORK_CONFIG=/<path-to-lit-assets>/lit-assets/blockchain/contracts/networkContext.json # name of the output file NETWORK_NAME=naga-develop # target directory DIRECTORY_NAME=naga-local

Command

NETWORK=naga-local pnpm run test:e2e all

Manual Publishing

# Generate a changeset pnpm changeset # Version the changeset pnpm changeset version # Build the packages pnpm build # Commit the changes git add . git commit -m "chore: release v0.0.1" # Publish the packages pnpm changeset publish

Apps

This monorepo contains two apps: Lit Auth Server and Lit Login Server.Both apps support Docker builds.

Releasing Docker Images

  • Trigger the Release Docker Images GitHub Action (.github/workflows/release-docker-images.yml) from the Actions tab once the desired changes are on the branch you want to release from.
  • When starting the workflow, select the branch ref, set auth-server-released to true, and optionally provide a custom-tag to add an extra image tag alongside the branch/commit/latest tags.
  • The job installs the Rust toolchain and wasm-pack, builds both lit-auth-server and lit-login-server via their Nx docker-build targets, and pushes images to ghcr.io/lit-protocol/<app> using the repo's GITHUB_TOKEN (or the GHCR_USERNAME/GHCR_TOKEN secrets if you supply them).
  • Published images live under:
  • Leave auth-server-released unchecked to perform a no-op dry run and confirm the workflow is available without publishing images.

One Click Deployable Images

Lit Auth Server

Deploy on Railway

Lit Login Server

Deploy on Railway

Environment configuration

  • ORIGIN: required for OAuth callbacks. Railway asks for a value during deploy—drop in a placeholder like http://localhost:3000, let the app spin up, then replace it with the generated public HTTPS domain (or your custom domain) so Google and Discord redirect URIs match. Leaving it empty keeps the local-only default and will break production flows.

Keeping the contract address and ABIs in sync with the latest changes

This command must be run manually and is NOT part of the build process, as it requires a GitHub API key.

DEV_BRANCH=develop GH_API_KEY=github_pat_xxx pnpm run sync:contracts

Keeping the docs changelog in sync with the public site

Use the sync:docs-changelog script to refresh the changelog that powers naga.developer.litprotocol.com/changelog.

pnpm run sync:docs-changelog

Note: we currently run this manually after the Changeset PR lands in the naga main branch, though we expect to automate it in CI in the future.

The script collates the latest entries from packages/*/CHANGELOG.md and rewrites the target changelog.mdx. Commit and publish the regenerated file in the docs repo so the public changelog stays current.


Legacy Documentation for V7 and Earlier

Version Link
V7 7.x.x docs
V6 6.x.x docs
V5 5.x.x docs
V2 2.x.x docs

Contact

You can reach the Lit Protocol team through Telegram, Discord, or X.