@@ -32,7 +32,9 @@ interface CommandResult {
3232// Constants
3333// ============================================================================
3434
35- const RPC_URL = process . env . NEXT_PUBLIC_RPC_URL || 'https://rpc.demiurge.cloud' ;
35+ // Use local proxy to avoid CORS issues
36+ const RPC_URL = '/api/rpc' ;
37+ const RPC_DISPLAY_URL = process . env . NEXT_PUBLIC_RPC_URL || 'https://rpc.demiurge.cloud' ;
3638
3739const HELP_TEXT = `
3840╔══════════════════════════════════════════════════════════════════════════╗
@@ -83,7 +85,7 @@ const WELCOME_MESSAGE = `
8385║ On-Chain CLI Terminal v1.0.0 - Web Interface ║
8486║ ║
8587║ Type 'help' for available commands ║
86- ║ Connected to: ${ RPC_URL . padEnd ( 52 ) } ║
88+ ║ Connected to: ${ RPC_DISPLAY_URL . padEnd ( 52 ) } ║
8789╚══════════════════════════════════════════════════════════════════════════╝
8890` ;
8991
@@ -94,9 +96,11 @@ const WELCOME_MESSAGE = `
9496class CommandExecutor {
9597 private client : DemiurgeClient ;
9698 private rpcUrl : string ;
99+ private displayUrl : string ;
97100
98- constructor ( rpcUrl : string = RPC_URL ) {
101+ constructor ( rpcUrl : string = RPC_URL , displayUrl : string = RPC_DISPLAY_URL ) {
99102 this . rpcUrl = rpcUrl ;
103+ this . displayUrl = displayUrl ;
100104 this . client = new DemiurgeClient ( { endpoint : rpcUrl } ) ;
101105 }
102106
@@ -158,7 +162,7 @@ class CommandExecutor {
158162 type : 'output' ,
159163 content : JSON . stringify ( {
160164 blockHeight : blockNumber ,
161- rpcEndpoint : this . rpcUrl ,
165+ rpcEndpoint : this . displayUrl ,
162166 network : 'Demiurge Mainnet' ,
163167 status : 'Online' ,
164168 } , null , 2 ) ,
@@ -172,7 +176,7 @@ class CommandExecutor {
172176│ Metric │ Value │
173177├────────────────────────────────┼────────────────────────────────────────────┤
174178│ Block Height │ ${ String ( blockNumber ) . padEnd ( 42 ) } │
175- │ RPC Endpoint │ ${ this . rpcUrl . padEnd ( 42 ) } │
179+ │ RPC Endpoint │ ${ this . displayUrl . padEnd ( 42 ) } │
176180│ Network │ Demiurge Mainnet │
177181│ Status │ ● Online │
178182└────────────────────────────────┴────────────────────────────────────────────┘
@@ -685,7 +689,7 @@ export function WebTerminal({ isOpen, onClose }: WebTerminalProps) {
685689 </ span >
686690 </ div >
687691 < div className = "flex items-center gap-4 text-xs text-text-tertiary font-mono" >
688- < span > RPC: { RPC_URL } </ span >
692+ < span > RPC: { RPC_DISPLAY_URL } </ span >
689693 < span className = "text-green-400" > ● Connected</ span >
690694 </ div >
691695 </ div >
0 commit comments