Skip to content

Commit

Permalink
eth/chain: update list of chains (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
q9f authored Jul 2, 2024
1 parent 4182fa7 commit 8547bd1
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 15 deletions.
43 changes: 32 additions & 11 deletions lib/eth/chain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ class ReplayProtectionError < StandardError; end
# Chain ID for Optimistic Ethereum mainnet.
OPTIMISM = 10.freeze

# Chain ID for Cronos mainnet.
CRONOS = 25.freeze

# Chain ID for Rootstock mainnet.
RSK = 30.freeze

# Chain ID for BNB Smart Chain mainnet.
BNB = 56.freeze

# Chain ID for Ethereum Classic mainnet.
CLASSIC = 61.freeze

Expand All @@ -50,9 +59,24 @@ class ReplayProtectionError < StandardError; end
# Chain ID for the Polygon mainnet (formerly Matic).
POLYGON = MATIC.freeze

# Chain ID for Arbitrum mainnet.
# Chain ID for Filecoin mainnet.
FILECOIN = 314.freeze

# Chain ID for Moonbeam
MOONBEAM = 1284.freeze

# Chain ID for Base mainnet.
BASE = 8453.freeze

# Chain ID for Arbitrum One mainnet.
ARBITRUM = 42161.freeze

# Chain ID for Avalance C-Chain mainnet.
AVALANCHE = 43114.freeze

# Chain ID for Linea mainnet.
LINEA = 59144.freeze

# Chain ID for Morden (Ethereum) testnet.
MORDEN = 2.freeze

Expand All @@ -77,7 +101,7 @@ class ReplayProtectionError < StandardError; end
# Chain ID for Mordor testnet.
MORDOR = 63.freeze

# Chain ID for Optimistik Kovan testnet.
# Chain ID for Optimistm Kovan testnet.
KOVAN_OPTIMISM = 69.freeze

# Chain ID for Arbitrum xDAI testnet.
Expand All @@ -86,6 +110,12 @@ class ReplayProtectionError < StandardError; end
# Chain ID for Optimistic Goerli testnet.
GOERLI_OPTIMISM = 420.freeze

# Chain ID for Moonriver testnet
MOONRIVER = 1285.freeze

# Chain ID for Moonbase alpha
MOONBASE = 1287.freeze

# Chain ID for the Polygon Mumbai testnet.
MUMBAI = 80001.freeze

Expand All @@ -104,15 +134,6 @@ class ReplayProtectionError < StandardError; end
# Chain ID for the geth private network preset.
PRIVATE_GETH = 1337.freeze

# Chain ID for Moonbase
MOONBASE = 1287.freeze

# Chain ID for Moonriver
MOONRIVER = 1285.freeze

# Chain ID for Moonbeam
MOONBEAM = 1284.freeze

# Indicates wether the given `v` indicates a legacy chain value
# used by ledger wallets without EIP-155 replay protection.
#
Expand Down
14 changes: 10 additions & 4 deletions spec/eth/chain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
expect(Chain::EXPANSE).to eq 2
expect(Chain::OPTIMISM).to eq 10
expect(Chain::CLASSIC).to eq 61
expect(Chain::CRONOS).to eq 25
expect(Chain::RSK).to eq 30
expect(Chain::BNB).to eq 56
expect(Chain::POA_NET).to eq 99
expect(Chain::XDAI).to eq 100
expect(Chain::GNOSIS).to eq 100
expect(Chain::MATIC).to eq 137
expect(Chain::POLYGON).to eq 137
expect(Chain::ARBITRUM).to eq 42161
expect(Chain::FILECOIN).to eq 314
expect(Chain::MOONBEAM).to eq 1284
expect(Chain::BASE).to eq 8453
expect(Chain::ARBITRUM).to eq 42161
expect(Chain::AVALANCHE).to eq 43114
expect(Chain::LINEA).to eq 59144

# Chain IDs for selected testnets
expect(Chain::MORDEN).to eq 2
Expand All @@ -28,15 +35,14 @@
expect(Chain::KOVAN_OPTIMISM).to eq 69
expect(Chain::XDAI_ARBITRUM).to eq 200
expect(Chain::GOERLI_OPTIMISM).to eq 420
expect(Chain::MOONRIVER).to eq 1285
expect(Chain::MOONBASE).to eq 1287
expect(Chain::MUMBAI).to eq 80001
expect(Chain::RINKEBY_ARBITRUM).to eq 421611
expect(Chain::GOERLI_ARBITRUM).to eq 421613
expect(Chain::SEPOLIA).to eq 11155111
expect(Chain::HOLESOVICE).to eq 11166111

expect(Chain::MOONRIVER).to eq 1285
expect(Chain::MOONBASE).to eq 1287

# Chain IDs for selected private networks
expect(Chain::PRIVATE_GETH).to eq 1337
end
Expand Down

0 comments on commit 8547bd1

Please sign in to comment.