Skip to content

Commit 9b63fd8

Browse files
committed
Merge branch 'LIT-4211-auth-refactor' into feature/lit-4238-clean-unnecessary-packages
2 parents 14a0ede + aaf8c5f commit 9b63fd8

File tree

162 files changed

+21629
-3717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+21629
-3717
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Generating Local Network Context for Lit Protocol
2+
3+
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.
4+
5+
## Local Network Setup
6+
7+
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.
8+
9+
## Version Compatibility Changes
10+
11+
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).
12+
13+
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.
14+
15+
## Generating Custom Context
16+
17+
To generate the proper context:
18+
19+
1. Locate the `getCustomContext` file in the network-specific folder (in this case, `vNaga/naga-develop` folder)
20+
2. Use the `generateSignaturesFromContext` helper function from the `@lit-protocol/contracts` repository
21+
22+
Here's an example of how to use this function:
23+
24+
```ts
25+
import { generateSignaturesFromContext } from '@lit-protocol/contracts/custom-network-signatures';
26+
27+
await generateSignaturesFromContext({
28+
jsonFilePath:
29+
'/Users/anson/Projects/lit-assets/blockchain/contracts/networkContext.json', // in lit assets repo
30+
networkName: 'naga-develop',
31+
outputDir: './naga-develop-signatures',
32+
useScriptDirectory: true,
33+
callerPath: import.meta.url,
34+
});
35+
```

.ctx/v7-to-v8-migration-notes.md

Whitespace-only changes.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,6 @@ local-tests/build
7777
packages/wrapped-keys-lit-actions/src/generated
7878

7979
digest
80-
generate-digest.ts
80+
generate-digest.ts
81+
82+
.cursor/rules

jest.setup.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,11 @@ if (!global.crypto.subtle) {
1414
},
1515
};
1616
}
17+
18+
// If this is not included, you will get the following error when running it in Jest:
19+
// (Error) Details: Request is not defined
20+
// 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.
21+
const { default: fetch, Request, Response } = require('node-fetch');
22+
global.fetch = fetch;
23+
global.Request = Request;
24+
global.Response = Response;

0 commit comments

Comments
 (0)