@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.js
CHANGED
|
@@ -18100,20 +18100,13 @@ var CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
|
18100
18100
|
function createGetRpcUrl(deps) {
|
|
18101
18101
|
const { client, rpcOverrides } = deps;
|
|
18102
18102
|
return async function getRpcUrl(chainId) {
|
|
18103
|
-
console.log("[getRpcUrl] Getting RPC URL for chainId:", chainId);
|
|
18104
18103
|
const overrideUrl = rpcOverrides?.[chainId.toString()];
|
|
18105
|
-
if (overrideUrl)
|
|
18106
|
-
console.log("[getRpcUrl] Using override URL");
|
|
18107
|
-
return overrideUrl;
|
|
18108
|
-
}
|
|
18104
|
+
if (overrideUrl) return overrideUrl;
|
|
18109
18105
|
const cached = networkCache.get(chainId);
|
|
18110
18106
|
if (cached && cached.rpcUrl && Date.now() - cached.timestamp < CACHE_TTL_MS) {
|
|
18111
|
-
console.log("[getRpcUrl] Using cached URL");
|
|
18112
18107
|
return cached.rpcUrl;
|
|
18113
18108
|
}
|
|
18114
|
-
console.log("[getRpcUrl] Fetching from backend API...");
|
|
18115
18109
|
const response = await client.get(`/networks/${chainId}?includeRpcUrl=true`);
|
|
18116
|
-
console.log("[getRpcUrl] Backend response received");
|
|
18117
18110
|
if (!response.rpcUrl) {
|
|
18118
18111
|
throw new Error(
|
|
18119
18112
|
`RPC URL not available for chainId ${chainId}. Please provide it in config.rpcOverrides[${chainId}]`
|
|
@@ -18125,7 +18118,6 @@ function createGetRpcUrl(deps) {
|
|
|
18125
18118
|
invokerAddress: response.invokerAddress,
|
|
18126
18119
|
timestamp: Date.now()
|
|
18127
18120
|
});
|
|
18128
|
-
console.log("[getRpcUrl] RPC URL fetched and cached");
|
|
18129
18121
|
return response.rpcUrl;
|
|
18130
18122
|
};
|
|
18131
18123
|
}
|