From e69e4f86de7f3536bb7594af178684fda5408c96 Mon Sep 17 00:00:00 2001 From: Ez3kiel Date: Tue, 30 Jul 2024 22:52:48 +0200 Subject: [PATCH] feat(daemon): splitAddress RPC method --- lib/src/data_transfer_objects/dtos.dart | 4 ++-- .../split_address/split_address_params.dart | 0 .../split_address/split_address_params.freezed.dart | 0 .../split_address/split_address_params.g.dart | 0 .../split_address/split_address_result.dart | 0 .../split_address/split_address_result.freezed.dart | 0 .../split_address/split_address_result.g.dart | 0 lib/src/repositories/daemon/daemon_constants.dart | 5 ++++- .../daemon/daemon_rpc_methods_extension.dart | 11 +++++++++++ .../wallet/wallet_rpc_methods_extension.dart | 3 ++- 10 files changed, 19 insertions(+), 4 deletions(-) rename lib/src/data_transfer_objects/{wallet => }/split_address/split_address_params.dart (100%) rename lib/src/data_transfer_objects/{wallet => }/split_address/split_address_params.freezed.dart (100%) rename lib/src/data_transfer_objects/{wallet => }/split_address/split_address_params.g.dart (100%) rename lib/src/data_transfer_objects/{wallet => }/split_address/split_address_result.dart (100%) rename lib/src/data_transfer_objects/{wallet => }/split_address/split_address_result.freezed.dart (100%) rename lib/src/data_transfer_objects/{wallet => }/split_address/split_address_result.g.dart (100%) diff --git a/lib/src/data_transfer_objects/dtos.dart b/lib/src/data_transfer_objects/dtos.dart index 2c26131..9dc4913 100644 --- a/lib/src/data_transfer_objects/dtos.dart +++ b/lib/src/data_transfer_objects/dtos.dart @@ -55,6 +55,8 @@ export 'network/network.dart'; export 'p2p_status/p2p_status_result.dart'; export 'peer_peer_disconnected_event/peer_peer_disconnected_event.dart'; export 'peer_peer_list_updated_event/peer_peer_list_updated_event.dart'; +export 'split_address/split_address_params.dart'; +export 'split_address/split_address_result.dart'; export 'stable_height_changed_event/stable_height_changed_event.dart'; export 'submit_block/submit_block_params.dart'; export 'submit_transaction/submit_transaction_params.dart'; @@ -75,8 +77,6 @@ export 'wallet/get_address/get_address_params.dart'; export 'wallet/get_balance/get_wallet_balance_params.dart'; export 'wallet/list_transactions/list_transactions_params.dart'; export 'wallet/rescan/rescan_params.dart'; -export 'wallet/split_address/split_address_params.dart'; -export 'wallet/split_address/split_address_result.dart'; export 'wallet/transaction_entry/transaction_entry.dart'; export 'wallet/transaction_entry/transaction_entry_type.dart'; export 'wallet/transaction_entry/transfer_in_entry.dart'; diff --git a/lib/src/data_transfer_objects/wallet/split_address/split_address_params.dart b/lib/src/data_transfer_objects/split_address/split_address_params.dart similarity index 100% rename from lib/src/data_transfer_objects/wallet/split_address/split_address_params.dart rename to lib/src/data_transfer_objects/split_address/split_address_params.dart diff --git a/lib/src/data_transfer_objects/wallet/split_address/split_address_params.freezed.dart b/lib/src/data_transfer_objects/split_address/split_address_params.freezed.dart similarity index 100% rename from lib/src/data_transfer_objects/wallet/split_address/split_address_params.freezed.dart rename to lib/src/data_transfer_objects/split_address/split_address_params.freezed.dart diff --git a/lib/src/data_transfer_objects/wallet/split_address/split_address_params.g.dart b/lib/src/data_transfer_objects/split_address/split_address_params.g.dart similarity index 100% rename from lib/src/data_transfer_objects/wallet/split_address/split_address_params.g.dart rename to lib/src/data_transfer_objects/split_address/split_address_params.g.dart diff --git a/lib/src/data_transfer_objects/wallet/split_address/split_address_result.dart b/lib/src/data_transfer_objects/split_address/split_address_result.dart similarity index 100% rename from lib/src/data_transfer_objects/wallet/split_address/split_address_result.dart rename to lib/src/data_transfer_objects/split_address/split_address_result.dart diff --git a/lib/src/data_transfer_objects/wallet/split_address/split_address_result.freezed.dart b/lib/src/data_transfer_objects/split_address/split_address_result.freezed.dart similarity index 100% rename from lib/src/data_transfer_objects/wallet/split_address/split_address_result.freezed.dart rename to lib/src/data_transfer_objects/split_address/split_address_result.freezed.dart diff --git a/lib/src/data_transfer_objects/wallet/split_address/split_address_result.g.dart b/lib/src/data_transfer_objects/split_address/split_address_result.g.dart similarity index 100% rename from lib/src/data_transfer_objects/wallet/split_address/split_address_result.g.dart rename to lib/src/data_transfer_objects/split_address/split_address_result.g.dart diff --git a/lib/src/repositories/daemon/daemon_constants.dart b/lib/src/repositories/daemon/daemon_constants.dart index 0b282ab..f560872 100644 --- a/lib/src/repositories/daemon/daemon_constants.dart +++ b/lib/src/repositories/daemon/daemon_constants.dart @@ -152,7 +152,10 @@ enum DaemonMethod implements XelisJsonKey { getDifficulty('get_difficulty'), /// Validate an address - validateAddress('validate_address'); + validateAddress('validate_address'), + + /// Splits address and integrated data into two different fields. + splitAddress('split_address'); /// Creates a new [DaemonMethod] instance. const DaemonMethod(this.jsonKey); diff --git a/lib/src/repositories/daemon/daemon_rpc_methods_extension.dart b/lib/src/repositories/daemon/daemon_rpc_methods_extension.dart index 59038ee..e8cae87 100644 --- a/lib/src/repositories/daemon/daemon_rpc_methods_extension.dart +++ b/lib/src/repositories/daemon/daemon_rpc_methods_extension.dart @@ -462,4 +462,15 @@ extension DaemonRpcMethodsExtension on DaemonClient { final result = await sendRequest(DaemonMethod.getDifficulty); return GetDifficultyResult.fromJson(result as Map); } + + /// Splits address and integrated data into two different fields. + Future splitAddress( + SplitAddressParams splitAddressParams, + ) async { + final result = await sendRequest( + DaemonMethod.splitAddress, + splitAddressParams.toJson(), + ); + return SplitAddressResult.fromJson(result as Map); + } } diff --git a/lib/src/repositories/wallet/wallet_rpc_methods_extension.dart b/lib/src/repositories/wallet/wallet_rpc_methods_extension.dart index aceda16..853f337 100644 --- a/lib/src/repositories/wallet/wallet_rpc_methods_extension.dart +++ b/lib/src/repositories/wallet/wallet_rpc_methods_extension.dart @@ -53,7 +53,8 @@ extension WalletRpcMethodsExtension on WalletClient { /// until the specified topoheight. /// When no topoheight is set, it rescan until 0. /// - /// **WARNING**: All balances and transactions will be deleted from wallet storage to be up-to-date with the chain of the node connected to. + /// **WARNING**: All balances and transactions will be deleted from wallet + /// storage to be up-to-date with the chain of the node connected to. Future rescan(RescanParams rescanParams) async { final result = await sendRequest( WalletMethod.rescan,