From 54f3ffd6f283c1b33e6290c1e30b6b95399ca5cd Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:53:55 -0500 Subject: [PATCH] Simplfy generate and fund command calls --- docs/getting-started/deploy-to-testnet.mdx | 6 +++- docs/getting-started/setup.mdx | 34 ++++++---------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/docs/getting-started/deploy-to-testnet.mdx b/docs/getting-started/deploy-to-testnet.mdx index fbca5d78..d1f055af 100644 --- a/docs/getting-started/deploy-to-testnet.mdx +++ b/docs/getting-started/deploy-to-testnet.mdx @@ -56,7 +56,11 @@ In the background, the CLI is making RPC calls. For information on that checkout ::: -Here we're setting the `to` argument to `RPC`. This again makes use of command expansion `$(…)`; see the note about that in the [Configure an Identity](setup.mdx#configure-an-identity) section of Setup. +:::tip Command Expansion `$(…)` + +This uses [command expansion](https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html), which only works with bash-compatible shells. If you are using Windows or some other shell, you will need to copy the output of `soroban config…` and paste it into the `curl` command, or figure out how command expansion works in your shell. + +::: ```bash soroban contract invoke \ diff --git a/docs/getting-started/setup.mdx b/docs/getting-started/setup.mdx index b57e473a..f0e3be33 100644 --- a/docs/getting-started/setup.mdx +++ b/docs/getting-started/setup.mdx @@ -31,16 +31,13 @@ To build and develop contracts you need only a couple prerequisites: ## Install Rust -If you use macOS, Linux, or another Unix-like OS, the simplest method to install -a Rust toolchain is to install `rustup`. Install `rustup` with the following -command. +If you use macOS, Linux, or another Unix-like OS, the simplest method to install a Rust toolchain is to install `rustup`. Install `rustup` with the following command. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -If you use Windows, or need an alternative method of installing Rust, check out: -https://www.rust-lang.org/tools/install +If you use Windows, or need an alternative method of installing Rust, check out: https://www.rust-lang.org/tools/install ## Install the target @@ -52,9 +49,7 @@ rustup target add wasm32-unknown-unknown ## Configure an Editor -Many editors have support for Rust. Visit the following link to find out how to -configure your editor: -https://www.rust-lang.org/tools +Many editors have support for Rust. Visit the following link to find out how to configure your editor: https://www.rust-lang.org/tools A popular editor is Visual Studio Code: @@ -68,8 +63,7 @@ A popular editor is Visual Studio Code: ## Install the Soroban CLI -The Soroban CLI can execute Soroban contracts in the same environment the -contract will execute on network, however in a local sandbox. +The Soroban CLI can execute Soroban contracts in the same environment the contract will execute on network, however in a local sandbox. Install the Soroban CLI using `cargo install`. @@ -79,8 +73,7 @@ cargo install --locked --version 20.3.0 soroban-cli :::info -Report issues and share feedback about the Soroban CLI -[here](https://github.com/stellar/soroban-cli/issues/new/choose). +Report issues and share feedback about the Soroban CLI [here](https://github.com/stellar/soroban-cli/issues/new/choose). ::: @@ -157,8 +150,7 @@ soroban network add --global testnet \ --network-passphrase "Test SDF Network ; September 2015" ``` -Note the `--global` flag. This creates a file in your home folder's `~/.config/soroban/network/testnet.toml` with the settings you specified. This -means that you can use the `--network testnet` flag in any Soroban CLI command to use this network from any directory or filepath on your system. +Note the `--global` flag. This creates a file in your home folder's `~/.config/soroban/network/testnet.toml` with the settings you specified. This means that you can use the `--network testnet` flag in any Soroban CLI command to use this network from any directory or filepath on your system. If you want project-specific network configurations, you can omit the `--global` flag, and the networks will be added to your working directory's `.soroban/network` folder instead. @@ -169,9 +161,7 @@ When you deploy a smart contract to a network, you need to specify an identity t Let's configure an identity called `alice`. You can use any name you want, but it might be nice to have some named identities that you can use for testing, such as [`alice`, `bob`, and `carol`](https://en.wikipedia.org/wiki/Alice_and_Bob). ```bash -soroban keys generate --global alice \ - --rpc-url https://soroban-testnet.stellar.org:443 \ - --network-passphrase "Test SDF Network ; September 2015" +soroban keys generate --global alice --network testnet ``` You can see the public key of `alice` with: @@ -184,17 +174,11 @@ Like the Network configs, the `--global` means that the identity gets stored in All this did so far is generate a public/private keypair on your local machine. No network requests were made, and `alice` has no funds on Testnet. This means that you can't make any transactions with `alice` yet. -To get `alice` some Testnet tokens, you'll need to use [Friendbot](https://developers.stellar.org/docs/fundamentals-and-concepts/testnet-and-pubnet#friendbot). All Stellar and Soroban test networks have a Friendbot that you can use to get some test tokens. The public Friendbot instance for Testnet lives at `https://friendbot.stellar.org`. Use it: +To get `alice` some Testnet tokens, you'll need to use [Friendbot](https://developers.stellar.org/docs/fundamentals-and-concepts/testnet-and-pubnet#friendbot). All Stellar and Soroban test networks have a Friendbot that you can use to get some test tokens. The public Friendbot instance for Testnet lives at `https://friendbot.stellar.org`. The cli includes a `fund` subcommand to fund your address with Friendbot: ```bash -curl "https://friendbot.stellar.org/?addr=$(soroban keys address alice)" +soroban keys fund alice --network testnet ``` -:::tip Command Expansion `$(…)` - -This uses [command expansion](https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html), which only works with bash-compatible shells. If you are using Windows or some other shell, you will need to copy the output of `soroban config…` and paste it into the `curl` command, or figure out how command expansion works in your shell. - -::: - [Rust]: https://www.rust-lang.org/ [Soroban CLI]: setup.mdx#install-the-soroban-cli