feat(frontend): implement API client layer for Axum backend with retry, timeout, and signature auth (#801)#877
Open
D-Lord-15 wants to merge 1 commit into
Open
Conversation
…nd communication (Fracverse#801) - Add InheritanceAPI client with handlers for createPlan, getPlans, pingPlan, triggerPayout, and getPayoutStatus endpoints - Enhance ApiClient with configurable timeout via Promise.race, exponential backoff retry policies, and ed25519 signature auth support (X-Public-Key + X-Signature headers) - Add clean TypeScript DTOs mapping to backend response types - Add MSW mock handlers for /api/plans and /api/anchor/payout-status - Add 18 unit tests covering success, validation error, and auth failure scenarios - Fix jsdom/MSW AbortSignal compatibility by replacing AbortController with Promise.race for timeout handling
|
@D-Lord-15 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! 🚀 |
Contributor
|
@D-Lord-15 |
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
Closes #801
Implements the frontend API client layer to communicate with the Axum backend for inheritance plan management.
Changes
New Files
frontend/app/lib/api/inheritance.ts— InheritanceAPI client with handlers for all 5 inheritance endpoints:createPlan()— POST /api/plans (signature auth)getPlans()— GET /api/plans (public, with owner/beneficiary filters)pingPlan()— POST /api/plans/ping (signature auth)triggerPayout()— POST /api/plans/payout (signature auth)getPayoutStatus()— GET /api/anchor/payout-status (public, paginated)frontend/tests/api/inheritance.test.ts— 18 unit tests covering success, validation errors, and auth failuresEnhanced Files
frontend/app/lib/api/client.ts— Enhanced ApiClient with:frontend/app/lib/api/index.ts— Exports new types and InheritanceAPI singletonfrontend/tests/mocks/handlers.ts— MSW handlers for /api/plans and /api/anchor/payout-status with validation logic and paginationArchitecture Decisions
Testing
npx vitest run tests/api/inheritance.test.ts # 18/18 tests passingCoverage includes:
Type Check
npx tsc --noEmit # passes clean