What problem does your feature solve?
Developers frequently need to convert between different Soroban type representations, especially when using tools like Stellar Lab that require exact hex encoding. Currently, there's an inconsistency: Stellar CLI automatically handles type conversions during contract invocations (e.g., accepting "ABCD" for a BytesN<32> parameter), but there's no standalone command to perform these conversions independently.
Common scenarios: converting strings to BytesN<32> hex format for use in Stellar Lab, encoding addresses to bytes, decoding hex values back to human-readable formats, preparing parameters for contract calls or inspection.
What would you like to see?
Encoding/decoding commands added to the Stellar CLI:
# Encode example
stellar contract encode --type bytes-n-32 --value "ABCD"
# Output: 4142434400000000000000000000000000000000000000000000000000000000
# Decode example
stellar contract decode --type bytes-n-32 --value "4142434400000000000000000000000000000000000000000000000000000000"
# Output: ABCD (or hex if not valid UTF-8)
This would reduce friction when switching between CLI and Lab and would improve developer experience.
What alternatives are there?
Using Python/Node/Unix commands, custom scripts or online converters.
What problem does your feature solve?
Developers frequently need to convert between different Soroban type representations, especially when using tools like Stellar Lab that require exact hex encoding. Currently, there's an inconsistency: Stellar CLI automatically handles type conversions during contract invocations (e.g., accepting "ABCD" for a BytesN<32> parameter), but there's no standalone command to perform these conversions independently.
Common scenarios: converting strings to BytesN<32> hex format for use in Stellar Lab, encoding addresses to bytes, decoding hex values back to human-readable formats, preparing parameters for contract calls or inspection.
What would you like to see?
Encoding/decoding commands added to the Stellar CLI:
This would reduce friction when switching between CLI and Lab and would improve developer experience.
What alternatives are there?
Using Python/Node/Unix commands, custom scripts or online converters.