@@ -109,13 +109,15 @@ Before you begin, ensure you have the following installed:
109109## Development Tools
110110
111111Recommended for better development experience:
112+
112113- [ NX Console] ( https://nx.dev/core-features/integrate-with-editors ) - Visual Studio Code extension for NX workspace management
113114
114115# Quick Start
115116
116117To start developing with this repository:
117118
1181191 . Install dependencies:
120+
119121```
120122yarn
121123```
@@ -150,8 +152,6 @@ yarn test:local
150152
151153` nx generate @nx/js:library `
152154
153-
154-
155155## Building
156156
157157``` sh
@@ -205,9 +205,11 @@ For changes to WebAssembly components in `packages/wasm`, refer to the [WebAssem
205205## Publishing New Versions
206206
207207Prerequisites:
208+
208209- Node.js v18.0.0 or later
209210
210211Publishing steps:
212+
2112131 . Update dependencies: ` yarn install `
2122142 . Increment version: ` yarn bump `
2132153 . Build packages: ` yarn build `
@@ -222,13 +224,15 @@ Publishing steps:
222224
223225### Available Test Commands
224226
225- | Command | Description |
226- | ---------| -------------|
227- | ` yarn test:unit ` | Run unit tests for all packages |
227+ | Command | Description |
228+ | ----------------- | ------------------------------------------------------ |
229+ | ` yarn test:unit ` | Run unit tests for all packages |
228230| ` yarn test:local ` | Launch E2E tests with Cypress and serve React test app |
229231
230232### Running Tests
233+
2312341 . Unit Tests:
235+
232236 ``` sh
233237 yarn test:unit
234238 ```
@@ -245,9 +249,11 @@ Publishing steps:
245249## Local Development with Lit Node
246250
247251### Setup Local Environment
252+
2482531 . Deploy Lit Node Contracts (addresses will be read from ` ../lit-assets/blockchain/contracts/deployed-lit-node-contracts-temp.json ` )
249254
2502552 . Configure environment variables:
256+
251257``` sh
252258# Enable local node development
253259export LIT_JS_SDK_LOCAL_NODE_DEV=" true"
@@ -257,6 +263,7 @@ export LIT_JS_SDK_FUNDED_WALLET_PRIVATE_KEY="your-funded-private-key"
257263```
258264
2592653 . Update and build contracts:
266+
260267``` sh
261268# Fetch and generate contract updates
262269yarn update:contracts-sdk --fetch
@@ -267,22 +274,25 @@ yarn build:packages
267274```
268275
2692764 . Start local development server:
277+
270278``` sh
271279yarn nx run nodejs:serve
272280```
273281
274282## Environment Variables
275283
276- | Variable | Description | Usage |
277- | ----------| -------------| --------|
278- | ` LIT_JS_SDK_GITHUB_ACCESS_TOKEN ` | GitHub access token | Required for accessing contract ABIs from private repository |
279- | ` LIT_JS_SDK_LOCAL_NODE_DEV ` | Local node development flag | Set to ` true ` to use a local Lit node |
280- | ` LIT_JS_SDK_FUNDED_WALLET_PRIVATE_KEY ` | Funded wallet private key | Required for Chronicle Testnet transactions |
284+ | Variable | Description | Usage |
285+ | -------------------------------------- | --------------------------- | ------------------------------------------------------------ |
286+ | ` LIT_JS_SDK_GITHUB_ACCESS_TOKEN ` | GitHub access token | Required for accessing contract ABIs from private repository |
287+ | ` LIT_JS_SDK_LOCAL_NODE_DEV ` | Local node development flag | Set to ` true ` to use a local Lit node |
288+ | ` LIT_JS_SDK_FUNDED_WALLET_PRIVATE_KEY ` | Funded wallet private key | Required for Chronicle Testnet transactions |
281289
282290# Error Handling Guide
283291
284292## Overview
293+
285294The SDK implements a robust error handling system using [ @openagenda/verror ] ( https://github.com/OpenAgenda/verror ) . This system provides:
295+
286296- Detailed error information with cause tracking
287297- Error composition and chaining
288298- Additional context through metadata
@@ -291,6 +301,7 @@ The SDK implements a robust error handling system using [@openagenda/verror](htt
291301## Using Error Handling
292302
293303### Basic Example
304+
294305``` ts
295306import { VError } from ' @openagenda/verror' ;
296307import { LitNodeClientBadConfigError } from ' @lit-protocol/constants' ;
@@ -310,10 +321,10 @@ try {
310321 );
311322} catch (e ) {
312323 // Access error details
313- console .log (e .name ); // LitNodeClientBadConfigError
314- console .log (e .message ); // some useful message: some native error
315- console .log (e .info ); // { foo: 'bar' }
316- console .log (e .baz ); // qux
324+ console .log (e .name ); // LitNodeClientBadConfigError
325+ console .log (e .message ); // some useful message: some native error
326+ console .log (e .info ); // { foo: 'bar' }
327+ console .log (e .baz ); // qux
317328
318329 // Additional error information
319330 // - VError.cause(e): Original error (someNativeError)
@@ -332,11 +343,18 @@ To add new error types:
3323433 . Export the new error class
3333444 . Import and use in your code with relevant context:
334345 ``` ts
335- throw new YourCustomError ({
336- cause: originalError ,
337- info: { /* context */ },
338- meta: { /* metadata */ }
339- }, " Error message" );
346+ throw new YourCustomError (
347+ {
348+ cause: originalError ,
349+ info: {
350+ /* context */
351+ },
352+ meta: {
353+ /* metadata */
354+ },
355+ },
356+ ' Error message'
357+ );
340358 ```
341359
342360# Dockerfile
@@ -345,8 +363,6 @@ To add new error types:
345363
346364## Other Commands
347365
348-
349-
350366# Core Systems and Services
351367
352368The Lit Protocol SDK provides the following core systems:
@@ -374,10 +390,12 @@ Key components available across packages:
374390## Common Issues and Solutions
375391
376392### React Source Map Error
393+
377394** Problem:** "Failed to parse source map from" error in React
378395
379- ** Solution:**
396+ ** Solution:**
380397Disable source map generation in your React ` package.json ` :
398+
381399``` json
382400{
383401 "scripts" : {
@@ -390,10 +408,12 @@ Disable source map generation in your React `package.json`:
390408```
391409
392410### Crypto API Error
411+
393412** Problem:** "Reference Error: crypto is not defined"
394413
395- ** Solution:**
414+ ** Solution:**
396415Add the following polyfill for environments without native crypto:
416+
397417``` js
398418import crypto , { createHash } from ' crypto' ;
399419
@@ -402,7 +422,7 @@ Object.defineProperty(globalThis, 'crypto', {
402422 value: {
403423 // Implement getRandomValues
404424 getRandomValues : (arr : any ) => crypto .randomBytes (arr .length ),
405-
425+
406426 // Implement subtle crypto
407427 subtle: {
408428 digest : (algorithm : string , data : Uint8Array ) => {
0 commit comments