feat: add cross-package transaction readiness engine with typed states and stages (Closes #21) - #79
Merged
El-swaggerito merged 1 commit intoJul 28, 2026
Conversation
…s and stages (Closes Axionvera#21)
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.
Description
Implements a cross-package Stellar transaction readiness engine (issue #21) — a single reusable surface that validates account state, asset, amount, memo, network mode, and submission safety before any transaction is built. Testnet-first; never submits real payments.
What changed
packages/types/src/index.ts:ReadinessState(ready|warnings|unsafe-network|blocked) — a typed aggregate outcome.ReadinessStage({ id, label, status, warnings }) — per-stage result.TransactionReadinesswithstateandstages(backward-compatible:ready/warnings/summaryretained).packages/stellar-kit/src/intent.ts:estimateTransactionReadinessSyncto run 7 discrete, reportable stages (account-source, account-dest, asset, amount, memo, network, balance) instead of one flat warning list.getReadinessState(warnings)derives the typedReadinessState.mapReadinessToErrorCode(warnings)returns the first error code for logging/branching.estimateTransactionReadiness(async) unchanged signature; now returns richer result.packages/stellar-kit/test/readiness.test.ts(new) — 11 tests: ready, warnings (same src/dest), blocked (bad asset/amount), unsafe-network (mainnet disabled), unfunded, insufficient-funds, plus helper tests forgetReadinessState/mapReadinessToErrorCode.examples/payment-readiness.example.json— deterministic intent + expectedstate/stages.apps/web/app/payments/page.tsx— readiness panel now shows the typedstatebadge (Ready / Ready with warnings / Unsafe network / Blocked) and a per-stage status grid; submission stays disabled unlessstateis ready/warnings.docs/transaction-readiness.md— engine reference, lifecycle, stages, API, safety notes.Verification
packages/stellar-kitfull suite: 149 tests passing (11 new for readiness).packages/stellar-kitbuilds; web app typechecks clean.Acceptance criteria
ReadinessState).Notes
MAINNET_DISABLEDwarning yieldsunsafe-networkstate.