-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor network name output #421
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/oceanprotocol/market/8mBysJtbBRfFhSR4QNA7J7Z99Q5f |
right, each chain can have multiple networks so to speak, and PR only accounts for current status quo. Warning icon: Another possibility would be to redefine the warning condition. Was also thinking of not using warning icon at all for all supported networks. But use it to signal when user is connected to an unsupported network, for which we can still output the network name. As for network name label:
|
After some researching, tending towards outsourcing the network naming standardization and just fetch all metadata from https://github.com/ethereum-lists/chains They capture chain & network which we could combine, so e.g. ETH Rinkeby or Matic Mainnet based on their data structure: https://chainid.network/chains.json. This should then cover all future chains/networks as long as they are in that list, which they probably are. There's also nativeCurrency which might help with #418 |
I think i agree with everything you said. Summary :
|
0559955
to
aa6eabc
Compare
alrighty, with chainid.network we get those network naming combinations if we want to keep it flexible: As per https://chainid.network/chains/#matic-mainnet--, for Matic it would be Matic Mainnet then, we could still remove all Mainnet strings though. The goal I had in mind was to make this network name output completely network agnostic, meaning we simply output whatever user is connected to, regardless if we support it or not. So the source of truth for all network metadata becomes that community-maintained repo. Like that idea of using test label but would keep it around network name, that account element is now exclusively for the account info. The condition based on https://chainid.network response data, Which gives us this for all test networks: With that, maybe it makes sense to use the warning icon then for networks we do not support. Although I guess everything crashes anyway right now when user is connected to unsupported network but ideally user should be able to connect to whatever network and our UI should give hints if it works or not for which warning icon seems a better use. Could be also solved as part of #401 instead of in here, but this could already work: |
043d62b
to
8a2eb1a
Compare
8a2eb1a
to
df6291f
Compare
Not crashing can be patched easily. It's not a proper fix, but it will not crash. |
So... just slapping a |
* remove supportedNetworks app config
one remaining thing: response from https://chainid.network can be slow, it's just Jekyll site on GitHub Pages. So seems better to fetch the list on build time into Gatsby data structure, and query that on client side so it's instant |
works pretty well by now in my testing, getting name is now instant. Will not touch any other network init stuff in here and leave that to #401. |
* was broken in non-web3 browsers * missed in #421
* was broken in non-web3 browsers * missed in #421
* was broken in non-web3 browsers * missed in oceanprotocol/market#421
* was broken in non-web3 browsers * missed in oceanprotocol/market#421
* was broken in non-web3 browsers * missed in oceanprotocol/market#421
* was broken in non-web3 browsers * missed in oceanprotocol/market#421
Fixes #412.
Changes proposed in this PR:
networkId
to display name among other thingsConfigHelper
configs, and error icon output based on itutils/wallet.ts
, remove unused or redundant methodsResulting in:
Supported & test network:
Unsupported & test network: