From 2aced616482f78a1cf913fda0950e346e3623a01 Mon Sep 17 00:00:00 2001 From: danielSanchezQ <3danimanimal@gmail.com> Date: Wed, 18 Feb 2026 09:20:58 +0000 Subject: [PATCH] Add transfer calls --- flake.lock | 6 +- src/i_logos_execution_zone_wallet_module.h | 45 +++++++++ src/logos_execution_zone_wallet_module.cpp | 106 +++++++++++++++++++++ src/logos_execution_zone_wallet_module.h | 39 ++++++++ 4 files changed, 193 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 52a8048..ffa467e 100644 --- a/flake.lock +++ b/flake.lock @@ -350,11 +350,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1770907667, - "narHash": "sha256-HclY4daI8MvVGNmC+SWsrqobeYx0B6l/PB2NKG//Kj8=", + "lastModified": 1771403500, + "narHash": "sha256-KnDqKhMjNjknUdtSupIhrTOR8CUCVHEi8ZEkEb/DUKU=", "owner": "logos-blockchain", "repo": "lssa", - "rev": "cb6fb881ace809bd452f2b8cab83802af68b9a56", + "rev": "27f31cf3d045506e3f0e887628057e15c7588463", "type": "github" }, "original": { diff --git a/src/i_logos_execution_zone_wallet_module.h b/src/i_logos_execution_zone_wallet_module.h index 7674022..f03749d 100644 --- a/src/i_logos_execution_zone_wallet_module.h +++ b/src/i_logos_execution_zone_wallet_module.h @@ -39,6 +39,11 @@ public: const FfiBytes32* account_id, FfiAccount* out_account ) = 0; + virtual WalletFfiError get_account_private( + WalletHandle* handle, + const FfiBytes32* account_id, + FfiAccount* out_account + ) = 0; virtual void free_account_data(FfiAccount* account) = 0; virtual WalletFfiError get_public_account_key( WalletHandle* handle, @@ -69,11 +74,51 @@ public: const QByteArray& amount_le16, FfiTransferResult* out_result ) = 0; + virtual WalletFfiError transfer_shielded( + WalletHandle* handle, + const FfiBytes32* from, + const FfiPrivateAccountKeys* to_keys, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) = 0; + virtual WalletFfiError transfer_deshielded( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) = 0; + virtual WalletFfiError transfer_private( + WalletHandle* handle, + const FfiBytes32* from, + const FfiPrivateAccountKeys* to_keys, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) = 0; + virtual WalletFfiError transfer_shielded_owned( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) = 0; + virtual WalletFfiError transfer_private_owned( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) = 0; virtual WalletFfiError register_public_account( WalletHandle* handle, const FfiBytes32* account_id, FfiTransferResult* out_result ) = 0; + virtual WalletFfiError register_private_account( + WalletHandle* handle, + const FfiBytes32* account_id, + FfiTransferResult* out_result + ) = 0; virtual void free_transfer_result(FfiTransferResult* result) = 0; // Wallet Lifecycle diff --git a/src/logos_execution_zone_wallet_module.cpp b/src/logos_execution_zone_wallet_module.cpp index 7c2a713..b93ed9c 100644 --- a/src/logos_execution_zone_wallet_module.cpp +++ b/src/logos_execution_zone_wallet_module.cpp @@ -68,6 +68,14 @@ WalletFfiError LogosExecutionZoneWalletModule::get_account_public( return wallet_ffi_get_account_public(handle, account_id, out_account); } +WalletFfiError LogosExecutionZoneWalletModule::get_account_private( + WalletHandle* handle, + const FfiBytes32* account_id, + FfiAccount* out_account +) { + return wallet_ffi_get_account_private(handle, account_id, out_account); +} + void LogosExecutionZoneWalletModule::free_account_data(FfiAccount* account) { wallet_ffi_free_account_data(account); } @@ -150,6 +158,96 @@ WalletFfiError LogosExecutionZoneWalletModule::transfer_public( return wallet_ffi_transfer_public(handle, from, to, &amount, out_result); } +WalletFfiError LogosExecutionZoneWalletModule::transfer_shielded( + WalletHandle* handle, + const FfiBytes32* from, + const FfiPrivateAccountKeys* to_keys, + const QByteArray& amount_le16, + FfiTransferResult* out_result +) { + if (amount_le16.size() != 16) { + qWarning() << "transfer_shielded: amount_le16 must be 16 bytes"; + return SERIALIZATION_ERROR; + } + + uint8_t amount[16]; + memcpy(amount, amount_le16.constData(), 16); + + return wallet_ffi_transfer_shielded(handle, from, to_keys, &amount, out_result); +} + +WalletFfiError LogosExecutionZoneWalletModule::transfer_deshielded( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result +) { + if (amount_le16.size() != 16) { + qWarning() << "transfer_deshielded: amount_le16 must be 16 bytes"; + return SERIALIZATION_ERROR; + } + + uint8_t amount[16]; + memcpy(amount, amount_le16.constData(), 16); + + return wallet_ffi_transfer_deshielded(handle, from, to, &amount, out_result); +} + +WalletFfiError LogosExecutionZoneWalletModule::transfer_private( + WalletHandle* handle, + const FfiBytes32* from, + const FfiPrivateAccountKeys* to_keys, + const QByteArray& amount_le16, + FfiTransferResult* out_result +) { + if (amount_le16.size() != 16) { + qWarning() << "transfer_private: amount_le16 must be 16 bytes"; + return SERIALIZATION_ERROR; + } + + uint8_t amount[16]; + memcpy(amount, amount_le16.constData(), 16); + + return wallet_ffi_transfer_private(handle, from, to_keys, &amount, out_result); +} + +WalletFfiError LogosExecutionZoneWalletModule::transfer_shielded_owned( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result +) { + if (amount_le16.size() != 16) { + qWarning() << "transfer_shielded_owned: amount_le16 must be 16 bytes"; + return SERIALIZATION_ERROR; + } + + uint8_t amount[16]; + memcpy(amount, amount_le16.constData(), 16); + + return wallet_ffi_transfer_shielded_owned(handle, from, to, &amount, out_result); +} + +WalletFfiError LogosExecutionZoneWalletModule::transfer_private_owned( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result +) { + if (amount_le16.size() != 16) { + qWarning() << "transfer_private_owned: amount_le16 must be 16 bytes"; + return SERIALIZATION_ERROR; + } + + uint8_t amount[16]; + memcpy(amount, amount_le16.constData(), 16); + + return wallet_ffi_transfer_private_owned(handle, from, to, &amount, out_result); +} + WalletFfiError LogosExecutionZoneWalletModule::register_public_account( WalletHandle* handle, const FfiBytes32* account_id, @@ -158,6 +256,14 @@ WalletFfiError LogosExecutionZoneWalletModule::register_public_account( return wallet_ffi_register_public_account(handle, account_id, out_result); } +WalletFfiError LogosExecutionZoneWalletModule::register_private_account( + WalletHandle* handle, + const FfiBytes32* account_id, + FfiTransferResult* out_result +) { + return wallet_ffi_register_private_account(handle, account_id, out_result); +} + void LogosExecutionZoneWalletModule::free_transfer_result(FfiTransferResult* result) { wallet_ffi_free_transfer_result(result); } diff --git a/src/logos_execution_zone_wallet_module.h b/src/logos_execution_zone_wallet_module.h index 6033eb9..e50080d 100644 --- a/src/logos_execution_zone_wallet_module.h +++ b/src/logos_execution_zone_wallet_module.h @@ -44,6 +44,8 @@ public: ) override; Q_INVOKABLE WalletFfiError get_account_public(WalletHandle* handle, const FfiBytes32* account_id, FfiAccount* out_account) override; + Q_INVOKABLE WalletFfiError + get_account_private(WalletHandle* handle, const FfiBytes32* account_id, FfiAccount* out_account) override; Q_INVOKABLE void free_account_data(FfiAccount* account) override; Q_INVOKABLE WalletFfiError get_public_account_key( WalletHandle* handle, @@ -74,8 +76,45 @@ public: const QByteArray& amount_le16, FfiTransferResult* out_result ) override; + Q_INVOKABLE WalletFfiError transfer_shielded( + WalletHandle* handle, + const FfiBytes32* from, + const FfiPrivateAccountKeys* to_keys, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) override; + Q_INVOKABLE WalletFfiError transfer_deshielded( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) override; + Q_INVOKABLE WalletFfiError transfer_private( + WalletHandle* handle, + const FfiBytes32* from, + const FfiPrivateAccountKeys* to_keys, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) override; + Q_INVOKABLE WalletFfiError transfer_shielded_owned( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) override; + Q_INVOKABLE WalletFfiError transfer_private_owned( + WalletHandle* handle, + const FfiBytes32* from, + const FfiBytes32* to, + const QByteArray& amount_le16, + FfiTransferResult* out_result + ) override; Q_INVOKABLE WalletFfiError register_public_account(WalletHandle* handle, const FfiBytes32* account_id, FfiTransferResult* out_result) override; + Q_INVOKABLE WalletFfiError + register_private_account(WalletHandle* handle, const FfiBytes32* account_id, FfiTransferResult* out_result) override; Q_INVOKABLE void free_transfer_result(FfiTransferResult* result) override; // Wallet Lifecycle