From f932773336b9093d1ffd593048fdd5cccb7511f9 Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Mon, 8 Jun 2026 12:22:10 +0300 Subject: [PATCH] fix: try 1 --- flake.lock | 24 ++++++++++++------------ src/LEZWalletBackend.cpp | 33 ++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index d73ac6b..e30b2e2 100644 --- a/flake.lock +++ b/flake.lock @@ -484,11 +484,11 @@ ] }, "locked": { - "lastModified": 1780614855, - "narHash": "sha256-zPA+Otg8zYxSj9NIf003Uyp0PWMOBNOcyBbyVSnBLk4=", + "lastModified": 1780703083, + "narHash": "sha256-Z0nOivZhmNWprngIAxx1ZwpZPKH3EvZRTPzr3nTrMgs=", "owner": "logos-co", "repo": "logos-cpp-sdk", - "rev": "3bdd8858f52bfefbc647536f2a9d1b8a5fe7dede", + "rev": "eb71a1aa90e05a98814138779680de2ea60a9ff2", "type": "github" }, "original": { @@ -1828,11 +1828,11 @@ ] }, "locked": { - "lastModified": 1780614890, - "narHash": "sha256-5reMb1hZ3287uNtgtBKyEYWzAWxTWq/7JQ+FZk++awA=", + "lastModified": 1780705793, + "narHash": "sha256-sOegBiJGTLXCkaASQ02WdPMApkSsOMIaD1zdBuO8I/Y=", "owner": "logos-co", "repo": "logos-module-builder", - "rev": "c975aa5b1d79402b701a5e8483d286127fd7fbb3", + "rev": "2afd64405439d3fdda1ffb53852a9bb0049f0f0e", "type": "github" }, "original": { @@ -10094,11 +10094,11 @@ ] }, "locked": { - "lastModified": 1779206088, - "narHash": "sha256-a+T5XY7KL1eFREtj4fzdMFnhD9BR8juSg9bQObbMeEQ=", + "lastModified": 1780703355, + "narHash": "sha256-QwLWoeYn0yMrldG63dWaH2lqyYFn7qgTi5XFlrgCJSc=", "owner": "logos-co", "repo": "logos-plugin-qt", - "rev": "8f8260e6f9aba54b55bf8cc88ddb673dabb7512b", + "rev": "f58fbaa25acbc547ae2671e2cddcc1517d6643f0", "type": "github" }, "original": { @@ -10290,11 +10290,11 @@ ] }, "locked": { - "lastModified": 1779206088, - "narHash": "sha256-a+T5XY7KL1eFREtj4fzdMFnhD9BR8juSg9bQObbMeEQ=", + "lastModified": 1780703355, + "narHash": "sha256-QwLWoeYn0yMrldG63dWaH2lqyYFn7qgTi5XFlrgCJSc=", "owner": "logos-co", "repo": "logos-plugin-qt", - "rev": "8f8260e6f9aba54b55bf8cc88ddb673dabb7512b", + "rev": "f58fbaa25acbc547ae2671e2cddcc1517d6643f0", "type": "github" }, "original": { diff --git a/src/LEZWalletBackend.cpp b/src/LEZWalletBackend.cpp index 3b7e7ec..3225343 100644 --- a/src/LEZWalletBackend.cpp +++ b/src/LEZWalletBackend.cpp @@ -44,11 +44,20 @@ namespace { } } -static bool hexToU128(const QString& hex, uint8_t (*output)[16]) { - QByteArray buffer; - if (!hexToBytes(hex, buffer, 16)) +static bool hexToU128(const QString& hex, uint8_t (*output)[16]) +{ + if (hex.isEmpty() || hex.length() != 32) return false; - memcpy(output, buffer.constData(), 16); + + for (int i = 0; i < 16; i++) + { + bool ok = false; + uint8_t byte = static_cast(hex.mid(i * 2, 2).toUInt(&ok, 16)); + if (!ok) + return false; + (*output)[i] = byte; + } + return true; } @@ -222,7 +231,7 @@ QString LEZWalletBackend::transferPublic(QString fromHex, QString toHex, QString if (amountHex.isEmpty()) return QStringLiteral("Error: Invalid amount."); uint8_t amount[16]; - if (!hexToU128(amount_le16_hex, &amount)) { + if (!hexToU128(amountHex, &amount)) { return QStringLiteral("Error: Invalid amount."); } @@ -233,12 +242,16 @@ QString LEZWalletBackend::transferPublic(QString fromHex, QString toHex, QString input_data_raw.append(amount[i]); } - QList input_data = m_logos->logos_execution_zone.serialization_helper(&input_data_raw); + const QList& input_data_raw_ref = input_data_raw; + + QList input_data = m_logos->logos_execution_zone.serialization_helper(input_data_raw_ref); QList elf = m_logos->logos_execution_zone.authenticated_transfer_elf(); QList> program_dependencies; - return m_logos->logos_execution_zone.send_generic_public_transaction(&account_ids, &signing_requirements, &input_data, &elf, &program_dependencies); + const QList& account_ids_ref = account_ids; + + return *m_logos->logos_execution_zone.send_generic_public_transaction(account_ids_ref, &signing_requirements, &input_data, &elf, &program_dependencies); } QString LEZWalletBackend::transferPrivate(QString fromHex, QString toHex, QString amountStr) @@ -266,7 +279,7 @@ QString LEZWalletBackend::transferPrivateOwned(QString fromHex, QString toHex, Q if (amountHex.isEmpty()) return QStringLiteral("Error: Invalid amount."); uint8_t amount[16]; - if (!hexToU128(amount_le16_hex, &amount)) { + if (!hexToU128(amountHex, &amount)) { return QStringLiteral("Error: Invalid amount."); } @@ -282,7 +295,9 @@ QString LEZWalletBackend::transferPrivateOwned(QString fromHex, QString toHex, Q QList> program_dependencies; - return m_logos->logos_execution_zone.send_generic_private_transaction(&account_ids, &input_data, &elf, &program_dependencies); + const QList& account_ids_ref = account_ids; + + return m_logos->logos_execution_zone.send_generic_private_transaction(account_ids_ref, &input_data, &elf, &program_dependencies); } bool LEZWalletBackend::createNew(QString configPath, QString storagePath, QString password)