Skip to content

Commit

Permalink
chore(CLI): remove all references to expire and use ttl (stellar#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal authored Oct 23, 2023
1 parent b2229a3 commit 58aad79
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
12 changes: 6 additions & 6 deletions cmd/soroban-cli/src/commands/contract/extend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub struct Cmd {
/// Number of ledgers to extend the entries
#[arg(long, required = true)]
pub ledgers_to_extend: u32,
/// Only print the new TTL ledger
/// Only print the new Time To Live ledger
#[arg(long)]
pub extension_ledger_only: bool,
pub ttl_ledger_only: bool,
#[command(flatten)]
pub key: key::Args,
#[command(flatten)]
Expand Down Expand Up @@ -80,11 +80,11 @@ pub enum Error {
impl Cmd {
#[allow(clippy::too_many_lines)]
pub async fn run(&self) -> Result<(), Error> {
let expiration_ledger_seq = self.run_against_rpc_server().await?;
if self.extension_ledger_only {
println!("{expiration_ledger_seq}");
let ttl_ledger = self.run_against_rpc_server().await?;
if self.ttl_ledger_only {
println!("{ttl_ledger}");
} else {
println!("New ttl ledger: {expiration_ledger_seq}");
println!("New ttl ledger: {ttl_ledger}");
}

Ok(())
Expand Down
1 change: 1 addition & 0 deletions cmd/soroban-cli/src/commands/contract/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl Cmd {
config: self.config.clone(),
fee: self.fee.clone(),
ledgers_to_extend: None,
ttl_ledger_only: true,
}
.run_against_rpc_server()
.await?;
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub enum Cmd {

Build(build::Cmd),

/// Extend the expiry ledger of a contract-data ledger entry.
/// Extend the time to live ledger of a contract-data ledger entry.
///
/// If no keys are specified the contract itself is extended.
Extend(extend::Cmd),
Expand Down
5 changes: 4 additions & 1 deletion cmd/soroban-cli/src/commands/contract/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ pub struct Cmd {
/// Number of ledgers to extend the entry
#[arg(long)]
pub ledgers_to_extend: Option<u32>,
/// Only print the new Time To Live ledger
#[arg(long)]
pub ttl_ledger_only: bool,
#[command(flatten)]
pub config: config::Args,
#[command(flatten)]
Expand Down Expand Up @@ -92,7 +95,7 @@ impl Cmd {
ledgers_to_extend,
config: self.config.clone(),
fee: self.fee.clone(),
extension_ledger_only: false,
ttl_ledger_only: false,
}
.run()
.await?;
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func extend(t *testing.T, contractId string, amount string, rest string) uint64
res := runSuccessfulCLICmd(
t,
fmt.Sprintf(
"contract extend --extension-ledger-only --id=%s --durability persistent --ledgers-to-extend=%s %s",
"contract extend --ttl-ledger-only --id=%s --durability persistent --ledgers-to-extend=%s %s",
contractId,
amount,
rest,
Expand Down
7 changes: 4 additions & 3 deletions docs/soroban-cli-full-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Tools for smart contract developers

* `bindings` — Generate code client bindings for a contract
* `build` — Build a contract from source
* `extend` — Extend the expiry ledger of a contract-data ledger entry
* `extend` — Extend the time to live ledger of a contract-data ledger entry
* `deploy` — Deploy a contract
* `fetch` — Fetch a contract's Wasm binary
* `inspect` — Inspect a WASM file listing contract functions, meta, etc
Expand Down Expand Up @@ -226,7 +226,7 @@ To view the commands that will be executed, without executing them, use the --pr

## `soroban contract extend`

Extend the expiry ledger of a contract-data ledger entry.
Extend the time to live ledger of a contract-data ledger entry.

If no keys are specified the contract itself is extended.

Expand All @@ -235,7 +235,7 @@ If no keys are specified the contract itself is extended.
###### **Options:**

* `--ledgers-to-extend <LEDGERS_TO_EXTEND>` — Number of ledgers to extend the entries
* `--extension-ledger-only` — Only print the new TTL ledger
* `--ttl-ledger-only` — Only print the new Time To Live ledger
* `--id <CONTRACT_ID>` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be extended
* `--key <KEY>` — Storage key (symbols only)
* `--key-xdr <KEY_XDR>` — Storage key (base64-encoded XDR)
Expand Down Expand Up @@ -463,6 +463,7 @@ If no keys are specificed the contract itself is restored.
Temporary

* `--ledgers-to-extend <LEDGERS_TO_EXTEND>` — Number of ledgers to extend the entry
* `--ttl-ledger-only` — Only print the new Time To Live ledger
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand Down

0 comments on commit 58aad79

Please sign in to comment.