Skip to content

Feat/tip refund mechanism#408

Merged
Mosas2000 merged 17 commits into
mainfrom
feat/tip-refund-mechanism
May 18, 2026
Merged

Feat/tip refund mechanism#408
Mosas2000 merged 17 commits into
mainfrom
feat/tip-refund-mechanism

Conversation

@Mosas2000

Copy link
Copy Markdown
Owner

Smart contract (
tipstream.clar
)

Added 5 new error constants (err-refund-window-expired, err-already-refunded, err-not-tip-sender, err-refund-not-found, err-refund-not-pending)
Added refund-window-blocks constant (144 blocks ≈ 24 hours) and status constants
Added refund-requests and refunded-tips data maps
Added request-refund, approve-refund, reject-refund public functions
Added get-refund-request, is-tip-refunded, is-refund-eligible, get-refund-window-blocks read-only functions
Backend (chainhook/)

storage.js — MemoryRefundStore and PostgresRefundStore with full CRUD, createRefundStore factory, REFUND_STATUSES and REFUND_WINDOW_MS exports
schema.sql — refund_requests table with indexes on sender, recipient, status
server.js — POST /api/refunds, GET /api/refunds, GET /api/refunds/:tipId, PATCH /api/refunds/:tipId endpoints with full validation
refund.test.js — 16 store unit tests
refund-api.test.js — 18 validation and lifecycle tests
Frontend (frontend/src/)

contracts.js
— 7 new refund function name constants
routes.js
— ROUTE_REFUNDS with labels, titles, and metadata
useRefund.js
— useRefund hook with requestRefund, resolveRefund, fetchRefundRequest, fetchUserRefunds, isWithinRefundWindow
RefundRequest.jsx
— sender-side refund initiation with confirm dialog and on-chain call
RefundApproval.jsx
— recipient-side approve/reject with on-chain calls
RefundHistory.jsx
— paginated history with direction and status filters
RefundManager.jsx
— page-level container
TipHistory.jsx
— integrated RefundRequest and RefundApproval into each tip row
App.jsx — ROUTE_REFUNDS route, RefundManager lazy import, RotateCcw nav icon, addToast passed to TipHistory
RefundRequest.test.jsx — 12 component tests
RefundHistory.test.jsx — 12 component tests

Closes #392

@Mosas2000 Mosas2000 merged commit 0d55a38 into main May 18, 2026
4 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement tip refund mechanism

1 participant