4 releases

0.1.3 Sep 17, 2024
0.1.2 Sep 16, 2024
0.1.1 Sep 16, 2024
0.1.0 Sep 16, 2024

#11 in #convert-hex

Download history 366/week @ 2024-09-12 73/week @ 2024-09-19 30/week @ 2024-09-26 18/week @ 2024-10-03

487 downloads per month

MIT license

9KB
130 lines

Starknet Converter CLI

A command-line interface tool for converting between different data types commonly used in the Starknet blockchain ecosystem.

Features

  • Convert between hexadecimal, felt (field element), and short string representations
  • Easy-to-use CLI with intuitive options
  • Robust error handling and informative error messages
  • Support for various input formats

Installation

To install please use the cargo install command:

cargo install snconvert

This will install the CLI tool directly from crates.io

Usage

The basic syntax for using the Starknet Converter CLI is:

snconvert <INPUT> [OPTIONS]

Where <INPUT> is the value you want to convert, and [OPTIONS] are the conversion options you want to apply.

Options

  • -x, --hex: Display the hexadecimal representation
  • -f, --felt: Display the felt (field element) representation
  • -s, --string: Display the short string representation

If no options are specified, the tool will display all available representations.

Examples

  1. Convert a hexadecimal value:

    snconvert 0x6869 -f -s
    
  2. Convert a felt value:

    snconvert 310939249775 -x -s
    
  3. Convert a short string:

    snconvert 'Hello, Starknet!' -x -f
    
  4. Display all representations:

    snconvert 0x48656c6c6f20576f726c6421
    

Error Handling

The Starknet Converter CLI includes robust error handling to help you identify issues with your input:

  • Invalid input format
  • String too long (max 31 characters for Starknet short strings)
  • Non-ASCII characters in short string input
  • Invalid hexadecimal format

If an error occurs, the tool will display a helpful error message explaining the issue.

Contributing

Contributions to the Starknet Converter CLI are welcome! Please feel free to submit pull requests, create issues, or suggest new features.


For installation instructions, please see the Installation section above.

Dependencies

~11MB
~195K SLoC