fix: try 1

This commit is contained in:
Pravdyvy 2026-06-08 12:22:10 +03:00
parent 65afa0de6a
commit f932773336
2 changed files with 36 additions and 21 deletions

24
flake.lock generated
View File

@ -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": {

View File

@ -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<uint8_t>(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<uint32_t> input_data = m_logos->logos_execution_zone.serialization_helper(&input_data_raw);
const QList<uint8_t>& input_data_raw_ref = input_data_raw;
QList<uint32_t> input_data = m_logos->logos_execution_zone.serialization_helper(input_data_raw_ref);
QList<uint8_t> elf = m_logos->logos_execution_zone.authenticated_transfer_elf();
QList<QList<uint8_t>> program_dependencies;
return m_logos->logos_execution_zone.send_generic_public_transaction(&account_ids, &signing_requirements, &input_data, &elf, &program_dependencies);
const QList<QString>& 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<QList<uint8_t>> program_dependencies;
return m_logos->logos_execution_zone.send_generic_private_transaction(&account_ids, &input_data, &elf, &program_dependencies);
const QList<QString>& 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)