Handle ethereum formated address in MetaData
The way parchain address format are added into the browser extension or the mobile app doesn't seem to allow ethereum formated address, like we have in Moonbeam. Please let me know how to integrate this and I will help.
@jacogr Is there a way to tell the extension that moonbeam address are supposed to be formated like ethereum? Should this be in Metadata?
@jacogr let me know when you have time to look at this as it is becoming a time sensitive issue for us
Ok, so this is basically for chains added via the apps UI metadata. In that case the best would certainly be just to add another flag - I guess it is the isEthereum flag that should be transported.
So would suggest making it a bit more generic, so pass something like an additional
addressType: “substrate” | “ethereum”
through in the metadata updates which uses the info from here https://github.com/polkadot-js/apps/blob/master/packages/page-settings/src/useChainInfo.ts#L15
Overall, yes, def. needs to be done since we are missing this and it is quite critical for these.
Here is a first PR to update the app : https://github.com/polkadot-js/apps/pull/5766 Let me know what part of extension I need to update to use ethereum formatted addresses
Will need to take a peek through, honestly not sure off-hand. Will need to a read through the code in the morning.
I guess it would start with where the metadata is uploaded and start from there - with types, etc. The only issue here would be old/new, so don't want to break on not having the field, but since we are mostly interested in the one, we can assume when not available it is the other.
https://github.com/polkadot-js/extension/blob/master/packages/extension-inject/src/types.ts#L52
It needs an additional chainType?: 'substrate' | 'ethereum' (it is marked optional since olde versions won't have the type, however that won't affect def.chainType === 'ethereum' checks anywhere, so all ok)
https://github.com/polkadot-js/extension/blob/master/packages/extension-ui/src/components/Address.tsx#L101
The above handles the formatting, chain there should then have chain.chainType? which can be used in the component
I made a first draft @jacogr https://github.com/polkadot-js/extension/pull/776 I just don't understand why the account doesnt appear in the app. Also the copy-paste doesnt work but that's less important