DTO specs, StellarService contract-mock harness, ticket lifecycle diagrams and full API reference - #370
Merged
EmmanuelOchaje merged 11 commits intoSep 27, 2026
Conversation
…isma CLI advisory
…oint with examples
|
@Majormaxx Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
✅ Deploy Preview for stellarticketsbackend ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Closes #226
Closes #227
Closes #228
Closes #229
Stacked on #369, which repairs
mainso the gates can run at all; the first eight commits here are that PR and this diff shrinks to the last three once it merges. If you would rather merge this one first, it carries the repair with it.#226 DTO specs
confirm-transfer-ticket.dto.spec.ts,confirm-list-for-resale.dto.spec.tsandconfirm-purchase-primary.dto.spec.ts, in the style of the existingconfirm-issue-ticket.dto.spec.ts. Each runsclass-validatorwith the global pipe'swhitelist/forbidNonWhitelistedoptions and covers: the accepted payload, every optional field at its boundaries (a 39-digit price, a 64-character seat, 3- and 32-character promo codes), each rejected field with several bad inputs (it.each), an unknown property, and several bad fields reported together. 57 cases.#227 Contract-mock harness for StellarService
test/mocks/soroban-rpc.mock.ts: anrpc.Serverdouble (getAccountresolves at sequence 1,prepareTransactionreturns the built transaction) with cannedsendTransaction/getTransaction/simulateTransactionresponses, andticketScVal/eventScValfixtures that encode the contract'sTicketandEventstructs asverify_ticketandget_eventreturn them (snake_case symbol map,u64ids,i128prices, address owner, status as a bare symbol or{ tag }).test/helpers/stellar-harness.ts:createStellarHarness()boots the realStellarServicefrom an in-memory config fortestnet,futurenetormainnetand swaps the double in;decodeInvokeHostFunction()takes an envelope back apart into source, fee, network passphrase, contract id, function name, native args and XDR arg types;signAsWallet()signs like a wallet.src/stellar/stellar.service.spec.ts(29 tests): everybuild*Txmethod decodes to the expected contract function, argument values and XDR types (scvAddress,scvU64,scvI128,scvString,scvU32) with the caller as source and no signatures; the returned envelope is the oneprepareTransactionproduced; the 300-second timebound; the passphrase mapping for all three networks and proof that a futurenet envelope hashes differently under the testnet passphrase;submitSignedTransactionrelaying a wallet-signed envelope with the same hash and one signature, decoding theu64return value, and failing on a rejected submission, an on-chain failure, a missing return value and a 15-poll timeout (fake timers);verifyTicket/getEventsimulating from the platform signer and decoding both status encodings plus the unknown-status fallback; simulation errors; the circuit breaker opening after three RPC failures.docs/TESTING.mdexplains the pieces and how to add a case.#228 Ticket lifecycle diagrams
docs/ARCHITECTURE.mdgains a "Ticket lifecycle" section: a participant table, the conventions every flow shares (idempotency, re-checks at confirm, 15-second polling, Postgres writes only after the chain confirms), and mermaid sequence diagrams for issue, purchase (including promo-code pricing and redemption), transfer, resale (list, buy, cancel in one diagram, plus the off-chain price update and expiry sweep), check-in (verify with stale fallback, staff JWT and scanner-device paths), a short revoke section, and a state diagram ofTicket.statustransitions. Every step is taken fromTicketsServiceandStellarService, not from the README. All six blocks parse with mermaid 11.17.2; please eyeball them on the rendered file tab.#229 API reference with examples
docs/API.mdnow documents all 73 routes: conventions first (versioning, auth, validation pipe behaviour, BigInt-as-string, status codes,Idempotency-Key, the build / confirm pair, the four error shapes), then each route with its purpose, auth requirement, a field table taken from the DTO decorators (rules, bounds, defaults), a copy-pasteablecurl, and the JSON the service returns (Prisma rows with their real columns,{ unsignedXdr }for build calls, the enriched resale listing withroyaltyFee/sellerProceeds,{ device, token }for scanner devices,{ entry, position }for the waitlist, and so on). Example public keys are valid strkeys; the resale cursor is a realbase64url("createdAt|id").Evidence (Node 22.23.3)
npx tsc --noEmitnpx eslint "src/**/*.ts"npx jest --coveragenpm run build,npm run docs:check,npm run audit:checkNoticed, not changed
scripts/generate-api-collection.jsdoes not followextends, so the generated Bruno bodies for everyconfirm-*request lacksignedXdrandtxHash.docs/API.mddocuments the real bodies; fixing the generator changes eleven.brufiles and is better as its own PR.