Skip to content

feat(core): add durable mint swap orchestration foundation - #402

Draft
igbopharaoh wants to merge 4 commits into
cashubtc:masterfrom
igbopharaoh:feat/mint-swap-orchestration-foundation
Draft

feat(core): add durable mint swap orchestration foundation#402
igbopharaoh wants to merge 4 commits into
cashubtc:masterfrom
igbopharaoh:feat/mint-swap-orchestration-foundation

Conversation

@igbopharaoh

@igbopharaoh igbopharaoh commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Work in progress

Summary

  • define the durable Mint Swap parent model, accounting invariants, prepared-plan fingerprint,
    fenced preparation lease, CAS contract, and operation-event outbox
  • add parent-owned mint and melt commands that commit authorization before remote I/O and apply
    results atomically afterward
  • split swap-then-melt execution into durable pre-swap and melt authorization phases
  • add an optional Mint Swap repository capability with rollback-safe, concurrency-safe memory
    transactions
  • add shared adapter contracts for capability absence, CAS, ownership, rollback, due ordering,
    outbox idempotency, and concurrent root writes

Dependency

Important

This draft depends on #400 and must not be marked ready or merged before Slice 1 lands.

Slice 1 provides the canonical BOLT11 accounting, locked quote/NUT-20 behavior, dispatch policy,
and broad-log rules consumed by this foundation. After #400 merges, this branch must be rebased
onto master, preserving those protocol changes and resolving the overlapping mint/melt seams.

Scope boundaries

  • Mint Swap remains dormant: no Manager/API activation, scheduler, processor, history, or React
    surface is added
  • persistent SQL and IndexedDB implementations remain in Slice 3
  • coordinator and restart recovery remain in Slice 4

Draft integration checklist

  • rebase onto master after feat(core): add protocol and secure BOLT11 foundations #400 merges
  • bind owned destination preparation to the locked quote's persisted NUT-20 key
  • apply destination issuance through Slice 1's canonical quote accounting
  • confirm the restricted owned-mint remote context preserves custom-handler compatibility
  • enforce legal parentExecutionPhase combinations through the shared child invariant
  • rerun the combined Slice 1 and Slice 2 suites

Verification

  • bun run --filter='@cashu/coco-core' typecheck
  • bun run --filter='@cashu/coco-adapter-tests' typecheck
  • bun run --filter='@cashu/coco-core' build
  • bun run --filter='@cashu/coco-adapter-tests' build
  • bun run --filter='@cashu/coco-core' test:unit
  • bun test ./src/test/contract.test.ts from packages/sqlite-bun

No changeset is included because release metadata is assigned to the final rollout slice.

Closes #366.

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 582d102

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

feat(core): add durable mint-swap orchestration foundations

1 participant