Skip to content

Exchange request files for exchange-plan and generate web - #41

Merged
jonatns merged 1 commit into
mainfrom
claude/what-next-uc8dgt
Aug 19, 2026
Merged

Exchange request files for exchange-plan and generate web#41
jonatns merged 1 commit into
mainfrom
claude/what-next-uc8dgt

Conversation

@jonatns

@jonatns jonatns commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Milestone B of strata's docs/settlement-ceremony-plan.md: applications (specifically Overwrite's web marketplace, see the companion strata PR) can hand exchange-plan a serialized request instead of reassembling CLI flags. Labcoat stays options-agnostic — it owns the file format and transport, not what the trade means.

Request file

  • New version-1 exchange request file: pretty JSON, fixed key order, and every u64 (ids and amounts) as a canonical decimal string, because the file is also produced in JavaScript where u64 exceeds safe float precision. Round-trips byte-exactly.
  • AtomicExchangeRequest::from_request_file / to_request_file in labcoat-core, with the exact bytes pinned by REQUEST_FILE_FIXTURE (a format change is a breaking change to the file format and fails the test). Strict parsing: wrong version, non-canonical numbers, out-of-range u64, and unknown fields are all EXCHANGE_REQUEST_INVALID.
  • labcoat exchange-plan --request <file> consumes it, mutually exclusive with the positional/flag form (clap required_unless_present/conflicts_with). Semantic validation is unchanged — build_exchange_plan still runs request.validate().

Generated web artifacts

labcoat generate web now emits exchange.ts alongside the read client:

  • serializeExchangeRequest(request) validates the same invariants the CLI enforces (positive u64 amounts, distinct assets and addresses) and emits byte-identical output to the Rust serializer.
  • exchangeCeremonyCommands(paths) renders the exchange-plan --requestwallet sign-psbtexchange-settle --broadcast sequence.
  • No signing, no key material, and no transaction construction in the browser — planning, signing, and settlement stay in the CLI ceremony, per docs/GENERATE-WEB.md boundaries.

Docs and tests

  • Golden codegen tree re-blessed (exchange.ts added); labcoat-core 96 lib tests and labcoat-cli 41 tests green.
  • CLI reference and cli-reference.json regenerated via pnpm sync:reference against the built binary; docs/GENERATE-WEB.md and the changelog updated.
  • Verified live from strata: the seeded e2e now drives exchange-plan --request with a request file produced by the application side and settled a real 25-CALL-for-125-tUSD exchange (see the strata PR for the full ceremony run).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KYxFNr6yqSLbhNyPxgCNM7


Generated by Claude Code

Add a version-1 exchange request file format (canonical decimal strings
for every u64, fixed key order, byte-exact round-trip) parsed by the new
`labcoat exchange-plan --request <file>` and serialized by
AtomicExchangeRequest::to_request_file. Extend `labcoat generate web`
with an exchange.ts artifact whose serializeExchangeRequest emits the
identical bytes in the browser and whose exchangeCeremonyCommands
renders the exchange-plan / wallet sign-psbt / exchange-settle sequence.
Planning, signing, and settlement stay in the CLI ceremony.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYxFNr6yqSLbhNyPxgCNM7
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
labcoat-web Ready Ready Preview Aug 19, 2026 1:31am

@jonatns
jonatns merged commit adf13f9 into main Aug 19, 2026
5 of 6 checks passed
@jonatns
jonatns deleted the claude/what-next-uc8dgt branch August 19, 2026 01:33
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