Bucket Creation

DeOSS as an object storage service, the data are stored in buckets, which can be created automatically when uploading data, or separately, refer to the following code:

```rust
use cess_rust_sdk::chain::ChainSdk;


use cess_rust_sdk::chain::file_bank::FileBank;
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";

const BUCKET_NAME: &str = "Bucket_For_Docs";

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

```

Last updated