mirror of
https://github.com/logos-blockchain/logos-execution-zone-module.git
synced 2026-04-03 04:33:08 +00:00
Rename out_ to output_ prefixes.
This commit is contained in:
parent
4609ae0bb1
commit
8dddebc7a8
@ -22,86 +22,86 @@ public:
|
|||||||
// === Logos Execution Zone Wallet ===
|
// === Logos Execution Zone Wallet ===
|
||||||
|
|
||||||
// Account Management
|
// Account Management
|
||||||
virtual WalletFfiError create_account_public(QString& out_account_id_hex) = 0;
|
virtual WalletFfiError create_account_public(QString& output_account_id_hex) = 0;
|
||||||
virtual WalletFfiError create_account_private(QString& out_account_id_hex) = 0;
|
virtual WalletFfiError create_account_private(QString& output_account_id_hex) = 0;
|
||||||
virtual WalletFfiError list_accounts(QJsonArray& out_list) = 0;
|
virtual WalletFfiError list_accounts(QJsonArray& output_list) = 0;
|
||||||
|
|
||||||
// Account Queries
|
// Account Queries
|
||||||
virtual WalletFfiError get_balance(
|
virtual WalletFfiError get_balance(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
bool is_public,
|
bool is_public,
|
||||||
QString& out_balance_le16_hex
|
QString& output_balance_le16_hex
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError get_account_public(
|
virtual WalletFfiError get_account_public(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_account_json
|
QString& output_account_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError get_account_private(
|
virtual WalletFfiError get_account_private(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_account_json
|
QString& output_account_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError get_public_account_key(
|
virtual WalletFfiError get_public_account_key(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_public_key_hex
|
QString& output_public_key_hex
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError get_private_account_keys(
|
virtual WalletFfiError get_private_account_keys(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_keys_json
|
QString& output_keys_json
|
||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
// Account Encoding
|
// Account Encoding
|
||||||
virtual QString account_id_to_base58(const QString& account_id_hex) = 0;
|
virtual QString account_id_to_base58(const QString& account_id_hex) = 0;
|
||||||
virtual WalletFfiError account_id_from_base58(const QString& base58_str, QString& out_account_id_hex) = 0;
|
virtual WalletFfiError account_id_from_base58(const QString& base58_str, QString& output_account_id_hex) = 0;
|
||||||
|
|
||||||
// Blockchain Synchronisation
|
// Blockchain Synchronisation
|
||||||
virtual WalletFfiError sync_to_block(uint64_t block_id) = 0;
|
virtual WalletFfiError sync_to_block(uint64_t block_id) = 0;
|
||||||
virtual WalletFfiError get_last_synced_block(uint64_t* out_block_id) = 0;
|
virtual WalletFfiError get_last_synced_block(uint64_t* output_block_id) = 0;
|
||||||
virtual WalletFfiError get_current_block_height(uint64_t* out_block_height) = 0;
|
virtual WalletFfiError get_current_block_height(uint64_t* output_block_height) = 0;
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
virtual WalletFfiError transfer_public(
|
virtual WalletFfiError transfer_public(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError transfer_shielded(
|
virtual WalletFfiError transfer_shielded(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_keys_json,
|
const QString& to_keys_json,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError transfer_deshielded(
|
virtual WalletFfiError transfer_deshielded(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError transfer_private(
|
virtual WalletFfiError transfer_private(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_keys_json,
|
const QString& to_keys_json,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError transfer_shielded_owned(
|
virtual WalletFfiError transfer_shielded_owned(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError transfer_private_owned(
|
virtual WalletFfiError transfer_private_owned(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError register_public_account(
|
virtual WalletFfiError register_public_account(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError register_private_account(
|
virtual WalletFfiError register_private_account(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
// Wallet Lifecycle
|
// Wallet Lifecycle
|
||||||
|
|||||||
@ -91,13 +91,13 @@ static QString ffiPrivateAccountKeysToJson(const FfiPrivateAccountKeys& keys) {
|
|||||||
return QJsonDocument(QJsonObject::fromVariantMap(map)).toJson(QJsonDocument::Compact);
|
return QJsonDocument(QJsonObject::fromVariantMap(map)).toJson(QJsonDocument::Compact);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool jsonToFfiPrivateAccountKeys(const QString& json, FfiPrivateAccountKeys* out_keys) {
|
static bool jsonToFfiPrivateAccountKeys(const QString& json, FfiPrivateAccountKeys* output_keys) {
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8());
|
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8());
|
||||||
if (!doc.isObject()) return false;
|
if (!doc.isObject()) return false;
|
||||||
const QVariantMap map = doc.object().toVariantMap();
|
const QVariantMap map = doc.object().toVariantMap();
|
||||||
|
|
||||||
if (map.contains(JsonKeys::NullifierPublicKey)) {
|
if (map.contains(JsonKeys::NullifierPublicKey)) {
|
||||||
if (!hexToBytes32(map[JsonKeys::NullifierPublicKey].toString(), &out_keys->nullifier_public_key)) return false;
|
if (!hexToBytes32(map[JsonKeys::NullifierPublicKey].toString(), &output_keys->nullifier_public_key)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map.contains(JsonKeys::ViewingPublicKey)) {
|
if (map.contains(JsonKeys::ViewingPublicKey)) {
|
||||||
@ -106,11 +106,11 @@ static bool jsonToFfiPrivateAccountKeys(const QString& json, FfiPrivateAccountKe
|
|||||||
|
|
||||||
uint8_t* data = static_cast<uint8_t*>(malloc(buffer.size()));
|
uint8_t* data = static_cast<uint8_t*>(malloc(buffer.size()));
|
||||||
memcpy(data, buffer.constData(), buffer.size());
|
memcpy(data, buffer.constData(), buffer.size());
|
||||||
out_keys->viewing_public_key = data;
|
output_keys->viewing_public_key = data;
|
||||||
out_keys->viewing_public_key_len = buffer.size();
|
output_keys->viewing_public_key_len = buffer.size();
|
||||||
} else {
|
} else {
|
||||||
out_keys->viewing_public_key = nullptr;
|
output_keys->viewing_public_key = nullptr;
|
||||||
out_keys->viewing_public_key_len = 0;
|
output_keys->viewing_public_key_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -143,30 +143,30 @@ void LogosExecutionZoneWalletModule::initLogos(LogosAPI* logosApiInstance) {
|
|||||||
|
|
||||||
// === Account Management ===
|
// === Account Management ===
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::create_account_public(QString& out_account_id_hex) {
|
WalletFfiError LogosExecutionZoneWalletModule::create_account_public(QString& output_account_id_hex) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
const WalletFfiError error = wallet_ffi_create_account_public(walletHandle, &id);
|
const WalletFfiError error = wallet_ffi_create_account_public(walletHandle, &id);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_account_id_hex = bytes32ToHex(id);
|
output_account_id_hex = bytes32ToHex(id);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::create_account_private(QString& out_account_id_hex) {
|
WalletFfiError LogosExecutionZoneWalletModule::create_account_private(QString& output_account_id_hex) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
const WalletFfiError error = wallet_ffi_create_account_private(walletHandle, &id);
|
const WalletFfiError error = wallet_ffi_create_account_private(walletHandle, &id);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_account_id_hex = bytes32ToHex(id);
|
output_account_id_hex = bytes32ToHex(id);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::list_accounts(QJsonArray& out_list) {
|
WalletFfiError LogosExecutionZoneWalletModule::list_accounts(QJsonArray& output_list) {
|
||||||
FfiAccountList list{};
|
FfiAccountList list{};
|
||||||
const WalletFfiError error = wallet_ffi_list_accounts(walletHandle, &list);
|
const WalletFfiError error = wallet_ffi_list_accounts(walletHandle, &list);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
for (uintptr_t i = 0; i < list.count; ++i) {
|
for (uintptr_t i = 0; i < list.count; ++i) {
|
||||||
out_list.append(ffiAccountListEntryToJson(list.entries[i]));
|
output_list.append(ffiAccountListEntryToJson(list.entries[i]));
|
||||||
}
|
}
|
||||||
wallet_ffi_free_account_list(&list);
|
wallet_ffi_free_account_list(&list);
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ WalletFfiError LogosExecutionZoneWalletModule::list_accounts(QJsonArray& out_lis
|
|||||||
WalletFfiError LogosExecutionZoneWalletModule::get_balance(
|
WalletFfiError LogosExecutionZoneWalletModule::get_balance(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
const bool is_public,
|
const bool is_public,
|
||||||
QString& out_balance_le16_hex
|
QString& output_balance_le16_hex
|
||||||
) {
|
) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
if (!hexToBytes32(account_id_hex, &id)) {
|
if (!hexToBytes32(account_id_hex, &id)) {
|
||||||
@ -188,14 +188,14 @@ WalletFfiError LogosExecutionZoneWalletModule::get_balance(
|
|||||||
uint8_t balance[16] = {0};
|
uint8_t balance[16] = {0};
|
||||||
const WalletFfiError error = wallet_ffi_get_balance(walletHandle, &id, is_public, &balance);
|
const WalletFfiError error = wallet_ffi_get_balance(walletHandle, &id, is_public, &balance);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_balance_le16_hex = bytesToHex(balance, 16);
|
output_balance_le16_hex = bytesToHex(balance, 16);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::get_account_public(
|
WalletFfiError LogosExecutionZoneWalletModule::get_account_public(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_account_json
|
QString& output_account_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
if (!hexToBytes32(account_id_hex, &id)) {
|
if (!hexToBytes32(account_id_hex, &id)) {
|
||||||
@ -204,7 +204,7 @@ WalletFfiError LogosExecutionZoneWalletModule::get_account_public(
|
|||||||
FfiAccount account{};
|
FfiAccount account{};
|
||||||
const WalletFfiError error = wallet_ffi_get_account_public(walletHandle, &id, &account);
|
const WalletFfiError error = wallet_ffi_get_account_public(walletHandle, &id, &account);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_account_json = ffiAccountToJson(account);
|
output_account_json = ffiAccountToJson(account);
|
||||||
wallet_ffi_free_account_data(&account);
|
wallet_ffi_free_account_data(&account);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -212,7 +212,7 @@ WalletFfiError LogosExecutionZoneWalletModule::get_account_public(
|
|||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::get_account_private(
|
WalletFfiError LogosExecutionZoneWalletModule::get_account_private(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_account_json
|
QString& output_account_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
if (!hexToBytes32(account_id_hex, &id)) {
|
if (!hexToBytes32(account_id_hex, &id)) {
|
||||||
@ -221,7 +221,7 @@ WalletFfiError LogosExecutionZoneWalletModule::get_account_private(
|
|||||||
FfiAccount account{};
|
FfiAccount account{};
|
||||||
const WalletFfiError error = wallet_ffi_get_account_private(walletHandle, &id, &account);
|
const WalletFfiError error = wallet_ffi_get_account_private(walletHandle, &id, &account);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_account_json = ffiAccountToJson(account);
|
output_account_json = ffiAccountToJson(account);
|
||||||
wallet_ffi_free_account_data(&account);
|
wallet_ffi_free_account_data(&account);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -229,7 +229,7 @@ WalletFfiError LogosExecutionZoneWalletModule::get_account_private(
|
|||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::get_public_account_key(
|
WalletFfiError LogosExecutionZoneWalletModule::get_public_account_key(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_public_key_hex
|
QString& output_public_key_hex
|
||||||
) {
|
) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
if (!hexToBytes32(account_id_hex, &id)) {
|
if (!hexToBytes32(account_id_hex, &id)) {
|
||||||
@ -238,14 +238,14 @@ WalletFfiError LogosExecutionZoneWalletModule::get_public_account_key(
|
|||||||
FfiPublicAccountKey key{};
|
FfiPublicAccountKey key{};
|
||||||
const WalletFfiError error = wallet_ffi_get_public_account_key(walletHandle, &id, &key);
|
const WalletFfiError error = wallet_ffi_get_public_account_key(walletHandle, &id, &key);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_public_key_hex = bytes32ToHex(key.public_key);
|
output_public_key_hex = bytes32ToHex(key.public_key);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::get_private_account_keys(
|
WalletFfiError LogosExecutionZoneWalletModule::get_private_account_keys(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_keys_json
|
QString& output_keys_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
if (!hexToBytes32(account_id_hex, &id)) {
|
if (!hexToBytes32(account_id_hex, &id)) {
|
||||||
@ -254,7 +254,7 @@ WalletFfiError LogosExecutionZoneWalletModule::get_private_account_keys(
|
|||||||
FfiPrivateAccountKeys keys{};
|
FfiPrivateAccountKeys keys{};
|
||||||
const WalletFfiError error = wallet_ffi_get_private_account_keys(walletHandle, &id, &keys);
|
const WalletFfiError error = wallet_ffi_get_private_account_keys(walletHandle, &id, &keys);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_keys_json = ffiPrivateAccountKeysToJson(keys);
|
output_keys_json = ffiPrivateAccountKeysToJson(keys);
|
||||||
wallet_ffi_free_private_account_keys(&keys);
|
wallet_ffi_free_private_account_keys(&keys);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -280,13 +280,13 @@ QString LogosExecutionZoneWalletModule::account_id_to_base58(const QString& acco
|
|||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::account_id_from_base58(
|
WalletFfiError LogosExecutionZoneWalletModule::account_id_from_base58(
|
||||||
const QString& base58_str,
|
const QString& base58_str,
|
||||||
QString& out_account_id_hex
|
QString& output_account_id_hex
|
||||||
) {
|
) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
const QByteArray utf8 = base58_str.toUtf8();
|
const QByteArray utf8 = base58_str.toUtf8();
|
||||||
const WalletFfiError error = wallet_ffi_account_id_from_base58(utf8.constData(), &id);
|
const WalletFfiError error = wallet_ffi_account_id_from_base58(utf8.constData(), &id);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_account_id_hex = bytes32ToHex(id);
|
output_account_id_hex = bytes32ToHex(id);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -297,12 +297,12 @@ WalletFfiError LogosExecutionZoneWalletModule::sync_to_block(const uint64_t bloc
|
|||||||
return wallet_ffi_sync_to_block(walletHandle, block_id);
|
return wallet_ffi_sync_to_block(walletHandle, block_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::get_last_synced_block(uint64_t* out_block_id) {
|
WalletFfiError LogosExecutionZoneWalletModule::get_last_synced_block(uint64_t* output_block_id) {
|
||||||
return wallet_ffi_get_last_synced_block(walletHandle, out_block_id);
|
return wallet_ffi_get_last_synced_block(walletHandle, output_block_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::get_current_block_height(uint64_t* out_block_height) {
|
WalletFfiError LogosExecutionZoneWalletModule::get_current_block_height(uint64_t* output_block_height) {
|
||||||
return wallet_ffi_get_current_block_height(walletHandle, out_block_height);
|
return wallet_ffi_get_current_block_height(walletHandle, output_block_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// === Operations ===
|
// === Operations ===
|
||||||
@ -311,7 +311,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_public(
|
|||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 fromId{}, toId{};
|
FfiBytes32 fromId{}, toId{};
|
||||||
if (!hexToBytes32(from_hex, &fromId) || !hexToBytes32(to_hex, &toId)) {
|
if (!hexToBytes32(from_hex, &fromId) || !hexToBytes32(to_hex, &toId)) {
|
||||||
@ -327,7 +327,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_public(
|
|||||||
FfiTransferResult result{};
|
FfiTransferResult result{};
|
||||||
const WalletFfiError error = wallet_ffi_transfer_public(walletHandle, &fromId, &toId, &amount, &result);
|
const WalletFfiError error = wallet_ffi_transfer_public(walletHandle, &fromId, &toId, &amount, &result);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_result_json = ffiTransferResultToJson(result);
|
output_result_json = ffiTransferResultToJson(result);
|
||||||
wallet_ffi_free_transfer_result(&result);
|
wallet_ffi_free_transfer_result(&result);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -337,7 +337,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_shielded(
|
|||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_keys_json,
|
const QString& to_keys_json,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 fromId{};
|
FfiBytes32 fromId{};
|
||||||
if (!hexToBytes32(from_hex, &fromId)) {
|
if (!hexToBytes32(from_hex, &fromId)) {
|
||||||
@ -359,7 +359,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_shielded(
|
|||||||
FfiTransferResult result{};
|
FfiTransferResult result{};
|
||||||
const WalletFfiError error = wallet_ffi_transfer_shielded(walletHandle, &fromId, &toKeys, &amount, &result);
|
const WalletFfiError error = wallet_ffi_transfer_shielded(walletHandle, &fromId, &toKeys, &amount, &result);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_result_json = ffiTransferResultToJson(result);
|
output_result_json = ffiTransferResultToJson(result);
|
||||||
wallet_ffi_free_transfer_result(&result);
|
wallet_ffi_free_transfer_result(&result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_deshielded(
|
|||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 fromId{}, toId{};
|
FfiBytes32 fromId{}, toId{};
|
||||||
if (!hexToBytes32(from_hex, &fromId) || !hexToBytes32(to_hex, &toId)) {
|
if (!hexToBytes32(from_hex, &fromId) || !hexToBytes32(to_hex, &toId)) {
|
||||||
@ -387,7 +387,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_deshielded(
|
|||||||
FfiTransferResult result{};
|
FfiTransferResult result{};
|
||||||
const WalletFfiError error = wallet_ffi_transfer_deshielded(walletHandle, &fromId, &toId, &amount, &result);
|
const WalletFfiError error = wallet_ffi_transfer_deshielded(walletHandle, &fromId, &toId, &amount, &result);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_result_json = ffiTransferResultToJson(result);
|
output_result_json = ffiTransferResultToJson(result);
|
||||||
wallet_ffi_free_transfer_result(&result);
|
wallet_ffi_free_transfer_result(&result);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -397,7 +397,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_private(
|
|||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_keys_json,
|
const QString& to_keys_json,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 fromId{};
|
FfiBytes32 fromId{};
|
||||||
if (!hexToBytes32(from_hex, &fromId)) {
|
if (!hexToBytes32(from_hex, &fromId)) {
|
||||||
@ -419,7 +419,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_private(
|
|||||||
FfiTransferResult result{};
|
FfiTransferResult result{};
|
||||||
const WalletFfiError error = wallet_ffi_transfer_private(walletHandle, &fromId, &toKeys, &amount, &result);
|
const WalletFfiError error = wallet_ffi_transfer_private(walletHandle, &fromId, &toKeys, &amount, &result);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_result_json = ffiTransferResultToJson(result);
|
output_result_json = ffiTransferResultToJson(result);
|
||||||
wallet_ffi_free_transfer_result(&result);
|
wallet_ffi_free_transfer_result(&result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_shielded_owned(
|
|||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 fromId{}, toId{};
|
FfiBytes32 fromId{}, toId{};
|
||||||
if (!hexToBytes32(from_hex, &fromId) || !hexToBytes32(to_hex, &toId)) {
|
if (!hexToBytes32(from_hex, &fromId) || !hexToBytes32(to_hex, &toId)) {
|
||||||
@ -447,7 +447,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_shielded_owned(
|
|||||||
FfiTransferResult result{};
|
FfiTransferResult result{};
|
||||||
const WalletFfiError error = wallet_ffi_transfer_shielded_owned(walletHandle, &fromId, &toId, &amount, &result);
|
const WalletFfiError error = wallet_ffi_transfer_shielded_owned(walletHandle, &fromId, &toId, &amount, &result);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_result_json = ffiTransferResultToJson(result);
|
output_result_json = ffiTransferResultToJson(result);
|
||||||
wallet_ffi_free_transfer_result(&result);
|
wallet_ffi_free_transfer_result(&result);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -457,7 +457,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_private_owned(
|
|||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 fromId{}, toId{};
|
FfiBytes32 fromId{}, toId{};
|
||||||
if (!hexToBytes32(from_hex, &fromId) || !hexToBytes32(to_hex, &toId)) {
|
if (!hexToBytes32(from_hex, &fromId) || !hexToBytes32(to_hex, &toId)) {
|
||||||
@ -473,7 +473,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_private_owned(
|
|||||||
FfiTransferResult result{};
|
FfiTransferResult result{};
|
||||||
const WalletFfiError error = wallet_ffi_transfer_private_owned(walletHandle, &fromId, &toId, &amount, &result);
|
const WalletFfiError error = wallet_ffi_transfer_private_owned(walletHandle, &fromId, &toId, &amount, &result);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_result_json = ffiTransferResultToJson(result);
|
output_result_json = ffiTransferResultToJson(result);
|
||||||
wallet_ffi_free_transfer_result(&result);
|
wallet_ffi_free_transfer_result(&result);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -481,7 +481,7 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_private_owned(
|
|||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::register_public_account(
|
WalletFfiError LogosExecutionZoneWalletModule::register_public_account(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
if (!hexToBytes32(account_id_hex, &id)) {
|
if (!hexToBytes32(account_id_hex, &id)) {
|
||||||
@ -490,7 +490,7 @@ WalletFfiError LogosExecutionZoneWalletModule::register_public_account(
|
|||||||
FfiTransferResult result{};
|
FfiTransferResult result{};
|
||||||
const WalletFfiError error = wallet_ffi_register_public_account(walletHandle, &id, &result);
|
const WalletFfiError error = wallet_ffi_register_public_account(walletHandle, &id, &result);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_result_json = ffiTransferResultToJson(result);
|
output_result_json = ffiTransferResultToJson(result);
|
||||||
wallet_ffi_free_transfer_result(&result);
|
wallet_ffi_free_transfer_result(&result);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -498,7 +498,7 @@ WalletFfiError LogosExecutionZoneWalletModule::register_public_account(
|
|||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::register_private_account(
|
WalletFfiError LogosExecutionZoneWalletModule::register_private_account(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) {
|
) {
|
||||||
FfiBytes32 id{};
|
FfiBytes32 id{};
|
||||||
if (!hexToBytes32(account_id_hex, &id)) {
|
if (!hexToBytes32(account_id_hex, &id)) {
|
||||||
@ -507,7 +507,7 @@ WalletFfiError LogosExecutionZoneWalletModule::register_private_account(
|
|||||||
FfiTransferResult result{};
|
FfiTransferResult result{};
|
||||||
const WalletFfiError error = wallet_ffi_register_private_account(walletHandle, &id, &result);
|
const WalletFfiError error = wallet_ffi_register_private_account(walletHandle, &id, &result);
|
||||||
if (error == SUCCESS) {
|
if (error == SUCCESS) {
|
||||||
out_result_json = ffiTransferResultToJson(result);
|
output_result_json = ffiTransferResultToJson(result);
|
||||||
wallet_ffi_free_transfer_result(&result);
|
wallet_ffi_free_transfer_result(&result);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
|
|||||||
@ -31,79 +31,79 @@ public:
|
|||||||
// === Logos Execution Zone Wallet ===
|
// === Logos Execution Zone Wallet ===
|
||||||
|
|
||||||
// Account Management
|
// Account Management
|
||||||
Q_INVOKABLE WalletFfiError create_account_public(QString& out_account_id_hex) override;
|
Q_INVOKABLE WalletFfiError create_account_public(QString& output_account_id_hex) override;
|
||||||
Q_INVOKABLE WalletFfiError create_account_private(QString& out_account_id_hex) override;
|
Q_INVOKABLE WalletFfiError create_account_private(QString& output_account_id_hex) override;
|
||||||
Q_INVOKABLE WalletFfiError list_accounts(QJsonArray& out_list) override;
|
Q_INVOKABLE WalletFfiError list_accounts(QJsonArray& output_list) override;
|
||||||
|
|
||||||
// Account Queries
|
// Account Queries
|
||||||
Q_INVOKABLE WalletFfiError get_balance(
|
Q_INVOKABLE WalletFfiError get_balance(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
bool is_public,
|
bool is_public,
|
||||||
QString& out_balance_le16_hex
|
QString& output_balance_le16_hex
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError
|
Q_INVOKABLE WalletFfiError
|
||||||
get_account_public(const QString& account_id_hex, QString& out_account_json) override;
|
get_account_public(const QString& account_id_hex, QString& output_account_json) override;
|
||||||
Q_INVOKABLE WalletFfiError
|
Q_INVOKABLE WalletFfiError
|
||||||
get_account_private(const QString& account_id_hex, QString& out_account_json) override;
|
get_account_private(const QString& account_id_hex, QString& output_account_json) override;
|
||||||
Q_INVOKABLE WalletFfiError get_public_account_key(
|
Q_INVOKABLE WalletFfiError get_public_account_key(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_public_key_hex
|
QString& output_public_key_hex
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError get_private_account_keys(
|
Q_INVOKABLE WalletFfiError get_private_account_keys(
|
||||||
const QString& account_id_hex,
|
const QString& account_id_hex,
|
||||||
QString& out_keys_json
|
QString& output_keys_json
|
||||||
) override;
|
) override;
|
||||||
|
|
||||||
// Account Encoding
|
// Account Encoding
|
||||||
Q_INVOKABLE QString account_id_to_base58(const QString& account_id_hex) override;
|
Q_INVOKABLE QString account_id_to_base58(const QString& account_id_hex) override;
|
||||||
Q_INVOKABLE WalletFfiError account_id_from_base58(const QString& base58_str, QString& out_account_id_hex) override;
|
Q_INVOKABLE WalletFfiError account_id_from_base58(const QString& base58_str, QString& output_account_id_hex) override;
|
||||||
|
|
||||||
// Blockchain Synchronisation
|
// Blockchain Synchronisation
|
||||||
Q_INVOKABLE WalletFfiError sync_to_block(uint64_t block_id) override;
|
Q_INVOKABLE WalletFfiError sync_to_block(uint64_t block_id) override;
|
||||||
Q_INVOKABLE WalletFfiError get_last_synced_block(uint64_t* out_block_id) override;
|
Q_INVOKABLE WalletFfiError get_last_synced_block(uint64_t* output_block_id) override;
|
||||||
Q_INVOKABLE WalletFfiError get_current_block_height(uint64_t* out_block_height) override;
|
Q_INVOKABLE WalletFfiError get_current_block_height(uint64_t* output_block_height) override;
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
Q_INVOKABLE WalletFfiError transfer_public(
|
Q_INVOKABLE WalletFfiError transfer_public(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError transfer_shielded(
|
Q_INVOKABLE WalletFfiError transfer_shielded(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_keys_json,
|
const QString& to_keys_json,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError transfer_deshielded(
|
Q_INVOKABLE WalletFfiError transfer_deshielded(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError transfer_private(
|
Q_INVOKABLE WalletFfiError transfer_private(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_keys_json,
|
const QString& to_keys_json,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError transfer_shielded_owned(
|
Q_INVOKABLE WalletFfiError transfer_shielded_owned(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError transfer_private_owned(
|
Q_INVOKABLE WalletFfiError transfer_private_owned(
|
||||||
const QString& from_hex,
|
const QString& from_hex,
|
||||||
const QString& to_hex,
|
const QString& to_hex,
|
||||||
const QString& amount_le16_hex,
|
const QString& amount_le16_hex,
|
||||||
QString& out_result_json
|
QString& output_result_json
|
||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError
|
Q_INVOKABLE WalletFfiError
|
||||||
register_public_account(const QString& account_id_hex, QString& out_result_json) override;
|
register_public_account(const QString& account_id_hex, QString& output_result_json) override;
|
||||||
Q_INVOKABLE WalletFfiError
|
Q_INVOKABLE WalletFfiError
|
||||||
register_private_account(const QString& account_id_hex, QString& out_result_json) override;
|
register_private_account(const QString& account_id_hex, QString& output_result_json) override;
|
||||||
|
|
||||||
// Wallet Lifecycle
|
// Wallet Lifecycle
|
||||||
Q_INVOKABLE WalletFfiError create_new(
|
Q_INVOKABLE WalletFfiError create_new(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user