Skip to content

Add environment constants (sandbox/production, testnet/mainnet) #3

Description

@codebestia

Description:

The SDK targets two environments — sandbox (Stellar testnet, staging backend) and production (Stellar mainnet, live backend). These must be represented as an enum so the HTTP client and Stellar layer automatically resolve the correct API base URL and network passphrase without the user doing the mapping themselves.

Proposed Steps:

  • Define an Environment enum in config.py with values SANDBOX and PRODUCTION.
  • Map each value to its Horizon URL, network passphrase, and Shade backend URL.
  • Accept string shorthands "sandbox" / "production" via a parse_environment() coercer.
  • Default the SDK to SANDBOX so developers don't accidentally hit production.

Acceptance Criteria:

  • shade.environment = "production" resolves to the mainnet Horizon URL and production API base.
  • shade.environment = "sandbox" resolves to the testnet Horizon URL and staging API base.
  • Invalid strings raise ValueError with the list of valid options.
  • The Stellar layer reads Environment without separate configuration.

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions