feat(explorer): enable rail settlements in console#98
feat(explorer): enable rail settlements in console#98silent-cipher wants to merge 9 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR enables both payers and payees (e.g., Storacha SPs) to settle rails from the console, addressing a critical need where some service provider software doesn't automatically settle. The implementation refactors settlement logic into reusable hooks and removes the payer-only restriction.
Changes:
- Removed the payer-only restriction from settlement functionality to enable payees to settle rails
- Refactored settlement logic into reusable
useRailSettlementsanduseRailSettlementCalculationshooks - Enhanced UI with improved settlement dialog, inline loading indicators, and new settlement action buttons
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/explorer/src/hooks/useRailSettlements.tsx | New hook implementing settlement transaction management with toast notifications |
| apps/explorer/src/hooks/useRailSettlementCalculations.ts | New hook for calculating settlement amounts and epochs |
| apps/explorer/src/components/shared/InlineTextLoader.tsx | New component for inline loading state with spinner |
| apps/explorer/src/components/UserConsole/SettleRailDialog.tsx | Refactored to remove payer-only restriction and improve UI |
| apps/explorer/src/components/UserConsole/RailsSection/index.tsx | Integrated settlement hooks and added settle action handlers |
| apps/explorer/src/components/UserConsole/RailsSection/components/RailActions.tsx | New component providing settlement action button in table rows |
| apps/explorer/src/components/UserConsole/RailsSection/data/columnDefinitions.tsx | Added actions column and refactored to use extended rail type |
| apps/explorer/src/components/UserConsole/RailsSection/types/index.ts | New type definition for extended rail with settlement state |
| apps/explorer/src/components/shared/Providers.tsx | Added custom toast styling (with invalid CSS class) |
| apps/explorer/src/utils/toast.ts | Updated settlement success message to include rail ID |
| apps/explorer/src/utils/constants.ts | Removed SETTLEMENT_FEE constant (settlement fee no longer required) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/explorer/src/components/UserConsole/RailsSection/data/columnDefinitions.tsx
Outdated
Show resolved
Hide resolved
| onSettle: (rail: RailExtended) => void; | ||
| }; | ||
|
|
||
| const RailActions = ({ rail, onSettle }: RailActionsProps) => { |
There was a problem hiding this comment.
instead of prop drilling onSettle all the way through, can this be a react hook instead?
There was a problem hiding this comment.
This feel like over-engineering for a simple callback (only 2 levels of prop passing). I went ahead and implemented it for now in 7e3a571
apps/explorer/src/components/UserConsole/RailsSection/types/index.ts
Outdated
Show resolved
Hide resolved
| settledUpto: bigint; | ||
| } | ||
|
|
||
| export const useRailSettlements = (options: UseRailSettlementsOptions) => { |
There was a problem hiding this comment.
The explorer doesn’t have a testing framework configured yet. I’ll raise an issue for this.
This Pr includes -
closes #83