From 59f1d971a7aa13f52d40b15ba52b93f50b8cfce3 Mon Sep 17 00:00:00 2001 From: mixmix Date: Thu, 24 Oct 2024 14:50:27 +1300 Subject: [PATCH 1/4] fix arguments --- src/balance/command.ts | 5 ++++- src/program/command.ts | 6 +++--- src/sign/command.ts | 2 +- src/transfer/command.ts | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/balance/command.ts b/src/balance/command.ts index f6829594..d99ba2e2 100644 --- a/src/balance/command.ts +++ b/src/balance/command.ts @@ -10,7 +10,10 @@ export function entropyBalanceCommand () { const balanceCommand = new Command('balance') balanceCommand .description('Command to retrieive the balance of an account on the Entropy Network') - .argument('account ', 'Account address whose balance you want to query') + .argument('', [ + 'The address an account address whose balance you want to query.', + 'Can also be the human-readable name of one of your accounts' + ].join(' ')) .addOption(endpointOption()) .action(async (account, opts) => { const entropy: Entropy = await loadEntropy(account, opts.endpoint) diff --git a/src/program/command.ts b/src/program/command.ts index 0f02ffb5..ad71ed2b 100644 --- a/src/program/command.ts +++ b/src/program/command.ts @@ -22,21 +22,21 @@ function entropyProgramDeploy () { 'Requires funds.' ].join(' ')) .argument( - 'bytecode', + '', [ 'The path to your program bytecode.', 'Must be a .wasm file.' ].join(' ') ) .argument( - 'configurationSchema', + '', [ 'The path to the JSON Schema for validating configurations passed in by users installing this program.', 'Must be a .json file.' ].join(' ') ) .argument( - 'auxillaryDataSchema', + '', [ 'The path to the JSON Schema for validating auxillary data passed to the program on calls to "sign".', 'Must be a .json file.' diff --git a/src/sign/command.ts b/src/sign/command.ts index 4fc2fede..9fffa433 100644 --- a/src/sign/command.ts +++ b/src/sign/command.ts @@ -5,7 +5,7 @@ import { EntropySign } from './main' export function entropySignCommand () { const signCommand = new Command('sign') .description('Sign a message using the Entropy network. Output is a JSON { verifyingKey, signature }') - .argument('msg', 'Message you would like to sign (string)') + .argument('', 'Message you would like to sign (string)') .addOption(accountOption()) .addOption(endpointOption()) // .addOption( diff --git a/src/transfer/command.ts b/src/transfer/command.ts index 7791842f..0cdfe6fe 100644 --- a/src/transfer/command.ts +++ b/src/transfer/command.ts @@ -6,8 +6,8 @@ export function entropyTransferCommand () { const transferCommand = new Command('transfer') transferCommand .description('Transfer funds between two Entropy accounts.') // TODO: name the output - .argument('destination', 'Account address funds will be sent to') - .argument('amount', 'Amount of funds to be moved (in "tokens")') + .argument('', 'Account address funds will be sent to') + .argument('', 'Amount of funds to be moved (in "tokens")') .addOption(accountOption()) .addOption(endpointOption()) .action(async (destination, amount, opts) => { From 7e70956145ff8f0296d5907976802139ec32027a Mon Sep 17 00:00:00 2001 From: mixmix Date: Thu, 24 Oct 2024 15:32:01 +1300 Subject: [PATCH 2/4] rename test/program{s,}.test.ts --- tests/{programs.test.ts => program.test.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{programs.test.ts => program.test.ts} (100%) diff --git a/tests/programs.test.ts b/tests/program.test.ts similarity index 100% rename from tests/programs.test.ts rename to tests/program.test.ts From f66dd1a1241e5a0ad1d183736e5c522ff58f442c Mon Sep 17 00:00:00 2001 From: mixmix Date: Thu, 24 Oct 2024 15:32:19 +1300 Subject: [PATCH 3/4] update README CHANGELOG --- CHANGELOG.md | 143 +++++++++++++++++++++++++++++++++------------------ README.md | 103 ++++++++++++++++++++----------------- 2 files changed, 148 insertions(+), 98 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82169a53..67e5650f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,78 +13,121 @@ Version header format: `[version] Name - year-month-day (entropy-core compatibil ## [0.0.4] Carnage - 2024-10-23 (entropy-core compatibility: 0.3.0) ### Added -- new: 'src/flows/register/register.ts' - service file for register pure function -- new: './src/flows/manage-accounts/helpers/create-account.ts' - new helper file to house the pure function used to create a new entropy account -- update: './tests/manage-accounts.test.ts' - added test for create account pure function -- update: './src/common/utils.ts' - removed isValidSubstrateAddress and imported the method in from the sdk -- new: './tests/user-program-management.test.ts' - unit tests file for user program management flows - - added test for adding a user program - - added test for viewing a user program - - added test for removing a user program -- new: './src/flows/user-program-management/add.ts' - service file for adding user program pure function -- new: 'src/flows/user-program-management/helpers/questions.ts' - utility helper file for all the different inquirer questions used -- new: 'src/flows/user-program-management/types.ts' - user program management method types -- new: 'src/flows/user-program-management/view.ts' - service file for pure functions of viewing user programs -- new: 'src/flows/user-program-management/helpers/utils.ts' - utility helper file for user program management specific methods -- new: './src/flows/user-program-management/remove.ts' - service file for removing user program pure function -- new: './src/common/entropy-base.ts' - base abstract class for new command classes -- new: './src/balance' - new file structure for our CLI/TUI flows - - new: './src/balance/main.ts' - main entry file for balance command for tui/cli - - new: './src/balance/utils.ts' - utilities and helper methods for all things balance -- new: './src/transfer' - new file structure for our CLI/TUI flows - - new: './src/transfer/main.ts' - main entry file for transfer command for tui/cli - - new: './src/transfer/utils.ts' - utilities and helper methods for all things transfer -- new: './src/account' - new file structure for our CLI/TUI flows - - new: './src/account/main.ts' - main entry file for accounts command for tui/cli - - new: './src/account/utils.ts' - utilities and helper methods for all things accounts -- new: './src/faucet' - new file structure for our CLI/TUI flows - - new: './src/faucet/main.ts' - main entry file for faucet methods used for command and interaction files - - new: './src/faucet/utils.ts' - utilities and helper methods for all things faucet - - new: './src/faucet/interaction.ts' - main entrypoint for TUI flows - - new: './src/faucet/command.ts' - main entrypoint for CLI flows - - new: package added - yocto-spinner for adding loading spinners to the cli - - new: added new menu item for TUI to trigger a jumpstart to the network (needs to only be run once) + +- programmatic CLI commands + - new: `entropy account create` + - new: `entropy account import` + - new: `entropy account list` + - new: `entropy account register` + - new: `entropy program deploy` + +- TUI + - new: added faucet to main menu for TUI + - updated faucet to use loading spinner to indicate to user the progress of the transfer + - new: menu item to trigger a jumpstart to the network (needs to be run once for fresh test networks) + +- documentation + - updated: `./README.md` + - new: `./src/README.md` - an guide to the source of the project + - new: `./src/_template/*` - an example "domain" with lots of notes + +- tests + - new: `./tests/account.test.ts` - tests for `./src/account/` + - updated: `./tests/balance.test.ts` - tests for `./src/balance/` + - new: `./tests/common.test.ts` - tests for `./src/common/` + - updated: `./tests/config.test.ts` - tests for `./src/config/` + - new: `./tests/e2e.cli.sh` - a shell script which is an early test for programmatic usage + + - new: `./tests/faucet.test.ts` - tests `./src/faucet/` + - new: `./tests/global.test.ts` - + - new: `./tests/program.test.ts` - tests for `./src/program/` + +- programs + - new: `./tests/programs/faucet_program.wasm` - the faucet program! + +- packages + - new: `yocto-spinner` for adding loading spinners to the cli + - some minor package updates + +- github actions + - new: CLA action ### Changed -- folder name for user programs to match the kebab-case style for folder namespace -- updated SDK version to v0.2.3 +- updated SDK version to v0.3.0 (entropy-core 0.3.0) + - updated us to use `four-nodes` docker setup - logger to handle nested contexts for better organization of logs -- merged user + dev program folders + tests -- removed flows/balance/*.ts directory with file restructure -- removed flows/entropyTransfer/*.ts directory with file restructure -- removed flows/manage-accounts/*/*.ts directory with file restructure -- removed flows/register/*.ts directory with file restructure -- removed flow/entropyFaucet/*.ts directory with file restructure -- added faucet to main menu for TUI -- updated faucet to use loading spinner to indicate to user the progress of the transfer +- update: `./src/common/utils.ts` - removed isValidSubstrateAddress and imported the method in from the sdk +- file restructure: + - removed: `src/flows/*` + - added + - `./src/common/entropy-base.ts` - base abstract class for all our domains `main.js` files + - `./src/_template` - docs explaining the new file structure pattern + - `./src/account` - new file structure for our CLI/TUI flows + - NOTE: this contains register flow + - `./src/balance` - new file structure for our CLI/TUI flows + - `./src/faucet` - new file structure for our CLI/TUI flows + - `./src/program` - new file structure for our CLI/TUI flows + - NOTE: this merges user-program + dev-program domains into a single domain + - `./src/sign` - new file structure for our CLI/TUI flows + - `./src/transfer` - new file structure for our CLI/TUI flows +- folder name for user programs to match the kebab-case style for folder namespace ### Broke -- deploying programs with TUI - - now requires a `*.wasm` file for `bytecode` - - now requires a `*.json` file path for `configurationSchema` - - now requires a `*.json` file path for `auxillaryDataSchema` - +- network now uses `four-nodes` docker setup + - requires an update to `/etc/hosts` for local testsing, should include line: + ``` + 127.0.0.1 alice-tss-server bob-tss-server charlie-tss-server dave-tss-server + ``` +- for programmatic CLI + - change account listing: + - old: `entropy list` + - new: `entropy account list [options]` + - changed transfer: + - old: `entropy transfer [options] ` + - new: `entropy transfer [options] ` + - changed env: `ENDPOINT` => `ENTROPY_ENDPOINT` + +- for TUI + - "endpoint" configuration has changed + - see `entropy --help` + - change flag: `--endpoint` => `--tui-endpiont` + - change env: `ENTROPY_ENDPOINT` => `ENTROPY_TUI_ENDPOINT` + - This is because of [collisions we were seeing](https://github.com/entropyxyz/cli/issues/265) with `commander` flags. + - Does not effect programmatic CLI usage + - We may revert this in a future release. + - deploying programs now requires + - `*.wasm` file for `bytecode` + - `*.json` file path for `configurationSchema` + - `*.json` file path for `auxillaryDataSchema` ## [0.0.3] Blade - 2024-07-17 (entropy-core compatibility: 0.2.0) ### Fixed + - HOT-FIX programmatic balance error [183](https://github.com/entropyxyz/cli/pull/183) ## [0.0.2] AntMan - 2024-07-12 (entropy-core compatibility: 0.2.0) ### Added -- new: './src/flows/balance/balance.ts' - service file separated out of main flow containing the pure functions to perform balance requests for one or multiple addresses -- new: './tests/balance.test.ts' - new unit tests file for balance pure functions -- new: './src/common/logger.ts' - utility file consisting of the logger used throughout the entropy cli -- new: './src/common/masking.ts' - utility helper file for EntropyLogger, used to mask private data in the payload (message) of the logging method + +- new: `./src/flows/balance/balance.ts` - service file separated out of main flow containing the pure functions to perform balance requests for one or multiple addresses +- new: `./tests/balance.test.ts` - new unit tests file for balance pure functions +- new: `./src/common/logger.ts` - utility file consisting of the logger used throughout the entropy cli +- new: `./src/common/masking.ts` - utility helper file for EntropyLogger, used to mask private data in the payload (message) of the logging method + ### Fixed + - keyring retrieval method was incorrectly returning the default keyring when no keyring was found, which is not the intended flow + ### Changed + - conditional when initializing entropy object to only error if no seed AND admin account is not found in the account data, new unit test caught bug with using OR condition + ### Broke ### Meta/Dev + - new: `./dev/README.md` - `./.github`: their is now a check list you should fill out for creating a PR diff --git a/README.md b/README.md index 473f8431..2753073f 100644 --- a/README.md +++ b/README.md @@ -73,27 +73,22 @@ entropy --help ```output Usage: entropy [options] [command] -CLI interface for interacting with entropy.xyz. Running without commands starts an interactive ui +CLI interface for interacting with entropy.xyz. Running this binary without any commands or arguments starts a text-based +interface. Options: - -e, --endpoint Runs entropy with the given endpoint and ignores - network endpoints in config. Can also be given a - stored endpoint name from config eg: `entropy - --endpoint test-net`. (default: - "ws://testnet.entropy.xyz:9944/", env: ENDPOINT) - - -h, --help display help for command + -et, --tui-endpoint Runs entropy with the given endpoint and ignores network endpoints in config. + Can also be given a stored endpoint name from config eg: `entropy --endpoint + test-net`. (default: "wss://testnet.entropy.xyz/", env: ENTROPY_TUI_ENDPOINT) + -h, --help display help for command Commands: - list|ls List all accounts. Output is JSON of form [{ name, - address, data }] - - balance [options]
Get the balance of an Entropy account. Output is a - - number - transfer [options] Transfer funds between two Entropy accounts. - sign [options]
Sign a message using the Entropy network. Output is - a signature (string) + balance [options] > Command to retrieive the balance of an account on the Entropy Network + account Commands to work with accounts on the Entropy Network + transfer [options] Transfer funds between two Entropy accounts. + sign [options] Sign a message using the Entropy network. Output is a JSON { verifyingKey, + signature } + program Commands for working with programs deployed to the Entropy Network ``` **Command-specific help**: @@ -103,19 +98,19 @@ entropy balance --help ``` ```output -Usage: entropy balance [options]
+Usage: entropy balance [options] -Get the balance of an Entropy account. Output is a number +Command to retrieive the balance of an account on the Entropy Network Arguments: - address Account address whose balance you want to query + account The address an account address whose balance you want to query. Can also be the human-readable name of + one of your accounts Options: - -e, --endpoint Runs entropy with the given endpoint and ignores network endpoints in - config. Can also be given a stored endpoint name from config eg: `entropy - --endpoint test-net`. (default: "wss://testnet.entropy.xyz/", env: - ENDPOINT) - -h, --help display help for command + -e, --endpoint Runs entropy with the given endpoint and ignores network endpoints in config. Can also be given a + stored endpoint name from config eg: `entropy --endpoint test-net`. (default: + "wss://testnet.entropy.xyz/", env: ENTROPY_ENDPOINT) + -h, --help display help for command ``` ### Available functions @@ -186,7 +181,8 @@ If you want to make changes to this CLI tool, you should install it by following ```output ? Select Action (Use arrow keys) - > Manage Accounts + ❯ Manage Accounts + Entropy Faucet Balance Register Sign @@ -203,37 +199,48 @@ If you want to make changes to this CLI tool, you should install it by following ``` ```output - yarn run v1.22.22 - $ yarn build && npm install -g && entropy --help - $ tsup + yarn run v1.22.1 + $ yarn build:global && entropy --help + $ tsup && npm install -g CLI Building entry: src/cli.ts CLI Using tsconfig: tsconfig.json CLI tsup v6.7.0 - - ... - - CLI interface for interacting with entropy.xyz. Running without commands starts an interactive ui - + CLI Using tsup config: /home/mixmix/projects/ENTROPY/cli/tsup.config.ts + CLI Target: es2022 + CLI Cleaning output folder + ESM Build start + ESM dist/cli.js 576.07 KB + ESM ⚡️ Build success in 38ms + DTS Build start + DTS ⚡️ Build success in 985ms + DTS dist/cli.d.ts 21.00 B + + up to date in 234ms + Usage: entropy [options] [command] + + CLI interface for interacting with entropy.xyz. Running this binary without any commands or arguments starts a text-based + interface. Options: - -e, --endpoint Runs entropy with the given endpoint and ignores - network endpoints in config. Can also be given a - stored endpoint name from config eg: `entropy - --endpoint test-net`. (default: - "ws://testnet.entropy.xyz:9944/", env: ENDPOINT) - -h, --help display help for command + -et, --tui-endpoint Runs entropy with the given endpoint and ignores network endpoints in config. + Can also be given a stored endpoint name from config eg: `entropy --endpoint + test-net`. (default: "wss://testnet.entropy.xyz/", env: ENTROPY_TUI_ENDPOINT) + -h, --help display help for command Commands: - list|ls List all accounts. Output is JSON of form [{ name, + balance [options] > Command to retrieive the balance of an account on the Entropy Network + account Commands to work with accounts on the Entropy Network + transfer [options] Transfer funds between two Entropy accounts. + sign [options] Sign a message using the Entropy network. Output is a JSON { verifyingKey, + signature } + program Commands for working with programs deployed to the Entropy Network + Done in 2.06s. + ``` - address, data }] - balance [options]
Get the balance of an Entropy account. Output is a - number - transfer [options] Transfer funds between two Entropy accounts. - sign [options]
Sign a message using the Entropy network. Output is - a signature (string) + You can see more detail on specific commands using `--help` e.g. + + ```bash - Done in 3.07s. ``` ## Support From 785519213bd220db2dd51f0aa3adbed8f370fe3c Mon Sep 17 00:00:00 2001 From: Nayyir Jutha Date: Wed, 23 Oct 2024 23:20:45 -0400 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67e5650f..6f76febd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,7 +76,7 @@ Version header format: `[version] Name - year-month-day (entropy-core compatibil ### Broke - network now uses `four-nodes` docker setup - - requires an update to `/etc/hosts` for local testsing, should include line: + - requires an update to `/etc/hosts` for local testing, should include line: ``` 127.0.0.1 alice-tss-server bob-tss-server charlie-tss-server dave-tss-server ```