-
Notifications
You must be signed in to change notification settings - Fork 354
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 isEthereum to ChainProperties #5686
Conversation
This gets us half-way and is a great start. With the chain properties, we have to ensure it is correctly decorated on the registry as well (so users can just use This part is done in the registry (where it also combines existing on-chain constants - always taking precedence, hence not applying that in eg. apps), you can find it here - api/packages/types/src/create/registry.ts Lines 154 to 167 in 47df39e
And here is where it is called/used - api/packages/types/src/create/registry.ts Lines 611 to 614 in 47df39e
|
Hi @jacogr. Thanks for the review and explanation! I've updated the registry to set |
@jacogr any news on this side? it would be important for us as we will start having chains that need addresses being represented in ethereum format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using Option<Bool>
instead of just Bool
?
I looked through and cannot see specific benefit.
With Option<Bool>
:
- if not specified it is
isNone
(which is equivalent tofalse
) - if specified, it returns
isTrue
orisFalse
With Bool
:
- If not specified, it is
isFalse
- if specified, it is either
isTrue
orisFalse
The benefit of using Bool
is that we don't need to go through unwrapping magic on use, i.e. it is a straight flag check.
EDIT: It would also be useful to add a getter (like the other chain*
retrievals) to the registry for chainIsEthereum(): boolean
(This makes downstream usage aq walk in the park)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Giving the growing number of Ethereum based substrate chains, the Tanssi team is proposing to add
isEthereum
to the chain properties so apps (such as polkadotjs-apps) can easily distinguish if the chain they're connecting to is Ethereum-based or not without having to maintain and update a manual list.