Full source
Every chapter's code above is a real excerpt from these files — never a separately maintained
"docs version." They live at examples/marketplace-mercatto/ in the Ishtaran platform repository.
examples/marketplace-mercatto/
├── fixtures.ts # the story's fixed constants
├── client.ts # env-aware client factory (Sandbox, or a local stack)
├── setup.ts # Chapter 2 — Setup
├── seller-onboarding.ts # Chapter 3 — Seller onboarding
├── create-order.ts # Chapter 4 — Creating an order
├── pay-order.ts # Chapters 5-6 — Accepting payment / Holding funds
├── confirm-delivery.ts # Chapter 7 — Confirming delivery
├── release-order.ts # Chapter 8 — Settlement and Split
├── withdraw.ts # Chapters 10-11 — Seller balance / Withdrawal
├── GAPS.md # every real platform limitation this case ran into
├── README.md # how the pieces fit together
├── scenarios/ # Chapter 12 — the 11 real failure/alternative paths
│ ├── settlement-partial.ts # Chapter 9 — Partial Settlement
│ └── … (10 more, see Chapter 12)
└── tests/
├── happy-path.e2e.ts # the exact sequence this tutorial walks through
└── scenarios.e2e.ts # runs and reports on all 11 scenarios
Nothing here is a simplified retelling: tests/happy-path.e2e.ts literally imports and calls
setup(), onboardParticipants(), createOrder(), payOrder(), confirmDelivery(),
releaseOrder(), checkSellerBalance(), and attemptWithdraw() — the same functions shown in
Chapters 2 through 11 — then asserts real financial invariants on the result (Gross = Fee +
distributions, exact Split amounts, real balances, correct Transaction states). If a platform
change breaks this story, that test fails and the release is blocked.