Skip to content

Add NIP-A5 interop: domain labels and payment_hash#2

Merged
refined-element merged 4 commits intomasterfrom
feat/nip-a5-interop
Mar 28, 2026
Merged

Add NIP-A5 interop: domain labels and payment_hash#2
refined-element merged 4 commits intomasterfrom
feat/nip-a5-interop

Conversation

@refined-element
Copy link
Copy Markdown
Owner

Summary

Updates kind 38403 attestations and kind 38402 agreements to match the NIP-A5 spec updates from PR #2273:

  • Attestation domain labels: Add ["l", "commerce.service_completion", "nostr.agent.attestation"] secondary NIP-32 label to kind 38403, enabling namespace-scoped reputation scoring by external consumers
  • Payment hash on agreements: Serialize ["payment_hash", "<hex>"] tag on kind 38402 when status is "completed", enabling third-party payment verification
  • Parse both status and payment_hash from Nostr event tags

Test plan

  • 6 new tests for status/payment_hash serialization, conditional emission, parsing, and roundtrip
  • All 94 tests pass

🤖 Generated with Claude Code

…eements

- Add commerce.service_completion domain label to kind 38403 attestations
  for NIP-32 namespace-scoped reputation scoring
- Serialize payment_hash tag on kind 38402 when status is completed,
  enabling third-party payment verification
- Parse payment_hash and status from Nostr event tags
- Add 6 tests for status/payment_hash serialization, parsing, roundtrip

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 28, 2026 06:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the SDK’s Nostr kind 38402 (agreements) and 38403 (attestations) models to align with the latest NIP-A5 interop changes by adding domain labeling for attestations and status/payment_hash handling for agreements.

Changes:

  • Add status to AgentServiceAgreement, parse it from tags, and always serialize it as a ["status", "..."] tag.
  • Conditionally serialize ["payment_hash", "<hex>"] for agreements when status == "completed", and parse payment_hash from tags.
  • Add the secondary NIP-32 label ["l", "commerce.service_completion", "nostr.agent.attestation"] to attestation tags and extend tests accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/le_agent_sdk/models/agreement.py Adds agreement lifecycle status plus parsing/serialization of status and conditional payment_hash.
src/le_agent_sdk/models/attestation.py Adds the commerce.service_completion secondary domain label to attestation NIP-32 labels.
tests/test_models.py Adds serialization/parsing/roundtrip tests for agreement status + payment_hash, and updates attestation tag expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/le_agent_sdk/models/agreement.py
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/le_agent_sdk/models/agreement.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@refined-element refined-element merged commit f1f6a54 into master Mar 28, 2026
7 checks 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