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 |
#827 in #sdk
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
~467K SLoC