Skip to content

Commit

Permalink
next dependency update, wagmi error fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-89 committed Apr 20, 2024
1 parent 5f102c1 commit 7d4eace
Show file tree
Hide file tree
Showing 6 changed files with 1,599 additions and 1,745 deletions.
2 changes: 1 addition & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { WagmiProvider, http } from 'wagmi'
// import { publicProvider } from 'wagmi/providers/public'
import { defineChain } from 'viem'
import { polygonMumbai } from 'viem/chains'
import { polygonAmoy } from 'viem/chains'
// import { alchemyProvider } from 'wagmi/providers/alchemy'
import {
RainbowKitProvider,
Expand Down
6 changes: 2 additions & 4 deletions components/shared/ButtonConnect/ButtonConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { useConnectModal } from '@rainbow-me/rainbowkit'

const ButtonConnect = () => {
const { openConnectModal } = useConnectModal()
const { isLoading } = useConnect({
chainId: Number(process.env.NEXT_PUBLIC_CHAIN_ID),
})
const { isPending } = useConnect()

return (
<>
Expand All @@ -25,7 +23,7 @@ const ButtonConnect = () => {
data-cy="btn-connect"
>
Connect Wallet
{isLoading && ' ...'}
{isPending && ' ...'}
</Button>
) : null}
</>
Expand Down
8 changes: 3 additions & 5 deletions context/ContractContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'
import { createContext, ReactNode, useContext } from 'react'
import { formatUnits } from 'viem'
import { useContractRead } from 'wagmi'
import { useReadContract } from 'wagmi'

// Contract
import { contractConfig } from '@/contract/config'
Expand Down Expand Up @@ -32,9 +32,8 @@ export function ContractProvider({ children }: { children: ReactNode }) {
isFetching: isTotalMintedFetching,
refetch: refetchTotalMinted,
isFetchedAfterMount: isTotalMintedChecked,
} = useContractRead({
} = useReadContract({
...contractConfig,
enabled: true,
functionName: 'totalMinted',
})

Expand All @@ -43,9 +42,8 @@ export function ContractProvider({ children }: { children: ReactNode }) {
isFetching: isActivePhaseIdFetching,
refetch: refetchActivePhaseId,
isFetchedAfterMount: isActivePhaseIdChecked,
} = useContractRead({
} = useReadContract({
...contractConfig,
enabled: true,
functionName: 'getActiveClaimConditionId',
})

Expand Down
14 changes: 9 additions & 5 deletions context/UserContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext, ReactNode, useContext } from 'react'
import { formatUnits } from 'viem'
import { useAccount, useBalance, useContractRead } from 'wagmi'
import { useAccount, useBalance, useReadContract } from 'wagmi'

// Contexts
import { useContractContext } from './ContractContext'
Expand Down Expand Up @@ -48,9 +48,11 @@ export function UserProvider({ children }: { children: ReactNode }) {
isFetching: isUserTotalNftBalanceFetching,
refetch: refetchUserTotalNftBalance,
isFetchedAfterMount: isUserTotalNftBalanceChecked,
} = useContractRead({
} = useReadContract({
...contractConfig,
enabled: !!address,
query: {
enabled: !!address,
},
functionName: 'balanceOf',
args: [address!],
})
Expand All @@ -60,9 +62,11 @@ export function UserProvider({ children }: { children: ReactNode }) {
isFetching: isUserPhaseNftBalanceFetching,
refetch: refetchUserPhaseNftBalance,
isFetchedAfterMount: isUserPhaseNftBalanceChecked,
} = useContractRead({
} = useReadContract({
...contractConfig,
enabled: !!address && activePhaseId !== undefined,
query: {
enabled: !!address && activePhaseId !== undefined,
},
functionName: 'getSupplyClaimedByWallet',
args: [
//@ts-ignore
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
"eslint": "8.45.0",
"eslint-config-next": "13.4.10",
"lokijs": "1.x",
"next": "14",
"next": "^14.2.2",
"pino-pretty": "^10.3.1",
"postcss": "8.4.31",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.3",
"typescript": "5.1.6",
"viem": "2.x",
"wagmi": "2"
"wagmi": "2",
"webpack-dev-middleware": ">=6.1.2"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.2.18",
Expand All @@ -58,4 +59,4 @@
"postcss": ">=8.4.31",
"express": ">=4.19.2"
}
}
}
Loading

0 comments on commit 7d4eace

Please sign in to comment.