pub struct PostageApi { /* private fields */ }Expand description
Handle exposing the postage endpoints. Cheap to clone.
Implementations§
Source§impl PostageApi
impl PostageApi
Sourcepub async fn get_postage_batches(&self) -> Result<Vec<PostageBatch>, Error>
pub async fn get_postage_batches(&self) -> Result<Vec<PostageBatch>, Error>
Every postage batch owned by this node — GET /stamps.
Sourcepub async fn get_postage_batch(
&self,
batch_id: &BatchId,
) -> Result<PostageBatch, Error>
pub async fn get_postage_batch( &self, batch_id: &BatchId, ) -> Result<PostageBatch, Error>
Single owned batch by id — GET /stamps/{id}.
Sourcepub async fn get_postage_batch_buckets(
&self,
batch_id: &BatchId,
) -> Result<PostageBatchBuckets, Error>
pub async fn get_postage_batch_buckets( &self, batch_id: &BatchId, ) -> Result<PostageBatchBuckets, Error>
Per-bucket collision stats — GET /stamps/{id}/buckets.
Sourcepub async fn get_global_postage_batches(
&self,
) -> Result<Vec<GlobalPostageBatch>, Error>
pub async fn get_global_postage_batches( &self, ) -> Result<Vec<GlobalPostageBatch>, Error>
Every chain-visible postage batch — GET /batches. Returns the
chain-wide view (no owner-only fields).
Sourcepub async fn create_postage_batch(
&self,
amount: &BigInt,
depth: u8,
label: Option<&str>,
) -> Result<BatchId, Error>
pub async fn create_postage_batch( &self, amount: &BigInt, depth: u8, label: Option<&str>, ) -> Result<BatchId, Error>
Buy a new postage batch — POST /stamps/{amount}/{depth}.
Returns the freshly-minted BatchId.
amount is the per-chunk amount (PLUR) and depth is the
stamp depth — together they determine effective capacity and
TTL. For a (size, duration)-shaped API see
crate::storage::buy_storage.
§Examples
use bee::Client;
use num_bigint::BigInt;
let client = Client::new("http://localhost:1633")?;
let amount = BigInt::from(414_720_000u64);
let batch_id = client
.postage()
.create_postage_batch(&amount, 22, Some("my-batch"))
.await?;
println!("bought batch {}", batch_id.to_hex());Sourcepub async fn create_postage_batch_with_options(
&self,
amount: &BigInt,
depth: u8,
opts: Option<&PostageBatchOptions>,
) -> Result<BatchId, Error>
pub async fn create_postage_batch_with_options( &self, amount: &BigInt, depth: u8, opts: Option<&PostageBatchOptions>, ) -> Result<BatchId, Error>
Buy a new postage batch with full options support. Mirrors
bee-js Bee.createPostageBatch and bee-go’s options-style
constructor — label and immutable map to query parameters,
gas_price / gas_limit map to Gas-Price / Gas-Limit headers.
Trait Implementations§
Source§impl Clone for PostageApi
impl Clone for PostageApi
Source§fn clone(&self) -> PostageApi
fn clone(&self) -> PostageApi
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more