From 3b9563932417f111b9459122919b67936aba2340 Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 4 Mar 2024 15:23:46 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Elliot Voris --- docs/getting-started/create-an-app.mdx | 6 +++--- docs/getting-started/hello-world.mdx | 2 +- docs/getting-started/storing-data.mdx | 10 ++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/getting-started/create-an-app.mdx b/docs/getting-started/create-an-app.mdx index 57441ba2..1774716a 100644 --- a/docs/getting-started/create-an-app.mdx +++ b/docs/getting-started/create-an-app.mdx @@ -69,7 +69,7 @@ Though we can run `soroban contract bindings typescript` for each of our contrac In addition to generating the NPM packages, `initialize.js` will also: -- Generate and fund our soroban account +- Generate and fund our Stellar account - Build all of the contracts in the `contracts` dir - Deploy our contracts - Create handy contract clients for each contract @@ -310,7 +310,7 @@ Now you're ready to sign the call to `increment`! ### Call `increment` -Now we can import the increment contract client from `soroban_increment_contract` and start using it. We'll again create a new Astro component. Create a new file at `src/components/Counter.astro` with the following contents: +Now we can import the `increment` contract client from `soroban_increment_contract` and start using it. We'll again create a new Astro component. Create a new file at `src/components/Counter.astro` with the following contents: ```html title="src/components/Counter.astro" Incrementor
@@ -350,7 +350,7 @@ The biggest difference from the call to `greeter.hello` is that this transaction :::info -Destructuring `{ result }` If you're new to JavaScript, you may not know what's happening with those `const { result }` lines. This is using JavaScript's _destructuring_ feature. If the thing on the right of the equals sign is an object, then you can use this pattern to quickly grab specific keys from that object and assign them to variables. You can also name the variable something else, if you like. For example, try changing the code above to: +Destructuring `{ result }`: If you're new to JavaScript, you may not know what's happening with those `const { result }` lines. This is using JavaScript's _destructuring_ feature. If the thing on the right of the equals sign is an object, then you can use this pattern to quickly grab specific keys from that object and assign them to variables. You can also name the variable something else, if you like. For example, try changing the code above to: ```ts const { result: newValue } = ... diff --git a/docs/getting-started/hello-world.mdx b/docs/getting-started/hello-world.mdx index d7e4cbe1..32bc24da 100644 --- a/docs/getting-started/hello-world.mdx +++ b/docs/getting-started/hello-world.mdx @@ -350,7 +350,7 @@ Building optimized contracts is only necessary when deploying to a network with In this section, we wrote a simple contract that can be deployed to a Soroban network. -Next we'll learn to deploy the HelloWorld contract to Soroban's Testnet network and interact with it over RPC using the CLI. +Next we'll learn to deploy the HelloWorld contract to Stellar's Testnet network and interact with it over RPC using the CLI. [Rust unit tests]: https://doc.rust-lang.org/rust-by-example/testing/unit_testing.html [`soroban-cli`]: setup.mdx#install-the-soroban-cli diff --git a/docs/getting-started/storing-data.mdx b/docs/getting-started/storing-data.mdx index c5d54e17..a5a87e1b 100644 --- a/docs/getting-started/storing-data.mdx +++ b/docs/getting-started/storing-data.mdx @@ -25,7 +25,7 @@ import TabItem from "@theme/TabItem"; Now that we've built a basic Hello World example contract, we'll write a simple contract that stores and retrieves data. This will help you see the basics of Soroban's storage system. -This is going to follow along with the [increment example](https://github.com/stellar/soroban-examples/tree/v20.0.0/increment), which has a single function that increments an internal counter and returns the value. If you want to see a working example, [try it in GitPod](https://gitpod.io/#https://github.com/stellar/soroban-examples/tree/v20.0.0). +This is going to follow along with the [increment example](https://github.com/stellar/soroban-examples/tree/v20.2.0/increment), which has a single function that increments an internal counter and returns the value. If you want to see a working example, [try it in GitPod](https://gitpod.io/#https://github.com/stellar/soroban-examples/tree/v20.2.0). This tutorial assumes that you've already completed the previous steps in Getting Started: [Setup](./setup.mdx), [Hello World](./hello-world.mdx), and [Deploy to Testnet](./deploy-to-testnet.mdx). @@ -33,7 +33,7 @@ This tutorial assumes that you've already completed the previous steps in Gettin The `soroban contract init` command allows us to initialize a new project with any of the example contracts from the [soroban-examples](https://github.com/stellar/soroban-examples) repo, using the `--with-example` (or `-w`) flag. -It will not overwrite existing files, so we can also use this command to add a new contract to an existing project. Run the command again with a `--with-example` flag to add an `increment` contract to our project. From the our `getting-started-tutorial` directory, run: +It will not overwrite existing files, so we can also use this command to add a new contract to an existing project. Run the command again with a `--with-example` flag to add an `increment` contract to our project. From inside our `getting-started-tutorial` directory, run: ```sh soroban contract init ./ --with-example increment @@ -136,7 +136,7 @@ The `set()` function stores the new count value against the key, replacing the e env.storage().instance().extend_ttl(100, 100); ``` -All contract data has a Time To Live (TTL), measured in ledgers, that must be periodically extended. If an entry's TTL is not periodically extended, the entry will eventually become "archived". You can learn more about this in the [State Archival](../soroban-internals/state-archival.mdx) document. +All contract data has a Time To Live (TTL), measured in ledgers, that must be periodically extended. If an entry's TTL is not periodically extended, the entry will eventually become "archived." You can learn more about this in the [State Archival](../soroban-internals/state-archival.mdx) document. For now, it's worth knowing that there are three kinds of storage: `Persistent`, `Temporary`, and `Instance`. This contract only uses `Instance` storage: `env.storage().instance()`. Every time the counter is incremented, this storage's TTL gets extended by 100 [ledgers](https://developers.stellar.org/docs/fundamentals-and-concepts/stellar-data-structures/ledgers), or about 500 seconds. @@ -148,7 +148,9 @@ soroban contract build Check that it built: - ls target/wasm32-unknown-unknown/release/*.wasm +```bash +ls target/wasm32-unknown-unknown/release/*.wasm +``` You should see both `soroban_hello_world_contract.wasm` and `soroban_increment_contract.wasm`.