From 55bdba2a9c3b32fabad42a9582dd7024d084ab30 Mon Sep 17 00:00:00 2001 From: Johnny <9611008+johnnymatthews@users.noreply.github.com> Date: Wed, 6 Nov 2024 20:49:00 -0400 Subject: [PATCH] Updates Docs for Core 0.3.0 Release. (#250) * Updates CLI to use `entropy tui`. (#249) * Updates required node version. --- content/basics/quickstart.md | 4 +- content/guides/deploy-a-program.md | 4 +- content/guides/manage-accounts.md | 4 +- content/guides/register-an-account.md | 2 +- content/reference/command-line-interface.md | 296 +++++++++++--------- 5 files changed, 163 insertions(+), 147 deletions(-) diff --git a/content/basics/quickstart.md b/content/basics/quickstart.md index 389f382f..85c1176f 100644 --- a/content/basics/quickstart.md +++ b/content/basics/quickstart.md @@ -33,10 +33,10 @@ The command-line interface (CLI) is the most straightforward way to interact wit npm install --global @entropyxyz/cli ``` -1. Run the CLI using `entropy`: +1. Run the CLI using `entropy tui`: ```shell - entropy + entropy tui ``` ```output diff --git a/content/guides/deploy-a-program.md b/content/guides/deploy-a-program.md index 029638c9..c7b0a9b7 100644 --- a/content/guides/deploy-a-program.md +++ b/content/guides/deploy-a-program.md @@ -19,7 +19,7 @@ Next, you can move on to starting the CLI and deploying your program. ### Deploy the program -1. Start the CLI by running `entropy`. +1. Start the CLI by running `entropy tui`. 1. At the main menu within the CLI, select **Deploy Program**: ```output @@ -50,7 +50,7 @@ You can now interact with your program using the program pointer. If you've lost your program pointer, you can list it by running the following: -1. Start the CLI by running `entropy`. +1. Start the CLI by running `entropy tui`. 1. At the main menu within the CLI, select **Deploy Program**: ```output diff --git a/content/guides/manage-accounts.md b/content/guides/manage-accounts.md index 4f5616ab..64a8ff25 100644 --- a/content/guides/manage-accounts.md +++ b/content/guides/manage-accounts.md @@ -11,7 +11,7 @@ You need to have the Entropy CLI installed. [Take a look at the CLI page for det ### Create an account -1. Start the CLI by running `entropy`. +1. Start the CLI by running `entropy tui`. 1. Select **Manage Accounts**. 1. Select **New**. 1. Type `n` and press `ENTER` when asked _Would you like to import a key?_: @@ -36,7 +36,7 @@ You need to have the Entropy CLI installed. [Take a look at the CLI page for det You can import an account by the `seed` for the account. Most Substrate-based wallets allow you to export your account information. -1. Start the CLI by running `entropy`. +1. Start the CLI by running `entropy tui`. 1. Select **Manage Accounts**. 1. Select **New**. 1. Type `y` and press `ENTER` when asked _Would you like to import a key?_: diff --git a/content/guides/register-an-account.md b/content/guides/register-an-account.md index 9c0adb10..913bcc92 100644 --- a/content/guides/register-an-account.md +++ b/content/guides/register-an-account.md @@ -7,7 +7,7 @@ lead: "Registering an account is a feature unique to Entropy. Without going into Here is the process for registering an address using the Entropy CLI's interactive text-based user interface (TUI). -1. Start the CLI by running `entropy`. +1. Start the CLI by running `entropy tui`. 1. Back at the main menu within the CLI, select **Register**: ```output diff --git a/content/reference/command-line-interface.md b/content/reference/command-line-interface.md index 439eee7f..711212ed 100644 --- a/content/reference/command-line-interface.md +++ b/content/reference/command-line-interface.md @@ -2,18 +2,11 @@ title: "Command-line interface" lead: "The command-line interface (CLI) is a straightforward way to experiment with the Entropy network and explore common workflows." aliases: - - "url" + - "cli" --- {{< cards cols=2 >}} - {{< card - link="#interactive-cli" - title="Interactive CLI" - image="/images/entropy-tui-terminal.png" - subtitle="Use the text-based user interface (TUI) to interact with the CLI tool." - >}} - {{< card link="#programmatic-cli" title="Programmatic CLI" @@ -21,22 +14,27 @@ aliases: subtitle="Pass arguments directly to the CLI as single-line terminal commands." >}} -{{< /cards >}} + {{< card + link="#interactive-cli" + title="Interactive CLI" + image="/images/entropy-tui-terminal.png" + subtitle="Use the text-based user interface (TUI) to interact with the CLI tool." + >}} -After installing, running `entropy` without any arguments will take you to the text-based user interface. If you pass any arguments, however, the CLI will assume you want to run the CLI as a single command. +{{< /cards >}} ## Install Follow these steps to install Entropy globally using NPM: -1. The CLI requires Node version 20 to run. Ensure you have Node.js version `20.x.x`: +1. The CLI requires Node version 20 or higher to run: ```shell node --version ``` ```output - v20.18.0 + v23.1.0 ``` {{< callout type="info" >}} @@ -49,31 +47,12 @@ Follow these steps to install Entropy globally using NPM: npm install --global @entropyxyz/cli ``` -1. You can now run the text-based interface anywhere using `entropy`: +1. You can now run the CLI from anywhere using `entropy`: ```shell entropy ``` - ```output - ? Select Action (Use arrow keys) - - ❯ Manage Accounts - Balance - Register - Sign - Transfer - Deploy Program - User Programs - Exit - ``` - -1. You can also interact with the CLI through one-line commands by adding any of the arguments listed in the help section: - - ```shell - entropy --help - ``` - ```output Usage: entropy [options] [command] @@ -100,119 +79,25 @@ Follow these steps to install Entropy globally using NPM: a signature (string) ``` -## Interactive CLI - -The following functions are available within the CLI using the text-based user interface (TUI). To start the TUI, simply enter `entropy` without any arguments into your terminal: - -### Manage Accounts - -Create a new Entropy account to store locally. List all Entropy accounts stored locally. Import an account into the CLI using a seed. - -```output -> Create/Import Account - Select Account - List Accounts -``` - -#### Create or Import Account - -Create a new Entropy account or import an existing account using a seed. - -#### Select Account - -Select an account to use within other functions. This is relevant if you have multiple accounts. -For example, assume you have three accounts, and you want to check the balance of `account 2`. You would: +1. You can also interact with the CLI through the TUI by adding `tui`: -1. Start the CLI. -1. Navigate to **Manage Accounts**. -1. Navigate to **Select Account**. -1. Choose the account that you would like to select and use within other functions: - - ```output - ? Choose account: (Use arrow keys) - > Gael (5CrFp9txcb5UECpNKsD6DTBsG4cj1z58DA43YikSVeeJqXJR) - Argo (5Dcps2RdXPQfiJBxxDnrF8iDzDHcnZC8rb5mcJ3xicqzhYbv) - Lapp (5G92hBs4UfZpVFYtBmmN3UqPTzGgotq7PSA3XfBMALfvWDUb) + ```shell + entropy tui ``` -1. The account you select is what the CLI will use when running other functions. - -#### List Accounts - -Show all the locally stored accounts. This function shows secret details such as `seed` in plaintext. - -### Balance - -Get the balance of an account. You can select any of the accounts stored locally or enter an Entropy address. - -```output -? Select Action Balance -Address 5Dcps2RdXPQfiJBxxDnrF8iDzDHcnZC8rb5mcJ3xicqzhYbv has a balance of: 382000000000000 bits -? Return to main menu? (Y/n) -``` - -### Register - -Register a locally stored account with the Entropy network. - -```output -Attempting to register the address: 5Dcps2RdXPQfiJBxxDnrF8iDzDHcnZC8rb5mcJ3xicqzhYbv -Your address 5Dcps2RdXPQfiJBxxDnrF8iDzDHcnZC8rb5mcJ3xicqzhYbv has been successfully registered. -``` - -The selected account must have available funds. Each registration costs about `400000000` bits. - -### Transfer - -Transfer funds from a locally stored account to any other valid Entropy address. - -```output -? Select Action Transfer -? Input amount to transfer: 12345 -? Input recipient's address: 5G92hBs4UfZpVFYtBmmN3UqPTzGgotq7PSA3XfBMALfvWDUb -Transferring Funds |++++___________________| 22% -``` - -The `amount to transfer` value is in whole units, not bits. So transferring `1` would equal `10000000000` bits. - -### Sign - -Sign a message using a registered account. - -```output -? Choose account: (Use arrow keys) - aragon (5FTwtSAjnKFybzkAKvyEo7owikXcHXmwzN7MzjwDNKEbjkub) -> charlie (5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT) - Other -``` - -### Deploy Program - -Deploy a program from a locally stored account. - -```output -? Select Action Deploy Program -? Select your action: (Use arrow keys) -> Deploy - Get Program Pointers - - Exit -``` - -### User Programs - -View all programs deployed to the network from locally stored accounts. + ```output + ? Select Action (Use arrow keys) -```output -? Select Action User Programs -? What would you like to do? (Use arrow keys) -> View My Programs - Add a Program to My List - Remove a Program from My List - Check if Program Exists - Exit to Main Menu -``` + ❯ Manage Accounts + Balance + Register + Sign + Transfer + Deploy Program + User Programs + Exit + ``` ## Programmatic CLI @@ -360,6 +245,137 @@ Sign a message using the Entropy network. Output is a signature as a string. entropy sign '5DSUAf2DwxW2ebZq15Pm6Z3SJ69Ur8fGd8ytWvgxvNjYtr7c' 'Pickle Pee, Pump-a-Rum!' ``` +## Text-based user interface + +The following functions are available within the CLI using the text-based user interface (TUI). To start the TUI, simply enter `entropy tui` without any arguments into your terminal: + +```shell +entropy tui +``` + +```output +? Select Action (Use arrow keys) + +❯ Manage Accounts + Balance + Register + Sign + Transfer + Deploy Program + User Programs + Exit +``` + +### Manage Accounts + +Create a new Entropy account to store locally. List all Entropy accounts stored locally. Import an account into the CLI using a seed. + +```output +> Create/Import Account + Select Account + List Accounts +``` + +#### Create or Import Account + +Create a new Entropy account or import an existing account using a seed. + +#### Select Account + +Select an account to use within other functions. This is relevant if you have multiple accounts. + +For example, assume you have three accounts, and you want to check the balance of `account 2`. You would: + +1. Start the CLI. +1. Navigate to **Manage Accounts**. +1. Navigate to **Select Account**. +1. Choose the account that you would like to select and use within other functions: + + ```output + ? Choose account: (Use arrow keys) + > Gael (5CrFp9txcb5UECpNKsD6DTBsG4cj1z58DA43YikSVeeJqXJR) + Argo (5Dcps2RdXPQfiJBxxDnrF8iDzDHcnZC8rb5mcJ3xicqzhYbv) + Lapp (5G92hBs4UfZpVFYtBmmN3UqPTzGgotq7PSA3XfBMALfvWDUb) + ``` + +1. The account you select is what the CLI will use when running other functions. + +#### List Accounts + +Show all the locally stored accounts. This function shows secret details such as `seed` in plaintext. + +### Balance + +Get the balance of an account. You can select any of the accounts stored locally or enter an Entropy address. + +```output +? Select Action Balance +Address 5Dcps2RdXPQfiJBxxDnrF8iDzDHcnZC8rb5mcJ3xicqzhYbv has a balance of: 382000000000000 bits +? Return to main menu? (Y/n) +``` + +### Register + +Register a locally stored account with the Entropy network. + +```output +Attempting to register the address: 5Dcps2RdXPQfiJBxxDnrF8iDzDHcnZC8rb5mcJ3xicqzhYbv +Your address 5Dcps2RdXPQfiJBxxDnrF8iDzDHcnZC8rb5mcJ3xicqzhYbv has been successfully registered. +``` + +The selected account must have available funds. Each registration costs about `400000000` bits. + +### Transfer + +Transfer funds from a locally stored account to any other valid Entropy address. + +```output +? Select Action Transfer +? Input amount to transfer: 12345 +? Input recipient's address: 5G92hBs4UfZpVFYtBmmN3UqPTzGgotq7PSA3XfBMALfvWDUb +Transferring Funds |++++___________________| 22% +``` + +The `amount to transfer` value is in whole units, not bits. So transferring `1` would equal `10000000000` bits. + +### Sign + +Sign a message using a registered account. + +```output +? Choose account: (Use arrow keys) + aragon (5FTwtSAjnKFybzkAKvyEo7owikXcHXmwzN7MzjwDNKEbjkub) +> charlie (5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT) + Other +``` + +### Deploy Program + +Deploy a program from a locally stored account. + +```output +? Select Action Deploy Program +? Select your action: (Use arrow keys) +> Deploy + Get Program Pointers + + Exit +``` + +### User Programs + +View all programs deployed to the network from locally stored accounts. + +```output +? Select Action User Programs +? What would you like to do? (Use arrow keys) +> View My Programs + Add a Program to My List + Remove a Program from My List + Check if Program Exists + Exit to Main Menu +``` + ## Configuration The CLI uses a configuration file to set and store basic information. This CLI uses [env-paths](https://www.npmjs.com/package/env-paths) to determine where configurations files should be stored: