Skip to content

Commit

Permalink
Deprecate contract install in favor of contract upload. (#1850)
Browse files Browse the repository at this point in the history
  • Loading branch information
fnando authored Jan 28, 2025
1 parent 4d76a25 commit 9b0e523
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
35 changes: 33 additions & 2 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ Tools for smart contract developers
* `id` — Generate the contract id for a given contract or asset
* `info` — Access info about contracts
* `init` — Initialize a Soroban contract project
* `inspect` — (Deprecated in favor of `contract info` subcommands) Inspect a WASM file listing contract functions, meta, etc
* `inspect` — (Deprecated in favor of `contract info` subcommand) Inspect a WASM file listing contract functions, meta, etc
* `upload` — Install a WASM file to the ledger without creating a contract instance
* `install` — (Deprecated in favor of `contract upload` subcommand) Install a WASM file to the ledger without creating a contract instance
* `invoke` — Invoke a contract function
* `optimize` — Optimize a WASM file
* `read` — Print the current value of a contract-data ledger entry
Expand Down Expand Up @@ -661,7 +662,7 @@ This command will create a Cargo workspace project and add a sample Stellar cont

## `stellar contract inspect`

(Deprecated in favor of `contract info` subcommands) Inspect a WASM file listing contract functions, meta, etc
(Deprecated in favor of `contract info` subcommand) Inspect a WASM file listing contract functions, meta, etc

**Usage:** `stellar contract inspect [OPTIONS] --wasm <WASM>`

Expand Down Expand Up @@ -715,6 +716,36 @@ Install a WASM file to the ledger without creating a contract instance



## `stellar contract install`

(Deprecated in favor of `contract upload` subcommand) Install a WASM file to the ledger without creating a contract instance

**Usage:** `stellar contract install [OPTIONS] --source-account <SOURCE_ACCOUNT> --wasm <WASM>`

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

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADERS>` — RPC Header(s) to include in requests to the RPC provider
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail
* `--hd-path <HD_PATH>` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0`
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--fee <FEE>` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm

Default value: `100`
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--wasm <WASM>` — Path to wasm binary
* `-i`, `--ignore-checks` — Whether to ignore safety checks when deploying contracts

Default value: `false`



## `stellar contract invoke`

Invoke a contract function
Expand Down
16 changes: 12 additions & 4 deletions cmd/soroban-cli/src/commands/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod read;
pub mod restore;
pub mod upload;

use crate::commands::global;
use crate::{commands::global, print::Print};

#[derive(Debug, clap::Subcommand)]
pub enum Cmd {
Expand Down Expand Up @@ -61,14 +61,16 @@ pub enum Cmd {
/// be overwritten unless `--overwrite` is passed.
Init(init::Cmd),

/// (Deprecated in favor of `contract info` subcommands) Inspect a WASM file listing contract functions, meta, etc
/// (Deprecated in favor of `contract info` subcommand) Inspect a WASM file listing contract functions, meta, etc
#[command(display_order = 100)]
Inspect(inspect::Cmd),

/// Install a WASM file to the ledger without creating a contract instance
#[command(visible_alias = "install")]
Upload(upload::Cmd),

/// (Deprecated in favor of `contract upload` subcommand) Install a WASM file to the ledger without creating a contract instance
Install(upload::Cmd),

/// Invoke a contract function
///
/// Generates an "implicit CLI" for the specified contract on-the-fly using the contract's
Expand Down Expand Up @@ -144,6 +146,8 @@ pub enum Error {

impl Cmd {
pub async fn run(&self, global_args: &global::Args) -> Result<(), Error> {
let print = Print::new(global_args.quiet);

match &self {
Cmd::Asset(asset) => asset.run(global_args).await?,
Cmd::Bindings(bindings) => bindings.run().await?,
Expand All @@ -155,7 +159,11 @@ impl Cmd {
Cmd::Info(info) => info.run(global_args).await?,
Cmd::Init(init) => init.run(global_args)?,
Cmd::Inspect(inspect) => inspect.run(global_args)?,
Cmd::Upload(install) => install.run(global_args).await?,
Cmd::Install(install) => {
print.warnln("`stellar contract install` has been deprecated in favor of `stellar contract upload`");
install.run(global_args).await?;
}
Cmd::Upload(upload) => upload.run(global_args).await?,
Cmd::Invoke(invoke) => invoke.run(global_args).await?,
Cmd::Optimize(optimize) => optimize.run()?,
Cmd::Fetch(fetch) => fetch.run().await?,
Expand Down

0 comments on commit 9b0e523

Please sign in to comment.