Skip to content

Feat/lit chain manager and lit network components #807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9a7a6bc
feat(local-dev): add gen:context command
Ansonhkg Mar 12, 2025
235535d
feat(ai): add context for AI and human 🧍‍♂️🤝🤖
Ansonhkg Mar 12, 2025
b4e9f05
feat(WIP->network&LitChainClient): copy/paste from https://github.com…
Ansonhkg Mar 12, 2025
81d3d95
feat(local-develop): update context
Ansonhkg Mar 12, 2025
d078e74
feat(networks): add shared directory
Ansonhkg Mar 12, 2025
2d136a8
feat(package.json): add bs58, elysia, and wagmi
Ansonhkg Mar 12, 2025
a8a3b82
chore: update yarn.lock
Ansonhkg Mar 12, 2025
c53ac9a
fix(networks/schemas): fix import paths
Ansonhkg Mar 12, 2025
68740c8
chore: remove unused `LIT_CONTRACT_NAME`
Ansonhkg Mar 12, 2025
2dd5ea2
fmt
Ansonhkg Mar 12, 2025
af1800d
chore: remove unused `callWithSeparatedSteps`, though this is a usefu…
Ansonhkg Mar 12, 2025
401b30d
fix(networks/LitChainClient): export util apis
Ansonhkg Mar 12, 2025
f50fca9
fmt
Ansonhkg Mar 12, 2025
2c703e8
fix(linter): pkp, pricing and staking directories
Ansonhkg Mar 12, 2025
7e9628f
fix(linter): permissions directory
Ansonhkg Mar 12, 2025
0abe5c1
fix(linter): fixed imports for permissions directory
Ansonhkg Mar 13, 2025
1c13933
fix(linter): fix vNaga imports for higher level apis
Ansonhkg Mar 13, 2025
405a43d
feat(.gitignore): add `.cursor/rules` to ignore list, we can manually…
Ansonhkg Mar 13, 2025
694425c
fix(linter): vNaga imports for higher level apis
Ansonhkg Mar 13, 2025
5ef1e6a
fix(createLitContracts): 😡 hacky types to fix ts7056 but it works
Ansonhkg Mar 13, 2025
5652cad
feat(test): ⭐️ remove `Bun` specific imports, so that the tests can b…
Ansonhkg Mar 14, 2025
bcf22fa
chore(test): remove bun imports
Ansonhkg Mar 14, 2025
46b3954
feat(package.json): add `pino-pretty` dep
Ansonhkg Mar 17, 2025
51e0ee9
feat(wip/networks): add `vDatil` code but need to fix linter and impo…
Ansonhkg Mar 17, 2025
d38c96f
fix(vNaga): fmt
Ansonhkg Mar 17, 2025
0bfd471
fix(networks): fix NetworkContext to be an interface (without realmId…
Ansonhkg Mar 17, 2025
851ab40
fmt
Ansonhkg Apr 3, 2025
b3205cb
fix(test): import paths
Ansonhkg Apr 3, 2025
f731a67
fix(.ts): import paths
Ansonhkg Apr 3, 2025
a08db3e
fmt
Ansonhkg Apr 3, 2025
edb6ab7
fmt
Ansonhkg Apr 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .ctx/generate-local-network-context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generating Local Network Context for Lit Protocol

The Lit network contexts, which include smart contract addresses and ABIs, typically come from the `@lit-protocol/contracts` package (a separate repository at https://github.com/LIT-Protocol/lit-contracts/). However, these contexts are designed for established networks.

## Local Network Setup

For local development (running Lit nodes on your machine), you need to generate a `networkContext.json` file in the `lit-assets` directory. This is typically done by running the deploy script after starting your local Anvil chain.

## Version Compatibility Changes

In version 7 or earlier, you could simply copy and paste the `networkContext.json` file, and it would work when setting the network to `custom` when running with Tinny (E2E test suite).

However, in version 8, we've optimised by removing redundant and unused ABIs from the JSON file and enforced strongly typed ABIs. This optimization introduced an additional conversion layer that extracts only the necessary ABI methods, which must be run manually for local network contexts.

## Generating Custom Context

To generate the proper context:

1. Locate the `getCustomContext` file in the network-specific folder (in this case, `vNaga/naga-develop` folder)
2. Use the `generateSignaturesFromContext` helper function from the `@lit-protocol/contracts` repository

Here's an example of how to use this function:

```ts
import { generateSignaturesFromContext } from '@lit-protocol/contracts/custom-network-signatures';

await generateSignaturesFromContext({
jsonFilePath:
'/Users/anson/Projects/lit-assets/blockchain/contracts/networkContext.json', // in lit assets repo
networkName: 'naga-develop',
outputDir: './naga-develop-signatures',
useScriptDirectory: true,
callerPath: import.meta.url,
});
```
Empty file.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,6 @@ local-tests/build
packages/wrapped-keys-lit-actions/src/generated

digest
generate-digest.ts
generate-digest.ts

.cursor/rules
8 changes: 8 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ const crypto = require('crypto');
global.TextEncoder = require('util').TextEncoder;
global.TextDecoder = require('util').TextDecoder;
global.crypto = crypto;

// If this is not included, you will get the following error when running it in Jest:
// (Error) Details: Request is not defined
// The problem is that Jest is running in a Node.js environment where the global Request API (part of the Fetch API) might not be available or properly configured. Bun, on the other hand, has this API built into its runtime by default, which is why it works.
const { default: fetch, Request, Response } = require('node-fetch');
global.fetch = fetch;
global.Request = Request;
global.Response = Response;
Loading
Loading