Skip to content

fix: replace mock trustline check with Horizon/backend queries - #580

Open
Marvy54 wants to merge 5 commits into
Ignition-World:mainfrom
Marvy54:fix/issue-455-trustline-check-uses-mock-service
Open

fix: replace mock trustline check with Horizon/backend queries#580
Marvy54 wants to merge 5 commits into
Ignition-World:mainfrom
Marvy54:fix/issue-455-trustline-check-uses-mock-service

Conversation

@Marvy54

@Marvy54 Marvy54 commented Aug 28, 2026

Copy link
Copy Markdown

Overview

This PR replaces the mocked checkTrustline implementation in the send flow with a real trustline verification service. It queries Horizon for the account’s trustlines and falls back to the configured backend API when needed, ensuring users get accurate trustline status before sending assets.

Related Issue

Closes: Trustline check uses mock service

Changes

🔍 Real Trustline Verification

  • [MODIFY] features/send/services/trustline_service.dart

    • Remove the mock checkTrustline logic; add a network-based implementation that queries Horizon for trustlines.
    • Add graceful fallback to the backend endpoint when Horizon is unreachable.
    • Include proper error mapping for missing accounts, invalid assets, and network failures.
  • [MODIFY] .env.example

    • Add HORIZON_URL and TRUSTLINE_BACKEND_URL environment variables for configuring the trustline check endpoints.
  • [MODIFY] examples/dart-wallet/basic-wallet/main.dart

    • Update the example wallet to initialize the real trustline service and display actual trustline results.
  • [MODIFY] examples/dart-wallet/basic-wallet/pubspec.yaml

    • Add http dependency required for the network-backed trustline service.
  • [MODIFY] examples/ts-backend/stellar-api-server/src/index.ts

    • Add a /trustline endpoint that verifies trustlines via Horizon and returns a normalized JSON response for the Flutter client.

Verification Results

flutter test --coverage
✅ 24/24 tests passed

Manual verification:
✅ checkTrustline now queries live Horizon testnet
✅ Backend fallback returns correct trustline status when Horizon is down
✅ Invalid asset code returns a clear error
✅ Example wallet shows real trustline status
Acceptance Criteria Status
checkTrustline queries Horizon instead of returning simulated results
Backend fallback works when Horizon is unavailable
Trustline errors are propagated clearly to the user
Configuration is documented via .env.example

Closes #455

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Marvy54 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

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.

Trustline check uses mock service

1 participant