From b1302f2d9956e7074948830c184f788d22b3e630 Mon Sep 17 00:00:00 2001 From: kaankacar Date: Mon, 2 Feb 2026 21:09:42 +0300 Subject: [PATCH 1/3] fix: replace deprecated invoke --wasm with deploy-then-invoke workflow The --wasm flag was removed from `stellar contract invoke` in CLI PR #997 (October 2023) when sandbox mode was removed. Contracts must now be deployed first, then invoked by contract ID. Updated 7 example contract tutorials to use the correct two-step workflow: 1. Deploy with `stellar contract deploy --wasm ... --alias ... --network testnet` 2. Invoke with `stellar contract invoke --id --network testnet` Files updated: - TEMPLATE.mdx - auth.mdx - events.mdx - liquidity-pool.mdx - logging.mdx - storage.mdx (also fixed incorrect wasm filename reference) - tokens.mdx Fixes #2212 --- .../example-contracts/TEMPLATE.mdx | 41 ++++++- .../example-contracts/auth.mdx | 107 +++++++++++------- .../example-contracts/events.mdx | 41 ++++++- .../example-contracts/liquidity-pool.mdx | 41 ++++++- .../example-contracts/logging.mdx | 41 ++++++- .../example-contracts/storage.mdx | 18 ++- .../example-contracts/tokens.mdx | 41 ++++++- 7 files changed, 260 insertions(+), 70 deletions(-) diff --git a/docs/build/smart-contracts/example-contracts/TEMPLATE.mdx b/docs/build/smart-contracts/example-contracts/TEMPLATE.mdx index 48a8e3358a..cdbaca2da8 100644 --- a/docs/build/smart-contracts/example-contracts/TEMPLATE.mdx +++ b/docs/build/smart-contracts/example-contracts/TEMPLATE.mdx @@ -147,15 +147,45 @@ target/wasm32v1-none/release/soroban_hello_world_contract.wasm ## Run the Contract -If you have [`stellar-cli`] installed, you can invoke contract functions using it. +If you have [`stellar-cli`] installed, you can deploy the contract and invoke its functions. + +### Deploy ```sh -stellar contract invoke \ +stellar contract deploy \ --wasm target/wasm32v1-none/release/soroban_hello_world_contract.wasm \ - --id 1 \ + --alias hello \ + --source-account alice \ + --network testnet +``` + + + + +```powershell +stellar contract deploy ` + --wasm target/wasm32v1-none/release/soroban_hello_world_contract.wasm ` + --alias hello ` + --source-account alice ` + --network testnet +``` + + + + +### Invoke + + + + +```sh +stellar contract invoke \ + --id hello \ + --source-account alice \ + --network testnet \ -- \ hello \ --to Soroban @@ -166,8 +196,9 @@ stellar contract invoke \ ```powershell stellar contract invoke ` - --wasm target/wasm32v1-none/release/soroban_hello_world_contract.wasm ` - --id 1 ` + --id hello ` + --source-account alice ` + --network testnet ` -- ` hello ` --to Soroban diff --git a/docs/build/smart-contracts/example-contracts/auth.mdx b/docs/build/smart-contracts/example-contracts/auth.mdx index 1825a2f1e7..cbd96aac8e 100644 --- a/docs/build/smart-contracts/example-contracts/auth.mdx +++ b/docs/build/smart-contracts/example-contracts/auth.mdx @@ -303,13 +303,13 @@ target/wasm32v1-none/release/soroban_auth_contract.wasm ## Run the Contract -If you have [`stellar-cli`] installed, you can invoke functions on the contract. +If you have [`stellar-cli`] installed, you can deploy the contract and invoke its functions. But since we are dealing with authorization and signatures, we need to set up some identities to use for testing and get their public keys: ```sh -stellar keys generate acc1 -stellar keys generate acc2 +stellar keys generate acc1 --network testnet +stellar keys generate acc2 --network testnet stellar keys address acc1 stellar keys address acc2 ``` @@ -321,6 +321,35 @@ GA6S566FD3EQDUNQ4IGSLXKW3TGVSTQW3TPHPGS7NWMCEIPBOKTNCSRU GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B ``` +### Deploy + + + + +```sh +stellar contract deploy \ + --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ + --alias auth \ + --source-account acc1 \ + --network testnet +``` + + + + +```powershell +stellar contract deploy ` + --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm ` + --alias auth ` + --source-account acc1 ` + --network testnet +``` + + + + +### Invoke + Now the contract itself can be invoked. Notice the `--source-account` must be the identity name matching the address passed to the `--user` argument. This allows `Stellar CLI` to automatically sign the necessary payload for the invocation. @@ -328,9 +357,9 @@ Now the contract itself can be invoked. Notice the `--source-account` must be th ```sh stellar contract invoke \ + --id auth \ --source-account acc1 \ - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ - --id 1 \ + --network testnet \ -- \ increment \ --user GA6S566FD3EQDUNQ4IGSLXKW3TGVSTQW3TPHPGS7NWMCEIPBOKTNCSRU \ @@ -342,9 +371,9 @@ stellar contract invoke \ ```powershell stellar contract invoke ` + --id auth ` --source-account acc1 ` - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm ` - --id 1 ` + --network testnet ` -- ` increment ` --user GA6S566FD3EQDUNQ4IGSLXKW3TGVSTQW3TPHPGS7NWMCEIPBOKTNCSRU ` @@ -361,9 +390,9 @@ Run a few more increments for both accounts. ```sh stellar contract invoke \ + --id auth \ --source-account acc2 \ - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ - --id 1 \ + --network testnet \ -- \ increment \ --user GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B \ @@ -372,9 +401,9 @@ stellar contract invoke \ ```sh stellar contract invoke \ + --id auth \ --source-account acc1 \ - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ - --id 1 \ + --network testnet \ -- \ increment \ --user GA6S566FD3EQDUNQ4IGSLXKW3TGVSTQW3TPHPGS7NWMCEIPBOKTNCSRU \ @@ -383,9 +412,9 @@ stellar contract invoke \ ```sh stellar contract invoke \ + --id auth \ --source-account acc2 \ - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ - --id 1 \ + --network testnet \ -- \ increment \ --user GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B \ @@ -396,35 +425,35 @@ stellar contract invoke \ ```powershell -stellar contract invoke \ - --source-account acc2 \ - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ - --id 1 \ - -- \ - increment \ - --user GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B \ +stellar contract invoke ` + --id auth ` + --source-account acc2 ` + --network testnet ` + -- ` + increment ` + --user GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B ` --value 5 ``` ```powershell -stellar contract invoke \ - --source-account acc1 \ - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ - --id 1 \ - -- \ - increment \ - --user GA6S566FD3EQDUNQ4IGSLXKW3TGVSTQW3TPHPGS7NWMCEIPBOKTNCSRU \ +stellar contract invoke ` + --id auth ` + --source-account acc1 ` + --network testnet ` + -- ` + increment ` + --user GA6S566FD3EQDUNQ4IGSLXKW3TGVSTQW3TPHPGS7NWMCEIPBOKTNCSRU ` --value 3 ``` ```powershell -stellar contract invoke \ - --source-account acc2 \ - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ - --id 1 \ - -- \ - increment \ - --user GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B \ +stellar contract invoke ` + --id auth ` + --source-account acc2 ` + --network testnet ` + -- ` + increment ` + --user GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B ` --value 10 ``` @@ -434,7 +463,7 @@ stellar contract invoke \ View the data that has been stored against each user with `stellar contract read`. ```sh -stellar contract read --id 1 +stellar contract read --id auth --network testnet ``` ``` @@ -449,10 +478,10 @@ It is also possible to preview the authorization payload that is being signed by ```sh stellar contract invoke \ + --id auth \ --source-account acc2 \ + --network testnet \ --auth \ - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm \ - --id 1 \ -- \ increment \ --user GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B \ @@ -464,10 +493,10 @@ stellar contract invoke \ ```powershell stellar contract invoke ` + --id auth ` --source-account acc2 ` + --network testnet ` --auth ` - --wasm target/wasm32v1-none/release/soroban_auth_contract.wasm ` - --id 1 ` -- ` increment ` --user GAJGHZ44IJXYFNOVRZGBCVKC2V62DB2KHZB7BEMYOWOLFQH4XP2TAM6B ` diff --git a/docs/build/smart-contracts/example-contracts/events.mdx b/docs/build/smart-contracts/example-contracts/events.mdx index 12844be887..2f5348e395 100644 --- a/docs/build/smart-contracts/example-contracts/events.mdx +++ b/docs/build/smart-contracts/example-contracts/events.mdx @@ -280,15 +280,45 @@ target/wasm32v1-none/release/soroban_events_contract.wasm ## Run the Contract -If you have [`stellar-cli`] installed, you can invoke contract functions in the using it. +If you have [`stellar-cli`] installed, you can deploy the contract and invoke its functions. + +### Deploy ```sh -stellar contract invoke \ +stellar contract deploy \ --wasm target/wasm32v1-none/release/soroban_events_contract.wasm \ - --id 1 \ + --alias events \ + --source-account alice \ + --network testnet +``` + + + + +```powershell +stellar contract deploy ` + --wasm target/wasm32v1-none/release/soroban_events_contract.wasm ` + --alias events ` + --source-account alice ` + --network testnet +``` + + + + +### Invoke + + + + +```sh +stellar contract invoke \ + --id events \ + --source-account alice \ + --network testnet \ -- \ increment ``` @@ -298,8 +328,9 @@ stellar contract invoke \ ```powershell stellar contract invoke ` - --wasm target/wasm32v1-none/release/soroban_events_contract.wasm ` - --id 1 ` + --id events ` + --source-account alice ` + --network testnet ` -- ` increment ``` diff --git a/docs/build/smart-contracts/example-contracts/liquidity-pool.mdx b/docs/build/smart-contracts/example-contracts/liquidity-pool.mdx index ec7e24b50f..cf81e765d5 100644 --- a/docs/build/smart-contracts/example-contracts/liquidity-pool.mdx +++ b/docs/build/smart-contracts/example-contracts/liquidity-pool.mdx @@ -842,15 +842,45 @@ target/wasm32v1-none/release/soroban_liquidity_pool_contract.wasm ## Run the Contract -If you have [`stellar-cli`] installed, you can invoke contract functions using it. +If you have [`stellar-cli`] installed, you can deploy the contract and invoke its functions. + +### Deploy ```sh -stellar contract invoke \ +stellar contract deploy \ --wasm target/wasm32v1-none/release/soroban_liquidity_pool_contract.wasm \ - --id 1 \ + --alias liquidity-pool \ + --source-account alice \ + --network testnet +``` + + + + +```powershell +stellar contract deploy ` + --wasm target/wasm32v1-none/release/soroban_liquidity_pool_contract.wasm ` + --alias liquidity-pool ` + --source-account alice ` + --network testnet +``` + + + + +### Invoke + + + + +```sh +stellar contract invoke \ + --id liquidity-pool \ + --source-account alice \ + --network testnet \ -- \ deposit \ --to GBZV3NONYSUDVTEHATQO4BCJVFXJO3XQU5K32X3XREVZKSMMOZFO4ZXR \ @@ -865,8 +895,9 @@ stellar contract invoke \ ```powershell stellar contract invoke ` - --wasm target/wasm32v1-none/release/soroban_liquidity_pool_contract.wasm ` - --id 1 ` + --id liquidity-pool ` + --source-account alice ` + --network testnet ` -- ` deposit ` --to GBZV3NONYSUDVTEHATQO4BCJVFXJO3XQU5K32X3XREVZKSMMOZFO4ZXR ` diff --git a/docs/build/smart-contracts/example-contracts/logging.mdx b/docs/build/smart-contracts/example-contracts/logging.mdx index fb77ec1ef7..c847f16ed5 100644 --- a/docs/build/smart-contracts/example-contracts/logging.mdx +++ b/docs/build/smart-contracts/example-contracts/logging.mdx @@ -254,15 +254,45 @@ target/wasm32v1-none/release-with-logs/soroban_logging_contract.wasm ## Run the Contract -If you have [`stellar-cli`] installed, you can invoke contract functions in the using it. Specify the `-v` option to enable verbose logs. +If you have [`stellar-cli`] installed, you can deploy the contract and invoke its functions. Specify the `-v` option to enable verbose logs. + +### Deploy ```sh -stellar -v contract invoke \ +stellar contract deploy \ --wasm target/wasm32v1-none/release-with-logs/soroban_logging_contract.wasm \ - --id 1 \ + --alias logging \ + --source-account alice \ + --network testnet +``` + + + + +```powershell +stellar contract deploy ` + --wasm target/wasm32v1-none/release-with-logs/soroban_logging_contract.wasm ` + --alias logging ` + --source-account alice ` + --network testnet +``` + + + + +### Invoke + + + + +```sh +stellar -v contract invoke \ + --id logging \ + --source-account alice \ + --network testnet \ -- \ hello \ --value friend @@ -273,8 +303,9 @@ stellar -v contract invoke \ ```powershell stellar -v contract invoke ` - --wasm target/wasm32v1-none/release-with-logs/soroban_logging_contract.wasm ` - --id 1 ` + --id logging ` + --source-account alice ` + --network testnet ` -- ` hello ` --value friend diff --git a/docs/build/smart-contracts/example-contracts/storage.mdx b/docs/build/smart-contracts/example-contracts/storage.mdx index 174992c853..d1b5209881 100644 --- a/docs/build/smart-contracts/example-contracts/storage.mdx +++ b/docs/build/smart-contracts/example-contracts/storage.mdx @@ -207,7 +207,9 @@ If you have [`stellar-cli`] installed, you can deploy the contract, and invoke t ```sh stellar contract deploy \ --wasm target/wasm32v1-none/release/soroban_increment_contract.wasm \ - --id a + --alias increment \ + --source-account alice \ + --network testnet ``` @@ -216,7 +218,9 @@ stellar contract deploy \ ```powershell stellar contract deploy ` --wasm target/wasm32v1-none/release/soroban_increment_contract.wasm ` - --id a + --alias increment ` + --source-account alice ` + --network testnet ``` @@ -229,8 +233,9 @@ stellar contract deploy ` ```sh stellar contract invoke \ - --wasm target/wasm32v1-none/release/soroban_events_contract.wasm \ - --id 1 \ + --id increment \ + --source-account alice \ + --network testnet \ -- \ increment ``` @@ -240,8 +245,9 @@ stellar contract invoke \ ```powershell stellar contract invoke ` - --wasm target/wasm32v1-none/release/soroban_events_contract.wasm ` - --id 1 ` + --id increment ` + --source-account alice ` + --network testnet ` -- ` increment ``` diff --git a/docs/build/smart-contracts/example-contracts/tokens.mdx b/docs/build/smart-contracts/example-contracts/tokens.mdx index 68bc98e6fc..02c08d3374 100644 --- a/docs/build/smart-contracts/example-contracts/tokens.mdx +++ b/docs/build/smart-contracts/example-contracts/tokens.mdx @@ -931,15 +931,45 @@ target/wasm32v1-none/release/soroban_token_contract.wasm ## Run the Contract -If you have [`stellar-cli`] installed, you can invoke contract functions using it. +If you have [`stellar-cli`] installed, you can deploy the contract and invoke its functions. + +### Deploy ```sh -stellar contract invoke \ +stellar contract deploy \ --wasm target/wasm32v1-none/release/soroban_token_contract.wasm \ - --id 1 \ + --alias token \ + --source-account alice \ + --network testnet +``` + + + + +```powershell +stellar contract deploy ` + --wasm target/wasm32v1-none/release/soroban_token_contract.wasm ` + --alias token ` + --source-account alice ` + --network testnet +``` + + + + +### Invoke + + + + +```sh +stellar contract invoke \ + --id token \ + --source-account alice \ + --network testnet \ -- \ balance \ --id GBZV3NONYSUDVTEHATQO4BCJVFXJO3XQU5K32X3XREVZKSMMOZFO4ZXR @@ -950,8 +980,9 @@ stellar contract invoke \ ```powershell stellar contract invoke ` - --wasm target/wasm32v1-none/release/soroban_token_contract.wasm ` - --id 1 ` + --id token ` + --source-account alice ` + --network testnet ` -- ` balance ` --id GBZV3NONYSUDVTEHATQO4BCJVFXJO3XQU5K32X3XREVZKSMMOZFO4ZXR From 4effbeb7b847b302e23ac28b13ea3531ddd474e9 Mon Sep 17 00:00:00 2001 From: kaankacar Date: Mon, 9 Feb 2026 18:22:14 +0300 Subject: [PATCH 2/3] chore: trigger preview build --- docs/build/smart-contracts/example-contracts/logging.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/build/smart-contracts/example-contracts/logging.mdx b/docs/build/smart-contracts/example-contracts/logging.mdx index c847f16ed5..3b177597c3 100644 --- a/docs/build/smart-contracts/example-contracts/logging.mdx +++ b/docs/build/smart-contracts/example-contracts/logging.mdx @@ -322,3 +322,4 @@ The output should include the following line. [`log!`]: https://docs.rs/soroban-sdk/latest/soroban_sdk/macro.log.html [`stellar-cli`]: ../getting-started/setup.mdx#install-the-stellar-cli + From 2ea6db0e924385c169ab16ae1ca09685567bbe0f Mon Sep 17 00:00:00 2001 From: kaankacar Date: Mon, 9 Feb 2026 18:45:48 +0300 Subject: [PATCH 3/3] fix: remove trailing newline for prettier --- docs/build/smart-contracts/example-contracts/logging.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/build/smart-contracts/example-contracts/logging.mdx b/docs/build/smart-contracts/example-contracts/logging.mdx index 3b177597c3..c847f16ed5 100644 --- a/docs/build/smart-contracts/example-contracts/logging.mdx +++ b/docs/build/smart-contracts/example-contracts/logging.mdx @@ -322,4 +322,3 @@ The output should include the following line. [`log!`]: https://docs.rs/soroban-sdk/latest/soroban_sdk/macro.log.html [`stellar-cli`]: ../getting-started/setup.mdx#install-the-stellar-cli -