Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / comments / decodeNumberValue

Function: decodeNumberValue()

function decodeNumberValue(encodedValue, isSigned): bigint;

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

Decodes a number value from encoded metadata bytes.

Be careful this returns only big ints, decimal numbers are not supported.

Parameters

encodedValue

`0x${string}`

The hex-encoded bytes (32 bytes big-endian)

isSigned

boolean = false

Whether the number is signed (for two's complement handling)

Returns

bigint

The decoded number value (as bigint for safety). If the value can't be decoded, it will return 0n.