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

feat: Safe creation + settings transactions #2845

Merged
merged 58 commits into from
Oct 28, 2021

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Oct 14, 2021

What it solves

Resolves #1866

How this PR fixes it

Expanded safe creation/settings 'transactions' show names from the address book or historical transactions (in that order) if they exist.

Note: For the time being owner names are not returned when interacting with owners.

How to test it

Expand safe creation/settings 'transactions' and ensure that known names are displayed.

Screenshots

image
image

DaniSomoza and others added 30 commits September 8, 2021 13:12
* Added new Stepper Component

* Added unit tests to the Stepper Component

* Added new StepperForm Component

* Added StepperForm unit tests
…mponent (#2699)

* first approach of new Load Safe flow

* Added Step 1 Connect wallet & select network step only for stage

* Added Step 2 Name and address in load safe flow

* Added Step 3 Load Safe Owners step

* Added Step 4 Last step of load safe flow

* added onSubmitLoadSafe event and switch network dialog

* Added a isLoading state to prevent to show an error in the safe address field

* Added the current network label clickable to open the network selection popup
* Use getChainId as hot load state

* Adapt transaction list to be compatible with multiple chains at once

* Fix queue transaction list

* Reset safes list when changing network

* Cleanup unused code

* Use config functions inside render cycle of components

* Add comments on things to be done in next steps

* Add possibility to switch network from button

* Remove unused selectors

* Navigate to Welcome page when changing network

* Add missing dependency in useCallback

* Add provider functions to be evaluated in runtime

* Fix create/process transaction

* Correctly swithc networkId on bnc-onboard

* Make onboard configuration dynamic

* Use network selector instead of getNetwork

* Skip a test for now

* Skip a test for now

* Fix lint

* networkSelecto -> currentChainId; add ChainIndicator

* Fix tests

* Fix chainId when adding address book entries

* Add network name in the default safe name

* APP_ENV

* Replace a couple more places with network config getters

* restored the select Network popup in Load flow

* Switch wallet chain only via popup click

* fixed adding an entry to the AB that already exists in another network

* updated addressBookAddressesByCurrentChainId selector to use currentNetworkAddressBook

* restored the check if web3 has been instantiated

* Use the onboard wallet check only as a fallback

Co-authored-by: katspaugh <katspaugh@gmail.com>
Co-authored-by: Daniel Somoza <daniel.somoza@gnosis.pm>
Co-authored-by: katspaugh <ivan.kalyaev@gmail.com>
* Fix onboard initialization

* Fix Ledger wallet connection
* Network circle on each transaction modal

* Get network id from config

* Added chain indicator on safe apps executions

* Changed the header in all modals

* Added header on add/replace/remove owner modals

* Fix imports

* Fix uncomplete missing import

Co-authored-by: katspaugh <ivan.kalyaev@gmail.com>
Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>
* Update start commands to work on Windows

* List of networks and owned safes

* Display balance + filter network safes

* Change network w/ safe + remove unused components

* Readd NetworkSelector + refactor network setting

* Refactor setNetwork

* Move setNetwork

* Load other network safes from localStorage

* Fix safe names/ordering + display ETH balance

* Scroll current safe into view

* Fix imports, loadFromStorage, nativeCoin + yarn

* Fix state

* Fix types + get local safes by network id

* Fix other network safe names

* Extract logic into hook

* Hide networks w/ no safes + lazy load hook state

* Show owned safes for cur. network + name/coin fix

* Fix number of owned safes

* Tweak when to display Safes

* Remove cross-env commands

* Load new env Safes, collapsed + scroll to loaded

* Add effect dependancy

* Less padding, scroll to added + when disconnected

* Fix scrolling to non-added, owned Safe
* Added new create safe flow and welcome layout

* Added Step 3 in Create New Safe flow

* Added Review Safe creation Step

* Added support for Old MultiSig migration and fixed #2590

* Added Safe creation Process component

* Added current network label to all steps in load and create safe flows

* Added CreateNewSafePage tests (step 1)

* Added Owners and confirmation tests in Create new safe flow

* added Step 4 tests and removed throttle from estimateGas

* Added a warning popup at the end of the New Safe Creation flow

* added instantiateSafeContracts in the Create Safe flow

Co-authored-by: katspaugh <katspaugh@users.noreply.github.com>
* Fix li nesting DOM error

* Remove comment
* Only poll when tags change on relevant paths

* Don't restrict polling to transactions route

* Add matchPath

* Remove matchPath for collectibles page

* Readd collectibles page check + always get tokens

* fetschSafeTokens in parallel

* Dispatch syncronously + add initial fetchSafe flag

* Polling dependant on safe loading state

* Add default isSafeLoaded value

* Update route + move network name to slug

Add networkName slug to history pushes

Move network name slug getter from config

Add missing network name slugs

Fix error boundary type

Route that filters legacy paths

Remove unnecessary path generation

Remove router from store

Fix Settings route

Test ChainRoute

Tests

Adjust legacy route detection + fix tests

Remove legacy routes + redirect before render

Fix import

Fix tests

Add types

Programmatically generate pathname

Fix test

Add basename to router

Add basename to history object

Update tests

Explicitly disable refresh forcing

Log networkName

Add base

Remove base and fallback via S3

Add network slug to middleware

Add index-document S3 arg

Adjust deploy script

Remove S3 command

Rm the network path from S3

Removed act warnings in the unit tests console (#2700)

* removed annoying warnings in tests console

Fix cla action (#2716)

Revert "Fix cla action (#2716)"

This reverts commit 578a53c.

Fix: wrap web3Provider.eth.getCode in a try-catch (#2715)

* Fix: wrap web3Provider.eth.getCode in a try-catch

* Remove test code; add unit tests

* Fix the null check

Feature/2397 display guard information in settings (#2662)

* Added transaction guard to advanced settings

* Get guard from the unified gateway

* Fixed tests

* Added TransactionGuard component

* WIP: created component without contract instance

* Call safe method to set guard tx address

* Deleted console log

* Added description to remove guard modal

* Update gateway-sdk to v2.1.0

* Fix remove guard function

* Minor fixes

* Replace guard if fetchedSafe has a null guard

* Fixed some tests

* Fixed test

Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>

Change baseGas and safeTxGas to string (#2710)

* Accept baseGas and safeTxGas as a number from the client gateway

* Set Gateway SDK to v2.2.2

Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>

Bump axios from 0.21.1 to 0.21.2 (#2722)

Bumps [axios](https://github.com/axios/axios) from 0.21.1 to 0.21.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](axios/axios@v0.21.1...v0.21.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Use SignMessageLib for signing (#2701)

* add function to get the deployment

* remove signMessageLib.ts'

* sign message modal wip

* pass request id to confirm/reject transaction functions

* sign message modal wip

* add sign messasge modal

* close modal by default

* use next version of safe-apps-sdk

* regenerate lockfile

* sign message hash

* style the signing modal

* remove console log

* tests wip

* adjust message to by string only

* updat esafe-apps-sdk

* use apps sdk from npm

* move try/catch logic to if statement

* use absolute path when mocking a module in SignMessageModal tests

fix gas types (#2732)

Upgrade bnc onboard (#2734)

* Bump bnc-onboard to latest version

* Bump dependencies with minor changes

Bump version to 3.14.0

dont import react when not needed (#2737)

Add gas estimation endpoint from gateway SDK (#2725)

* Add gas estimation endpoint from gateway SDK

* Use latest gateway-sdk version

Use fetchSafesByOwner from client-gateway

Fix more ESLint errors (#2738)

Use a different S3 bucket for PR deployments

yarn install

Revert "yarn install"

This reverts commit a8bf5b3.

A new PR deployment host

Remove networks from PR comments

Fix lint

Change browser history basename

Remove getBasename tests

Add network to browser history basename

Move network name from basename to welcome route

Bump version

Fix BSC gasPrice (#2747)

Feature: Review Safe App Transaction modal tests (#2743)

* wip confirm tx modal tests

* remove unused var

* Add ts-expect-error statements

* Remove unused web3readonly

Add base route slugs to all redirects

Add missing base route slug

Add route slugs

Add network name slug to add safe button

Add networkName slug to basename

Remove all networkName path generation

Move legacy route redirection to Root component

Use window location object

Add Router w/ history object to legacy redirection

Default network name

Fix import

Revert "Use a different S3 bucket for PR deployments"

This reverts commit 82eaa7f.

Revert "A new PR deployment host"

This reverts commit 3d1710c.

Add network to deploy script

Move network basename to slug + deploy to /app

Fix test

Add PUBLIC_URL base

Adjust PUBLIC_URL

Remove PUBLIC_URL from deploy actions

Add absolute homepage

Fix route slugs

* Fix merge issues

* Fix root URL

* defaultSafe bug hunting + remove safe tracking

* Base app rendering in addressFromUrl

Clear current session from react state to get the app in loading state while fetching new info from local storage

* Add types

* Add return type

* Set network subdirectory from network label

* Fix config tests

* Access loader via PUBLIC_URL

* Load loader relevant to index.html

* Add base

* Header logo navigates to welcome page

* Throw invalid URL addresses + fix network base

* Remove error thrown + fix tests

* Fix merge error

* Fix merge conflicts

Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>
* Clean up deployment scripts

* Fix tests
* Removed old files and added some extra ids because e2e

* Deleted old stepper and renamed CreateSafePage component

* renamed NewStepper to Stepper component
* Created iframe and postMessage

* Migration flow complete

* Remove event listeners once the component is unmounted

* Minor fixes and commented some code

* Migration from unified app to network apps

* Added typing and mocked apps urls

* Migration working, can be tested with ports 3000,3001,3002

* Added types to event from child iframe

* Minor code changes

* Added store action to migrate without notifications

* Updated urls for QA testing

* Unit tests for batchLoadEntries

* Target.origin updated for postMessage

* Changed urls for QA testing

* Deleted console log

* Added logs for debuging

* Save into inmortaldb and include empty name addressbook entries

* Add debugging for migration screen

* Commit to trigger build

* saveMigratedKey to storage using origin key

* Allow read entries with undefined name in addressbook

* Fix storing payload entries to local storage

* Test to stringify the complete localstorage

* Check if migration is already done and don't repeat

* Directly save current session to storage when setting local storage migrated

* Add logic to execute or skip migration

* Add migration reset when adding/updating safes or updating the address book

* Ensure that we send message only once

* Remove state dependency from useEffect, cleanup console.log and fix executeMigration

* Simplify condition check

* Set a defined target URL for post message

* Set example of production and staging urls

* Configure new testing environment

* Work in progress

* Work in progress

* Refactor

* Remove redundant localStorage store flags

* Remove log

* Update subdomain

* Track instead of log error

* Exclude mainnet from migration

* Remove mainnet check + add dependancy

* Rm isLocalStorageMigrated

* Load all iframes at once

* Subdomain URL

* Extract testable functions

* Add tests + types

* Cleaner typing

* Never import MAINNET keys

* Update the PR hostname

* Rm slash

* Take the network from the iframe

* Extract network from the origin

* Load iframes sequentially + add a timeout

* Polygon first

Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>
Co-authored-by: iamacook <aaron.cook@gnosis.pm>
Co-authored-by: katspaugh <381895+katspaugh@users.noreply.github.com>
@iamacook iamacook marked this pull request as ready for review October 25, 2021 11:14
@iamacook iamacook requested a review from katspaugh October 25, 2021 11:14
const implementation = useKnownAddress(txInfo.implementation?.value || ZERO_ADDRESS, {
name: txInfo.implementation?.name || undefined,
image: txInfo.implementation?.logoUri || undefined,
})
Copy link
Member

Choose a reason for hiding this comment

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

That's a bit of a boilerplate. Could we maybe modify useKnownAddress to fallback to ZERO_ADDRESS and undefined internally?

@coveralls
Copy link

coveralls commented Oct 25, 2021

Pull Request Test Coverage Report for Build 1393752427

  • 4 of 17 (23.53%) changed or added relevant lines in 8 files are covered.
  • 4 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.1%) to 31.242%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/routes/safe/components/Settings/SpendingLimit/InfoDisplay/ResetTimeInfo.tsx 1 2 50.0%
src/routes/safe/components/Settings/SpendingLimit/InfoDisplay/TokenInfo.tsx 1 2 50.0%
src/routes/safe/components/Transactions/TxList/hooks/useTransactionType.ts 0 1 0.0%
src/routes/safe/components/Transactions/TxList/TxInfoSettings.tsx 0 2 0.0%
src/routes/safe/components/Transactions/TxList/TxInfoCreation.tsx 0 3 0.0%
src/routes/safe/components/Transactions/TxList/TxInfoTransfer.tsx 0 5 0.0%
Files with Coverage Reduction New Missed Lines %
src/routes/safe/components/Settings/SpendingLimit/InfoDisplay/DataDisplay.tsx 1 0%
src/routes/safe/components/Transactions/TxList/TxInfoCreation.tsx 1 9.09%
src/routes/safe/components/Transactions/TxList/TxInfoSettings.tsx 2 1.92%
Totals Coverage Status
Change from base Build 1391841404: -0.1%
Covered Lines: 2932
Relevant Lines: 8352

💛 - Coveralls

@iamacook iamacook requested a review from katspaugh October 25, 2021 12:11
Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

Nice!

@liliya-soroka
Copy link
Member

liliya-soroka commented Oct 26, 2021

  • @iamacook , please remove changes for the send and incoming tx names in the list ( not expanded view)

image

Expected result: It should be "Send" and "Receive" as was before

@iamacook
Copy link
Member Author

* [x]  @iamacook , please remove changes for the send and incoming tx names in the list ( not expanded view)

image

Expected result: It should be "Send" and "Receive" as was before

I've changed it back.

@francovenica
Copy link
Contributor

So I took the new description the original ticket had:

Everything inside expanded transaction details regarding: safe creation, safe settings (transactions) and outgoing transactions requires known names added. Priority is given to address book entries, then known addresses returned by the /transactions endpoint.

So I assume that:
-any new owner that is added/removed/replaced,
-any new module,
-any outgoing tx like send funds
that has a known address should be shown in the tx expanded details.

Safe used:
https://pr2845--safereact.review-safe.gnosisdev.com/app/rin:0xa5A735e8f4B1830692230e3Be2c530249091efC4/transactions/history

Issue:
According to the documentation I had this 2 addresses are known addresses
0xf2565317F3Ae8Ae9EA98E9Fe1e7FADC77F823cbD (Lil's second safe)
0x65F8236309e5A99Ff0d129d04E486EBCE20DC7B0 (Named Owner 2)

I created a "Send funds" tx for both of them, but their names won't show up
image

@liliya-soroka Can you check if those addresses are still "known addresses"?

@iamacook
Copy link
Member Author

iamacook commented Oct 27, 2021

So I took the new description the original ticket had:

Everything inside expanded transaction details regarding: safe creation, safe settings (transactions) and outgoing transactions requires known names added. Priority is given to address book entries, then known addresses returned by the /transactions endpoint.

So I assume that: -any new owner that is added/removed/replaced, -any new module, -any outgoing tx like send funds that has a known address should be shown in the tx expanded details.

Safe used: https://pr2845--safereact.review-safe.gnosisdev.com/app/rin:0xa5A735e8f4B1830692230e3Be2c530249091efC4/transactions/history

Issue: According to the documentation I had this 2 addresses are known addresses 0xf2565317F3Ae8Ae9EA98E9Fe1e7FADC77F823cbD (Lil's second safe) 0x65F8236309e5A99Ff0d129d04E486EBCE20DC7B0 (Named Owner 2)

I created a "Send funds" tx for both of them, but their names won't show up image

@liliya-soroka Can you check if those addresses are still "known addresses"?

I've just tweaked the code and it should be working.

@iamacook iamacook marked this pull request as draft October 27, 2021 07:44
@iamacook iamacook requested a review from katspaugh October 27, 2021 08:04
@iamacook iamacook marked this pull request as ready for review October 27, 2021 08:04
Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

👍

@francovenica
Copy link
Contributor

Safe: https://pr2845--safereact.review-safe.gnosisdev.com/app/rin:0xa5A735e8f4B1830692230e3Be2c530249091efC4/transactions/history

Issue:
For owner add/replace/removal, the name is also missing.
Check this 2 tx, one is a send funds, where the name of the address is shown, but when added as an owner the name is not shown
image

@iamacook iamacook marked this pull request as draft October 27, 2021 14:49
@francovenica
Copy link
Contributor

@iamacook Ok, I've check other outgoing tx and enabling modules and they look fine.
You told me that it seems that for add/remove/replace owners you don't get the name information.

@iamacook iamacook marked this pull request as ready for review October 28, 2021 08:31
@iamacook
Copy link
Member Author

@iamacook Ok, I've check other outgoing tx and enabling modules and they look fine. You told me that it seems that for add/remove/replace owners you don't get the name information.

I've checked with the backend team and the names are not returned. Can we move this out of QA?

@github-actions
Copy link

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 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@github-actions
Copy link

E2E Tests Failed
Check the results here: https://github.com/gnosis/safe-react-e2e-tests/actions/runs/1393775082

Failed tests:

  • ❌ Safe Apps List Safe Apps List

@iamacook iamacook merged commit 64b6967 into dev Oct 28, 2021
@iamacook iamacook deleted the add-known-addresses-to-transaction-details branch October 28, 2021 12:42
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 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.

v2 Display human readable names for "Known" addresses
8 participants