@volr/react 0.1.107 → 0.1.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -18124,20 +18124,13 @@ var CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
|
18124
18124
|
function createGetRpcUrl(deps) {
|
|
18125
18125
|
const { client, rpcOverrides } = deps;
|
|
18126
18126
|
return async function getRpcUrl(chainId) {
|
|
18127
|
-
console.log("[getRpcUrl] Getting RPC URL for chainId:", chainId);
|
|
18128
18127
|
const overrideUrl = rpcOverrides?.[chainId.toString()];
|
|
18129
|
-
if (overrideUrl)
|
|
18130
|
-
console.log("[getRpcUrl] Using override URL");
|
|
18131
|
-
return overrideUrl;
|
|
18132
|
-
}
|
|
18128
|
+
if (overrideUrl) return overrideUrl;
|
|
18133
18129
|
const cached = networkCache.get(chainId);
|
|
18134
18130
|
if (cached && cached.rpcUrl && Date.now() - cached.timestamp < CACHE_TTL_MS) {
|
|
18135
|
-
console.log("[getRpcUrl] Using cached URL");
|
|
18136
18131
|
return cached.rpcUrl;
|
|
18137
18132
|
}
|
|
18138
|
-
console.log("[getRpcUrl] Fetching from backend API...");
|
|
18139
18133
|
const response = await client.get(`/networks/${chainId}?includeRpcUrl=true`);
|
|
18140
|
-
console.log("[getRpcUrl] Backend response received");
|
|
18141
18134
|
if (!response.rpcUrl) {
|
|
18142
18135
|
throw new Error(
|
|
18143
18136
|
`RPC URL not available for chainId ${chainId}. Please provide it in config.rpcOverrides[${chainId}]`
|
|
@@ -18149,7 +18142,6 @@ function createGetRpcUrl(deps) {
|
|
|
18149
18142
|
invokerAddress: response.invokerAddress,
|
|
18150
18143
|
timestamp: Date.now()
|
|
18151
18144
|
});
|
|
18152
|
-
console.log("[getRpcUrl] RPC URL fetched and cached");
|
|
18153
18145
|
return response.rpcUrl;
|
|
18154
18146
|
};
|
|
18155
18147
|
}
|