Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tx decode/encode subcommands #1785

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Add tx decode/encode subcommands #1785

wants to merge 6 commits into from

Conversation

leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Dec 10, 2024

What

Add tx decode and encode subcommands.

Why

To make decoding tx's to JSON more discoverable and convenient. It's the most common XDR to want to decode.

Including encode for symmetry.

Dependent on:

@leighmcculloch leighmcculloch changed the title Add tx decode subcommand Add tx decode/encode subcommands Dec 10, 2024
@willemneal
Copy link
Member

I just had this same idea. This could be very useful for the tx edit functionality. E.g.

{
    "tx": {
      "tx": {
        "source_account":  "alice",
        "fee": 5000,
        "seq_num": 61499636711945,
        "cond": {
          "time": {
            "min_time": 0,
            "max_time": 1733772281
          }
        },
        "memo": {
          "text": "Load lumens"
        },
        "operations": [
          {
            "source_account": null,
            "body": {
              "payment": {
                "destination": "bob",
                "asset": "native", // could also handle `usdc:cicle` here
                "amount": 50000000
              }
            }
          }
        ],
        "ext": "v0"
      },
      "signatures": [
        {
          "hint": "26f802ad",
          "signature": "b26cde9fc068173241013279207343d17124488de0d44e43858faab093aca30efee4dbbce8a9fd96b11b7e36bd21db355c77fbe9bc2c493545b1bf19e31f5109"
        }
      ]
    }
  }

Perhaps we could add a tx update, which would then resolve all of the accounts and also maybe update the seq_num and fees?

@leighmcculloch
Copy link
Member Author

leighmcculloch commented Dec 11, 2024

Perhaps we could add a tx update, which would then resolve all of the accounts and also maybe update the seq_num and fees?

+1. Replying to this over here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog (Not Ready)
Development

Successfully merging this pull request may close these issues.

2 participants