soroban-sdk

Crates.iosoroban-sdk
lib.rssoroban-sdk
version22.0.2
sourcesrc
created_at2022-07-28 21:20:22.557883
updated_at2024-12-10 03:55:43.646802
descriptionSoroban SDK.
homepagehttps://github.com/stellar/rs-soroban-sdk
repositoryhttps://github.com/stellar/rs-soroban-sdk
max_upload_size
id634679
size511,660
Stellar (Rust crate publisher) (stellar-crates)

documentation

README

Soroban SDK supports writing smart contracts for the Wasm-powered Soroban smart contract runtime, deployed on Stellar.

Docs

See developers.stellar.org for documentation about building smart contracts for Stellar.

Migrating Major Versions

See [_migrating] for a summary of how to migrate from one major version to another.

Examples

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

#[contract]
pub struct Contract;

#[contractimpl]
impl Contract {
    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, ());
    let client = ContractClient::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:

Commit count: 949

cargo fmt