From af315b22550dfb1669a807ca13a15daeeab57af1 Mon Sep 17 00:00:00 2001 From: anson Date: Fri, 5 Sep 2025 16:10:04 +0100 Subject: [PATCH] docs(networks): add `.withOverrides` method to network modules --- docs.json | 6 +++ .../networks/functions/withOverrides.mdx | 40 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 sdk/sdk-reference/networks/functions/withOverrides.mdx diff --git a/docs.json b/docs.json index aff635f..b332a72 100644 --- a/docs.json +++ b/docs.json @@ -105,6 +105,12 @@ { "group": "@lit-protocol/auth@beta", "pages": ["sdk/sdk-reference/auth/functions/createAuthManager"] + }, + { + "group": "@lit-protocol/networks@beta", + "pages": [ + "sdk/sdk-reference/networks/functions/withOverrides" + ] } ] } diff --git a/sdk/sdk-reference/networks/functions/withOverrides.mdx b/sdk/sdk-reference/networks/functions/withOverrides.mdx new file mode 100644 index 0000000..23b8f31 --- /dev/null +++ b/sdk/sdk-reference/networks/functions/withOverrides.mdx @@ -0,0 +1,40 @@ +--- +title: withOverrides +--- + +# Functions + +> **withOverrides**(`overrides`) + +Create a network module instance with runtime overrides (primarily for RPC URL). Use this to direct SDK operations to your own private RPC endpoint. + +## Parameters + + + Optional overrides. Provide `rpcUrl` to replace the chain RPC used by the module instance. + ```ts + { rpcUrl: "https://my-private-rpc.example.com" } + ``` + + +## Returns + + + A new module instance with overrides applied. Pass this into `createLitClient( + {network})`. + + +## Example + +### Override RPC at runtime + +```ts +import { createLitClient } from "@lit-protocol/lit-client"; +import { nagaDev } from "@lit-protocol/networks"; + +const network = nagaDev.withOverrides({ + rpcUrl: "https://my-private-rpc.example.com", +}); + +const litClient = await createLitClient({ network }); +```