vega-frontend-monorepo/specs/0004-EWAL-connect_ethereum_wallet.md
2023-08-07 08:41:25 +01:00

2.5 KiB

Connect Ethereum wallet

Dapps can connect to an Ethereum wallet to complete Ethereum transactions such as Deposits and withdraws to/from Vega, Association and more.

Connecting wallet

When wanting or needing to write to Ethereum, I...

  • will have seen a link to connect that opens connection options (this always happens in context so should be covered by WITH, DEPO, ASSO ACS)

  • if first time:

    • must select a connection method / wallet type: (e.g. wallet connect, injected / metamask) (0004-EWAL-001)
    • must be prompt to check eth wallet (while the dapp waits for a response) (0004-EWAL-002)
    • must see an option to cancel the attempted connection (if the wallet fails to respond) (0004-EWAL-003)
    • if the app gets multiple keys: the user:
      • should be shown the keys returned and given a UI to select a key for use (but the pattern is often just to select the first in the array)
      • should be prompted to select one (in many cases Dapps default to key 0 in the array)
  • after first use (if there is a connection to restore):

    • must prompt wallet to grant access (0004-EWAL-004)
    • should see previous connection has been recovered
    • should see a link to trigger a fresh connection / fetch new keys (in in the case where I now want to use a different wallet to the one I was connected with)
  • once connected:

    • must see the connected ethereum wallet Public key (0004-EWAL-005)

... so I can sign and broadcast Ethereum transactions, use a key address as in input, or read data from ethereum via my connected wallet

Disconnecting

When I'm finished using a connected Ethereum wallet I may wish to disconnect...

  • must see a link to disconnect (0004-EWAL-006)
    • must destroy dapp -> ETH wallet session so that hitting connect again triggers the modal that asks what method you'd like to use to connect to an ETH wallet, (note: it is not possible to invalidate the permission the metamask wallet has granted the app, therefore users will need to know that if they want to connect to a new ETH key they will have to do so from the wallet) (0004-EWAL-007)

... so that I can use a different wallet, or ensure may wallet can not be used by other apps