add query pagination options struct

This commit is contained in:
Yeastplume 2022-11-22 12:04:17 +00:00
parent 8384a3ebb0
commit 746c1831c5
3 changed files with 33 additions and 3 deletions

View file

@ -33,8 +33,9 @@ use crate::types::{AcctPathMapping, NodeClient, TxLogEntry, WalletBackend, Walle
use crate::Error;
use crate::{
address, wallet_lock, BuiltOutput, InitTxArgs, IssueInvoiceTxArgs, NodeHeightResult,
OutputCommitMapping, PaymentProof, ScannedBlockInfo, Slatepack, SlatepackAddress, Slatepacker,
SlatepackerArgs, TxLogEntryType, ViewWallet, WalletInitStatus, WalletInst, WalletLCProvider,
OutputCommitMapping, PaymentProof, RetrieveTxQueryArgs, ScannedBlockInfo, Slatepack,
SlatepackAddress, Slatepacker, SlatepackerArgs, TxLogEntryType, ViewWallet, WalletInitStatus,
WalletInst, WalletLCProvider,
};
use ed25519_dalek::PublicKey as DalekPublicKey;
use ed25519_dalek::SecretKey as DalekSecretKey;
@ -313,6 +314,7 @@ pub fn retrieve_txs<'a, L, C, K>(
refresh_from_node: bool,
tx_id: Option<u32>,
tx_slate_id: Option<Uuid>,
query_args: Option<RetrieveTxQueryArgs>,
) -> Result<(bool, Vec<TxLogEntry>), Error>
where
L: WalletLCProvider<'a, C, K>,

View file

@ -148,6 +148,34 @@ impl Default for IssueInvoiceTxArgs {
}
}
/// Retrieve Transaction List Pagination Arguments
#[derive(Clone, Serialize, Deserialize)]
pub struct RetrieveTxQueryArgs {
/// Retrieve transactions with an id lower than the given, inclusive
/// If None, consider items from the latest transaction and earlier
pub before_id_inc: Option<u32>,
/// Retrieve tranactions with an id higher than the given, inclusive
/// If None, consider items from the first transaction and later
pub after_id_inc: 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
pub limit: Option<u32>,
/// whether to include cancelled transactions in the returned set
pub include_cancelled: Option<bool>,
}
impl Default for RetrieveTxQueryArgs {
fn default() -> Self {
Self {
before_id_inc: None,
after_id_inc: None,
limit: None,
include_cancelled: None,
}
}
}
/// Fees in block to use for coinbase amount calculation
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BlockFees {

View file

@ -65,7 +65,7 @@ pub use crate::slatepack::{
pub use api_impl::owner_updater::StatusMessage;
pub use api_impl::types::{
Amount, BlockFees, BuiltOutput, InitTxArgs, InitTxSendArgs, IssueInvoiceTxArgs,
NodeHeightResult, OutputCommitMapping, PaymentProof, VersionInfo,
NodeHeightResult, OutputCommitMapping, PaymentProof, RetrieveTxQueryArgs, VersionInfo,
};
pub use internal::scan::scan;
pub use slate_versions::ser as dalek_ser;