Skip to content

Commit

Permalink
scoring interfaces and demo (#148)
Browse files Browse the repository at this point in the history
* scoring and augument-api updates
  • Loading branch information
smohan-dw authored Dec 4, 2023
1 parent fbe19bb commit 01ed31c
Show file tree
Hide file tree
Showing 27 changed files with 1,710 additions and 625 deletions.
30 changes: 30 additions & 0 deletions demo/res/network-rating.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$metadata": {
"version": "1.0.0",
"slug": "ondc-network-rating-demo-schema",
"discoverable": true
},
"title": "ONDC Network Rating Schema v1",
"description": "Test Schema",
"properties": {
"entityUid": { "type": "string" },
"entityId": { "type": "string" },
"providerUid": { "type": "string" },
"providerId": { "type": "string" },
"entityType": {
"type": "string",
"enum": ["Retail", "Logistic"]
},
"ratingType": {
"type": "string",
"enum": ["Overall", "Delivery"]
},
"referenceId": { "type": "string" },
"countOfTxn": { "type": "number" },
"totalRating": { "type": "number" }
},
"required": ["entityUid", "entityId", "providerUid", "providerId", "entityType", "ratingType", "countOfTxn", "totalRating"],
"additionalProperties": false,
"type": "object"
}
14 changes: 7 additions & 7 deletions demo/src/func-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createDid } from './utils/generateDid'
import { createDidName } from './utils/generateDidName'
import { getDidDocFromName } from './utils/queryDidName'
import { randomUUID } from 'crypto'
import { addAuthority } from './utils/createAuthorities'
import { addNetworkMember } from './utils/createAuthorities'
import { createAccount } from './utils/createAccount'

import {
Expand Down Expand Up @@ -37,14 +37,14 @@ async function main() {
console.log(
`🏦 Member (${authorityIdentity.type}): ${authorityIdentity.address}`
)
await addAuthority(authorityAuthorIdentity, authorityIdentity.address)
await addNetworkMember(authorityAuthorIdentity, authorityIdentity.address)
await setRegistrar(authorityAuthorIdentity, authorityIdentity.address)
console.log('✅ Network Authority created!')

// Setup network member account.
const { account: authorIdentity } = await createAccount()
console.log(`🏦 Member (${authorIdentity.type}): ${authorIdentity.address}`)
await addAuthority(authorityAuthorIdentity, authorIdentity.address)
await addNetworkMember(authorityAuthorIdentity, authorIdentity.address)
console.log(`🔏 Member permissions updated`)
await setIdentity(authorIdentity)
console.log(`🔏 Member identity info updated`)
Expand Down Expand Up @@ -270,7 +270,7 @@ async function main() {
credHash,
space.uri,
issuerDid.uri,
schemaUri
schemaUri as Cord.SchemaUri
)
console.dir(statementEntry, {
depth: null,
Expand Down Expand Up @@ -327,7 +327,7 @@ async function main() {
credHash,
issuerDid.uri,
space.uri,
schemaUri
schemaUri as Cord.SchemaUri
)

if (verificationResult.isValid) {
Expand Down Expand Up @@ -359,7 +359,7 @@ async function main() {
updatedStatementEntry.elementUri,
delegateTwoDid.uri,
authorIdentity,
delegateAuth,
delegateAuth as Cord.AuthorizationUri,
async ({ data }) => ({
signature: delegateTwoKeys.authentication.sign(data),
keyType: delegateTwoKeys.authentication.type,
Expand Down Expand Up @@ -390,7 +390,7 @@ async function main() {
updatedStatementEntry.elementUri,
delegateTwoDid.uri,
authorIdentity,
delegateAuth,
delegateAuth as Cord.AuthorizationUri,
async ({ data }) => ({
signature: delegateTwoKeys.authentication.sign(data),
keyType: delegateTwoKeys.authentication.type,
Expand Down
Loading

0 comments on commit 01ed31c

Please sign in to comment.