Crates.io | zebedee-rust |
lib.rs | zebedee-rust |
version | 0.8.0 |
source | src |
created_at | 2022-11-15 23:11:24.453388 |
updated_at | 2024-02-28 19:00:40.175691 |
description | Utility crate for ZEBEDEE Public API using reqwest |
homepage | |
repository | https://github.com/miketwenty1/zebedee-rust/ |
max_upload_size | |
id | 716019 |
size | 68,382 |
Interface easily with ZEBEDEE's public APIs.
Currently supports most features of the public ZEBEDEE API.
Accepting PR's and Github issues for needed functionality.
use std::env;
use zebedee_rust::{charges::*, ZebedeeClient};
#[tokio::main]
async fn main() {
let apikey: String = env::var("ZBD_API_KEY").unwrap();
let zebedee_client = ZebedeeClient::new(apikey);
// Create a Bolt 11 Invoice for 5000 msat or 5 sat.
let charge = Charge {
amount: String::from("5000"),
..Default::default()
};
// Create the charge
let charges_res = zebedee_client.create_charge(&charge).await.unwrap();
// Print the response
println!("{:?}", charges_res);
}
use std::env;
use zebedee_rust::{ln_address::*, ZebedeeClient};
#[tokio::main]
async fn main() {
let apikey: String = env::var("ZBD_API_KEY").unwrap();
let zebedee_client = ZebedeeClient::new(apikey);
// Create a Lightning payment
let payment = LnPayment {
ln_address: String::from("dannym@zbd.gg"),
amount: String::from("1000"),
..Default::default()
};
// Initiate the payment
let payment_res = zebedee_client.pay_ln_address(&payment).await.unwrap();
// Print the result
println!("Internal transfer result: {:?}", payment_res);
}
use std::env;
use zebedee_rust::{internal_transfer::*, ZebedeeClient};
#[tokio::main]
async fn main() {
let apikey: String = env::var("ZBD_API_KEY").unwrap();
let zebedee_client = ZebedeeClient::new(apikey);
// Send Internal Transfer
let internal_transfer_payload = InternalTransfer {
amount: String::from("1000"),
receiver_wallet_id: String::from("b2bcc262-186a-4fe8-961e-a5246383516c"),
};
// Initiate the internal transfer
let transfer_res = zebedee_client.internal_transfer(&internal_transfer_payload).await.unwrap();
// Print the result
println!("Internal transfer result: {:?}", transfer_res);
}