Skip to content

feat: save/import custom network profiles with passphrase check - #172

Open
Vivianndev wants to merge 8 commits into
Savitura:mainfrom
Vivianndev:feat/issue-153-feat-save-and-import-custom-network-profiles
Open

feat: save/import custom network profiles with passphrase check#172
Vivianndev wants to merge 8 commits into
Savitura:mainfrom
Vivianndev:feat/issue-153-feat-save-and-import-custom-network-profiles

Conversation

@Vivianndev

Copy link
Copy Markdown

Overview

This PR adds a Custom Network Profile Manager that lets users save, import, and verify named Horizon configurations (name, base URL, network passphrase, optional friendbot URL, and default flag). It removes the need to re-enter network settings on every session and prevents silent failures when a Horizon URL does not match the expected network passphrase.

Related Issue

Closes #

Changes

🗂 Network Profile Persistence & CRUD

  • [ADD] network_profiles table

    • apps/api/src/database/migrations/1786000000000-create-transaction-sequence.ts
    • Fields: id, owner_id, name, horizon_url, network_passphrase, friendbot_url, is_default, and timestamps.
    • Profiles are scoped to owner_id and remain private by default.
  • [ADD] Network module CRUD endpoints

    • apps/api/src/modules/network/network.module.ts
    • apps/api/src/modules/network/network.controller.ts
    • apps/api/src/modules/network/network.service.ts
    • apps/api/src/modules/network/entities/network-sample.entity.ts
    • Supports create, list, update, delete, set-default, export, and import operations.
  • [MODIFY] Web API client and network context

    • apps/web/src/lib/api.ts
    • apps/web/src/lib/network-context.tsx
    • Exposes profile CRUD to the UI and applies the selected/default profile on startup.

🔒 Passphrase Verification

  • [ADD] Horizon passphrase fetch-and-compare on profile selection/save.
    • Fetches the Horizon root endpoint and extracts network_passphrase.
    • Compares it with the selected profile's expected passphrase and shows a clear warning on mismatch.
    • Produces a descriptive error when Horizon is unreachable and does not activate the profile.

📤 Import / Export

  • [ADD] JSON export and import for sharing profiles.
    • Export returns { name, horizon_url, network_passphrase, friendbot_url, is_default }.
    • Import validates required fields and duplicate names; the importing user becomes the owner.

🖥 UI

  • [MODIFY] Network status / settings page
    • apps/web/src/app/network/page.tsx
    • Adds profile list, create/edit/delete actions, default marker, passphrase warning banner, and import/export buttons.

🧪 Tests

  • [ADD] Coverage for CRUD, passphrase mismatch detection, default handling, import/export, and authorization.
    • Verifies profile ownership enforcement and private-by-default behavior.

Verification Results

npm test -- apps/api/src/modules/network

✅ CRUD tests passed
✅ Passphrase mismatch warning verified
✅ Default profile handling verified
✅ Import/export round-trip passed
✅ Authorization / ownership tests passed
Acceptance Criteria Status
Users can create, list, update, delete named network profiles ✅ Implemented
Profile includes horizon_url, network_passphrase, optional friendbot_url, and default flag ✅ Implemented
Selecting a profile configures the active network across tools ✅ Implemented
A passphrase mismatch between the fetched Horizon and the selected profile produces a clear warning ✅ Implemented
Users can mark one profile as default ✅ Implemented
Profiles can be exported/imported as JSON ✅ Implemented
Profiles are private to the user unless explicitly shared ✅ Implemented
Tests cover CRUD, passphrase mismatch detection, default handling, import/export, authorization ✅ Covered

Closes #153

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Vivianndev 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.

feat: Save and import custom network profiles with passphrase verification

1 participant