Skip to content

Conversation

@RishabhS7
Copy link
Contributor

@RishabhS7 RishabhS7 commented Sep 10, 2025

Summary

Added Data Model V2.0 ECDSA Documents for gallery

Jira Ticket

Summary by CodeRabbit

  • New Features
    • Added sample W3C Verifiable Credentials for:
      • Bill of Lading (operative, inoperative) with embedded rendering, QR codes, attachments, and transferable record status.
      • Electronic Promissory Note (operative, inoperative) with rendering, QR codes, and transferable record status.
      • Invoice (default, expired, redacted, revoked) with rendering, QR codes, and revocation status where applicable.
      • Certificate of Origin (default, expired, redacted, revoked) with rendering, QR codes, and revocation status where applicable.
      • Warehouse Receipt (operative, inoperative) with rendering, QR codes, and transferable record status.

@coderabbitai
Copy link

coderabbitai bot commented Sep 10, 2025

Walkthrough

Adds multiple new static JSON artifacts under public/static/w3c/v2_0 for Verifiable Credentials: Bill of Lading (operative/inoperative), Certificate of Origin (default/expired/redacted/revoked), Electronic Promissory Note (operative/inoperative), Invoice (default/expired/redacted/revoked), and Warehouse Receipt (operative/inoperative). Each includes contexts, embedded renderMethod, QR code, issuer/proof, and status metadata.

Changes

Cohort / File(s) Summary
Bill of Lading VCs
public/static/w3c/v2_0/bill-of-lading-operative.json, public/static/w3c/v2_0/bill-of-lading-inoperative.json
Add VerifiableCredentials for BillOfLadingCarrier with contexts, embedded renderer (BILL_OF_LADING_CARRIER), subject shipping details, attachments, QR code, DataIntegrityProof; one operative and one inoperative variant; TransferableRecords status.
Certificate of Origin VCs
public/static/w3c/v2_0/certificate-of-origin-default.json, .../certificate-of-origin-expired.json, .../certificate-of-origin-redacted.json, .../certificate-of-origin-revoked.json
Add COO VerifiableCredentials with CHAFTA_COO renderer, extensive consignment/export/import data, QR code, DataIntegrityProof; variants for default, expired (validUntil), redacted, and revoked (BitstringStatusListEntry).
Electronic Promissory Note VCs
public/static/w3c/v2_0/electronic-promissory-note-operative.json, .../electronic-promissory-note-inoperative.json
Add PromissoryNote VerifiableCredentials with PROMISSORY_NOTE renderer, financial terms, parties, QR code, DataIntegrityProof; TransferableRecords status; operative and inoperative variants.
Invoice VCs
public/static/w3c/v2_0/invoice-default.json, .../invoice-expired.json, .../invoice-redacted.json, .../invoice-revoked.json
Add Invoice VerifiableCredentials with INVOICE renderer, billing details, items and totals, QR code, DataIntegrityProof; variants for default, expired (validUntil), redacted, and revoked (BitstringStatusListEntry).
Warehouse Receipt VCs
public/static/w3c/v2_0/warehouse-receipt-operative.json, .../warehouse-receipt-inoperative.json
Add WarehouseReceipt VerifiableCredentials with WAREHOUSE_RECEIPT renderer, goods details, terms, QR code, DataIntegrityProof; TransferableRecords status; operative and inoperative variants.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant M as Mobile/Web App
  participant S as Static Host
  participant R as Renderer
  participant V as Verifier
  participant ST as Status Service

  U->>M: Scan TrustVC QR
  M->>S: GET VC JSON (URI from QR)
  S-->>M: VC JSON
  M->>R: Render via renderMethod (templateName)
  R-->>M: Rendered view

  M->>V: Verify DataIntegrityProof
  V-->>M: Proof result

  alt TransferableRecords
    M->>ST: Check token status (registry/chainId/tokenId)
    ST-->>M: Status result
  else StatusList
    M->>ST: Fetch statusListCredential/index
    ST-->>M: Revocation result
  end

  M-->>U: Display document + verification/status
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • isaackps
  • Moiz47

Pre-merge checks (1 passed, 1 warning, 1 inconclusive)

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The current description only provides a brief summary and a Jira ticket link, but it omits the required “## Changes,” “## Issues,” and “## Releases” sections defined in the repository’s pull request template, leaving out critical details about what was modified, related work items, and release information. Please update the description to match the template by adding a “## Changes” section listing the new JSON files and their purpose, an “## Issues” section linking related tickets, and a “## Releases” section specifying the target channels and ETA.
Title Check ❓ Inconclusive The title “chore: dm v2 docs” is related to the addition of v2 documentation but is overly generic and uses the unclear acronym “dm,” failing to convey the primary change of adding a suite of Data Model v2 ECDSA JSON credential artifacts. Please revise the title to be concise yet descriptive of the main change, for example “Add Data Model v2 ECDSA JSON credential samples,” so that the intent of the pull request is immediately clear.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

A nibble of bytes, a hop through the chain,
New creds in the meadow, signed in the rain.
QR seeds sprout, renderers bloom,
Proofs keep the foxes far from the loom.
I stamp with my paw—approved! 🐇✅

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/dm-v2-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify
Copy link

netlify bot commented Sep 10, 2025

Deploy Preview for tradetrust-gallery ready!

Name Link
🔨 Latest commit b67362f
🔍 Latest deploy log https://app.netlify.com/projects/tradetrust-gallery/deploys/68c1134e844a370009e1e41f
😎 Deploy Preview https://deploy-preview-23--tradetrust-gallery.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (22)
public/static/w3c/v2_0/invoice-expired.json (2)

31-36: Normalize monetary/quantity fields (strings vs numbers).

Quantities and amounts are strings while totals include currency symbols. Consider adding an explicit currency code and keeping numeric fields machine-parseable.

Example (non-breaking additive change):

       "terms": "Net 30 Days",
+      "currencyCode": "USD",
       "subtotal": "$16,500.00",
       "tax": "5%",
       "taxTotal": "$825.00",
       "total": "$17,325.00"

Also applies to: 38-42, 49-52


56-58: Minor: chainId type consistency.

QR payload uses chainId as a string ("101010") while credentialStatus objects in other files use a number (101010). Consider aligning for consistency across artifacts.

public/static/w3c/v2_0/invoice-redacted.json (1)

24-30: Optional: mark redactions explicitly.

If this is used to demo selective disclosure, consider adding explicit redaction markers or a disclosure frame to clarify intentional omissions.

public/static/w3c/v2_0/electronic-promissory-note-inoperative.json (3)

45-51: Gitleaks “generic-api-key” looks like a false positive.

tokenRegistry and tokenId are on a FREE test chain and not secrets. Recommend suppressing this pattern in gitleaks config to avoid noise.

I can propose a minimal .gitleaks.toml rule to ignore hex-like token IDs while still catching real keys.


35-35: Reduce embedded asset size.

Base64 logo inflates repo size. Consider a smaller placeholder image or referencing a shared static asset.


28-31: Add explicit currency code; keep amount numeric if possible.

Currently amount is a string with commas. Consider adding currencyCode and (optionally) a numeric amount alongside a display field.

Example (additive):

       "currency": "USD",
+      "currencyCode": "USD",
-      "amount": "50,000.00",
+      "amount": "50,000.00"
public/static/w3c/v2_0/electronic-promissory-note-operative.json (1)

35-35: Trim embedded logo for repo weight.

Same note as the inoperative variant: consider a lighter asset or external reference.

public/static/w3c/v2_0/warehouse-receipt-operative.json (3)

45-45: Large embedded images (logo/signature).

These base64 blobs significantly increase repo size. Recommend downsizing or referencing shared assets to keep the gallery slim.

Also applies to: 51-51


27-44: Clarify per-item weight units.

goods[].netWeight/grossWeight look like metric tons (totalNetWeight = 2.20 MT). Consider adding an explicit unit per item to avoid ambiguity.

Example (additive):

       {
         "brand": "GoldNut Premium",
         "piles": "5",
         "bundles": "25",
         "pieces": "500",
-        "netWeight": "1.25",
-        "grossWeight": "1.30"
+        "netWeight": "1.25",
+        "grossWeight": "1.30",
+        "weightUnit": "MT"
       },

65-66: Gitleaks alert likely false positive.

tokenId flagged as “generic API key”. This is a content hash/identifier, not a secret. Suggest tightening gitleaks rules.

I can craft a safe regex exclusion to avoid hex-256 token IDs under credentialStatus.tokenId.

public/static/w3c/v2_0/invoice-revoked.json (1)

49-52: Optional: currency code and numeric fields.

Consider adding a currencyCode and keeping quantities/amounts parseable.

public/static/w3c/v2_0/certificate-of-origin-redacted.json (1)

7-8: Unused context?

attachments-context is included but no attachments field is present. Either add a minimal attachments sample or drop the context to reduce fetches.

public/static/w3c/v2_0/invoice-default.json (2)

31-36: Normalize amounts/quantities and expose currency.

As with other invoices, consider adding a currencyCode and keeping numeric values machine-parseable (retain display strings if needed by the renderer).

Example (additive):

       "terms": "Net 30 Days",
+      "currencyCode": "USD",
       "subtotal": "$16,500.00",
       "tax": "5%",
       "taxTotal": "$825.00",
       "total": "$17,325.00"

Also applies to: 38-42, 49-52


56-58: Minor: chainId string vs number.

QR payload uses "101010" (string) while credentialStatus in other docs use 101010 (number). Consider aligning types.

public/static/w3c/v2_0/warehouse-receipt-inoperative.json (2)

65-66: Gitleaks “Generic API Key” is a false positive

tokenRegistry (address) and tokenId (hash) are not secrets. Consider adding a repo-level allowlist rule to silence this pattern.


45-45: Very large base64 blobs bloat the repo

Embedding full-size PNGs/proofs grows clone time. If feasible for the gallery, downscale or replace with tiny placeholders while keeping structure intact.

Also applies to: 51-51, 72-78

public/static/w3c/v2_0/certificate-of-origin-default.json (1)

88-88: QR chainId string—document the expected type

Since some other docs use numeric chainId in status, please confirm the canonical type (string vs number) for clients parsing this payload.

public/static/w3c/v2_0/certificate-of-origin-revoked.json (1)

98-98: QR chainId string—confirm client expectation

Keep consistent with other samples or document the intended type.

public/static/w3c/v2_0/bill-of-lading-inoperative.json (2)

91-92: Gitleaks false positive on token identifiers

These are on-chain identifiers, not secrets. Consider suppressing via rules.


41-41: Large embedded assets

Logo, signature, and multi‑MB attachments significantly increase repository size. If acceptable for the gallery, replace with smaller placeholders.

Also applies to: 55-55, 57-77

public/static/w3c/v2_0/bill-of-lading-operative.json (2)

91-92: Gitleaks “Generic API Key” is a false positive

Addresses/hashes are not secrets. Add an allowlist to reduce noise.


41-41: Large embedded assets

Same note as the inoperative B/L: consider lighter placeholders for gallery purposes.

Also applies to: 55-55, 57-77

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d59e135 and 2ae6eb2.

📒 Files selected for processing (14)
  • public/static/w3c/v2_0/bill-of-lading-inoperative.json (1 hunks)
  • public/static/w3c/v2_0/bill-of-lading-operative.json (1 hunks)
  • public/static/w3c/v2_0/certificate-of-origin-default.json (1 hunks)
  • public/static/w3c/v2_0/certificate-of-origin-expired.json (1 hunks)
  • public/static/w3c/v2_0/certificate-of-origin-redacted.json (1 hunks)
  • public/static/w3c/v2_0/certificate-of-origin-revoked.json (1 hunks)
  • public/static/w3c/v2_0/electronic-promissory-note-inoperative.json (1 hunks)
  • public/static/w3c/v2_0/electronic-promissory-note-operative.json (1 hunks)
  • public/static/w3c/v2_0/invoice-default.json (1 hunks)
  • public/static/w3c/v2_0/invoice-expired.json (1 hunks)
  • public/static/w3c/v2_0/invoice-redacted.json (1 hunks)
  • public/static/w3c/v2_0/invoice-revoked.json (1 hunks)
  • public/static/w3c/v2_0/warehouse-receipt-inoperative.json (1 hunks)
  • public/static/w3c/v2_0/warehouse-receipt-operative.json (1 hunks)
🧰 Additional context used
🪛 Gitleaks (8.27.2)
public/static/w3c/v2_0/warehouse-receipt-inoperative.json

[high] 65-65: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 66-66: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

public/static/w3c/v2_0/electronic-promissory-note-inoperative.json

[high] 50-50: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 51-51: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

public/static/w3c/v2_0/bill-of-lading-inoperative.json

[high] 91-91: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 92-92: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

public/static/w3c/v2_0/bill-of-lading-operative.json

[high] 91-91: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 92-92: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

public/static/w3c/v2_0/warehouse-receipt-operative.json

[high] 65-65: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 66-66: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🔇 Additional comments (16)
public/static/w3c/v2_0/invoice-expired.json (2)

18-29: Confirm PII is synthetic and intentionally public.

Names, addresses, emails, and phone numbers are present. Please confirm these are fictitious placeholders suitable for a public repo. If not, replace with non-PII samples.

Also applies to: 46-52


61-66: Proof created after validUntil — verify intent.

validUntil is 2025-06-09, but proof.created is 2025-09-09. For an “expired” sample this is fine; just confirm this is deliberate to illustrate expiry semantics.

public/static/w3c/v2_0/invoice-redacted.json (1)

1-39: LGTM for a redacted sample.

Structure, contexts, and proof look consistent with the set.

public/static/w3c/v2_0/electronic-promissory-note-inoperative.json (1)

46-51: Sanity-check registry placeholders.

Please confirm tokenRegistry address and tokenId are test/demo values and match whatever explorer your docs reference for the FREE chain.

public/static/w3c/v2_0/electronic-promissory-note-operative.json (1)

44-51: Verify registry metadata and consider gitleaks suppression.

As above, tokenRegistry/tokenId appear benign identifiers; suppress in gitleaks to avoid false positives.

public/static/w3c/v2_0/warehouse-receipt-operative.json (1)

47-48: Status block looks consistent; net weight math checks out.

2 item net weights (1.25 + 0.95) align with totalNetWeight 2.20 MT. No issues spotted.

Also applies to: 62-67

public/static/w3c/v2_0/invoice-revoked.json (3)

27-38: Confirm PII is test data.

Same ask as other invoices—please confirm these values are synthetic.


1-80: Overall: structure and revocation metadata look good.

No structural issues found; QR and proof align with the dataset.


18-23: StatusList endpoint and bitstring v2 verified
Endpoint https://trustvc.github.io/did/credentials/statuslist/2 returns HTTP 200 with a v2 bitstring of length 131072, and bit 5 is set to 1.

public/static/w3c/v2_0/certificate-of-origin-redacted.json (1)

1-44: LGTM for a redacted COO.

Contexts, renderer, and proof are consistent with the v2_0 set.

public/static/w3c/v2_0/invoice-default.json (2)

18-29: Confirm PII is mock.

Please confirm names/emails/phones/addresses are synthetic.


1-70: LGTM overall.

Structure, totals math, and proof look consistent.

public/static/w3c/v2_0/certificate-of-origin-default.json (1)

56-57: Confirm harmonisedTariff field naming

Validate the expected casing/identifier (harmonisedTariffclassCode/Name). Some schemas use “Harmonized” and/or different casing.

public/static/w3c/v2_0/certificate-of-origin-revoked.json (1)

18-26: StatusList entry format: looks correct, but verify URL resolution

BitstringStatusListEntry shape is fine. Ensure statusListCredential and fragment index resolve and are hosted.

public/static/w3c/v2_0/certificate-of-origin-expired.json (1)

92-92: Expiry looks correct

validUntil is 2024-12-03Z, which is in the past relative to today (2025-09-10). Sample reflects an expired VC.

public/static/w3c/v2_0/bill-of-lading-operative.json (1)

83-83: Normalize chainId as string across QR payload and tokenNetwork
Ensure that chainId is consistently serialized as a string (e.g. "101010") in the QR URI payload (lines 83, 88–90) and in the tokenNetwork definition.

Comment on lines +33 to +36
"packagesDescription": "Roasted Chickpeas (20kg packs)",
"packagesMeasurement": "60 Bundles",
"packagesWeight": "1.3"
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Inconsistent package weight units

packages[1].packagesWeight is “1.3” (no unit) while packages[0] is “2.65 MT”. Normalize units for reliable rendering.

-        "packagesWeight": "1.3"
+        "packagesWeight": "1.30 MT"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"packagesDescription": "Roasted Chickpeas (20kg packs)",
"packagesMeasurement": "60 Bundles",
"packagesWeight": "1.3"
}
"packagesDescription": "Roasted Chickpeas (20kg packs)",
"packagesMeasurement": "60 Bundles",
"packagesWeight": "1.30 MT"
}
🤖 Prompt for AI Agents
In public/static/w3c/v2_0/bill-of-lading-inoperative.json around lines 33 to 36,
packages[1].packagesWeight is "1.3" while packages[0].packagesWeight is "2.65
MT"; normalize package weight units across all package entries by choosing a
single unit (e.g., "MT") and update the value to include the unit (e.g., "1.3
MT") or convert numerically so both entries share the same unit format; ensure
the field remains a string with consistent unit suffix for reliable rendering.

"type": ["VerifiableCredential"],
"qrCode": {
"type": "TrustVCQRCode",
"uri": "https://actions.tradetrust.io?q=%7B%22type%22%3A%22DOCUMENT%22%2C%22payload%22%3A%7B%22uri%22%3A%22https%3A%2F%2Fgallery.tradetrust.io%2Fstatic%2Fw3c%2Fv2_0%2Fbill-of-lading-inoperative.json%22%2C%22redirect%22%3A%22https%3A%2F%2Fref.tradetrust.io%2F%22%2C%22chainId%22%3A%22101010%22%7D%7D"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Normalize chainId type across QR and status

QR uses string; status uses number. Pick one consistently across all samples.

-      "chainId": 101010
+      "chainId": "101010"

Also applies to: 88-90


🏁 Script executed:

#!/bin/bash
grep -RIn '"chainId"' public/static/w3c/v2_0

Length of output: 515


Normalize chainId type to string across all W3C v2_0 sample JSON files
Convert all chainId values from numbers to quoted strings to match the QR payload format:

Affected files:

  • public/static/w3c/v2_0/bill-of-lading-operative.json (line 89)
  • public/static/w3c/v2_0/bill-of-lading-inoperative.json (line 89)
  • public/static/w3c/v2_0/electronic-promissory-note-operative.json (line 48)
  • public/static/w3c/v2_0/electronic-promissory-note-inoperative.json (line 48)
  • public/static/w3c/v2_0/warehouse-receipt-operative.json (line 63)
  • public/static/w3c/v2_0/warehouse-receipt-inoperative.json (line 63)
-  "chainId": 101010
+  "chainId": "101010"

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In public/static/w3c/v2_0/bill-of-lading-inoperative.json around line 83 (and
similarly update the other listed W3C v2_0 sample files), the chainId is
currently a number; change it to a JSON string by surrounding the numeric value
with quotes (e.g., "chainId": "101010") so the chainId type is normalized to
string across all sample files and matches the QR payload format.

Comment on lines 33 to 36
"packagesDescription": "Roasted Chickpeas (20kg packs)",
"packagesMeasurement": "60 Bundles",
"packagesWeight": "1.3"
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Inconsistent package weight units

As per the inoperative sample, include units for packages[1].packagesWeight.

-        "packagesWeight": "1.3"
+        "packagesWeight": "1.30 MT"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"packagesDescription": "Roasted Chickpeas (20kg packs)",
"packagesMeasurement": "60 Bundles",
"packagesWeight": "1.3"
}
"packagesDescription": "Roasted Chickpeas (20kg packs)",
"packagesMeasurement": "60 Bundles",
"packagesWeight": "1.30 MT"
}
🤖 Prompt for AI Agents
In public/static/w3c/v2_0/bill-of-lading-operative.json around lines 33 to 36,
the packages[1].packagesWeight value "1.3" lacks units; update that field to
include the proper unit string (e.g. "1.3 kg" or whatever unit the inoperative
sample uses) so the weight is explicitly specified and consistent with the
sample.

"transportPackagesGrossWeight": "2050"
}
],
"sequenceNumber": -4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Negative sequenceNumber looks invalid

sequenceNumber is -4. Unless your schema permits negatives, use a positive ordinal.

Apply:

-            "sequenceNumber": -4
+            "sequenceNumber": 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"sequenceNumber": -4
"sequenceNumber": 1
🤖 Prompt for AI Agents
In public/static/w3c/v2_0/certificate-of-origin-default.json at line 65, the
sequenceNumber is set to -4 which is invalid per typical ordinal rules; change
it to a positive integer (e.g., 4) and ensure it matches the intended ordering,
then run schema/validation against the JSON to confirm the field accepts only
non-negative integers and update any references or tests that expect the prior
value.

"transportPackagesGrossWeight": "2050"
}
],
"sequenceNumber": -4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Negative sequenceNumber looks invalid

Align with positive sequencing as suggested in other COO samples.

-            "sequenceNumber": -4
+            "sequenceNumber": 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"sequenceNumber": -4
"sequenceNumber": 1
🤖 Prompt for AI Agents
In public/static/w3c/v2_0/certificate-of-origin-expired.json around line 65 the
"sequenceNumber" is negative (-4), which is invalid; change it to a positive
integer consistent with other COO samples (e.g., 4 or the intended positive
sequence) so sequencing follows the established positive ordering and update any
related references if needed.

Comment on lines +75 to +76
"sequenceNumber": -4
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Negative sequenceNumber looks invalid

As with the default COO, prefer a positive sequence number.

-            "sequenceNumber": -4
+            "sequenceNumber": 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"sequenceNumber": -4
}
"sequenceNumber": 1
}
🤖 Prompt for AI Agents
public/static/w3c/v2_0/certificate-of-origin-revoked.json lines 75-76: the
sequenceNumber is negative (-4) which is invalid for COO; change it to a
positive value (e.g., 4) consistent with the default Certificate of Origin
sequenceNumber so the document uses a valid, non-negative sequenceNumber.

Comment on lines +27 to +44
"goods": [
{
"brand": "GoldNut Premium",
"piles": "5",
"bundles": "25",
"pieces": "500",
"netWeight": "1.25",
"grossWeight": "1.30"
},
{
"brand": "AgroChoice Classic",
"piles": "3",
"bundles": "18",
"pieces": "360",
"netWeight": "0.95",
"grossWeight": "1.00"
}
],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add explicit weight units for goods entries

goods[].(netWeight|grossWeight) are bare numbers-as-strings, while totalNetWeight includes the unit (“2.20 MT”). Add units (or a separate unit field) for consistency and downstream parsing.

Example:

-        "netWeight": "1.25",
-        "grossWeight": "1.30"
+        "netWeight": "1.25 MT",
+        "grossWeight": "1.30 MT"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"goods": [
{
"brand": "GoldNut Premium",
"piles": "5",
"bundles": "25",
"pieces": "500",
"netWeight": "1.25",
"grossWeight": "1.30"
},
{
"brand": "AgroChoice Classic",
"piles": "3",
"bundles": "18",
"pieces": "360",
"netWeight": "0.95",
"grossWeight": "1.00"
}
],
"goods": [
{
"brand": "GoldNut Premium",
"piles": "5",
"bundles": "25",
"pieces": "500",
- "netWeight": "1.25",
"netWeight": "1.25 MT",
"grossWeight": "1.30 MT"
},
{
"brand": "AgroChoice Classic",
"piles": "3",
"bundles": "18",
"pieces": "360",
- "netWeight": "0.95",
"netWeight": "0.95 MT",
"grossWeight": "1.00 MT"
}
],
🤖 Prompt for AI Agents
In public/static/w3c/v2_0/warehouse-receipt-inoperative.json around lines 27 to
44, the goods[].netWeight and goods[].grossWeight are plain numeric strings
while totalNetWeight includes a unit ("2.20 MT"); update each goods entry to
include explicit units for weight — either append the unit to the existing
string (e.g., "1.25 MT") or add a sibling field (e.g., "netWeightUnit":"MT" and
"grossWeightUnit":"MT") consistently across all goods objects so downstream
parsers can reliably interpret values.

"type": ["VerifiableCredential"],
"qrCode": {
"type": "TrustVCQRCode",
"uri": "https://actions.tradetrust.io?q=%7B%22type%22%3A%22DOCUMENT%22%2C%22payload%22%3A%7B%22uri%22%3A%22https%3A%2F%2Fgallery.tradetrust.io%2Fstatic%2Fw3c%2Fv2_0%2Fwarehouse-receipt-inoperative.json%22%2C%22redirect%22%3A%22https%3A%2F%2Fref.tradetrust.io%2F%22%2C%22chainId%22%3A%22101010%22%7D%7D"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Normalize chainId type across QR payload and credentialStatus

QR uses a string "101010" while credentialStatus.tokenNetwork.chainId is a number. Pick one consistently (confirming downstream expectations) to avoid type mismatches at render/verify time.

Example (string everywhere):

-      "chainId": 101010
+      "chainId": "101010"

Also applies to: 61-64


🏁 Script executed:

#!/bin/bash
set -eux

# Show the first 100 lines of the QR payload JSON
sed -n '1,100p' public/static/w3c/v2_0/warehouse-receipt-inoperative.json

# List all occurrences of "chainId" with line numbers in the QR payload JSON
grep -n '"chainId"' public/static/w3c/v2_0/warehouse-receipt-inoperative.json

# Find all JSON fixtures defining credentialStatus in v2_0
grep -R '"credentialStatus"' -n public/static/w3c/v2_0

# For each file containing credentialStatus, list its chainId occurrences
for file in $(grep -R '"credentialStatus"' -l public/static/w3c/v2_0); do
  echo "---- $file ----"
  grep -n '"chainId"' "$file"
done

Length of output: 37490


Normalize chainId type to string
credentialStatus.tokenNetwork.chainId (line 63) must be quoted ("101010") instead of a number to match the QR payload and avoid type mismatches.

-      "chainId": 101010
+      "chainId": "101010"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"uri": "https://actions.tradetrust.io?q=%7B%22type%22%3A%22DOCUMENT%22%2C%22payload%22%3A%7B%22uri%22%3A%22https%3A%2F%2Fgallery.tradetrust.io%2Fstatic%2Fw3c%2Fv2_0%2Fwarehouse-receipt-inoperative.json%22%2C%22redirect%22%3A%22https%3A%2F%2Fref.tradetrust.io%2F%22%2C%22chainId%22%3A%22101010%22%7D%7D"
"tokenNetwork": {
"uri": "https://actions.tradetrust.io?q=%7B%22type%22%3A%22DOCUMENT%22%2C%22payload%22%3A%7B%22uri%22%3A%22https%3A%2F%2Fgallery.tradetrust.io%2Fstatic%2Fw3c%2Fv2_0%2Fwarehouse-receipt-inoperative.json%22%2C%22redirect%22%3A%22https%3A%2F%2Fref.tradetrust.io%2F%22%2C%22chainId%22%3A%22101010%22%7D%7D",
"chainId": "101010"
}
🤖 Prompt for AI Agents
In public/static/w3c/v2_0/warehouse-receipt-inoperative.json around lines 57–63,
credentialStatus.tokenNetwork.chainId is currently a number but must be a string
to match the QR payload; update the chainId value to a quoted string ("101010")
so the JSON type aligns with the QR payload and avoids type mismatches.

@rongquan1 rongquan1 merged commit bcf5a49 into main Sep 10, 2025
6 checks passed
@rongquan1 rongquan1 deleted the chore/dm-v2-docs branch September 10, 2025 06:05
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.

3 participants