tantk commited on
Commit
df61c23
·
verified ·
1 Parent(s): bbe58f8

feat: OpenZeppelin x402 mainnet support — update network-config.js

Browse files
Files changed (1) hide show
  1. network-config.js +8 -4
network-config.js CHANGED
@@ -1,5 +1,8 @@
1
  // Network configuration. Reads NETWORK from env (default: stellar:testnet).
2
- // Set NETWORK=stellar:public for mainnet deployments.
 
 
 
3
  import { Networks } from "@stellar/stellar-sdk";
4
 
5
  const NETWORKS = {
@@ -9,8 +12,8 @@ const NETWORKS = {
9
  horizonUrl: "https://horizon-testnet.stellar.org",
10
  usdcIssuer: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
11
  },
12
- "stellar:public": {
13
- network: "stellar:public",
14
  passphrase: Networks.PUBLIC,
15
  horizonUrl: "https://horizon.stellar.org",
16
  usdcIssuer: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
@@ -20,7 +23,7 @@ const NETWORKS = {
20
  const selected = process.env.NETWORK || "stellar:testnet";
21
  if (!NETWORKS[selected]) {
22
  throw new Error(
23
- `Invalid NETWORK="${selected}". Must be "stellar:testnet" or "stellar:public".`,
24
  );
25
  }
26
 
@@ -30,3 +33,4 @@ export const HORIZON_URL = NETWORKS[selected].horizonUrl;
30
  export const USDC_ISSUER = NETWORKS[selected].usdcIssuer;
31
  export const FACILITATOR_URL =
32
  process.env.FACILITATOR_URL || "https://www.x402.org/facilitator";
 
 
1
  // Network configuration. Reads NETWORK from env (default: stellar:testnet).
2
+ // Set NETWORK=stellar:pubnet for mainnet deployments.
3
+ //
4
+ // Note: x402 uses CAIP-2-style chain IDs which differ from the Stellar SDK's
5
+ // network passphrase concept. Stellar mainnet is "stellar:pubnet" in x402-land.
6
  import { Networks } from "@stellar/stellar-sdk";
7
 
8
  const NETWORKS = {
 
12
  horizonUrl: "https://horizon-testnet.stellar.org",
13
  usdcIssuer: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
14
  },
15
+ "stellar:pubnet": {
16
+ network: "stellar:pubnet",
17
  passphrase: Networks.PUBLIC,
18
  horizonUrl: "https://horizon.stellar.org",
19
  usdcIssuer: "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
 
23
  const selected = process.env.NETWORK || "stellar:testnet";
24
  if (!NETWORKS[selected]) {
25
  throw new Error(
26
+ `Invalid NETWORK="${selected}". Must be "stellar:testnet" or "stellar:pubnet".`,
27
  );
28
  }
29
 
 
33
  export const USDC_ISSUER = NETWORKS[selected].usdcIssuer;
34
  export const FACILITATOR_URL =
35
  process.env.FACILITATOR_URL || "https://www.x402.org/facilitator";
36
+ export const FACILITATOR_API_KEY = process.env.OPENZEPPELIN_API_KEY || null;