-
Notifications
You must be signed in to change notification settings - Fork 27
feat: adds @gridplus/cli #698
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
base: dev
Are you sure you want to change the base?
Conversation
- Commander-based CLI with gridplus/gp commands - Placeholder commands: setup, address, pubkey, eth2 - ETH2 staking subcommands: deposit-data, bls-change - Build config following packages/btc patterns - Fix biome.json schema version for subpackage lint
Session infrastructure: - session.ts - ~/.gridplus/ persistence with SDK callbacks - config.ts - CLI configuration management - output.ts - JSON/human formatting with chalk colors - prompts.ts - Inquirer prompts with ora spinners Commands implemented: - setup - Interactive device setup - connect - Connect to saved device - pair <code> - Pair with pairing code - address [path] - ETH/BTC/Solana addresses with --type - pubkey [path] - secp256k1/ed25519/BLS keys - sign <tx> - Ethereum transaction signing - sign-message <msg> - Personal sign and EIP-712 - eth2 deposit-data - Validator deposit data export - eth2 bls-change - BLS withdrawal credential migration All commands support -j/--json output flag.
- Fix ETH multi-address fetch (use fetchAddress loop) - Strip "m/" prefix from derivation paths (SDK doesn't handle it) - Convert pubkey Buffer responses to hex strings - Convert Solana address Buffer responses to base58 - Add bs58 dependency for Solana encoding
- Add `gridplus simulator setup` - one-shot setup + pair - Add `gridplus simulator info` - show simulator defaults - Add `--simulator` flag to setup and pair commands - Add SIMULATOR_DEFAULTS config (localhost:3000, SD0001, etc.) - Track `isSimulator` in session for auto-detection Simulator defaults match CI workflow: - URL: http://127.0.0.1:3000 - Device ID: SD0001 - Password/Pairing: 12345678
Run CLI tests in parallel with SDK e2e tests: - gridplus simulator setup - gridplus address (ETH, BTC, Solana) - gridplus pubkey - JSON output verification CLI tests run concurrently while e2e tests execute.
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d00ab9c05
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Set network configuration | ||
| depositOpts.network = eth2.Constants.NETWORKS.MAINNET_GENESIS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honor --network when building ETH2 deposit data
The command advertises --network mainnet|goerli|holesky, but the implementation always sets depositOpts.network to MAINNET_GENESIS. As a result, users who pass --network goerli or --network holesky still get mainnet fork/version roots, which produces invalid deposit data for testnets. This is a functional correctness bug for any non-mainnet use case and should select the network based on options.network instead of hardcoding mainnet.
Useful? React with 👍 / 👎.
| const pathParts = cleanPath(derivationPath).split('/'); | ||
| const lastPart = pathParts[pathParts.length - 1]; | ||
| if (!lastPart?.toLowerCase().includes('x')) { | ||
| pathParts[pathParts.length - 1] = 'x'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve hardened wildcard for multi-key pubkey paths
When --count > 1, the code replaces the last derivation path component with 'x' unconditionally. For hardened paths such as the default Solana path m/44'/501'/0'/0', this drops the hardened marker (') and changes the derivation to a non‑hardened branch. That yields different keys than intended (or can be rejected by the device), so gp pubkey --type ed25519 --count N won’t return keys from the documented path. The replacement should preserve hardened paths by using "x'" when the last component is hardened.
Useful? React with 👍 / 👎.
- Add full CLI documentation with all commands and options - Cover device setup, addresses, pubkeys, signing, and ETH2 commands - Include simulator quick start and CI integration examples - Add troubleshooting section and JSON output examples
The simulator only supports one pairing at a time. Running SDK e2e tests (as 'lattice-manager') and CLI tests (as 'GridPlus CLI') in parallel caused pairing conflicts where one would fail with "Pairing failed".
📝 Summary
🔧 Context / Implementation
🧪 Test Plan
🖼️ Screenshots (if applicable)