mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 07:11:36 +02:00
Merge pull request #743 from GetGrin/retrieve_txs_account
Retrieve txs for an account with custom query arguments
This commit is contained in:
@@ -96,6 +96,7 @@ where
|
|||||||
/// Apply advanced filtering to resultset from retrieve_txs below
|
/// Apply advanced filtering to resultset from retrieve_txs below
|
||||||
pub fn apply_advanced_tx_list_filtering<'a, T: ?Sized, C, K>(
|
pub fn apply_advanced_tx_list_filtering<'a, T: ?Sized, C, K>(
|
||||||
wallet: &mut T,
|
wallet: &mut T,
|
||||||
|
parent_key_id: Option<&Identifier>,
|
||||||
query_args: &RetrieveTxQueryArgs,
|
query_args: &RetrieveTxQueryArgs,
|
||||||
) -> Vec<TxLogEntry>
|
) -> Vec<TxLogEntry>
|
||||||
where
|
where
|
||||||
@@ -107,6 +108,10 @@ where
|
|||||||
let txs_iter: Box<dyn Iterator<Item = TxLogEntry>> = Box::new(
|
let txs_iter: Box<dyn Iterator<Item = TxLogEntry>> = Box::new(
|
||||||
wallet
|
wallet
|
||||||
.tx_log_iter()
|
.tx_log_iter()
|
||||||
|
.filter(|tx_entry| match parent_key_id {
|
||||||
|
Some(k) => tx_entry.parent_key_id == *k,
|
||||||
|
None => true,
|
||||||
|
})
|
||||||
.filter(|tx_entry| {
|
.filter(|tx_entry| {
|
||||||
if let Some(v) = query_args.exclude_cancelled {
|
if let Some(v) = query_args.exclude_cancelled {
|
||||||
if v {
|
if v {
|
||||||
@@ -343,7 +348,7 @@ where
|
|||||||
// Adding in new transaction list query logic. If `tx_id` or `tx_slate_id`
|
// Adding in new transaction list query logic. If `tx_id` or `tx_slate_id`
|
||||||
// is provided, then `query_args` is ignored and old logic is followed.
|
// 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() {
|
if query_args.is_some() && tx_id.is_none() && tx_slate_id.is_none() {
|
||||||
txs = apply_advanced_tx_list_filtering(wallet, &query_args.unwrap())
|
txs = apply_advanced_tx_list_filtering(wallet, parent_key_id, &query_args.unwrap())
|
||||||
} else {
|
} else {
|
||||||
txs = wallet
|
txs = wallet
|
||||||
.tx_log_iter()
|
.tx_log_iter()
|
||||||
|
|||||||
Reference in New Issue
Block a user