Skip to content
Draft
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
5 changes: 1 addition & 4 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import './globals.css';
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import { ThemeProvider } from '@/components/theme-provider';
import { Toaster } from '@/components/ui/toaster';

const inter = Inter({ subsets: ['latin'] });

export const metadata: Metadata = {
title: 'RFV x Greenpill - Regenerative Finance Platform',
description: 'Empowering Regenerative Finance for a Sustainable Future',
Expand All @@ -18,7 +15,7 @@ export default function RootLayout({
}) {
return (
<html lang="en" suppressHydrationWarning>
<body className={inter.className}>
<body className="font-sans">
<ThemeProvider attribute="class" defaultTheme="light">
{children}
<Toaster />
Expand Down
2 changes: 1 addition & 1 deletion components/contact/contact-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { useToast } from "@/components/ui/use-toast";
import { useToast } from "@/hooks/use-toast";

export function ContactForm() {
const [loading, setLoading] = useState(false);
Expand Down
3 changes: 1 addition & 2 deletions components/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use client";

import * as React from "react";
import { ThemeProvider as NextThemesProvider } from "next-themes";
import { type ThemeProviderProps } from "next-themes/dist/types";
import { ThemeProvider as NextThemesProvider, type ThemeProviderProps } from "next-themes";

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
Expand Down
5 changes: 3 additions & 2 deletions components/web3/ConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useState, useCallback } from 'react';
import { Button } from '@/components/ui/button';
import { useToast } from '@/components/ui/use-toast';
import { useToast } from '@/hooks/use-toast';
import { SUPPORTED_CHAINS } from '@/lib/contracts/config';

export function ConnectButton() {
Expand All @@ -22,8 +22,9 @@ export function ConnectButton() {
try {
setConnecting(true);
const chainId = await window.ethereum.request({ method: 'eth_chainId' });
const chainIdNumber = parseInt(chainId as string, 16);

if (!SUPPORTED_CHAINS.includes(parseInt(chainId, 16))) {
if (!(SUPPORTED_CHAINS as readonly number[]).includes(chainIdNumber)) {
toast({
title: "Wrong Network",
description: "Please connect to Ethereum Mainnet or Goerli",
Expand Down
6 changes: 3 additions & 3 deletions lib/hooks/useRFVToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useState, useCallback } from 'react';
import { ethers } from 'ethers';
import RFVTokenABI from '../contracts/abis/RFVToken.json';
import { CONTRACT_ADDRESSES } from '../contracts/config';
import { useToast } from '@/components/ui/use-toast';
import { useToast } from '@/hooks/use-toast';

export function useRFVToken() {
const [balance, setBalance] = useState<string>('0');
Expand All @@ -14,15 +14,15 @@ export function useRFVToken() {
const getBalance = useCallback(async (address: string) => {
try {
setLoading(true);
const provider = new ethers.providers.Web3Provider(window.ethereum);
const provider = new ethers.BrowserProvider(window.ethereum!);
const contract = new ethers.Contract(
CONTRACT_ADDRESSES.RFVToken,
RFVTokenABI.abi,
provider
);

const balance = await contract.balanceOf(address);
setBalance(ethers.utils.formatEther(balance));
setBalance(ethers.formatEther(balance));
} catch (error) {
toast({
title: "Error",
Expand Down
Loading