buildFromProperties
buildFromProperties(
digest
,spaceUri
,creatorUri
,schemaUri
?):IStatementEntry
Constructs a IStatementEntry
object from given properties.
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.
• creatorUri: did:cord:3${string}
The DID URI 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
IStatementEntry
A fully constructed IStatementEntry
object.
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
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
Various errors from verifyDataStructure
if the created statement entry does not meet the validation criteria.
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.