add deshielded tab

This commit is contained in:
Sergio Chouhy 2026-06-05 00:14:43 -03:00
parent 8fa1d2f440
commit a97f8b06dd
6 changed files with 36 additions and 7 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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))

View File

@ -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()

View File

@ -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)
}
}

View File

@ -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)
}
}
}