import '@rainbow-me/rainbowkit/styles.css'; import { getDefaultWallets, RainbowKitProvider } from '@rainbow-me/rainbowkit'; import { ConnectButton } from '@rainbow-me/rainbowkit'; import { configureChains, createClient, WagmiConfig } from 'wagmi'; import { mainnet, goerli, localhost } from 'wagmi/chains'; import { publicProvider } from 'wagmi/providers/public'; import { AwesomeButton, AwesomeButtonProgress, AwesomeButtonSocial } from 'react-awesome-button'; const { chains, provider } = configureChains( [mainnet, goerli, localhost], [publicProvider()] ); const { connectors } = getDefaultWallets({ appName: 'My RainbowKit App', chains }); const wagmiClient = createClient({ autoConnect: true, connectors, provider }); function Wallet() { return ( {({ account, chain, openAccountModal, openChainModal, openConnectModal, mounted, }) => { const ready = mounted; const connected = ready && account && chain; return (
{(() => { if (!connected) { return ( { openConnectModal(); release(); }}> Connect Wallet ); } if (chain.unsupported) { return ( { openChainModal(); release(); }}> Wrong network ); } return (
{ openChainModal(); release(); }}> {chain.hasIcon && (
{chain.iconUrl && ( {chain.name )}
)} {chain.name}
{ openAccountModal(); release(); }}> {account.displayName} {account.displayBalance ? ` (${account.displayBalance})` : ''}
); })()}
); }}
); }; export default Wallet;