We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 102b1e3 commit c812d08Copy full SHA for c812d08
1 file changed
modules/statics/src/networks.ts
@@ -2798,3 +2798,14 @@ const networkByName: Map<string, BaseNetwork> = new Map(
2798
export function getNetworkByName(name: string): BaseNetwork | undefined {
2799
return networkByName.get(name);
2800
}
2801
+
2802
+/**
2803
+ * Dynamically register a new network in the lookup map.
2804
+ * Throws if a network with the same name is already registered.
2805
+ */
2806
+export function registerNetwork(network: BaseNetwork): void {
2807
+ if (networkByName.has(network.name)) {
2808
+ throw new Error(`Network '${network.name}' is already registered`);
2809
+ }
2810
+ networkByName.set(network.name, network);
2811
+}
0 commit comments