Skip to content

Commit

Permalink
Merge pull request #127 from entropyxyz/dev
Browse files Browse the repository at this point in the history
merge dev into main to prep for release
  • Loading branch information
frankiebee authored Jul 12, 2024
2 parents 89d45ad + 236f413 commit b28240e
Show file tree
Hide file tree
Showing 57 changed files with 3,905 additions and 1,558 deletions.
36 changes: 36 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!-- Provide a brief description of the changes made in this PR -->

## Related Issue(s)
<!-- Link to the issue(s) that this PR addresses -->

- Resolves #[issue_number]

## Proposed Changes
<!-- List the changes made in this PR -->

- Change 1
- Change 2
- ...

## Testing
<!-- Describe how you tested the changes -->

- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed

## Screenshots (if applicable)
<!-- Include any relevant screenshots here -->

## Additional Context
<!-- Add any other context or information that might be helpful for the reviewer -->

## Checklist
<!-- Confirm that the following items are true and correct: -->

- [ ] I have performed a self-review of my code.
- [ ] I have added tests.
- [ ] I have commented my code.
- [ ] I have included a `CHANGELOG.md` entry.
- [ ] I have updated documentation in `github.com:entropyxyz/entropy-docs`, where necessary.

33 changes: 33 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Build, lint, test
run-name: Test JS CLI (started by @${{ github.triggering_actor }})

on:
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
build_test_lint:
name: Build, test, and lint
permissions:
contents: read
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.10.0
- name: Install
run: yarn --network-timeout 180000
- name: Typecheck
run: yarn run test:types
- name: Build
run: yarn run build
- name: Add TSS server host mappings
run: |
echo "127.0.0.1 alice-tss-server bob-tss-server" | sudo tee -a /etc/hosts
- name: Test
run: yarn run test
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

All notable changes to this project will be documented in this file.

The format extends [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
**At the moment this project DOES NOT adhere to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).**

**Until MAJOR version 1; All MINOR versions are breaking changes and all patch versions are bug fixes and features.**

Version header format: `[version] Name - year-month-day (entropy-core compatibility: version [range])`

## [UNRELEASED]

### 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
### 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
164 changes: 96 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A straightforward command-line interface (CLI) tool to showcase how to perform basic Entropy actions.

> This tool is in early development. As such, a lot of things do not work. Feel free to play around with it and report any issues at [github.com/entropyxyz/cli](https://github.com/entropyxyz/cli).
> :warning: This tool is in early development. As such, a lot of things do not work. Feel free to play around with it and report any issues at [github.com/entropyxyz/cli](https://github.com/entropyxyz/cli).
- [Install](#install)
- [Basic usage](#basic-usage)
Expand All @@ -12,83 +12,43 @@ A straightforward command-line interface (CLI) tool to showcase how to perform b

## Install

1. Make sure you've got Yarn 1.22.X installed:

```
# MacOS
brew install yarn
```

```shell
# Debian/Ubuntu
sudo apt install yarn -y
```

```shell
# Arch
sudo pacman -S yarn
```

1. Clone the Entropy CLI repository and move into the new directory:

```shell
git clone https://github.com/entropyxyz/cli && cd cli
```

1. Build the CLI with Yarn:

```shell
yarn
```

1. Start the CLI:

```shell
yarn start
```

You should now see the main menu:

```output
? Select Action (Use arrow keys)
> Manage Accounts
Balance
Register
Sign
Transfer
Deploy Program
User Programs
Exit
```bash
npm install -g @entropyxyz/cli
```

## Basic usage
## Usage

### Start the CLI
### Interactive mode

Start the CLI by moving to the CLI directory and running `yarn start`:

```shell
cd cli
yarn start
```bash
entropy
```

This command will bring you to the main menu:

```output
? Select Action (Use arrow keys)
> Manage Accounts
Balance
Register
Sign
Transfer
Deploy Program
User Programs
Exit
```output
? Select Action (Use arrow keys)
> Manage Accounts
Balance
Register
Sign
Transfer
Deploy Program
User Programs
Exit
```

### Programmatic mode

```bash
entropy balance 5GYvMHuB8J4mpJFCJ7scdR8AXGbT69B2bAqbNxPEa9ZSgEJm
```

### Stop the CLI
See help on programmatic usage:
```bash
entropy --help # all commands
entropy balance --help # a specific command
```

You can stop the CLI by selecting **Exit** from the main menu or pressing `CTRL` + `c`.

### Available functions

Expand All @@ -111,3 +71,71 @@ Need help with something? [Head over to the Entropy Community repository for sup
## License

This project is licensed under [GNU Affero General Public License v3.0](./LICENSE).

## Development

<details>
<summary>
<strong>Development install</strong>
</summary>

1. Install Node + yarn 1.22.x

- we recommend installing Node with e.g. [NVM](https://github.com/nvm-sh/nvm)
- enable yarn by running `corepack enable`

1. Grab this repository and move into the new directory:

```bash
git clone https://github.com/entropyxyz/cli
cd cli
```

1. Build the CLI with Yarn:

```bash
yarn
```

1. Start the CLI:

For an interactive text user interface:

```bash
yarn start
```

You should now see the main menu:
```output
? Select Action (Use arrow keys)
> Manage Accounts
Balance
Register
Sign
Transfer
Deploy Program
User Programs
Exit
```

For programmatic use, see:
```bash
yarn start --help
```

</details>
<details>
<summary>
<strong>Global install</strong>
</summary>

```bash
npm install -g
```
This will register the `entropy` bin script globally so that you can run

```bash
entropy --help
```

</details>
46 changes: 46 additions & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Hello sdk dev!

## Tests

DONT HAVE ANY YET LETS MAKE SOME!

## Linting

We've got automated linting set up as a pre-commit hook.
Setup

- dependencies: `husky`, `pinst`, `lint-staged`
- files: `.husky/`

If you are blocked from committing, you can skip these hooks

```bash
git commit --no-verify
```

### A note on PR's

- Please check all relevant boxes in pr template
- Please select an appropriate reviewer.
- PR's that have the reviewer also contribute code will either not be merged in or they might get reverted.
- PR for `dev` -> `main`
- must have:
- [ ] two QA approvals one from `js team` one from `dev rel`
- [ ] comprehensive coverage of change log

## Publishing all included


Always publish from `main` branch

```bash
git checkout main
yarn burn
yarn
yarn bundle
yarn version --patch # patch|minor|major
# npm publish # we are not live yet on npm do this when we have global install figured out
git push origin main --tags
```

go create a release on github if possible.
25 changes: 25 additions & 0 deletions dev/bin/test-only.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /usr/bin/env bash

RESULT=$(grep -r \
--exclude-dir=dev \
--exclude-dir=node_modules \
--exclude-dir=.git \
'test\.only'
)

if [ "$RESULT" ]; then
RED='\033[0;31m'
NC='\033[0m' # No Color

printf "${RED}Error: test.only found${NC} \n" && \
grep -rn \
--exclude-dir=dev \
--exclude-dir=node_modules \
--exclude-dir=.git \
--color \
'test\.only' && \
echo '' && \
echo 'Please remove ♡' && \
echo '' && \
exit 1
fi
23 changes: 23 additions & 0 deletions dev/bin/test-ts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /usr/bin/env bash

# HACK: normally we could just go:
# tape tests/*.test.ts | tap-spec
#
# but here we are fighting TS ... this works well enough

ONLY_FILES=`grep 'test.only' tests/*.test.ts -l`

if [ $ONLY_FILES ]; then
# If there are files with test.only, run only those files
# NOTE: `yarn test:only` ensures our CI fails if those are left in
set -e;
for t in $ONLY_FILES; do
npx tsx $t | tap-spec;
done
else
# Otherwise run all tests
set -e;
for t in tests/*.test.ts; do
npx tsx $t | tap-spec;
done
fi
Loading

0 comments on commit b28240e

Please sign in to comment.