Skip to content

Command hex format#717

Open
Lagrang3 wants to merge 14 commits into
Blockstream:mainfrom
Lagrang3:command-hex-format
Open

Command hex format#717
Lagrang3 wants to merge 14 commits into
Blockstream:mainfrom
Lagrang3:command-hex-format

Conversation

@Lagrang3
Copy link
Copy Markdown
Collaborator

@Lagrang3 Lagrang3 commented May 15, 2026

Added json outputs to gl-cli commands.

For example:

$ glcli --json node getinfo
{
  "address": [],
  "alias": "...",
  "binding": [],
  "blockheight": 949533,
  "color": "...",
  "fees_collected_msat": 0,
  "id": "...",
  "lightning_dir": "/tmp/bitcoin",
  "network": "bitcoin",
  "num_active_channels": 0,
  "num_inactive_channels": 0,
  "num_peers": 1,
  "num_pending_channels": 0,
  "our_features": {
    "channel": "",
    "init": "0898880a8a59a1",
    "invoice": "02000002024100",
    "node": "8898880a8a59a1"
  },
  "version": "v25.12gl1"
}

I did this by hand, for every possible gRPC response that we use, which are not all of CLN's commands.
I know this is not ideal, since we have no guarantee of correctedness by developer error or API changes and
as the number of gRPC commands grow this task becomes tedious.
But right now it is manageable and until we find a trick to make it automatic we can use this.

Lagrang3 added 14 commits May 15, 2026 08:42
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
and implemented the trait for GetinfoResponse
to have nice json outputs from glcli.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Sort out if we use the typical output or we print a json object.
Use a macro to avoid code repetition.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Though this implementation is trivial, notice that this command's
response is always failure when it should be success.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
Sign up for free to 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.

1 participant