@@ -88,6 +88,15 @@ const AppContent = () => {
8888 // Use Phantom wallet context instead of Swig wallet
8989 const wallet = usePhantomWallet ( ) ;
9090
91+ // State for selected network (must be declared before using in useMemo)
92+ const [ selectedNetwork , setSelectedNetwork ] = useState ( 'solana' ) ;
93+ const [ activeTab , setActiveTab ] = useState ( 'buy' ) ; // 'buy', 'sell', 'myoffers', 'disputes', 'profile'
94+ const [ isGuidedWorkflow , setIsGuidedWorkflow ] = useState ( false ) ;
95+ const [ guidedWorkflowType , setGuidedWorkflowType ] = useState ( null ) ; // 'buy' or 'sell'
96+
97+ // Get network configuration
98+ const network = SVM_NETWORKS [ selectedNetwork ] ;
99+
91100 // Create enhanced connection with retry logic for rate limits
92101 const connection = useMemo ( ( ) => {
93102 return createConnection ( network . endpoint , network . connectionConfig || {
@@ -99,15 +108,6 @@ const AppContent = () => {
99108 // Initialize the Anchor program
100109 const program = useProgram ( connection , wallet ) ;
101110
102- // State for selected network
103- const [ selectedNetwork , setSelectedNetwork ] = useState ( 'solana' ) ;
104- const [ activeTab , setActiveTab ] = useState ( 'buy' ) ; // 'buy', 'sell', 'myoffers', 'disputes', 'profile'
105- const [ isGuidedWorkflow , setIsGuidedWorkflow ] = useState ( false ) ;
106- const [ guidedWorkflowType , setGuidedWorkflowType ] = useState ( null ) ; // 'buy' or 'sell'
107-
108- // Get network configuration
109- const network = SVM_NETWORKS [ selectedNetwork ] ;
110-
111111 // Context values
112112 const contextValue = useMemo ( ( ) => ( {
113113 network,
0 commit comments