Skip to content

dispatchRestoreToChain

dispatchRestoreToChain(registryUri, namespaceAuthorizationUri, authorizationUri, authorAccount): Promise<object>

Dispatches a request to restore a already archived 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 restores the specified registry and submits the transaction to the chain.

Parameters

registryUri: `registry:cord:${string}`

The URI of the registry to be restored.

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

authorizationUri: `registryauth:cord:${string}`

The URI of the authorization associated with the registry.

authorAccount: CordKeyringPair

The account that will authorize the restoration of the registry.

Returns

Promise<object>

A promise that resolves to an object containing the restored registry’s URI, namespace and 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: Restore a registry
const restoredRegistry = await dispatchRestoreToChain(
'registry:cord:example_registry_uri',
'auth:cord:example_namespace_authorization_uri',
'auth:cord:example_authorization_uri',
authorAccount
);
console.log('Restored Registry URI:', restoredRegistry.uri);

Source

registries/src/Registries.chain.ts:563