Uh oh!
There was an error while loading. Please reload this page.
Adds staking operations to CLI and JS SDK - #307
Conversation
This commit introduces staking capabilities for both the `genlayer` CLI and the `genlayer-js` SDK. It includes commands for validators and delegators to manage their stakes on the testnet-asimov network such as joining, exiting, and claiming rewards. Also provides commands to manage validator identity. The SDK provides functions to get staking information, perform stake actions, and helper utilities.
WalkthroughTwo documentation pages were updated: the CLI doc replaces Keypair Management with Account Management and adds a comprehensive Staking Operations (Testnet) section; the JavaScript doc appends a Staking (Testnet) API reference and examples. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for genlayer-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Adds the ability to import an account using a private key via the genlayer CLI. Includes options for specifying the private key and output path.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
pages/api-references/genlayer-cli.mdx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
pages/**/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
pages/**/*.mdx: All content is in MDX format supporting React components
Import and use custom components within MDX files
Create .mdx file in appropriate pages/ subdirectory when adding new pages
All content should support React components in MDX files
Files:
pages/api-references/genlayer-cli.mdx
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Applied to files:
pages/api-references/genlayer-cli.mdx
📚 Learning: 2025-07-24T07:56:58.272Z
Learnt from: CR
Repo: genlayerlabs/genlayer-docs PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Applied to files:
pages/api-references/genlayer-cli.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Cursor Bugbot
- GitHub Check: Playwright E2E
🔇 Additional comments (1)
pages/api-references/genlayer-cli.mdx (1)
204-237: LGTM!The Account Management section is well-structured and follows established CLI documentation patterns. The terminology shift from "keypair" to "keystore" is appropriate and clearly reflected in the options and examples.
| OPTIONS (validator-join): | ||
| --amount <amount> Stake amount (e.g., "42000gen") | ||
| --operator <address> Optional operator address for the validator | ||
| --staking-address <addr> Override staking contract address | ||
| OPTIONS (delegator-join): | ||
| --validator <address> Validator address to delegate to (required) | ||
| --amount <amount> Amount to stake (e.g., "100gen") | ||
| --staking-address <addr> Override staking contract address | ||
| OPTIONS (exit commands): | ||
| --shares <shares> Number of shares to withdraw | ||
| --validator <address> Validator address (for delegator commands) | ||
| --staking-address <addr> Override staking contract address | ||
| OPTIONS (set-identity): | ||
| --validator <address> Validator address (required) | ||
| --moniker <name> Display name (required) | ||
| --website <url> Website URL | ||
| --description <text> Description | ||
| --twitter <handle> Twitter handle | ||
| --telegram <handle> Telegram handle | ||
| --github <handle> GitHub handle | ||
| --email <email> Contact email | ||
| --logo-uri <uri> Logo image URL | ||
There was a problem hiding this comment.
Document OPTIONS for all listed staking commands.
Several staking commands are listed in the command groups (lines 312–332) but lack explicit OPTIONS documentation: validator-deposit, validator-claim, validator-prime, validator-info, set-operator, delegator-claim, epoch-info, active-validators, quarantined-validators, and banned-validators.
While the EXAMPLES section provides hints (e.g., line 374 shows validator-info --validator 0x...), readers should not have to infer parameters from examples. Add explicit OPTIONS subsections for all commands, even if some have no additional options beyond the command name.
For example, add sections like:
+OPTIONS (validator-info):+ --validator <address> Validator address (required)+ --staking-address <addr> Override staking contract address++OPTIONS (delegator-claim):+ --validator <address> Validator address (required)+ --staking-address <addr> Override staking contract address++OPTIONS (epoch-info):+ --staking-address <addr> Override staking contract addressVerify with the actual CLI implementation which parameters each command accepts and document them explicitly.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In pages/api-references/genlayer-cli.mdx around lines 334 to 359, add explicit
OPTIONS subsections for each staking command missing them (validator-deposit,
validator-claim, validator-prime, validator-info, set-operator, delegator-claim,
epoch-info, active-validators, quarantined-validators, banned-validators); for
each command, consult the actual CLI implementation to enumerate accepted flags
and arguments (e.g., --validator, --amount, --staking-address, --operator,
--shares, etc.), document each option with a short description and example
value, and include an explicit "No options" note for commands that take none so
readers don’t have to infer parameters from examples.
Uh oh!
There was an error while loading. Please reload this page.
Description
Adds staking functionality to the
genlayerCLI and JS SDK, enabling users to manage staking operations for validators and delegators on the testnet-asimov network.Includes commands for joining, exiting, claiming rewards, and viewing staking information.
Note
Adds testnet staking docs to CLI and JS SDK and replaces keypair management with account management in CLI docs.
pages/api-references/genlayer-cli.mdx)genlayer account ...) covering create/import/send/unlock/lock with options and examples.pages/api-references/genlayer-js.mdx)testnetAsimovand APIs for epochs/validators (getEpochInfo,getActiveValidators,isValidator,getValidatorInfo), stake queries (getStakeInfo), actions (validatorJoin,delegatorJoin,validatorExit,delegatorExit,validatorClaim,delegatorClaim), and utilities (parseStakingAmount,formatStakingAmount).Written by Cursor Bugbot for commit 7a194cd. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.