remove _inc from field names

This commit is contained in:
Yeastplume 2022-12-01 09:44:51 +00:00
parent ae7145029b
commit b1beca4206
4 changed files with 37 additions and 37 deletions

View file

@ -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"
}

View file

@ -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;

View file

@ -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<u32>,
pub min_id: Option<u32>,
/// 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<u32>,
pub max_id: Option<u32>,
/// 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<u64>,
pub max_amount: Option<u64>,
/// lower bound on the creation timestamp, inclusive
pub min_creation_timestamp_inc: Option<DateTime<Utc>>,
pub min_creation_timestamp: Option<DateTime<Utc>>,
/// higher bound on on the creation timestamp, inclusive
pub max_creation_timestamp_inc: Option<DateTime<Utc>>,
pub max_creation_timestamp: Option<DateTime<Utc>>,
/// lower bound on the confirmation timestamp, inclusive
pub min_confirmed_timestamp_inc: Option<DateTime<Utc>>,
pub min_confirmed_timestamp: Option<DateTime<Utc>>,
/// higher bound on the confirmation timestamp, inclusive
pub max_confirmed_timestamp_inc: Option<DateTime<Utc>>,
pub max_confirmed_timestamp: Option<DateTime<Utc>>,
/// Field within the tranasction list on which to sort
/// defaults to ID if not present
pub sort_field: Option<RetrieveTxQuerySortField>,
@ -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),
}

View file

@ -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 {