Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions base-account/base-account-wagmi-template/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
:root {
background-color: #181818;
color: rgba(255, 255, 255, 0.87);
color-scheme: light dark;
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
font-synthesis: none;
Expand All @@ -13,9 +11,29 @@
-webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: light) {
:root {
background-color: #f8f8f8;
color: #181818;
body {
margin: 0;
padding: 0;
}

/* Spinner animation */
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

/* Input focus styles */
input:focus {
border-color: #667eea !important;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Button hover effects */
button:not(:disabled):hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
267 changes: 228 additions & 39 deletions base-account/base-account-wagmi-template/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,240 @@ function App() {
const { disconnect } = useDisconnect();

return (
<>
<div>
<h2>Account</h2>

<div>
status: {account.status}
<br />
addresses: {JSON.stringify(account.addresses)}
<br />
chainId: {account.chainId}
</div>
<div style={styles.container}>
<div style={styles.innerContainer}>
{/* Header */}
<header style={styles.header}>
<h1 style={styles.title}>🔷 Base Account Demo</h1>
<p style={styles.subtitle}>
Sign in to interact with batch transactions and mint NFTs
</p>
</header>

{/* Account Info Card */}
{account.status === "connected" && (
<button type="button" onClick={() => disconnect()}>
Disconnect
</button>
<div style={styles.card}>
<div style={styles.cardHeader}>
<h2 style={styles.cardTitle}>Your Account</h2>
<span style={{
...styles.statusBadge,
backgroundColor: "#10b981",
}}>
Signed In
</span>
</div>
<div style={styles.accountInfo}>
<div style={styles.infoRow}>
<span style={styles.infoLabel}>Address:</span>
<code style={styles.infoValue}>
{account.addresses?.[0]
? `${account.addresses[0]}`
: "N/A"}
</code>
</div>
</div>
<button
type="button"
onClick={() => disconnect()}
style={styles.disconnectButton}
>
Sign Out
</button>
</div>
)}
</div>

<div>
<h2>Connect</h2>
{connectors.map((connector) => {
if (connector.name === "Base Account") {
return (
<SignInWithBase key={connector.uid} connector={connector} />
);
} else {
return (
<button
key={connector.uid}
onClick={() => connect({ connector })}
type="button"
>
{connector.name}
</button>
);
}
})}
<div>{status}</div>
<div>{error?.message}</div>
</div>
{/* Sign In Card */}
{account.status !== "connected" && (
<div style={styles.card}>
<h2 style={styles.cardTitle}>Sign In</h2>
<p style={styles.cardDescription}>
Choose your preferred sign-in method to get started
</p>
<div style={styles.connectButtons}>
{connectors.map((connector) => {
if (connector.name === "Base Account") {
return (
<SignInWithBase key={connector.uid} connector={connector} />
);
} else {
return (
<button
key={connector.uid}
onClick={() => connect({ connector })}
type="button"
style={styles.connectButton}
>
Sign in with {connector.name}
</button>
);
}
})}
</div>
{status && status !== "idle" && (
<div style={styles.statusMessage}>
<span style={styles.statusText}>Status: {status}</span>
</div>
)}
{error && (
<div style={styles.errorMessage}>
⚠️ {error.message}
</div>
)}
</div>
)}

{/* Batch Transactions Card */}
{account.status === "connected" && (
<div style={styles.card}>
<BatchTransactions />
</div>
)}

{account.status === "connected" && <BatchTransactions />}
</>
{/* Footer */}
<footer style={styles.footer}>
<p style={styles.footerText}>
Powered by Base • Built with Wagmi
</p>
</footer>
</div>
</div>
);
}

const styles = {
container: {
minHeight: "100vh",
background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
padding: "2rem",
} as React.CSSProperties,
innerContainer: {
maxWidth: "800px",
margin: "0 auto",
} as React.CSSProperties,
header: {
textAlign: "center",
marginBottom: "3rem",
color: "white",
} as React.CSSProperties,
title: {
fontSize: "3rem",
fontWeight: "bold",
margin: "0 0 1rem 0",
textShadow: "0 2px 4px rgba(0,0,0,0.1)",
} as React.CSSProperties,
subtitle: {
fontSize: "1.125rem",
opacity: 0.9,
margin: 0,
} as React.CSSProperties,
card: {
backgroundColor: "white",
borderRadius: "16px",
padding: "2rem",
marginBottom: "2rem",
boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
} as React.CSSProperties,
cardHeader: {
display: "flex",
justifyContent: "space-between",
alignItems: "center",
marginBottom: "1.5rem",
} as React.CSSProperties,
cardTitle: {
fontSize: "1.5rem",
fontWeight: "600",
color: "#1f2937",
margin: 0,
} as React.CSSProperties,
cardDescription: {
color: "#6b7280",
marginBottom: "1.5rem",
} as React.CSSProperties,
statusBadge: {
padding: "0.5rem 1rem",
borderRadius: "9999px",
color: "white",
fontSize: "0.875rem",
fontWeight: "500",
} as React.CSSProperties,
accountInfo: {
backgroundColor: "#f9fafb",
borderRadius: "8px",
padding: "1.5rem",
marginBottom: "1.5rem",
} as React.CSSProperties,
infoRow: {
display: "flex",
justifyContent: "space-between",
alignItems: "center",
marginBottom: "0.75rem",
} as React.CSSProperties,
infoLabel: {
fontWeight: "500",
color: "#6b7280",
} as React.CSSProperties,
infoValue: {
color: "#1f2937",
fontWeight: "500",
} as React.CSSProperties,
connectButtons: {
display: "flex",
flexDirection: "column",
gap: "0.75rem",
alignItems: "center",
} as React.CSSProperties,
connectButton: {
width: "100%",
padding: "1rem",
backgroundColor: "#667eea",
color: "white",
border: "none",
borderRadius: "8px",
fontSize: "1rem",
fontWeight: "500",
cursor: "pointer",
transition: "all 0.2s",
} as React.CSSProperties,
disconnectButton: {
width: "100%",
padding: "0.75rem",
backgroundColor: "#ef4444",
color: "white",
border: "none",
borderRadius: "8px",
fontSize: "1rem",
fontWeight: "500",
cursor: "pointer",
transition: "all 0.2s",
} as React.CSSProperties,
statusMessage: {
marginTop: "1rem",
padding: "0.75rem",
backgroundColor: "#dbeafe",
borderRadius: "8px",
textAlign: "center",
} as React.CSSProperties,
statusText: {
color: "#1e40af",
fontWeight: "500",
} as React.CSSProperties,
errorMessage: {
marginTop: "1rem",
padding: "0.75rem",
backgroundColor: "#fee2e2",
borderRadius: "8px",
color: "#991b1b",
textAlign: "center",
} as React.CSSProperties,
footer: {
textAlign: "center",
marginTop: "3rem",
color: "white",
} as React.CSSProperties,
footerText: {
opacity: 0.8,
fontSize: "0.875rem",
} as React.CSSProperties,
};

export default App;
Loading