lordsarcastic / lazerpay-rust-sdk Goto Github PK
View Code? Open in Web Editor NEWLazerpay SDK for Rust ๐ฆ
License: MIT License
Lazerpay SDK for Rust ๐ฆ
License: MIT License
I think the library should just be renamed lazerpay
or lazerpay-rs
. lazerpay-rust-sdk
is a mouthful.
There is no need for the ...-rust-sdk
namespacing since this rust version is only ever going to exist in crates-verse.
It also helps with discoverability.
Might want to return Results instead of unwrapping. This puts error handling into the users hands and prevents unexpected and sometimes unwanted panics.
Right now, Lazerpay Rust SDK looks so much like the node SDK. The issue with that is the library doesn't take full advantage of Rust's type safety all in the spirit of staying true to the official implementation. But node is not Rust. JavaScript is a weakly typed language.
For the reasons stated above, I would like to propose a slightly different, more Rusty interface for the SDK. Specifying it in a way that doesn't diverge too much from the reference implementation.
I think it will help with creating a more solid foundation for the project as Lazerpay grows its features.
let lazerpay = Lazerpay::new()?; // Sets up API keys. Grabs details from .env.
let payment = lazerpay.create_payment(PaymentConfig { // Returns a payment object but doesn't send req.
customer: Customer::new("Lagbaja Ajanaku", "[email protected]"),
coin: Coin::USDC,
currency: Currency::NGN,
amount: 5_000,
pk_address: "0x16227d60f7a0e586c66b005219dfc887d13c9531",
reference: "Just sending some money your way",
..Default::default()
})?;
payment.send()?; // Sends payment req.
payment.check_confirmation()?; // Asks for confirmation.
payment.get_accepted_coins()?; // Get supported coins.
Let me know what you think and if there is any edge case I'm missing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.