From 1e256c8bf146cac356c15d25021cf6b62ae0ec01 Mon Sep 17 00:00:00 2001 From: Stefan Date: Mon, 8 Jul 2024 13:40:43 +0300 Subject: [PATCH] feat(dapps) fail on Wallet Connect unsupported networks Also extend the generic error handling of approval errors Updates: #14676 --- .../Wallet/services/dapps/WalletConnectService.qml | 7 ++++++- ui/app/AppLayouts/Wallet/services/dapps/types/Pairing.qml | 2 ++ .../shared/popups/walletconnect/PairWCModal/WCUriInput.qml | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/app/AppLayouts/Wallet/services/dapps/WalletConnectService.qml b/ui/app/AppLayouts/Wallet/services/dapps/WalletConnectService.qml index 3461e276a4..4d2ba05128 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/WalletConnectService.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/WalletConnectService.qml @@ -131,7 +131,12 @@ QObject { function onBuildApprovedNamespacesResult(approvedNamespaces, error) { if(error) { - // TODO: error reporting + // Check that it contains Non conforming namespaces" + if (error.includes("Non conforming namespaces")) { + root.pairingUriValidated(Pairing.uriErrors.unsupportedNetwork) + } else { + root.pairingUriValidated(Pairing.uriErrors.unknownError) + } return } diff --git a/ui/app/AppLayouts/Wallet/services/dapps/types/Pairing.qml b/ui/app/AppLayouts/Wallet/services/dapps/types/Pairing.qml index b64901a046..140e76bf20 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/types/Pairing.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/types/Pairing.qml @@ -10,5 +10,7 @@ QtObject { readonly property int invalidUri: 3 readonly property int alreadyUsed: 4 readonly property int expired: 5 + readonly property int unsupportedNetwork: 6 + readonly property int unknownError: 7 } } \ No newline at end of file diff --git a/ui/imports/shared/popups/walletconnect/PairWCModal/WCUriInput.qml b/ui/imports/shared/popups/walletconnect/PairWCModal/WCUriInput.qml index 6c60e08d06..2fff98de55 100644 --- a/ui/imports/shared/popups/walletconnect/PairWCModal/WCUriInput.qml +++ b/ui/imports/shared/popups/walletconnect/PairWCModal/WCUriInput.qml @@ -48,6 +48,12 @@ ColumnLayout { } if (errorText.text.length > 0) { return false + } else if(root.errorState === Pairing.uriErrors.unsupportedNetwork) { + errorText.text = qsTr("dApp is requesting to connect on an unsupported network") + return false + } else if(root.errorState === Pairing.uriErrors.unknownError) { + errorText.text = qsTr("Unexpected error occurred, please try again") + return false } return true