Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions constants/extraRpcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3106,11 +3106,6 @@ export const extraRpcs = {
tracking: "none",
trackingDetails: privacyStatement.omnia,
},
{
url: "https://endpoints.omniatech.io/v1/merlin/mainnet/public",
tracking: "none",
trackingDetails: privacyStatement.omnia,
},
{
url: "https://merlin.drpc.org",
tracking: "none",
Expand Down Expand Up @@ -3696,16 +3691,6 @@ export const extraRpcs = {
tracking: "none",
trackingDetails: privacyStatement.radiumblock,
},
{
url: "https://moonbeam.drpc.org",
tracking: "none",
trackingDetails: privacyStatement.drpc,
},
{
url: "wss://moonbeam.drpc.org",
tracking: "none",
trackingDetails: privacyStatement.drpc,
},
{
url: "https://rpc.poolz.finance/moonbeam",
tracking: "limited",
Expand Down Expand Up @@ -4472,7 +4457,6 @@ export const extraRpcs = {
"https://rpc.xdc.org",
"https://rpc.xdc.network",
"https://earpc.xinfin.network/",
"https://erpc.xinfin.network/",
"wss://ews.xinfin.network/ws",
{
url: "https://rpc.ankr.com/xdc",
Expand All @@ -4497,7 +4481,6 @@ export const extraRpcs = {
"https://apothem.xdcrpc.com",
"https://rpc.ankr.com/xdc_testnet",
"https://earpc.apothem.network/",
"https://erpc.apothem.network/",
"wss://eaws.apothem.network/",
{
url: "https://xdc-testnet.drpc.org",
Expand Down Expand Up @@ -5561,7 +5544,6 @@ export const extraRpcs = {
"https://rpc.dogechain.dog",
"https://rpc-us.dogechain.dog",
"https://rpc-sg.dogechain.dog",
"https://rpc.dogechain.dog",
"https://rpc01-sg.dogechain.dog",
"https://rpc02-sg.dogechain.dog",
"https://rpc03-sg.dogechain.dog",
Expand Down Expand Up @@ -6120,7 +6102,6 @@ export const extraRpcs = {
"https://rpc-evm.testnet.evmos.dragonstake.io",
"https://evmos-testnet-rpc.stake-town.com",
"https://evmos-testnet-jsonrpc.stake-town.com",
"https://api.evmos-test.theamsolutions.info",
"https://jsonrpc-t.evmos.nodestake.top",
"https://evmos-testnet-jsonrpc.autostake.com",
"https://evmos-testnet-jsonrpc.alkadeta.com",
Expand Down Expand Up @@ -6635,11 +6616,6 @@ export const extraRpcs = {
tracking: "limited",
trackingDetails: privacyStatement.dwellir,
},
{
url: "https://base.drpc.org",
tracking: "none",
trackingDetails: privacyStatement.drpc,
},
{
url: "wss://base.drpc.org",
tracking: "none",
Expand Down Expand Up @@ -6914,11 +6890,6 @@ export const extraRpcs = {
tracking: "limited",
trackingDetails: privacyStatement.therpc,
},
{
url: "https://scroll.api.pocket.network",
tracking: "none",
trackingDetails: privacyStatement.pokt,
},
{
url: "https://api-scroll-mainnet.n.dwellir.com/2ccf18bf-2916-4198-8856-42172854353c",
tracking: "limited",
Expand Down Expand Up @@ -7265,7 +7236,6 @@ export const extraRpcs = {
trackingDetails: privacyStatement.routemesh,
},
"https://palm-testnet.infura.io/v3/${INFURA_API_KEY}",
"https://palm-testnet.public.blastapi.io",
{
url: "https://palm-testnet.public.blastapi.io",
tracking: "limited",
Expand Down Expand Up @@ -7558,7 +7528,6 @@ export const extraRpcs = {
},
50001: {
rpcs: [
"https://rpc.oracle.liveplex.io",
{
url: "https://rpc.oracle.liveplex.io",
tracking: "yes",
Expand Down Expand Up @@ -7818,11 +7787,6 @@ export const extraRpcs = {
tracking: "none",
trackingDetails: privacyStatement.omnia,
},
{
url: "https://rpc.ankr.com/scroll_sepolia_testnet",
tracking: "none",
trackingDetails: privacyStatement.ankr,
},
{
url: "https://scroll-sepolia.therpc.io",
tracking: "limited",
Expand Down Expand Up @@ -7895,7 +7859,6 @@ export const extraRpcs = {
tracking: "limited",
trackingDetails: privacyStatement.routemesh,
},
"https://rpc.jfinchain.com",
{
url: "https://rpc.jfinchain.com",
tracking: "limited",
Expand Down Expand Up @@ -8871,7 +8834,6 @@ export const extraRpcs = {
tracking: "limited",
trackingDetails: privacyStatement.routemesh,
},
"https://rpc-v2.powerloom.network",
{
url: "https://rpc-v2.powerloom.network",
tracking: "yes",
Expand Down Expand Up @@ -9048,8 +9010,6 @@ export const extraRpcs = {
trackingDetails: privacyStatement.routemesh,
},
"https://rpc.immutable.com",
"https://immutable-zkevm.drpc.org",
"wss://immutable-zkevm.drpc.org",
{
url: "https://immutable-zkevm.drpc.org",
tracking: "none",
Expand Down Expand Up @@ -9257,7 +9217,6 @@ export const extraRpcs = {
},
20230825: {
rpcs: [
"https://testnet.vcity.app",
{
url: "https://testnet.vcity.app",
tracking: "none",
Expand Down Expand Up @@ -9393,7 +9352,6 @@ export const extraRpcs = {
16600: {
rpcs: [
"https://evmrpc-testnet.0g.ai",
"https://0g-json-rpc-public.originstake.com",
"https://og-testnet-jsonrpc.blockhub.id",
{
url: "https://0g-json-rpc-public.originstake.com",
Expand Down Expand Up @@ -10364,11 +10322,6 @@ export const extraRpcs = {
tracking: "none",
trackingDetails: privacyStatement.ankr,
},
{
url: "https://rpc.ankr.com/monad_testnet",
tracking: "none",
trackingDetails: privacyStatement.ankr,
},
{
url: "https://monad-testnet.gateway.tatum.io/",
tracking: "yes",
Expand All @@ -10380,11 +10333,6 @@ export const extraRpcs = {
trackingDetails: privacyStatement.onfinality,
},
"https://rpc-testnet.monadinfra.com",
{
url: "https://monad-testnet.api.onfinality.io/public",
tracking: "limited",
trackingDetails: privacyStatement.onfinality,
},
{
url: "https://monad-testnet-rpc.huginn.tech",
tracking: "none",
Expand Down Expand Up @@ -10723,11 +10671,6 @@ export const extraRpcs = {
tracking: "none",
trackingDetails: privacyStatement.drpc,
},
{
url: "https://lens.drpc.org",
tracking: "none",
trackingDetails: privacyStatement.drpc,
},
{
url: "wss://lens.drpc.org",
tracking: "none",
Expand Down
53 changes: 53 additions & 0 deletions tests/check-duplicate-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,53 @@ function checkChainIdsDuplicates() {
console.log(`✓ No duplicate keys found in chainIds (checked ${chainIds.size} keys)`);
}

/**
* Check for the same rpc url listed more than once inside one chain's rpcs array.
* Arrays keep every entry, so these are invisible to the duplicate-key checks above,
* and unlike keys they survive an import intact, so this reads the exported object
* instead of parsing lines (rpcs written on one line would otherwise be skipped).
*/
function checkDuplicateRpcUrls() {
console.log("Checking extraRpcs for duplicate rpc urls within a chain...");

const filePath = path.join(__dirname, "../constants/extraRpcs.js");
const script = [
`import { extraRpcs } from ${JSON.stringify(filePath)};`,
"const out = {};",
"for (const [chainId, { rpcs = [] }] of Object.entries(extraRpcs)) out[chainId] = rpcs.map((rpc) => (typeof rpc === 'string' ? rpc : rpc.url));",
"console.log(JSON.stringify(out));",
].join("\n");
const rpcsByChain = JSON.parse(
execSync("node --input-type=module", { input: script, encoding: "utf-8", stdio: "pipe", maxBuffer: 64 * 1024 * 1024 })
);

const normalize = (url) => url.trim().replace(/\/+$/, "").toLowerCase();
const duplicates = [];
let checked = 0;

for (const [chainId, urls] of Object.entries(rpcsByChain)) {
const seen = new Set();
for (const url of urls) {
if (typeof url !== "string") continue;
checked++;
const key = normalize(url);
if (seen.has(key)) {
duplicates.push(`${chainId}: ${url}`);
} else {
seen.add(key);
}
}
}

if (duplicates.length > 0) {
console.error("ERROR: Duplicate rpc urls found in extraRpcs:");
duplicates.forEach((d) => console.error(` - ${d}`));
throw new Error(`Duplicate rpc urls found in extraRpcs: ${duplicates.length}`);
}

console.log(`✓ No duplicate rpc urls found in extraRpcs (checked ${checked} urls)`);
}

// Run all tests and collect errors
console.log("=".repeat(60));
console.log("Running syntax and duplicate key checks...");
Expand Down Expand Up @@ -185,6 +232,12 @@ try {
errors.push(error.message);
}

try {
checkDuplicateRpcUrls();
} catch (error) {
errors.push(error.message);
}

console.log("=".repeat(60));

if (errors.length > 0) {
Expand Down
Loading