docs: document the escrow status model across contract, backend, and clients (#580) - #629
Closed
ZacLou wants to merge 4 commits into
Closed
docs: document the escrow status model across contract, backend, and clients (#580)#629ZacLou wants to merge 4 commits into
ZacLou wants to merge 4 commits into
Conversation
added 4 commits
August 29, 2026 08:55
…LitCodes#557) - services/api.ts now imports apiUrl from security/env.ts instead of reading EXPO_PUBLIC_API_BASE_URL directly - EXPO_PUBLIC_API_BASE_URL is fully removed from the codebase - security/env.ts: corrected dev rpcUrl default from 8545 (EVM port) to 8000 (Soroban RPC port) - validateEnv() now provides detailed warnings in development when env vars are missing or still using defaults - validateEnv() is called at app start in app/_layout.tsx - Added apps/mobile/.env.example documenting EXPO_PUBLIC_APP_ENV, EXPO_PUBLIC_API_URL, and EXPO_PUBLIC_RPC_URL Closes StayLitCodes#557
…tCodes#579) Created docs/ENVIRONMENT.md listing every env var per service (backend, frontend, mobile, onchain deployment) with: - Variable name, owning service, required/optional, secret flag, default - Conflict & duplicate register (EXPO_PUBLIC_API_BASE_URL vs EXPO_PUBLIC_API_URL, NEXT_PUBLIC_API_BASE_URL vs NEXT_PUBLIC_API_URL, API_BASE_URL) - Cross-service variables that must agree (API URL, Stellar network, Soroban RPC, contract ID) - Quick start examples for each service Closes StayLitCodes#579
Created docs/contract/EVENTS.md documenting: - Three-part topic convention (Vaultix, v1, EventName) - EVENT_NAMESPACE and EVENT_SCHEMA_VERSION constants - All 16 emitted events with topic tuples, payload structs, and field types - Entrypoint mapping and state transitions for each event - Events that deviate from the typed-struct pattern (SignatureCollected, MultisigConfigured, ContractUpgraded) flagged for convergence - State transition graph showing legal EscrowStatus transitions - Schema version bump strategy for consumers Linked from docs/contract/README.md. Closes StayLitCodes#578
…nts (StayLitCodes#580) Created docs/STATUS_MAPPING.md reconciling status representations across all four layers: - Contract (Rust): Created, Active, Completed, Cancelled, Disputed, Resolved, Expired - Backend (NestJS): PENDING, ACTIVE, COMPLETED, CANCELLED, DISPUTED, EXPIRED, REFUNDED - Frontend (Next.js): lowercase + legacy uppercase variants - Mobile (Expo): created, funded, confirmed, released, completed, cancelled, disputed, expired Documents: - Full mapping table with alias explanations (e.g. 'funded' = contract 'Active') - Milestone status mapping (including the missing 'Disputed' milestone status on all clients) - Legal state transition graph for both contract and backend - Client-only aliases with reasons - Three known gaps: missing 'Resolved' on clients, missing 'Disputed' milestone on clients, mixed-case frontend union Linked from docs/contract/DATA_MODELS.md. Closes StayLitCodes#580
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.
Overview
Fixes #580 — creates
docs/STATUS_MAPPING.mdreconciling the escrow status representations across all four layers (contract, backend, frontend, mobile).What's in the doc
Layer source references
Links to the exact file and line numbers where each layer defines its status type:
apps/onchain/src/lib.rslines 52–61apps/backend/src/modules/escrow/entities/escrow.entity.tslines 17–25apps/frontend/types/escrow.tslines 10–24apps/mobile/types/escrow.tslines 1–9Full mapping table
Every contract status mapped to its backend, frontend, and mobile equivalents with notes. Highlights:
fundedis a client-only alias for the contract'sActive(UI convention)REFUNDEDwhich has no direct contract equivalentconfirmed,released) not present on-chainPENDING,ACTIVE, etc.) alongside lowercaseMilestone status mapping
Documents that the contract's
Disputedmilestone status has no representation on any client — a known gap.Legal state transition graph
Both the contract transitions (enforced by
validate_status_transitionininvariants.rs) and the backend transitions (enforced byvalidateTransitioninescrow-state-machine.ts) are documented, including terminal states.Client-only aliases
Explains each alias with its reason (e.g.,
fundedis used because "Active" is ambiguous to end users).Three known gaps documented
Resolvedhas no client representation — clients seeCOMPLETEDorCANCELLEDinsteadDisputedmilestone status has no client representation — rendered aspendingEach gap includes impact assessment and recommendation.
Cross-references
Linked from
docs/contract/DATA_MODELS.mdand cross-referenced withEVENTS.md,ERRORS.md, andWORKFLOWS.md.Acceptance Criteria Checklist
docs/STATUS_MAPPING.mdpresents a table mapping every contract status to its backend representation and its frontend/mobile labelvalidate_status_transitionfundedstanding in for the contract'sActive) are named as aliases, with the reasondocs/contract/DATA_MODELS.mdand referenced by the mobile and frontend type definitionsCloses #580