status-im/nim-stew

byteutils - cannot instantiate: 'N'

Closed this issue · 3 comments

Hey,

i just tried to use the function hexToByteArray from byteutils which throws the following error:

\stew-0.1.0\stew\byteutils.nim(61, 22) Error: cannot instantiate: 'N'

Some idea how to fix this?

Greetings

fromHex() runs fine but returns an byte sequence. I'm actually needing a byte array like this

var bytearray: array[22, byte]

Ok i didn´t need the mentioned array, a byte sequence was fine :)

hexToByteArray offers 3 variants, one of them requires N to be specified at compile time. e.g. hexToByteArray[22](hexStr).

But you can also use:

var bytearray: array[22, byte]
hexToByteArray(hexStr, bytearray)

# or

hexToByteArray(hexStr, bytearray, 0, bytearray.high)