Skip to content

Adds staking operations to CLI and JS SDK - #307

Merged
cristiam86 merged 2 commits into
mainfrom
edgars/asimov-phase-4
Dec 3, 2025
Merged

Adds staking operations to CLI and JS SDK#307
cristiam86 merged 2 commits into
mainfrom
edgars/asimov-phase-4

Conversation

@MuncleUscles

@MuncleUsclesMuncleUscles commented Dec 2, 2025

Copy link
Copy Markdown
Member

Description

Adds staking functionality to the genlayer CLI 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.

  • Docs: CLI (pages/api-references/genlayer-cli.mdx)
    • Replace keypair management with Account Management (genlayer account ...) covering create/import/send/unlock/lock with options and examples.
    • Add Staking Operations (Testnet) section: validator and delegator commands (join, deposit, exit, claim, prime, info), identity/operator updates, epoch/validators queries, options, and examples.
  • Docs: JS SDK (pages/api-references/genlayer-js.mdx)
    • Add Staking (Testnet) guide: setup on testnetAsimov and 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

  • Documentation
    • CLI docs: replaced Keypair Management with Account Management; updated usage, options, examples, and clarified keystore path/overwrite semantics.
    • CLI docs: added Staking Operations (Testnet) guide with validator/delegator/info commands, options, and examples for join/leave/stake/withdraw and queries.
    • JS API docs: added Staking (Testnet) section covering epoch info, validators, stake info, joins/exits, claims, and utility methods.

✏️ Tip: You can customize this high-level summary in your review settings.

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.
@coderabbitai

coderabbitaiBot commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Two 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

Cohort / File(s)Summary
CLI documentation (Account + Staking)
pages/api-references/genlayer-cli.mdx
Replaces Keypair Management with Account Management (commands: account show, account create, account import, account send, account unlock, account lock), adjusts USAGE/OPTIONS/EXAMPLES wording to use keystore paths and per-subcommand keystore handling, and adds a new Staking Operations (Testnet) section with validator, delegator, and info commands, options, and usage examples.
JavaScript documentation (Staking)
pages/api-references/genlayer-js.mdx
Appends a new "Staking (Testnet)" section with setup boilerplate and API reference entries for epoch info, validators, stake info, validator/delegator join/exit, claims, and staking utility functions and examples.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify CLI command syntax and option descriptions match implemented CLI behavior.
  • Check examples for correct flags/addresses and consistency with keystore terminology.
  • Review JS staking API names and example code for accuracy and consistency.

Suggested reviewers

  • cristiam86

Poem

🐰 I hopped through docs with tiny feet,

Accounts now sing and staking's sweet.
Validators leap, delegators grin,
A keystore tucked beneath my chin.
Hooray—new routes for chains to spin! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check nameStatusExplanation
Title check✅ PassedThe title 'Adds staking operations to CLI and JS SDK' clearly and concisely summarizes the main changes in the pull request, which involve adding staking functionality to both the CLI and JavaScript SDK documentation.
Description check✅ PassedThe pull request description provides comprehensive details about the changes, including what staking functionality was added to both CLI and JS SDK, with specific commands and features documented.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch edgars/asimov-phase-4

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify

netlifyBot commented Dec 2, 2025

Copy link
Copy Markdown

Deploy Preview for genlayer-docs ready!

NameLink
🔨 Latest commit7a194cd
🔍 Latest deploy loghttps://app.netlify.com/projects/genlayer-docs/deploys/692f3228b7a73600082a5f97
😎 Deploy Previewhttps://deploy-preview-307--genlayer-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e593bb2 and 7a194cd.

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

Comment on lines +334 to +359
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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 address

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

@cristiam86
cristiam86 merged commit 98276c6 into mainDec 3, 2025
7 checks passed
@cristiam86
cristiam86 deleted the edgars/asimov-phase-4 branch December 3, 2025 23:12
@coderabbitaicoderabbitaiBot mentioned this pull request Mar 11, 2026
4 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@MuncleUscles@cristiam86