soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

Add tx decode/encode subcommands

Open leighmcculloch opened this issue 11 months ago • 2 comments

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:

  • https://github.com/stellar/rs-stellar-xdr/pull/403

leighmcculloch avatar Dec 10 '24 12:12 leighmcculloch

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?

willemneal avatar Dec 10 '24 18:12 willemneal

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:

  • https://github.com/stellar/stellar-cli/issues/1643#issuecomment-2533725947

leighmcculloch avatar Dec 11 '24 06:12 leighmcculloch