diff --git a/storybook/qmlTests/tests/tst_DAppsWorkflow.qml b/storybook/qmlTests/tests/tst_DAppsWorkflow.qml index e3e6a7e2fb..e494c9e5b5 100644 --- a/storybook/qmlTests/tests/tst_DAppsWorkflow.qml +++ b/storybook/qmlTests/tests/tst_DAppsWorkflow.qml @@ -51,7 +51,7 @@ Item { const requestItem = testCase.createTemporaryObject(sessionRequestComponent, root, { event: requestObj, topic, - id: requestObj.id, + requestId: requestObj.id, method: Constants.personal_sign, accountAddress: account, chainId: network, @@ -314,7 +314,7 @@ Item { compare(handler.store.authenticateUserCalls.length, 1, "expected a call to store.authenticateUser") let store = handler.store - store.userAuthenticated(td.topic, td.request.id, "hello world", "") + store.userAuthenticated(td.topic, td.request.requestId, "hello world", "") compare(store.signMessageCalls.length, 1, "expected a call to store.signMessage") compare(store.signMessageCalls[0].message, td.request.data) } diff --git a/ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml b/ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml index 0c51e8482c..47386a8f38 100644 --- a/ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml +++ b/ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml @@ -297,7 +297,7 @@ DappsComboBox { return } requestHandled = true - root.signRequestRejected(request.topic, request.id) + root.signRequestRejected(request.topic, request.requestId) } parent: root @@ -347,7 +347,7 @@ DappsComboBox { hasExpiryDate: !!request.expirationTimestamp onOpened: { - root.subscribeForFeeUpdates(request.topic, request.id) + root.subscribeForFeeUpdates(request.topic, request.requestId) } onClosed: { @@ -356,7 +356,7 @@ DappsComboBox { onAccepted: { requestHandled = true - root.signRequestAccepted(request.topic, request.id) + root.signRequestAccepted(request.topic, request.requestId) } onRejected: { diff --git a/ui/app/AppLayouts/Wallet/services/dapps/DAppsRequestHandler.qml b/ui/app/AppLayouts/Wallet/services/dapps/DAppsRequestHandler.qml index 0e727f99a0..3b9133b27c 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/DAppsRequestHandler.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/DAppsRequestHandler.qml @@ -309,7 +309,7 @@ SQUtils.QObject { let obj = sessionRequestComponent.createObject(null, { event, topic: event.topic, - id: event.id, + requestId: event.id, method, accountAddress, chainId, @@ -317,7 +317,6 @@ SQUtils.QObject { preparedData: interpreted.preparedData, maxFeesText: "?", maxFeesEthText: "?", - enoughFunds: enoughFunds, expirationTimestamp: requestExpiry }) if (obj === null) { @@ -338,7 +337,7 @@ SQUtils.QObject { } obj.resolveDappInfoFromSession(session) - root.sessionRequest(obj.id) + root.sessionRequest(obj.requestId) d.updateFeesParamsToPassedObj(obj) }) @@ -498,24 +497,24 @@ SQUtils.QObject { function executeSessionRequest(request, password, pin, payload) { if (!SessionRequest.getSupportedMethods().includes(request.method)) { console.error("Unsupported method to execute: ", request.method) - return + return false } if (password === "") { console.error("No password provided to sign message") - return + return false } if (request.method === SessionRequest.methods.sign.name) { store.signMessageUnsafe(request.topic, - request.id, + request.requestId, request.accountAddress, SessionRequest.methods.personalSign.getMessageFromData(request.data), password, pin) } else if (request.method === SessionRequest.methods.personalSign.name) { store.signMessage(request.topic, - request.id, + request.requestId, request.accountAddress, SessionRequest.methods.personalSign.getMessageFromData(request.data), password, @@ -525,7 +524,7 @@ SQUtils.QObject { { let legacy = request.method === SessionRequest.methods.signTypedData.name store.safeSignTypedData(request.topic, - request.id, + request.requestId, request.accountAddress, SessionRequest.methods.signTypedData.getMessageFromData(request.data), request.chainId, @@ -554,7 +553,7 @@ SQUtils.QObject { if (request.method === SessionRequest.methods.signTransaction.name) { store.signTransaction(request.topic, - request.id, + request.requestId, request.accountAddress, request.chainId, txObj, @@ -563,7 +562,7 @@ SQUtils.QObject { } else if (request.method === SessionRequest.methods.sendTransaction.name) { store.sendTransaction( request.topic, - request.id, + request.requestId, request.accountAddress, request.chainId, txObj, @@ -571,6 +570,8 @@ SQUtils.QObject { pin) } } + + return true } // Returns Constants.TransactionEstimatedTime diff --git a/ui/app/AppLayouts/Wallet/services/dapps/DappsConnectorSDK.qml b/ui/app/AppLayouts/Wallet/services/dapps/DappsConnectorSDK.qml index 25cea60f6d..f9c7d76436 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/DappsConnectorSDK.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/DappsConnectorSDK.qml @@ -86,7 +86,7 @@ WalletConnectSDKBase { let obj = sessionRequestComponent.createObject(null, { event, topic: event.topic, - id: event.id, + requestId: event.id, method, accountAddress, chainId, @@ -94,7 +94,7 @@ WalletConnectSDKBase { preparedData: interpreted.preparedData, maxFeesText: "?", maxFeesEthText: "?", - enoughFunds: enoughFunds + haveEnoughFunds: enoughFunds }) if (obj === null) { @@ -133,14 +133,14 @@ WalletConnectSDKBase { let maxFeesString = maxFees.toString() obj.maxFeesText = maxFeesString obj.maxFeesEthText = maxFeesString - obj.enoughFunds = true + obj.haveEnoughFunds = true } else { let gasPrice = hexToGwei(tx.gasPrice) let maxFees = BigOps.times(gasLimit, gasPrice) let maxFeesString = maxFees.toString() obj.maxFeesText = maxFeesString obj.maxFeesEthText = maxFeesString - obj.enoughFunds = true + obj.haveEnoughFunds = true } } @@ -364,14 +364,14 @@ WalletConnectSDKBase { if (request.method === SessionRequest.methods.sign.name) { store.signMessageUnsafe(request.topic, - request.id, + request.requestId, request.accountAddress, SessionRequest.methods.personalSign.getMessageFromData(request.data), password, pin) } else if (request.method === SessionRequest.methods.personalSign.name) { store.signMessage(request.topic, - request.id, + request.requestId, request.accountAddress, SessionRequest.methods.personalSign.getMessageFromData(request.data), password, @@ -381,7 +381,7 @@ WalletConnectSDKBase { { let legacy = request.method === SessionRequest.methods.signTypedData.name store.safeSignTypedData(request.topic, - request.id, + request.requestId, request.accountAddress, SessionRequest.methods.signTypedData.getMessageFromData(request.data), request.chainId, @@ -391,7 +391,7 @@ WalletConnectSDKBase { } else if (request.method === SessionRequest.methods.signTransaction.name) { let txObj = SessionRequest.methods.signTransaction.getTxObjFromData(request.data) store.signTransaction(request.topic, - request.id, + request.requestId, request.accountAddress, request.chainId, txObj, @@ -399,9 +399,9 @@ WalletConnectSDKBase { pin) } else if (request.method === SessionRequest.methods.sendTransaction.name) { store.sendTransaction(request.topic, - request.id, - request.account.address, - request.network.chainId, + request.requestId, + request.accountAddress, + request.chainId, request.data.tx, password, pin) @@ -445,7 +445,7 @@ WalletConnectSDKBase { } function authenticate(request) { - return store.authenticateUser(request.topic, request.id, request.account.address) + return store.authenticateUser(request.topic, request.requestId, request.accountAddress) } } @@ -545,14 +545,14 @@ WalletConnectSDKBase { id: dappRequestModal objectName: "connectorDappsRequestModal" - readonly property var account: accountEntry.available ? accountEntry.model : { + readonly property var account: accountEntry.available ? accountEntry.item : { "address": "", "name": "", "emoji": "", "colorId": 0 } - readonly property var network: networkEntry.available ? networkEntry.model : { + readonly property var network: networkEntry.available ? networkEntry.item : { "chainId": 0, "chainName": "", "iconUrl": "" @@ -580,8 +580,8 @@ WalletConnectSDKBase { estimatedTime: "" feesLoading: !request.maxFeesText || !request.maxFeesEthText hasFees: signingTransaction - enoughFundsForTransaction: request.enoughFunds - enoughFundsForFees: request.enoughFunds + enoughFundsForTransaction: request.haveEnoughFunds + enoughFundsForFees: request.haveEnoughFunds signingTransaction: request.method === SessionRequest.methods.signTransaction.name || request.method === SessionRequest.methods.sendTransaction.name diff --git a/ui/app/AppLayouts/Wallet/services/dapps/types/SessionRequestResolved.qml b/ui/app/AppLayouts/Wallet/services/dapps/types/SessionRequestResolved.qml index e782bb2a6f..7de116cdba 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/types/SessionRequestResolved.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/types/SessionRequestResolved.qml @@ -17,7 +17,7 @@ QObject { /// dApp request data required property string topic - required property string id + required property string requestId required property string method required property string accountAddress required property string chainId diff --git a/ui/app/AppLayouts/Wallet/services/dapps/types/SessionRequestsModel.qml b/ui/app/AppLayouts/Wallet/services/dapps/types/SessionRequestsModel.qml index 43888495d1..df12b386ed 100644 --- a/ui/app/AppLayouts/Wallet/services/dapps/types/SessionRequestsModel.qml +++ b/ui/app/AppLayouts/Wallet/services/dapps/types/SessionRequestsModel.qml @@ -5,7 +5,7 @@ ListModel { id: root function enqueue(request) { - root.append({requestId: request.id, requestItem: request}); + root.append({requestId: request.requestId, requestItem: request}); } function dequeue() { @@ -20,7 +20,7 @@ ListModel { function removeRequest(topic, id) { for (var i = 0; i < root.count; i++) { let entry = root.get(i).requestItem - if (entry.topic == topic && entry.id == id) { + if (entry.topic == topic && entry.requestId == id) { root.remove(i, 1); return; } @@ -31,7 +31,7 @@ ListModel { function findRequest(topic, id) { for (var i = 0; i < root.count; i++) { let entry = root.get(i).requestItem - if (entry.topic == topic && entry.id == id) { + if (entry.topic == topic && entry.requestId == id) { return entry; } } @@ -42,7 +42,7 @@ ListModel { function findById(id) { for (var i = 0; i < root.count; i++) { let entry = root.get(i).requestItem - if (entry.id == id) { + if (entry.requestId == id) { return entry; } }