pub struct NonceLedger { /* private fields */ }Expand description
Nonce management for tracking local and on-chain nonces.
Maintains two nonce counters per address:
- confirmed — the last nonce known to be mined on-chain.
- pending — the highest nonce assigned locally but not yet confirmed.
Implementations§
Source§impl NonceLedger
impl NonceLedger
Sourcepub fn set_confirmed(&self, address: &str, nonce: u64)
pub fn set_confirmed(&self, address: &str, nonce: u64)
Set the on-chain confirmed nonce for an address.
Sourcepub fn next(&self, address: &str) -> u64
pub fn next(&self, address: &str) -> u64
Get the next available nonce — the maximum of (confirmed + 1) and (pending + 1), falling back to 0 when neither is set.
Sourcepub fn mark_pending(&self, address: &str, nonce: u64)
pub fn mark_pending(&self, address: &str, nonce: u64)
Mark a nonce as used (pending).
Sourcepub fn confirm(&self, address: &str, nonce: u64)
pub fn confirm(&self, address: &str, nonce: u64)
Confirm a nonce — updates confirmed and clears pending when the pending nonce is at or below the confirmed nonce.
Sourcepub fn confirmed_nonce(&self, address: &str) -> Option<u64>
pub fn confirmed_nonce(&self, address: &str) -> Option<u64>
Get the current confirmed nonce.
Sourcepub fn pending_nonce(&self, address: &str) -> Option<u64>
pub fn pending_nonce(&self, address: &str) -> Option<u64>
Get the current pending nonce.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for NonceLedger
impl RefUnwindSafe for NonceLedger
impl Send for NonceLedger
impl Sync for NonceLedger
impl Unpin for NonceLedger
impl UnsafeUnpin for NonceLedger
impl UnwindSafe for NonceLedger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more