Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / comments / createMetadataKey

Function: createMetadataKey()

function createMetadataKey(keyString, valueType): `0x${string}`;

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

Creates a metadata key by encoding a string in the format "type key".

Parameters

keyString

string

The key string (e.g., "status", "author", "url")

valueType

MetadataType

The type of the value MetadataType

Returns

`0x${string}`

The hex-encoded bytes of the "type key" string of length 32 bytes padded from the left with leading zeros.

Throws

If the value type + key string exceeds 32 bytes