Skip to content

feat: wire frontend to real backend API#162

Open
fawizzy wants to merge 6 commits intoStayLitCodes:mainfrom
fawizzy:main
Open

feat: wire frontend to real backend API#162
fawizzy wants to merge 6 commits intoStayLitCodes:mainfrom
fawizzy:main

Conversation

@fawizzy
Copy link
Copy Markdown

@fawizzy fawizzy commented Mar 24, 2026

  • Replace all mock data in services/escrow.ts with real HTTP calls to the
    NestJS backend, covering every escrow endpoint (list, detail, create, fund,
    release, cancel, dispute, fulfill/confirm conditions, events)
  • Add lib/api-client.ts — a typed fetch wrapper with configurable
    NEXT_PUBLIC_API_URL, automatic Authorization: Bearer header injection, and
    silent token refresh on 401
  • Add services/auth.ts implementing the full wallet auth flow: POST /auth/challenge → sign message with wallet → POST /auth/verify → store JWT
  • refresh token in localStorage
  • Add signMessage() to FreighterService, IWalletService, and
    WalletContext to support signing the raw auth challenge (distinct from XDR
    transaction signing)
  • Replace the mock hooks/useWallet.ts (hardcoded public key) with a real
    wrapper over useWalletConnection from WalletContext
  • Convert hooks/useEscrow.ts from manual useState/useEffect/fetch to
    useQuery with 404-aware retry logic
  • Mount WalletProvider in component/Providers.tsx so wallet state is
    available app-wide
  • Add apps/frontend/.env.example documenting required env vars

closes #141

  - Add lib/api-client.ts with NEXT_PUBLIC_API_URL config, JWT injection, and
  automatic token refresh on 401
  - Add services/auth.ts implementing the challenge → sign → verify auth flow
  - Replace all mock data in EscrowService with real HTTP calls (GET/POST
  /escrows and all sub-routes)
  - Replace mock useWallet hook with real useWalletConnection from WalletContext
  - Convert useEscrow from useState/useEffect to useQuery with 404-aware retry
  logic
  - Add signMessage to FreighterService, IWalletService, and WalletContext for
  auth signing
  - Mount WalletProvider in Providers tree
  - Add .env.example documenting NEXT_PUBLIC_API_URL and
  NEXT_PUBLIC_STELLAR_NETWORK
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 24, 2026

@fawizzy 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! 🚀

Learn more about application limits

@Cedarich
Copy link
Copy Markdown
Contributor

Fix failing workflow

- Rewrite eslint.config.js as a valid ESLint 10 flat config (remove
  mixed ESM/CJS, replace invalid env/extends keys with plugins/rules)
- Add "type": "module" to root package.json so Node loads the ESM config
- Remove --ext flag from root lint script (dropped in ESLint 9+)
- Add "root": true to frontend .eslintrc.json to prevent ESLint from
  traversing up to the root config
- Downgrade no-explicit-any and no-unused-vars to warn so pre-existing
  violations don't block CI; suppress stale eslint-disable directives
@fawizzy
Copy link
Copy Markdown
Author

fawizzy commented Mar 25, 2026

fixed the failing workflow

@Cedarich
Copy link
Copy Markdown
Contributor

Kindly fix workflow

fawizzy added 4 commits March 25, 2026 20:24
- Remove unused imports and variables throughout
- Replace `any` types with proper types (unknown, Record<string, unknown>, typed interfaces)
- Fix unused catch bindings with empty catch clauses
- Type Stellar server, wallet interfaces, and error handlers properly
- Configure frontend ESLint to honour underscore-prefixed ignore pattern
- Resolve conflict in escrow.service.ts (actorId optional, Record<string, any>)
- Accept upstream deletion of eslint.config.js
@Cedarich
Copy link
Copy Markdown
Contributor

Please fix conflict

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.

[Frontend] Replace Mock Data Services with Real Backend API Integration

2 participants