11import React , { useMemo , useState , useEffect } from 'react' ;
22import Image from 'next/image' ;
3- import { ConnectionProvider , WalletProvider } from '@solana/wallet-adapter-react' ;
4- import { WalletAdapterNetwork } from '@solana/wallet-adapter-base' ;
5- import {
6- PhantomWalletAdapter ,
7- } from '@solana/wallet-adapter-wallets' ;
8- import {
9- WalletModalProvider ,
10- WalletDisconnectButton ,
11- WalletMultiButton
12- } from '@solana/wallet-adapter-react-ui' ;
133import { clusterApiUrl } from '@solana/web3.js' ;
144
155// Import styles
16- import '@solana/wallet-adapter-react-ui/styles.css' ;
176import './styles/guided-workflow.css' ;
187import './styles/wallet-connection-guide.css' ;
198
@@ -27,8 +16,9 @@ import { UserProfile } from './components/UserProfile';
2716import TradingGuidedWorkflow from './components/guided-workflow/TradingGuidedWorkflow' ;
2817import ErrorBoundary from './components/ErrorBoundary' ;
2918
30- // Import wallet safety utilities
31- import { SafeWalletProvider , useSafeWallet } from './contexts/WalletContextProvider' ;
19+ // Import Swig wallet utilities
20+ import { SwigWalletProvider , useSwigWallet } from './contexts/SwigWalletProvider' ;
21+ import { SwigWalletButton } from './components/SwigWalletButton' ;
3222import { initializeWalletConflictPrevention } from './utils/walletConflictPrevention' ;
3323import { createConnection , getNetworkConnection } from './utils/rpcConnection' ;
3424
@@ -89,10 +79,10 @@ const SVM_NETWORKS = {
8979 }
9080} ;
9181
92- // Inner component that can use the wallet hook
82+ // Inner component that can use the Swig wallet hook
9383const AppContent = ( ) => {
94- // Use safe wallet context instead of direct wallet adapter
95- const wallet = useSafeWallet ( ) ;
84+ // Use Swig wallet context instead of Solana wallet adapter
85+ const wallet = useSwigWallet ( ) ;
9686
9787 // State for selected network
9888 const [ selectedNetwork , setSelectedNetwork ] = useState ( 'solana' ) ;
@@ -134,7 +124,7 @@ const AppContent = () => {
134124 setActiveTab ( tab ) ;
135125 } ;
136126
137- // Status indicator for wallet connection
127+ // Status indicator for Swig wallet connection
138128 const renderWalletStatus = ( ) => {
139129 if ( wallet . error ) {
140130 return (
@@ -258,7 +248,7 @@ const AppContent = () => {
258248 } >
259249 < div className = "wallet-wrapper" >
260250 { renderWalletStatus ( ) }
261- < WalletMultiButton />
251+ < SwigWalletButton />
262252 { wallet . error && (
263253 < button
264254 className = "wallet-retry-button"
@@ -416,14 +406,6 @@ const AppContent = () => {
416406} ;
417407
418408const App = ( ) => {
419- // Set up wallet adapters - updated for latest wallet adapter versions
420- const wallets = useMemo (
421- ( ) => [
422- new PhantomWalletAdapter ( ) ,
423- ] ,
424- [ ]
425- ) ;
426-
427409 // Define network for connection provider
428410 const network = SVM_NETWORKS [ 'solana' ] ;
429411
@@ -452,15 +434,9 @@ const App = () => {
452434 </ div >
453435 </ div >
454436 } >
455- < ConnectionProvider endpoint = { network . endpoint } config = { network . connectionConfig } connection = { connection } >
456- < WalletProvider wallets = { wallets } autoConnect >
457- < SafeWalletProvider >
458- < WalletModalProvider >
459- < AppContent />
460- </ WalletModalProvider >
461- </ SafeWalletProvider >
462- </ WalletProvider >
463- </ ConnectionProvider >
437+ < SwigWalletProvider >
438+ < AppContent />
439+ </ SwigWalletProvider >
464440 </ ErrorBoundary >
465441 ) ;
466442} ;
0 commit comments