Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / comments / decodeStringValue

Function: decodeStringValue()

function decodeStringValue(encodedValue): Json;

Defined in: packages/sdk/src/comments/metadata.ts:184

Decodes a string value from encoded metadata bytes.

If the string is valid JSON value, it returns the parsed JSON value. Otherwise it returns string.

Parameters

encodedValue

`0x${string}`

The hex-encoded bytes

Returns

Json

The decoded string value. If the value can't be decoded, it will return an empty string.