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

@lit-protocol/lit-listener-sdk

v1.1.0

Published

An open source typescript SDK, compatible with node and browser, with an easy interface to automate responses from webhooks, subscribed on-chain events and intervals through triggered callback functions and the use of Lit Protocol PKPs.

Downloads

8

Readme

Lit Listener

An open source typescript SDK, compatible with node and browser, with an easy interface to automate responses from webhooks, subscribed on-chain events and intervals through triggered callback functions and the use of Lit Protocol PKPs.

The LitListenerSDK is designed around the principle of conditionally pre-approved chain reactions with account abstraction.

Lit Listener

Check out the documentation for in depth implementation details.

To install the SDK run:

npm i lit-listener-sdk

Quick Start

import { ethers, BigNumber } from "ethers";
import { Circuit } from "lit-listener-sdk";

const chronicleProvider = new ethers.providers.JsonRpcProvider("https://chain-rpc.litprotocol.com/http", 175177);
const chronicleSigner = new ethers.Wallet(YOUR_PRIVATE_KEY, chronicleProvider);

const quickStartCircuit = new Circuit(chronicleSigner);

quickStartCircuit.setConditions([
 new ContractCondition(
    "0x6968105460f67c3bf751be7c15f92f5286fd0ce5", // contract address
    [
     {
      "anonymous": false,
      "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "to",
        "type": "address"
       },
       {
        "indexed": false,
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
        }
          ],
          "name": "Transfer",
          "type": "event"
        },
      ], // abi
      "Transfer", // event name
      CHAIN_NAME.polygon, // chainId
      "https://your_provider_url_for_this_network", // provider URL
      ["to", "value"], // event name args
      ["0x6968105460f67c3bf751be7c15f92f5286fd0ce5",
      BigNumber.from("500000")], // expected value
      "===", // match operator
      async () => { console.log("Matched!"); }, // onMatched function
      async () => { console.log("Unmatched!"); }, // onUnMatched function
      (error: Error) => { console.log("Error:", error); } // onError function,
), ]);

const {unsignedTransactionDataObject, litActionCode} = await quickStartCircuit.setActions([{
  type: "contract",
  priority: 2,
  contractAddress: "0x6968105460f67c3bf751be7c15f92f5286fd0ce5",
  abi: [
     {
      constant: true,
      inputs: [{ name: "numberValue", type: "uint256" }],
      name: "your_function_name",
      outputs: [{ name: "", type: "uint256" }],
      payable: false,
      stateMutability: "external",
      type: "function",
      },
  ],
  functionName: "your_function_name",
  chainId: "polygon",
  nonce: 1,
  gasLimit: 100000,
  value: 0,
  maxPriorityFeePerGas: 1000,
  maxFeePerGas: 10000,
  args: [20],
};
]);

// Assuming you have already uploaded the Lit Action Code to IPFS and just need to retrive the hash
const ipfsCID = await quickStartCircuit.getIPFSHash(litActionCode);
const { publicKey, tokenId, address } = await quickStartCircuit.mintGrantBurnPKP(ipfsCID);

await quickStartCircuit.start({publicKey, ipfsCID});

Account abstraction enticing you to abstract away the code too?

Check out a no code implementation of the SDK live here.

Abstracted