Skip to content

Commit

Permalink
cli: fix docs and path check validation for stronghold migration (#672)
Browse files Browse the repository at this point in the history
* fix: add additional error when migrating stronghold v2-v3

* fix: make file exists verification first

* docs: fixes

* docs: participation-overview

* docs: step-by-step

* Update documentation/cli/docs/03-account.md

---------

Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
qrayven and thibault-martinez authored Jun 23, 2023
1 parent 8d61a34 commit c7b37f4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
13 changes: 5 additions & 8 deletions cli/src/command/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,12 @@ pub async fn init_command(
}

pub async fn migrate_stronghold_snapshot_v2_to_v3_command(path: Option<String>) -> Result<(), Error> {
let snapshot_path = path.as_deref().unwrap_or(DEFAULT_STRONGHOLD_SNAPSHOT_PATH);
check_file_exists(snapshot_path.as_ref()).await?;

let password = get_password("Stronghold password", false)?;
StrongholdAdapter::migrate_snapshot_v2_to_v3(
path.as_deref().unwrap_or(DEFAULT_STRONGHOLD_SNAPSHOT_PATH),
password,
"wallet.rs",
100,
None,
None,
)?;
StrongholdAdapter::migrate_snapshot_v2_to_v3(snapshot_path, password, "wallet.rs", 100, None, None)?;

println_log_info!("Stronghold snapshot successfully migrated from v2 to v3.");

Ok(())
Expand Down
34 changes: 21 additions & 13 deletions documentation/cli/docs/03-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Prints the account balance.

#### Parameters

| Name | Optional | Default | Example |
| ----------- | --------- | ------- | --------------------------------------------------------------- |
| `addresses` || N/A | rms1qztwng6cty8cfm42nzvq099ev7udhrnk0rw8jt8vttf9kpqnxhpsx869vr3 |
| Name | Optional | Default | Example |
| ----------- | --------- | -------------------------------------- | --------------------------------------------------------------- |
| `addresses` || All addresses belonging to the account | rms1qztwng6cty8cfm42nzvq099ev7udhrnk0rw8jt8vttf9kpqnxhpsx869vr3 |

#### Examples

Expand Down Expand Up @@ -82,9 +82,9 @@ Tries to claim outputs with storage deposit return, expiration or timelock unloc

#### Parameters

| Name | Optional | Default | Example |
| ----------- | --------- | ------- | ---------------------------------------------------------------------- |
| `output_id` || N/A | 0xd5dff9ee869dfa7796d5132b220cb5c00146c36abba27d3562e2d726decb50850000 |
| Name | Optional | Default | Example |
| ----------- | --------- | --------------------- | ---------------------------------------------------------------------- |
| `output_id` || All claimable outputs | 0xd5dff9ee869dfa7796d5132b220cb5c00146c36abba27d3562e2d726decb50850000 |

#### Examples

Expand Down Expand Up @@ -230,7 +230,7 @@ Requests funds from a faucet.
| Name | Optional | Default | Example |
| --------- | --------- | -----------------------------------------------------| ------------------------------------------------------------------|
| `address` || The latest address of the account | rms1qztwng6cty8cfm42nzvq099ev7udhrnk0rw8jt8vttf9kpqnxhpsx869vr3 |
| `url` || <https://faucet.testnet.shimmer.network/api/enqueue> | <http://localhost:8091/api/enqueue> |
| `url` || https://faucet.testnet.shimmer.network/api/enqueue | http://localhost:8091/api/enqueue |

#### Examples

Expand Down Expand Up @@ -429,9 +429,9 @@ Calculates the participation overview of the account.

#### Parameters

| Name | Optional | Default | Example |
| ----------- | --------- | ------- | ------------------------------------------------------------------ |
| `event_ids` || N/A | 0x8d6ffcd8d6c9f049b5732adb8900bb6f6a28e282b15a2297405a28181eebd515 |
| Name | Optional | Default | Example |
| ----------- | --------- | ------------------------------------------- | ------------------------------------------------------------------ |
| `event_ids` || All participation event ids for the account | 0x8d6ffcd8d6c9f049b5732adb8900bb6f6a28e282b15a2297405a28181eebd515 |

#### Example

Expand Down Expand Up @@ -561,16 +561,24 @@ Lists all account transactions.

#### Parameters

| Name | Optional | Default | Example |
| -------------------| --------- | ------- | ------------------------------------------------------------------------------- |
| `show_details` || false | true |
| Name | Optional | Default | Example |
| -------------------| --------- | ------- | -------- |
| `show_details` || false | true |

#### Example

List all transactions.

```sh
> Account "main": transactions
```

List all transactions with details.

```sh
> Account "main": transactions --show-details
```

### `unspent-outputs`

Displays all unspent outputs that are stored in the account.
Expand Down
12 changes: 6 additions & 6 deletions documentation/cli/docs/04-step-by-step.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It is advised to do them all at least once in the given order to understand the

Initialize the wallet with a given node and a randomly generated mnemonic.
```sh title=Input
./wallet init --node <NODE_API_URL>
./wallet init --node-url <NODE_API_URL>
```
```sh title=Output
> INFO Mnemonic stored successfully
Expand Down Expand Up @@ -69,7 +69,7 @@ Enter the "main" account and send some amount to the "savings" address.
```
```sh title=Output
> INFO Transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand All @@ -96,7 +96,7 @@ Enter the "main" account and mint native tokens with foundry metadata.

```sh title=Output
> INFO Native token minting transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand Down Expand Up @@ -128,7 +128,7 @@ Send native tokens from the "main" account to the new "savings" address.
```
```sh title=Output
> INFO Native token transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand All @@ -144,7 +144,7 @@ Enter the "main" account and mint an NFT.
```
```sh title=Output
> INFO NFT minting transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand Down Expand Up @@ -177,7 +177,7 @@ Send the NFT to the new "savings" address.
```
```sh title=Output
> INFO Nft transaction sent:
> transaction id: 0x...
> TransactionId(0x...)
> Some(BlockId(0x...))
```

Expand Down

0 comments on commit c7b37f4

Please sign in to comment.