updateRegistryEntryUri
updateRegistryEntryUri(
registryEntryUri,digest):EntriesUri
Updates the digest component of a given registry entry URI with a new digest.
Parameters
Section titled “Parameters”• registryEntryUri: `entry:cord:${string}`
The original registry entry URI to be updated. Format: ‘entry:cord:
• digest: HexString
The new hexadecimal string digest to be inserted into the URI. Must start with ‘0x’.
Returns
Section titled “Returns”EntriesUri
The updated registry entry URI with the new digest.
Remarks
Section titled “Remarks”This function modifies an existing registry entry URI by replacing its digest with a new provided digest. It ensures that the URI retains its original structure and prefix, while only the digest part is updated.
Example
Section titled “Example”const originalUri = 'entry:cord:1234:abcd';const newDigest = '0x5678...';const updatedUri = updateRegistryEntryUri(originalUri, newDigest);console.log('Updated Registry Entry URI:', updatedUri);Throws
Section titled “Throws”If the registryEntryUri does not follow the expected format.
Throws
Section titled “Throws”If the new digest does not start with ‘0x’.
Description
Section titled “Description”The function splits the registryEntryUri and validates its structure. If valid, it replaces the digest with the new one.
The updated URI is constructed with the new digest (without ‘0x’ prefix) and returned.