|
| 1 | +/** |
| 2 | + * Main environment configuration interface for the Mina Rust frontend. |
| 3 | + * This interface defines all possible configuration options that can be set |
| 4 | + * per environment (development, production, local, etc.). |
| 5 | + * |
| 6 | + * To configure a frontend instance, modify the appropriate environment file: |
| 7 | + * - Development: src/environments/environment.ts |
| 8 | + * - Production: src/environments/environment.prod.ts |
| 9 | + * - Local: src/environments/environment.local.ts |
| 10 | + * - WebNode: src/environments/environment.webnodelocal.ts |
| 11 | + * - Producer: src/environments/environment.producer.ts |
| 12 | + * - Fuzzing: src/environments/environment.fuzzing.ts |
| 13 | + * |
| 14 | + * @see {@link https://github.com/o1-labs/mina-rust/tree/develop/frontend/src/environments} |
| 15 | + */ |
1 | 16 | export interface MinaEnv { |
| 17 | + /** Whether this is a production build */ |
2 | 18 | production: boolean; |
| 19 | + |
| 20 | + /** Array of Mina node configurations to connect to */ |
3 | 21 | configs: MinaNode[]; |
| 22 | + |
| 23 | + /** Human-readable identifier for this environment (e.g., "Dev FE") */ |
4 | 24 | identifier?: string; |
| 25 | + |
| 26 | + /** Hide the top toolbar in the UI */ |
5 | 27 | hideToolbar?: boolean; |
| 28 | + |
| 29 | + /** Hide node statistics display */ |
6 | 30 | hideNodeStats?: boolean; |
| 31 | + |
| 32 | + /** Allow adding custom nodes through the UI */ |
7 | 33 | canAddNodes?: boolean; |
| 34 | + |
| 35 | + /** Show the WebNode landing page */ |
8 | 36 | showWebNodeLandingPage?: boolean; |
| 37 | + |
| 38 | + /** Show the leaderboard/uptime tracking feature */ |
9 | 39 | showLeaderboard?: boolean; |
| 40 | + |
| 41 | + /** Hide the peers pill in the status bar */ |
10 | 42 | hidePeersPill?: boolean; |
| 43 | + |
| 44 | + /** Hide the transactions pill in the status bar */ |
11 | 45 | hideTxPill?: boolean; |
| 46 | + |
| 47 | + /** Sentry error tracking configuration */ |
12 | 48 | sentry?: { |
| 49 | + /** Sentry Data Source Name for error reporting */ |
13 | 50 | dsn: string; |
| 51 | + /** Origins to trace for performance monitoring */ |
14 | 52 | tracingOrigins: string[]; |
15 | 53 | }; |
| 54 | + |
| 55 | + /** Global configuration shared across all nodes */ |
16 | 56 | globalConfig?: { |
| 57 | + /** Feature flags configuration defining which UI sections are available */ |
17 | 58 | features?: FeaturesConfig; |
| 59 | + /** GraphQL endpoint URL for blockchain queries */ |
18 | 60 | graphQL?: string; |
| 61 | + /** Firebase configuration for leaderboard and hosting */ |
19 | 62 | firebase?: any; |
| 63 | + /** Enable heartbeat/uptime tracking functionality */ |
20 | 64 | heartbeats?: boolean; |
21 | 65 | }; |
22 | 66 | } |
23 | 67 |
|
| 68 | +/** |
| 69 | + * Configuration for a single Mina node connection. |
| 70 | + * Each node can have different endpoints and feature sets enabled. |
| 71 | + */ |
24 | 72 | export interface MinaNode { |
| 73 | + /** Display name for this node (e.g., "Local rust node", "Producer-0") */ |
25 | 74 | name: string; |
| 75 | + |
| 76 | + /** Base URL for the node's API endpoint (e.g., "http://127.0.0.1:3000") */ |
26 | 77 | url?: string; |
| 78 | + |
| 79 | + /** URL for memory profiling endpoint */ |
27 | 80 | memoryProfiler?: string; |
| 81 | + |
| 82 | + /** URL for debugger interface */ |
28 | 83 | debugger?: string; |
| 84 | + |
| 85 | + /** Node-specific feature configuration (overrides globalConfig.features) */ |
29 | 86 | features?: FeaturesConfig; |
| 87 | + |
| 88 | + /** Whether this is a user-added custom node */ |
30 | 89 | isCustom?: boolean; |
| 90 | + |
| 91 | + /** Whether this node runs in the browser as a WebNode */ |
31 | 92 | isWebNode?: boolean; |
32 | 93 | } |
33 | 94 |
|
| 95 | +/** |
| 96 | + * Feature flags configuration that controls which UI sections and sub-features |
| 97 | + * are available. Each feature can have multiple sub-features enabled. |
| 98 | + * |
| 99 | + * @example |
| 100 | + * ```typescript |
| 101 | + * features: { |
| 102 | + * 'dashboard': [], // Dashboard tab (no sub-features) |
| 103 | + * 'nodes': ['overview', 'live'], // Nodes tab with overview and live sub-tabs |
| 104 | + * 'network': ['messages', 'blocks'] // Network tab with specific sub-sections |
| 105 | + * } |
| 106 | + * ``` |
| 107 | + */ |
34 | 108 | export type FeaturesConfig = Partial<{ |
| 109 | + /** Main dashboard view */ |
35 | 110 | 'dashboard': string[]; |
| 111 | + |
| 112 | + /** Node management and monitoring features */ |
36 | 113 | 'nodes': string[]; |
| 114 | + |
| 115 | + /** State machine and action tracking */ |
37 | 116 | 'state': string[]; |
| 117 | + |
| 118 | + /** Network topology, messages, and peer connections */ |
38 | 119 | 'network': string[]; |
| 120 | + |
| 121 | + /** SNARK proof generation and verification */ |
39 | 122 | 'snarks': string[]; |
| 123 | + |
| 124 | + /** System resource monitoring (memory, CPU) */ |
40 | 125 | 'resources': string[]; |
| 126 | + |
| 127 | + /** Block production and slot tracking */ |
41 | 128 | 'block-production': string[]; |
| 129 | + |
| 130 | + /** Transaction mempool monitoring */ |
42 | 131 | 'mempool': string[]; |
| 132 | + |
| 133 | + /** Performance benchmarking tools */ |
43 | 134 | 'benchmarks': string[]; |
| 135 | + |
| 136 | + /** Fuzzing and testing tools */ |
44 | 137 | 'fuzzing': string[]; |
45 | 138 | }>; |
46 | 139 |
|
| 140 | +/** |
| 141 | + * Union type of all available feature names. |
| 142 | + * Used for type safety when referencing features in code. |
| 143 | + */ |
47 | 144 | export type FeatureType = keyof FeaturesConfig; |
0 commit comments