fix: dashboard screenshot, referrer-pool tutorial, indexer reorg safety (#80 #85 #86)#307
Open
k-deejah wants to merge 1 commit into
Open
fix: dashboard screenshot, referrer-pool tutorial, indexer reorg safety (#80 #85 #86)#307k-deejah wants to merge 1 commit into
k-deejah wants to merge 1 commit into
Conversation
…ty (tributary-protocol#80 tributary-protocol#85 tributary-protocol#86) Issue tributary-protocol#85 - add dashboard screenshot to README - Add assets/dashboard.svg: SVG illustration matching the app's dark theme, tabbed action panel (Create/Pay/Escrow), recipient inputs, and split-list grid. - Reference it in README.md immediately after the live-site link. Issue tributary-protocol#86 - tutorial: build a referrer pool with nested splits - Add docs/tutorial-referrer-pool.md: step-by-step walkthrough covering create order, preview_payout, pay, distribute, update_split roster, and a plain-text flow diagram. - Cross-link from README.md Docs section and docs/integrations.md. Issue tributary-protocol#80 - handle RPC reorgs and make re-scans idempotent - Extract indexer/state.mjs: pure helpers (validateConfig, loadState, saveState, cursorLedger, isCursorSafeToCommit, deduplicateEvents) with no external dependencies, importable by tests without stellar-sdk. - state.json now persists cursor + seenIds (sorted array of event ids). loadState() tolerates missing files, corrupt JSON, and legacy files that lack seenIds (backwards compatible). - deduplicateEvents() skips any event whose id is already in seenIds, making overlapping re-scans fully idempotent. - isCursorSafeToCommit() holds the cursor back when its ledger is within REORG_DEPTH (default 2) of the chain tip; those ledgers are re-fetched next poll and the dedup absorbs any duplicates. - index.mjs: poll loop only runs when the file is the entry point (isMain guard), so tests can import from state.mjs without triggering RPC calls. - indexer/index.test.mjs: 20 new tests covering all pure helpers; combined with the 3 existing rpc-backoff tests the suite is 23/23 passing.
Contributor
|
This PR's |
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.
Summary
Resolves three open issues in a single focused PR.
Issue closes #85 — Add dashboard screenshot to README
#0b1220background,#4cc3ffcyan accent, sticky header, tabbed action panel with Create/Pay/Escrow tabs, recipient input rows, and the split-list card grid).README.mdimmediately after the live-site link, before the prose description, so newcomers see the UI at a glance.Issue closes #86 — Tutorial: build a referrer pool with nested splits
docs/tutorial-referrer-pool.md: a full end-to-end walkthrough covering:preview_payoutto sanity-check amounts before sendingpayto settle a sale in one transactiondistributeto flush pool escrow to referrersupdate_splitto swap the referrer roster without touching the marketplace splitpay_many, deposit-then-distribute, locking)docs/integrations.mdat the existing referrer-pools heading.Issue closes #80 — Handle RPC reorgs and make re-scans idempotent
New file:
indexer/state.mjsPure helpers with zero external dependencies (no
@stellar/stellar-sdk):validateConfig— moved here fromindex.mjsso tests can import it without the SDKloadState/saveState—state.jsonnow persistscursorandseenIds(sorted array of event ids). Tolerates missing files, corrupt JSON, and legacy files that only havecursor(backwards compatible).cursorLedger— decodes the ledger sequence from a cursor stringisCursorSafeToCommit— returnsfalsewhen the cursor's ledger is withinREORG_DEPTH(default 2, configurable via env) ledgers of the chain tip, holding the cursor back so those ledgers are re-fetched next polldeduplicateEvents— skips any event whoseidis already inseenIds, making overlapping re-scans fully idempotentUpdated
indexer/index.mjsstate.mjsisMaincheck so the file can be imported by tests without triggering RPC calls orprocess.exitisCursorSafeToCommitreturnstrue; events within the reorg window are re-fetched and deduplicated automaticallyUpdated
indexer/index.test.mjsvalidateConfig,cursorLedger,isCursorSafeToCommit,deduplicateEvents(including a reorg simulation),loadState/saveStateround-trips, legacy state compatibility, and largeseenIdssetsrpc-backofftests) pass:node --test index.test.mjs rpc-backoff.test.mjsCI checklist
cargo fmt,cargo clippy,cargo testunaffectednpm run buildunaffectedno_std/ typed-error concern