Skip to content

dispatchUpdateRegistryToChain

dispatchUpdateRegistryToChain(registryDetails, authorAccount): Promise<object>

Dispatches a request to update an existing registry on the CORD blockchain.

This function checks if the specified registry exists. If it does not exist, an error is thrown. If the registry is found, it updates the registry with the new details provided and submits the transaction to the chain.

Parameters

registryDetails: IRegistryUpdate

An object containing the details required to update the registry, including:

  • uri: The unique identifier for the registry to be updated.
  • namespaceAuthorizationUri: The URI for the associated namespace authorization.
  • authorizationUri: The URI for the associated authorization.
  • digest: A hash representing the updated content of the registry.
  • blob: Additional data related to the registry update.

authorAccount: CordKeyringPair

The account that will authorize the update of the registry.

Returns

Promise<object>

A promise that resolves to an object containing the updated registry’s URI, namespace & registry authorization URIs.

authorizationUri

authorizationUri: RegistryAuthorizationUri

uri

uri: RegistryUri

Throws

If the registry does not exist or if an error occurs while dispatching to the chain.

Example

// Example: Updating an existing registry
const updatedRegistry = await dispatchUpdateRegistryToChain({
uri: 'registry:cord:example_registry_uri',
namespaceAuthorizationUri: 'auth:cord:example_namespace_authorization_uri',
authorizationUri: 'auth:cord:example_authorization_uri',
digest: '0xdef456...',
blob: 'Updated registry data blob'
}, authorAccount);
console.log('Updated Registry URI:', updatedRegistry.uri);

Source

registries/src/Registries.chain.ts:279