feat: StellarNetworkSwitcher, OwnershipChainValidator, document detail & verify pages - #1072
Open
khaadish wants to merge 1 commit into
Open
feat: StellarNetworkSwitcher, OwnershipChainValidator, document detail & verify pages#1072khaadish wants to merge 1 commit into
khaadish wants to merge 1 commit into
Conversation
CT-11 — StellarNetworkSwitcher (contract/src/module/network/mod.rs)
- StellarNetwork enum with Testnet and Mainnet variants
- parse_network() with case-insensitive matching and descriptive errors
- network_from_env() validates STELLAR_NETWORK at startup
- GET /module/network handler returning current network + Horizon URL
- 8 unit tests covering all acceptance criteria
CT-22 — OwnershipChainValidator (contract/src/module/ownership_chain/mod.rs)
- ValidationResult enum: Valid, Invalid { gap_at_index, expected_owner, found_owner }, Empty
- validate_chain() fetches TransferRecords from cache and checks continuity
- GET /module/chain/:document_hash handler returning result as JSON
- 5 unit tests: empty history, single transfer, valid two-step chain, gap at index 1, gap at last transfer
FE-18 — Document detail page (frontend/app/(protected)/documents/[id]/page.tsx)
- Fetches GET /api/documents/:id and GET /api/documents/:id/risk in parallel
- Circular SVG risk gauge (colour-coded 0-100)
- Flag breakdown cards (detected/not-detected, weight, contribution)
- Vertical status timeline: PENDING → ANALYZING → VERIFIED/FLAGGED/REJECTED
- Skeleton loader while fetching
- Real-time status updates via WebSocket
- Actions: Verify on Stellar, Download Report, File Dispute, Share modal
FE-20 — Verify page (frontend/app/(protected)/documents/[id]/verify/page.tsx)
- Redirects to detail page if document is already VERIFIED
- Pre-verification: document hash preview, cost note, Anchor on Stellar button
- Processing: animated progress bar + WebSocket real-time progress messages
- Post-verification: green checkmark, copyable tx hash with Stellar explorer link, ledger number, QR code, Download Verification Certificate (print)
Wiring: lib.rs exports pub mod module, imports network_handler + chain_handler,
routes /module/network and /module/chain/:document_hash added to app() router.
Contributor
|
@khaadish is attempting to deploy a commit to the Mftee's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@khaadish Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
This PR implements four assigned issues in a single batch:
CT-11 — StellarNetworkSwitcher (
contract/src/module/network/)StellarNetworkenum (Testnet/Mainnet)parse_network(value: &str)— case-insensitive, returns descriptiveErrfor unknown valuesnetwork_from_env()— readsSTELLAR_NETWORKenv var; startup fails with a clear error on unrecognised valuesGET /module/network— returns current network name and Horizon URL as JSONTestnet,MAINNET,TestNet), invalid string, empty stringCT-22 — OwnershipChainValidator (
contract/src/module/ownership_chain/)ValidationResultenum:Valid,Invalid { gap_at_index, expected_owner, found_owner },Emptyvalidate_chain(document_hash, cache)— fetchesTransferRecords from Redis and checks eachfrom_owner == previous.to_ownerGET /module/chain/:document_hash— returnsValidationResultas JSONFE-18 — Document detail page (
frontend/app/(protected)/documents/[id]/page.tsx)GET /api/documents/:idandGET /api/documents/:id/riskin parallelFE-20 — Verify / Stellar anchoring page (
frontend/app/(protected)/documents/[id]/verify/page.tsx)VERIFIEDPOST /api/documents/:id/verifyTesting
tsc --noEmitpasses with zero errors on the frontendcargo testcloses #543
closes #554
closes #830
closes #832