Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix merge conflicts with the matterlab's main branch. #7

Merged
merged 48 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
799c950
adding zeek, analytics, and var replacing with env secret
githubdoramon Feb 26, 2023
ffc9781
adding readme info
githubdoramon Feb 26, 2023
37d432e
avoiding app breaking if analytics is not configured properly
githubdoramon Feb 26, 2023
aaf7d62
adding possibility to remove tracking
githubdoramon Feb 27, 2023
f0c4dac
added support for other networks
mm-zk Apr 3, 2023
405439a
Merge branch 'main' into mm-zk_0304_add_network_support
mm-zk Apr 3, 2023
dd9275d
Allow selecting network for withdrawal
mm-zk Apr 4, 2023
92d602a
feat: adds help command to zksync cli
dutterbutter May 26, 2023
ff07a82
chore: fixed formatting
dutterbutter May 26, 2023
b442720
chore: update readme to include help usage
dutterbutter May 26, 2023
cc4cacd
Merge branch 'main' into feat/zeek_analytics
uF4No Jun 20, 2023
5bc7371
Merge pull request #7 from githubdoramon/feat/zeek_analytics
uF4No Jun 20, 2023
9e7f833
Update src/deposit.ts
uF4No Jul 7, 2023
faf49dc
Update src/deposit.ts
uF4No Jul 7, 2023
3cfcd09
Apply suggestions from code review
uF4No Jul 7, 2023
aad8e59
Merge pull request #9 from mm-zk/mm-zk_0304_add_network_support
uF4No Jul 7, 2023
8695481
Apply suggestions from code review
uF4No Jul 7, 2023
4bf6a43
Merge pull request #10 from mm-zk/mm-zk_0404_add_network_withdraw
uF4No Jul 7, 2023
c6b17d8
removes bin
uF4No Jul 7, 2023
79591ab
Merge pull request #19 from matter-labs/fix/removes-bin
uF4No Jul 7, 2023
41c9c7a
chore: resolve conflicts
dutterbutter Jul 7, 2023
c8c2d7b
Add confirm-withdrawal command. Add optional l1-rpc-url and l2-rpc-ur…
MexicanAce Jul 3, 2023
dde6154
Remove bin files
MexicanAce Jul 7, 2023
ef3f598
Merge pull request #20 from matter-labs/nmv-devrl-132-update-zksync-c…
MexicanAce Jul 7, 2023
2f89dac
chore: resolve conflicts and add confirm-withdrawal
dutterbutter Jul 7, 2023
a654efc
chore: format
dutterbutter Jul 7, 2023
790ae3e
Merge pull request #15 from dutterbutter/db/add-help-flag
uF4No Jul 7, 2023
566f492
fixes for v0.2.0 release
uF4No Jul 7, 2023
9924c97
removes bin
uF4No Jul 7, 2023
cc6d5b5
updates gitignore
uF4No Jul 7, 2023
a42d80f
Update src/index.ts
uF4No Jul 7, 2023
1d1c519
bugfix: Fix the localnet network option when overrides not supplied
MexicanAce Jul 7, 2023
5996e84
Update withdraw command name to match default import
MexicanAce Jul 7, 2023
018bbb1
Merge pull request #23 from matter-labs/nmv-devrl-156-fix-localnet-op…
MexicanAce Jul 7, 2023
325e0a9
Merge branch 'main' into fix/release-020
uF4No Jul 10, 2023
79da507
Merge pull request #22 from matter-labs/fix/release-020
uF4No Jul 10, 2023
c85a61d
adds vyper
uF4No Jul 10, 2023
913838b
Merge pull request #25 from matter-labs/feat/DEVRL-87
uF4No Jul 10, 2023
b0b1241
adds env to action and logs
uF4No Jul 11, 2023
4857b11
updates version
uF4No Jul 11, 2023
4787185
fix environment
uF4No Jul 11, 2023
0e7d124
adds env to job
uF4No Jul 11, 2023
4a4dfb6
adds env vars check
uF4No Jul 11, 2023
6e25290
0.2.2
uF4No Jul 11, 2023
ee35131
fix env names
uF4No Jul 11, 2023
f58f757
fix analytics
uF4No Jul 11, 2023
4d44048
Merge branch 'upstream:main' into fix-merge-conflicts-with-matterlabs…
jpcenteno Jul 20, 2023
55b145c
Update help
jpcenteno Jul 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/npm_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@ name: Publish to NPM
on:
push:
tags:
- '*'
- "*"

jobs:
build:
runs-on: [self-hosted, ci-runner]
environment: production release
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies and build
run: npm ci && npm run build
run: npm ci && npm run build && npm run replaceVars
env:
RUDDER_STACK_KEY: ${{ secrets.RUDDER_STACK_KEY }}
RUDDER_STACK_DATAPLANE_URL: ${{ secrets.RUDDER_STACK_DATAPLANE_URL }}
- name: Publish package on NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }}
RUDDER_STACK_KEY: ${{ secrets.RUDDER_STACK_KEY }}
RUDDER_STACK_DATAPLANE_URL: ${{ secrets.RUDDER_STACK_DATAPLANE_URL }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ typechain
#Hardhat files
cache
artifacts

bin
bin/
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ You can install this program globally with `npm i -g zksync-cli` or run the comm

### Commands

- `zksync-cli help`: Provides detailed information about each command.

- `zksync-cli create {PROJECT_NAME}`: creates a new Hardhat project in the given project name. If not provided, creates the project in the current folder, although this requires the folder to be empty.

- `zksync-cli deposit`: deposits funds from L1 (Goerli testnet) to zkSync 2.0 testnet. It will ask to enter: recipient wallet, amount in ETH (eg 0.1) and the private key of the wallet you're sending the funds from.
- `zksync-cli deposit`: deposits funds from L1 (Goerli testnet) to zkSync 2.0 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.

- `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.

- `zksync-cli withdraw`: withdraws funds from zkSync 2.0 to L1 (Goerli testnet). It will ask to enter: recipient wallet, amount in ETH (eg 0.1) and the private key of the wallet you're sending the funds from.
- `zksync-cli confirm-withdrawal`: 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.

> Both deposit and withdraw might take a couple of minutes to complete.

Expand All @@ -30,6 +34,12 @@ You can install this program globally with `npm i -g zksync-cli` or run the comm
- `zksync-cli localnet help`: Display this message and quit.
- `zksync-cli localnet wallets`: Display seeded wallet keys.

### Options (flags)

- `--zeek`: zeek, the dev cat, will search for an inspirational quote and provide to you at the end of any command.
- `--l1-rpc-url`: override the default Goerli L1 rpc URL when `localnet` is selected as the network.
- `--l2-rpc-url`: override the default zkSync testnet rpc URL when `localnet` is selected as the network.

## Developing new features

### Install and build
Expand All @@ -48,6 +58,11 @@ git push --tags

Proper tests will be included soon. For now, you can test new changes locally by installing this package globably with `npm i -g`.


### Tracking

zkSync-cli tracks its usage for the single purpose of providing data so it can be improved. Data is fully anonymized. If you want to disable the tracking, set the environment variable NO_TRACKING to true.

## Official Links

- [Website](https://zksync.io/)
Expand Down
1 change: 0 additions & 1 deletion bin/create.d.ts

This file was deleted.

67 changes: 0 additions & 67 deletions bin/create.js

This file was deleted.

1 change: 0 additions & 1 deletion bin/deposit.d.ts

This file was deleted.

82 changes: 0 additions & 82 deletions bin/deposit.js

This file was deleted.

2 changes: 0 additions & 2 deletions bin/index.d.ts

This file was deleted.

87 changes: 63 additions & 24 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#! /usr/bin/env node
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Expand All @@ -13,29 +22,59 @@ const create_1 = __importDefault(require("./create"));
const deposit_1 = __importDefault(require("./deposit"));
const withdraw_1 = __importDefault(require("./withdraw"));
const localnet_1 = __importDefault(require("./localnet"));
const availableOptions = ['create', 'deposit', 'withdraw', 'localnet'];
const help_1 = __importDefault(require("./help"));
const confirm_withdraw_1 = __importDefault(require("./confirm-withdraw"));
const zeek_1 = __importDefault(require("./zeek"));
const availableOptions = [
"create",
"deposit",
"withdraw",
"localnet",
"confirm-withdraw",
"help",
];
// second argument should be the selected option
const option = process.argv[2];
if (!availableOptions.includes(option)) {
console.log(`Invalid operation. Available operations are: ${availableOptions}`);
process.exit(-1);
}
// Starts CLI
console.log(chalk_1.default.magentaBright(figlet_1.default.textSync(`zkSync ${option}`, { horizontalLayout: 'full' })));
switch (option) {
case 'create':
// arg 3 is the project name
const projectName = process.argv[3] || '.';
(0, create_1.default)(projectName);
break;
case 'deposit':
(0, deposit_1.default)();
break;
case 'withdraw':
(0, withdraw_1.default)();
break;
case 'localnet':
const subcommandName = process.argv[3] || undefined;
(0, localnet_1.default)(subcommandName);
break;
}
const main = () => __awaiter(void 0, void 0, void 0, function* () {
if (!availableOptions.includes(option)) {
console.log(`Invalid operation. Available operations are: ${availableOptions}`);
process.exit(-1);
}
// Starts CLI
console.log(chalk_1.default.magentaBright(figlet_1.default.textSync(`zkSync ${option}`, { horizontalLayout: "full" })));
const zeekFlag = Boolean(process.argv.filter((arg) => arg === "--zeek")[0]);
const l1RpcUrl = String(process.argv
.filter((arg) => arg.startsWith("l1-rpc-url"))
.map((arg) => arg.split("=")[1])[0]);
const l2RpcUrl = String(process.argv
.filter((arg) => arg.startsWith("l2-rpc-url"))
.map((arg) => arg.split("=")[1])[0]);
switch (option) {
case "create":
// arg 3 is the project name
const projectName = process.argv[3] || ".";
yield (0, create_1.default)(projectName, zeekFlag);
break;
case "deposit":
yield (0, deposit_1.default)(zeekFlag, l1RpcUrl, l2RpcUrl);
break;
case "withdraw":
yield (0, withdraw_1.default)(zeekFlag, l1RpcUrl, l2RpcUrl);
break;
case "confirm-withdraw":
yield (0, confirm_withdraw_1.default)(zeekFlag, l1RpcUrl, l2RpcUrl);
break;
case 'localnet':
const subcommandName = process.argv[3] || undefined;
(0, localnet_1.default)(subcommandName);
break;
case "help":
(0, help_1.default)();
break;
}
if (zeekFlag) {
yield (0, zeek_1.default)();
}
process.exit(0);
});
main();
1 change: 0 additions & 1 deletion bin/withdraw.d.ts

This file was deleted.

Loading