Commit Graph

44 Commits

Author SHA1 Message Date
Stefan Dunca 112a6f3003
Connection fixes for v2.30.x (#15921)
* chore(dapps) remove the POC wallet connect

Updates: #15598

* fix(dapps) Wallet Connect internet connection reestablishing issue

Add a new NetworkChecker QObject to StatusQ to be used in checking
internet connection status. This is used by the WebEngineLoader
to only allow loading of web pages when there is an active internet
to cover for a corner case on MacOS where the internet connection is
not reestablished if the WebEngineView was loaded without an active
internet connection.

Closes: #15598, #15806

* chore(dapps) disable eth_signTransaction for Wallet Connect

Closes: #15661
2024-07-31 13:23:39 -04:00
Roman Chornii d7e3af8165
fix(dApps): Improved logic for disconnecting of dApps in the app. (#15819)
Closes: #15814
2024-07-29 12:46:03 -04:00
Stefan 7d0e77d86f fix(dapps) emoji in wallet connect uri error
Closes: #15594
2024-07-25 12:55:29 +02:00
Stefan f6ae5ceabe fix(dapps) Wallet Connect url validation
The static url validation state `Pairing.errors.ok` was directly
responsible for the validation action in UX. With current change
the validation is now based on the pairing response. When the
pairing response is received the UX is validated and after half second
UX is moved to the approval process (`ConnectedDAppModal`)

Closes: #15591
2024-07-25 12:55:29 +02:00
Stefan 597d4bac9f fix(dapps) unsupported protocol Wallet Connect corner case
We have no easy way to check the protocol and provide a customized
error message. Therefore we generalizes the error message to network
not supported.

Closes: #15649
2024-07-25 12:55:29 +02:00
Godfrain Jacques c2a8817a80
fix missing required param to fix sign request popup display (#15760) 2024-07-24 08:45:09 -07:00
Stefan 7fb241b964 fix(dapps): filter out dApps connected on other profiles
Add helper function to filter out dApps with sessions that don't
have any supported account in the available accounts list.
Use helper function to filter out dApps connected on other profiles
when listing dApps in the dApps list.
When disconnecting an app only disconnect sessions for the current
profile.

Closes: #14888, #15707
2024-07-24 13:24:05 +02:00
Stefan 35b7f0583d fix(dapps) don't show Wallet Connect state from other profiles
Ignore session requests events that include accounts in other profiles

Updates: #15707
2024-07-24 13:24:05 +02:00
Stefan dc43a40a76 fix(dapps) minor wallet connect fixes and improvements
Also

- don't report error in case of status-go returning nil instead
of an empty array.
- fix misleading alias to AmountsArithmetic
- minor improvements requested in previous discussions

Updates: #15707
2024-07-24 13:24:05 +02:00
Stefan e57f7552d9 feat(dapps) make wallet connect request data human readable
Notify user if he doesn't hold enough funds to make the transaction
Also check fees funds including the amount to be sent

Closes: #15192
2024-07-23 00:24:22 +02:00
Godfrain Jacques 347e0df8b0
feat(connector)_: add sign transaction flow (#15662)
fixes #15182

 - Implement the sign transaction popup for Accept or Rejecting
   transactions
2024-07-22 11:02:35 -07:00
Stefan 36e3a7cbb5 feat(dapps) check max fees against balance
Also differentiate between l1 and l2 fees and check them against the
specific chain balance

Also

- Included tests for the new functionality
- Fixed some inconsistencies in handling types

Updates: #15552
2024-07-22 16:20:07 +02:00
Godfrain Jacques 6eeb917cd7
feat(connector)_: create connection between connector service and status-desktop (#15565)
fix #15179 that triggers connection request from client

 - Setup the initial architecture for connecting Status-go and UI
   screens
 - Implement the request Connection popup for Accept or Rejecting
   connection
2024-07-19 12:21:36 -07:00
Lungu Cristian 05287c873a
fix(walletconnect)_: tx fees not sent (#15678) 2024-07-19 16:33:22 +03:00
Stefan 248ba1c1c8 feat(dapps): Add support for max fees in WalletConnect requests
Compute max fees for transaction related requests and display the
results to user.

Also:

- Add helper to convert from hex (backend) to decimal (frontend) values.
- Add helper to convert from float gwei to hex wei
- Update tests to accommodate for the new dependencies.

Sourcing of account balances is not included therefore the transaction is
allowed to go through even if the account balance is insufficient. An error
will be generated by the backend in this case.

Updates: #15192
2024-07-19 10:02:50 +02:00
Roman Chornii c4d930ef88
fix(dapps) fail to process a transaction if missing usual fields (#15481)
Updates: #15189

Co-authored-by: Stefan <stefand@status.im>
2024-07-15 12:23:35 +03:00
Stefan fae3d14d50 feat(dapps): fetch max fees per gas from blockchain if not provided
Updates: #15192
2024-07-12 15:39:41 +02:00
Stefan 4deea3461f feat(dapps): show estimated time for dApps requests
Implemented using the fees from the transaction data sent
by the dApp.

Also fixed the nim status go wrapper to send proper formatted
string as expected on the other side.

Updates: #15192
2024-07-12 15:39:41 +02:00
Alex Jbanca ca8a0028a8
feat(WalletConnect): Implement sign request modal (#15520)
* feat(WalletConnect): Implement sign request modal

1. Implementing sign request modal based on SignTransactionModalBase
2. Adding storybook page
3. Integrate it in the app
4. Removing DAppRequestModal
5. Update RoundImageWithBadge to preserve aspect ratio between badge and main image

* fix(WalletConnect): Remove unneeded properties from WalletConnectService API

Removing `selectedAccountAddress` and `loginType`. These properties are now passed through DAppsWorkflow API

* fix(WalletConnect): Removing unnecessary changes
2024-07-12 00:00:15 +03:00
Noelia bc74724672 refactor(Wallet/SendModal): Created `WalletAccountsAdaptor` to be used in `SendModal`
- Created data transformation file called `WalletAccountsAdaptor` for `SendModal`. Now it contains the owned wallet accounts model data transformations.
- Added common formatting method for short chain ids to some utils and partially removed backend dependency.
2024-07-11 14:05:55 +02:00
Stefan 136194c112 feat(dapp) handle pairing errors or timeout if no response
Found out while testing that in some corner cases there will be no
response of error in case of pairing. This is handled now by showing
a generic error message. The implementation is using a timer to handle
this case.
Extend the logic to report errors in the pairing process.

Closes #14676
2024-07-09 19:21:09 +02:00
Stefan 1e256c8bf1 feat(dapps) fail on Wallet Connect unsupported networks
Also extend the generic error handling of approval errors

Updates: #14676
2024-07-09 19:21:09 +02:00
Stefan 15b2c084d2 feat(dapps) check Wallet Connect pair uri for already used and expired
Refactor and bring all the error check back to services
Automate pairing procedure and move to the connect dialog
if uri was validated

Updates: #14676
2024-07-09 16:11:23 +02:00
Stefan 3049c6016b feat(dapps) extend and improve sign
Extend support for legacy `eth_sign` and `eth_signTypedData`
methods.
Keep the `eth_sign` using the legacy method for compatibility

Use the newly added status-go apis for a safer implementation
of signing typed data by providing chain validation.

Closes: #15361
2024-07-09 15:01:27 +02:00
Stefan dbd96133a5 feat(dapps) update persistance from the SDK on sessions refresh
Updates: #15189
2024-07-05 17:48:30 +02:00
Stefan 94dc7b04a5 feat(dapp) disconnect wallet connect dapps
Closes: #15189
2024-07-05 17:48:30 +02:00
Alex Jbanca 2f050a025f feat(WalletConnect): Fine-tune connect dApp modal
Changes:
1. Align dialog with Figma design
2. Add new components for round image with badge and connection status tag
3. Add tests
4. Dapps service will now receive wallet `RootStore` as input and reuse existing models with account balance and other necessary info for account selection and chain selection
5. Minor updates in stores
6. Minor updates in WC toast messages to display app domain instead of app url
2024-07-05 01:03:23 +03:00
Stefan 97413d99d1 feat(dapps) implement eth_sendTransaction support for wallet
Add `Fees` section to request modal

Closes: #15126
2024-07-02 09:24:09 +02:00
Stefan 8cca2664e4 fix(dapps): failure if case sensitivity mismatch in account address
Update: #15126
2024-06-26 12:00:54 +02:00
Stefan cb368ea5fb feat(dapps) fix missing list of dapps in wallet connect
Updates: #15126
2024-06-26 12:00:54 +02:00
Stefan 92d0420449 feat(dApps) implement sign transaction for wallet connect
Uses status-go's endpoints:
- `wallet_buildTransactions` to format the transaction
- `wallet_signMessage` to sign the transaction
- `wallet_buildRawTransaction` to format the final signed transaction

Updates #15126
2024-06-26 12:00:54 +02:00
Stefan dfe53c4c7c chore(dApps) support multiple actions in DAppRequestModal
Also fix minor issue and add improvements

Updates #15126
2024-06-26 12:00:54 +02:00
Alex Jbanca 8b4cbc59a8 refactor: Refactoring of AccountSelector dropdown
The new account selector expects a generic account model. It will display all the account data if provided, including preferred chains, balance or asset balance. Otherwise it will display only the available data.
The account selector can receive an initial selection based on account address and will provide the current selected address and the current selected model item.

- Unify the account selector between communities and wallet
- Update the account selector to work with addresses instead of model indexes
- Adapt all components using the account selector or the account selection
- Move/reuse qml components involved in the account selector UI
- Remove nim logic used to handle index based account selection.
- Adding storybook page
2024-06-20 11:24:35 +03:00
Stefan 758dbc55e5 feat(dapps) implement signing of messages
Implement infrastructure and integration with status-go to support
general session requests

Supported methods:
- personal_sign
- eth_signTypedData_v4

depends on status-go change that exposes the signing methods

Also

- support hex or utf8 encoding for personal_sign
- format the typed data for display in the modal

Tests are disabled for now, as they are crashing on CI

Close: #14927
2024-06-17 15:06:26 +02:00
Stefan 4d080e12aa feat(dapps) authenticate user for session request
Trigger authentication with identity of the request
Track the authentication using the identity and allow only once
Add tests for the new functionality
Minor improvements around the code

Closes #15018
2024-06-12 16:52:12 +02:00
Stefan f5b46d6972 feat(dapps) implements responding to wallet connect requests
For start support showing sign message only
Support rejecting the request
Storybook integration
Add disabled tests for the main logic and sanity UI tests.
They crash on CI only and work locally on mac. Postponed finding out why
for now.

Closes: #14927
2024-06-12 15:44:53 +02:00
Stefan 145053e34f chore(dapps) implement service tests and basic workflow tests
Abstract WalletConnectSDK to make it testable
Implement WC service pairing test
Bring back DAppsWorkflow tests back to life and add a pair modal test

Updates: #14927
2024-06-12 15:44:53 +02:00
Stefan 35b81eadf6 feat(dapps): show dapps list in wallet connect popup
Things done here:

Integrate basic functionality for wallet connect in status-go
Update the list of dapps from the SDK
Retrieve the persistence dapps list from the backend as a fallback
if there is no connection and SDK can't be initialized
Provide a basic simple view of dapps in the wallet connect popup

Closes: #14557
2024-05-30 10:57:42 +02:00
Stefan 07bc6c49df feat(dapps) attempt to fix the wallet connect abstraction
Spent too much time figuring out the puzzle of
service->module->view->QML just to call a
status-go function.

Keeping this attempt for later while moving to a
simplified Controller/Provider approach. I will
come back to the abstraction when we add tests
to use it.

Updates: #14615
2024-05-30 10:57:42 +02:00
Stefan ea2b6b2ed7 chore(dapps) move responsibility of tracking sessions from WC SDK
Updates: #14615
2024-05-30 10:57:42 +02:00
Stefan 0cf41a60cb chore(dapp) update SDK interface and the generated code
Updates: #14615
2024-05-30 10:57:42 +02:00
Stefan 08a1e10f59 feat(dapps) add toast notifications for Wallet Connect paring
Updates: #14754
2024-05-20 17:13:30 +02:00
Stefan ee72ec7aee feat(dapps) add DAppsService component and ConnectDAppModal
Implement the initial Pairing user workflow and disconnect option for
the first session.

Also

- rename pairing modal accordingly (`PairWCModal.qml`) to make room for the proper
`ConnectDAppModal.qml`
- basic tests for service helpers
- update storybook to reflect the new user workflows

Closes #14607
2024-05-20 15:09:57 +02:00
Stefan 78775d3d69 chore(dapps) move wallet connect service code outside popups
Updates: #14607
2024-05-20 15:09:57 +02:00