@percolatorct/sdk 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ /**
3
+ * Read an environment variable safely. Returns `undefined` in browser
4
+ * environments where `process` is not defined, avoiding a
5
+ * `ReferenceError` crash at import time.
6
+ */
7
+ export declare function safeEnv(key: string): string | undefined;
8
+ /**
9
+ * Centralized PROGRAM_ID configuration
10
+ *
11
+ * Default to environment variable, then fall back to network-specific defaults.
12
+ * This prevents hard-coded program IDs scattered across the codebase.
13
+ */
14
+ export declare const PROGRAM_IDS: {
15
+ readonly devnet: {
16
+ readonly percolator: "FxfD37s1AZTeWfFQps9Zpebi2dNQ9QSSDtfMKdbsfKrD";
17
+ readonly matcher: "GTRgyTDfrMvBubALAqtHuQwT8tbGyXid7svXZKtWfC9k";
18
+ };
19
+ readonly mainnet: {
20
+ readonly percolator: "GM8zjJ8LTBMv9xEsverh6H6wLyevgMHEJXcEzyY3rY24";
21
+ readonly matcher: "DHP6DtwXP1yJsz8YzfoeigRFPB979gzmumkmCxDLSkUX";
22
+ };
23
+ };
24
+ export type Network = "devnet" | "mainnet";
25
+ /**
26
+ * Get the Percolator program ID for the current network
27
+ *
28
+ * Priority:
29
+ * 1. PROGRAM_ID env var (explicit override)
30
+ * 2. Network-specific default (NETWORK env var)
31
+ * 3. Devnet default (safest fallback — bug bounty PERC-697)
32
+ */
33
+ export declare function getProgramId(network?: Network): PublicKey;
34
+ /**
35
+ * Get the Matcher program ID for the current network
36
+ */
37
+ export declare function getMatcherProgramId(network?: Network): PublicKey;
38
+ /**
39
+ * Get the current network from environment.
40
+ *
41
+ * SECURITY (PERC-697): Removed silent mainnet default.
42
+ * Previously defaulted to "mainnet" when NETWORK was unset, which could cause
43
+ * crank/keeper scripts run without env vars to silently target mainnet program IDs.
44
+ *
45
+ * Now defaults to "devnet" — the safer fallback for a devnet-first protocol.
46
+ * Production deployments always set NETWORK explicitly via Railway/env.
47
+ * For mainnet operations use networkValidation.ts (ensureNetworkConfigValid) which
48
+ * enforces FORCE_MAINNET=1.
49
+ */
50
+ export declare function getCurrentNetwork(): Network;
@@ -0,0 +1,7 @@
1
+ export * from "./abi/index.js";
2
+ export * from "./solana/index.js";
3
+ export * from "./runtime/index.js";
4
+ export * from "./math/index.js";
5
+ export * from "./validation.js";
6
+ export * from "./oracle/price-router.js";
7
+ export * from "./config/program-ids.js";