Safe-react: [Address Book v2] Make the address book global

Created on 20 Apr 2021  路  4Comments  路  Source: gnosis/safe-react

cf. Trello activity and problem statement

Title/Description


Currently, each safe has its own AB. We want to make it global for all safes for a given user.

Requirements

  • AB should be visible to all safes
  • A global localStorage item per domain/network
  • All name-address connections should come from AB (not settings)

Data structure

The address book should be a list of records like this:

type AddressBookEntry = {
  address: string: // the contact address
  name: string; // human-readable name
  chainId: number; // see https://chainid.network
}

Persistence layer

Simplify the logic that saves/restores the AB from the localStorage. Consider using a Redux plugin for that.

Must Tech-debt 馃毀 Web 馃捇 epic-address-book

Most helpful comment

I think abi could be left out. There is this linked ticket (#948), yes, but currently we have no plans to have this.

All 4 comments

I think abi could be left out. There is this linked ticket (#948), yes, but currently we have no plans to have this.

@liliya-soroka @francovenica as discussed, we can start testing this issue on the epic branch #2280.

Tests cases to pay attention to:

  • Safe creation, loading, loading via URL
  • Renaming via settings
  • Renaming via address book
  • Adding/renaming owners
  • Empty safe/owner names

Works fine:

  • [x] Safe creation, loading
  • [x] Renaming via settings
  • [x] Renaming via address book
  • [x] Adding/renaming owners
  • [x] Empty safe/owner names

Issues:

Safe load by URL Issue: The name of the safe is not being stored in the AB, or is being removed when the safe is removed. See the gif
05-28-2021_x(2507)

https://pr2280--safereact.review.gnosisdev.com/rinkeby/app/#/safes/0x9913B9180C20C6b0F21B6480c84422F6ebc4B808/address-book

Step:
Load the safe normally using the address
Give a name to the safe
Check the address book, the safe is there with its name
Remove the safe from the settings, you will be sent back to the "Welcome page"
Paste the URL of the safe
The address book won't show the safe anymore there

I'd assume that, even if you load the safe by URL, if the name was already entered in the AB, it should remain there if it is loaded by copy/pasting the URL.

So:

  • Or the name of the safe is not being actually stored during the load safe process
  • Or the name of the safe is being removed from the address book when the safe is removed from the settings
  • Or somehow pasting the URL automatically loads the safe without a name and that overwrites whatever it was stored for the address book.

EDIT: I just checked the local storage and yes, the safe entry in the AB is being removed if it is removed from the settings. Why?, there is no need to remove it there.

Update:
So, if you have a safe in address book and you load it by copy pasting the URL the new safe takes the name of the one in the address book, so this is working fine.
The issue reported in the previous comment is more of the name being removed when the safe is removed, something that probably should not happen, but is for another ticket.

I'll close this one as approved and put the issue in a new ticket (Reported here https://github.com/gnosis/safe-react/issues/2353)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rmeissner picture rmeissner  路  6Comments

alongoni picture alongoni  路  6Comments

lukasschor picture lukasschor  路  5Comments

lukasschor picture lukasschor  路  4Comments

katspaugh picture katspaugh  路  3Comments