Exchange request files for exchange-plan and generate web - #41
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milestone B of strata's
docs/settlement-ceremony-plan.md: applications (specifically Overwrite's web marketplace, see the companion strata PR) can handexchange-plana 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
AtomicExchangeRequest::from_request_file/to_request_fileinlabcoat-core, with the exact bytes pinned byREQUEST_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 allEXCHANGE_REQUEST_INVALID.labcoat exchange-plan --request <file>consumes it, mutually exclusive with the positional/flag form (claprequired_unless_present/conflicts_with). Semantic validation is unchanged —build_exchange_planstill runsrequest.validate().Generated web artifacts
labcoat generate webnow emitsexchange.tsalongside 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 theexchange-plan --request→wallet sign-psbt→exchange-settle --broadcastsequence.docs/GENERATE-WEB.mdboundaries.Docs and tests
exchange.tsadded);labcoat-core96 lib tests andlabcoat-cli41 tests green.cli-reference.jsonregenerated viapnpm sync:referenceagainst the built binary;docs/GENERATE-WEB.mdand the changelog updated.exchange-plan --requestwith 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