mirror of
https://github.com/logos-blockchain/logos-execution-zone-module.git
synced 2026-04-02 12:13:48 +00:00
Add transfer calls
This commit is contained in:
parent
b643d3502e
commit
2aced61648
6
flake.lock
generated
6
flake.lock
generated
@ -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": {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user