Skip to main content

sagapay_sdk/
lib.rs

1//! # SagaPay Rust SDK
2//!
3//! This crate provides a Rust interface to the SagaPay blockchain payment gateway API.
4//! SagaPay is the world's first free, non-custodial blockchain payment gateway service provider.
5//!
6//! ## Example
7//!
8//! ```rust,no_run
9//! use sagapay::{Client, Config, CreateDepositParams, NetworkType};
10//!
11//! #[tokio::main]
12//! async fn main() -> Result<(), sagapay::Error> {
13//!     // Initialize the SagaPay client
14//!     let client = Client::new(Config {
15//!         api_key: "your-api-key".to_string(),
16//!         api_secret: "your-api-secret".to_string(),
17//!         ..Config::default()
18//!     });
19//!
20//!     // Create a deposit address
21//!     let deposit = client.create_deposit(CreateDepositParams {
22//!         network_type: NetworkType::BEP20,
23//!         contract_address: "0".to_string(), // '0' for native tokens (BNB)
24//!         amount: "1.5".to_string(),
25//!         ipn_url: "https://example.com/webhook".to_string(),
26//!         udf: Some("order-123".to_string()),
27//!         address_type: Some("TEMPORARY".to_string()),
28//!     }).await?;
29//!
30//!     println!("Deposit address: {}", deposit.address);
31//!     println!("Expires at: {}", deposit.expires_at);
32//!
33//!     Ok(())
34//! }
35//! ```
36
37mod client;
38mod config;
39mod error;
40mod models;
41mod webhook;
42
43pub use client::Client;
44pub use config::Config;
45pub use error::Error;
46pub use models::*;
47pub use webhook::WebhookHandler;