soroban-sdk 0.1.0

Soroban SDK.
Documentation

Soroban SDK supports writing programs for the Soroban smart contract platform.

Docs

See soroban.stellar.org for documentation.

Examples

use soroban_sdk::{contractimpl, symbol, vec, BytesN, Env, Symbol, Vec};

pub struct HelloContract;

#[contractimpl]
impl HelloContract {
pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
vec![&env, symbol!("Hello"), to]
}
}

#[test]
fn test() {
# }
# #[cfg(feature = "testutils")]
# fn main() {
let env = Env::default();
let contract_id = BytesN::from_array(&env, &[0; 32]);
env.register_contract(&contract_id, HelloContract);
let client = HelloContractClient::new(&env, &contract_id);

let words = client.hello(&symbol!("Dev"));

assert_eq!(words, vec![&env, symbol!("Hello"), symbol!("Dev"),]);
}
# #[cfg(not(feature = "testutils"))]
# fn main() { }

More examples are available at https://soroban.stellar.org/docs/category/examples.