feat: auto-refresh contract state every 30s and wire landlord release action#2
Closed
arandomogg wants to merge 1 commit into
Closed
feat: auto-refresh contract state every 30s and wire landlord release action#2arandomogg wants to merge 1 commit into
arandomogg wants to merge 1 commit into
Conversation
… action Resolves merge conflicts in page.tsx and queries.ts, introduces 30-second contract state polling that pauses when the browser tab is hidden, and wires the Release Funds button so only the connected landlord can trigger a Freighter- signed release transaction with a TransactionReview security modal. closes Ogstevyn#501 closes Ogstevyn#502
7a75932 to
b0e78db
Compare
Owner
Author
|
Opening against the correct upstream repo Ogstevyn/payeasy instead. |
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
app/escrow/[contractId]/page.tsxandlib/stellar/queries.ts, restoring all previously missing query infrastructure (getLandlord,getTotal,getDeadline, etc.) alongside bothgetContractStateandgetFeeStats.hooks/useContractPolling.ts: pollsgetContractStateevery 30 s viasetInterval; pauses automatically when the browser tab is hidden viavisibilitychange; cleans up on unmount.fetchDatainEscrowDashboardClient.tsxwith the new polling hook and adds an inline error/retry state.lib/stellar/actions/release.ts: fixes the stalewindow.freighterguard to usefreighterApi.isConnected(), and splits the flow intobuildReleaseXdr(assert funded + simulate) andsignAndSubmitRelease(Freighter sign + Horizon submit); the originalreleaseEscrowconvenience wrapper is kept.EscrowDashboardClient.tsxthat renders only whenisConnected && publicKey === landlord; clicking it builds the prepared XDR, opens theTransactionReviewsecurity modal, then signs and submits on confirm, shows a "Funds released to landlord." toast, and refreshes state.Test plan
useContractPollingcallsgetContractStateon mount and again after 30 s (mock two RPC responses and advance fake timers).document.visibilityState === "hidden"and fires immediately when the tab becomes visible.buildReleaseXdr+signAndSubmitRelease; confirm success toast and state refresh on confirm.closes Ogstevyn#501
closes Ogstevyn#502