From f5abbf342a549cfcf2bb90125db8d70ce4b057e7 Mon Sep 17 00:00:00 2001 From: devin distefano Date: Fri, 9 Oct 2026 12:09:58 -0500 Subject: [PATCH 1/2] update soroban guide --- src/content/data-feeds/llms-full.txt | 12 ++++++++++-- .../data-feeds/stellar/using-data-feeds-on-chain.mdx | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/content/data-feeds/llms-full.txt b/src/content/data-feeds/llms-full.txt index 272e1022fb5..3fd97848f17 100644 --- a/src/content/data-feeds/llms-full.txt +++ b/src/content/data-feeds/llms-full.txt @@ -6022,10 +6022,12 @@ Before you begin, you should have: To complete this guide, you'll need: -- **Stellar CLI**: Install the [Stellar CLI](https://soroban.stellar.org/docs/reference/cli). Run stellar --version to verify your installation. +- **Stellar CLI**: Install the [Stellar CLI](https://soroban.stellar.org/docs/reference/cli). Run stellar --version to verify your installation. This guide uses Stellar CLI v25 or later. - **Rust toolchain**: Install [Rust](https://www.rust-lang.org/tools/install) using [rustup](https://rustup.rs/). Run cargo --version to verify your installation. +- **soroban-sdk**: The `stellar contract init` command scaffolds a project that depends on the latest `soroban-sdk` (v25 or later). The contract in this guide compiles against `soroban-sdk` v21 and later. If you pin an older version, use v21 or later. + - **Testnet XLM**: You'll need testnet XLM to deploy your contract. Fund a Stellar Testnet account using the friendbot faucet. Testnet XLM has no real value. ## Set up your Stellar testnet account @@ -6106,7 +6108,7 @@ To complete this guide, you'll need: /// Read the latest round for a feed and return its answer. pub fn read_latest_price(env: Env, proxy: Address, data_id: BytesN<32>) -> I256 { let client = DataFeedsProxyClient::new(&env, &proxy); - let round = client.latest_round(&data_id, &18).unwrap(); + let round = client.latest_round(&data_id, &18); round.answer } } @@ -6114,6 +6116,12 @@ To complete this guide, you'll need: This contract calls the proxy's `latest_round` function with a single `data_id` and requests the answer at `18` decimal places. The returned `Round` contains the `round_id`, `answer`, and `timestamp` fields for the feed. + The `#[contractclient]` macro generates a client whose `latest_round` method returns the `Round` value directly, not a `Result`. Do not call `.unwrap()` on the result. If you need to handle errors from the proxy call, use the generated `try_latest_round` method instead. It returns a nested `Result`: the outer `Result` reports whether the call itself succeeded, and the inner `Result` carries the contract's `ProxyReadError`: + + ```rust + let round = client.try_latest_round(&data_id, &18).unwrap().unwrap(); + ``` + ## Build and deploy the contract 1. Build the contract: diff --git a/src/content/data-feeds/stellar/using-data-feeds-on-chain.mdx b/src/content/data-feeds/stellar/using-data-feeds-on-chain.mdx index beca2d5db7a..b60ec4f0857 100644 --- a/src/content/data-feeds/stellar/using-data-feeds-on-chain.mdx +++ b/src/content/data-feeds/stellar/using-data-feeds-on-chain.mdx @@ -43,10 +43,12 @@ Before you begin, you should have: To complete this guide, you'll need: -- **Stellar CLI**: Install the [Stellar CLI](https://soroban.stellar.org/docs/reference/cli). Run to verify your installation. +- **Stellar CLI**: Install the [Stellar CLI](https://soroban.stellar.org/docs/reference/cli). Run to verify your installation. This guide uses Stellar CLI v25 or later. - **Rust toolchain**: Install [Rust](https://www.rust-lang.org/tools/install) using [rustup](https://rustup.rs/). Run to verify your installation. +- **soroban-sdk**: The `stellar contract init` command scaffolds a project that depends on the latest `soroban-sdk` (v25 or later). The contract in this guide compiles against `soroban-sdk` v21 and later. If you pin an older version, use v21 or later. + - **Testnet XLM**: You'll need testnet XLM to deploy your contract. Fund a Stellar Testnet account using the friendbot faucet. Testnet XLM has no real value. ## Set up your Stellar testnet account @@ -127,7 +129,7 @@ To complete this guide, you'll need: /// Read the latest round for a feed and return its answer. pub fn read_latest_price(env: Env, proxy: Address, data_id: BytesN<32>) -> I256 { let client = DataFeedsProxyClient::new(&env, &proxy); - let round = client.latest_round(&data_id, &18).unwrap(); + let round = client.latest_round(&data_id, &18); round.answer } } @@ -135,6 +137,12 @@ To complete this guide, you'll need: This contract calls the proxy's `latest_round` function with a single `data_id` and requests the answer at `18` decimal places. The returned `Round` contains the `round_id`, `answer`, and `timestamp` fields for the feed. + The `#[contractclient]` macro generates a client whose `latest_round` method returns the `Round` value directly, not a `Result`. Do not call `.unwrap()` on the result. If you need to handle errors from the proxy call, use the generated `try_latest_round` method instead. It returns a nested `Result`: the outer `Result` reports whether the call itself succeeded, and the inner `Result` carries the contract's `ProxyReadError`: + + ```rust + let round = client.try_latest_round(&data_id, &18).unwrap().unwrap(); + ``` + ## Build and deploy the contract 1. Build the contract: From 046c548f0bdcfa6f4db5865595dc765535f97712 Mon Sep 17 00:00:00 2001 From: devin distefano Date: Fri, 9 Oct 2026 12:16:19 -0500 Subject: [PATCH 2/2] remove extra explainer snippet --- src/content/data-feeds/llms-full.txt | 6 ------ .../data-feeds/stellar/using-data-feeds-on-chain.mdx | 6 ------ 2 files changed, 12 deletions(-) diff --git a/src/content/data-feeds/llms-full.txt b/src/content/data-feeds/llms-full.txt index 3fd97848f17..48867e59325 100644 --- a/src/content/data-feeds/llms-full.txt +++ b/src/content/data-feeds/llms-full.txt @@ -6116,12 +6116,6 @@ To complete this guide, you'll need: This contract calls the proxy's `latest_round` function with a single `data_id` and requests the answer at `18` decimal places. The returned `Round` contains the `round_id`, `answer`, and `timestamp` fields for the feed. - The `#[contractclient]` macro generates a client whose `latest_round` method returns the `Round` value directly, not a `Result`. Do not call `.unwrap()` on the result. If you need to handle errors from the proxy call, use the generated `try_latest_round` method instead. It returns a nested `Result`: the outer `Result` reports whether the call itself succeeded, and the inner `Result` carries the contract's `ProxyReadError`: - - ```rust - let round = client.try_latest_round(&data_id, &18).unwrap().unwrap(); - ``` - ## Build and deploy the contract 1. Build the contract: diff --git a/src/content/data-feeds/stellar/using-data-feeds-on-chain.mdx b/src/content/data-feeds/stellar/using-data-feeds-on-chain.mdx index b60ec4f0857..d095e17fabf 100644 --- a/src/content/data-feeds/stellar/using-data-feeds-on-chain.mdx +++ b/src/content/data-feeds/stellar/using-data-feeds-on-chain.mdx @@ -137,12 +137,6 @@ To complete this guide, you'll need: This contract calls the proxy's `latest_round` function with a single `data_id` and requests the answer at `18` decimal places. The returned `Round` contains the `round_id`, `answer`, and `timestamp` fields for the feed. - The `#[contractclient]` macro generates a client whose `latest_round` method returns the `Round` value directly, not a `Result`. Do not call `.unwrap()` on the result. If you need to handle errors from the proxy call, use the generated `try_latest_round` method instead. It returns a nested `Result`: the outer `Result` reports whether the call itself succeeded, and the inner `Result` carries the contract's `ProxyReadError`: - - ```rust - let round = client.try_latest_round(&data_id, &18).unwrap().unwrap(); - ``` - ## Build and deploy the contract 1. Build the contract: