IntersectMBO / bech32

Haskell implementation of the Bech32 address format (BIP 0173).
Apache License 2.0
44 stars 13 forks source link

bech32 command line #20

Closed KtorZ closed 4 years ago

KtorZ commented 4 years ago
piotr-iohk commented 4 years ago

Some suggestions:

Available options: -h,--help Show this help text PREFIX A human-readable prefix (e.g. 'addr').

Examples: Convert from bech32 to base16: bech32 <<< addr1qzpy4tmfe838pu5zaly90d2tqee2j9vyfurjew5veuu7wx3n7hfkxy3hly0rtt5str0c3ax62c8xu33j50mx64fd600u477qj43ayv4630526j

Convert from base16 to bech32: bech32 addr <<< 00824aaf69c9e270f282efc857b54b0672a915844f072cba8ccf39e71a33f5d3631237f91e35ae9058df88f4da560e6e4632a3f66d552dd3dfcafbc09563d232ba

Convert from base58 to bech32: bech32 addr <<< Ae2tdPwUPEYyDf8J4KQNr1ZPw26iyn9JU9dHWTAxNEaNbi8VDNDTBmjQuXj

 - Nicer error message (when required prefix is missing), currently there is:

$ bech32 <<< 00824aaf69c9e270f282efc857b54b0672a915844f072cba8ccf39e71a33f5d3631237f91e35ae9058df88f4da560e6e4632a3f66d552dd3dfcafbc09563d232ba bech32: user error (StringToDecodeContainsInvalidChars [CharPosition 117,CharPosition 128])

$ bech32 <<< Ae2tdPwUPEYyDf8J4KQNr1ZPw26iyn9JU9dHWTAxNEaNbi8VDNDTBmjQuXj bech32: user error (StringToDecodeHasMixedCase)

rvl commented 4 years ago

If the goal here is a MVP (not sure though, is there a jira ticket?) then ugly error messages and other rough edges are fine.

But tests would be easy to do and should be added.

KtorZ commented 4 years ago

@rvl indeed that is just an MVP / quick'n'dirty draft, not sure why it got the attention of three of you :s I wrote this n half an hour while waiting for a bors build to complete, hence the absence of tests and polish on the interface. This may come later -- perhaps.