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

Conversation

@yagopv
Copy link
Member

@yagopv yagopv commented Mar 11, 2022

What it solves

Resolves safe-global/safe-apps-sdk#301, resolves safe-global/safe-react-apps#374

How this PR fixes it

We are doing 2 different things here:

  1. Adding a new method getCommunicationInfo() used by returning some info about the communicator. By now we are returning the origin as we need it in the walletConnect app and is difficult to get it inside an iframe (Current approach ancestorOrigins is not supported on Firefox

  2. We are including a new property isReadOnly on the SafeInfo object allowing as to know safe apps if the safe-web is on READ-ONLY mode

⚠️ Build going to fail until I update the pending SDK version with the methods and types ⚠️

@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Mar 11, 2022

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

@coveralls
Copy link

coveralls commented Mar 11, 2022

Pull Request Test Coverage Report for Build 1981898496

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • 29 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.02%) to 34.849%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/routes/safe/components/Apps/components/AppFrame.tsx 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
src/routes/safe/components/Apps/components/AppFrame.tsx 2 0%
src/components/AppLayout/Header/components/ProviderDetails/PairingDetails.tsx 3 0%
src/components/AppLayout/Header/components/ProviderDetails/ConnectDetails.tsx 4 0%
src/components/AppLayout/Header/index.tsx 20 0%
Totals Coverage Status
Change from base Build 1969206373: -0.02%
Covered Lines: 3375
Relevant Lines: 8776

💛 - Coveralls

Copy link
Contributor

@iamacook iamacook left a comment

Choose a reason for hiding this comment

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

👍

chainId: parseInt(chainId, 10),
owners,
threshold,
isReadOnly: !granted,
Copy link
Member

@katspaugh katspaugh Mar 11, 2022

Choose a reason for hiding this comment

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

Non-owners can still execute txns, so it's not 100% read-only.
Maybe isOwnedByMe: granted would be more descriptive?

Copy link
Member Author

@yagopv yagopv Mar 11, 2022

Choose a reason for hiding this comment

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

mmm could be, naming came from a conversation with Dani. WDYT @dasanra?

Copy link
Contributor

Choose a reason for hiding this comment

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

Apps rather propose transactions than execute them, the nonowner cannot propose a transaction

Copy link
Member Author

Choose a reason for hiding this comment

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

So what's the better option ? For me if nonowners cannot propose transactions isReadOnly could be fine as well in the safe-apps context

Copy link
Contributor

Choose a reason for hiding this comment

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

This matches the Safe. We always show the read only warning if a user is not 'granted'.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, this isReadOnly is inspired as the Safe in the interface is shown as "Read Only" mode. The other name that could fit would be isOwnerConnected as we are trying to allow the apps to know if the owner is connected, so they can distinguish if that transaction could only be simulated or sent to be executed, either at that moment or later

Copy link
Contributor

Choose a reason for hiding this comment

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

if the interface ever starts supporting delegates, isOwnerConnected may become non-relevant

Copy link
Collaborator

@dasanra dasanra Mar 14, 2022

Choose a reason for hiding this comment

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

So, yes in this case the most relevant is to know if transaction could be sent or not, so isReadOnly should be good

@github-actions
Copy link

Deployment links

🟠 Rinkeby Mainnet 🟣 Polygon 🟡 BSC Arbitrum 🟢 Gnosis Chain

@yagopv yagopv merged commit b446ca5 into dev Mar 15, 2022
@yagopv yagopv deleted the feature/add-communication-info-method-support branch March 15, 2022 09:08
@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2022
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.

Add a method to return when a Safe is on READ_ONLY mode [WalletConnect] Not redirecting to app on Firefox

7 participants