mirror of
https://github.com/logos-blockchain/logos-execution-zone-module.git
synced 2026-07-09 12:10:12 +00:00
fix: transfered all inputs and outputs into jsons to satisfy Qt parser
This commit is contained in:
parent
8b24950b50
commit
3ff01477c5
30
flake.lock
generated
30
flake.lock
generated
@ -670,11 +670,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780703083,
|
"lastModified": 1780948044,
|
||||||
"narHash": "sha256-Z0nOivZhmNWprngIAxx1ZwpZPKH3EvZRTPzr3nTrMgs=",
|
"narHash": "sha256-LJF2BvGhDCX10tKjwp7FRCFtZgeC/N9egRqIszOqoX0=",
|
||||||
"owner": "logos-co",
|
"owner": "logos-co",
|
||||||
"repo": "logos-cpp-sdk",
|
"repo": "logos-cpp-sdk",
|
||||||
"rev": "eb71a1aa90e05a98814138779680de2ea60a9ff2",
|
"rev": "40e7631402d2082664a146a9fb9de33cf35cd299",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -921,11 +921,11 @@
|
|||||||
"process-stats": "process-stats_2"
|
"process-stats": "process-stats_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780324383,
|
"lastModified": 1780945875,
|
||||||
"narHash": "sha256-cArQVYE2U50Dyj3Nm78qTYJNemBiAH8WxRzysceAYIc=",
|
"narHash": "sha256-uHnxNUd7ZMcZ+tyyV4HrqVJ41EvcNTAgck7jxvq+kfc=",
|
||||||
"owner": "logos-co",
|
"owner": "logos-co",
|
||||||
"repo": "logos-liblogos",
|
"repo": "logos-liblogos",
|
||||||
"rev": "51313eb58f2566efaa6ece82071a34e3bc4f7f61",
|
"rev": "eb0d30095dbbc5c46ce538989658f84415a33bee",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -1140,11 +1140,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780705793,
|
"lastModified": 1780948815,
|
||||||
"narHash": "sha256-sOegBiJGTLXCkaASQ02WdPMApkSsOMIaD1zdBuO8I/Y=",
|
"narHash": "sha256-NiBHv3Fb6kGcbz4zSHSGMBMqReXtsPEt1DaqxGfQotA=",
|
||||||
"owner": "logos-co",
|
"owner": "logos-co",
|
||||||
"repo": "logos-module-builder",
|
"repo": "logos-module-builder",
|
||||||
"rev": "2afd64405439d3fdda1ffb53852a9bb0049f0f0e",
|
"rev": "b841fdc1d9a60f470e924a0da78ec5978c1b0a1b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -5925,11 +5925,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780703355,
|
"lastModified": 1780929868,
|
||||||
"narHash": "sha256-QwLWoeYn0yMrldG63dWaH2lqyYFn7qgTi5XFlrgCJSc=",
|
"narHash": "sha256-yDxv9Cv5VEJDVqHz9qYCU3UXv+kCIjRoD90A7uGYuGU=",
|
||||||
"owner": "logos-co",
|
"owner": "logos-co",
|
||||||
"repo": "logos-plugin-qt",
|
"repo": "logos-plugin-qt",
|
||||||
"rev": "f58fbaa25acbc547ae2671e2cddcc1517d6643f0",
|
"rev": "68090d0a976224ca1c3c606c486a9ac3dd7a4559",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -6035,11 +6035,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780703355,
|
"lastModified": 1780929868,
|
||||||
"narHash": "sha256-QwLWoeYn0yMrldG63dWaH2lqyYFn7qgTi5XFlrgCJSc=",
|
"narHash": "sha256-yDxv9Cv5VEJDVqHz9qYCU3UXv+kCIjRoD90A7uGYuGU=",
|
||||||
"owner": "logos-co",
|
"owner": "logos-co",
|
||||||
"repo": "logos-plugin-qt",
|
"repo": "logos-plugin-qt",
|
||||||
"rev": "f58fbaa25acbc547ae2671e2cddcc1517d6643f0",
|
"rev": "68090d0a976224ca1c3c606c486a9ac3dd7a4559",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@ -88,28 +88,28 @@ public:
|
|||||||
virtual QString register_public_account(const QString& account_id_hex) = 0;
|
virtual QString register_public_account(const QString& account_id_hex) = 0;
|
||||||
virtual QString register_private_account(const QString& account_id_hex) = 0;
|
virtual QString register_private_account(const QString& account_id_hex) = 0;
|
||||||
|
|
||||||
virtual QList<uint32_t> serialization_helper(const QList<uint8_t>& input_data) = 0;
|
virtual QJsonArray serialization_helper(const QJsonArray& input_data) = 0;
|
||||||
|
|
||||||
virtual QByteArray authenticated_transfer_elf() = 0;
|
virtual QJsonArray authenticated_transfer_elf() = 0;
|
||||||
virtual QList<uint8_t> token_elf() = 0;
|
virtual QJsonArray token_elf() = 0;
|
||||||
virtual QList<uint8_t> amm_elf() = 0;
|
virtual QJsonArray amm_elf() = 0;
|
||||||
virtual QList<uint8_t> ata_elf() = 0;
|
virtual QJsonArray ata_elf() = 0;
|
||||||
|
|
||||||
virtual QString send_generic_public_transaction(
|
virtual QString send_generic_public_transaction(
|
||||||
const QList<QString>& account_ids,
|
const QList<QString>& account_ids,
|
||||||
const QList<bool>& signing_requirements,
|
const QJsonArray& signing_requirements,
|
||||||
const QList<uint8_t>& instruction,
|
const QJsonArray& instruction,
|
||||||
const QList<uint8_t>& program_elf,
|
const QJsonArray& program_elf,
|
||||||
const QList<QList<uint8_t>>& program_dependencies
|
const QJsonArray& program_dependencies
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual QString send_generic_private_transaction(
|
virtual QString send_generic_private_transaction(
|
||||||
const QList<QString>& account_ids,
|
const QList<QString>& account_ids,
|
||||||
const QList<uint8_t>& instruction,
|
const QJsonArray& instruction,
|
||||||
const QList<uint8_t>& program_elf,
|
const QJsonArray& program_elf,
|
||||||
const QList<QList<uint8_t>>& program_dependencies
|
const QJsonArray& program_dependencies
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual QString send_program_deployment_transaction(
|
virtual QString send_program_deployment_transaction(
|
||||||
const QList<uint8_t>& program_elf
|
const QJsonArray& program_elf
|
||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
// Wallet Lifecycle
|
// Wallet Lifecycle
|
||||||
|
|||||||
@ -753,78 +753,106 @@ QString LogosExecutionZoneWalletModule::register_private_account(const QString&
|
|||||||
return resultJson;
|
return resultJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<uint32_t> LogosExecutionZoneWalletModule::serialization_helper(const QList<uint8_t>& input_data) {
|
QJsonArray LogosExecutionZoneWalletModule::token_elf() {
|
||||||
const uint8_t *input_instruction_data = input_data.constData();
|
|
||||||
uintptr_t input_instruction_data_size = static_cast<uintptr_t>(input_data.size());
|
|
||||||
FfiInstructionWords raw_words = wallet_ffi_serialization_helper(input_instruction_data, input_instruction_data_size);
|
|
||||||
if (raw_words.error != SUCCESS) {
|
|
||||||
qWarning() << "serialization_helper: wallet FFI error" << raw_words.error;
|
|
||||||
return QList<uint32_t> {};
|
|
||||||
}
|
|
||||||
QList<uint32_t> result(raw_words.instruction_words, raw_words.instruction_words + raw_words.instruction_words_size);
|
|
||||||
wallet_ffi_free_instruction_words(&raw_words);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<uint8_t> LogosExecutionZoneWalletModule::token_elf() {
|
|
||||||
FfiProgram ffi_program {};
|
FfiProgram ffi_program {};
|
||||||
WalletFfiError error = wallet_ffi_token_elf(&ffi_program);
|
WalletFfiError error = wallet_ffi_token_elf(&ffi_program);
|
||||||
if (error != SUCCESS) {
|
if (error != SUCCESS) {
|
||||||
qWarning() << "authenticated_transfer_elf: wallet FFI error " << error;
|
qWarning() << "token_elf: wallet FFI error " << error;
|
||||||
return QList<uint8_t> {};
|
return QJsonArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<uint8_t> result(ffi_program.elf_data, ffi_program.elf_data + ffi_program.elf_size);
|
QJsonArray result;
|
||||||
|
for (size_t i = 0; i < ffi_program.elf_size; ++i) {
|
||||||
|
result.append(static_cast<int>(ffi_program.elf_data[i]));
|
||||||
|
}
|
||||||
wallet_ffi_free_ffi_program(&ffi_program);
|
wallet_ffi_free_ffi_program(&ffi_program);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<uint8_t> LogosExecutionZoneWalletModule::amm_elf() {
|
QJsonArray LogosExecutionZoneWalletModule::amm_elf() {
|
||||||
FfiProgram ffi_program {};
|
FfiProgram ffi_program {};
|
||||||
WalletFfiError error = wallet_ffi_amm_elf(&ffi_program);
|
WalletFfiError error = wallet_ffi_amm_elf(&ffi_program);
|
||||||
if (error != SUCCESS) {
|
if (error != SUCCESS) {
|
||||||
qWarning() << "authenticated_transfer_elf: wallet FFI error " << error;
|
qWarning() << "amm_elf: wallet FFI error " << error;
|
||||||
return QList<uint8_t> {};
|
return QJsonArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<uint8_t> result(ffi_program.elf_data, ffi_program.elf_data + ffi_program.elf_size);
|
QJsonArray result;
|
||||||
|
for (size_t i = 0; i < ffi_program.elf_size; ++i) {
|
||||||
|
result.append(static_cast<int>(ffi_program.elf_data[i]));
|
||||||
|
}
|
||||||
wallet_ffi_free_ffi_program(&ffi_program);
|
wallet_ffi_free_ffi_program(&ffi_program);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<uint8_t> LogosExecutionZoneWalletModule::ata_elf() {
|
QJsonArray LogosExecutionZoneWalletModule::ata_elf() {
|
||||||
FfiProgram ffi_program {};
|
FfiProgram ffi_program {};
|
||||||
WalletFfiError error = wallet_ffi_ata_elf(&ffi_program);
|
WalletFfiError error = wallet_ffi_ata_elf(&ffi_program);
|
||||||
if (error != SUCCESS) {
|
if (error != SUCCESS) {
|
||||||
qWarning() << "authenticated_transfer_elf: wallet FFI error " << error;
|
qWarning() << "ata_elf: wallet FFI error " << error;
|
||||||
return QList<uint8_t> {};
|
return QJsonArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<uint8_t> result(ffi_program.elf_data, ffi_program.elf_data + ffi_program.elf_size);
|
QJsonArray result;
|
||||||
|
for (size_t i = 0; i < ffi_program.elf_size; ++i) {
|
||||||
|
result.append(static_cast<int>(ffi_program.elf_data[i]));
|
||||||
|
}
|
||||||
wallet_ffi_free_ffi_program(&ffi_program);
|
wallet_ffi_free_ffi_program(&ffi_program);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray LogosExecutionZoneWalletModule::authenticated_transfer_elf() {
|
QJsonArray LogosExecutionZoneWalletModule::authenticated_transfer_elf() {
|
||||||
FfiProgram ffi_program {};
|
FfiProgram ffi_program {};
|
||||||
WalletFfiError error = wallet_ffi_transfer_elf(&ffi_program);
|
WalletFfiError error = wallet_ffi_transfer_elf(&ffi_program);
|
||||||
if (error != SUCCESS) {
|
if (error != SUCCESS) {
|
||||||
qWarning() << "authenticated_transfer_elf: wallet FFI error " << error;
|
qWarning() << "authenticated_transfer_elf: wallet FFI error " << error;
|
||||||
return QByteArray();
|
return QJsonArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray result(reinterpret_cast<const char*>(ffi_program.elf_data), ffi_program.elf_size);
|
QJsonArray result;
|
||||||
|
for (size_t i = 0; i < ffi_program.elf_size; ++i) {
|
||||||
|
result.append(static_cast<int>(ffi_program.elf_data[i]));
|
||||||
|
}
|
||||||
wallet_ffi_free_ffi_program(&ffi_program);
|
wallet_ffi_free_ffi_program(&ffi_program);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QJsonArray LogosExecutionZoneWalletModule::serialization_helper(const QJsonArray& input_data) {
|
||||||
|
QList<uint8_t> input_list;
|
||||||
|
input_list.reserve(input_data.size());
|
||||||
|
for (const QJsonValue& val : input_data) {
|
||||||
|
input_list.append(static_cast<uint8_t>(val.toInt()));
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t* input_instruction_data = input_list.constData();
|
||||||
|
uintptr_t input_instruction_data_size = static_cast<uintptr_t>(input_list.size());
|
||||||
|
FfiInstructionWords raw_words = wallet_ffi_serialization_helper(input_instruction_data, input_instruction_data_size);
|
||||||
|
if (raw_words.error != SUCCESS) {
|
||||||
|
qWarning() << "serialization_helper: wallet FFI error" << raw_words.error;
|
||||||
|
return QJsonArray{};
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonArray result;
|
||||||
|
for (size_t i = 0; i < raw_words.instruction_words_size; ++i) {
|
||||||
|
result.append(static_cast<qint64>(raw_words.instruction_words[i]));
|
||||||
|
}
|
||||||
|
wallet_ffi_free_instruction_words(&raw_words);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
QString LogosExecutionZoneWalletModule::send_generic_public_transaction(
|
QString LogosExecutionZoneWalletModule::send_generic_public_transaction(
|
||||||
const QList<QString>& account_ids,
|
const QList<QString>& account_ids,
|
||||||
const QList<bool>& signing_requirements,
|
const QJsonArray& signing_requirements,
|
||||||
const QList<uint8_t>& instruction,
|
const QJsonArray& instruction,
|
||||||
const QList<uint8_t>& program_elf,
|
const QJsonArray& program_elf,
|
||||||
const QList<QList<uint8_t>>& program_dependencies
|
const QJsonArray& program_dependencies
|
||||||
) {
|
) {
|
||||||
|
QList<bool> signing_requirements_list;
|
||||||
|
signing_requirements_list.reserve(signing_requirements.size());
|
||||||
|
for (const QJsonValue& val : signing_requirements) {
|
||||||
|
signing_requirements_list.append(val.toBool());
|
||||||
|
}
|
||||||
|
|
||||||
QList<FfiAccountIdentity> identities_resolved;
|
QList<FfiAccountIdentity> identities_resolved;
|
||||||
identities_resolved.reserve(account_ids.size());
|
identities_resolved.reserve(account_ids.size());
|
||||||
|
|
||||||
@ -837,7 +865,7 @@ QString LogosExecutionZoneWalletModule::send_generic_public_transaction(
|
|||||||
return transferResultToJson(nullptr, QStringLiteral("wallet_ffi_resolve_public_account: invalid account_id_hex"));
|
return transferResultToJson(nullptr, QStringLiteral("wallet_ffi_resolve_public_account: invalid account_id_hex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError error = wallet_ffi_resolve_public_account(id, signing_requirements[i], &acc_identity);
|
WalletFfiError error = wallet_ffi_resolve_public_account(id, signing_requirements_list[i], &acc_identity);
|
||||||
if (error != SUCCESS) {
|
if (error != SUCCESS) {
|
||||||
qWarning() << "wallet_ffi_resolve_public_account failed for index" << i << " : wallet FFI error" << error;
|
qWarning() << "wallet_ffi_resolve_public_account failed for index" << i << " : wallet FFI error" << error;
|
||||||
return transferResultToJson(nullptr, QStringLiteral("wallet_ffi_resolve_public_account: wallet FFI error ") + QString::number(error));
|
return transferResultToJson(nullptr, QStringLiteral("wallet_ffi_resolve_public_account: wallet FFI error ") + QString::number(error));
|
||||||
@ -848,29 +876,48 @@ QString LogosExecutionZoneWalletModule::send_generic_public_transaction(
|
|||||||
const FfiAccountIdentity *account_identities = identities_resolved.constData();
|
const FfiAccountIdentity *account_identities = identities_resolved.constData();
|
||||||
uintptr_t account_identities_size = static_cast<uintptr_t>(identities_resolved.size());
|
uintptr_t account_identities_size = static_cast<uintptr_t>(identities_resolved.size());
|
||||||
|
|
||||||
const uint8_t *input_instruction_data = instruction.constData();
|
QList<uint32_t> instruction_list;
|
||||||
uintptr_t input_instruction_data_size = static_cast<uintptr_t>(instruction.size());
|
instruction_list.reserve(instruction.size());
|
||||||
FfiInstructionWords raw_words = wallet_ffi_serialization_helper(input_instruction_data, input_instruction_data_size);
|
for (const QJsonValue& val : instruction) {
|
||||||
if (raw_words.error != SUCCESS) {
|
instruction_list.append(static_cast<uint32_t>(val.toInt()));
|
||||||
qWarning() << "wallet_ffi_resolve_public_account failed at instruction serialization: wallet FFI error" << raw_words.error;
|
|
||||||
return transferResultToJson(nullptr, QStringLiteral("wallet_ffi_resolve_public_account: wallet FFI error ") + QString::number(raw_words.error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint32_t* input_instruction_data = instruction_list.constData();
|
||||||
|
uintptr_t input_instruction_data_size = static_cast<uintptr_t>(instruction_list.size());
|
||||||
|
|
||||||
FfiProgram main_program {};
|
FfiProgram main_program {};
|
||||||
|
|
||||||
const uint8_t *program_elf_data = program_elf.constData();
|
QList<uint8_t> program_elf_list;
|
||||||
uintptr_t program_elf_size = static_cast<uintptr_t>(program_elf.size());
|
program_elf_list.reserve(program_elf.size());
|
||||||
|
for (const QJsonValue& val : program_elf) {
|
||||||
|
program_elf_list.append(static_cast<uint8_t>(val.toInt()));
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t *program_elf_data = program_elf_list.constData();
|
||||||
|
uintptr_t program_elf_size = static_cast<uintptr_t>(program_elf_list.size());
|
||||||
|
|
||||||
main_program.elf_data = program_elf_data;
|
main_program.elf_data = program_elf_data;
|
||||||
main_program.elf_size = program_elf_size;
|
main_program.elf_size = program_elf_size;
|
||||||
|
|
||||||
|
QList<QList<uint8_t>> program_dependencies_list;
|
||||||
|
program_dependencies_list.reserve(program_dependencies.size());
|
||||||
|
for (const QJsonValue& outer : program_dependencies) {
|
||||||
|
QList<uint8_t> inner;
|
||||||
|
const QJsonArray inner_arr = outer.toArray();
|
||||||
|
inner.reserve(inner_arr.size());
|
||||||
|
for (const QJsonValue& val : inner_arr) {
|
||||||
|
inner.append(static_cast<uint8_t>(val.toInt()));
|
||||||
|
}
|
||||||
|
program_dependencies_list.append(inner);
|
||||||
|
}
|
||||||
|
|
||||||
QList<FfiProgram> ffi_program_dependencies;
|
QList<FfiProgram> ffi_program_dependencies;
|
||||||
|
|
||||||
for (int i = 0; i < program_dependencies.size(); ++i) {
|
for (int i = 0; i < program_dependencies_list.size(); ++i) {
|
||||||
FfiProgram program{};
|
FfiProgram program{};
|
||||||
|
|
||||||
const uint8_t *program_elf_data = program_dependencies[i].constData();
|
const uint8_t *program_elf_data = program_dependencies_list[i].constData();
|
||||||
uintptr_t program_elf_size = static_cast<uintptr_t>(program_dependencies[i].size());
|
uintptr_t program_elf_size = static_cast<uintptr_t>(program_dependencies_list[i].size());
|
||||||
|
|
||||||
program.elf_data = program_elf_data;
|
program.elf_data = program_elf_data;
|
||||||
program.elf_size = program_elf_size;
|
program.elf_size = program_elf_size;
|
||||||
@ -893,8 +940,8 @@ QString LogosExecutionZoneWalletModule::send_generic_public_transaction(
|
|||||||
walletHandle,
|
walletHandle,
|
||||||
account_identities,
|
account_identities,
|
||||||
account_identities_size,
|
account_identities_size,
|
||||||
raw_words.instruction_words,
|
input_instruction_data,
|
||||||
raw_words.instruction_words_size,
|
input_instruction_data_size,
|
||||||
&program_with_dependencies,
|
&program_with_dependencies,
|
||||||
&result
|
&result
|
||||||
);
|
);
|
||||||
@ -914,9 +961,9 @@ QString LogosExecutionZoneWalletModule::send_generic_public_transaction(
|
|||||||
|
|
||||||
QString LogosExecutionZoneWalletModule::send_generic_private_transaction(
|
QString LogosExecutionZoneWalletModule::send_generic_private_transaction(
|
||||||
const QList<QString>& account_ids,
|
const QList<QString>& account_ids,
|
||||||
const QList<uint8_t>& instruction,
|
const QJsonArray& instruction,
|
||||||
const QList<uint8_t>& program_elf,
|
const QJsonArray& program_elf,
|
||||||
const QList<QList<uint8_t>>& program_dependencies
|
const QJsonArray& program_dependencies
|
||||||
) {
|
) {
|
||||||
QList<FfiAccountIdentity> identities_resolved;
|
QList<FfiAccountIdentity> identities_resolved;
|
||||||
identities_resolved.reserve(account_ids.size());
|
identities_resolved.reserve(account_ids.size());
|
||||||
@ -941,29 +988,48 @@ QString LogosExecutionZoneWalletModule::send_generic_private_transaction(
|
|||||||
const FfiAccountIdentity *account_identities = identities_resolved.constData();
|
const FfiAccountIdentity *account_identities = identities_resolved.constData();
|
||||||
uintptr_t account_identities_size = static_cast<uintptr_t>(identities_resolved.size());
|
uintptr_t account_identities_size = static_cast<uintptr_t>(identities_resolved.size());
|
||||||
|
|
||||||
const uint8_t *input_instruction_data = instruction.constData();
|
QList<uint32_t> instruction_list;
|
||||||
uintptr_t input_instruction_data_size = static_cast<uintptr_t>(instruction.size());
|
instruction_list.reserve(instruction.size());
|
||||||
FfiInstructionWords raw_words = wallet_ffi_serialization_helper(input_instruction_data, input_instruction_data_size);
|
for (const QJsonValue& val : instruction) {
|
||||||
if (raw_words.error != SUCCESS) {
|
instruction_list.append(static_cast<uint32_t>(val.toInt()));
|
||||||
qWarning() << "wallet_ffi_resolve_private_account failed at instruction serialization: wallet FFI error" << raw_words.error;
|
|
||||||
return transferResultToJson(nullptr, QStringLiteral("wallet_ffi_resolve_private_account: wallet FFI error ") + QString::number(raw_words.error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint32_t* input_instruction_data = instruction_list.constData();
|
||||||
|
uintptr_t input_instruction_data_size = static_cast<uintptr_t>(instruction_list.size());
|
||||||
|
|
||||||
FfiProgram main_program {};
|
FfiProgram main_program {};
|
||||||
|
|
||||||
const uint8_t *program_elf_data = program_elf.constData();
|
QList<uint8_t> program_elf_list;
|
||||||
uintptr_t program_elf_size = static_cast<uintptr_t>(program_elf.size());
|
program_elf_list.reserve(program_elf.size());
|
||||||
|
for (const QJsonValue& val : program_elf) {
|
||||||
|
program_elf_list.append(static_cast<uint8_t>(val.toInt()));
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t *program_elf_data = program_elf_list.constData();
|
||||||
|
uintptr_t program_elf_size = static_cast<uintptr_t>(program_elf_list.size());
|
||||||
|
|
||||||
main_program.elf_data = program_elf_data;
|
main_program.elf_data = program_elf_data;
|
||||||
main_program.elf_size = program_elf_size;
|
main_program.elf_size = program_elf_size;
|
||||||
|
|
||||||
|
QList<QList<uint8_t>> program_dependencies_list;
|
||||||
|
program_dependencies_list.reserve(program_dependencies.size());
|
||||||
|
for (const QJsonValue& outer : program_dependencies) {
|
||||||
|
QList<uint8_t> inner;
|
||||||
|
const QJsonArray inner_arr = outer.toArray();
|
||||||
|
inner.reserve(inner_arr.size());
|
||||||
|
for (const QJsonValue& val : inner_arr) {
|
||||||
|
inner.append(static_cast<uint8_t>(val.toInt()));
|
||||||
|
}
|
||||||
|
program_dependencies_list.append(inner);
|
||||||
|
}
|
||||||
|
|
||||||
QList<FfiProgram> ffi_program_dependencies;
|
QList<FfiProgram> ffi_program_dependencies;
|
||||||
|
|
||||||
for (int i = 0; i < program_dependencies.size(); ++i) {
|
for (int i = 0; i < program_dependencies_list.size(); ++i) {
|
||||||
FfiProgram program{};
|
FfiProgram program{};
|
||||||
|
|
||||||
const uint8_t *program_elf_data = program_dependencies[i].constData();
|
const uint8_t *program_elf_data = program_dependencies_list[i].constData();
|
||||||
uintptr_t program_elf_size = static_cast<uintptr_t>(program_dependencies[i].size());
|
uintptr_t program_elf_size = static_cast<uintptr_t>(program_dependencies_list[i].size());
|
||||||
|
|
||||||
program.elf_data = program_elf_data;
|
program.elf_data = program_elf_data;
|
||||||
program.elf_size = program_elf_size;
|
program.elf_size = program_elf_size;
|
||||||
@ -986,8 +1052,8 @@ QString LogosExecutionZoneWalletModule::send_generic_private_transaction(
|
|||||||
walletHandle,
|
walletHandle,
|
||||||
account_identities,
|
account_identities,
|
||||||
account_identities_size,
|
account_identities_size,
|
||||||
raw_words.instruction_words,
|
input_instruction_data,
|
||||||
raw_words.instruction_words_size,
|
input_instruction_data_size,
|
||||||
&program_with_dependencies,
|
&program_with_dependencies,
|
||||||
&result
|
&result
|
||||||
);
|
);
|
||||||
@ -1006,12 +1072,18 @@ QString LogosExecutionZoneWalletModule::send_generic_private_transaction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString LogosExecutionZoneWalletModule::send_program_deployment_transaction(
|
QString LogosExecutionZoneWalletModule::send_program_deployment_transaction(
|
||||||
const QList<uint8_t>& program_elf
|
const QJsonArray& program_elf
|
||||||
) {
|
) {
|
||||||
FfiTransactionResult result {};
|
FfiTransactionResult result {};
|
||||||
|
|
||||||
const uint8_t *program_elf_data = program_elf.constData();
|
QList<uint8_t> program_elf_list;
|
||||||
uintptr_t program_elf_size = static_cast<uintptr_t>(program_elf.size());
|
program_elf_list.reserve(program_elf.size());
|
||||||
|
for (const QJsonValue& val : program_elf) {
|
||||||
|
program_elf_list.append(static_cast<uint8_t>(val.toInt()));
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t *program_elf_data = program_elf_list.constData();
|
||||||
|
uintptr_t program_elf_size = static_cast<uintptr_t>(program_elf_list.size());
|
||||||
|
|
||||||
const WalletFfiError error = wallet_ffi_program_deployment(
|
const WalletFfiError error = wallet_ffi_program_deployment(
|
||||||
walletHandle,
|
walletHandle,
|
||||||
|
|||||||
@ -116,28 +116,28 @@ public:
|
|||||||
Q_INVOKABLE QString register_public_account(const QString& account_id_hex) override;
|
Q_INVOKABLE QString register_public_account(const QString& account_id_hex) override;
|
||||||
Q_INVOKABLE QString register_private_account(const QString& account_id_hex) override;
|
Q_INVOKABLE QString register_private_account(const QString& account_id_hex) override;
|
||||||
|
|
||||||
Q_INVOKABLE QList<uint32_t> serialization_helper(const QList<uint8_t>& input_data) override;
|
Q_INVOKABLE QJsonArray serialization_helper(const QJsonArray& input_data) override;
|
||||||
|
|
||||||
Q_INVOKABLE QByteArray authenticated_transfer_elf() override;
|
Q_INVOKABLE QJsonArray authenticated_transfer_elf() override;
|
||||||
Q_INVOKABLE QList<uint8_t> token_elf() override;
|
Q_INVOKABLE QJsonArray token_elf() override;
|
||||||
Q_INVOKABLE QList<uint8_t> amm_elf() override;
|
Q_INVOKABLE QJsonArray amm_elf() override;
|
||||||
Q_INVOKABLE QList<uint8_t> ata_elf() override;
|
Q_INVOKABLE QJsonArray ata_elf() override;
|
||||||
|
|
||||||
Q_INVOKABLE QString send_generic_public_transaction(
|
Q_INVOKABLE QString send_generic_public_transaction(
|
||||||
const QList<QString>& account_ids,
|
const QList<QString>& account_ids,
|
||||||
const QList<bool>& signing_requirements,
|
const QJsonArray& signing_requirements,
|
||||||
const QList<uint8_t>& instruction,
|
const QJsonArray& instruction,
|
||||||
const QList<uint8_t>& program_elf,
|
const QJsonArray& program_elf,
|
||||||
const QList<QList<uint8_t>>& program_dependencies
|
const QJsonArray& program_dependencies
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE QString send_generic_private_transaction(
|
Q_INVOKABLE QString send_generic_private_transaction(
|
||||||
const QList<QString>& account_ids,
|
const QList<QString>& account_ids,
|
||||||
const QList<uint8_t>& instruction,
|
const QJsonArray& instruction,
|
||||||
const QList<uint8_t>& program_elf,
|
const QJsonArray& program_elf,
|
||||||
const QList<QList<uint8_t>>& program_dependencies
|
const QJsonArray& program_dependencies
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE QString send_program_deployment_transaction(
|
Q_INVOKABLE QString send_program_deployment_transaction(
|
||||||
const QList<uint8_t>& program_elf
|
const QJsonArray& program_elf
|
||||||
) override;
|
) override;
|
||||||
|
|
||||||
// Wallet Lifecycle
|
// Wallet Lifecycle
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user