41 releases (27 stable)

22.0.0-rc.3.2 Nov 14, 2024
22.0.0-rc.3 Oct 24, 2024
21.7.7 Nov 11, 2024
21.4.0 Jul 26, 2024
0.0.3 Jul 30, 2022

#366 in Magic Beans

Download history 2970/week @ 2024-08-02 1760/week @ 2024-08-09 2867/week @ 2024-08-16 2647/week @ 2024-08-23 2461/week @ 2024-08-30 2508/week @ 2024-09-06 2022/week @ 2024-09-13 2684/week @ 2024-09-20 2705/week @ 2024-09-27 2593/week @ 2024-10-04 2151/week @ 2024-10-11 1646/week @ 2024-10-18 2444/week @ 2024-10-25 3816/week @ 2024-11-01 3861/week @ 2024-11-08 2436/week @ 2024-11-15

13,081 downloads per month
Used in 57 crates (46 directly)

Apache-2.0

530KB
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–15MB
~316K SLoC