Skip to content

isSchemaStored

isSchemaStored(schema): Promise<boolean>

Checks if a given schema is stored on the blockchain. This function queries the blockchain to determine whether the specified schema exists in the blockchain storage.

Parameters

schema: ISchema

The schema object (ISchema) to be checked. It must contain a valid $id property.

Returns

Promise<boolean>

A promise that resolves to a boolean value. It returns true if the schema is stored on the blockchain, and false if it is not.

Example

const stored = await isSchemaStored(mySchema);
if (stored) {
console.log('Schema is stored on the blockchain.');
} else {
console.log('Schema is not stored on the blockchain.');
}

Source

schema/src/Schema.chain.ts:77