genlayer 0.40.0-clarke.2 → 0.40.0-clarke.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/e2e-wallet.yml +63 -0
- package/CHANGELOG.md +17 -0
- package/CLAUDE.md +3 -1
- package/README.md +95 -2
- package/dist/index.js +1136 -648
- package/docs/api-references/_meta.json +1 -0
- package/docs/api-references/accounts/account/show.mdx +1 -0
- package/docs/api-references/balances.mdx +19 -0
- package/docs/api-references/index.mdx +2 -1
- package/docs/api-references/staking/staking/wizard.mdx +3 -1
- package/docs/api-references/staking/staking.mdx +1 -1
- package/e2e/config-default.e2e.ts +69 -0
- package/e2e/errors.e2e.ts +128 -0
- package/e2e/fixtures/StakingStub.json +114 -0
- package/e2e/fixtures/StakingStub.sol +33 -0
- package/e2e/fixtures/chain.ts +141 -0
- package/e2e/fixtures/cli.ts +257 -0
- package/e2e/fixtures/mockProvider.ts +64 -0
- package/e2e/helpers/bridgePage.ts +116 -0
- package/e2e/lane-a-staking.e2e.ts +89 -0
- package/e2e/lane-b-deploy.e2e.ts +25 -0
- package/e2e/wallet-session.e2e.ts +105 -0
- package/package.json +5 -1
- package/playwright.config.ts +18 -0
- package/src/commands/account/export.ts +10 -2
- package/src/commands/account/import.ts +6 -1
- package/src/commands/balances/BalancesAction.ts +105 -74
- package/src/commands/staking/StakingAction.ts +27 -51
- package/src/commands/staking/delegatorClaim.ts +8 -13
- package/src/commands/staking/delegatorExit.ts +9 -15
- package/src/commands/staking/delegatorJoin.ts +11 -16
- package/src/commands/staking/index.ts +22 -2
- package/src/commands/staking/setIdentity.ts +47 -39
- package/src/commands/staking/setOperator.ts +36 -24
- package/src/commands/staking/stakingInfo.ts +6 -5
- package/src/commands/staking/validatorClaim.ts +31 -26
- package/src/commands/staking/validatorDeposit.ts +22 -22
- package/src/commands/staking/validatorExit.ts +25 -25
- package/src/commands/staking/validatorHistory.ts +1 -1
- package/src/commands/staking/validatorJoin.ts +13 -15
- package/src/commands/staking/validatorPrime.ts +19 -17
- package/src/commands/staking/validators.ts +4 -2
- package/src/commands/staking/wizard.ts +436 -67
- package/src/commands/transactions/trace.ts +1 -6
- package/src/commands/vesting/VestingAction.ts +20 -0
- package/src/commands/vesting/claim.ts +9 -13
- package/src/commands/vesting/delegate.ts +13 -19
- package/src/commands/vesting/list.ts +1 -2
- package/src/commands/vesting/undelegate.ts +10 -16
- package/src/commands/vesting/validatorClaim.ts +9 -15
- package/src/commands/vesting/validatorCreate.ts +14 -19
- package/src/commands/vesting/validatorDeposit.ts +9 -15
- package/src/commands/vesting/validatorExit.ts +9 -15
- package/src/commands/vesting/validatorList.ts +1 -1
- package/src/commands/vesting/validatorOperatorTransfer.ts +29 -43
- package/src/commands/vesting/validatorSetIdentity.ts +20 -25
- package/src/commands/vesting/vestingTypes.ts +8 -0
- package/src/commands/vesting/withdraw.ts +12 -16
- package/src/commands/wallet/WalletAction.ts +4 -1
- package/src/lib/actions/BaseAction.ts +125 -15
- package/src/lib/config/ConfigFileManager.ts +4 -2
- package/src/lib/wallet/bridgePage.ts +26 -3
- package/src/lib/wallet/browserBridge.ts +139 -42
- package/src/lib/wallet/browserSend.ts +31 -7
- package/src/lib/wallet/sessionClient.ts +12 -2
- package/src/lib/wallet/sessionConstants.ts +18 -3
- package/tests/actions/balances.test.ts +109 -2
- package/tests/actions/resolveActiveIdentity.test.ts +95 -0
- package/tests/actions/staking.test.ts +318 -57
- package/tests/actions/stakingWizard.test.ts +542 -42
- package/tests/actions/trace.test.ts +71 -0
- package/tests/actions/vesting.test.ts +51 -27
- package/tests/actions/walletStatusDisconnect.test.ts +273 -0
- package/tests/commands/balances.test.ts +10 -4
- package/tests/commands/vesting.test.ts +16 -0
- package/tests/libs/availableToStake.test.ts +47 -0
- package/tests/libs/baseAction.test.ts +32 -0
- package/tests/libs/browserBridge.test.ts +55 -0
- package/tests/libs/configFileManager.test.ts +5 -2
- package/tests/libs/sessionClient.test.ts +3 -1
- package/vitest.config.ts +2 -2
- package/src/lib/wallet/stakingTx.ts +0 -12
- package/src/lib/wallet/txBuilders.ts +0 -114
- package/tests/libs/stakingTx.test.ts +0 -116
- package/tests/libs/txBuilders.test.ts +0 -152
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Tier-2 browser-wallet signing e2e (Playwright + mock provider on anvil).
|
|
2
|
+
#
|
|
3
|
+
# INFORMATIONAL / NOT A REQUIRED GATE (initially). This job drives a headless
|
|
4
|
+
# chromium against the real bridge page with a viem-backed mock window.ethereum
|
|
5
|
+
# that signs+broadcasts to an ephemeral anvil, exercising the full
|
|
6
|
+
# connect -> sign -> receipt loop with zero MetaMask. Keep it OFF the required
|
|
7
|
+
# status checks in branch protection until it has proven stable across a few
|
|
8
|
+
# weeks of PRs, then promote it to required.
|
|
9
|
+
#
|
|
10
|
+
# Distinct filename from the synced cross-repo e2e.yml (the /run-e2e cucumber
|
|
11
|
+
# pipeline) so the two never collide.
|
|
12
|
+
name: E2E Wallet (Tier 2)
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
pull_request:
|
|
16
|
+
types: [opened, synchronize, reopened]
|
|
17
|
+
push:
|
|
18
|
+
branches:
|
|
19
|
+
- v0.40
|
|
20
|
+
- v0.40-dev
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
e2e-wallet:
|
|
24
|
+
name: Browser-wallet e2e (anvil lanes)
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout code
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Install libsecret runtime
|
|
31
|
+
run: sudo apt-get update && sudo apt-get install -y libsecret-1-0
|
|
32
|
+
|
|
33
|
+
- name: Set up Node.js
|
|
34
|
+
uses: actions/setup-node@v4
|
|
35
|
+
with:
|
|
36
|
+
node-version: 20
|
|
37
|
+
cache: "npm"
|
|
38
|
+
|
|
39
|
+
- name: Install dependencies
|
|
40
|
+
run: npm ci
|
|
41
|
+
|
|
42
|
+
- name: Build the project
|
|
43
|
+
run: npm run build
|
|
44
|
+
|
|
45
|
+
- name: Install Foundry (anvil)
|
|
46
|
+
uses: foundry-rs/foundry-toolchain@v1
|
|
47
|
+
|
|
48
|
+
- name: Install Playwright chromium
|
|
49
|
+
run: npx playwright install --with-deps chromium
|
|
50
|
+
|
|
51
|
+
- name: Run Tier-2 e2e (anvil lanes)
|
|
52
|
+
run: npm run test:e2e
|
|
53
|
+
|
|
54
|
+
- name: Upload Playwright report
|
|
55
|
+
if: always()
|
|
56
|
+
uses: actions/upload-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: playwright-report
|
|
59
|
+
path: |
|
|
60
|
+
playwright-report/
|
|
61
|
+
test-results/
|
|
62
|
+
retention-days: 7
|
|
63
|
+
if-no-files-found: ignore
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.40.0-clarke.3](https://github.com/genlayerlabs/genlayer-cli/compare/v0.40.0-clarke.2...v0.40.0-clarke.3) (2026-07-10)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **staking:** non-interactive wizard mode ([#384](https://github.com/genlayerlabs/genlayer-cli/issues/384)) ([ef47935](https://github.com/genlayerlabs/genlayer-cli/commit/ef47935f81f17119caafb4d3121874a27308a40c))
|
|
8
|
+
* **staking:** wizard guides identity on the vesting funding path ([#386](https://github.com/genlayerlabs/genlayer-cli/issues/386)) ([6249e26](https://github.com/genlayerlabs/genlayer-cli/commit/6249e26d68ce12236e4fda6512480778d2990621))
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **account:** clear error for password prompts with no TTY ([#390](https://github.com/genlayerlabs/genlayer-cli/issues/390)) ([0ce6b1b](https://github.com/genlayerlabs/genlayer-cli/commit/0ce6b1b19d4d6fb17ce52569a74574212c8d0d53))
|
|
13
|
+
* **balances:** degrade gracefully when staking is unavailable ([#389](https://github.com/genlayerlabs/genlayer-cli/issues/389)) ([8cdcb8a](https://github.com/genlayerlabs/genlayer-cli/commit/8cdcb8aea4c17fcb4f671f5d03bf7decf784618b)), closes [#2](https://github.com/genlayerlabs/genlayer-cli/issues/2)
|
|
14
|
+
* **balances:** wallet-only view when consensus infra is not deployed ([#391](https://github.com/genlayerlabs/genlayer-cli/issues/391)) ([f2d9c98](https://github.com/genlayerlabs/genlayer-cli/commit/f2d9c9837f88be42e53e0a4dcc94322e1d15b5b6)), closes [#389](https://github.com/genlayerlabs/genlayer-cli/issues/389)
|
|
15
|
+
* **cli:** read commands honor a live wallet session (connect-once identity) ([#385](https://github.com/genlayerlabs/genlayer-cli/issues/385)) ([923475d](https://github.com/genlayerlabs/genlayer-cli/commit/923475d93e36dbb8146f2dcb9ff5d80799af99a4))
|
|
16
|
+
* **staking:** route set-operator/validator-claim/set-identity/trace through the SDK ([#387](https://github.com/genlayerlabs/genlayer-cli/issues/387)) ([e70b31b](https://github.com/genlayerlabs/genlayer-cli/commit/e70b31b039bbb67b568628adc7219909e9d0d1af))
|
|
17
|
+
* **staking:** validator-deposit/exit work through the CLI ([#382](https://github.com/genlayerlabs/genlayer-cli/issues/382)) ([3de9a6a](https://github.com/genlayerlabs/genlayer-cli/commit/3de9a6a2ee07bd596d3706228d9584f529ce1e16))
|
|
18
|
+
* **wallet:** harden bridge (verify signer, Host check, constant-time token, 0700, url scrub, body cap) ([#383](https://github.com/genlayerlabs/genlayer-cli/issues/383)) ([e55f917](https://github.com/genlayerlabs/genlayer-cli/commit/e55f917f269ece99c98dee6337695c7e5c459b95))
|
|
19
|
+
|
|
3
20
|
## [0.40.0-clarke.2](https://github.com/genlayerlabs/genlayer-cli/compare/v0.40.0-clarke.1...v0.40.0-clarke.2) (2026-07-09)
|
|
4
21
|
|
|
5
22
|
### Features
|
package/CLAUDE.md
CHANGED
|
@@ -26,7 +26,9 @@ npx vitest -t "test name pattern" # Run specific test by name
|
|
|
26
26
|
### Entry Point & Command Structure
|
|
27
27
|
- `src/index.ts` - Main entry, initializes Commander program and registers all command groups
|
|
28
28
|
- Commands organized in `src/commands/<domain>/index.ts` - each exports `initialize*Commands(program)` function
|
|
29
|
-
- Command domains: general (init/up/stop), account, contracts, config, localnet, update, scaffold, network, transactions, staking
|
|
29
|
+
- Command domains: general (init/up/stop), account, contracts, config, localnet, update, scaffold, network, transactions, staking, vesting, wallet, balances
|
|
30
|
+
- Custom networks: `network add <alias> --base <built-in>` registers a custom network profile (RPC/contract-address overrides); resolved by alias everywhere via `--network`
|
|
31
|
+
- Browser-wallet signing: write commands (staking/vesting/deploy/write) accept `--wallet browser` to sign in MetaMask through a local bridge (`addWalletModeOption` in `src/lib/wallet/walletOption.ts`); `wallet connect` starts a persistent session so the key never leaves MetaMask
|
|
30
32
|
|
|
31
33
|
### Core Classes
|
|
32
34
|
- `BaseAction` (`src/lib/actions/BaseAction.ts`) - Base class for all CLI actions. Provides:
|
package/README.md
CHANGED
|
@@ -151,15 +151,34 @@ USAGE:
|
|
|
151
151
|
genlayer network set [network] Set the network to use
|
|
152
152
|
genlayer network info Show current network configuration and contract addresses
|
|
153
153
|
genlayer network list List available networks
|
|
154
|
+
genlayer network add <alias> Add a custom network profile
|
|
155
|
+
genlayer network remove <alias> Remove a custom network profile
|
|
156
|
+
|
|
157
|
+
OPTIONS (add):
|
|
158
|
+
--base <built-in-alias> Built-in base network to derive from (required)
|
|
159
|
+
--rpc <url> Node RPC URL override
|
|
160
|
+
--chain-id <n> Chain ID override
|
|
161
|
+
--consensus-main <addr> ConsensusMain contract address override
|
|
162
|
+
--consensus-data <addr> ConsensusData contract address override
|
|
163
|
+
--staking <addr> Staking contract address override
|
|
164
|
+
--fee-manager <addr> FeeManager contract address override
|
|
165
|
+
--deployment <path.json> Consensus deployments JSON file to read addresses from
|
|
154
166
|
|
|
155
167
|
EXAMPLES:
|
|
156
168
|
genlayer network set
|
|
157
|
-
genlayer network set testnet
|
|
158
|
-
genlayer network set mainnet
|
|
169
|
+
genlayer network set testnet-bradbury
|
|
159
170
|
genlayer network info
|
|
160
171
|
genlayer network list
|
|
172
|
+
|
|
173
|
+
# Register a custom network on top of a built-in base, then use it by alias
|
|
174
|
+
genlayer network add my-devnet --base testnet-bradbury --rpc https://rpc.example.com --chain-id 4221
|
|
175
|
+
genlayer network set my-devnet
|
|
176
|
+
genlayer deploy --network my-devnet
|
|
161
177
|
```
|
|
162
178
|
|
|
179
|
+
Custom networks are stored by alias and can be selected anywhere a built-in
|
|
180
|
+
network can, via `--network <alias>` (or `genlayer network set <alias>`).
|
|
181
|
+
|
|
163
182
|
#### Deploy and Call Intelligent Contracts
|
|
164
183
|
|
|
165
184
|
Deploy and interact with intelligent contracts.
|
|
@@ -585,6 +604,80 @@ EXAMPLES:
|
|
|
585
604
|
genlayer staking prime-all
|
|
586
605
|
```
|
|
587
606
|
|
|
607
|
+
#### Browser Wallet Signing
|
|
608
|
+
|
|
609
|
+
By default, write commands sign with your encrypted keystore. Any write command
|
|
610
|
+
(`deploy`, `write`, and the `staking`/`vesting` commands) also accepts
|
|
611
|
+
`--wallet browser` to sign in MetaMask instead: the CLI serves a small page on
|
|
612
|
+
`127.0.0.1`, opens it, and you connect and confirm in the wallet. Your private
|
|
613
|
+
key never leaves MetaMask.
|
|
614
|
+
|
|
615
|
+
To avoid reconnecting for every command, open a persistent session once with
|
|
616
|
+
`wallet connect` and reuse it across subsequent `--wallet browser` commands.
|
|
617
|
+
|
|
618
|
+
```bash
|
|
619
|
+
USAGE:
|
|
620
|
+
genlayer wallet connect [options] Start a persistent browser-wallet session (connect once)
|
|
621
|
+
genlayer wallet status Show the current session (address, network, heartbeat)
|
|
622
|
+
genlayer wallet disconnect End the active session
|
|
623
|
+
|
|
624
|
+
EXAMPLES:
|
|
625
|
+
# Connect once, then reuse across commands
|
|
626
|
+
genlayer wallet connect --network testnet-bradbury
|
|
627
|
+
genlayer deploy --wallet browser
|
|
628
|
+
genlayer write 0x123...abc updateValue --args 42 --wallet browser
|
|
629
|
+
genlayer wallet status
|
|
630
|
+
genlayer wallet disconnect
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
For remote/SSH hosts, forward the printed port first
|
|
634
|
+
(`ssh -L <port>:127.0.0.1:<port> ...`). The default signing mode can be set via
|
|
635
|
+
the `walletMode` config value.
|
|
636
|
+
|
|
637
|
+
#### Balances
|
|
638
|
+
|
|
639
|
+
Show wallet and vesting balances plus committed stake for an address
|
|
640
|
+
(read-only, no keystore unlock).
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
USAGE:
|
|
644
|
+
genlayer balances [options]
|
|
645
|
+
|
|
646
|
+
OPTIONS:
|
|
647
|
+
--beneficiary <address> Address to inspect (defaults to the active account)
|
|
648
|
+
--account <name> Account whose address to use (no unlock)
|
|
649
|
+
--network <network> Built-in or custom network alias
|
|
650
|
+
--rpc <rpcUrl> RPC URL for the network
|
|
651
|
+
|
|
652
|
+
EXAMPLES:
|
|
653
|
+
genlayer balances
|
|
654
|
+
genlayer balances --beneficiary 0x123...abc --network testnet-bradbury
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
#### Vesting
|
|
658
|
+
|
|
659
|
+
Manage vesting contracts and vesting-backed validators. Beneficiaries can list
|
|
660
|
+
their vesting contracts, delegate/withdraw vested tokens, and run validators
|
|
661
|
+
whose stake is committed from a vesting contract rather than their wallet.
|
|
662
|
+
|
|
663
|
+
```bash
|
|
664
|
+
USAGE:
|
|
665
|
+
genlayer vesting list List beneficiary vesting contracts and state
|
|
666
|
+
genlayer vesting delegate <validator> Delegate vesting-held tokens to a validator
|
|
667
|
+
genlayer vesting withdraw --amount <amt> Withdraw vested tokens to the beneficiary
|
|
668
|
+
genlayer vesting validator create [operator] --amount <amt> Create a vesting-backed validator
|
|
669
|
+
genlayer vesting validator list List validator wallets owned by a vesting contract
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
The `staking wizard` can fund a validator from either your wallet or a vesting
|
|
673
|
+
contract, and sign with a keystore key or a browser wallet — the recommended
|
|
674
|
+
path for creating a vesting-backed validator interactively:
|
|
675
|
+
|
|
676
|
+
```bash
|
|
677
|
+
genlayer staking wizard
|
|
678
|
+
genlayer staking wizard --wallet browser
|
|
679
|
+
```
|
|
680
|
+
|
|
588
681
|
### Running the CLI from the repository
|
|
589
682
|
|
|
590
683
|
First, install the dependencies and start the build process
|