Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Conversation

@Ansonhkg
Copy link
Contributor

@Ansonhkg Ansonhkg commented Sep 5, 2025

No description provided.

@linear
Copy link

linear bot commented Sep 5, 2025

JSS-81 [Naga] [Bug] Overwrite RPC URL

WHAT

Previously, we added support for specifying a private RPC URL in the artillery test, which was great as it resolved the artillery issue. However, the SDK itself should also allow overwriting the RPC URL. This is important for servers running our SDK long term, as they will eventually hit the RPC URL rate limit.

I was thinking we could do something like this initially:

const litClient = await createLitClient({
  networkModule: nagaDev,
  rpcUrl: '<private_rpc_url'
});

but this is not a good solution, because the nagaDev module is a singleton that has already captured the hardcoded RPC when it was instantiated. Overwriting methods on the shared networkModule inside createLitClient is risky because it might have global side effects.

Solution

Add a .withOverrides method on the network module.

eg

import { nagaDev } from '@lit-protocol/networks';

const customNagaDev = nagaDev.withOverrides({ rpcUrl: '<private_rpc_url' });
const litClient = await createLitClient({ network: customNagaDev });

@Ansonhkg Ansonhkg merged commit 320176a into main Sep 23, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants