Skip to content

Commit 632cb36

Browse files
authored
feat: refactor the code, improve usability and code structure (#46)
1 parent b4b34ab commit 632cb36

28 files changed

+1200
-779
lines changed

.github/workflows/release.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
branches:
55
- main
6+
- alpha
7+
- beta
68
- '[0-9]+.*'
79

810
jobs:
@@ -19,10 +21,11 @@ jobs:
1921
node-version: "18.x"
2022
registry-url: "https://registry.npmjs.org"
2123
- name: Install dependencies and build
22-
env:
23-
RUDDER_STACK_KEY: ${{ secrets.RUDDER_STACK_KEY }}
24-
RUDDER_STACK_DATAPLANE_URL: ${{ secrets.RUDDER_STACK_DATAPLANE_URL }}
25-
run: npm ci && npm run build && npm run replaceVars
24+
run: npm ci && npm run build
25+
- name: Create .env-public-analytics file
26+
run: |
27+
echo "RUDDER_STACK_KEY=${{ secrets.RUDDER_STACK_KEY }}" > .env-public-analytics
28+
echo "RUDDER_STACK_DATAPLANE_URL=${{ secrets.RUDDER_STACK_DATAPLANE_URL }}" >> .env-public-analytics
2629
- name: Release
2730
env:
2831
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ cache
99
artifacts
1010

1111
bin
12-
bin/

.npmignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
*
33

44
# Include specific files
5-
!bin/
5+
!bin/**/*
6+
!.env-public-analytics
67
!package.json
78
!package-lock.json
89
!LICENSE-MIT

README.md

+20-12
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,41 @@ You can install this program globally with `npm i -g zksync-cli` or run the comm
2323

2424
## 💻 Commands
2525

26-
- `zksync-cli help`: Provides detailed information about each command.
26+
- `zksync-cli deposit`: deposits funds from Ethereum (L1) to zkSync (L2)
2727

28-
- `zksync-cli create {PROJECT_NAME}`: creates a new project in the given project name. If not provided, creates the project in the current folder, although this requires the folder to be empty.
28+
- `zksync-cli withdraw`: withdraws funds from zkSync (L2) to Ethereum (L1)
2929

30-
- `zksync-cli deposit`: deposits funds from L1 to L2 (local, testnet or mainnet). It will ask to enter: network, recipient wallet, amount in ETH (eg 0.1) and the private key of the wallet you're sending the funds from.
30+
- `zksync-cli withdraw-finalize`: finalizes withdrawal of funds from zkSync (L2) to Ethereum (L1)
3131

32-
- `zksync-cli withdraw`: withdraws funds from zkSync 2.0 to L1 (Goerli testnet). It will ask to enter: network, recipient wallet, amount in ETH (eg 0.1) and the private key of the wallet you're sending the funds from.
32+
- `zksync-cli create-project {FOLDER_NAME}`: creates project from template in the specified folder
3333

34-
- `zksync-cli confirm-withdraw`: confirms withdrawal of funds from zkSync 2.0 to L1 (Goerli testnet). It will ask to enter: network, withdrawal transaction address and the private key of the wallet you sent the funds from.
34+
- `zksync-cli help`: Provides information about all supported commands
3535

36-
- `zksync-cli <command> --help`: Provides detailed information about how to use a specific command. Replace <command> with the name of the command you want help with (e.g., create, deposit, withdraw, confirm-withdraw).
36+
- `zksync-cli help <command>`: Provides detailed information about how to use a specific command. Replace <command> with the name of the command you want help with (e.g., create-project, deposit, withdraw, withdraw-finalize)
3737

38-
- `zksync-cli --version`: Returns the current version.
38+
- `zksync-cli --version`: Returns the current version
3939

4040

41-
### ⚙️ Options (flags)
41+
### 🔗 Supported chains
42+
43+
By default zkSync CLI supports Era Testnet and Era Mainnet. You can also use other networks by overwriting L1 and L2 RPC URLs. For example: `zksync-cli deposit --l2-rpc=http://... --l1-rpc=http://...`
4244

43-
- `--l1-rpc-url`: override the default L1 rpc URL when `localnet` is selected as the network. Usage `--l1-rpc-url=http://...`.
44-
- `--l2-rpc-url`: override the default L2 rpc URL when `localnet` is selected as the network. Usage `--l1-rpc-url=http://...`.
45+
If you're using [local setup (dockerized testing node)](https://github.com/matter-labs/local-setup) with default L1 and L2 RPC URLs, you can select `Local Dockerized node` option in the CLI or provide option `--chain local-dockerized`.
46+
47+
### ⚙️ Options (flags)
4548
- `--zeek`: zeek, the dev cat, will search for an inspirational quote and provide to you at the end of any command.
4649

4750
## 👩‍💻 Developing new features
4851

49-
### Install and build
52+
### Run in development mode
53+
54+
1. Install all dependencies with `npm i`.
55+
2. To use CLI in development mode run `NODE_ENV=development npx ts-node --transpile-only src/index.ts`.
56+
57+
### Building for production
5058

5159
1. Install all dependencies with `npm i`.
52-
2. This project was build with Typescript. Run `npm run build` to compile code in `/src` into `/bin`.
60+
2. This project was build with Typescript. Run `npm run build` to compile the code into `/bin`.
5361
3. You can run your local build with `node ./bin`
5462

5563
### Testing

0 commit comments

Comments
 (0)