# Changelog

List of changelogs ordered from latest to oldest


## [0.4.3-RC2] - 2025-06-13
### Added / Changed
- Added support of `json` output for most commands through the usage of the global `-o`/ `--output-format` argument (to be given before any command).
  - The default output remains the `human` format.
- Added possibility to use `vault inspect` command without interactive prompts (when providing all necessary arguments)
- Added possibility to use `vault remove` command without interactive prompts (added `--force` argument in case there were derivation accounts linked) and support for `json` output format
- Added specific json serialization in case of error (for commands supporting `json` output)
  - example when not providing enough arguments when using `json` output for `vault remove`:
    ```shell
    gcli -o json vault remove -v predef-ed | jq
    ```

    ```json
    {
      "error_type": "Input",
      "error": "Cannot delete an account with derivations without using --force"
    }
    ```
  - example using an incorrect vault name with `vault inspect` command:
    ```shell
    gcli -o json vault inspect -v predef-sr//Aliceaze --no-password | jq
    ```

    ```json
    {
      "error_type": "Input",
      "error": "No account found with name:'predef-sr' and path:'//Aliceaze'"
    }
    ```
  - example when using an incorrect duniter websocket RPC endpoint _url_ with `identity show` command:
    ```shell
    gcli -o json --url=badurl identity show | jq
    ```

    ```json
    {
      "error_type": "Duniter",
      "error": "can not connect to duniter badurl"
    }
    ```
    Specifically for this kind of error, to get more details, you can run gcli commands with a specific log level below *error* (which is the default).
    ```shell
    RUST_LOG=warn gcli -o json --url=badurl identity show | jq
    [2025-06-13T15:50:46Z WARN  gcli::data] [src/data.rs:239] Rpc(ClientError(RelativeUrlWithoutBase))
    {
      "error_type": "Duniter",
      "error": "can not connect to duniter badurl"
    }
    ```
    
    Please note that those logs are written to _stderr_ and not _stdout_; which is why jq command is not impacted in this case.

- Added proper error json output for `account balance` command
- To have a clean `json` output; those commands should be called with all necessary arguments so that no interactive prompt is required; which then allows to pipe the result to other commands like `jq`
  - Example usage:
    ```shell
    gcli -o json vault inspect -v predef-sr//Alice --no-password | jq 
    {
      "substrate_uri": "bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice",
      "crypto_scheme": "sr25519",
      "secret_seed": "e5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a",
      "public_key_hex": "d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
      "ss58_address": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
      "g1v1_public_key": null
    }
    ```

### Fixed
- None

### Deprecated
- Two commands are still deprecated and will be removed in a future release:
    - `gcli vault list-files`
    - `gcli vault migrate`

### Removed
- None

### CI/CD
- None


## [0.4.2] - 2025-05-16
### Added / Changed
- Extra command `completion` added which takes a `--shell` argument to generate a completions script for a specified shell.
  - Calling this command with `gcli completion --help` will provide detailed instructions to generate the completion script and register it for your shell (not necessary when using the `.deb` package that include and registers the completion scripts for `bash`, `zsh` and `fish`)

### CI/CD
- Adapted the Linux (amd64) build to:
  - generate the `gcli-completion.bash`, `gcli-completion.zsh`, `gcli-completion.fish`, `gcli-completion.ps1` completion scripts
  - add the `bash`, `zsh` and `fish` completion scripts in the `.deb` package
- Added the ARM64 build generating a binary and a `.deb` package that also include those completion scripts.

### Fixed
- None

### Deprecated
- Two commands are still deprecated and will be removed in a future release:
  - `gcli vault list-files`
  - `gcli vault migrate`

### Removed
- None


## [0.4.1] - 2025-04-08
### Added / Changed
- We now use `ed25519` crypto scheme by default for all commands.  It means that if you import your substrate mnemonic without giving a specific argument to change the crypto scheme, the resulting SS58 address will not be the same as before (it was using `sr25519` for substrate mnemonic previously)
  - Extra `-c` / `--crypto-scheme` argument allows to specify which crypto scheme to use (`sr25519` or `ed25519`) and having a default value of `ed25519` in most places.
    - this argument is present in all places where you could provide `-S` / `--secret-format` argument
  - Due to that change, the display of the vault (`vault list ...` commands) will not display the g1v1 public key of all `ed25519` \<Base\> keys by default anymore; you will have to provide an extra `--show-g1v1` argument for that.
  - Another impact is that we can now `vault derive` any key; including the ones with `ed25519` crypto-scheme.
    - It is still highly recommended to **only derive** keys based on a **substrate mnemonic**; as old `g1v1` keys with their _manual_ `id` & `secret` are not as secure as using a generated substrate mnemonic.
  - There is an exception to the impacted commands: `vault migrate` will still import old key files as `sr25519` crypto-scheme keys; as it would otherwise not correspond to the SS58 Address of those key files.
- It is now possible to perform `vault import` and `vault derive` commands without interactive prompts if all necessary optional arguments are provided.
  - Please check for more details with commands:
    - `vault import --help`
    - `vault derive --help`
  - If the command tries to override an existing vault entry, then it will still require manual input from the user!
- Adapted commands `identity link-account` and `identity change-owner-key`
  - Made it clear that the arguments are meant to "target" another account
  - Added possibility to provide the "target" account from the vault
    - `-a` SS58 Address of target vault account
    - `-v` Name of target vault account
  - `-S` (secret_format) doesn't have a default anymore since it conflicts with using `-a` or `-v`
- Adapted `vault inspect` command to display more information
  - Substrate URI (was already present)
  - Crypto scheme: to be more coherent since both the `substrate uri` and `crypto-scheme` are needed to create the key with the proper `address`
  - Secret seed/mini-secret: only computed if no `soft` (single '/') derivation are used
  - Public key (hex)
  - SS58 Address
  - (potential G1v1 public key if inspecting a \<Base\> account with ed25519 crypto-scheme)
- Small changes
  - In the vault, changed sorting of children account so that they are sorted by derivation `Path` value (makes more sense when viewing derivations of one account)

### Fixed
- None

### Deprecated
- Two commands are still deprecated and will be removed in a future release:
    - `gcli vault list-files`
    - `gcli vault migrate`

### Removed
- None

### CI/CD
- None


## [0.4.0] - 2025-02-xx
### Changed
- Old key files cannot be used directly anymore, they have to be migrated to the SQLite file database.  You can use the following commands for that:
    - `gcli vault list-files` lists _old_ key files from previous versions
    - `gcli vault migrate` which allows to migrate _old_ key files into the vault database
- Some arguments and commands were adapted
    - Arguments
        - **SecretFormat** (`-S`): _cesium_ was renamed to _g1v1_ - but it will still work properly if using _cesium_
        - Several arguments were renamed for clarity.  Examples:
          - `<TARGET>` => `<USERNAME>`
          - `<ACCOUNT_ID>` => `<ADDRESS>`
    - Commands
        - `gcli vault import` now has an optional **SecretFormat** `-S` argument with _substrate_ as default value
            - It is now possible to import _substrate_ URI, _seed_, _g1v1_ id/secret (old "cesium") keys into the vault.
        - `gcli vault list` now has sub-commands and only shows Addresses from the SQLite file database

### Added
- Support for SQLite file database to persist vault data
- global `-v <NAME>` argument to select a vault Address by name (mutually exclusive with `-a <ADDRESS>` argument)
- Already mentioned in the "Changed" section above, but it is now possible to add different kind of keys to the vault when doing `vault import`
  - Default providing _substrate_ URI (or `-S substrate`): can be a mnemonic or a mini-secret ('0x' prefixed seed) together with optional derivation path; using Sr25519 crypto scheme
  - `-S seed`: using the 32 character hexadecimal secret seed; using Sr25519 crypto scheme
  - `-S g1v1` (or `-S cesium`): allows to input G1v1 `id` and `secret`; using Ed25519 crypto scheme
- Added possibility to `derive` non _g1v1_/_cesium_ Addresses (see `gcli vault derive`)
- Some commands were added
  - `gcli vault list all` List all \<Base\> SS58 Addresses and their linked derivations in the vault
  - `gcli vault list for` List \<Base\> and Derivation SS58 Addresses linked to the selected one
  - `gcli vault list base` List all \<Base\> SS58 Addresses in the vault
  - `gcli vault use` Use specific SS58 Address (changes the config Address)
  - `gcli vault derive` Add a derivation to an existing SS58 Address
  - `gcli vault rename` Give a meaningful name to an SS58 Address in the vault
  - `gcli vault remove` Remove an SS58 Address from the vault together with its linked derivations
  - `gcli vault inspect` Inspect a vault entry, retrieving its Substrate URI (will provide more data in a future version)
  - `gcli vault list-files` (deprecated) List available key files (needs to be migrated with command `vault migrate` in order to use them)
  - `gcli vault migrate` (deprecated) Migrate old key files into db (will have to provide password for each key)

### Fixed
- None

### Deprecated
- Two commands are now deprecated and will be removed in a future release
  - `gcli vault list-files`
  - `gcli vault migrate`

### Removed
- None

### CI/CD
- #45, !42:
  - In linux build job, switch to "non-slim" Debian image which provides `libssl-dev` now required
  - Introduce linux tests job (#46)
- !38: Build deb and macos pkgs in parallel

## [0.3.0] - 2024-10-10
### Added
- Previous version without changelog