devol-accounts-kit

Crates.iodevol-accounts-kit
lib.rsdevol-accounts-kit
version0.3.4
sourcesrc
created_at2024-05-14 12:00:05.070036
updated_at2024-06-18 11:28:30.51598
descriptionSDK for interacting with the DeVol Network option trading platform on the Solana blockchain
homepagehttps://sdk.devol.network
repositoryhttps://github.com/DeVol-Network/devol-accounts-kit
max_upload_size
id1239507
size351,708
(devol-sdk)

documentation

README

Devol Accounts Kit

Table of Contents

Introduction

Welcome to the Devol Accounts Kit documentation. This comprehensive guide is designed to equip developers and system administrators with the knowledge and tools necessary to effectively implement and manage the Devol smart contract system.

Quick Start Guide

Setting Up Your Development Environment

To begin, ensure your development environment is set up with the necessary tools and libraries:

  1. Rust
  2. Solana CLI

Initialize Your Project

Create a new Rust project where you will integrate the Devol Accounts Kit:

cargo new devol_integration
cd devol_integration

Add Dependencies

Open your Cargo.toml file and add the necessary dependencies for working with the Solana blockchain and the Devol Accounts Kit:

[dependencies]
devol-accounts-kit = '*'

Sample Code to Interact with Devol Smart Contracts

Below is a basic example to set up your client and interact with the Devol smart contracts:

// Required imports
use std::str::FromStr;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;
use devol_accounts_kit::dvl_client::dvl_client::DvlClient;
use devol_accounts_kit::accounts::root::root_account::RootAccount;
use tokio;

#[tokio::main] // This attribute sets up the Tokio runtime for your async main
async fn main() {
    let rpc_url = String::from("https://api.mainnet-beta.solana.com/");
    let rpc_client = RpcClient::new(rpc_url);

    // Proper error handling with `match` for key parsing
    let admin_pub_key = match Pubkey::from_str("ADMIN_PUBLIC_KEY") {
        Ok(key) => key,
        Err(e) => {
            eprintln!("Failed to parse admin public key: {}", e);
            return;
        }
    };

    let program_id = match Pubkey::from_str("PROGRAM_ID") {
        Ok(id) => id,
        Err(e) => {
            eprintln!("Failed to parse program ID: {}", e);
            return;
        }
    };

    let reader = DvlClient::new(rpc_client, INT_SEED, admin_pub_key, program_id);

    match reader.get_account::<RootAccount>(()).await {
        Ok(root_account) => println!("Root Account: {:?}", root_account),
        Err(e) => eprintln!("Failed to fetch the RootAccount: {}", e),
    };
}

Run Your Application

To run your application and see the output:

cargo run

This simple setup will help you start interacting with the Devol smart contract and explore more complex transactions and interactions as you progress in your development.

Advanced

Feature Configuration Options:

The Devol Accounts Kit is equipped with a set of features that cater to various use cases in blockchain application development. The library is structured with a default feature set, which compiles the entire library including all functionalities necessary for typical applications. Additionally, there is a specific feature designed for blockchain environments:

  • On-chain Feature

    The on-chain feature is specifically designed for scenarios where the network-dependent functionalities are not required. When this feature is enabled, it removes all network-related parts of the library, making it suitable for deployment within smart contracts themselves. This feature ensures that the library is optimized for on-chain operations, reducing the footprint and enhancing performance for smart contract execution.

Documentation

For more detailed guidance DeVol Network Documentation

Commit count: 243

cargo fmt