status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
301 stars 79 forks source link

Feat(DApps): Refactoring wallet connect service and bring BrowserConnect inline with WC #16730

Closed alexjba closed 2 days ago

alexjba commented 2 weeks ago

What does the PR do

Closes: #16044 #15936 #15711

Needs status-go PR: https://github.com/status-im/status-go/pull/6051

This is the final PR in the dapps refactoring. At this point the WalletConnect and BrowserConnect is using the same UI and the same qml processing. From this point on we can bring BrowserConnect to the same level of feature completeness as WalletConnect by translating the store signals to SDK events in the DAppsConnectorSDK or by reusing the necessary plugins.

The goal of this PR is to refactor the dapps service to be used by both WalletConnect and BrowserConnect. This is achieved by breaking up the DAppsRequestHandler into multiple plugins with a well defined responsibility. All the previous logic has been moved to each specific plugin with small adaptations. The plugins will process specific events from the SDK interface. As a result we have different plugins to manage the sessions, sign requests, siwe and so on.

  1. https://github.com/status-im/status-desktop/pull/16730/commits/417ce05eb4fa647f2880a6283cdab8d172b4d940 - Unify dapp sessions between Wallet Connect and Browser Connect
  2. https://github.com/status-im/status-desktop/pull/16730/commits/e74fe0076370def7b838e0dbff409c9364b0fb70 - Unify dapp signing between WalletConnect and Browser Connect

Next step for later: Refactor the test_DAppsWorkflow.qml. Currently it's testing everything E2E. But now we have the component separation needed to test everything in isolation.

Affected areas

Wallet Connect Browser Connect

Architecture compliance

Screenshot of functionality (including design for comparison)

status-im-auto commented 2 weeks ago

Jenkins Builds

Click to see older builds (19) | :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result | |-|-|-|-|-|-|-| | :heavy_check_mark: | e74fe007 | [#1](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-nim/job/PR-16730/1/) | 2024-11-07 09:32:09 | ~6 min | `tests/nim` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-nim/job/PR-16730/1//consoleText) | | :heavy_check_mark: | e74fe007 | [#1](https://ci.status.im/job/status-desktop/job/prs/job/macos/job/aarch64/job/package/job/PR-16730/1/) | 2024-11-07 09:32:13 | ~6 min | `macos/aarch64` | [:apple:`dmg`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-092518-e74fe0-pr16730-aarch64.dmg) | | :x: | e74fe007 | [#1](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-ui/job/PR-16730/1/) | 2024-11-07 09:35:42 | ~10 min | `tests/ui` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-ui/job/PR-16730/1/consoleText) | | :heavy_check_mark: | e74fe007 | [#1](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/package/job/PR-16730/1/) | 2024-11-07 09:44:29 | ~19 min | `linux/x86_64` | [:package:`tgz`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-092515-e74fe0-pr16730-x86_64.tar.gz) | | :heavy_check_mark: | e74fe007 | [#1](https://ci.status.im/job/status-desktop/job/prs/job/macos/job/x86_64/job/package/job/PR-16730/1/) | 2024-11-07 09:44:40 | ~19 min | `macos/x86_64` | [:apple:`dmg`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-092519-e74fe0-pr16730-x86_64.dmg) | | :heavy_check_mark: | e74fe007 | [#1](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/package-nix/job/PR-16730/1/) | 2024-11-07 09:47:15 | ~22 min | `linux-nix/x86_64` | [:package:`tgz`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-092514-e74fe0-pr16730-x86_64.nix.tar.gz) | | :heavy_check_mark: | e74fe007 | [#1](https://ci.status.im/job/status-desktop/job/prs/job/windows/job/x86_64/job/package/job/PR-16730/1/) | 2024-11-07 09:53:38 | ~28 min | `windows/x86_64` | [:cd:`exe`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-092521-e74fe0-pr16730-x86_64.exe) | | :x: | e74fe007 | [#2](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-ui/job/PR-16730/2/) | 2024-11-07 10:04:05 | ~9 min | `tests/ui` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-ui/job/PR-16730/2/consoleText) | | :heavy_check_mark: | e74fe007 | [#2](https://ci.status.im/job/status-desktop/job/prs/job/macos/job/aarch64/job/package/job/PR-16730/2/) | 2024-11-07 12:18:26 | ~4 min | `macos/aarch64` | [:apple:`dmg`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-121346-e74fe0-pr16730-aarch64.dmg) | | :x: | e74fe007 | [#2](https://ci.status.im/job/status-desktop/job/prs/job/windows/job/x86_64/job/package/job/PR-16730/2/) | 2024-11-07 12:20:24 | ~6 min | `windows/x86_64` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/windows/job/x86_64/job/package/job/PR-16730/2/consoleText) | | :heavy_check_mark: | e74fe007 | [#2](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-nim/job/PR-16730/2/) | 2024-11-07 12:20:50 | ~7 min | `tests/nim` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-nim/job/PR-16730/2//consoleText) | | :x: | e74fe007 | [#3](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-ui/job/PR-16730/3/) | 2024-11-07 12:23:54 | ~10 min | `tests/ui` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-ui/job/PR-16730/3/consoleText) | | | | | | | | | | :heavy_check_mark: | b6aae86f | [#3](https://ci.status.im/job/status-desktop/job/prs/job/macos/job/aarch64/job/package/job/PR-16730/3/) | 2024-11-07 12:31:19 | ~4 min | `macos/aarch64` | [:apple:`dmg`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-122628-b6aae8-pr16730-aarch64.dmg) | | :x: | b6aae86f | [#3](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/package-nix/job/PR-16730/3/) | 2024-11-07 12:31:23 | ~4 min | `linux-nix/x86_64` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/package-nix/job/PR-16730/3/consoleText) | | :heavy_check_mark: | b6aae86f | [#3](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-nim/job/PR-16730/3/) | 2024-11-07 12:33:33 | ~7 min | `tests/nim` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-nim/job/PR-16730/3//consoleText) | | :x: | b6aae86f | [#4](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-ui/job/PR-16730/4/) | 2024-11-07 12:36:59 | ~10 min | `tests/ui` | [:page_facing_up:`log`](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/tests-ui/job/PR-16730/4/consoleText) | | :heavy_check_mark: | b6aae86f | [#3](https://ci.status.im/job/status-desktop/job/prs/job/linux/job/x86_64/job/package/job/PR-16730/3/) | 2024-11-07 12:44:13 | ~17 min | `linux/x86_64` | [:package:`tgz`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-122624-b6aae8-pr16730-x86_64.tar.gz) | | :heavy_check_mark: | b6aae86f | [#3](https://ci.status.im/job/status-desktop/job/prs/job/macos/job/x86_64/job/package/job/PR-16730/3/) | 2024-11-07 12:44:33 | ~18 min | `macos/x86_64` | [:apple:`dmg`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-122629-b6aae8-pr16730-x86_64.dmg) | | :heavy_check_mark: | b6aae86f | [#3](https://ci.status.im/job/status-desktop/job/prs/job/windows/job/x86_64/job/package/job/PR-16730/3/) | 2024-11-07 12:51:14 | ~24 min | `windows/x86_64` | [:cd:`exe`](https://status-im-desktop-prs.ams3.cdn.digitaloceanspaces.com/StatusIm-Desktop-241107-122631-b6aae8-pr16730-x86_64.exe) |
:grey_question: Commit :hash: Finished (UTC) Duration Platform Result
:heavy_check_mark: 698cbeeb #4 2024-11-08 14:52:41 ~4 min macos/aarch64 :apple:dmg
:heavy_check_mark: 698cbeeb #4 2024-11-08 14:55:30 ~7 min tests/nim :page_facing_up:log
:x: 698cbeeb #5 2024-11-08 14:57:24 ~9 min tests/ui :page_facing_up:log
:heavy_check_mark: 698cbeeb #4 2024-11-08 15:03:17 ~15 min macos/x86_64 :apple:dmg
:heavy_check_mark: 698cbeeb #4 2024-11-08 15:04:15 ~16 min linux/x86_64 :package:tgz
:heavy_check_mark: 698cbeeb #4 2024-11-08 15:05:30 ~17 min linux-nix/x86_64 :package:tgz
:heavy_check_mark: 698cbeeb #4 2024-11-08 15:12:33 ~24 min windows/x86_64 :cd:exe
:x: 698cbeeb #6 2024-11-08 15:22:56 ~10 min tests/ui :page_facing_up:log
:heavy_check_mark: 00fb1ff6 #5 2024-11-08 22:44:09 ~4 min macos/aarch64 :apple:dmg
:heavy_check_mark: 00fb1ff6 #5 2024-11-08 22:46:48 ~7 min tests/nim :page_facing_up:log
:heavy_check_mark: 00fb1ff6 #7 2024-11-08 22:51:54 ~12 min tests/ui :page_facing_up:log
:heavy_check_mark: 00fb1ff6 #5 2024-11-08 22:53:34 ~14 min macos/x86_64 :apple:dmg
:heavy_check_mark: 00fb1ff6 #5 2024-11-08 22:57:01 ~17 min linux/x86_64 :package:tgz
:heavy_check_mark: 00fb1ff6 #5 2024-11-08 22:58:34 ~19 min linux-nix/x86_64 :package:tgz
:heavy_check_mark: 00fb1ff6 #5 2024-11-08 23:02:07 ~22 min windows/x86_64 :cd:exe
alexjba commented 1 week ago

@virginiabalducci This PR brings session management for BC and aligns the send_transaction with the WC flows. What should we see here for BC is that:

  1. BC complies with the WC session management https://www.notion.so/I-want-to-see-my-connected-dApps-139abf76a4744bb196eb080de49f7959?pvs=4
  2. BC send transaction works as before
  3. No WC regressions. There's no updated flow on WC side, just refactored the code.