Skip to content

Add Testnet/Mainnet network selector to the editor #84

Description

@Pvsaint

Summary

The deployContract function is hardcoded to deploy to Stellar Testnet with no way to switch networks. There is no UI for selecting the target network, and no environment variable support for configuring the RPC URL.

Problem

  • Deployment target is implied (Testnet) but not displayed or configurable.
  • Developers cannot switch to Mainnet without modifying source code.
  • There is no guard preventing accidental Mainnet deployments.

Expected Behaviour

  1. A network selector dropdown (Testnet / Mainnet) is visible in the editor toolbar or header.
  2. The current network is always clearly indicated (e.g. a coloured badge: green = Testnet, orange = Mainnet).
  3. Switching to Mainnet shows a confirmation dialog warning that real XLM will be spent.
  4. The selected network is stored in application state and passed to deployContract.
  5. The RPC endpoint URL is derived from the selected network (configurable via NEXT_PUBLIC_STELLAR_NETWORK env var as a fallback).

Acceptance Criteria

  • A NetworkSelector component renders a dropdown with options: Testnet and Mainnet.
  • Selected network is stored in a React context or Zustand store.
  • deployContract accepts a network parameter and uses the corresponding RPC URL.
  • Switching to Mainnet requires explicit user confirmation (dialog with "I understand this uses real XLM").
  • The network badge is always visible in the editor and colour-coded.
  • NEXT_PUBLIC_STELLAR_NETWORK env var can override the RPC URL for custom/private networks.
  • Default network on first load is always Testnet.

References

  • src/lib/stellar/deploy.ts
  • src/components/editor/DeployButton.tsx
  • Stellar network passphrases: Networks.TESTNET, Networks.PUBLIC in @stellar/stellar-sdk

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaigndifficulty: MediumModerate complexity, some experience neededenhancementNew feature or requestfrontendFrontend / UI workstellar-integrationStellar SDK / wallet integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions