Skip to content

buildFromReviseRatingProperties

buildFromReviseRatingProperties(rating, chainSpace, authorUri): Promise<object>

Constructs a revised entry for a previously amended rating on the blockchain.

This asynchronous function is responsible for building a rating object from revised rating properties. It takes a rating entry, chain space URI, and author URI as parameters and returns a promise resolving to an object containing the URI of the rating entry and its details. It verifies the signature of the amended rating, validates required fields, and generates the necessary signatures for the revised entry. This is essential for maintaining the integrity and trustworthiness of the rating system, especially in decentralized environments.

This function is specifically designed for use by Rating Authors or Ledger/API Providers.

Parameters

rating: IRatingEntry

The rating revise entry to process. This includes the original rating’s digest, signature, and other relevant details.

chainSpace: space:cord:${string}

The identifier of the blockchain space (as a URI) where the rating is being revised. This helps in pinpointing the exact location on the blockchain where the rating resides.

authorUri: did:cord:3${string}

The Decentralized Identifier (DID) URI of the author who is revising the rating. This identifier is crucial for associating the revocation with the correct author.

Returns

Promise<object>

A promise resolving to an object with the following structure: uri: The URI of the rating entry. details: An object containing the details of the rating dispatch, including the entry and other metadata.

details

details: IRatingDispatch

uri

uri: RatingEntryUri

Throws

  • if there is an error during the transformation process.

Example

try {
const result = await buildFromReviseRatingProperties(ratingEntry, chainSpaceUri, authorUri);
console.log("Rating entry URI:", result.uri);
console.log("Rating details:", result.details);
} catch (error) {
console.error("Error building rating from revised properties:", error);
}

Source

network-score/src/Scoring.ts:489