Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Display the list of owned safes #2495

Merged
merged 6 commits into from
Jul 1, 2021
Merged

Display the list of owned safes #2495

merged 6 commits into from
Jul 1, 2021

Conversation

katspaugh
Copy link
Member

@katspaugh katspaugh commented Jun 28, 2021

What it solves

When testing the safe interface, oftentimes you clear the localStorage and lose all your safes.

Related to #510.

How this PR fixes it

Your safes can be still retrieved via an endpoint, so I've made a little custom hook that fetches safes by their owner.

How to test it

Connect your wallet and see your unsaved safes in the sidebar. Should not be visible on production.

Screenshots

Screenshot 2021-06-29 at 12 09 45

@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Jun 28, 2021

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 1 0
Ignored 0 N/A
  • Result: ✅ success

  • Annotations: 1 total


[warning] @typescript-eslint/explicit-module-boundary-types

Require explicit return and argument types on exported functions' and classes' public class methods


Report generated by eslint-plus-action

@github-actions
Copy link

@github-actions
Copy link

@lukasschor
Copy link
Member

This is not just an issue when testing, but also for users. There is already a similar ticket addressing this problem, even with some designs: #510

So would be more in favor of coming up with a solution that would also work as a v1 that we can also use in production. Even if it's not the "proper solution" as planned in #510.

Maybe also worth looking into parcel.money or multisafe.finance, as they offer to add Safes where the connect wallet is an owner by "scanning for them".

@katspaugh
Copy link
Member Author

@lukasschor thanks Lucas!
I like your idea in the comments there:

Instead of adding them to the regular Safe sidebar permenantely so the Safes also persist when disconnecting the signer key, we could introduce an (expandable) sub-section in the Sidebar where Safes are displayed where the signer key is an owner, if the user wants to add a Safe permanently he/she would still have to go through the regular Load Safe flow

I could make the unsaved saves a collapsible section and add an "Add safe" button on hover.

Screenshot 2021-06-28 at 16 53 47

@katspaugh katspaugh marked this pull request as draft June 28, 2021 14:55
@katspaugh katspaugh changed the title Display the list of owned safes on dev Display the list of owned safes Jun 28, 2021
@katspaugh katspaugh force-pushed the owned-safes branch 2 times, most recently from 8ef7b5b to 77f03a9 Compare June 29, 2021 10:14
@katspaugh katspaugh marked this pull request as ready for review June 29, 2021 10:14
@katspaugh katspaugh requested a review from dasanra June 29, 2021 10:15
import { getTxServiceUrl } from 'src/config'

export const fetchSafesByOwner = async (ownerAddress: string): Promise<string[]> => {
const url = `${getTxServiceUrl()}/owners/${ownerAddress}`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint structure is deprecated. It should have /safes after owner address

Check swagger for more info
https://safe-transaction.mainnet.gnosis.io/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated ✅

@lukasschor
Copy link
Member

Really nice! Would love to have this available as a feature for users if the overhead is small enough.

Some minor comments

CleanShot 2021-06-29 at 15 51 50@2x

The address abbreviation doesn't follow our standard of "0x1234...abcd"

CleanShot 2021-06-29 at 15 52 59@2x

Some more space between the button and the "Owned Safes" label would be nice

@katspaugh
Copy link
Member Author

Fixed, thanks @lukasschor!

Screenshot 2021-06-29 at 16 03 58

@katspaugh katspaugh self-assigned this Jun 29, 2021
@katspaugh katspaugh requested a review from dasanra June 29, 2021 19:59
Copy link
Collaborator

@dasanra dasanra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@mmv08
Copy link
Member

mmv08 commented Jun 30, 2021

This feature is truly awesome

The only thing: it looks like laggy in scenarios with a lot of safes: https://www.loom.com/share/927df3bf33c94e73a847b9a3949f6e7f

Maybe virtualizing the list would help

@katspaugh
Copy link
Member Author

Maybe virtualizing the list would help

@mikheevm I've checked react-virtualized docs and it seems it needs to know the height in advance. And we have a flexible height there. The whole container scrolls. I assume regular users won't have more than a dozen safes. Good UX pattern though, will note for future. 👍

@katspaugh katspaugh moved this from Code review and dev test to Ready for QA in Gnosis Safe React (Archived) Jun 30, 2021
@mmv08
Copy link
Member

mmv08 commented Jun 30, 2021

@katspaugh Looks like there's a component for dynamic sizing: https://github.com/bvaughn/react-virtualized/blob/master/docs/AutoSizer.md

Anyway, this is a rather extreme case, so it's not required to fix it in this PR.

@francovenica francovenica moved this from Ready for QA to QA in progress in Gnosis Safe React (Archived) Jun 30, 2021
@francovenica
Copy link
Contributor

I like the feature and is functional.
Tested it with MM extension, WC, Trezor and Portis.
Also tested in Mainnet and rinkeby, bringing only the safes created on those environments

A few improvements we can make:

  • The dropdowns still shows after the person disconnects, we can hide it if the person disconnects from the gnosis app
  • The search feature on the top works only with addresses, but not with names. We could add that it works with safe names as well for this particular list

Still, give what this feature was created for, I'd not put much more effort into it.

@francovenica francovenica moved this from QA in progress to QA done in Gnosis Safe React (Archived) Jun 30, 2021
@katspaugh
Copy link
Member Author

The dropdowns still shows after the person disconnects, we can hide it if the person disconnects from the gnosis app

Fixed, good catch @francovenica.

@github-actions
Copy link

github-actions bot commented Jul 1, 2021

@github-actions
Copy link

github-actions bot commented Jul 1, 2021

@katspaugh katspaugh merged commit 45d3f30 into dev Jul 1, 2021
Gnosis Safe React (Archived) automation moved this from QA done to Closed Jul 1, 2021
@katspaugh katspaugh deleted the owned-safes branch July 1, 2021 09:34
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants