mirror of
https://github.com/logos-blockchain/logos-execution-zone-module.git
synced 2026-04-03 20:53:14 +00:00
Merge pull request #2 from logos-blockchain/dsq/new-wallet-ffi-calls
feat(wallet): Add transfer calls
This commit is contained in:
commit
35f9e768c5
6
flake.lock
generated
6
flake.lock
generated
@ -350,11 +350,11 @@
|
|||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1770907667,
|
"lastModified": 1771403500,
|
||||||
"narHash": "sha256-HclY4daI8MvVGNmC+SWsrqobeYx0B6l/PB2NKG//Kj8=",
|
"narHash": "sha256-KnDqKhMjNjknUdtSupIhrTOR8CUCVHEi8ZEkEb/DUKU=",
|
||||||
"owner": "logos-blockchain",
|
"owner": "logos-blockchain",
|
||||||
"repo": "lssa",
|
"repo": "lssa",
|
||||||
"rev": "cb6fb881ace809bd452f2b8cab83802af68b9a56",
|
"rev": "27f31cf3d045506e3f0e887628057e15c7588463",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@ -39,6 +39,11 @@ public:
|
|||||||
const FfiBytes32* account_id,
|
const FfiBytes32* account_id,
|
||||||
FfiAccount* out_account
|
FfiAccount* out_account
|
||||||
) = 0;
|
) = 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 void free_account_data(FfiAccount* account) = 0;
|
||||||
virtual WalletFfiError get_public_account_key(
|
virtual WalletFfiError get_public_account_key(
|
||||||
WalletHandle* handle,
|
WalletHandle* handle,
|
||||||
@ -69,11 +74,51 @@ public:
|
|||||||
const QByteArray& amount_le16,
|
const QByteArray& amount_le16,
|
||||||
FfiTransferResult* out_result
|
FfiTransferResult* out_result
|
||||||
) = 0;
|
) = 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(
|
virtual WalletFfiError register_public_account(
|
||||||
WalletHandle* handle,
|
WalletHandle* handle,
|
||||||
const FfiBytes32* account_id,
|
const FfiBytes32* account_id,
|
||||||
FfiTransferResult* out_result
|
FfiTransferResult* out_result
|
||||||
) = 0;
|
) = 0;
|
||||||
|
virtual WalletFfiError register_private_account(
|
||||||
|
WalletHandle* handle,
|
||||||
|
const FfiBytes32* account_id,
|
||||||
|
FfiTransferResult* out_result
|
||||||
|
) = 0;
|
||||||
virtual void free_transfer_result(FfiTransferResult* result) = 0;
|
virtual void free_transfer_result(FfiTransferResult* result) = 0;
|
||||||
|
|
||||||
// Wallet Lifecycle
|
// Wallet Lifecycle
|
||||||
|
|||||||
@ -68,6 +68,14 @@ WalletFfiError LogosExecutionZoneWalletModule::get_account_public(
|
|||||||
return wallet_ffi_get_account_public(handle, account_id, out_account);
|
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) {
|
void LogosExecutionZoneWalletModule::free_account_data(FfiAccount* account) {
|
||||||
wallet_ffi_free_account_data(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);
|
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(
|
WalletFfiError LogosExecutionZoneWalletModule::register_public_account(
|
||||||
WalletHandle* handle,
|
WalletHandle* handle,
|
||||||
const FfiBytes32* account_id,
|
const FfiBytes32* account_id,
|
||||||
@ -158,6 +256,14 @@ WalletFfiError LogosExecutionZoneWalletModule::register_public_account(
|
|||||||
return wallet_ffi_register_public_account(handle, account_id, out_result);
|
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) {
|
void LogosExecutionZoneWalletModule::free_transfer_result(FfiTransferResult* result) {
|
||||||
wallet_ffi_free_transfer_result(result);
|
wallet_ffi_free_transfer_result(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,8 @@ public:
|
|||||||
) override;
|
) override;
|
||||||
Q_INVOKABLE WalletFfiError
|
Q_INVOKABLE WalletFfiError
|
||||||
get_account_public(WalletHandle* handle, const FfiBytes32* account_id, FfiAccount* out_account) override;
|
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 void free_account_data(FfiAccount* account) override;
|
||||||
Q_INVOKABLE WalletFfiError get_public_account_key(
|
Q_INVOKABLE WalletFfiError get_public_account_key(
|
||||||
WalletHandle* handle,
|
WalletHandle* handle,
|
||||||
@ -74,8 +76,45 @@ public:
|
|||||||
const QByteArray& amount_le16,
|
const QByteArray& amount_le16,
|
||||||
FfiTransferResult* out_result
|
FfiTransferResult* out_result
|
||||||
) override;
|
) 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
|
Q_INVOKABLE WalletFfiError
|
||||||
register_public_account(WalletHandle* handle, const FfiBytes32* account_id, FfiTransferResult* out_result) override;
|
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;
|
Q_INVOKABLE void free_transfer_result(FfiTransferResult* result) override;
|
||||||
|
|
||||||
// Wallet Lifecycle
|
// Wallet Lifecycle
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user