-
Notifications
You must be signed in to change notification settings - Fork 43
Implement On-Chain Bounty Status Sync and Event Listener #147
Copy link
Copy link
Open
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programarchitecturecomponentfrontendFrontend developmentFrontend developmentgraphqlhelp wantedExtra attention is neededExtra attention is neededtanstack-querywebsockets
Milestone
Description
Feature: On-Chain Bounty Status Sync and Event Listener
Overview
The Bounty Registry contract emits events for all state changes (BountyCreated, BountyApplied, BountyAssigned, WorkSubmitted, SubmissionApproved, BountyClaimed, BountyCancelled, etc.). The frontend needs to listen to these events for real-time status updates and data consistency between on-chain and off-chain state.
Depends on: #139 (TypeScript contract bindings)
Goals
- Sync frontend bounty state with on-chain contract state
- Listen to contract events for real-time updates
- Reconcile GraphQL data with on-chain truth
- Handle state conflicts gracefully
Contract Events
BountyCreated { bounty_id, creator }
BountyApplied { bounty_id, applicant }
BountyAssigned { bounty_id, assignee }
WorkSubmitted { bounty_id, submitter }
SubmissionApproved { bounty_id, winner }
BountyClaimed { bounty_id, claimer }
BountyCancelled { bounty_id, reason }
SplitApproved { bounty_id, amount }
ApplicationRejected { bounty_id, applicant }
Implementation Details
1. Contract Event Poller
Create: lib/contracts/event-listener.ts
- Poll Stellar RPC for contract events at interval
- Parse event topics and data
- Dispatch to relevant query cache invalidations
2. On-Chain Status Verification Hook
Create: hooks/use-onchain-bounty.ts
useOnChainBounty(bountyId)— reads directly from contract- Compare with GraphQL data for consistency
- Show "verified on-chain" indicator
3. Transaction Confirmation Tracker
Create: hooks/use-transaction-status.ts
- After submitting a transaction, track confirmation
- Show pending → confirmed → finalized states
- Link to Stellar explorer for verification
Files Affected
Created
lib/contracts/event-listener.tshooks/use-onchain-bounty.tshooks/use-transaction-status.tscomponents/bounty/onchain-status-badge.tsx
Acceptance Criteria
- Contract events trigger UI updates
- On-chain status readable for any bounty
- Transaction confirmation tracked after submission
- Status conflicts between GraphQL and on-chain detected
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Stellar WaveIssues in the Stellar wave programIssues in the Stellar wave programarchitecturecomponentfrontendFrontend developmentFrontend developmentgraphqlhelp wantedExtra attention is neededExtra attention is neededtanstack-querywebsockets