Skip to content

Commit 1de62eb

Browse files
committed
Merge branch 'naga' of github.com:LIT-Protocol/js-sdk into feature/jss-110-security-pin-all-versions-v8
2 parents 2ec7aa6 + 614001f commit 1de62eb

File tree

207 files changed

+176718
-1968
lines changed

Some content is hidden

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

207 files changed

+176718
-1968
lines changed

.changeset/fruity-lands-help.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@lit-protocol/contracts': minor
3+
'@lit-protocol/networks': minor
4+
---
5+
6+
Add `naga` and `naga-proto` networks. Create per-network entrypoints and subpath exports (naga, naga-production, naga-proto, naga-staging, naga-test, naga-dev, naga-local) for better tree-shaking

.changeset/gold-ducks-repeat.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@lit-protocol/networks': patch
3+
'@lit-protocol/e2e': patch
4+
---
5+
6+
PKP signing now auto-hashes Cosmos payloads, exposes a documented bypassAutoHashing option, and ships with a new e2e suite plus docs so builders can rely on every listed curve working out of the box.

.changeset/warm-lizards-fry.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@lit-protocol/lit-client': patch
3+
'@lit-protocol/networks': patch
4+
'@lit-protocol/e2e': patch
5+
---
6+
7+
SDK exposes typed Shiva env helpers (`createShivaEnvVars`, `waitForTestnetInfo`, `SUPPORTED_NETWORKS`) so QA suites can spin up testnets without bespoke env plumbing, and the new `executeWithHandshake` runner automatically retry failures for more stable Lit action execution.

.dockerignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ out
2626

2727
# allow lit-login-server build output for docker image
2828
!dist/apps/lit-login-server/**
29-
!dist/apps/lit-login-server
29+
!dist/apps/lit-login-server
30+
31+
# allow explorer build output for docker image
32+
!apps/explorer/dist/**
33+
!apps/explorer/dist

.eslintrc.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"root": true,
33
"ignorePatterns": ["**/*"],
4-
"plugins": ["@nrwl/nx", "import"],
4+
"plugins": ["@nx", "import"],
55
"overrides": [
66
{
77
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
88
"rules": {
9-
"@nrwl/nx/enforce-module-boundaries": [
9+
"@nx/enforce-module-boundaries": [
1010
"error",
1111
{
1212
"enforceBuildableLibDependency": true,
@@ -23,14 +23,14 @@
2323
},
2424
{
2525
"files": ["*.ts", "*.tsx"],
26-
"extends": ["plugin:@nrwl/nx/typescript"],
26+
"extends": ["plugin:@nx/typescript"],
2727
"rules": {
2828
"@typescript-eslint/no-inferrable-types": "off"
2929
}
3030
},
3131
{
3232
"files": ["*.js", "*.jsx"],
33-
"extends": ["plugin:@nrwl/nx/javascript"],
33+
"extends": ["plugin:@nx/javascript"],
3434
"rules": {}
3535
}
3636
],

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ pnpm install && pnpm build
4040
# (Optional) Request a private rpc url from
4141
# https://hub.conduit.xyz/chronicle-yellowstone-testnet-9qgmzfcohk
4242
LIT_YELLOWSTONE_PRIVATE_RPC_URL=<private-rpc-url>
43+
# (Optional) Mainnet RPC override for naga-proto / naga
44+
LIT_MAINNET_RPC_URL=<mainnet-rpc-url>
4345

4446
# For live networks (naga-dev, naga-staging)
4547
LIVE_MASTER_ACCOUNT=<master-account-private-key>
@@ -48,6 +50,8 @@ LIVE_MASTER_ACCOUNT=<master-account-private-key>
4850
LOCAL_MASTER_ACCOUNT=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
4951
```
5052

53+
When `NETWORK` is set to `naga-proto` or `naga`, the test helpers only top up generated accounts with `0.01` LIT and deposit `0.01` LIT into the Lit Ledger to avoid locking up excess mainnet funds.
54+
5155
## Command
5256

5357
```bash
@@ -99,6 +103,68 @@ DIRECTORY_NAME=naga-local
99103
NETWORK=naga-local pnpm run test:e2e all
100104
```
101105

106+
# Artillery Load Testing
107+
108+
Use the standalone Artillery project under `packages/artillery`
109+
110+
## Preparation
111+
112+
```bash
113+
# from the repo root
114+
pnpm install
115+
116+
# pick your target network: naga-dev | naga-staging | naga-test | naga-local
117+
export NETWORK=naga-staging
118+
export LOG_LEVEL=info # optional: debug | debug2 | silent
119+
```
120+
121+
For live networks that read ABI data from the `networks` repo (for example `naga-staging`), run the sync script before firing Artillery so the contracts and addresses are up to date:
122+
123+
```bash
124+
pnpm run sync:contracts # requires GH_API_KEY in your environment
125+
```
126+
127+
Testing a custom local network? Point the runner at your generated `networkContext.json` and RPC URL. (/lit-assets/blockchain/contracts/networkContext.json)
128+
129+
```ts
130+
const networkModule = nagaLocal
131+
.withLocalContext({
132+
networkContextPath:
133+
'/Users/<username>/Projects/lit-assets/blockchain/contracts/networkContext.json',
134+
networkName: 'naga-local',
135+
})
136+
.withOverrides({ rpcUrl: process.env.LOCAL_RPC_URL });
137+
```
138+
139+
If you want Artillery Cloud reports, set `ARTILLERY_KEY=<your-key>` in `.env` before running a scenario.
140+
141+
## One-time initialisation
142+
143+
Master account, auth data and PKP info are written to this file:
144+
`packages/artillery/artillery-state.json`.
145+
146+
```bash
147+
pnpm nx run artillery:init
148+
```
149+
150+
(optional) Check master balances before blasting a load test:
151+
152+
```bash
153+
pnpm nx run artillery:balance-status
154+
```
155+
156+
## Run a workload
157+
158+
Each scenario is exposed as an Nx target. Use the `run:` prefixed name:
159+
160+
```bash
161+
pnpm nx run artillery:run:pkp-sign # PKP signing focus
162+
pnpm nx run artillery:run:encrypt-decrypt # Encryption/decryption focus
163+
pnpm nx run artillery:run:execute # Lit Action execution
164+
pnpm nx run artillery:run:mix # Mixed workload
165+
pnpm nx run artillery:run:sign-session-key # Session key signing
166+
```
167+
102168
# Manual Publishing
103169

104170
```bash

apps/explorer/.eslintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
}
9+
]
10+
}

apps/explorer/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
.vercel
26+
.cursor
27+
.env
28+
.plan

apps/explorer/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file is generated by Nx.
2+
#
3+
# Build the docker image with `pnpm nx run explorer:docker-build`.
4+
# Tip: Modify "docker-build" options in project.json to change docker build args.
5+
#
6+
# Run the container with `docker run -p 4173:80 -t explorer`.
7+
FROM --platform=linux/amd64 docker.io/nginx:alpine
8+
9+
ENV NODE_ENV=production
10+
11+
# Remove default nginx site content
12+
RUN rm -rf /usr/share/nginx/html/*
13+
14+
# Copy SPA routing config
15+
COPY apps/explorer/nginx.conf /etc/nginx/conf.d/default.conf
16+
17+
# Copy the static assets produced by `nx run explorer:build`
18+
COPY apps/explorer/dist /usr/share/nginx/html
19+
20+
EXPOSE 80
21+
CMD ["nginx", "-g", "daemon off;"]

apps/explorer/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Lit Explorer Naga
2+
3+
Lit Explorer Naga is an application that allows you to authenticate with Lit Protocol using the native Lit auth methods.
4+
5+
# Env vars
6+
7+
```bash
8+
# Global Settings
9+
VITE_LOGIN_SERVICE_URL=https://login.litgateway.com
10+
VITE_LOGIN_DISCORD_CLIENT_ID=1052874239658692668
11+
12+
# Network-Specific Auth Service URLs
13+
VITE_AUTH_SERVICE_URL_NAGA_DEV=https://naga-dev-auth-service.getlit.dev
14+
VITE_AUTH_SERVICE_URL_NAGA_TEST=https://naga-test-auth-service.getlit.dev
15+
VITE_AUTH_SERVICE_URL_NAGA=https://naga-auth-service.getlit.dev
16+
```
17+
18+
## Getting started
19+
20+
```
21+
pnpm install
22+
pnpm nx run explorer:dev
23+
```
24+
25+
## Docker
26+
27+
To produce a deployable container:
28+
29+
```
30+
pnpm nx run explorer:build
31+
pnpm nx run explorer:docker-build
32+
docker run -p 4173:80 explorer
33+
```
34+
35+
The image serves the built assets via Nginx and includes SPA routing so client-side navigation works.
36+
37+
## Adding Lit Action examples
38+
39+
- Add a new file in `src/lit-action-examples/entries/` that default-exports a `LitActionExample`. The `id` must be unique.
40+
- Use `String.raw` to define multiline snippets, e.g. ``const code = String.raw\`...\`;`` and fill in `title`, optional `description`, `order`, and any default `jsParams`.
41+
- The registry auto-loads every file in that directory, so your example will appear in the Lit Action editor once you save and refresh the app.
42+
- Prefer small, focused samples that demonstrate a single concept; link to docs inside the description if extra context is needed.
43+
44+
## FAQs
45+
46+
### What "logged-in" means here
47+
48+
- You are considered "logged-in" when both a PKP and an auth context exist in state.
49+
50+
### How you become "logged-in"
51+
52+
After authenticating with a method (Google, Discord, WebAuthn, EOA, Stytch, Custom), either:
53+
54+
- You select an existing PKP in the PKP selection section
55+
- You mint a new PKP and immediately create `authContext`, then set `user`
56+
57+
### What redirect happens and when
58+
59+
The `<LitAuthProvider />` does not redirect on successful login. It simply closes the modal once user is set and isAuthenticated becomes true.
60+
61+
The dashboard is always the index route for `/`, and it conditionally renders based on auth state from context. When the user logs in, React re-renders the same component with different UI.
62+
63+
Inside `LoggedInDashboard`, it reads user from `useLitAuth()`. If there’s no user, it shows a sign-in experience and, in popup mode, auto-opens the modal.
64+
65+
# Screenshots
66+
67+
## Login Modal
68+
69+
![Login Modal](./public/screenshot-1.png)
70+
71+
## Logged in Dashboard
72+
![Logged in Dashboard](./public/screenshot-2.png)

0 commit comments

Comments
 (0)