Skip to content

isRatingStored

isRatingStored(ratingUri): Promise<boolean>

Checks if a specific rating is stored in the blockchain.

This asynchronous function is used to determine whether a particular rating, identified by its URI, is stored in the blockchain. It queries the blockchain using a provided rating URI to verify the existence of the rating. This function is essential for validation processes where the presence of a rating in the blockchain needs to be confirmed. It is commonly used in scenarios where the integrity and existence of ratings are crucial, such as in verifying claims or during audits.

Parameters

ratingUri: rating:cord:${string}

The URI of the rating entry to be checked. This URI is used to identify the rating in the blockchain.

Returns

Promise<boolean>

  • A promise that resolves to a boolean value:
    • true if the rating is found in the blockchain.
    • false if the rating is not found.

Throws

  • Thrown if there’s an error during the querying process, such as network issues or problems with the query construction.

Example

// Example usage of the function
const ratingUri = 'ratingUri123';
try {
const isStored = await isRatingStored(ratingUri);
console.log('Is the rating stored?', isStored);
} catch (error) {
console.error('Error checking if rating is stored:', error);
}

Source

network-score/src/Scoring.chain.ts:86