Skip to content

Commit 49910c6

Browse files
committed
Merge branch 'feature/jss-132-naga-test-allow-naga-local-configuration' of https://github.com/LIT-Protocol/js-sdk into feature/jss-132-naga-test-allow-naga-local-configuration
2 parents 0912a63 + 7818d10 commit 49910c6

Some content is hidden

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

57 files changed

+1600
-61
lines changed

docs/changelog.mdx

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ rss: true
66

77
| Package | Latest version | Summary |
88
| ------- | -------------- | ------- |
9-
| [@lit-protocol/lit-client](#lit-client) | [8.1.0](https://www.npmjs.com/package/%40lit-protocol%2Flit-client) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
9+
| [@lit-protocol/lit-client](#lit-client) | [8.2.0](https://www.npmjs.com/package/%40lit-protocol%2Flit-client) | LitClient now offers `getIpfsId` via `@lit-protocol/lit-client/ipfs`, letting apps compute CIDv0 hashes (e.g., `await getIpfsId('hello')`) while keeping bundles lean. |
1010
| [@lit-protocol/auth](#auth) | [8.1.0](https://www.npmjs.com/package/%40lit-protocol%2Fauth) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
11-
| [@lit-protocol/networks](#networks) | [8.1.0](https://www.npmjs.com/package/%40lit-protocol%2Fnetworks) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
12-
| [@lit-protocol/auth-services](#auth-services) | [2.0.3](https://www.npmjs.com/package/%40lit-protocol%2Fauth-services) | Updated dependencies |
11+
| [@lit-protocol/networks](#networks) | [8.2.0](https://www.npmjs.com/package/%40lit-protocol%2Fnetworks) | introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime |
12+
| [@lit-protocol/auth-services](#auth-services) | [2.0.4](https://www.npmjs.com/package/%40lit-protocol%2Fauth-services) | Updated dependencies |
1313
| [@lit-protocol/access-control-conditions](#access-control-conditions) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Faccess-control-conditions) | - |
1414
| [@lit-protocol/access-control-conditions-schemas](#access-control-conditions-schemas) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Faccess-control-conditions-schemas) | - |
15-
| [@lit-protocol/artillery](#artillery) | [0.0.4](https://www.npmjs.com/package/%40lit-protocol%2Fartillery) | @lit-protocol/e2e@2.0.0 |
15+
| [@lit-protocol/artillery](#artillery) | [0.0.5](https://www.npmjs.com/package/%40lit-protocol%2Fartillery) | Updated dependencies |
1616
| [@lit-protocol/auth-helpers](#auth-helpers) | [8.1.0](https://www.npmjs.com/package/%40lit-protocol%2Fauth-helpers) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
17-
| [@lit-protocol/constants](#constants) | [8.0.3](https://www.npmjs.com/package/%40lit-protocol%2Fconstants) | Updated dependencies |
18-
| [@lit-protocol/contracts](#contracts) | [0.6.0](https://www.npmjs.com/package/%40lit-protocol%2Fcontracts) | Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually. |
17+
| [@lit-protocol/constants](#constants) | [8.0.4](https://www.npmjs.com/package/%40lit-protocol%2Fconstants) | Updated dependencies |
18+
| [@lit-protocol/contracts](#contracts) | [0.7.0](https://www.npmjs.com/package/%40lit-protocol%2Fcontracts) | introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime |
1919
| [@lit-protocol/crypto](#crypto) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Fcrypto) | - |
20-
| [@lit-protocol/e2e](#e2e) | [2.0.0](https://www.npmjs.com/package/%40lit-protocol%2Fe2e) | Updated dependencies |
20+
| [@lit-protocol/e2e](#e2e) | [3.0.0](https://www.npmjs.com/package/%40lit-protocol%2Fe2e) | introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime |
2121
| [@lit-protocol/logger](#logger) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Flogger) | - |
2222
| [@lit-protocol/schemas](#schemas) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Fschemas) | - |
2323
| [@lit-protocol/types](#types) | [8.0.2](https://www.npmjs.com/package/%40lit-protocol%2Ftypes) | - |
@@ -27,15 +27,20 @@ rss: true
2727

2828
<Update
2929
label="lit-client"
30-
description="v8.1.0"
30+
description="v8.2.0"
3131
tags={["Minor Changes"]}
32-
rss={{ title: "lit-client", description: "Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually." }}
32+
rss={{ title: "lit-client", description: "LitClient now offers `getIpfsId` via `@lit-protocol/lit-client/ipfs`, letting apps compute CIDv0 hashes (e.g., `await getIpfsId('hello')`) while keeping bundles lean." }}
3333
id="lit-client"
3434
>
3535

3636
## Minor Changes
3737

38-
- Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually.
38+
- LitClient now offers `getIpfsId` via `@lit-protocol/lit-client/ipfs`, letting apps compute CIDv0 hashes (e.g., `await getIpfsId('hello')`) while keeping bundles lean.
39+
- ```ts
40+
- import { getIpfsId } from '@lit-protocol/lit-client/ipfs';
41+
- const cid = await getIpfsId('hello');
42+
- ```
43+
- introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime
3944
</Update>
4045
4146
<Update
@@ -57,25 +62,25 @@ rss: true
5762
5863
<Update
5964
label="networks"
60-
description="v8.1.0"
65+
description="v8.2.0"
6166
tags={["Minor Changes", "Patch Changes"]}
62-
rss={{ title: "networks", description: "Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually." }}
67+
rss={{ title: "networks", description: "introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime" }}
6368
id="networks"
6469
>
6570
6671
## Minor Changes
6772
68-
- Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually.
73+
- introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime
6974
7075
## Patch Changes
7176
7277
- Updated dependencies
73-
- @lit-protocol/contracts@0.6.0
78+
- @lit-protocol/contracts@0.7.0
7479
</Update>
7580
7681
<Update
7782
label="auth-services"
78-
description="v2.0.3"
83+
description="v2.0.4"
7984
tags={["Patch Changes"]}
8085
rss={{ title: "auth-services", description: "Updated dependencies" }}
8186
id="auth-services"
@@ -84,7 +89,7 @@ rss: true
8489
## Patch Changes
8590
8691
- Updated dependencies
87-
- @lit-protocol/contracts@0.6.0
92+
- @lit-protocol/contracts@0.7.0
8893
</Update>
8994
9095
<Update
@@ -111,15 +116,16 @@ rss: true
111116
112117
<Update
113118
label="artillery"
114-
description="v0.0.4"
119+
description="v0.0.5"
115120
tags={["Patch Changes"]}
116-
rss={{ title: "artillery", description: "@lit-protocol/[email protected]" }}
121+
rss={{ title: "artillery", description: "Updated dependencies" }}
117122
id="artillery"
118123
>
119124
120125
## Patch Changes
121126
122-
- @lit-protocol/e2e@2.0.0
127+
- Updated dependencies
128+
- @lit-protocol/[email protected]
123129
</Update>
124130
125131
<Update
@@ -137,7 +143,7 @@ rss: true
137143
138144
<Update
139145
label="constants"
140-
description="v8.0.3"
146+
description="v8.0.4"
141147
tags={["Patch Changes"]}
142148
rss={{ title: "constants", description: "Updated dependencies" }}
143149
id="constants"
@@ -146,20 +152,20 @@ rss: true
146152
## Patch Changes
147153
148154
- Updated dependencies
149-
- @lit-protocol/contracts@0.6.0
155+
- @lit-protocol/contracts@0.7.0
150156
</Update>
151157
152158
<Update
153159
label="contracts"
154-
description="v0.6.0"
160+
description="v0.7.0"
155161
tags={["Minor Changes"]}
156-
rss={{ title: "contracts", description: "Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually." }}
162+
rss={{ title: "contracts", description: "introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime" }}
157163
id="contracts"
158164
>
159165
160166
## Minor Changes
161167
162-
- Converted viem from a bundled dependency to a peer dependency to avoid build errors from version conflicts (e.g., missing exports like sendCallsSync) and improve compatibility by reducing dependency lock-in. Consumers must now install compatible versions manually.
168+
- introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime
163169
</Update>
164170
165171
<Update
@@ -175,19 +181,22 @@ rss: true
175181
176182
<Update
177183
label="e2e"
178-
description="v2.0.0"
179-
tags={["Patch Changes"]}
180-
rss={{ title: "e2e", description: "Updated dependencies" }}
184+
description="v3.0.0"
185+
tags={["Minor Changes", "Patch Changes"]}
186+
rss={{ title: "e2e", description: "introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime" }}
181187
id="e2e"
182188
>
183189
190+
## Minor Changes
191+
192+
- introduce `litClient.utils.getDerivedKeyId` - a little helper to resolve the Lit Action public key outside of the Action runtime
193+
184194
## Patch Changes
185195
186196
- Updated dependencies
187197
- Updated dependencies
188-
- @lit-protocol/auth@8.1.0
189-
- @lit-protocol/lit-client@8.1.0
190-
- @lit-protocol/networks@8.1.0
198+
- @lit-protocol/[email protected]
199+
- @lit-protocol/[email protected]
191200
</Update>
192201
193202
<Update

docs/docs.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@
9191
]
9292
},
9393
{
94-
"group": "Access Control Conditions",
94+
"group": "Utilities",
9595
"pages": [
96-
"sdk/sdk-reference/access-control-conditions/functions/createAccBuilder"
96+
"sdk/sdk-reference/access-control-conditions/functions/createAccBuilder",
97+
"sdk/sdk-reference/lit-client/functions/getIpfsId"
9798
]
9899
},
99100
{
@@ -156,7 +157,9 @@
156157
"group": "$LITKEY Token",
157158
"pages": [
158159
"governance/litkey/overview",
159-
"governance/litkey/initial-allocation-and-distribution"
160+
"governance/litkey/initial-allocation-and-distribution",
161+
"governance/litkey/lit-chain",
162+
"governance/litkey/bridging-and-addresses"
160163
]
161164
},
162165
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "Bridging and Contract Addresses"
3+
---
4+
5+
Use the [Hyperlane Nexus Bridge](https://nexus.hyperlane.xyz/) for fast bridging of LITKEY to all the networks listed in the table below.
6+
7+
8+
## Official Contract Addresses
9+
10+
| Contract | Network | Address | Notes |
11+
|----------|--------------|--------------------------------------------|---------------------------------------------------------------------|
12+
| LITKEY | Ethereum | [0x4D4eb0E8B160f6EbF63cC6d36060ffec09301B42](https://etherscan.io/address/0x4D4eb0E8B160f6EbF63cC6d36060ffec09301B42) | Master token contract |
13+
| LITKEY | Base | [0xF732A566121Fa6362E9E0FBdd6D66E5c8C925E49](https://basescan.org/address/0xF732A566121Fa6362E9E0FBdd6D66E5c8C925E49) | Bridged to Base using canonical bridge, Hyperlane supported |
14+
| LITKEY | Arbitrum One | [0xC7603786470F04D33E35f9E9B56bD0Ca8803fB95](https://arbiscan.io/address/0xC7603786470F04D33E35f9E9B56bD0Ca8803fB95) | Bridged to Arbitrum One using canonical bridge, Hyperlane supported |
15+
| LITKEY | Optimism | [0x0633E91f64C22d4FEa53dbE6e77B7BA4093177B8](https://optimistic.etherscan.io/address/0x0633E91f64C22d4FEa53dbE6e77B7BA4093177B8) | Bridged to Optimism using canonical bridge, Hyperlane supported |
16+
| LITKEY | Polygon | [0x5bEd1A06b26853360D9D1a6a27eaCE1b85206867](https://polygonscan.com/address/0x5bEd1A06b26853360D9D1a6a27eaCE1b85206867) | Hyperlane synthetic token |
17+
| LITKEY | BSC | [0x0bBeA6812fb3fcBcA126eDb558e551B3f1702026](https://bscscan.com/address/0x0bBeA6812fb3fcBcA126eDb558e551B3f1702026) | Hyperlane synthetic token |
18+
| LITKEY | Avalanche | [0xa38Fce8bf2fA38a97749332724b9db3FF44F006D](https://snowtrace.io/address/0xa38Fce8bf2fA38a97749332724b9db3FF44F006D) | Hyperlane synthetic token |
19+
| LITKEY | Linea | [0x94930Cbfed2483b69DfBed9d96a9CdD7c27D1393](https://explorer.linea.build/address/0x94930Cbfed2483b69DfBed9d96a9CdD7c27D1393) | Hyperlane synthetic token |
20+
| LITKEY | Lit Chain | N/A | Native gas token for Lit Chain |
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "Lit Chain"
3+
---
4+
import { AddLitChainButton } from "/snippets/AddLitChainButton.jsx";
5+
6+
7+
Lit Chain is an Arbitrum Orbit-based L3 rollup that acts as the shared state layer for Lit Protocol.
8+
9+
## Connecting to Lit Chain
10+
11+
<AddLitChainButton />
12+
13+
To connect to Lit Chain, you can click the button above or manually add the network parameters below. For production use cases, you should get a free private RPC URL from Conduit by clicking "Get an API Key" on the [Lit Chain hub page](https://hub.conduit.xyz/lit-chain-1rw3jdu82h).
14+
15+
<Note>
16+
The below and additional chain parameters are available [here](https://hub.conduit.xyz/lit-chain-1rw3jdu82h).
17+
</Note>
18+
19+
| Parameter Name | Value |
20+
|--------------------|----------------------------------------------------|
21+
| Chain ID | 175200 |
22+
| Name | Lit Chain |
23+
| RPC URL | https://lit-chain-rpc.litprotocol.com |
24+
| Block Explorer URL | https://lit-chain-explorer.litprotocol.com |
25+
| Currency Symbol | LITKEY |
26+
| Currency Decimals | 18 |

docs/guides/lit-action-sign-as-action.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,21 @@ const { keccak256, arrayify } = ethers.utils;
6969
```
7070

7171
This approach keeps the derivation entirely within the Lit Action context. Because the public key depends only on the Action CID and signing scheme, you can rely on `Lit.Actions.getActionPublicKey` for a deterministic identity without needing to execute the Action externally first.
72+
73+
## Derive the Same Public Key from Client Code
74+
75+
If you prefer to resolve the Lit Action public key outside of the Action runtime - e.g., inside tests or other tooling—the SDK now exposes a helper that calls the on-chain PubkeyRouter contract.
76+
77+
```ts
78+
import { createLitClient } from "@lit-protocol/lit-client";
79+
import { nagaDev } from "@lit-protocol/networks";
80+
import { keccak256, stringToBytes } from "viem";
81+
82+
const litClient = await createLitClient({ network: nagaDev });
83+
const derivedKeyId = keccak256(stringToBytes(`lit_action_${actionIpfsCid}`));
84+
const actionPublicKey = await litClient.utils.getDerivedKeyId(derivedKeyId);
85+
86+
console.log("Derived Lit Action pubkey:", actionPublicKey);
87+
```
88+
89+
Under the hood, `getDerivedKeyId` routes through `PubkeyRouter.getDerivedPubkey`, passing the staking contract address and the default Naga key set (`naga-keyset1`) (will be dynamic in the future). This mirrors the same key derivation the nodes perform, letting you confirm identities or signatures without re-running the Lit Action.

docs/sdk/sdk-reference/lit-client/functions/createLitClient.mdx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,33 @@ Create a Viem-compatible account backed by a PKP.
10461046
</Expandable>
10471047
</ResponseField>
10481048

1049+
### utils.getDerivedKeyId
1050+
1051+
Resolve the uncompressed PKP public key for a given derived key identifier.
1052+
1053+
#### Parameters
1054+
1055+
<ResponseField name="derivedKeyId" type="string" required>
1056+
0x-prefixed bytes32 identifier (for example, <code>keccak256(stringToBytes(`lit_action_${ipfsCid}`))</code>).
1057+
</ResponseField>
1058+
1059+
#### Returns
1060+
1061+
<ResponseField name="result" type="Promise<string>">
1062+
0x-prefixed uncompressed public key as returned by the PubkeyRouter contract.
1063+
</ResponseField>
1064+
1065+
#### Example
1066+
1067+
```ts
1068+
import { keccak256, stringToBytes } from "viem";
1069+
1070+
const derivedKeyId = keccak256(stringToBytes(`lit_action_${ipfsCid}`));
1071+
const derivedPubkey = await litClient.utils.getDerivedKeyId(derivedKeyId);
1072+
```
1073+
1074+
> Note: this helper currently calls `PubkeyRouter.getDerivedPubkey` with the default Naga key set (`naga-keyset1`). See the [Derive Lit Action Public Keys guide](../../../../guides/lit-action-sign-as-action) for an end-to-end workflow.
1075+
10491076
### getChainConfig
10501077

10511078
Returns the chain configuration for the current network.
@@ -1074,4 +1101,4 @@ Stop background state updates and release resources.
10741101
none
10751102

10761103
#### Returns
1077-
void
1104+
void
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: getIpfsId
3+
description: Generate CIDv0 hashes with the Lit Client IPFS helper
4+
---
5+
6+
## Overview
7+
8+
`getIpfsId` is an optional helper exported via `@lit-protocol/lit-client/ipfs`. It produces CIDv0 IPFS identifiers identical to the Lit SDK v7 utility while remaining fully tree-shakeable from the main client bundle.
9+
10+
## Usage
11+
12+
```ts
13+
import { getIpfsId } from '@lit-protocol/lit-client/ipfs';
14+
15+
const cid = await getIpfsId('console.log("hello lit")');
16+
// cid === 'Qm...'
17+
18+
const bytes = new TextEncoder().encode('console.log("hello lit")');
19+
const sameCid = await getIpfsId(bytes);
20+
// sameCid === cid
21+
```
22+
23+
## Parameters
24+
25+
| Name | Type | Description |
26+
| ---- | ---- | ----------- |
27+
| input | `string \| Uint8Array \| ArrayBuffer \| ArrayBufferView` | Source content to hash. Strings are UTF-8 encoded automatically; buffers and typed views are accepted directly. |
28+
29+
## Returns
30+
31+
```
32+
// A CIDv0 string beginning with Qm
33+
Promise<Qm${string}>
34+
```
35+
36+
## Notes
37+
38+
- The helper delegates to the same hashing routine used in v7 (`typestub-ipfs-only-hash`) and can be imported without pulling the entire Lit Client into your bundle.
39+
- Binary payloads do not need to be stringified first—pass any `Uint8Array`, `ArrayBuffer`, or typed view directly and the helper will normalize it before hashing.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
3+
export const AddLitChainButton = () => {
4+
const addNetwork = () => {
5+
const params = [
6+
{
7+
chainId: '0x2AC60',
8+
chainName: 'Lit Chain',
9+
nativeCurrency: {
10+
name: 'Lit Protocol',
11+
symbol: 'LITKEY',
12+
decimals: 18,
13+
},
14+
rpcUrls: ['https://lit-chain-rpc.litprotocol.com'],
15+
blockExplorerUrls: [
16+
'https://lit-chain-explorer.litprotocol.com',
17+
],
18+
},
19+
];
20+
21+
window.ethereum
22+
.request({ method: 'wallet_addEthereumChain', params })
23+
.then(() => console.log('Success'))
24+
.catch(error => console.log('Error', error.message));
25+
};
26+
27+
return (
28+
<button
29+
onClick={addNetwork}
30+
className="px-5 py-2 rounded-md bg-gradient-to-r from-[#F97316] to-[#EA580C] text-white font-semibold shadow-md hover:from-[#fb923c] hover:to-[#ea580c] focus:outline-none focus:ring-2 focus:ring-[#F97316] transition-all"
31+
>
32+
Add Lit Chain to Metamask
33+
</button>
34+
);
35+
}

packages/artillery/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @lit-protocol/artillery
22

3+
## 0.0.5
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [4d339d1]
8+
- @lit-protocol/e2e@3.0.0
9+
310
## 0.0.4
411

512
### Patch Changes

0 commit comments

Comments
 (0)