buildFromProperties
buildFromProperties(
digest,spaceUri,creatorAddress,schemaUri?):IStatementEntryAccountType
Constructs a IStatementEntry object from given properties.
Parameters
Section titled “Parameters”• digest: HexString
The hexadecimal string representing the digest of the statement.
• spaceUri: `space:cord:${string}`
The URI of the ChainSpace associated with the statement.
• creatorAddress: string
The address of the statement’s creator.
• schemaUri?: `schema:cord:${string}`
(Optional) The URI of the schema linked to the statement. Defaults to undefined if not provided.
Returns
Section titled “Returns”IStatementEntryAccountType
A fully constructed IStatementEntry object.
Remarks
Section titled “Remarks”This function creates a statement entry in the CORD blockchain system. It takes various identifiers and
assembles them into a structured object that conforms to the IStatementEntry interface. It also ensures
that the created object adheres to the required data structure through validation.
Example
Section titled “Example”const digest = '0x123...';const spaceUri = 'space:cord:example_uri';const creatorUri = 'did:cord:creator_uri';const schemaUri = 'schema:cord:schema_uri';const statementEntry = buildFromProperties(digest, spaceUri, creatorUri, schemaUri);console.log('Statement Entry:', statementEntry);Throws
Section titled “Throws”Various errors from verifyDataStructure if the created statement entry does not meet the validation criteria.
Description
Section titled “Description”The function first calls getUriForStatement to generate a statement URI using the provided digest, spaceUri, and creatorUri.
It then assembles these properties, along with the optional schemaUri, into an object conforming to the IStatementEntry interface.
The verifyDataStructure function is subsequently called to validate the integrity and structure of the created statement entry.
If validation passes, the function returns the constructed IStatementEntry object.