Authorize Space

To authorize the use of space to an Account using the address, import the DeOss trait into scope, and call the authorize function passing in the slice of account address.

use cess_rust_sdk::chain::ChainSdk;

use cess_rust_sdk::chain::deoss::DeOss;
use cess_rust_sdk::core::utils::account::parsing_public_key;

// 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";

const ACCOUNT_ADDRESS: &str = "cXjmuHdBk4J3Zyt2oGodwGegNFaTFPcfC48PZ9NMmcUFzF6cc";

async fn main() {
    let sdk = ChainSdk::new(MNEMONIC, "service_name");
    let pk_bytes = parsing_public_key(ACCOUNT_ADDRESS).unwrap();
    let result = sdk.authorize(&pk_bytes).await;
    match result {
        Ok(r) => {
            println!("Account authorize successful: {:?}", r);
        Err(e) => {
            println!("Account authorize failed: {:?}", e);


Last updated