dispatchCreateRegistryToChain
dispatchCreateRegistryToChain(
registryDetails
,authorAccount
):Promise
<object
>
Dispatches a request to create a new registry on the CORD blockchain.
This function checks if a registry already exists at the specified URI. If it does, an error is thrown. If the registry does not exist, it creates a new registry using the provided details and submits the transaction to the chain.
Parameters
• registryDetails: IRegistryCreate
An object containing the details required to create the registry, including:
uri
: The unique identifier for the registry.namespaceAuthorizationUri
: The URI for the associated namespace authorization.authorizationUri
: The URI for the associated authorization.digest
: A hash representing the registry’s content.schemaId
: The identifier for the schema used.blob
: Additional data related to the registry.
• authorAccount: CordKeyringPair
The account that will authorize the creation of the registry.
Returns
Promise
<object
>
A promise that resolves to an object containing the created registry’s URI namespace auth URI and registry authorization URI.
authorizationUri
authorizationUri:
RegistryAuthorizationUri
uri
uri:
RegistryUri
Throws
If the registry already exists or if an error occurs while dispatching to the chain.
Example
// Example: Creating a new registryconst newRegistry = await dispatchCreateRegistryToChain({ uri: 'registry:cord:example_registry_uri', namespaceAuthorizationUri: 'auth:cord:example_namespace_authorization_uri', authorizationUri: 'auth:cord:example_authorization_uri', digest: '0xabc123...', schemaId: 'schema:cord:example_schema_id', blob: 'Registry data blob'}, authorAccount);console.log('Created Registry URI:', newRegistry.uri);