-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a76943
commit 1862ccb
Showing
3 changed files
with
123 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,45 @@ | ||
import type { AppProps } from "next/app"; | ||
import { RainbowKitProvider } from "@rainbow-me/rainbowkit"; | ||
import { configureChains, createConfig, WagmiConfig } from "wagmi"; | ||
import { Alfajores, Celo } from "@celo/rainbowkit-celo/chains"; | ||
import celoGroups from "@celo/rainbowkit-celo/lists"; | ||
import Layout from "../components/Layout"; | ||
import "../styles/globals.css"; | ||
import { RainbowKitProvider } from "@rainbow-me/rainbowkit"; | ||
import "@rainbow-me/rainbowkit/styles.css"; | ||
import type { AppProps } from "next/app"; | ||
import { WagmiConfig, configureChains, createConfig } from "wagmi"; | ||
import { publicProvider } from "wagmi/providers/public"; | ||
import { Alfajores, Celo } from "@celo/rainbowkit-celo/chains"; | ||
import Layout from "../components/Layout"; | ||
import "../styles/globals.css"; | ||
|
||
const projectId = process.env.NEXT_PUBLIC_WC_PROJECT_ID as string; // get one at https://cloud.walletconnect.com/app | ||
|
||
const { chains, publicClient } = configureChains( | ||
[Celo, Alfajores], | ||
[publicProvider()] | ||
[Celo, Alfajores], | ||
[publicProvider()] | ||
); | ||
|
||
const connectors = celoGroups({ | ||
chains, | ||
projectId, | ||
appName: | ||
(typeof document === "object" && document.title) || "Your App Name", | ||
chains, | ||
projectId, | ||
appName: (typeof document === "object" && document.title) || "Your App Name", | ||
}); | ||
|
||
const appInfo = { | ||
appName: "Celo Composer", | ||
appName: "Celo Composer", | ||
}; | ||
|
||
const wagmiConfig = createConfig({ | ||
autoConnect: true, | ||
connectors, | ||
publicClient: publicClient, | ||
connectors, | ||
publicClient: publicClient, | ||
}); | ||
|
||
function App({ Component, pageProps }: AppProps) { | ||
return ( | ||
<WagmiConfig config={wagmiConfig}> | ||
<RainbowKitProvider | ||
chains={chains} | ||
appInfo={appInfo} | ||
coolMode={true} | ||
> | ||
<Layout> | ||
<Component {...pageProps} /> | ||
</Layout> | ||
</RainbowKitProvider> | ||
</WagmiConfig> | ||
); | ||
return ( | ||
<WagmiConfig config={wagmiConfig}> | ||
<RainbowKitProvider chains={chains} appInfo={appInfo} coolMode={true}> | ||
<Layout> | ||
<Component {...pageProps} /> | ||
</Layout> | ||
</RainbowKitProvider> | ||
</WagmiConfig> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
import { useEffect, useState } from "react"; | ||
import { useAccount } from "wagmi"; | ||
|
||
export default function Home() { | ||
const [userAddress, setUserAddress] = useState(""); | ||
const { address, isConnected } = useAccount(); | ||
|
||
useEffect(() => { | ||
if (isConnected && address) { | ||
setUserAddress(address); | ||
} | ||
}, [address, isConnected]); | ||
|
||
return ( | ||
<div> | ||
<div className="h1">There you go... a canvas for your next Celo project!</div> | ||
<div className="flex flex-col justify-center items-center"> | ||
<div className="h1"> | ||
There you go... a canvas for your next Celo project! | ||
</div> | ||
{isConnected && ( | ||
<div className="h2 text-center">Your address: {userAddress}</div> | ||
)} | ||
</div> | ||
) | ||
); | ||
} |