🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

@lit-protocol/contracts

Package Overview
Dependencies
Maintainers
0
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lit-protocol/contracts

A TypeScript utility for fetching and caching Lit Protocol contract ABIs and addresses. This tool maintains consistent contract data formats across the Lit Protocol ecosystem.

0.1.6
npm
Version published
Weekly downloads
2.5K
-36.78%
Maintainers
0
Weekly downloads
 
Created
Source

Lit Protocol Contract Fetcher

A TypeScript utility for fetching and caching Lit Protocol contract ABIs and addresses. This tool maintains consistent contract data formats across the Lit Protocol ecosystem.

Architecture

flowchart TB
    subgraph Main Process
        main["main()"] --> procProd["Process Production Networks"]
        main --> procDev["Process Development Networks"]
        main --> genIndex["Generate Index File"]
        main --> summary["Print Network Summary"]
    end

    subgraph Production Flow
        procProd --> |"For each network"| updateProdCache["updateProdCache()"]
        updateProdCache --> getProdABIs["getProdContractABIs()"]
        updateProdCache --> getLastMod["getLastModified()"]
        updateProdCache --> writeCache["Write Cache File"]
    end

    subgraph Development Flow
        procDev --> updateDevCache["updateDevCache()"]
        updateDevCache --> getDevABIs["getDevContractABIs()"]
        updateDevCache --> getLastMod
        updateDevCache --> writeCache
    end

    subgraph File Generation
        genIndex --> |"Generate"| indexTS["dist/index.ts"]
        writeCache --> |"Generate"| prodTS["dist/prod/*.ts"]
        writeCache --> |"Generate"| devTS["dist/dev/*.ts"]
    end

    subgraph Configuration
        config["Constants & Config"]
        networks["Network Definitions"]
        contractMap["Contract Name Mappings"]
        config --> main
        networks --> main
        contractMap --> updateProdCache
        contractMap --> updateDevCache
    end

    subgraph GitHub API
        getProdABIs --> |"Fetch"| ghAPI["GitHub API"]
        getDevABIs --> |"Fetch"| ghAPI
        getLastMod --> |"Fetch"| ghAPI
    end

    style main fill:#f9f,stroke:#333,stroke-width:4px
    style ghAPI fill:#b8d4ff,stroke:#333
    style config fill:#d4ffb8,stroke:#333

Project Structure

src/
├── config/          # Configuration constants and network definitions
├── services/        # Core business logic services
├── types/           # TypeScript type definitions
├── utils/           # Utility functions
└── index.ts        # Main entry point

Prerequisites

  • Node.js 16 or higher
  • GitHub Personal Access Token with read permissions

Environment Variables

  • GH_API_KEY: GitHub Personal Access Token (required)
  • DEV_BRANCH: Development branch name (defaults to 'develop')

Installation

yarn add @lit-protocol/contracts

Usage

Production Networks (from 'networks' repo)

import { datilDev, datilTest, datil } from "@lit-protocol/contracts";

console.log("datilDev:", datilDev);
console.log("datilTest:", datilTest);
console.log("datil:", datil);

Development Networks (from 'lit-assets' repo)

import { develop } from "@lit-protocol/contracts";

console.log("Development contracts:", develop);

Local Development

  • Clone the repository

  • Install dependencies:

    yarn install
    
  • Set up environment variables:

    export GH_API_KEY=your_github_token
    export LIT_ABI_SOURCE=prod  # or 'dev'
    
  • Run the fetcher:

    # For default branch
    bun run fetch-contracts.ts
    
    # For specific branch
    DEV_BRANCH=develop bun run fetch-contracts.ts
    

CI/CD Workflow

License

MIT

FAQs

Package last updated on 11 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts