From a97f8b06dd3ed4a8afda2decfb2377a13661555d Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Fri, 5 Jun 2026 00:14:43 -0300 Subject: [PATCH] add deshielded tab --- src/LEZWalletBackend.cpp | 7 +++++++ src/LEZWalletBackend.h | 1 + src/LEZWalletBackend.rep | 1 + src/qml/ExecutionZoneWalletView.qml | 9 +++++++++ src/qml/views/DashboardView.qml | 2 ++ src/qml/views/TransferPanel.qml | 23 ++++++++++++++++------- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/LEZWalletBackend.cpp b/src/LEZWalletBackend.cpp index e4b007c..f2f9f46 100644 --- a/src/LEZWalletBackend.cpp +++ b/src/LEZWalletBackend.cpp @@ -260,6 +260,13 @@ QString LEZWalletBackend::transferShieldedOwned(QString fromHex, QString toHex, return m_logos->logos_execution_zone.transfer_shielded_owned(fromHex, toHex.trimmed(), amountHex); } +QString LEZWalletBackend::transferDeshielded(QString fromHex, QString toHex, QString amountStr) +{ + const QString amountHex = amountToLe16Hex(amountStr); + if (amountHex.isEmpty()) return QStringLiteral("Error: Invalid amount."); + return m_logos->logos_execution_zone.transfer_deshielded(fromHex.trimmed(), toHex.trimmed(), amountHex); +} + bool LEZWalletBackend::createNew(QString configPath, QString storagePath, QString password) { const QString localPath = toLocalPath(configPath); diff --git a/src/LEZWalletBackend.h b/src/LEZWalletBackend.h index d6658ed..17c2cda 100644 --- a/src/LEZWalletBackend.h +++ b/src/LEZWalletBackend.h @@ -44,6 +44,7 @@ public slots: QString transferPrivateOwned(QString fromHex, QString toHex, QString amountStr) override; QString transferShielded(QString fromHex, QString toKeysJson, QString amountStr) override; QString transferShieldedOwned(QString fromHex, QString toHex, QString amountStr) override; + QString transferDeshielded(QString fromHex, QString toHex, QString amountStr) override; bool createNew(QString configPath, QString storagePath, QString password) override; void copyToClipboard(QString text) override; diff --git a/src/LEZWalletBackend.rep b/src/LEZWalletBackend.rep index 695958f..0bd0a33 100644 --- a/src/LEZWalletBackend.rep +++ b/src/LEZWalletBackend.rep @@ -21,6 +21,7 @@ class LEZWalletBackend SLOT(QString transferPrivateOwned(QString fromHex, QString toHex, QString amountStr)) SLOT(QString transferShielded(QString fromHex, QString toKeysJson, QString amountStr)) SLOT(QString transferShieldedOwned(QString fromHex, QString toHex, QString amountStr)) + SLOT(QString transferDeshielded(QString fromHex, QString toHex, QString amountStr)) SLOT(bool createNew(QString configPath, QString storagePath, QString password)) diff --git a/src/qml/ExecutionZoneWalletView.qml b/src/qml/ExecutionZoneWalletView.qml index aa49340..38fb435 100644 --- a/src/qml/ExecutionZoneWalletView.qml +++ b/src/qml/ExecutionZoneWalletView.qml @@ -202,6 +202,15 @@ Rectangle { dashboardView.transferResultIsError = true }) } + onTransferDeshieldedRequested: (fromId, toAccountId, amount) => { + if (!backend) return + logos.watch(backend.transferDeshielded(fromId, toAccountId, amount), + function(raw) { ffiErrors.applyTransferResult(dashboardView, raw) }, + function(error) { + dashboardView.transferResult = qsTr("Error: %1").arg(error) + dashboardView.transferResultIsError = true + }) + } onCopyRequested: (copyText) => { clipHelper.text = copyText clipHelper.selectAll() diff --git a/src/qml/views/DashboardView.qml b/src/qml/views/DashboardView.qml index f8361f6..429ceb9 100644 --- a/src/qml/views/DashboardView.qml +++ b/src/qml/views/DashboardView.qml @@ -24,6 +24,7 @@ Rectangle { signal transferPrivateOwnedRequested(string fromAccountId, string toAccountId, string amount) signal transferShieldedRequested(string fromAccountId, string toKeysJsonOrAddress, string amount) signal transferShieldedOwnedRequested(string fromAccountId, string toAccountId, string amount) + signal transferDeshieldedRequested(string fromAccountId, string toAccountId, string amount) signal copyRequested(string copyText) color: Theme.palette.background @@ -60,6 +61,7 @@ Rectangle { onTransferPrivateOwnedRequested: (fromId, toAccountId, amount) => root.transferPrivateOwnedRequested(fromId, toAccountId, amount) onTransferShieldedRequested: (fromId, toKeysJsonOrAddress, amount) => root.transferShieldedRequested(fromId, toKeysJsonOrAddress, amount) onTransferShieldedOwnedRequested: (fromId, toAccountId, amount) => root.transferShieldedOwnedRequested(fromId, toAccountId, amount) + onTransferDeshieldedRequested: (fromId, toAccountId, amount) => root.transferDeshieldedRequested(fromId, toAccountId, amount) onCopyRequested: (copyText) => root.copyRequested(copyText) } } diff --git a/src/qml/views/TransferPanel.qml b/src/qml/views/TransferPanel.qml index a5b4046..4a9e381 100644 --- a/src/qml/views/TransferPanel.qml +++ b/src/qml/views/TransferPanel.qml @@ -22,6 +22,7 @@ Rectangle { signal transferPrivateOwnedRequested(string fromAccountId, string toAccountId, string amount) signal transferShieldedRequested(string fromAccountId, string toKeysJsonOrAddress, string amount) signal transferShieldedOwnedRequested(string fromAccountId, string toAccountId, string amount) + signal transferDeshieldedRequested(string fromAccountId, string toAccountId, string amount) signal copyRequested(string copyText) readonly property int fromFilterCount: fromCombo.count @@ -33,8 +34,10 @@ Rectangle { readonly property bool isPublicTab: transferTypeBar.currentIndex === 0 readonly property bool isPrivateTab: transferTypeBar.currentIndex === 1 readonly property bool isShieldedTab: transferTypeBar.currentIndex === 2 + readonly property bool isDeshieldedTab: transferTypeBar.currentIndex === 3 readonly property bool showOwnedOption: isPrivateTab || isShieldedTab - readonly property bool toAddressValid: showOwnedOption && useOwnedAccountForTo + readonly property bool toComboPermanent: isDeshieldedTab + readonly property bool toAddressValid: (toComboPermanent || (showOwnedOption && useOwnedAccountForTo)) ? (toFilterCount > 0 && toCombo.currentIndex >= 0) : (toField && toField.text.trim().length > 0) readonly property bool sendEnabled: amountField && manualFromField @@ -61,7 +64,7 @@ Rectangle { // Transfer type toggle TabBar { id: transferTypeBar - Layout.preferredWidth: 300 + Layout.preferredWidth: 400 currentIndex: 0 background: Rectangle { @@ -80,6 +83,10 @@ Rectangle { LogosTabButton { text: qsTr("Shielded") } + + LogosTabButton { + text: qsTr("Deshielded") + } } // From: dropdown when accounts exist, or manual entry when list is empty @@ -103,7 +110,7 @@ Rectangle { AccountComboBox { id: fromCombo Layout.fillWidth: true - model: d.isPrivateTab ? root.privateAccountModel : root.publicAccountModel + model: (d.isPrivateTab || d.isDeshieldedTab) ? root.privateAccountModel : root.publicAccountModel visible: fromFilterCount > 0 onCopyRequested: (text) => root.copyRequested(text) } @@ -134,14 +141,14 @@ Rectangle { id: toField Layout.fillWidth: true placeholderText: d.isPublicTab ? qsTr("Recipient address") : qsTr("Recipient private keys (JSON)") - visible: !d.showOwnedOption || !d.useOwnedAccountForTo + visible: !d.toComboPermanent && (!d.showOwnedOption || !d.useOwnedAccountForTo) } AccountComboBox { id: toCombo Layout.fillWidth: true - model: d.isPublicTab ? root.publicAccountModel : root.privateAccountModel - visible: d.showOwnedOption && d.useOwnedAccountForTo && toFilterCount > 0 + model: (d.isPublicTab || d.isDeshieldedTab) ? root.publicAccountModel : root.privateAccountModel + visible: d.toComboPermanent || (d.showOwnedOption && d.useOwnedAccountForTo && toFilterCount > 0) onCopyRequested: (text) => root.copyRequested(text) } } @@ -174,7 +181,7 @@ Rectangle { var fromId = fromFilterCount > 0 && fromCombo.currentIndex >= 0 ? (fromCombo.currentValue ?? "") : manualFromField.text.trim() - var toAddress = d.useOwnedAccountForTo && toCombo.currentIndex >= 0 + var toAddress = (d.toComboPermanent || (d.useOwnedAccountForTo && toCombo.currentIndex >= 0)) ? (toCombo.currentValue ?? "") : toField.text.trim() var amount = amountField.text.trim() @@ -191,6 +198,8 @@ Rectangle { root.transferShieldedOwnedRequested(fromId, toAddress, amount) else root.transferShieldedRequested(fromId, toAddress, amount) + } else if (d.isDeshieldedTab) { + root.transferDeshieldedRequested(fromId, toAddress, amount) } } }