status-im / status-mobile

a free (libre) open source, mobile OS for Ethereum
https://status.app
Mozilla Public License 2.0
3.85k stars 983 forks source link

Support Metamask address QRs #19986

Open xAlisher opened 1 month ago

xAlisher commented 1 month ago

User Story

As a Status app user, I want to be able to scan Metamask QR addresses, so I can send assets or save the address, if Status supports the network.

Description

Metamask stores addresses in QR codes with the following format: ethereum:0x38cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd2@0xa

ethereum: - prefix described in EIP-67 0xa - chain ID suffix described in EIP-155

Since Status addresses do not include these parts, we need to convert the data from Metamask QR addresses to a format our app can work with for sending, saving, and editing network preferences.

Conversion

  1. ethereum: - prefix should be ignored and removed on our side

  2. Status addresses follow the EIP-3770 format, which maps hexadecimal chain IDs to readable chain prefixes.

Name EIP-155 (HEX) DEC EIP-3770
Mainnet 0x1 1 eth:
Binance Smart Chain 0x38 56 bsc:
Linea 0xe708 59144 linea:
Polygon 0x89 137 matic:
Arbitrum 0xa4b1 42161 arb1:
Optimism 0xa 10 oeth:

More networks: chains_mini.json file on chainid.network

After converting, ethereum:0x38cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd2@0xa should become oeth:0x38cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd2

This conversion should happen in all instances of scanning addresses, such as

It should be implemented on all supported platforms.

If the address contains an unsupported network, the user should receive an error "Address contains unsupported network" Users should not be able to save addresses with unsupported network prefixes to avoid problems in the send flow and sending assets to wrong networks.

Implementation.

  1. Design cases for all relevant instances of QR scanner in Figma
  2. Implement the conversion and validation logic
  3. Submit the feature for review and approval by the Status QA team

Acceptance Criteria

Future Steps Consider supporting Metamask's "Payment request" QR format including additional data like requested amount and token ID.

xAlisher commented 1 month ago

Designs Universal scanner - https://www.figma.com/design/eDfxTa9IoaCMUy5cLTp0ys/Shell-for-Mobile?node-id=9463%3A6641&t=wFbzKm9rir4nA4YV-1

Saving addresses - https://www.figma.com/design/QWJV5WRbroXVDsdubEDjAT/Wallet-settings-for-Mobile?node-id=2321%3A47009&t=P6QiIOmVtrEz40XJ-1

Sending:

image

xAlisher commented 1 month ago

After discussing this issue with John it needs to be updated. Hold on...

churik commented 1 month ago

put the label "blocked" when it is under the discussion

xAlisher commented 2 weeks ago

Issue discussed with John and updated.

churik commented 1 week ago

cc @J-Son89 should it be included in 2.30?

J-Son89 commented 1 week ago

It does seem like something worth having, let's put it lower priority than the high priority bugs, but once we get through them we can look at it? wdyt? 🤔

churik commented 1 week ago

Yes, I think it is required feature to be honest, agreed