This is actually something I'm able to reproduce manually, i.e. creating metadata with token name: "ギル" results in "������" being stored in metadata file. I believe this used to work fine...
Error messages
I think the error message could be improved a little bit. The message when someone is using decimal value that's out of range is OK:
$ token-metadata-creator entry 6b1b1cc20a8d37d1d7bea2ca5427335c7f4c586e70692333153ef38354455354444543494d414c5330 --name "DECIMALSCOIN" --description "Test Decimals" --policy /home/piotr/wb/tokens_minter/testnet/nft4_test/policy.script --decimals 256
option --decimals: Error in $: Decimal value must be in the range [0, 255] (inclusive)
But looking at some other examples:
$ token-metadata-creator entry ... --decimals "potato"
option --decimals: Error in $: Failed reading: not a valid json value
$ token-metadata-creator entry ... --decimals 0x
option --decimals: Error in $: endOfInput
$ token-metadata-creator entry ... --decimals 0.x
option --decimals: Error in $: Failed reading: takeWhile1
I think it would be much nicer if we display "Decimal value must be in the range [0, 255] (inclusive)" for every case when decimals are invalid. What do you think?
Regarding the error messages, I think that's a great idea. Aeson's (JSON handling library) default error messages are not good enough, even for those familiar with Aeson, let alone end-users.
ADP-915
Added in this PR:
3c0796dd31a357f69d95bcb6da8c749f042dee54 Test for decimals range
54e3a4e1070befa16a1f035ba5f089cdc30173ca Update acceptance test
@sevanspowell I've been adding some additional tests and stumbled upon two issues, see below:
Issues:
This is actually something I'm able to reproduce manually, i.e. creating metadata with token name: "ギル" results in "������" being stored in metadata file. I believe this used to work fine...
I think the error message could be improved a little bit. The message when someone is using decimal value that's out of range is OK:
But looking at some other examples:
I think it would be much nicer if we display "Decimal value must be in the range [0, 255] (inclusive)" for every case when decimals are invalid. What do you think?