Skip to main content
Version: v3.x

Minimal Anti Collusion Infrastructure (MACI) / createCidFromObject

Function: createCidFromObject()

createCidFromObject<T>(data): Promise<string>

Defined in: packages/sdk/ts/utils/cid.ts:27

Creates a CID (Content Identifier) from an object by encoding the object into JSON and hashing it using the SHA-256 algorithm, and then creating a CID using the Multiformats CID library.

Type Parameters

T

Parameters

data

T

The input object to be encoded and hashed to generate the CID.

Returns

Promise<string>

A CID generated from the hashed JSON-encoded object.