| Crates.io | deltadefi |
| lib.rs | deltadefi |
| version | 0.1.0 |
| created_at | 2025-04-16 06:18:36.718351+00 |
| updated_at | 2025-08-31 03:35:11.240971+00 |
| description | The Rust SDK for DeltaDeFi |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1636017 |
| size | 141,936 |
The DeltaDeFi Rust SDK provides a convenient way to interact with the DeltaDeFi protocol. It allows developers to perform operations such as placing and canceling orders, managing wallets, and more.
Add the following to your Cargo.toml:
[dependencies]
deltadefi = "<latest-version>"
Here is an example of how to use the DeltaDeFi Rust SDK to place and cancel an order:
use deltadefi::{DeltaDeFi, OrderSide, OrderType, Stage};
use dotenv::dotenv;
use std::env;
pub async fn order() {
dotenv().ok();
let api_key = env::var("DELTADEFI_API_KEY").expect("DELTADEFI_API_KEY must be set");
let encryption_passcode =
env::var("ENCRYPTION_PASSCODE").expect("ENCRYPTION_PASSCODE must be set");
// Initialize DeltaDeFi client and wallet
let mut deltadefi = DeltaDeFi::new(api_key, Stage::Staging, None);
deltadefi
.load_operation_key(&encryption_passcode)
.await
.unwrap();
// Build place order transaction
let res = deltadefi
.post_order(
"ADAUSDX",
OrderSide::Sell,
OrderType::Limit,
51.0,
Some(1.5),
None,
None,
)
.await
.expect("Failed to build place order transaction");
println!("Order submitted successfully: {:?}", res);
let res = deltadefi
.order
.build_cancel_order_transaction(&res.order_id)
.await
.expect("Failed to build cancel order transaction");
println!("Order canceled successfully: {:?}", res);
}
For more examples, visit the DeltaDeFi SDKs Demo Repository.
We welcome contributions! Please follow our Contributing Guide before submitting a pull request.
This project is licensed under the Apache-2.0 License.