Skip to content

Commit

Permalink
Release/0.0.4rc1 (#267)
Browse files Browse the repository at this point in the history
* fix arguments

* rename test/program{s,}.test.ts

* update README CHANGELOG

* Update CHANGELOG.md

---------

Co-authored-by: Nayyir Jutha <[email protected]>
  • Loading branch information
mixmix and rh0delta authored Oct 29, 2024
1 parent 3244691 commit 8d9a2e4
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 108 deletions.
145 changes: 94 additions & 51 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,80 +13,123 @@ 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)
- new: option to display cli and core version

- programmatic CLI commands
- new: `entropy account create`
- new: `entropy account import`
- new: `entropy account list`
- new: `entropy account register`
- new: `entropy program deploy`
- new: option to display cli and core version

- 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
- ascii art print out now shows up to date core version based, coming from SDK

### 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 testing, 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] <source> <destination> <amount>`
- new: `entropy transfer [options] <destination> <amount>`
- 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
107 changes: 57 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,24 @@ 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 <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
-v, --version display current cli version
-cv, --core-version display current core protocol version
-et, --tui-endpoint <url> 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
-v, --version Display current cli version
-cv, --core-version Display current core protocol version
Commands:
list|ls List all accounts. Output is JSON of form [{ name,
address, data }]
balance [options] <address> Get the balance of an Entropy account. Output is a
number
transfer [options] <source> <destination> <amount> Transfer funds between two Entropy accounts.
sign [options] <address> <message> Sign a message using the Entropy network. Output is
a signature (string)
balance [options] <account <address|name>> Command to retrieive the balance of an account on the Entropy Network
account Commands to work with accounts on the Entropy Network
transfer [options] <destination> <amount> Transfer funds between two Entropy accounts.
sign [options] <msg> 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**:
Expand All @@ -105,19 +100,19 @@ entropy balance --help
```

```output
Usage: entropy balance [options] <address>
Usage: entropy balance [options] <account>
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 <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 <url> 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
Expand Down Expand Up @@ -188,7 +183,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
Expand All @@ -205,37 +201,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 <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 <url> 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] <account <address|name>> Command to retrieive the balance of an account on the Entropy Network
account Commands to work with accounts on the Entropy Network
transfer [options] <destination> <amount> Transfer funds between two Entropy accounts.
sign [options] <msg> 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] <address> Get the balance of an Entropy account. Output is a
number
transfer [options] <source> <destination> <amount> Transfer funds between two Entropy accounts.
sign [options] <address> <message> 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
Expand Down
5 changes: 4 additions & 1 deletion src/balance/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <address|name>', 'Account address whose balance you want to query')
.argument('<account>', [
'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)
Expand Down
6 changes: 3 additions & 3 deletions src/program/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ function entropyProgramDeploy () {
'Requires funds.'
].join(' '))
.argument(
'bytecode',
'<bytecode>',
[
'The path to your program bytecode.',
'Must be a .wasm file.'
].join(' ')
)
.argument(
'configurationSchema',
'<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',
'<auxillaryDataSchema>',
[
'The path to the JSON Schema for validating auxillary data passed to the program on calls to "sign".',
'Must be a .json file.'
Expand Down
2 changes: 1 addition & 1 deletion src/sign/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('<msg>', 'Message you would like to sign (string)')
.addOption(accountOption())
.addOption(endpointOption())
// .addOption(
Expand Down
4 changes: 2 additions & 2 deletions src/transfer/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('<destination>', 'Account address funds will be sent to')
.argument('<amount>', 'Amount of funds to be moved (in "tokens")')
.addOption(accountOption())
.addOption(endpointOption())
.action(async (destination, amount, opts) => {
Expand Down
File renamed without changes.

0 comments on commit 8d9a2e4

Please sign in to comment.