18 releases

0.2.4 Oct 1, 2024
0.2.3 Sep 16, 2024
0.2.2-rc2 Aug 31, 2024
0.1.9 Aug 10, 2024
0.1.5 May 28, 2024

#678 in #sdk

Download history 73/week @ 2024-07-01 46/week @ 2024-07-08 155/week @ 2024-07-29 108/week @ 2024-08-05 138/week @ 2024-08-12 319/week @ 2024-08-26 110/week @ 2024-09-02 12/week @ 2024-09-09 258/week @ 2024-09-16 43/week @ 2024-09-23 244/week @ 2024-09-30 12/week @ 2024-10-07

557 downloads per month

Apache-2.0

80KB
1.5K SLoC

Zephyr Rust SDK

Implementation of the Zephyr SDK for Rust. The Zephyr SDK lets you build Zephyr programs for the Mercury Cloud Execution environment.

Examples can be found at the zephyr-examples repository.

For any bugs or feature requests, please open an issue in this repository.


lib.rs:

Zephyr Rust SDK

The zephyr rust sdk aids developers in writing programs for the Zephyr Virtual Machine.

Hello Ledger Example

use zephyr_sdk::{prelude::*, soroban_sdk::xdr::{ScString, ScVal}, EnvClient, DatabaseDerive};

#[derive(DatabaseDerive, Clone)]
#[with_name("test")]
struct TestTable {
    hello: ScVal,
}

#[no_mangle]
pub extern "C" fn on_close() {
    let env = EnvClient::new();

    let sequence = env.reader().ledger_sequence();
    env.log().debug(format!("Got sequence {}", sequence), None);

    let message = {
        let message = format!("World at ledegr sequence {}", sequence);
        ScVal::String(ScString(message.try_into().unwrap()))
    };

    let table = TestTable {
        hello: message.clone(),
    };

    env.log().debug(
        "Writing to the database",
        Some(bincode::serialize(&message).unwrap()),
    );
    table.put(&env);
    env.log().debug("Successfully wrote to the database", None);
}

Dependencies

~15–28MB
~466K SLoC