Spaces:
Running
Running
| // Network configuration. Reads NETWORK from env (default: stellar:testnet). | |
| // Set NETWORK=stellar:pubnet for mainnet deployments. | |
| // | |
| // Note: x402 uses CAIP-2-style chain IDs which differ from the Stellar SDK's | |
| // network passphrase concept. Stellar mainnet is "stellar:pubnet" in x402-land. | |
| import { Networks } from "@stellar/stellar-sdk"; | |
| const NETWORKS = { | |
| "stellar:testnet": { | |
| network: "stellar:testnet", | |
| passphrase: Networks.TESTNET, | |
| horizonUrl: "https://horizon-testnet.stellar.org", | |
| usdcIssuer: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5", | |
| }, | |
| "stellar:pubnet": { | |
| network: "stellar:pubnet", | |
| passphrase: Networks.PUBLIC, | |
| horizonUrl: "https://horizon.stellar.org", | |
| usdcIssuer: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN", | |
| }, | |
| }; | |
| const selected = process.env.NETWORK || "stellar:testnet"; | |
| if (!NETWORKS[selected]) { | |
| throw new Error( | |
| `Invalid NETWORK="${selected}". Must be "stellar:testnet" or "stellar:pubnet".`, | |
| ); | |
| } | |
| export const NETWORK = NETWORKS[selected].network; | |
| export const NETWORK_PASSPHRASE = NETWORKS[selected].passphrase; | |
| export const HORIZON_URL = NETWORKS[selected].horizonUrl; | |
| export const USDC_ISSUER = NETWORKS[selected].usdcIssuer; | |
| export const FACILITATOR_URL = | |
| process.env.FACILITATOR_URL || "https://www.x402.org/facilitator"; | |
| export const FACILITATOR_API_KEY = process.env.OPENZEPPELIN_API_KEY || null; | |