Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8a5b844
feat(heimdall): scaffold command skeleton and register with root
praetoriansentry Apr 20, 2026
6aa1775
feat(heimdall): add config resolution and persistent flags
praetoriansentry Apr 20, 2026
308a475
feat(heimdall): add REST and CometBFT RPC HTTP clients
praetoriansentry Apr 20, 2026
0faf00b
feat(heimdall): add output rendering, watch wrapper, hints
praetoriansentry Apr 20, 2026
7f5da4f
feat(heimdall): capture test-node fixtures and add freshness test
praetoriansentry Apr 20, 2026
6703b40
chore(heimdall): promote go-toml/v2 to direct dep
praetoriansentry Apr 20, 2026
72cb3c2
feat(heimdall): hard-code public Polygon preset URLs
praetoriansentry Apr 20, 2026
57cb5c5
feat(heimdall): add chain subcommands for CometBFT queries
praetoriansentry Apr 20, 2026
8e3e998
chore(heimdall): capture /tx and /tx_search fixtures
praetoriansentry Apr 20, 2026
97fe908
feat(heimdall): add tx/account read-only subcommands
praetoriansentry Apr 20, 2026
53d4ee8
chore(heimdall): capture checkpoint prepare-next/signatures/buffer fi…
praetoriansentry Apr 20, 2026
765dd0b
feat(heimdall): add checkpoint query subcommands with cp alias
praetoriansentry Apr 20, 2026
a15c83e
chore(heimdall): capture bor producer-votes and planned-downtime fixt…
praetoriansentry Apr 20, 2026
afc633a
feat(heimdall): add span query subcommands with sp alias
praetoriansentry Apr 20, 2026
81c69e8
chore(heimdall): capture milestone out-of-range and early-milestone f…
praetoriansentry Apr 20, 2026
61945d3
feat(heimdall): add milestone query subcommands with ms alias
praetoriansentry Apr 20, 2026
c222ad8
feat(heimdall): add validator query subcommands with val alias
praetoriansentry Apr 20, 2026
14f27c1
docs(heimdall): regenerate CLI docs for validator subcommands
praetoriansentry Apr 20, 2026
608ddaa
chore(heimdall): capture clerk L1-unreachable and pagination fixtures
praetoriansentry Apr 20, 2026
7bd0325
feat(heimdall): add state-sync (clerk) query subcommands
praetoriansentry Apr 20, 2026
fe24b22
chore(heimdall): add topup REST fixtures for unit tests
praetoriansentry Apr 20, 2026
2303577
feat(heimdall): add topup umbrella command
praetoriansentry Apr 20, 2026
8cc5358
test(heimdall): add topup unit + integration tests
praetoriansentry Apr 20, 2026
b2df63d
chore(heimdall): add chainmanager REST fixtures for unit tests
praetoriansentry Apr 20, 2026
3eac6f3
feat(heimdall): add chainmanager umbrella command
praetoriansentry Apr 20, 2026
3d6eaa0
test(heimdall): add chainmanager unit + integration tests
praetoriansentry Apr 20, 2026
53fde24
feat(heimdall): add util umbrella command
praetoriansentry Apr 20, 2026
9e6a1d2
test(heimdall): add util unit + integration tests
praetoriansentry Apr 20, 2026
6632785
chore(heimdall): add ops CometBFT RPC fixtures for unit tests
praetoriansentry Apr 20, 2026
ee14ace
feat(heimdall): add ops umbrella command for CometBFT RPC surface
praetoriansentry Apr 20, 2026
b01aa44
test(heimdall): add ops unit + integration tests
praetoriansentry Apr 20, 2026
d544117
feat(heimdall): add wallet command group for local keystore management
praetoriansentry Apr 20, 2026
922db39
feat(heimdall): vendor narrow Cosmos SDK tx proto wire types
praetoriansentry Apr 20, 2026
27b37de
feat(heimdall): add shared transaction builder with broadcast/simulate
praetoriansentry Apr 20, 2026
07dbf50
test(heimdall): add tx builder unit + integration tests
praetoriansentry Apr 20, 2026
d0f734c
feat(heimdall): add mktx/send/estimate umbrellas with msg registry
praetoriansentry Apr 20, 2026
6e0aae5
feat(heimdall): add withdraw msg subcommand
praetoriansentry Apr 20, 2026
8faae67
test(heimdall): unit and integration tests for mktx/send/estimate
praetoriansentry Apr 20, 2026
6078ef8
feat(heimdall): add proto Msg types for checkpoint/bor/stake/clerk/topup
praetoriansentry Apr 20, 2026
bbba078
feat(heimdall): add Msg wrappers and L1-mirroring guard entries
praetoriansentry Apr 20, 2026
b0359fa
feat(heimdall): add per-Msg subcommands for W4 modules
praetoriansentry Apr 20, 2026
ce25215
feat(heimdall): add offline decode umbrella with tx/msg/hash-tx/ve
praetoriansentry Apr 20, 2026
e3befb5
test(heimdall): cover W4 proto, subcommands, and decoders
praetoriansentry Apr 20, 2026
23bfc88
feat(heimdall): add --watch DURATION to all read-only subcommands
praetoriansentry Apr 20, 2026
292bfed
feat(heimdall): map errors to cast-style exit codes
praetoriansentry Apr 20, 2026
1caae57
refactor(heimdall): consolidate wallet helpers into internal/heimdall…
praetoriansentry Apr 20, 2026
d1b94e4
docs(heimdall): trim command Short descriptions
praetoriansentry Apr 20, 2026
0ab7ac5
docs(heimdall): regenerate CLI docs for W5 changes
praetoriansentry Apr 20, 2026
2d687a2
docs(heimdall): add operator-facing quick-start guide
praetoriansentry Apr 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Note: Do not modify this section! It is auto-generated by `cobra` using `make ge

- [polycli hash](doc/polycli_hash.md) - Provide common crypto hashing functions.

- [polycli heimdall](doc/polycli_heimdall.md) - Query and interact with a Heimdall v2 node.

- [polycli loadtest](doc/polycli_loadtest.md) - Run a generic load test against an Eth/EVM style JSON-RPC endpoint.

- [polycli metrics-to-dash](doc/polycli_metrics-to-dash.md) - Create a dashboard from an Openmetrics / Prometheus response.
Expand Down
46 changes: 46 additions & 0 deletions cmd/heimdall/chain/age.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package chain

import (
"fmt"

"github.com/spf13/cobra"

"github.com/0xPolygon/polygon-cli/internal/heimdall/render"
)

// newAgeCmd builds `age [HEIGHT]`. Prints the block timestamp via
// the shared timestamp helper, matching `cast age`.
func newAgeCmd() *cobra.Command {
return &cobra.Command{
Use: "age [HEIGHT]",
Short: "Show the timestamp of a CometBFT block.",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
rpc, _, err := newRPCClient(cmd)
if err != nil {
return err
}
heightArg := ""
if len(args) == 1 {
heightArg = args[0]
}
height, err := resolveHeight(cmd.Context(), rpc, heightArg)
if err != nil {
return err
}
blk, raw, err := fetchBlock(cmd.Context(), rpc, height)
if err != nil {
return err
}
if raw == nil {
return nil
}
unix, err := unixFromRFC3339Nano(blk.Block.Header.Time)
if err != nil {
return err
}
_, err = fmt.Fprintln(cmd.OutOrStdout(), render.AnnotateUnixSeconds(unix))
return err
},
}
}
83 changes: 83 additions & 0 deletions cmd/heimdall/chain/block.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package chain

import (
"encoding/json"
"fmt"

"github.com/spf13/cobra"

"github.com/0xPolygon/polygon-cli/internal/heimdall/render"
)

// newBlockCmd builds the `block [HEIGHT]` command (alias `bl`). The
// HEIGHT arg accepts an integer, `latest`, or `earliest`. Default
// output is the summary keys chain_id/height/time/proposer/num_txs;
// --full includes the tx list.
func newBlockCmd() *cobra.Command {
var full bool
var fields []string
cmd := &cobra.Command{
Use: "block [HEIGHT]",
Aliases: []string{"bl"},
Short: "Show a CometBFT block by height (or latest).",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
rpc, cfg, err := newRPCClient(cmd)
if err != nil {
return err
}
ctx := cmd.Context()

heightArg := ""
if len(args) == 1 {
heightArg = args[0]
}
height, err := resolveHeight(ctx, rpc, heightArg)
if err != nil {
return err
}
blk, raw, err := fetchBlock(ctx, rpc, height)
if err != nil {
return err
}
if raw == nil {
return nil // --curl
}

opts := renderOpts(cmd, cfg, fields)

// --json passes through the full result with render's
// byte-field normalization.
if opts.JSON {
var generic any
if err := json.Unmarshal(raw, &generic); err != nil {
return fmt.Errorf("decoding block for json: %w", err)
}
return render.RenderJSON(cmd.OutOrStdout(), generic, opts)
}

out := map[string]any{
"chain_id": blk.Block.Header.ChainID,
"height": blk.Block.Header.Height,
"time": blk.Block.Header.Time,
"proposer": "0x" + blk.Block.Header.ProposerAddress,
"num_txs": len(blk.Block.Data.Txs),
"hash": "0x" + blk.BlockID.Hash,
}
if full {
out["txs"] = blk.Block.Data.Txs
}
if err := render.RenderKV(cmd.OutOrStdout(), out, opts); err != nil {
return err
}
// Hint path: zero-proposer is the only generic trigger
// DetectHints can spot on a block summary.
hints := render.DetectHints(out)
return render.WriteHints(cmd.ErrOrStderr(), hints, opts)
},
}
f := cmd.Flags()
f.BoolVar(&full, "full", false, "include the full tx list in output")
f.StringArrayVarP(&fields, "field", "f", nil, "pluck one or more fields (repeatable)")
return cmd
}
37 changes: 37 additions & 0 deletions cmd/heimdall/chain/blocknumber.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package chain

import (
"fmt"

"github.com/spf13/cobra"
)

// newBlockNumberCmd builds `block-number` (alias `bn`). Prints
// /status.sync_info.latest_block_height as a bare integer, matching
// `cast block-number`.
func newBlockNumberCmd() *cobra.Command {
return &cobra.Command{
Use: "block-number",
Aliases: []string{"bn"},
Short: "Print the latest CometBFT block height.",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
rpc, _, err := newRPCClient(cmd)
if err != nil {
return err
}
st, err := fetchStatus(cmd.Context(), rpc)
if err != nil {
return err
}
if st == nil {
return nil // --curl
}
if st.SyncInfo.LatestBlockHeight == "" {
return fmt.Errorf("status did not contain latest_block_height")
}
_, err = fmt.Fprintln(cmd.OutOrStdout(), st.SyncInfo.LatestBlockHeight)
return err
},
}
}
Loading
Loading