Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a link to migrating docs to home #1389

Merged
merged 7 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ build-fuzz:

readme:
cd soroban-sdk \
&& cargo +nightly rustdoc -- -Zunstable-options -wjson \
&& cargo +nightly rustdoc --features testutils -- -Zunstable-options -wjson \
&& cat ../target/doc/soroban_sdk.json \
| jq -r '.index[.root|tostring].docs' \
> README.md
Expand Down
27 changes: 18 additions & 9 deletions soroban-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
Soroban SDK supports writing programs for the Soroban smart contract
platform.
Soroban SDK supports writing smart contracts for the Wasm-powered [Soroban] smart contract
runtime, deployed on [Stellar].

### Docs

See [soroban.stellar.org](https://soroban.stellar.org) for documentation.
See [developers.stellar.org] for documentation about building smart contracts for [Stellar].

[developers.stellar.org]: https://developers.stellar.org
[Stellar]: https://stellar.org
[Soroban]: https://stellar.org/soroban

### Migrating Major Versions

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

### Examples

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

#[contract]
pub struct HelloContract;
pub struct Contract;

#[contractimpl]
impl HelloContract {
impl Contract {
pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
vec![&env, symbol_short!("Hello"), to]
}
Expand All @@ -26,8 +34,8 @@ fn test() {
# #[cfg(feature = "testutils")]
# fn main() {
let env = Env::default();
let contract_id = env.register(HelloContract, ());
let client = HelloContractClient::new(&env, &contract_id);
let contract_id = env.register(Contract, ());
let client = ContractClient::new(&env, &contract_id);

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

Expand All @@ -37,5 +45,6 @@ fn test() {
# fn main() { }
```

More examples are available at <https://soroban.stellar.org/docs/category/basic-tutorials>
and <https://soroban.stellar.org/docs/category/advanced-tutorials>.
More examples are available at:
- <https://developers.stellar.org/docs/build/smart-contracts/example-contracts>
- <https://developers.stellar.org/docs/build/guides>
27 changes: 18 additions & 9 deletions soroban-sdk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
//! Soroban SDK supports writing programs for the Soroban smart contract
//! platform.
//! Soroban SDK supports writing smart contracts for the Wasm-powered [Soroban] smart contract
//! runtime, deployed on [Stellar].
//!
//! ### Docs
//!
//! See [soroban.stellar.org](https://soroban.stellar.org) for documentation.
//! See [developers.stellar.org] for documentation about building smart contracts for [Stellar].
//!
//! [developers.stellar.org]: https://developers.stellar.org
//! [Stellar]: https://stellar.org
//! [Soroban]: https://stellar.org/soroban
//!
//! ### Migrating Major Versions
//!
//! See [_migrating] for a summary of how to migrate from one major version to another.
//!
//! ### Examples
//!
//! ```rust
//! use soroban_sdk::{contract, contractimpl, vec, symbol_short, BytesN, Env, Symbol, Vec};
//!
//! #[contract]
//! pub struct HelloContract;
//! pub struct Contract;
//!
//! #[contractimpl]
//! impl HelloContract {
//! impl Contract {
//! pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
//! vec![&env, symbol_short!("Hello"), to]
//! }
Expand All @@ -26,8 +34,8 @@
//! # #[cfg(feature = "testutils")]
//! # fn main() {
//! let env = Env::default();
//! let contract_id = env.register(HelloContract, ());
//! let client = HelloContractClient::new(&env, &contract_id);
//! let contract_id = env.register(Contract, ());
//! let client = ContractClient::new(&env, &contract_id);
//!
//! let words = client.hello(&symbol_short!("Dev"));
//!
Expand All @@ -37,8 +45,9 @@
//! # fn main() { }
//! ```
//!
//! More examples are available at <https://soroban.stellar.org/docs/category/basic-tutorials>
//! and <https://soroban.stellar.org/docs/category/advanced-tutorials>.
//! More examples are available at:
//! - <https://developers.stellar.org/docs/build/smart-contracts/example-contracts>
//! - <https://developers.stellar.org/docs/build/guides>

#![cfg_attr(target_family = "wasm", no_std)]
#![cfg_attr(feature = "docs", feature(doc_cfg))]
Expand Down
Loading