Skip to content
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

Add icon URLs #202

Closed
edmundedgar opened this issue Apr 1, 2021 · 5 comments
Closed

Add icon URLs #202

edmundedgar opened this issue Apr 1, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@edmundedgar
Copy link

Now that we have EIP-3085 it becomes useful for dapps to have a maintained list of parameters they can use to create "add network" requests. The chains.json here file works great for this purpose, except that it's missing a couple of fields:

We don't necessarily need them for all networks, just the main ones would be fine.

@ligi ligi added the enhancement New feature or request label Apr 3, 2021
@ligi
Copy link
Member

ligi commented Apr 3, 2021

Yea - actually Icons are easier than the block explorer so I will start with this one.
I suggest to make it an array to cater for different sizes / formats and enforce the URL to be a web3 URL (ipfs:// to start with) so we can pin it in the process.
Does this work for everyone:

{
    ...
	"icon": [{
			"url": "ipfs://myIPFSurl",
			"width": 128,
			"height": 128,
			"format": "png"
		},
		{
			"url": "ipfs://myIPFSurlForSVG",
			"format": "svg"
		}
	]
}

where:

  • URL must be a valid resolveable web3 URL that will be pinned in the process
  • width, height are a number and optional (for vector assets)
  • format is either jpg,png or svg

If we can get rough consensus around this I would add support for it to the CI and hope for some help with backfilling important chains.

@edmundedgar
Copy link
Author

edmundedgar commented Apr 3, 2021

That looks good to me - I'm not sure whether metamask will handle raw ipfs urls correctly or not but if not I guess it's not a big deal for the code that consumes that to switch the ipfs:// URL to use a gateway.

@ligi
Copy link
Member

ligi commented Apr 3, 2021

yea - we could also offer a transformed json that changes the URLs to use a prefix

@ligi
Copy link
Member

ligi commented Apr 4, 2021

Just had one thought when starting to add support: maybe it makes sense to have the icon definitions in different files and just have references to it in the chain definitions.
Background: some chains will share the icon definitions (e.g. between main and testnets) so this would make things WET and IMHO we should keep things DRY.

@edmundedgar
Copy link
Author

Sounds good to me, I guess that'll mean we'll definitely want to be able to generate a transformed json but that's probably a good idea anyhow

@ligi ligi closed this as completed in 7b2edb8 Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants