Skip to content

deltartificial/dfns-sdk-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dfns SDK Rust

Build status License Coverage Crates.io Downloads

Modular, extensible, and easy-to-use Rust SDK for the Dfns API.

Warning: This SDK is currently under development and not ready for production use. The API is subject to change. Consider contributing to the project if you're interested in helping out.

Installation

cargo add dfns-sdk-rs

Examples

Check out the list of all examples in this repository.

Wallets
Webhooks
Staking
Signers
Policies
Permissions
Networks
Exchanges
Authentication

Usage

Here's a simple example of how to use the SDK:

use dfns_sdk_rs::{
    DfnsApiClient, DfnsBaseApiOptions, CredentialSigner,
    models::wallets::CreateWalletRequest,
};
use std::sync::Arc;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize your signer (implementation depends on your use case)
    let signer = Arc::new(YourCredentialSigner::new());

    // Create API client
    let client = DfnsApiClient::new(
        DfnsBaseApiOptions {
            base_url: "https://api.dfns.io".to_string(),
            app_id: "ap-2ng9jv-80cfc-983pop0iauf2sv8r".to_string(),
            auth_token: "your-auth-token".to_string(),
        },
        Some(signer),
    );

    // Create a wallet
    let wallet = client
        .wallets()
        .create_wallet(CreateWalletRequest {
            network: "EthereumSepolia".to_string(),
        })
        .await?;

    // Get wallet assets
    let assets = client
        .wallets()
        .get_wallet_assets(wallet.id)
        .await?;

    println!("Wallet assets: {:?}", assets);
    Ok(())
}

The example above demonstrates:

  • Creating an API client with authentication
  • Creating a new wallet
  • Retrieving wallet assets

Documentation

Generating Documentation

To generate the documentation locally, you'll need the nightly Rust toolchain. Here's how to set it up:

# Install and switch to nightly Rust
rustup install nightly
rustup default nightly

# Generate the documentation
RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo doc --no-deps --document-private-items --target-dir ./docs

Viewing Documentation

To view the documentation in your browser:

# Start a local server (Python required)
python3 -m http.server 8000 --directory ./docs/doc

Then open http://localhost:8000/dfns_sdk_rs/ in your browser.

For more examples and detailed API documentation, check the documentation section.

About

Dfns SDK written in Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages