Repository navigation
feat: make /send and /request functional without a deployed indexer - #28
Merged
Merged
Conversation
Both pages showed "can't be loaded" for every payee, since no indexer is deployed (M2-18, still TODO). kinlock-registry's real payees/ dir is empty, and the indexer's own registry-join reads a local filesystem checkout, not something kinlock-app should fetch live or re-implement. Added a scoped interim source instead: - lib/payees/known.ts: a committed snapshot of kinlock-registry's three fixture payees. - lib/payees/registry.ts: joins each one with a live chain read (getPayee), verifying the on-chain meta_hash still matches this snapshot's hash of the full record before showing any of its display fields, exactly the binding the real indexer enforces. status and payout are always the live on-chain values. Wired into /send and /request in place of the broken listPayees() call. All three fixtures turned out to already be registered and Active on testnet from earlier work; confirmed directly against the deployed contract.
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.
What and why
/sendand/requestshowed "The list of payees can't be loaded right now" for every payee, since no indexer is deployed yet (M2-18, stillTODO). Investigated whetherkinlock-registry's real data could substitute directly: itspayees/directory is empty (.gitkeeponly), and the indexer's own registry-join (kinlock-sdk/services/indexer/src/registry/sync.ts) reads a local filesystem checkout of the registry repo, not somethingkinlock-appshould fetch live from GitHub at runtime or re-implement wholesale (that's real infrastructure work, a separate, bigger task).Changes
lib/payees/known.ts: a committed snapshot ofkinlock-registry/fixtures/payees/'s three fictional testnet fixtures (NG School, KE School, PH Rent).lib/payees/registry.ts:listKnownPayees()joins each snapshot entry with a live chain read (getPayee, hard rule 3: chain is truth) and only shows a payee's display fields when the on-chainmeta_hashstill matches this snapshot's hash of the full record, computed with the exact samecanonicalize/sha256algorithmkinlock-registry's ownscripts/registry.tsand the indexer's sync already use (so this isn't a new trust model, just the same one, duplicated the same way the indexer already duplicates it).statusandpayoutare always the live on-chain values, never the snapshot's.app/send/page.tsx,app/request/page.tsx: uselistKnownPayees()instead of the indexer'slistPayees().While investigating, found all three fixtures are in fact already registered and
Activeon testnet (from earlier work this session, not part of this PR); confirmed directly against the deployed contract withstellar contract invoke ... get_payee, independent of this app's code.Hard rules / invariants touched
None broken; this restores rule 3 (chain is truth) for the sender/payee-selection surface, which was previously just failing closed.
statusandpayoutare never taken from the committed snapshot.Tests
pnpm lint,pnpm typecheck,pnpm test(101/101, 7 new inlib/payees/registry.test.ts:payeeIdOfmatcheskinlock-registry's ownpnpm hashoutput, display fields clear whenmeta_hashdoesn't match, a failed chain read drops that payee rather than throwing, live status is always reflected),pnpm buildall green.Full end-to-end functional test with Playwright against a real local build with no indexer configured (matching production): both pages list all three payees;
/requestgenerates a real, working prefilled/sendlink;/send's complete review flow (payee select, schedule, take-back date, USD total, preflight) runs through to "Connect your wallet first", the correct stopping point (actual signing needs a real wallet extension).Docs / ADR
None needed; no SDK API or event change.
Roadmap
New row
M3-26added (app, P1,DONE). Phase 4 App: 10→11 DONE, total 25→26 (40%→42%). All rows: 40→41 DONE, total 200→201 (23%, unchanged after rounding).M3-06is untouched (IN PROGRESS): its "Done when" is "creates a lock on testnet end to end," which still needs an actual wallet-signedcreateLock, not something this PR attempts.Assumptions and open questions
This is explicitly an interim measure.
M3-26's row says so, and the code comments point at it. OnceM2-18(real indexer) ships,/sendand/requestshould go back to the indexer-backedlistPayees(), which also serves/payee's dashboard and will cover real, non-fixture payees as they're onboarded (this interim source only ever shows these three fixtures, by design).While investigating I also installed the
stellarCLI (Homebrew) and generated a throwaway testnet attester identity (kinlock-fixture-attester), expecting I'd need to register these payees myself. That turned out to be unnecessary (they were already registered), so that identity is unused; it's a local-only Stellar CLI keystore entry, nothing committed to this repo.Deploying to
kinlock-app.vercel.appviavercel --prodafter this merges.