diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index e7e9c31c..23fc6b63 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -325,10 +325,10 @@ pub trait OwnerRpc { "token": "d202964900000000d302964900000000d402964900000000d502964900000000", "refresh_from_node": true, "query": { - "min_id_inc": 0, - "max_id_inc": 100, - "min_amount_inc": "0", - "max_amount_inc": "60000000000", + "min_id": 0, + "max_id": 100, + "min_amount": "0", + "max_amount": "60000000000", "sort_field": "Id", "sort_order": "Asc" } diff --git a/controller/tests/tx_list_filter.rs b/controller/tests/tx_list_filter.rs index 4a8676f3..f105a281 100644 --- a/controller/tests/tx_list_filter.rs +++ b/controller/tests/tx_list_filter.rs @@ -56,7 +56,7 @@ fn test_wallet_tx_filtering( ) -> Result<(), libwallet::Error> { wallet::controller::owner_single_use(Some(wallet.clone()), mask, None, |api, _m| { let mut tx_query_args = RetrieveTxQueryArgs::default(); - tx_query_args.min_id_inc = Some(5); + tx_query_args.min_id = Some(5); // Min ID let tx_results = api @@ -67,8 +67,8 @@ fn test_wallet_tx_filtering( // Max ID let mut tx_query_args = RetrieveTxQueryArgs::default(); - tx_query_args.min_id_inc = Some(5); - tx_query_args.max_id_inc = Some(20); + tx_query_args.min_id = Some(5); + tx_query_args.max_id = Some(20); let tx_results = api .retrieve_txs(mask, true, None, None, Some(tx_query_args))? .1; @@ -78,8 +78,8 @@ fn test_wallet_tx_filtering( // Exclude 1 cancelled let mut tx_query_args = RetrieveTxQueryArgs::default(); tx_query_args.exclude_cancelled = Some(true); - tx_query_args.min_id_inc = Some(5); - tx_query_args.max_id_inc = Some(50); + tx_query_args.min_id = Some(5); + tx_query_args.max_id = Some(50); let tx_results = api .retrieve_txs(mask, true, None, None, Some(tx_query_args))? .1; @@ -89,8 +89,8 @@ fn test_wallet_tx_filtering( let mut tx_query_args = RetrieveTxQueryArgs::default(); tx_query_args.exclude_cancelled = Some(true); tx_query_args.include_confirmed_only = Some(true); - tx_query_args.min_id_inc = Some(5); - tx_query_args.max_id_inc = Some(50); + tx_query_args.min_id = Some(5); + tx_query_args.max_id = Some(50); let tx_results = api .retrieve_txs(mask, true, None, None, Some(tx_query_args))? .1; @@ -100,8 +100,8 @@ fn test_wallet_tx_filtering( let mut tx_query_args = RetrieveTxQueryArgs::default(); tx_query_args.exclude_cancelled = Some(false); tx_query_args.include_outstanding_only = Some(true); - tx_query_args.min_id_inc = Some(5); - tx_query_args.max_id_inc = Some(50); + tx_query_args.min_id = Some(5); + tx_query_args.max_id = Some(50); let tx_results = api .retrieve_txs(mask, true, None, None, Some(tx_query_args))? .1; @@ -112,8 +112,8 @@ fn test_wallet_tx_filtering( tx_query_args.exclude_cancelled = Some(false); tx_query_args.include_outstanding_only = Some(true); tx_query_args.include_confirmed_only = Some(true); - tx_query_args.min_id_inc = Some(5); - tx_query_args.max_id_inc = Some(50); + tx_query_args.min_id = Some(5); + tx_query_args.max_id = Some(50); let tx_results = api .retrieve_txs(mask, true, None, None, Some(tx_query_args))? .1; @@ -162,7 +162,7 @@ fn test_wallet_tx_filtering( // amount, should see as above with coinbases excluded let mut tx_query_args = RetrieveTxQueryArgs::default(); tx_query_args.min_amount_inc = Some(60_000_000_000 - 59_963_300_000); - tx_query_args.max_amount_inc = Some(60_000_000_000 - 1); + tx_query_args.max_amount = Some(60_000_000_000 - 1); let tx_results = api .retrieve_txs(mask, true, None, None, Some(tx_query_args))? .1; diff --git a/libwallet/src/api_impl/types.rs b/libwallet/src/api_impl/types.rs index 2c35cc43..64e33ba1 100644 --- a/libwallet/src/api_impl/types.rs +++ b/libwallet/src/api_impl/types.rs @@ -180,10 +180,10 @@ pub enum RetrieveTxQuerySortField { pub struct RetrieveTxQueryArgs { /// Retrieve transactions with an id higher than or equal to the given /// If None, consider items from the first transaction and later - pub min_id_inc: Option, + pub min_id: Option, /// Retrieve tranactions with an id less than or equal to the given /// If None, consider items from the last transaction and earlier - pub max_id_inc: Option, + pub max_id: Option, /// The maximum number of transactions to return /// if both `before_id_inc` and `after_id_inc` are supplied, this will apply /// to the before and earlier set @@ -209,15 +209,15 @@ pub struct RetrieveTxQueryArgs { /// higher bound on the total amount (amount_credited - amount_debited), inclusive #[serde(with = "secp_ser::opt_string_or_u64")] #[serde(default)] - pub max_amount_inc: Option, + pub max_amount: Option, /// lower bound on the creation timestamp, inclusive - pub min_creation_timestamp_inc: Option>, + pub min_creation_timestamp: Option>, /// higher bound on on the creation timestamp, inclusive - pub max_creation_timestamp_inc: Option>, + pub max_creation_timestamp: Option>, /// lower bound on the confirmation timestamp, inclusive - pub min_confirmed_timestamp_inc: Option>, + pub min_confirmed_timestamp: Option>, /// higher bound on the confirmation timestamp, inclusive - pub max_confirmed_timestamp_inc: Option>, + pub max_confirmed_timestamp: Option>, /// Field within the tranasction list on which to sort /// defaults to ID if not present pub sort_field: Option, @@ -228,8 +228,8 @@ pub struct RetrieveTxQueryArgs { impl Default for RetrieveTxQueryArgs { fn default() -> Self { Self { - min_id_inc: None, - max_id_inc: None, + min_id: None, + max_id: None, limit: None, exclude_cancelled: Some(false), include_outstanding_only: Some(false), @@ -239,11 +239,11 @@ impl Default for RetrieveTxQueryArgs { include_coinbase_only: Some(false), include_reverted_only: Some(false), min_amount_inc: None, - max_amount_inc: None, - min_creation_timestamp_inc: None, - max_creation_timestamp_inc: None, - min_confirmed_timestamp_inc: None, - max_confirmed_timestamp_inc: None, + max_amount: None, + min_creation_timestamp: None, + max_creation_timestamp: None, + min_confirmed_timestamp: None, + max_confirmed_timestamp: None, sort_field: Some(RetrieveTxQuerySortField::Id), sort_order: Some(RetrieveTxQuerySortOrder::Asc), } diff --git a/libwallet/src/internal/updater.rs b/libwallet/src/internal/updater.rs index ad5ada1d..8462d37c 100644 --- a/libwallet/src/internal/updater.rs +++ b/libwallet/src/internal/updater.rs @@ -188,14 +188,14 @@ where } }) .filter(|tx_entry| { - if let Some(v) = query_args.min_id_inc { + if let Some(v) = query_args.min_id { tx_entry.id >= v } else { true } }) .filter(|tx_entry| { - if let Some(v) = query_args.max_id_inc { + if let Some(v) = query_args.max_id { tx_entry.id <= v } else { true @@ -219,7 +219,7 @@ where } }) .filter(|tx_entry| { - if let Some(v) = query_args.max_amount_inc { + if let Some(v) = query_args.max_amount { if tx_entry.tx_type == TxLogEntryType::TxSent || tx_entry.tx_type == TxLogEntryType::TxSentCancelled { @@ -236,21 +236,21 @@ where } }) .filter(|tx_entry| { - if let Some(v) = query_args.min_creation_timestamp_inc { + if let Some(v) = query_args.min_creation_timestamp { tx_entry.creation_ts >= v } else { true } }) .filter(|tx_entry| { - if let Some(v) = query_args.min_confirmed_timestamp_inc { + if let Some(v) = query_args.min_confirmed_timestamp { tx_entry.creation_ts <= v } else { true } }) .filter(|tx_entry| { - if let Some(v) = query_args.min_confirmed_timestamp_inc { + if let Some(v) = query_args.min_confirmed_timestamp { if let Some(t) = tx_entry.confirmation_ts { t >= v } else { @@ -261,7 +261,7 @@ where } }) .filter(|tx_entry| { - if let Some(v) = query_args.max_confirmed_timestamp_inc { + if let Some(v) = query_args.max_confirmed_timestamp { if let Some(t) = tx_entry.confirmation_ts { t <= v } else {