@midnight-ntwrk/midnight-js-contracts v0.1.15 • API
Midnight.js API Reference v0.1.15 / @midnight-ntwrk/midnight-js-contracts / utils / parseHex
Function: parseHex()
parseHex(
source
):ParsedHexString
Parses a string as a hex-encoded string.
Parameters
• source: string
The source string to parse.
Returns
A ParsedHexString describing the parsed elements of source
.
Example
parseHex('Hello') =>
{
hasPrefix: false,
incompleteChars: 'Hello'
}
Example
parseHex('ab12e') =>
{
hasPrefix: false,
byteChars: 'ab12'
incompleteChars: 'e'
}
Example
parseHex('0xab12') =>
{
hasPrefix: true,
byteChars: 'ab12'
incompleteChars: ''
}