49 releases (stable)

22.0.7 Feb 13, 2025
22.0.4 Dec 20, 2024
22.0.0-rc.3.2 Nov 14, 2024
21.7.7 Nov 11, 2024
0.0.3 Jul 30, 2022

#35 in #contract

Download history 4646/week @ 2024-12-09 4656/week @ 2024-12-16 912/week @ 2024-12-23 955/week @ 2024-12-30 2562/week @ 2025-01-06 3476/week @ 2025-01-13 3769/week @ 2025-01-20 2764/week @ 2025-01-27 3222/week @ 2025-02-03 3727/week @ 2025-02-10 3004/week @ 2025-02-17 3213/week @ 2025-02-24 2921/week @ 2025-03-03 4962/week @ 2025-03-10 4280/week @ 2025-03-17 3031/week @ 2025-03-24

15,353 downloads per month
Used in 69 crates (58 directly)

Apache-2.0

535KB
10K SLoC

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:

Dependencies

~11–16MB
~325K SLoC