Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network-score: Augment-Api, Package, Demo Script updates to match ONDC specs #202

Merged
merged 4 commits into from
Apr 10, 2024

Conversation

vatsa287
Copy link
Member

@vatsa287 vatsa287 commented Apr 10, 2024

Changes on:

  • Augment API
  • Packages/Network-Score
  • Scripts/Network-Score-Tests (demo-script)

for changes made on CORD to match ONDC changes.

@amarts
Copy link
Member

amarts commented Apr 10, 2024

Some minor changes needed. Will review post those changes.

@vatsa287 vatsa287 force-pushed the score-augment-api branch from 92546a9 to 406e180 Compare April 10, 2024 10:10
@vatsa287 vatsa287 changed the title network-score: Augment-Api Updates for network-score type changes network-score: Augment-Api & Package Type updates to match ONDC specs Apr 10, 2024
@vatsa287
Copy link
Member Author

@amarts WIP, I'll remove commented code & request for review.

@vatsa287 vatsa287 force-pushed the score-augment-api branch from 406e180 to dca2436 Compare April 10, 2024 11:15
@vatsa287 vatsa287 changed the title network-score: Augment-Api & Package Type updates to match ONDC specs network-score: Augment-Api & Package, Demo Script updates to match ONDC specs Apr 10, 2024
@vatsa287
Copy link
Member Author

Test output with newer specs.

npx tsx src/network-score-test.ts 

🌐 Network Score Initial Setup

🎎 Particpants 
🔐 Network Member (sr25519): 3ydNZgC16DA8zKzxNwB6uW3ufoM4X373vRVpCWFTnAXzFff7
✅ Network Membership Approved! 🎉

🔐  Network Score Admin (sr25519): did:cord:3tyDctXoY1n9Tpq8BTvdWonXT4H1SBB8V94RrHjpeMbAjrz7
🔐  Network Participant (Provider) (sr25519): did:cord:3x9P35VRnfJ7ezQyjq1vM17eCbBxhUJ2Q7FiqYGJdUqtXthT
🔐 Network Author (API -> Node) (sr25519): did:cord:3xjjqi5CJ2mb6PoCJDM9NaZtHVqEganEwQrhTEioyYRh4MQs
✅ Network Members created! 🎉

🌐  Network Score Chain Space Creation 
{
  uri: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
  desc: 'ChainSpace v1.0b3c45b8-a726-4113-92c4-e75d2d105653',
  digest: '0x2c46c7f6d8fb0e473d74479ace7a368683390db170e05d765448375f1888e92a',
  creatorUri: 'did:cord:3tyDctXoY1n9Tpq8BTvdWonXT4H1SBB8V94RrHjpeMbAjrz7',
  authorizationUri: 'auth:cord:a3fx9rnVjBeBGHV7VihW2yfRG5E9XK6ugD2FXcX2Y72qmJDtZ'
}
✅ Chain Space created! 🎉

🌐  Chain Space Authorization (Author) 
{
  uri: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
  delegateUri: 'did:cord:3xjjqi5CJ2mb6PoCJDM9NaZtHVqEganEwQrhTEioyYRh4MQs',
  permission: 1,
  authorizationUri: 'auth:cord:a3eRfZncBqmHvijgUBoQB1FzJMP6Kv3N8bFwss9xVaxeuZ6Zt',
  delegatorUri: 'did:cord:3tyDctXoY1n9Tpq8BTvdWonXT4H1SBB8V94RrHjpeMbAjrz7'
}
✅ Chain Space Authorization Approved! 🎉

🌐  Query From Chain - Chain Space 
{
  uri: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
  creatorUri: 'did:cord:3tyDctXoY1n9Tpq8BTvdWonXT4H1SBB8V94RrHjpeMbAjrz7',
  txnCapacity: 1000,
  txnUsage: 1,
  approved: true,
  archive: false
}

🌐  Query From Chain - Chain Space Authorization 
{
  uri: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
  delegateUri: 'did:cord:3xjjqi5CJ2mb6PoCJDM9NaZtHVqEganEwQrhTEioyYRh4MQs',
  permission: 1,
  authorizationUri: 'auth:cord:a3eRfZncBqmHvijgUBoQB1FzJMP6Kv3N8bFwss9xVaxeuZ6Zt',
  delegatorUri: 'did:cord:3tyDctXoY1n9Tpq8BTvdWonXT4H1SBB8V94RrHjpeMbAjrz7'
}
✅ Initial Setup Completed! 🎊

⏳ Network Rating Transaction Flow

💠  Write Rating - (Genesis) Credit Entry 
{
  entityId: '2c19af4d-3e26-4e4c-b187-9134af471956',
  providerId: '59133f9c-ae16-414f-a5aa-305184aeb312',
  ratingType: 'Overall',
  countOfTxn: 100,
  totalRating: 320
}

🌐  Rating Information to API endpoint (/write-ratings) 
{
  entry: {
    entityId: '2c19af4d-3e26-4e4c-b187-9134af471956',
    providerId: '59133f9c-ae16-414f-a5aa-305184aeb312',
    ratingType: 'Overall',
    countOfTxn: 100,
    providerDid: '3x9P35VRnfJ7ezQyjq1vM17eCbBxhUJ2Q7FiqYGJdUqtXthT',
    totalEncodedRating: 3200
  },
  messageId: 'eae447c3-0563-4d4a-bfde-2b7422dd4489',
  entryDigest: '0x2dbf8c691cee6b84a9085146168d1ca4ac5d48ed1cfd171779b78a8b742c31cc'
}

🌐  Rating Information to Ledger (API -> Ledger) 
{
  uri: 'rating:cord:r363uzHLwHshqy3g6PPzTQkaHjCsfjokXxNAJ6m8gwJgbobQN',
  details: {
    entryUri: 'rating:cord:r363uzHLwHshqy3g6PPzTQkaHjCsfjokXxNAJ6m8gwJgbobQN',
    chainSpace: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
    messageId: 'eae447c3-0563-4d4a-bfde-2b7422dd4489',
    entryDigest: '0x2dbf8c691cee6b84a9085146168d1ca4ac5d48ed1cfd171779b78a8b742c31cc',
    authorUri: 'did:cord:3xjjqi5CJ2mb6PoCJDM9NaZtHVqEganEwQrhTEioyYRh4MQs',
    entry: {
      entityId: '2c19af4d-3e26-4e4c-b187-9134af471956',
      providerId: '59133f9c-ae16-414f-a5aa-305184aeb312',
      ratingType: 'Overall',
      countOfTxn: 100,
      providerDid: '3x9P35VRnfJ7ezQyjq1vM17eCbBxhUJ2Q7FiqYGJdUqtXthT',
      totalEncodedRating: 3200
    }
  }
}
✅ Rating addition successful! 🎉

💠  Revoke Rating - Debit Entry 
{
  entryUri: 'rating:cord:r363uzHLwHshqy3g6PPzTQkaHjCsfjokXxNAJ6m8gwJgbobQN',
  entityId: '2c19af4d-3e26-4e4c-b187-9134af471956'
}

🌐  Rating Revoke (Debit) Information to API endpoint (/amend-ratings) 
{
  entry: {
    messageId: 'msg-4a116b5b-c8f6-4781-80dc-132beb5f8a76',
    entryDigest: '0x630a929efb11aa759d38c6815893f6e8cf9a54919c2fd5a9374a0d94f03a0e31',
    referenceId: 'rating:cord:r363uzHLwHshqy3g6PPzTQkaHjCsfjokXxNAJ6m8gwJgbobQN'
  },
  entityId: '2c19af4d-3e26-4e4c-b187-9134af471956',
  providerDid: 'did:cord:3x9P35VRnfJ7ezQyjq1vM17eCbBxhUJ2Q7FiqYGJdUqtXthT'
}

🌐  Rating Revoke (Debit) Information to Ledger (API -> Ledger) 
{
  uri: 'rating:cord:r37kp57B5H3uDW4QMJEpLrRsmSXPAuQTnReey3RkojrGWZLnQ',
  details: {
    entryUri: 'rating:cord:r37kp57B5H3uDW4QMJEpLrRsmSXPAuQTnReey3RkojrGWZLnQ',
    chainSpace: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
    messageId: 'msg-4a116b5b-c8f6-4781-80dc-132beb5f8a76',
    entryDigest: '0x630a929efb11aa759d38c6815893f6e8cf9a54919c2fd5a9374a0d94f03a0e31',
    authorUri: 'did:cord:3xjjqi5CJ2mb6PoCJDM9NaZtHVqEganEwQrhTEioyYRh4MQs',
    entry: {
      messageId: 'msg-4a116b5b-c8f6-4781-80dc-132beb5f8a76',
      entryDigest: '0x630a929efb11aa759d38c6815893f6e8cf9a54919c2fd5a9374a0d94f03a0e31',
      referenceId: 'rating:cord:r363uzHLwHshqy3g6PPzTQkaHjCsfjokXxNAJ6m8gwJgbobQN'
    }
  }
}
✅ Rating Revoke (Debit) successful! 🎉

💠  Revised Rating - Credit Entry

{
  entityId: '2c19af4d-3e26-4e4c-b187-9134af471956',
  providerId: '59133f9c-ae16-414f-a5aa-305184aeb312',
  ratingType: 'Overall',
  countOfTxn: 80,
  totalRating: 280,
  providerDid: '3x9P35VRnfJ7ezQyjq1vM17eCbBxhUJ2Q7FiqYGJdUqtXthT',
  referenceId: 'rating:cord:r37kp57B5H3uDW4QMJEpLrRsmSXPAuQTnReey3RkojrGWZLnQ'
}

🌐  Rating Revised(Credit) Information to API endpoint (/write-ratings)

{
  uri: 'rating:cord:r374LaN4n1UYxcPvUMA9DaazwqCffGYYeyjqVeKTqvkm6YNAd',
  details: {
    entryUri: 'rating:cord:r374LaN4n1UYxcPvUMA9DaazwqCffGYYeyjqVeKTqvkm6YNAd',
    chainSpace: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
    messageId: 'afe8c790-9213-4867-b29b-787ab25e7585',
    entryDigest: '0xb97840c975537a7d288aa00b9ecd18a97ca1e8b5a938b73d6d509ec63b680f9b',
    authorUri: 'did:cord:3xjjqi5CJ2mb6PoCJDM9NaZtHVqEganEwQrhTEioyYRh4MQs',
    entry: {
      entityId: '2c19af4d-3e26-4e4c-b187-9134af471956',
      providerId: '59133f9c-ae16-414f-a5aa-305184aeb312',
      ratingType: 'Overall',
      countOfTxn: 80,
      providerDid: '3x9P35VRnfJ7ezQyjq1vM17eCbBxhUJ2Q7FiqYGJdUqtXthT',
      referenceId: 'rating:cord:r37kp57B5H3uDW4QMJEpLrRsmSXPAuQTnReey3RkojrGWZLnQ',
      totalEncodedRating: 2800
    }
  }
}

🌐  Rating Revised(Credit) Information to Ledger (API -> Ledger) 

✅ Rating Revision(Credit) successful! 🎉

🌐  Query From Chain - Rating Entry 
{
  entryUri: 'rating:cord:r374LaN4n1UYxcPvUMA9DaazwqCffGYYeyjqVeKTqvkm6YNAd',
  entry: {
    entityId: '2c19af4d-3e26-4e4c-b187-9134af471956',
    providerId: '59133f9c-ae16-414f-a5aa-305184aeb312',
    ratingType: 'Overall',
    countOfTxn: 80,
    totalRating: 280
  },
  digest: '0xb97840c975537a7d288aa00b9ecd18a97ca1e8b5a938b73d6d509ec63b680f9b',
  messageId: 'afe8c790-9213-4867-b29b-787ab25e7585',
  space: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
  creatorUri: 'did:cord:3zV3JmZEciA9JVCLtqAfMFYJqWq5zmYXD1ngadxdB5gFpQfz',
  entryType: 'Credit',
  referenceId: 'rating:cord:r363uzHLwHshqy3g6PPzTQkaHjCsfjokXxNAJ6m8gwJgbobQN',
  createdAt: 'April 10, 2024 at 16:48:54 GMT+5:30'
}

🌐  Query From Chain - Aggregate Score 
[
  {
    entityId: '2c19af4d-3e26-4e4c-b187-9134af471956',
    ratingType: 'Overall',
    countOfTxn: 80,
    totalRating: 280
  }
]

🌐  Query From Chain - Chain Space Usage 
{
  uri: 'space:cord:c36rD2BZUn2xZxr7Vv6T8eYC2vxSg8QicdmrZY5fL2QRG16Kj',
  creatorUri: 'did:cord:3tyDctXoY1n9Tpq8BTvdWonXT4H1SBB8V94RrHjpeMbAjrz7',
  txnCapacity: 1000,
  txnUsage: 4,
  approved: true,
  archive: false
}

Bye! 👋 👋 👋 

Signed-off-by: Shreevatsa N <[email protected]>
@vatsa287 vatsa287 force-pushed the score-augment-api branch from ec558bf to 33d869e Compare April 10, 2024 11:34
@vatsa287 vatsa287 changed the title network-score: Augment-Api & Package, Demo Script updates to match ONDC specs network-score: Augment-Api, Package, Demo Script updates to match ONDC specs Apr 10, 2024
@amarts amarts merged commit 340f366 into dhiway:develop Apr 10, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants