Skip to main content

PaidAddressStore

Trait PaidAddressStore 

Source
pub trait PaidAddressStore: Send + Sync {
    // Required methods
    fn contains(&self, store_key: &str, address: &str) -> bool;
    fn record_success(&self, store_key: &str, address: &str);
    fn has_used_nonce(&self, nonce: &str) -> bool;
    fn record_nonce(&self, nonce: &str);
    fn consume_nonce(&self, nonce: &str) -> bool;
}
Available on crate features server and siwx only.
Expand description

Addresses that completed a successful settlement, plus consumed nonces.

Required Methods§

Source

fn contains(&self, store_key: &str, address: &str) -> bool

Whether address already paid for store_key.

Source

fn record_success(&self, store_key: &str, address: &str)

Records a successful settlement. Failures and verifies are ignored.

Source

fn has_used_nonce(&self, nonce: &str) -> bool

Whether nonce is already in the used set.

Source

fn record_nonce(&self, nonce: &str)

Marks nonce as used. Idempotent.

Source

fn consume_nonce(&self, nonce: &str) -> bool

Inserts nonce if absent. true means this caller consumed it.

Must be atomic. Callers must not delete a nonce after a failed consume (replay) or a later failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§