soroban-sdk

Crates.iosoroban-sdk
lib.rssoroban-sdk
version21.1.1
sourcesrc
created_at2022-07-28 21:20:22.557883
updated_at2024-06-25 16:46:06.824084
descriptionSoroban SDK.
homepagehttps://github.com/stellar/rs-soroban-sdk
repositoryhttps://github.com/stellar/rs-soroban-sdk
max_upload_size
id634679
size452,848
Stellar (Rust crate publisher) (stellar-crates)

documentation

README

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

Docs

See soroban.stellar.org for documentation.

Examples

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

#[contract]
pub struct HelloContract;

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

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

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

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

More examples are available at https://soroban.stellar.org/docs/category/basic-tutorials and https://soroban.stellar.org/docs/category/advanced-tutorials.

Commit count: 871

cargo fmt