Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ concurrency:

jobs:
docs-validation:
uses: stellar/stellar-docs/.github/workflows/build.yml@main
uses: stellar/stellar-docs/.github/workflows/cli-build.yml@main
with:
stellar-cli-ref: ${{ github.sha }}
4 changes: 3 additions & 1 deletion FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5020,6 +5020,8 @@ Generate arbitrary XDR values

Default value: `20000`

- `--entropy <ENTROPY>` — Drive generation with the bytes in this file, or stdin if '-', instead of with fresh randomness. Bytes are consumed the same way the fuzz targets consume them, so a fuzz corpus entry piped in here produces the value that entry stands for

## `stellar xdr xfile`

Preprocess XDR .x files
Expand Down Expand Up @@ -5094,7 +5096,7 @@ Generate the zero strkey

- `<STRKEY>` — Strkey type to generate the zero value for

Possible values: `public_key_ed25519`, `pre_auth_tx`, `hash_x`, `muxed_account_ed25519`, `signed_payload_ed25519`, `contract`, `liquidity_pool`, `claimable_balance_v0`
Possible values: `public_key_ed25519`, `pre_auth_tx`, `hash_x`, `muxed_account_ed25519`, `signed_payload_ed25519`, `contract`, `liquidity_pool`, `claimable_balance_v0`, `muxed_contract`

###### **Options:**

Expand Down
4 changes: 1 addition & 3 deletions cookbook/asset-management.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Asset Management
hide_table_of_contents: false
description: Issue a Stellar Asset, deploy it's contract, and mint, burn, freeze, and clawback.
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/asset-management.mdx
---

The [stellar-cli] can be used to issue and administer assets on the Stellar network.
Expand Down Expand Up @@ -263,7 +261,7 @@ Using the user account, invoke the asset contract's `transfer` function. The inv
stellar keys use user
```

```bash cookbooktest.fail cookbooktest.stderr="balance is deauthorized"
```bash cookbooktest.fail="" cookbooktest.stderr="balance is deauthorized"
stellar contract invoke --id mycontract -- transfer --from user --to user2 --amount 3
```

Expand Down
6 changes: 2 additions & 4 deletions cookbook/contract-build-meta.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
title: Add meta data to contract WASM on build
hide_table_of_contents: true
description: Include meta data in the contract WASM byte code on build
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/contract-build-meta.mdx
---

To build a smart contract, use the `stellar contract build` command. The `--meta` option will allow you to add additional meta data entries to the `contractmetav0` custom section of the resulting WASM file at build time.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
export SHA=$(git rev-parse HEAD)
```

Expand All @@ -25,7 +23,7 @@ stellar contract info meta \
--wasm target/wasm32v1-none/release/test_hello_world.wasm
```

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
Contract meta:
• rsver: 1.91.0 (Rust version)
• rssdkver: 23.0.1#510d3feb724c2b01d7e7ab7652f03b9f8efc3f35 (Soroban SDK version and its commit hash)
Expand Down
32 changes: 15 additions & 17 deletions cookbook/contract-invoke-arguments.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: "Contract Invoke: Argument Types"
hide_table_of_contents: true
description: How to pass each argument type when invoking a Stellar smart contract using the CLI
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/contract-invoke-arguments.mdx
---

When using `stellar contract invoke`, each `--arg-name <value>` flag is parsed according to the contract's type spec. This guide shows the correct format for each supported type.
Expand All @@ -11,7 +9,7 @@ When using `stellar contract invoke`, each `--arg-name <value>` flag is parsed a

Pass bare numeric literals directly on the command line.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--count 42 \
--offset -7
Expand All @@ -21,7 +19,7 @@ stellar contract invoke --id mycontract -- my_function \

Pass bare numeric literals, just like small integers. The CLI reads the raw value as a string internally, bypassing JSON number precision limits entirely.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--amount 340282366920938463463374607431768211455
```
Expand All @@ -30,7 +28,7 @@ stellar contract invoke --id mycontract -- my_function \

Pass `true` or `false` as unquoted literals.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--is_active true \
--is_paused false
Expand All @@ -40,7 +38,7 @@ stellar contract invoke --id mycontract -- my_function \

Bare words work for simple strings. Numbers and booleans are also accepted and are automatically converted to their string representation, so you do not need to add extra quoting. Explicit JSON quoting is also accepted.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
# Bare word
stellar contract invoke --id mycontract -- my_function \
--label hello
Expand All @@ -62,7 +60,7 @@ stellar contract invoke --id mycontract -- my_function \

Symbols follow the same rules as `String`: bare words, numbers, and booleans are all accepted, and non-string JSON values are auto-converted.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--status active
```
Expand All @@ -71,7 +69,7 @@ stellar contract invoke --id mycontract -- my_function \

You can pass either a locally known identity name (e.g. `alice`) or a raw Stellar strkey (`G…` for accounts, `C…` for contracts).

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
# Using an identity alias
stellar contract invoke --id mycontract -- my_function \
--owner alice
Expand All @@ -85,7 +83,7 @@ stellar contract invoke --id mycontract -- my_function \

Pass a hex-encoded string representing the byte sequence.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--hash "deadbeef01020304"
```
Expand All @@ -94,7 +92,7 @@ stellar contract invoke --id mycontract -- my_function \

Simply omit the flag. The CLI will supply a `void` / null value for any `Option<T>` parameter that is not provided.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
# If `--memo` is optional, leaving it out passes None
stellar contract invoke --id mycontract -- my_function \
--amount 100
Expand All @@ -104,7 +102,7 @@ stellar contract invoke --id mycontract -- my_function \

Pass a JSON array, quoting the whole value so the shell does not split it.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--recipients '["alice", "bob", "carol"]'
```
Expand All @@ -113,7 +111,7 @@ stellar contract invoke --id mycontract -- my_function \

Pass a JSON object with string keys.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--metadata '{"key": "value", "version": "1"}'
```
Expand All @@ -122,7 +120,7 @@ stellar contract invoke --id mycontract -- my_function \

Pass a JSON array whose elements match the tuple's field order.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--point '[10, 20]'
```
Expand All @@ -131,7 +129,7 @@ stellar contract invoke --id mycontract -- my_function \

Pass a JSON object with the struct's named fields.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--config '{"max_supply": "1000000", "decimals": 7}'
```
Expand All @@ -140,7 +138,7 @@ stellar contract invoke --id mycontract -- my_function \

For unit variants, pass the variant name as a plain string. For variants that carry a value, pass a JSON object with the variant name as the key.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
# Unit variant
stellar contract invoke --id mycontract -- my_function \
--status "Active"
Expand All @@ -154,7 +152,7 @@ stellar contract invoke --id mycontract -- my_function \

For long or complex JSON values, use the `--arg-file-path` flag variant to load the value from a file instead of inlining it on the command line. The flag name is derived from the argument name by appending `-file-path`.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
# Write the JSON to a file first
echo '{"max_supply": "1000000", "decimals": 7}' > config.json

Expand All @@ -165,7 +163,7 @@ stellar contract invoke --id mycontract -- my_function \

For `Bytes` and `BytesN` parameters, the file's raw binary content is read directly — no hex encoding is required.

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract invoke --id mycontract -- my_function \
--hash-file-path /path/to/binary.bin
```
6 changes: 2 additions & 4 deletions cookbook/contract-lifecycle.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
title: Contract Lifecycle
hide_table_of_contents: true
description: Manage the lifecycle of a Stellar smart contract using the CLI
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/contract-lifecycle.mdx
---

To manage the lifecycle of a Stellar smart contract using the CLI, follow these steps:

1. Set your preferred network. For this guide, we will use `testnet`. A list of available networks can be found [here](../../../networks/README.mdx)
1. Set your preferred network. For this guide, we will use `testnet`. A list of available networks can be found [here](/docs/networks)

```bash
stellar network use testnet
Expand Down Expand Up @@ -41,7 +39,7 @@ This will display the resulting contract ID, e.g.:
CBB65ZLBQBZL5IYHDHEEPCVUUMFOQUZSQKAJFV36R7TZETCLWGFTRLOQ
```

To learn more about how to build contract `.wasm` files, take a look at our [getting started tutorial](../../../build/smart-contracts/getting-started/setup.mdx).
To learn more about how to build contract `.wasm` files, take a look at our [getting started tutorial](/docs/build/smart-contracts/getting-started/setup).

5. Invoke a contract function:

Expand Down
6 changes: 2 additions & 4 deletions cookbook/deploy-contract.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Deploy a contract from uploaded Wasm bytecode
hide_table_of_contents: true
description: Deploy an instance of a compiled contract that has already been uploaded on the network
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/deploy-contract.mdx
---

To deploy an instance of a compiled smart contract that has already been uploaded onto the Stellar network, use the `stellar contract deploy` command:
Expand All @@ -15,8 +13,8 @@ stellar contract deploy \
--alias <alias>
```

:::tip
<Tip>

Optionally assign an alias by replacing `<alias>` with your desired alias name for the contract. The alias is a locally stored mapping to the contract address, and can be used in other stellar-cli commands in place of the address.

:::
</Tip>
10 changes: 4 additions & 6 deletions cookbook/deploy-stellar-asset-contract.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Deploy the Stellar Asset Contract for a Stellar asset
hide_table_of_contents: true
description: Deploy an SAC for a Stellar asset so that it can interact with smart contracts
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/deploy-stellar-asset-contract.mdx
---

The Stellar CLI can deploy a [Stellar Asset Contract] for a Stellar asset so that any Stellar smart contract can interact with the asset.
Expand All @@ -15,7 +13,7 @@ The Stellar Asset Contract can be deployed for any possible Stellar asset, eithe

To perform the deploy, use the following command:

```bash cookbooktest.ignore
```bash cookbooktest.ignore=""
stellar contract asset deploy \
--source S... \
--network testnet \
Expand All @@ -26,18 +24,18 @@ The `asset` argument corresponds to the symbol and it's issuer address, which is

The same can be done for the native [Lumens] asset:

```bash cookbooktest.fail cookbooktest.stderr="contract already exists"
```bash cookbooktest.fail="" cookbooktest.stderr="contract already exists"
stellar contract asset deploy \
--source S... \
--network testnet \
--asset native
```

:::note
<Note>

Deploying the native asset will fail on testnet or mainnet as a Stellar Asset Contract already exists.

:::
</Note>

For any asset, the contract address can be fetched with:

Expand Down
2 changes: 0 additions & 2 deletions cookbook/extend-contract-instance.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Extend a deployed contract instance's TTL
hide_table_of_contents: true
description: Use the CLI to extend the time to live (TTL) of a contract instance
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/extend-contract-instance.mdx
---

You can use the Stellar CLI to extend the TTL of a contract instance like so:
Expand Down
8 changes: 3 additions & 5 deletions cookbook/extend-contract-storage.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Extend a deployed contract's storage entry TTL
hide_table_of_contents: true
description: Use the CLI to extend the time to live (TTL) of a contract's persistent storage entry
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/extend-contract-storage.mdx
---

You can use the Stellar CLI to extend the TTL of a contract's persistent storage entry. For a storage entry that uses a simple `Symbol` as its storage key, you can run a command like so:
Expand Down Expand Up @@ -31,8 +29,8 @@ stellar contract extend \
--durability persistent
```

:::info
<Info>

Be sure to check out our [guide on creating XDR ledger keys](../../../build/guides/rpc/generate-ledger-keys-python.mdx) for help generating them.
Be sure to check out our [guide on creating XDR ledger keys](/docs/build/guides/rpc/generate-ledger-keys-python) for help generating them.

:::
</Info>
8 changes: 3 additions & 5 deletions cookbook/extend-contract-wasm.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Extend a deployed contract's Wasm code TTL
hide_table_of_contents: true
description: Use Stellar CLI to extend contract's Wasm bytecode TTL, with or without local binary
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/extend-contract-wasm.mdx
---

You can use the Stellar CLI to extend the TTL of a contract's Wasm bytecode. This can be done in two forms: if you do or do not have the compiled contract locally. If you do have the compiled binary on your local machine:
Expand All @@ -29,8 +27,8 @@ stellar contract extend \
--durability persistent
```

:::info
<Info>

You can learn more about finding the correct Wasm hash for a contract instance [here (JavaScript)](../../../build/guides/rpc/retrieve-contract-code-js.mdx) and [here (Python)](../../../build/guides/rpc/retrieve-contract-code-python.mdx).
You can learn more about finding the correct Wasm hash for a contract instance [here (JavaScript)](/docs/build/guides/rpc/retrieve-contract-code-js) and [here (Python)](/docs/build/guides/rpc/retrieve-contract-code-python).

:::
</Info>
6 changes: 2 additions & 4 deletions cookbook/payments-and-assets.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
title: Payments and Assets
hide_table_of_contents: true
description: Send XLM, stellar classic, or a soroban asset using the Stellar CLI
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/payments-and-assets.mdx
---

To send payments and work with assets using the Stellar CLI, follow these steps:

1. Set your preferred network. For this guide, we will use `testnet`. A list of available networks can be found [here](../../../networks/README.mdx)
1. Set your preferred network. For this guide, we will use `testnet`. A list of available networks can be found [here](/docs/networks)

```bash
stellar network use testnet
Expand Down Expand Up @@ -59,4 +57,4 @@ stellar contract invoke --id <ASSET_CONTRACT_ID> -- transfer --to bob --from ali
stellar contract invoke --id <ASSET_CONTRACT_ID> -- balance --id bob
```

For more information on the functions available to the stellar asset contract, see the [token interface code](../../../tokens/token-interface.mdx#code)
For more information on the functions available to the stellar asset contract, see the [token interface code](/docs/tokens/token-interface#code)
2 changes: 0 additions & 2 deletions cookbook/restore-contract-instance.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Restore an archived contract using the Stellar CLI
hide_table_of_contents: true
description: Restore an archived contract instance using the Stellar CLI
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/restore-contract-instance.mdx
---

If your contract instance has been archived, it can easily be restored using the Stellar CLI.
Expand Down
8 changes: 3 additions & 5 deletions cookbook/restore-contract-storage.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
title: Restore archived contract data using the Stellar CLI
hide_table_of_contents: true
description: Restore archived contract storage entries using Stellar CLI
custom_edit_url: https://github.com/stellar/stellar-cli/edit/main/cookbook/restore-contract-storage.mdx
---

If a contract's persistent storage entry has been archived, you can restore it using the Stellar CLI. For a storage entry that uses a simple `Symbol` as its storage key, you can run a command like so:
Expand All @@ -27,8 +25,8 @@ stellar contract restore \
--durability persistent
```

:::info
<Info>

Be sure to check out our [guide on creating XDR ledger keys](../../../build/guides/rpc/generate-ledger-keys-python.mdx) for help generating them.
Be sure to check out our [guide on creating XDR ledger keys](/docs/build/guides/rpc/generate-ledger-keys-python) for help generating them.

:::
</Info>
Loading
Loading