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::Error;
use crate::{ use crate::{
address, wallet_lock, BuiltOutput, InitTxArgs, IssueInvoiceTxArgs, NodeHeightResult, address, wallet_lock, BuiltOutput, InitTxArgs, IssueInvoiceTxArgs, NodeHeightResult,
OutputCommitMapping, PaymentProof, ScannedBlockInfo, Slatepack, SlatepackAddress, Slatepacker, OutputCommitMapping, PaymentProof, RetrieveTxQueryArgs, ScannedBlockInfo, Slatepack,
SlatepackerArgs, TxLogEntryType, ViewWallet, WalletInitStatus, WalletInst, WalletLCProvider, SlatepackAddress, Slatepacker, SlatepackerArgs, TxLogEntryType, ViewWallet, WalletInitStatus,
WalletInst, WalletLCProvider,
}; };
use ed25519_dalek::PublicKey as DalekPublicKey; use ed25519_dalek::PublicKey as DalekPublicKey;
use ed25519_dalek::SecretKey as DalekSecretKey; use ed25519_dalek::SecretKey as DalekSecretKey;
@ -313,6 +314,7 @@ pub fn retrieve_txs<'a, L, C, K>(
refresh_from_node: bool, refresh_from_node: bool,
tx_id: Option<u32>, tx_id: Option<u32>,
tx_slate_id: Option<Uuid>, tx_slate_id: Option<Uuid>,
query_args: Option<RetrieveTxQueryArgs>,
) -> Result<(bool, Vec<TxLogEntry>), Error> ) -> Result<(bool, Vec<TxLogEntry>), Error>
where where
L: WalletLCProvider<'a, C, K>, 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 /// Fees in block to use for coinbase amount calculation
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BlockFees { pub struct BlockFees {

View file

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