Skip to content

Implement tiers and checks for networks#362

Merged
JonoPrest merged 2 commits into
mainfrom
jp/implement-chain-tiers
Nov 27, 2024
Merged

Implement tiers and checks for networks#362
JonoPrest merged 2 commits into
mainfrom
jp/implement-chain-tiers

Conversation

@JonoPrest

Copy link
Copy Markdown
Collaborator
  • Adds chain tiers and icon to network selection
    Screenshot 2024-11-25 at 12 51 07

  • Uses API to manage only public chains/tiers and check tests

Comment on lines -311 to -317
.filter(|&n| {
HypersyncNetwork::iter()
//able to cast as u64 because networks enum
//uses repr(u64) attribute
.find(|&sn| n as u64 == sn as u64)
.is_some()
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I thought I deleted the code. Looks like I missed the place 👍

Comment on lines +500 to +516
match self {
EthereumMainnet | Fantom | Zeta | Sepolia | OptimismSepolia | Metis | ZksyncEra
| Optimism | ArbitrumSepolia | ArbitrumNova | Avalanche | Polygon | Bsc | Mantle
| Zircuit | BaseSepolia => Gold,

Manta | Base | BerachainBartio | Boba | Blast | Cyber | Aurora | Harmony | Scroll
| Darwinia | Mode | Rsk | ShimmerEvm | Linea | NeonEvm | Amoy | Saakuru | Moonbeam
| Opbnb | Lisk | BlastSepolia | Celo | Chiliz | Fuji | ArbitrumOne | Merlin
| Holesky => Silver,

Zora | MoonbaseAlpha | Morph | LuksoTestnet | Kroma | GnosisChiado | XLayer | Lukso
| Gnosis | C1Milkomeda | Crab | Tangle | Sophon | Flare | PolygonZkevm | MevCommit => {
Bronze
}

SophonTestnet | MorphTestnet | GaladrielDevnet | CitreaTestnet | Goerli
| BscTestnet | B2Testnet | UnichainSepolia => Experimental,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe store the json file and compute the values from it in runtime?

I think it's going to be annoying to sync the list. Also, we can do the same for whether chain is hypersync or not + add a make script to update the json file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH we should probably just compute everything dynamically from the API.

But otherwise yeah, json file could be better.

We could get rid of our network enum entirely.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to add things like the default confirmed block threshold to the API

@DZakh DZakh Nov 25, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would be great. But inline the file to binary, instead of fetching from the server on every run

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we also have non-hypersync chains there, so I'm not really sure

Comment on lines -309 to -318
let options = NetworkWithExplorer::iter()
//Filter only our supported networks
.filter(|&n| {
HypersyncNetwork::iter()
//able to cast as u64 because networks enum
//uses repr(u64) attribute
.find(|&sn| n as u64 == sn as u64)
.is_some()
})
.collect();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this filtering of only offering hypersync networks for contract import. It should now be obvious if they are hyper sync networks or not from the icon.

@JonoPrest JonoPrest merged commit 8bfc4b0 into main Nov 27, 2024
@JonoPrest JonoPrest deleted the jp/implement-chain-tiers branch November 27, 2024 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants