extension icon indicating copy to clipboard operation
extension copied to clipboard

Handle ethereum formated address in MetaData

Open joelamouche opened this issue 4 years ago • 7 comments

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.

joelamouche avatar Jun 21 '21 14:06 joelamouche

@jacogr Is there a way to tell the extension that moonbeam address are supposed to be formated like ethereum? Should this be in Metadata?

joelamouche avatar Jun 24 '21 09:06 joelamouche

@jacogr let me know when you have time to look at this as it is becoming a time sensitive issue for us

joelamouche avatar Jul 02 '21 12:07 joelamouche

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.

jacogr avatar Jul 03 '21 05:07 jacogr

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

joelamouche avatar Jul 05 '21 09:07 joelamouche

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.

jacogr avatar Jul 06 '21 18:07 jacogr

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

jacogr avatar Jul 07 '21 05:07 jacogr

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

joelamouche avatar Jul 07 '21 13:07 joelamouche