GithubHelp home page GithubHelp logo

lit-listener-sdk's Introduction

LitListenerSdk

lit-listener-sdk is sdk for automate transaction with Lit Protocol PKP inspired by DIGITALAX/LitListenerSDK

Developed with the goal of a more scalable architecture

Installation

server:

yarn add @lit-listener-sdk/types @lit-listener-sdk/circuit-base @lit-listener-sdk/circuit-viem @lit-listener-sdk/circuit-zerodev

frontend:

yarn add @lit-listener-sdk/types

Server-SDK Integration

lit-listener-server is a server using this sdk and NestJs

swagger: https://lit-listener-server-demo.iampocket.com/api#/

frontend example using this server to run a simple automated transaction

frontend source code

Quick Start

    const transactionAction = new ViemTransactionAction({
      chain: chronicle,
      transport: { type: 'http' },
      to: '0x016013f36abb93F6304eC0aBAbe5b0F3b6636579',
      value: 0n,
      type: 'viem',
    });
    const abi = parseAbi([
      'event Transfer(address indexed from, address indexed to, uint256 amount)',
    ]);
    const contractCondition: ViemContractCondition = new ViemContractCondition({
      type: 'viem-contract',
      abi,
      transport: {
        type: 'http',
        url: 'https://ethereum-goerli.publicnode.com',
      },
      expectedValue: 0n,
      matchOperator: '===',
      // goerli weth
      contractAddress: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6',
      eventName: 'Transfer',
      // add your address here, and send 0 weth to it on goerli after running this test
      eventArgs: { from: '' },
    });

    // This is a factory function
    const circuit = new CircuitViem({
      litNetwork: 'cayenne',
      pkpPubKey: PKP_PUBKEY,
      conditions: [contractCondition],
      conditionalLogic: { type: 'EVERY' },
      options: { maxLitActionCompletions: 1 },
      actions: [transactionAction],
      authSig: CONTROLLER_AUTHSIG,
    });
    circuit.start();
    circuit.on('circuitLog', (log) => {
      console.log(log);
    });

lit-listener-sdk's People

Contributors

yhl125 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.