stellar / rs-stellar-xdr

Rust lib for Stellar XDR.
Apache License 2.0
20 stars 27 forks source link

Add encode subcommand to cli #311

Closed leighmcculloch closed 1 year ago

leighmcculloch commented 1 year ago

What

Add encode subcommand to cli that converts JSON into XDR.

❯ printf '{
  "updated_entry": [
    {
      "contract_max_size_bytes": 2011
    },
    {
      "contract_compute_v0": {
        "ledger_max_instructions": 2500011,
        "tx_max_instructions": 2500011,
        "fee_rate_per_instructions_increment": 111,
        "tx_memory_limit": 2000011
      }
    }
  ]
}' | stellar-xdr encode --type ConfigUpgradeSet
AAAAAgAAAAAAAAfbAAAAAQAAAAAAJiWrAAAAAAAmJasAAAAAAAAAbwAehIs=

Why

The stellar-xdr CLI can convert XDR to JSON. It would be helpful to be able to convert JSON into XDR going in the reverse direction.