Initialize SDK

To initiate and utilize the Rust SDK, the initial step involves adding an entry to the Cargo.toml file for the SDK.

cess-rust-sdk = { git = "", version="0.1.0"}
tokio = { version = "1.29.1", features = ["full"] }


Open the file and initialize the ChainSDK as follows:-

use cess_rust_sdk::chain::ChainSdk;

// This module has default Cess chain URL and gateway URL
// and gateway account address.
use cess_rust_sdk::config;

// The account mnemonic that will be used to sign transactions.
const MNEMONIC: &str = "bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice";

async fn main() {
    // Default URL is set to CESS Testnet.
    // To change to local or other open CESS node 
    // call the set_custom_url function with URL:port

    // Similarly for gateway url and account call the following 
    // functions with correct url and account.
    // config::set_custom_deoss_url(Some("gateway_url".to_string()));
    // config::set_custom_deoss_account(Some("gateway_account".to_string()));

    // Initialize the SDK object
    let sdk = ChainSdk::new(MNEMONIC, "service_name");
    // Other task


Last updated