npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@overdive/lit-js-sdk

v0.0.5

Published

<div align="center"> <h1>Lit Protocol Javascript/Typescript SDK V6.5.x</h1>

Downloads

17

Readme

Quick Start

NodeJS Exclusive

Removed browser-specific methods, e.g., checkAndSignAuthSig

yarn add @overdive/lit-node-client-nodejs

or..

Isomorphic Implementation

Operable in both Node.js and the browser

yarn add @overdive/lit-node-client

Packages

📝 If you're looking to use the Lit SDK, you're probably all set with just the lit-node-client . Get started with interacting with Lit network!

| Package | Category | Download | | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | @overdive/lit-node-client-nodejs | lit-node-client-nodejs | | | @overdive/lit-node-client | lit-node-client | |

If you're a tech-savvy user and wish to utilize only specific submodules that our main module relies upon, you can find individual packages listed below. This way, you can import only the necessary packages that cater to your specific use case::

| Package | Category | Download | | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | @overdive/access-control-conditions | access-control-conditions | | | @overdive/auth-helpers | auth-helpers | | | @overdive/bls-sdk | bls-sdk | | | @overdive/constants | constants | | | @overdive/contracts-sdk | contracts-sdk | | | @overdive/core | core | | | @overdive/crypto | crypto | | | @overdive/ecdsa-sdk | ecdsa-sdk | | | @overdive/encryption | encryption | | | @overdive/logger | logger | | | @overdive/misc | misc | | | @overdive/nacl | nacl | | | @overdive/pkp-base | pkp-base | | | @overdive/pkp-client | pkp-client | | | @overdive/pkp-cosmos | pkp-cosmos | | | @overdive/pkp-ethers | pkp-ethers | | | @overdive/pkp-sui | pkp-sui | | | @overdive/pkp-walletconnect | pkp-walletconnect | | | @overdive/sev-snp-utils-sdk | sev-snp-utils-sdk | | | @overdive/types | types | | | @overdive/uint8arrays | uint8arrays | | | @overdive/wrapped-keys | wrapped-keys | | | @overdive/wrapped-keys-lit-actions | wrapped-keys-lit-actions | | | @overdive/auth-browser | auth-browser | | | @overdive/misc-browser | misc-browser | |

API Doc

| Version | Link | | ---------------- | -------------------------------------------------------- | | V6 (Beta) | 6.x.x docs | | V5 (Current) | 5.x.x docs | | V2 | 2.x.x docs |

Contributing and developing to this SDK

Prerequisite

  • node (v19.x or above)

Recommended

  • NX Console: https://nx.dev/core-features/integrate-with-editors

Quick Start

The following commands will help you start developing with this repository.

First, install the dependencies via yarn:

yarn

Building

You can build the project with the following commands:

// for local development - It stripped away operations that don't matter for local dev
yarn build:dev

// you should never need to use yarn build unless you want to test or publish it
yarn build

Run unit tests

yarn test:unit

Run E2E tests in nodejs

yarn test:local

Advanced

Creating a new library

nx generate @nx/js:library

Create a new react demo app using the Lit JS SDK

yarn tools --create --react contracts-sdk --demo

Deleting a package or app

// delete an app from ./app/<app-name>
yarn delete:app <app-name>

// delete a package from ./packages/<package-name>
yarn delete:package <package-name>

Building

yarn build

Building target package

yarn nx run <project-name>:build

Building Local Changes

During development you may wish to build your code changes in packages/ in a client application to test the correctness of the functionality.

If you would like to establish a dependency between packages within this monorepo and an external client application that consumes these packages:

  1. Run npm link at the root of the specific package you are making code changes in.
cd ./packages/*/<package-name>
npm link
  1. Build the packages with or without dependencies
yarn build
# or
yarn nx run lit-node-client-nodejs:build --with-deps=false
  1. In the client application, run npm link <package> --save to ensure that the package.json of the client application is updated with a file: link to the dependency. This effectively creates a symlink in the node_modules of the client application to the local dependency in this repository.
cd path/to/client-application
npm link <package> --save

Having done this setup, this is what the development cycle looks like moving forward:

  1. Make code change
  2. Rebuild specific package
  3. Rebuild client application.

Publishing

You must have at least nodejs v18 to do this.

  1. Install the latest packages with yarn install

  2. Run yarn bump to bump the version

  3. Build all the packages with yarn build

  4. Run the unit tests with yarn test:unit & e2e node tests yarn test:local locally & ensure that they pass

  5. Update the docs with yarn gen:docs --push

  6. Finally, publish with the @cayenne tag: yarn publish:cayenne

  7. Commit these changes "Published version X.X.X"

Publishing to Serrano / Jalapno

git checkout serrano
yarn bump
yarn build
yarn node ./tools/scripts/pub.mjs --tag serrano-jalapeno

Testing

Quick Start on E2E Testing

The following will serve the react testing app and launch the cypress e2e testing after

yarn test:local

Unit Tests

yarn test:unit

Testing with a Local Lit Node

First, deploy your Lit Node Contracts, since the correct addresses will be pulled from the ../lit-assets/blockchain/contracts/deployed-lit-node-contracts-temp.json file.

Set these two env vars:

export LIT_JS_SDK_LOCAL_NODE_DEV="true"
export LIT_JS_SDK_FUNDED_WALLET_PRIVATE_KEY="putAFundedPrivateKeyOnChronicleHere"

Run:

yarn update:contracts-sdk --fetch
yarn update:contracts-sdk --gen
yarn build:packages

To run manual tests:

 yarn nx run nodejs:serve

ENV Vars

  • LIT_JS_SDK_GITHUB_ACCESS_TOKEN - a github access token to get the contract ABIs from a private repo
  • LIT_JS_SDK_LOCAL_NODE_DEV - set to true to use a local node
  • LIT_JS_SDK_FUNDED_WALLET_PRIVATE_KEY - set to a funded wallet on Chronicle Testnet

Dockerfile

...coming soon

Other Commands

Interactive graph dependencies using NX

yarn graph

FAQs & Common Errors

In your React package.json, add GENERATE_SOURCEMAP=false to your start script

eg.

  "scripts": {
    "start": "GENERATE_SOURCEMAP=false react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

It’s currently using a custom plugin @websaam/nx-esbuild which is a fork from @wanews/nx-esbuild

"_buildWeb": {
    "executor": "@websaam/nx-esbuild:package",
    "options": {
      "banner": {
        "js": "import { createRequire } from 'module';const require = createRequire(import.meta.url);"
      },
      "globalName": "LitJsSdk_CoreBrowser",
      "outfile":"dist/packages/core-browser-vanilla/core-browser.js",
      "entryPoints": ["./packages/core-browser/src/index.ts"],
      "define": { "global": "window" },
      "plugins":[
        {
          "package": "esbuild-node-builtins",
          "function": "nodeBuiltIns"
        }
      ]
    }
  }
import crypto, { createHash } from 'crypto';
Object.defineProperty(globalThis, 'crypto', {
  value: {
    getRandomValues: (arr: any) => crypto.randomBytes(arr.length),
    subtle: {
      digest: (algorithm: string, data: Uint8Array) => {
        return new Promise((resolve, reject) =>
          resolve(
            createHash(algorithm.toLowerCase().replace('-', ''))
              .update(data)
              .digest()
          )
        );
      },
    },
  },
});

Make sure your node version is above v18.0.0