-
-
Notifications
You must be signed in to change notification settings - Fork 28
feat(chains): support paths to spec-files to enable permissionless adding of new chains #43
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
Comments
You could just use Define the schema in a concise and safe TypeScript and use that at runtime, and optionally export JSON Schema to add to the registries for better authoring experience (i.e. editor completions and etc) for the files. The only (maybe) downside is you'd have to derive the |
I've heard good things about zod but never looked much into it. I see in the docs the |
Not all types of course, just the ones that describe the data. Also, I mostly use |
Closing this issue as part of the move to automated data collection in #62, since the new design is much more scalable and does not require chains to maintain their own JSON data files |
Uh oh!
There was an error while loading. Please reload this page.
The current plan is to first add the complete set of data for the 3 initial chains. From there, I'd like to add a helper method that makes it easy to add a new chain based off an existing chain, so the diffs for new chains can be small.
With both of those in place, we can support a feature that lets chains permissionlessly add their own data using e.g. a JSON file that has the same structure as the
Chain
type insrc/types/chains.ts
. Assuming we go the JSON route, we'd probably want to use JSON Schema to strongly type it and so users can validate their implementations. There are at least two actively maintained packages that support converting TS types to JSON Schema which would help the conversion:A chain could define their JSON file and host it somewhere, then users can navigate directly to
https://www.evmdiff.com/diff?base=1&target=encodedUrlToChainDiffFile
. This would compare chain ID 1 (mainnet) to the chain whose path is specified in the URL.We'll also have to show a warning that the data is unverified and may not be accurate.
Some chains may be limited by the shape of the
Chains
type depending on how EVM-(in)compatible they are. One way to mitigate this is to add a generic catch-call section to the end that supports arbitrary keys and values, which get rendered in their own section of the UI.h/t @alcuadrado for the idea
The text was updated successfully, but these errors were encountered: