-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stefan <[email protected]>
- Loading branch information
1 parent
b57e9c6
commit f6c55f6
Showing
8 changed files
with
2,291 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NEXT_PUBLIC_INFURA_ID= | ||
NEXT_PUBLIC_ALCHEMY_KEY= |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Flex, Text } from "@chakra-ui/react" | ||
import React from "react" | ||
import "@rainbow-me/rainbowkit/styles.css" | ||
import { ConnectButton } from "@rainbow-me/rainbowkit" | ||
|
||
export const Header = () => { | ||
return ( | ||
<Flex | ||
w="full" | ||
pb={2} | ||
my={4} | ||
align="center" | ||
justify="space-between" | ||
borderBottomWidth="1px" | ||
borderBottomColor="gray.200" | ||
> | ||
<Text>@app</Text> | ||
<ConnectButton /> | ||
</Flex> | ||
) | ||
} |
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,5 +1,74 @@ | ||
import { ChakraProvider, Container } from "@chakra-ui/react" | ||
import { | ||
connectorsForWallets, | ||
RainbowKitProvider, | ||
} from "@rainbow-me/rainbowkit" | ||
import { | ||
coinbaseWallet, | ||
metaMaskWallet, | ||
trustWallet, | ||
walletConnectWallet, | ||
} from "@rainbow-me/rainbowkit/wallets" | ||
import { Provider, WebSocketProvider } from "@wagmi/core" | ||
import type { AppProps } from "next/app" | ||
import { Client, configureChains, createClient, WagmiConfig } from "wagmi" | ||
|
||
import { Inter } from "@next/font/google" | ||
import { useEffect, useState } from "react" | ||
import { foundry, mainnet } from "wagmi/chains" | ||
import { alchemyProvider } from "wagmi/providers/alchemy" | ||
import { publicProvider } from "wagmi/providers/public" | ||
import { Header } from "../components/Header" | ||
import { theme } from "./theme" | ||
const inter = Inter({ subsets: ["latin"], variable: "--font-inter" }) | ||
|
||
const { chains, provider } = configureChains( | ||
[mainnet, foundry], | ||
[ | ||
alchemyProvider({ | ||
apiKey: process.env.NEXT_PUBLIC_ALCHEMY_KEY as string, | ||
}), | ||
publicProvider(), | ||
] | ||
) | ||
export default function App({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} /> | ||
const [client, setClient] = useState< | ||
any & Client<Provider, WebSocketProvider> | ||
>() | ||
|
||
useEffect(() => { | ||
const connectors = connectorsForWallets([ | ||
{ | ||
groupName: "Wallets", | ||
wallets: [ | ||
metaMaskWallet({ chains }), | ||
walletConnectWallet({ chains }), | ||
trustWallet({ chains }), | ||
coinbaseWallet({ appName: "@app", chains: chains }), | ||
], | ||
}, | ||
]) | ||
|
||
const wagmiClient = createClient({ | ||
autoConnect: false, | ||
connectors, | ||
provider, | ||
}) | ||
setClient(wagmiClient) | ||
}, []) | ||
|
||
return ( | ||
<ChakraProvider theme={theme}> | ||
{client && ( | ||
<WagmiConfig client={client}> | ||
<RainbowKitProvider chains={chains}> | ||
<Container maxW="container.lg" my={1} className={inter.className}> | ||
<Header /> | ||
<Component {...pageProps} /> | ||
</Container> | ||
</RainbowKitProvider> | ||
</WagmiConfig> | ||
)} | ||
</ChakraProvider> | ||
) | ||
} |
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,7 +1,12 @@ | ||
import { Inter } from "@next/font/google" | ||
|
||
const inter = Inter({ subsets: ["latin"] }) | ||
import { Flex, Text } from "@chakra-ui/react" | ||
import { useAccount } from "wagmi" | ||
|
||
export default function Home() { | ||
return <main>foo</main> | ||
const { address } = useAccount() | ||
|
||
return ( | ||
<Flex> | ||
<Text>{address}</Text> | ||
</Flex> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { extendTheme } from "@chakra-ui/react" | ||
|
||
export const theme = extendTheme({}) |
Oops, something went wrong.