Skip to content

feat(PR30): XRPL escrow budget fields in PolicyGrantLike#48

Merged
naory merged 2 commits intomainfrom
feat/xrpl-escrow-grant-fields
Apr 1, 2026
Merged

feat(PR30): XRPL escrow budget fields in PolicyGrantLike#48
naory merged 2 commits intomainfrom
feat/xrpl-escrow-grant-fields

Conversation

@naory
Copy link
Copy Markdown
Collaborator

@naory naory commented Apr 1, 2026

Summary

  • Adds six new PA-signed fields to PolicyGrantLike, policyGrantForVerificationSchema, and CreatePolicyGrantInput / createPolicyGrant factory:
    • budgetMinor / budgetCurrency — total authorized spend ceiling (PA-signed, tamper-proof)
    • budgetEscrowRef — URI pointer to the on-chain XRPL escrow that pre-reserves the budget
    • authorizedGateway — XRPL address of the only gateway allowed to spend against this grant's escrow
    • offlineMaxSinglePayment / offlineMaxSinglePaymentCurrency — per-transaction cap for offline merchant acceptance (tiered trust Option A)

Motivation

The Trust Gateway must enforce a budget ceiling that comes from the PA-signed grant rather than from an agent-reported value. These fields are included in the PA signature, so a compromised agent or gateway cannot forge a higher ceiling.

Test plan

  • npm run build — no TypeScript errors
  • Existing tests pass (npm test)
  • New fields round-trip through createPolicyGrantverifyPolicyGrant in a manual test

🤖 Generated with Claude Code

NAOR YUVAL and others added 2 commits April 1, 2026 21:58
…ineMaxSinglePayment to PolicyGrantLike

XRPL-escrow budget enforcement requires these PA-signed fields in the PolicyGrant
so the Trust Gateway can enforce ceilings from a tamper-proof source rather than
trusting agent-reported values.

- PolicyGrantLike: budgetMinor, budgetCurrency, budgetEscrowRef, authorizedGateway,
  offlineMaxSinglePayment, offlineMaxSinglePaymentCurrency
- policyGrantForVerificationSchema: Zod validators for all six fields (numeric strings
  validated via regex)
- createPolicyGrant / CreatePolicyGrantInput: factory and input type updated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- types.ts: authorizedGateway — remove XRPL-specific "address" wording, use rail-agnostic description
- types.ts: offlineMaxSinglePayment — "(drops)" → "minor units" (rail-agnostic)
- types.ts: budgetEscrowRef example — add lockId to eth example for consistency with spec
- createPolicyGrant.ts: add missing JSDoc for authorizedGateway, offlineMaxSinglePayment,
  offlineMaxSinglePaymentCurrency (other new fields had docs, these three did not)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naory naory merged commit 7db7386 into main Apr 1, 2026
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.

1 participant