Skip to content

Improve CLI output readability for payment types#122

Open
benthecarman wants to merge 1 commit intolightningdevkit:mainfrom
benthecarman:better-pretty-print
Open

Improve CLI output readability for payment types#122
benthecarman wants to merge 1 commit intolightningdevkit:mainfrom
benthecarman:better-pretty-print

Conversation

@benthecarman
Copy link
Collaborator

Convert payment enums and byte vectors to human-readable formats:

  • Payment direction/status now display as strings (e.g., "succeeded") instead of numbers
  • Byte vectors (payment secrets) now display as hex strings instead of number arrays

Kinda gets ugly recreating the Payment struct but allows us to print things better

before:

₿ ldk-server-cli list-payments 
{
  "payments": [
    {
      "id": "0bfd4050d9251e9c8dc14d4f59e579a47db055f649ad093ac9f463b38fc63daf",
      "kind": {
        "kind": {
          "bolt11": {
            "hash": "0bfd4050d9251e9c8dc14d4f59e579a47db055f649ad093ac9f463b38fc63daf",
            "preimage": "69172b32ae823751d37c7485c17ebb168f165b900435370dc267e6f71e381a66",
            "secret": [
              93,
              160,
              246,
              39,
              147,
              33,
              180,
              246,
              98,
              129,
              85,
              25,
              203,
              68,
              48,
              58,
              251,
              79,
              201,
              51,
              119,
              173,
              62,
              224,
              182,
              102,
              92,
              126,
              221,
              2,
              198,
              163
            ]
          }
        }
      },
      "amount_msat": 1000000000,
      "fee_paid_msat": 0,
      "direction": 1,
      "status": 1,
      "latest_update_timestamp": 1770412903
    }
  ]
}

after:

₿ ldk-server-cli list-payments 
{
  "list": [
    {
      "id": "0bfd4050d9251e9c8dc14d4f59e579a47db055f649ad093ac9f463b38fc63daf",
      "kind": {
        "bolt11": {
          "hash": "0bfd4050d9251e9c8dc14d4f59e579a47db055f649ad093ac9f463b38fc63daf",
          "preimage": "69172b32ae823751d37c7485c17ebb168f165b900435370dc267e6f71e381a66",
          "secret": "5da0f6279321b4f662815519cb44303afb4fc93377ad3ee0b6665c7edd02c6a3"
        }
      },
      "amount_msat": 1000000000,
      "fee_paid_msat": 0,
      "direction": "OUTBOUND",
      "status": "SUCCEEDED",
      "latest_update_timestamp": 1770412903
    }
  ]
}

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Feb 6, 2026

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@benthecarman benthecarman requested a review from tnull February 6, 2026 21:30
Convert payment enums and byte vectors to human-readable formats:
- Payment direction/status now display as strings (e.g., "succeeded") instead of numbers
- Byte vectors (payment secrets) now display as hex strings instead of number arrays

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.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

2 participants