Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / comments / decodeMetadataKey

Function: decodeMetadataKey()

function decodeMetadataKey(key): MetadataKeyDefinition;

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

Decodes a metadata key from a hex-encoded key

Parameters

key

`0x${string}`

The hex-encoded key

Returns

MetadataKeyDefinition

The decoded metadata key

Throws

If the metadata type is unknown

Throws

If the key is not a valid hex string

Example

const decodedKey = decodeMetadataKey("0x0000000000000000000000000000000000000000737472696e67207469746c65");
console.log(decodedKey);
// { key: "title", type: "string" }