From a2c68eeb30813c933985311c5e4a325d0e3a3385 Mon Sep 17 00:00:00 2001 From: Jane Wang Date: Thu, 20 Jun 2024 19:42:13 -0400 Subject: [PATCH] Rename cli commands to stellar in smart contract dir --- .../example-contracts/deployer.mdx | 16 ++++----- .../example-contracts/tokens.mdx | 12 +++---- .../deploy-increment-contract.mdx | 14 ++++---- .../getting-started/deploy-to-testnet.mdx | 18 +++++----- .../getting-started/storing-data.mdx | 6 ++-- .../guides/dapps/initialization.mdx | 36 +++++++++---------- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/docs/smart-contracts/example-contracts/deployer.mdx b/docs/smart-contracts/example-contracts/deployer.mdx index 2631de83e..6126a1f55 100644 --- a/docs/smart-contracts/example-contracts/deployer.mdx +++ b/docs/smart-contracts/example-contracts/deployer.mdx @@ -434,10 +434,10 @@ assert_eq!(sum, 5); ## Build the Contracts -To build the contract into a `.wasm` file, use the `soroban contract build` command. Build both the deployer contract and the test contract. +To build the contract into a `.wasm` file, use the `stellar contract build` command. Build both the deployer contract and the test contract. ```sh -soroban contract build +stellar contract build ``` Both `.wasm` files should be found in both contract `target` directories after building both contracts: @@ -457,7 +457,7 @@ If you have [`stellar-cli`] installed, you can invoke the contract function to d Before deploying the test contract with the deployer, install the test contract Wasm using the `install` command. The `install` command will print out the hash derived from the Wasm file (it's not just the hash of the Wasm file itself though) which should be used by the deployer. ```sh -soroban contract install --wasm contract/target/wasm32-unknown-unknown/release/soroban_deployer_test_contract.wasm +stellar contract install --wasm contract/target/wasm32-unknown-unknown/release/soroban_deployer_test_contract.wasm ``` The command prints out the hash as hex. It will look something like `7792a624b562b3d9414792f5fb5d72f53b9838fef2ed9a901471253970bc3b15`. @@ -465,7 +465,7 @@ The command prints out the hash as hex. It will look something like `7792a624b56 We also need to deploy the `Deployer` contract: ```sh -soroban contract deploy --wasm deployer/target/wasm32-unknown-unknown/release/soroban_deployer_contract.wasm --id 1 +stellar contract deploy --wasm deployer/target/wasm32-unknown-unknown/release/soroban_deployer_contract.wasm --id 1 ``` This will return the deployer address: `CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM`. @@ -477,7 +477,7 @@ Then the deployer contract may be invoked with the Wasm hash value above. ```sh -soroban contract invoke --id 1 -- deploy \ +stellar contract invoke --id 1 -- deploy \ --deployer CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM --salt 123 \ --wasm_hash 7792a624b562b3d9414792f5fb5d72f53b9838fef2ed9a901471253970bc3b15 \ @@ -490,7 +490,7 @@ soroban contract invoke --id 1 -- deploy \ ```powershell -soroban contract invoke --id 1 -- deploy ` +stellar contract invoke --id 1 -- deploy ` --deployer CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM --salt 123 ` --wasm_hash 7792a624b562b3d9414792f5fb5d72f53b9838fef2ed9a901471253970bc3b15 ` @@ -509,7 +509,7 @@ And then invoke the deployed test contract using the identifier returned from th ```sh -soroban contract invoke \ +stellar contract invoke \ --id ead19f55aec09bfcb555e09f230149ba7f72744a5fd639804ce1e934e8fe9c5d \ -- \ value @@ -520,7 +520,7 @@ soroban contract invoke \ ```powershell -soroban contract invoke ` +stellar contract invoke ` --id ead19f55aec09bfcb555e09f230149ba7f72744a5fd639804ce1e934e8fe9c5d ` -- ` value diff --git a/docs/smart-contracts/example-contracts/tokens.mdx b/docs/smart-contracts/example-contracts/tokens.mdx index 95ba7e63e..b25b7cf03 100644 --- a/docs/smart-contracts/example-contracts/tokens.mdx +++ b/docs/smart-contracts/example-contracts/tokens.mdx @@ -975,10 +975,10 @@ The eight tests created for this example contract test a range of possible condi ## Build the Contract -To build the contract, use the `soroban contract build` command. +To build the contract, use the `stellar contract build` command. ```sh -soroban contract build +stellar contract build ``` A `.wasm` file should be outputted in the `target` directory: @@ -989,14 +989,14 @@ target/wasm32-unknown-unknown/release/soroban_token_contract.wasm ## Run the Contract -If you have [`soroban-cli`] installed, you can invoke contract functions using it. +If you have [`stellar-cli`] installed, you can invoke contract functions using it. ```sh -soroban contract invoke \ +stellar contract invoke \ --wasm target/wasm32-unknown-unknown/release/soroban_token_contract.wasm \ --id 1 \ -- \ @@ -1009,7 +1009,7 @@ soroban contract invoke \ ```powershell -soroban contract invoke ` +stellar contract invoke ` --wasm target/wasm32-unknown-unknown/release/soroban_token_contract.wasm ` --id 1 ` -- ` @@ -1021,4 +1021,4 @@ soroban contract invoke ` -[`soroban-cli`]: ../../tools/developer-tools.mdx#cli +[`stellar-cli`]: ../../tools/developer-tools.mdx#cli diff --git a/docs/smart-contracts/getting-started/deploy-increment-contract.mdx b/docs/smart-contracts/getting-started/deploy-increment-contract.mdx index 38c4e748b..97638c461 100644 --- a/docs/smart-contracts/getting-started/deploy-increment-contract.mdx +++ b/docs/smart-contracts/getting-started/deploy-increment-contract.mdx @@ -35,7 +35,7 @@ You can run these two steps separately. Let's try it with the Increment contract ```sh -soroban contract install \ +stellar contract install \ --network testnet \ --source alice \ --wasm target/wasm32-unknown-unknown/release/soroban_increment_contract.wasm @@ -46,7 +46,7 @@ soroban contract install \ ```powershell -soroban contract install ` +stellar contract install ` --network testnet ` --source alice ` --wasm target/wasm32-unknown-unknown/release/soroban_increment_contract.wasm @@ -63,7 +63,7 @@ This returns the hash of the Wasm bytes, like `6ddb28e0980f643bb97350f7e3bacb0ff ```sh -soroban contract deploy \ +stellar contract deploy \ --wasm-hash 6ddb28e0980f643bb97350f7e3bacb0ff1fe74d846c6d4f2c625e766210fbb5b \ --source alice \ --network testnet @@ -74,7 +74,7 @@ soroban contract deploy \ ```powershell -soroban contract deploy ` +stellar contract deploy ` --wasm-hash 6ddb28e0980f643bb97350f7e3bacb0ff1fe74d846c6d4f2c625e766210fbb5b ` --source alice ` --network testnet @@ -91,7 +91,7 @@ This command will return the contract id (e.g. `CACDYF3CYMJEJTIVFESQYZTN67GO2R5D ```sh -soroban contract invoke \ +stellar contract invoke \ --id CACDYF3CYMJEJTIVFESQYZTN67GO2R5D5IUABTCUG3HXQSRXCSOROBAN \ --source alice \ --network testnet \ @@ -104,7 +104,7 @@ soroban contract invoke \ ```powershell -soroban contract invoke ` +stellar contract invoke ` --id CACDYF3CYMJEJTIVFESQYZTN67GO2R5D5IUABTCUG3HXQSRXCSOROBAN ` --source alice ` --network testnet ` @@ -131,6 +131,6 @@ Sometimes you'll need to run your own node: - Production apps! Stellar maintains public test RPC nodes for Testnet and Futurenet, but not for Mainnet. Instead, you will need to run your own node, and point your app at that. If you want to use a software-as-a-service platform for this, [various providers](../../data/rpc/rpc-providers.mdx) are available. - When you need a network that differs from the version deployed to Testnet. -The Soroban team maintains Docker containers that makes this as straightforward as possible. See the [RPC](../../data/rpc/admin-guide.mdx) reference for details. +The RPC team maintains Docker containers that makes this as straightforward as possible. See the [RPC](../../data/rpc/admin-guide.mdx) reference for details. Up next, we'll use the deployed contracts to build a simple web app. diff --git a/docs/smart-contracts/getting-started/deploy-to-testnet.mdx b/docs/smart-contracts/getting-started/deploy-to-testnet.mdx index b39765706..bc6a869c2 100644 --- a/docs/smart-contracts/getting-started/deploy-to-testnet.mdx +++ b/docs/smart-contracts/getting-started/deploy-to-testnet.mdx @@ -23,8 +23,8 @@ import { getPlatform } from "@site/src/helpers/getPlatform"; To recap what we've done so far, in [Setup](setup.mdx): - we set up our local environment to write Rust smart contracts -- installed the soroban-cli -- configured the soroban-cli to communicate with the Soroban Testnet via RPC +- installed the stellar-cli +- configured the stellar-cli to communicate with the Stellar Testnet via RPC - and configured an identity to sign transactions In [Hello World](hello-world.mdx) we created a `hello-world` project, and learned how to test and build the `HelloWorld` contract. Now we are ready to deploy that contract to Testnet, and interact with it. @@ -38,7 +38,7 @@ To deploy your HelloWorld contract, run the following command: ```sh -soroban contract deploy \ +stellar contract deploy \ --wasm target/wasm32-unknown-unknown/release/hello_world.wasm \ --source alice \ --network testnet @@ -49,7 +49,7 @@ soroban contract deploy \ ```powershell -soroban contract deploy ` +stellar contract deploy ` --wasm target/wasm32-unknown-unknown/release/hello_world.wasm ` --source alice ` --network testnet @@ -76,7 +76,7 @@ In the background, the CLI is making RPC calls. For information on that checkout ```sh -soroban contract invoke \ +stellar contract invoke \ --id CACDYF3CYMJEJTIVFESQYZTN67GO2R5D5IUABTCUG3HXQSRXCSOROBAN \ --source alice \ --network testnet \ @@ -90,7 +90,7 @@ soroban contract invoke \ ```powershell -soroban contract invoke ` +stellar contract invoke ` --id CACDYF3CYMJEJTIVFESQYZTN67GO2R5D5IUABTCUG3HXQSRXCSOROBAN ` --source alice ` --network testnet ` @@ -113,16 +113,16 @@ The following output should appear. The `--` double-dash is required! -This is a general [CLI pattern](https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean) used by other commands like [cargo run](https://doc.rust-lang.org/cargo/commands/cargo-run.html). Everything after the `--`, sometimes called [slop](https://github.com/clap-rs/clap/issues/971), is passed to a child process. In this case, `soroban contract invoke` builds an _implicit CLI_ on-the-fly for the `hello` method in your contract. It can do this because Soroban SDK embeds your contract's schema / interface types right in the `.wasm` file that gets deployed on-chain. You can also try: +This is a general [CLI pattern](https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean) used by other commands like [cargo run](https://doc.rust-lang.org/cargo/commands/cargo-run.html). Everything after the `--`, sometimes called [slop](https://github.com/clap-rs/clap/issues/971), is passed to a child process. In this case, `stellar contract invoke` builds an _implicit CLI_ on-the-fly for the `hello` method in your contract. It can do this because Soroban SDK embeds your contract's schema / interface types right in the `.wasm` file that gets deployed on-chain. You can also try: ```sh -soroban contract invoke ... -- --help +stellar contract invoke ... -- --help ``` and ```sh -soroban contract invoke ... -- hello --help +stellar contract invoke ... -- hello --help ``` ::: diff --git a/docs/smart-contracts/getting-started/storing-data.mdx b/docs/smart-contracts/getting-started/storing-data.mdx index 25cabb898..cc37d5b04 100644 --- a/docs/smart-contracts/getting-started/storing-data.mdx +++ b/docs/smart-contracts/getting-started/storing-data.mdx @@ -27,12 +27,12 @@ This tutorial assumes that you've already completed the previous steps in Gettin ## Adding the increment contract -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. +The `stellar 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 inside our `soroban-hello-world` directory, run: ```sh -soroban contract init ./ --with-example increment +stellar contract init ./ --with-example increment ``` This will create a new `contracts/increment` directory with the following files: @@ -141,7 +141,7 @@ For now, it's worth knowing that there are three kinds of storage: `Persistent`, From inside `soroban-hello-world`, run: ```sh -soroban contract build +stellar contract build ``` Check that it built: diff --git a/docs/smart-contracts/guides/dapps/initialization.mdx b/docs/smart-contracts/guides/dapps/initialization.mdx index 8381fb969..e9db91d2c 100644 --- a/docs/smart-contracts/guides/dapps/initialization.mdx +++ b/docs/smart-contracts/guides/dapps/initialization.mdx @@ -31,21 +31,21 @@ This action will compile the smart contracts and place them in the `token/target After building, you're ready to deploy the smart contracts to Futurenet. To do this, open a terminal in the `soroban-examples/token` directory and execute the following: ```shell -soroban contract deploy \ +stellar contract deploy \ --wasm target/wasm32-unknown-unknown/release/soroban_token_contract.wasm \ --source \ --rpc-url https://rpc-futurenet.stellar.org:443 \ --network-passphrase 'Test SDF Future Network ; October 2022' ``` -This command deploys the smart contracts to Futurenet using the `soroban contract deploy` function. +This command deploys the smart contracts to Futurenet using the `stellar contract deploy` function. ## Initializing a Token Contract With the contracts deployed, it's time to initialize the token contract: ```shell -soroban contract invoke \ +stellar contract invoke \ --id \ --source-account \ --rpc-url https://rpc-futurenet.stellar.org:443 \ @@ -72,7 +72,7 @@ This command requires certain inputs: Lastly, you need to mint some tokens to the sender's account: ```shell -soroban contract invoke \ +stellar contract invoke \ --id \ --source-account \ --rpc-url https://rpc-futurenet.stellar.org:443 \ @@ -101,7 +101,7 @@ set -e NETWORK="$1" -# If soroban-cli is called inside the soroban-preview docker container, +# If stellar-cli is called inside the soroban-preview docker container, # it can call the stellar standalone container just using its name "stellar" if [[ "$IS_USING_DOCKER" == "true" ]]; then SOROBAN_RPC_HOST="http://stellar:8000" @@ -136,18 +136,18 @@ esac echo Add the $NETWORK network to cli client -soroban network add \ +stellar network add \ --rpc-url "$SOROBAN_RPC_URL" \ --network-passphrase "$SOROBAN_NETWORK_PASSPHRASE" "$NETWORK" -if !(soroban keys ls | grep token-admin 2>&1 >/dev/null); then +if !(stellar keys ls | grep token-admin 2>&1 >/dev/null); then echo Create the token-admin identity - soroban keys generate token-admin + stellar keys generate token-admin fi -TOKEN_ADMIN_SECRET="$(soroban keys show token-admin)" -TOKEN_ADMIN_ADDRESS="$(soroban keys address token-admin)" +TOKEN_ADMIN_SECRET="$(stellar keys show token-admin)" +TOKEN_ADMIN_ADDRESS="$(stellar keys address token-admin)" -# TODO: Remove this once we can use `soroban keys` from webpack. +# TODO: Remove this once we can use `stellar keys` from webpack. mkdir -p .soroban-example-dapp echo "$TOKEN_ADMIN_SECRET" > .soroban-example-dapp/token_admin_secret echo "$TOKEN_ADMIN_ADDRESS" > .soroban-example-dapp/token_admin_address @@ -159,7 +159,7 @@ curl --silent -X POST "$FRIENDBOT_URL?addr=$TOKEN_ADMIN_ADDRESS" >/dev/null ARGS="--network $NETWORK --source token-admin" echo Deploy the Stellar asset contract -TOKEN_ID=$(soroban contract asset deploy $ARGS --asset "EXT:$TOKEN_ADMIN_ADDRESS") +TOKEN_ID=$(stellar contract asset deploy $ARGS --asset "EXT:$TOKEN_ADMIN_ADDRESS") echo "Token deployed successfully with TOKEN_ID: $TOKEN_ID" # TODO - remove this workaround when @@ -174,7 +174,7 @@ make build echo Deploy the crowdfund contract CROWDFUND_ID="$( - soroban contract deploy $ARGS \ + stellar contract deploy $ARGS \ --wasm target/wasm32-unknown-unknown/release/soroban_crowdfund_contract.wasm )" echo "Contract deployed successfully with ID: $CROWDFUND_ID" @@ -182,7 +182,7 @@ echo "$CROWDFUND_ID" > .soroban-example-dapp/crowdfund_id echo "Initialize the crowdfund contract" deadline="$(($(date +"%s") + 86400))" -soroban contract invoke \ +stellar contract invoke \ $ARGS \ --id "$CROWDFUND_ID" \ -- \ @@ -201,13 +201,13 @@ Here's a summary of what the `initialize.sh` script does: - Determines the Soroban RPC host URL depending on its execution environment (either inside the soroban-preview Docker container or locally) - Sets the Soroban RPC URL based on the previously determined host URL - Sets the Soroban network passphrase and Friendbot URL depending on the chosen network -- Adds the network configuration to Soroban using `soroban network add` -- Generates a token-admin identity using `soroban keys generate` +- Adds the network configuration using `stellar network add` +- Generates a token-admin identity using `stellar keys generate` - Fetches the TOKEN_ADMIN_SECRET and TOKEN_ADMIN_ADDRESS from the newly generated identity - Saves the TOKEN_ADMIN_SECRET and TOKEN_ADMIN_ADDRESS in the .soroban directory - Funds the token-admin account using Friendbot -- Deploy the Stellar asset contract with `soroban contract asset deploy` and stores the resulting TOKEN_ID -- Builds the crowdfund contract with `make build` and deploys it using `soroban contract deploy`, storing the returned CROWDFUND_ID +- Deploy the Stellar asset contract with `stellar contract asset deploy` and stores the resulting TOKEN_ID +- Builds the crowdfund contract with `make build` and deploys it using `stellar contract deploy`, storing the returned CROWDFUND_ID - Initializes the crowdfund contract by invoking the initialize function with necessary parameters - Prints "Done" to signify the end of the initialization process