Skip to content

Commit e8f39ae

Browse files
Copilot0xrinegade
andcommitted
Fix devnet environment handling: treat devnet as staging, not development
Co-authored-by: 0xrinegade <[email protected]>
1 parent bc03dac commit e8f39ae

File tree

2 files changed

+8
-36
lines changed

2 files changed

+8
-36
lines changed

src/components/OfferCreation.js

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
4747
const [txHash, setTxHash] = useState('');
4848
const [txStatus, setTxStatus] = useState(null);
4949
const [showConfirmation, setShowConfirmation] = useState(false);
50-
const [devnetBypass, setDevnetBypass] = useState(false);
5150

5251
// Connection status tracking
5352
const isWalletConnected = wallet.connected && wallet.publicKey;
54-
const isSmartContractReady = (isWalletConnected && program && connection && connectionStatus === CONNECTION_STATUS.CONNECTED) || devnetBypass;
53+
const isSmartContractReady = isWalletConnected && program && connection && connectionStatus === CONNECTION_STATUS.CONNECTED;
5554
const isConnectionFailed = connectionStatus === CONNECTION_STATUS.FAILED;
5655
const isConnectionRetrying = connectionStatus === CONNECTION_STATUS.RETRYING;
5756
const isConnectionConnecting = connectionStatus === CONNECTION_STATUS.CONNECTING;
@@ -66,10 +65,9 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
6665
hasProgram: !!program,
6766
hasConnection: !!connection,
6867
connectionStatus,
69-
isSmartContractReady,
70-
devnetBypass
68+
isSmartContractReady
7169
});
72-
}, [isWalletConnected, wallet, program, connection, connectionStatus, isSmartContractReady, devnetBypass]);
70+
}, [isWalletConnected, wallet, program, connection, connectionStatus, isSmartContractReady]);
7371

7472
// Track connection status for better UX
7573
useEffect(() => {
@@ -121,8 +119,8 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
121119
return;
122120
}
123121

124-
if (!isSmartContractReady && !devnetBypass) {
125-
setError('Smart contract connection is not ready. Please check your devnet connection and try again.');
122+
if (!isSmartContractReady) {
123+
setError('Smart contract connection is not ready. Please check your Solana devnet connection and try again.');
126124
return;
127125
}
128126

@@ -495,7 +493,7 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
495493
</ul>
496494

497495
<div className="devnet-notice">
498-
<p><strong>Note:</strong> If devnet endpoints are temporarily unavailable, you can continue in simulation mode for interface testing. Smart contract features will be simulated.</p>
496+
<p><strong>Important:</strong> Solana devnet is required for trading operations. Please ensure you have a stable internet connection and try refreshing the page if the issue persists.</p>
499497
</div>
500498
</>
501499
)}
@@ -517,22 +515,6 @@ const OfferCreation = ({ onStartGuidedWorkflow }) => {
517515
`Retry Connection${connectionAttempts > 0 ? ` (${connectionAttempts})` : ''}`
518516
}
519517
</ButtonLoader>
520-
521-
{isConnectionFailed && (
522-
<button
523-
type="button"
524-
onClick={() => {
525-
// Enable devnet bypass for UI testing when endpoints are unavailable
526-
setDevnetBypass(true);
527-
setError('');
528-
console.log('[OfferCreation] Devnet bypass enabled - simulating connection for UI testing');
529-
}}
530-
className="devnet-bypass-button"
531-
title="Continue with simulation mode (devnet features simulated)"
532-
>
533-
Continue Without Devnet (Simulation Mode)
534-
</button>
535-
)}
536518
</div>
537519
)}
538520
</div>

src/contexts/AppContext.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const AppContextProvider = ({ children }) => {
112112

113113
const errorMessage = `All ${endpoints.length} endpoints failed. Error type: ${errorType}. Last error: ${errorDetails}`;
114114
console.error('[AppContext] All endpoints failed:', errorMessage);
115-
// Don't throw error in development - create fallback connection instead
115+
throw new Error(errorMessage);
116116

117117
} catch (error) {
118118
console.error('[AppContext] Connection creation failed:', error);
@@ -137,17 +137,7 @@ export const AppContextProvider = ({ children }) => {
137137
}, delay);
138138
} else {
139139
setConnectionStatus(CONNECTION_STATUS.FAILED);
140-
// Create a minimal connection for development/testing purposes
141-
try {
142-
const defaultConfig = getDefaultNetworkConfig();
143-
console.log('[AppContext] Creating fallback connection for UI testing');
144-
const conn = new Connection(defaultConfig.endpoint, 'confirmed');
145-
setConnection(conn);
146-
} catch (fallbackError) {
147-
console.error('[AppContext] Even fallback connection failed:', fallbackError);
148-
// Create a null connection to at least allow UI testing
149-
setConnection(null);
150-
}
140+
console.error('[AppContext] Connection failed after max retries:', error.message);
151141
}
152142
}
153143
}, [selectedNetwork, connectionAttempts]);

0 commit comments

Comments
 (0)