add doctest exercising advanced query JSON API

This commit is contained in:
Yeastplume
2022-11-29 09:30:45 +00:00
parent 13b1fc8e01
commit 1188f3287d
4 changed files with 90 additions and 3 deletions
+4
View File
@@ -203,8 +203,12 @@ pub struct RetrieveTxQueryArgs {
/// whether to only consider reverted transactions
pub include_reverted_only: Option<bool>,
/// lower bound on the total amount (amount_credited - amount_debited), inclusive
#[serde(with = "secp_ser::opt_string_or_u64")]
#[serde(default)]
pub min_amount_inc: Option<u64>,
/// 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>,
/// lower bound on the creation timestamp, inclusive
pub min_creation_timestamp_inc: Option<DateTime<Utc>>,
+2 -2
View File
@@ -25,6 +25,7 @@ use crate::grin_core::global;
use crate::grin_core::libtx::proof::ProofBuilder;
use crate::grin_core::libtx::reward;
use crate::grin_keychain::{Identifier, Keychain, SwitchCommitmentType};
use crate::grin_util as util;
use crate::grin_util::secp::key::SecretKey;
use crate::grin_util::secp::pedersen;
use crate::grin_util::static_secp_instance;
@@ -32,7 +33,6 @@ use crate::internal::keys;
use crate::types::{
NodeClient, OutputData, OutputStatus, TxLogEntry, TxLogEntryType, WalletBackend, WalletInfo,
};
use crate::{grin_util as util, Amount};
use crate::{
BlockFees, CbData, OutputCommitMapping, RetrieveTxQueryArgs, RetrieveTxQuerySortField,
RetrieveTxQuerySortOrder,
@@ -339,7 +339,7 @@ where
C: NodeClient + 'a,
K: Keychain + 'a,
{
let mut txs: Vec<TxLogEntry> = vec![];
let mut txs;
// Adding in new tranasction list query logic. If `tx_id` or `tx_slate_id`
// is provided, then `query_args` is ignored and old logic is followed.
if query_args.is_some() && tx_id.is_none() && tx_slate_id.is_none() {