Skip to content

registryCreateProperties

registryCreateProperties(creatorAddress, namespaceAuthorizationUri, digest, schemaUri, blob): Promise<IRegistryCreate>

Creates properties for a new registry, including the registry URI, creator URI, digest, and the optionally serialized and CBOR-encoded blob.

This function requires either a digest or a blob to generate the registry properties. If a blob is provided without a digest, the digest will be computed from the serialized blob. The blob will be CBOR-encoded before dispatching to the blockchain.

If only digest is provided, it will be dispatched as is into CORD Registry.

If both digest and blob are provided, the function will:

  • Validate the blob for serialization.
  • Encode the blob in CBOR before dispatching it.
  • Use the existing digest as-is for the registry creation process, without computing a new digest from the blob.

Parameters

creatorAddress: string

The address of the creator initiating the registry creation.

namespaceAuthorizationUri: `namespaceauth:cord:${string}`

The authorization URI for the namespace.

digest: any= null

An optional hex string representing the digest. If not provided, it will be computed from the blob.

schemaUri: null | `schema:cord:${string}`= null

blob: null | string= null

An optional string representing the data to be stored in the registry.

Returns

Promise<IRegistryCreate>

A promise that resolves to an object containing the properties of the registry, including the URI, creator URI, digest, blob, schema ID, and namespace and registry authorization URIs.

Throws

If neither digest nor blob is provided, or if the digest is empty after processing.

Example

const registryProperties = await registryCreateProperties(
'5F3s...', // creatorAddress
null, // digest
'schemaId123', // schemaId
'{"key":"value"}' // blob
);
// registryProperties will contain the created registry properties.

Source

registries/src/Registries.ts:395