| Crates.io | bulencoin-sdk |
| lib.rs | bulencoin-sdk |
| version | 0.1.5 |
| created_at | 2025-11-25 13:52:14.728005+00 |
| updated_at | 2025-11-30 18:55:42.463028+00 |
| description | Lightweight client for BulenCoin prototype APIs (payments, status, reward estimation). |
| homepage | |
| repository | https://example.com/bulencoin |
| max_upload_size | |
| id | 1949794 |
| size | 55,188 |
Minimal clients for the BulenCoin prototype HTTP APIs (payments, payment links, status, reward estimation). Blocking and async variants are provided.
[dependencies]
bulencoin-sdk = { path = "../sdk-rs" }
use bulencoin_sdk::{BulenClient, PaymentRequest, build_payment_link};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = BulenClient::new("http://localhost:4100/api")?;
let payment = client.create_payment(&PaymentRequest {
to: "merchant-addr".into(),
amount: 25,
memo: Some("order-123".into()),
expires_in_seconds: None,
webhook_url: None,
})?;
println!("payment id: {}", payment.id);
let link = client.create_payment_link(&bulencoin_sdk::PaymentLinkRequest {
address: payment.to.clone(),
amount: payment.amount,
memo: payment.memo.clone(),
})?;
println!("link: {}", link.link);
let rewards = client.estimate_rewards(&bulencoin_sdk::RewardEstimateRequest {
stake: 1000,
uptime_hours_per_day: 24,
days: 7,
device_class: Some("server".into()),
})?;
println!("weekly: {}", rewards.projection.weekly);
let local_link = build_payment_link("addr", 10, Some("memo"));
println!("local link: {}", local_link);
Ok(())
}
Async (Tokio):
use bulencoin_sdk::{AsyncBulenClient, PaymentRequest};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = AsyncBulenClient::new("http://localhost:4100/api")?;
let payment = client.create_payment(&PaymentRequest {
to: "merchant-addr".into(),
amount: 10,
memo: None,
expires_in_seconds: None,
webhook_url: None,
}).await?;
println!("payment {}", payment.id);
Ok(())
}
Notes:
BulenClient; async client: AsyncBulenClient (bring your own Tokio runtime)./api prefix).docs/dev_cookbook.md for HTTP examples and other languages.