Skip to main content

bee/postage/
mod.rs

1//! Postage batch CRUD + stamp metadata. Mirrors `pkg/postage` in
2//! bee-go.
3//!
4//! The endpoint methods live on [`PostageApi`] (get one from
5//! [`crate::Client::postage`]). Pure stamp math — `get_stamp_cost`,
6//! `get_stamp_effective_bytes`, etc. — is exposed as free functions
7//! since it has no I/O.
8
9mod endpoints;
10mod stamp_math;
11mod stamper;
12mod types;
13
14use std::sync::Arc;
15
16use crate::client::Inner;
17
18pub use stamp_math::{
19    EFFECTIVE_SIZE_BREAKPOINTS, get_depth_for_size, get_stamp_cost, get_stamp_effective_bytes,
20    get_stamp_theoretical_bytes, get_stamp_usage,
21};
22pub use stamper::{
23    Envelope, MARSHALED_STAMP_LENGTH, MIN_DEPTH, NUM_BUCKETS, Stamper,
24    convert_envelope_to_marshaled_stamp, marshal_stamp,
25};
26pub use types::{BatchBucket, GlobalPostageBatch, PostageBatch, PostageBatchBuckets};
27
28/// Handle exposing the postage endpoints. Cheap to clone.
29#[derive(Clone, Debug)]
30pub struct PostageApi {
31    pub(crate) inner: Arc<Inner>,
32}
33
34impl PostageApi {
35    pub(crate) fn new(inner: Arc<Inner>) -> Self {
36        Self { inner }
37    }
38}