status-desktop/ui/app/AppLayouts/Wallet/services/dapps
Alex Jbanca 7603f24372 refactor: Remove business logic from WC ui components
This commit brings a separation of concerns for the UI components involved in dApp interactions.

Issue: The UI components depend on the WalletConnectService and also on its dependencies like DAppsRequestHAndler. As a result the UI components have a hard dependency on the WalletConnect specifics and are incompatible with BC. This results in duplication of logic.
Issue: The UI components operate on WalletConnect specific JSON object. E.g. session objects, session proposal etc. As a result the UI is built around the WalletConnect message format.
Issue: The UI components operate on ListModel items received through functions and stored internally. Any change in the model would result in a crash.
Solution: Remove the WalletConnectService dependency from DAppsWorkflow. The DAppsWorkflow now operates with models, signals and functions. This is the first step in the broader refactoring. Moving the logic into the service itself will allow us to further refactor the WC and BC.

How does it work now:

Dependencies - The UI components have a dependency on models. SessionRequestsModel and DAppsModel.
Pairing - The pairing is initiated in the UI. On user input a pairingValidationRequested signal is emitted and the result is received as a function pairingValidated. If the url is valid the UI requests a pairingRequested. When the WalletConnectService is refactored we can go further and request only pairingRequested and to receive a pairingResult call as a function with the result. In the current implementation on pairingRequested we'll receive a connectDApp request.
Connecting dApps - The flow is initiated with connectDApp function. This call currently contains all the needed info as args. In the next step it could be replaced with a ConnectionRequests model. The connectDApp call triggered a connection popup if we're not currently showing one to the user. If we're currently showing one it will be queued (corner case). The connection can be accepted with connectionAccepted and rejected with connectionDeclined. Once the connection is accepted we're expecting a result connectionSuccessful or connectionFailed. The connectionSuccessful also expects a new id for the established connection.
Signing - The signing flow orbits around the SessionRequestsModel. Each item from the model will generate a popup showing the sign details to the user. Sign can be accepted or rejected using signRequestAccepted or signRequestRejected. No response is currently expected. The model is expected to remove the sign request item.
2024-10-09 13:32:53 +03:00
..
sdk chore(dapps) remove unused Wallet Connect authentication from the SDK 2024-07-31 14:08:16 +02:00
types refactor: Remove business logic from WC ui components 2024-10-09 13:32:53 +03:00
ConnectorDAppsListProvider.qml refactor: Remove business logic from WC ui components 2024-10-09 13:32:53 +03:00
DAppsListProvider.qml refactor: Remove business logic from WC ui components 2024-10-09 13:32:53 +03:00
DAppsRequestHandler.qml refactor: Remove business logic from WC ui components 2024-10-09 13:32:53 +03:00
DappsConnectorSDK.qml refactor: Remove business logic from WC ui components 2024-10-09 13:32:53 +03:00
WalletConnectSDK.qml refactor: Remove business logic from WC ui components 2024-10-09 13:32:53 +03:00
WalletConnectSDKBase.qml refactor: Remove business logic from WC ui components 2024-10-09 13:32:53 +03:00
WalletConnectService.qml refactor: Remove business logic from WC ui components 2024-10-09 13:32:53 +03:00
helpers.js fix(WalletConnect): Fixing sign for uniswap and paraswap 2024-08-26 11:41:27 +03:00
qmldir feature(connector)_: Add model join to handle connected dApps (#15954) 2024-08-06 13:20:08 -07:00