Skip to content

@ecp.eth/sdk


@ecp.eth/sdk / comments / createMetadataEntries

Function: createMetadataEntries()

function createMetadataEntries(metadata): MetadataEntry[];

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

Creates multiple metadata entries from an object with explicit types

Parameters

metadata

Record<string, { type: MetadataType; value: | string | boolean | number | bigint | JsonObject; }>

An object with key-value pairs and their types

Returns

MetadataEntry[]

Array of MetadataEntry

Example

const metadata = {
  "status": {
    type: "string",
    value: "status",
  },
};
const metadataEntries = createMetadataEntries(metadata);
console.log(metadataEntries);
// [
//   {
//     key: "0x0000000000000000000000000000000000000000000000000000000000000000",
//     value: "0x0000000000000000000000000000000000000000000000000000000000000000",
//   },
// ]