Skip to content

prepareCreateExtrinsic

prepareCreateExtrinsic(schema): Promise<SubmittableExtrinsic>

Prepares a blockchain transaction to store a schema on-chain.

This function creates an extrinsic for the blockchain transaction to store a schema. It encodes the schema using CBOR serialization and creates an extrinsic for the blockchain transaction to store the schema. The extrinsic is prepared for submission to the blockchain.

Parameters:

Parameters

schema: ISchema

The schema object to be stored on-chain. It should conform to the ISchema interface used in the Cord network.

Returns:

Returns

Promise<SubmittableExtrinsic>

A promise that resolves to a SubmittableExtrinsic object representing the blockchain transaction to store the schema. The extrinsic is ready for signing and submission to the blockchain.

Example Usage:

const schema = { title: 'Example Schema', properties: { id: { type: 'string' } } };
const extrinsic = await prepareCreateExtrinsic(schema);

Source

schema/src/Schema.chain.ts:220