Skip to content

Commit

Permalink
Add missing mainnet aliases (#86)
Browse files Browse the repository at this point in the history
* add mainnet alias validation rule

* fix chains without "-mainnet" aliases

* bump version
  • Loading branch information
YaroShkvorets authored Feb 22, 2025
1 parent 894d076 commit 824287b
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.6.41",
"version": "0.6.42",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion registry/bip122/btc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "btc",
"shortName": "Bitcoin",
"fullName": "Bitcoin Mainnet",
"aliases": ["bitcoin"],
"aliases": ["bitcoin", "btc-mainnet"],
"caip2Id": "bip122:000000000019d6689c085ae165831e93",
"explorerUrls": ["https://btcscan.org"],
"rpcUrls": ["https://bitcoin-mainnet.gateway.tatum.io"],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/arbitrum-one.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "arbitrum-one",
"shortName": "Arbitrum One",
"fullName": "Arbitrum One Mainnet",
"aliases": ["arbone", "arbitrum", "arb-sepolia", "evm-42161"],
"aliases": ["arbone", "arbitrum", "arb-sepolia", "evm-42161", "arbitrum-one-mainnet"],
"caip2Id": "eip155:42161",
"graphNode": { "protocol": "ethereum" },
"relations": [{ "kind": "l2Of", "network": "mainnet" }],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/bnb-op.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "bnb-op",
"shortName": "opBNB",
"fullName": "opBNB Mainnet",
"aliases": ["evm-204", "opbnb", "bsc-op"],
"aliases": ["evm-204", "opbnb", "bsc-op", "bnb-op-mainnet"],
"caip2Id": "eip155:204",
"graphNode": { "protocol": "ethereum" },
"relations": [{ "kind": "l2Of", "network": "bsc" }],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/boba-bnb.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "boba-bnb",
"shortName": "Boba BNB",
"fullName": "Boba BNB Mainnet",
"aliases": ["evm-56288", "boba-bsc"],
"aliases": ["evm-56288", "boba-bsc", "boba-bnb-mainnet"],
"caip2Id": "eip155:56288",
"graphNode": { "protocol": "ethereum" },
"explorerUrls": ["https://bnb.bobascan.com"],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/clover.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "clover",
"shortName": "CLV",
"fullName": "CLV Parachain",
"aliases": ["clv-mainnet", "evm-1023"],
"aliases": ["clv-mainnet", "evm-1023", "clover-mainnet"],
"caip2Id": "eip155:1023",
"graphNode": { "protocol": "ethereum" },
"explorerUrls": ["https://clvscan.com"],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/fraxtal.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "fraxtal",
"shortName": "Fraxtal",
"fullName": "Fraxtal Mainnet",
"aliases": ["evm-252"],
"aliases": ["evm-252", "fraxtal-mainnet"],
"caip2Id": "eip155:252",
"graphNode": { "protocol": "ethereum" },
"explorerUrls": ["https://fraxscan.com"],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "mint",
"shortName": "Mint",
"fullName": "Mint Mainnet",
"aliases": ["evm-185"],
"aliases": ["evm-185", "mint-mainnet"],
"caip2Id": "eip155:185",
"graphNode": { "protocol": "ethereum" },
"explorerUrls": ["https://explorer.mintchain.io"],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/moonbeam.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "moonbeam",
"shortName": "Moonbeam",
"fullName": "Moonbeam Mainnet",
"aliases": ["evm-1284", "mbeam"],
"aliases": ["evm-1284", "mbeam", "moonbeam-mainnet"],
"caip2Id": "eip155:1284",
"graphNode": { "protocol": "ethereum" },
"explorerUrls": ["https://moonbeam.moonscan.io"],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/moonriver.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "moonriver",
"shortName": "Moonriver",
"fullName": "Moonriver Mainnet",
"aliases": ["evm-1285", "mriver"],
"aliases": ["evm-1285", "mriver", "moonriver-mainnet"],
"caip2Id": "eip155:1285",
"graphNode": { "protocol": "ethereum" },
"explorerUrls": ["https://moonriver.moonscan.io"],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/optimism.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "optimism",
"shortName": "Optimism",
"fullName": "OP Mainnet",
"aliases": ["evm-10", "op-mainnet"],
"aliases": ["evm-10", "op-mainnet", "optimism-mainnet"],
"caip2Id": "eip155:10",
"graphNode": { "protocol": "ethereum" },
"relations": [{ "kind": "l2Of", "network": "mainnet" }],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/polygon-zkevm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "polygon-zkevm",
"shortName": "Polygon zkEVM",
"fullName": "Polygon zkEVM Mainnet",
"aliases": [],
"aliases": ["evm-1101", "polygon-zkevm-mainnet"],
"caip2Id": "eip155:1101",
"graphNode": { "protocol": "ethereum" },
"relations": [{ "kind": "l2Of", "network": "mainnet" }],
Expand Down
2 changes: 1 addition & 1 deletion registry/eip155/zksync-era.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"shortName": "zkSync",
"secondName": "Era",
"fullName": "zkSync Mainnet",
"aliases": ["evm-324", "zksync"],
"aliases": ["evm-324", "zksync", "zksync-era-mainnet"],
"caip2Id": "eip155:324",
"graphNode": { "protocol": "ethereum" },
"explorerUrls": ["https://explorer.zksync.io"],
Expand Down
2 changes: 1 addition & 1 deletion registry/solana/solana-mainnet-beta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "solana-mainnet-beta",
"shortName": "Solana",
"fullName": "Solana Mainnet",
"aliases": ["solana-mainnet", "solana"],
"aliases": ["solana-mainnet", "solana", "solana-beta"],
"caip2Id": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
"explorerUrls": ["http://explorer.solana.com", "http://solana.fm"],
"rpcUrls": ["https://api.mainnet-beta.solana.com"],
Expand Down
28 changes: 28 additions & 0 deletions src/validate_logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,33 @@ function validateUrls(networks: Network[]) {
process.stdout.write("done\n");
}

function validateMainnetAliases(networks: Network[]) {
process.stdout.write("Validating mainnet aliases ... ");
const mainnets = networks.filter(
(n) =>
n.id !== "mainnet" &&
n.networkType === "mainnet" &&
!n.relations?.some((r) => r.kind === "beaconOf"),
);
for (const network of mainnets) {
const woMainnet = network.id.replace("-mainnet", "");
const withMainnet = `${woMainnet}-mainnet`;

if (woMainnet === network.id) {
if (!network.aliases?.includes(withMainnet)) {
ERRORS.push(
`\`${network.id}\` - must have an alias \`${withMainnet}\``,
);
}
} else {
if (!network.aliases?.includes(woMainnet)) {
ERRORS.push(`\`${network.id}\` - must have an alias \`${woMainnet}\``);
}
}
}
process.stdout.write("done\n");
}

async function validateWeb3Icons(networks: Network[]) {
process.stdout.write("Validating web3 icons ... ");
const web3Icons = await fetchWeb3NetworkIcons();
Expand Down Expand Up @@ -427,6 +454,7 @@ export async function validateLogic(networksPath: string) {
validateTestnets(networks);
validateUrls(networks);
validateServices(networks);
validateMainnetAliases(networks);
await validateWeb3Icons(networks);
await validateFirehoseBlockType(networks);
await validateGraphNetworks(networks);
Expand Down

0 comments on commit 824287b

Please sign in to comment.