Skip to content

Commit bc86ea5

Browse files
committed
Merge branch 'main' of github.com:efdevcon/monorepo
2 parents bb99d76 + 2f9b6f2 commit bc86ea5

11 files changed

Lines changed: 262 additions & 182 deletions

File tree

devconnect-app/next.config.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,36 @@ const nextConfig: NextConfig = {
44
/* config options here */
55
devIndicators: false,
66
transpilePackages: ['lib'],
7+
webpack: (config, { isServer }) => {
8+
if (!isServer) {
9+
// Fallbacks for Node.js modules in client-side code
10+
config.resolve.fallback = {
11+
...config.resolve.fallback,
12+
fs: false,
13+
net: false,
14+
tls: false,
15+
crypto: false,
16+
stream: false,
17+
url: false,
18+
zlib: false,
19+
http: false,
20+
https: false,
21+
assert: false,
22+
os: false,
23+
path: false,
24+
};
25+
}
26+
27+
// Add null-loader for fastfile to prevent fs module issues
28+
config.module.rules.push({
29+
test: /fastfile/,
30+
use: {
31+
loader: 'null-loader',
32+
},
33+
});
34+
35+
return config;
36+
},
737
turbopack: {
838
rules: {
939
'*.svg': {

devconnect-app/src/app/api/portfolio/route.ts

Lines changed: 65 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,58 @@
11
import { NextRequest, NextResponse } from 'next/server';
2+
import { chains } from '@/config/networks';
23

34
const ZAPPER_API_KEY = process.env.ZAPPER_API_KEY;
45

6+
// Helper function to get readable network name
7+
const getReadableNetworkName = (networkName: string): string => {
8+
const networkMap: Record<string, string> = {
9+
'ETHEREUM_MAINNET': 'Ethereum',
10+
'BASE_MAINNET': 'Base',
11+
'OPTIMISM_MAINNET': 'Optimism',
12+
'ARBITRUM_MAINNET': 'Arbitrum',
13+
'Ethereum': 'Ethereum',
14+
'Base': 'Base',
15+
'OP Mainnet': 'Optimism',
16+
'Arbitrum One': 'Arbitrum',
17+
// Additional possible formats from Zapper
18+
'ethereum': 'Ethereum',
19+
'base': 'Base',
20+
'optimism': 'Optimism',
21+
'arbitrum': 'Arbitrum',
22+
'Ethereum Mainnet': 'Ethereum',
23+
'Base Mainnet': 'Base',
24+
'Optimism Mainnet': 'Optimism',
25+
'Arbitrum Mainnet': 'Arbitrum',
26+
};
27+
28+
// Check exact match first
29+
if (networkMap[networkName]) {
30+
return networkMap[networkName];
31+
}
32+
33+
// Check if network name contains keywords (case insensitive)
34+
const lowerName = networkName.toLowerCase();
35+
if (lowerName.includes('ethereum') || lowerName.includes('eth')) {
36+
return 'Ethereum';
37+
}
38+
if (lowerName.includes('base')) {
39+
return 'Base';
40+
}
41+
if (lowerName.includes('optimism') || lowerName.includes('op')) {
42+
return 'Optimism';
43+
}
44+
if (lowerName.includes('arbitrum') || lowerName.includes('arb')) {
45+
return 'Arbitrum';
46+
}
47+
48+
return networkName;
49+
};
50+
551
export async function POST(request: NextRequest) {
652
try {
7-
const { address, network = 'base' } = await request.json();
53+
const { address } = await request.json();
854

9-
console.log('Portfolio API called for address:', address, 'network:', network);
55+
console.log('Portfolio API called for address:', address);
1056

1157
if (!address) {
1258
return NextResponse.json(
@@ -22,15 +68,8 @@ export async function POST(request: NextRequest) {
2268
);
2369
}
2470

25-
// Network configuration
26-
const networkConfig = {
27-
mainnet: { chainId: 1, network: 'ETHEREUM_MAINNET' },
28-
'op-mainnet': { chainId: 10, network: 'OPTIMISM_MAINNET' },
29-
base: { chainId: 8453, network: 'BASE_MAINNET' },
30-
arbitrum: { chainId: 42161, network: 'ARBITRUM_MAINNET' }
31-
};
32-
33-
const selectedNetwork = networkConfig[network as keyof typeof networkConfig] || networkConfig.base;
71+
// Get all chain IDs from the chains configuration
72+
const chainIds = chains.map(chain => chain.id);
3473

3574
const headers = {
3675
'Content-Type': 'application/json',
@@ -75,7 +114,7 @@ export async function POST(request: NextRequest) {
75114
query: portfolioQuery,
76115
variables: {
77116
addresses: [address],
78-
chainIds: [selectedNetwork.chainId],
117+
chainIds: chainIds,
79118
},
80119
}),
81120
});
@@ -92,7 +131,7 @@ export async function POST(request: NextRequest) {
92131

93132
console.log('Portfolio data fetched successfully');
94133

95-
// Fetch activity data for Base chain only
134+
// Fetch activity data for all chains
96135
const activityQuery = `
97136
query TransactionDescriptionExample($subjects: [Address!]!, $perspective: TransactionHistoryV2Perspective, $first: Int, $filters: TransactionHistoryV2FiltersArgs) {
98137
transactionHistoryV2(subjects: $subjects, perspective: $perspective, first: $first, filters: $filters) {
@@ -151,7 +190,7 @@ export async function POST(request: NextRequest) {
151190
perspective: 'All',
152191
first: 20,
153192
filters: {
154-
chainIds: [selectedNetwork.chainId]
193+
chainIds: chainIds
155194
}
156195
},
157196
}),
@@ -191,10 +230,13 @@ export async function POST(request: NextRequest) {
191230
}
192231

193232
// Add transaction data in the format expected by the frontend
233+
// Find the chain name for this network and make it readable
234+
const chain = chains.find(c => c.id === node.network);
235+
const networkName = chain?.name || `Chain ${node.network}`;
194236
node.transaction = {
195237
hash: node.transactionHash,
196238
timestamp: node.transactionBlockTimestamp,
197-
network: node.network
239+
network: getReadableNetworkName(networkName)
198240
};
199241
}
200242
});
@@ -213,7 +255,14 @@ export async function POST(request: NextRequest) {
213255
const portfolio = portfolioResult.data.portfolioV2;
214256

215257
// Filter tokens with value >= $0.01 and calculate total from tokens only
216-
const allTokenBalances = portfolio.tokenBalances?.byToken?.edges?.map((edge: any) => edge.node) || [];
258+
const allTokenBalances = portfolio.tokenBalances?.byToken?.edges?.map((edge: any) => {
259+
const token = edge.node;
260+
// Update network name to be readable
261+
if (token.network?.name) {
262+
token.network.name = getReadableNetworkName(token.network.name);
263+
}
264+
return token;
265+
}) || [];
217266
const filteredTokenBalances = allTokenBalances.filter((token: any) => token.balanceUSD >= 0.01);
218267

219268
const totalValue = filteredTokenBalances.reduce((sum: number, token: any) => sum + token.balanceUSD, 0);

devconnect-app/src/app/layout.tsx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -163,25 +163,14 @@ export default function RootLayout({
163163
<body
164164
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
165165
>
166-
{hasSupabase ? (
167-
<SkippedProvider>
168-
<PWAProvider>
169-
<WalletsProviders>
170-
{children}
171-
<NewDeployment />
172-
</WalletsProviders>
173-
</PWAProvider>
174-
</SkippedProvider>
175-
) : (
176-
<SkippedProvider>
177-
<PWAProvider>
178-
<WalletsProviders>
179-
{children}
180-
<NewDeployment />
181-
</WalletsProviders>
182-
</PWAProvider>
183-
</SkippedProvider>
184-
)}
166+
<SkippedProvider>
167+
<PWAProvider>
168+
<WalletsProviders>
169+
{children}
170+
<NewDeployment />
171+
</WalletsProviders>
172+
</PWAProvider>
173+
</SkippedProvider>
185174
<Toaster />
186175
</body>
187176
</html>

devconnect-app/src/app/onboarding/WalletTab.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import Onboarding from '@/components/Onboarding';
55
import ConnectedWallet from '@/components/ConnectedWallet';
66
import { useUnifiedConnection } from '@/hooks/useUnifiedConnection';
77
import { useUser } from '@/hooks/useUser';
8+
import { useRouter } from 'next/navigation';
89

910
export default function HomePage() {
1011
// Unified connection status - trust the unified hook completely
1112
const { isConnected, address, isPara } = useUnifiedConnection();
1213
const { user } = useUser();
14+
const router = useRouter();
1315

1416
// Only log significant connection changes to avoid spam
1517
const lastLoggedState = useRef<string | null>(null);
@@ -28,6 +30,18 @@ export default function HomePage() {
2830
}
2931
}, [isConnected, address, isPara]);
3032

33+
useEffect(() => {
34+
console.log('🔄 [ONBOARDING] Connection status:', address);
35+
if (
36+
typeof window !== 'undefined' &&
37+
window.location.pathname === '/onboarding' &&
38+
address
39+
) {
40+
console.log('🔄 [ONBOARDING] Redirecting to profile');
41+
router.push('/profile');
42+
}
43+
}, [address]);
44+
3145
return (
3246
<>
3347
{!address ? (

devconnect-app/src/app/onboarding/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import Auth from '@/components/Auth';
33

44
export default function OnboardingPage() {
55
return (
6-
<Auth>
7-
<WalletTab />
8-
</Auth>
6+
// <Auth>
7+
<WalletTab />
8+
// </Auth>
99
);
1010
}

devconnect-app/src/app/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import PageLayout from '@/components/PageLayout';
55
import TabbedSection from '@/components/TabbedSection';
66
import DashboardImage from '@/images/hero.webp';
77
import Image from 'next/image';
8+
import { useUnifiedConnection } from '@/hooks/useUnifiedConnection';
89
// import { NAV_ITEMS } from '@/config/nav-items';
910

1011
// const navItem = NAV_ITEMS.find((item) => item.href === '/');
@@ -28,14 +29,16 @@ const tabs = [
2829

2930
export default function HomePage() {
3031
const router = useRouter();
32+
const { address } = useUnifiedConnection();
3133

3234
useEffect(() => {
3335
const isSkipped = localStorage.getItem('loginIsSkipped');
3436

35-
if (!isSkipped) {
37+
if (!isSkipped && address) {
38+
console.log('🔄 [HOME] Redirecting to onboarding');
3639
router.push('/onboarding');
3740
}
38-
}, [router]);
41+
}, [router, address]);
3942

4043
// if (!address) {
4144
// return <WalletTab />;

devconnect-app/src/app/profile/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ const navLabel = navItem?.label || 'Sign up';
1313
const title = navLabel;
1414

1515
const tabs = [
16-
// {
17-
// label: 'Wallet',
18-
// component: () => <WalletTab />,
19-
// },
16+
{
17+
label: 'Wallet',
18+
component: () => <WalletTab />,
19+
},
2020
{
2121
label: 'Ticket',
2222
component: () => <TicketTab />,

devconnect-app/src/components/Onboarding.tsx

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export default function Onboarding({ onConnect }: OnboardingProps) {
2424
const { open } = useAppKit();
2525
const { connect, connectors } = useConnect();
2626
const { isSkipped, setSkipped } = useUnifiedConnection();
27-
const [showGetStarted, setShowGetStarted] = useState(true);
2827
const [authState, setAuthState] = useState<AuthState | undefined>();
2928
const { user, signOut } = useUser();
3029
const [email, setEmail] = useState('');
@@ -59,10 +58,6 @@ export default function Onboarding({ onConnect }: OnboardingProps) {
5958
(connector: any) => connector.id === 'para'
6059
);
6160

62-
const handleGetStarted = () => {
63-
setShowGetStarted(false);
64-
};
65-
6661
const handleWalletConnect = () => {
6762
// Use AppKit for wallet connections
6863
open();
@@ -200,7 +195,6 @@ export default function Onboarding({ onConnect }: OnboardingProps) {
200195
};
201196

202197
const handleReset = () => {
203-
setShowGetStarted(true);
204198
setSkipped(false);
205199
setAuthState(undefined);
206200
setEmail('');
@@ -211,7 +205,6 @@ export default function Onboarding({ onConnect }: OnboardingProps) {
211205
try {
212206
await signOut();
213207
// Reset the onboarding state after logout
214-
setShowGetStarted(true);
215208
setSkipped(false);
216209
setAuthState(undefined);
217210
setEmail('');
@@ -295,60 +288,6 @@ export default function Onboarding({ onConnect }: OnboardingProps) {
295288
};
296289
}, []);
297290

298-
// GetStarted Container
299-
if (showGetStarted) {
300-
return (
301-
<div className="bg-white box-border flex flex-col gap-4 items-center justify-center pb-7 pt-6 px-6 relative rounded-[1px] w-full">
302-
{/* Main border with shadow */}
303-
<div className="absolute border border-white border-solid inset-[-0.5px] pointer-events-none rounded-[1.5px] shadow-[0px_8px_0px_0px_#36364c]" />
304-
305-
<div className="flex flex-col gap-3 items-start justify-start p-0 relative w-full">
306-
{/* Title container with rating */}
307-
<div className="flex flex-col gap-3 items-start justify-start p-0 relative w-full">
308-
<div className="flex flex-col gap-3 items-start justify-start p-0 relative w-full">
309-
{/* PATHFINDER WIP title */}
310-
<div className="flex items-center justify-start w-full">
311-
<img
312-
src="/images/devonnect-arg-pathfinder.png"
313-
alt="Devconnect ARG Pathfinder"
314-
className="h-auto w-full max-w-full"
315-
/>
316-
</div>
317-
</div>
318-
319-
{/* Description */}
320-
<div className="font-normal text-[#36364c] text-[18px] leading-[1.4] tracking-[-0.2px]">
321-
Your companion for{' '}
322-
<span className="text-[#36364c]">Devconnect ARG</span>, the first
323-
Ethereum World&apos;s Fair.
324-
</div>
325-
</div>
326-
</div>
327-
328-
{/* Get Started Button */}
329-
<button
330-
onClick={handleGetStarted}
331-
className="bg-[#1b6fae] flex flex-row gap-2 items-center justify-center p-[16px] relative rounded-[1px] shadow-[0px_6px_0px_0px_#125181] w-full hover:bg-[#125181] transition-colors"
332-
>
333-
<span className="font-bold text-white text-[16px] text-center tracking-[-0.1px] leading-none">
334-
Get started
335-
</span>
336-
</button>
337-
338-
{/* Logout Button - Only show when user is logged in */}
339-
{user && (
340-
<button
341-
onClick={handleLogout}
342-
className="bg-white flex flex-row gap-2 items-center justify-center p-[12px] relative rounded-[1px] w-full border border-[#4b4b66] shadow-[0px_2px_0px_0px_#4b4b66] hover:bg-gray-50 transition-colors"
343-
>
344-
<span className="font-bold text-[#36364c] text-[14px] text-center tracking-[-0.1px] leading-none">
345-
Account logout
346-
</span>
347-
</button>
348-
)}
349-
</div>
350-
);
351-
}
352291

353292
// Email verification screen
354293
if (authState?.stage === 'verify') {

0 commit comments

Comments
 (0)