Skip to content

Restructure config.ts into a per-network config map #113

Description

@Miracle656

Background

src/config.ts builds a single frozen config object at import — one Horizon, one RPC, one passphrase, one Soroswap factory. Worse, the defaults are incoherent: HORIZON_URL/RPC_URL default to testnet while the Soroswap factory, Reflector oracle and Aquarius API default to mainnet addresses. Dual-network needs config resolved per network, not one flat object.

What to build

Replace the flat config with config.networks.{testnet,mainnet}, each carrying horizon.url, rpc.url, network.passphrase, soroswap.factoryAddress, oracle ids, and watched pairs — from paired env vars.

Key files

  • src/config.ts (31-72)

Suggested execution

git checkout -b feat/per-network-config
  1. Read paired env: HORIZON_URL_{TESTNET,MAINNET}, RPC_URL_*, NETWORK_PASSPHRASE_*, SOROSWAP_FACTORY_ADDRESS_*, REFLECTOR_CONTRACT_ID_*, WATCHED_PAIRS_*
  2. Expose getNetworkConfig(network); keep single-var fallback
  3. Update .env.example with both networks

Acceptance criteria

  • config.networks.testnet and .mainnet each fully specified
  • No more incoherent testnet-RPC/mainnet-contract defaults
  • Back-compat single-network env still resolves
  • .env.example documents both

Drips Wave · Complexity: Advanced · 200 points


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Activity

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

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programarea:ingestSDEX / AMM ingestiondifficulty:advancedMulti-day projecthelp wantedExtra attention is neededpoints:200Advanced tier — 200 Wave points

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions