Skip to content

Commit

Permalink
chore (compo): better name for wagmi config
Browse files Browse the repository at this point in the history
  • Loading branch information
vblackwhale committed Dec 18, 2024
1 parent 23cc577 commit e4854c6
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/components/DApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@rainbow-me/rainbowkit/styles.css";
import { FC } from "react";
import { WagmiProvider } from "wagmi";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { config } from "../lib/dapp/config";
import { wagmiConfig } from "../lib/dapp/wagmi";
import RainbowKitProvider from "./RainbowKitProvider";
import { MainContextProvider } from "@/contexts";

Expand All @@ -17,7 +17,7 @@ interface Props {
const DApp: FC<Props> = ({ children }) => {
return (
<MainContextProvider>
<WagmiProvider config={config}>
<WagmiProvider config={wagmiConfig}>
<QueryClientProvider client={queryClient}>
<RainbowKitProvider>{children}</RainbowKitProvider>
</QueryClientProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
useBlockNumber,
} from "wagmi";
import { useQueryClient } from "@tanstack/react-query";
import { config } from "@/lib/dapp/config";
import { wagmiConfig } from "@/lib/dapp/wagmi";

interface ProcessBigRequestButtonProps {
lTokenAddress: `0x${string}`;
Expand Down Expand Up @@ -81,7 +81,7 @@ const ProcessBigRequestButton: FC<ProcessBigRequestButtonProps> = ({
allowance >= (requestData ? requestData[1] : 0n)
}
onClick={() => {
writeGenericErc20Approve(config, {
writeGenericErc20Approve(wagmiConfig, {
address: underlyingAddress!,
args: [lTokenAddress, requestData ? requestData[1] : 0n],
});
Expand All @@ -97,7 +97,7 @@ const ProcessBigRequestButton: FC<ProcessBigRequestButtonProps> = ({
allowance < (requestData ? requestData[1] : 0n)
}
onClick={() => {
writeLTokenProcessBigQueuedRequest(config, {
writeLTokenProcessBigQueuedRequest(wagmiConfig, {
address: lTokenAddress,
args: [requestId],
});
Expand Down Expand Up @@ -178,7 +178,7 @@ export const AdminLTokenWithdrawalRequests: FC<Props> = ({ lTokenSymbol }) => {
// Retrieve batch of 50 queued requests data
for (let i = readQueueCursor; i < readQueueCursor + 50n; i++) {
proms.push(
readLToken(config, {
readLToken(wagmiConfig, {
address: lTokenAddress!,
functionName: "withdrawalQueue",
args: [i],
Expand Down
8 changes: 4 additions & 4 deletions src/components/app/dashboard/useGrowthRevenueData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useAvailableLTokens } from "@/hooks/useAvailableLTokens";
import { getContractAddress } from "@/lib/getContractAddress";
import { useEffect, useState } from "react";
import { Activity, LToken, RewardsMint, execute } from "graphclient";
import { config } from "@/lib/dapp/config";
import { wagmiConfig } from "@/lib/dapp/wagmi";
import { useCurrentChain } from "@/hooks/useCurrentChain";

type Data = Record<
Expand Down Expand Up @@ -189,16 +189,16 @@ export const useGrowthRevenueData = () => {
if (currentChain) {
for (const lToken of lTokens) {
const lTokenAddress = getContractAddress(lToken, currentChain.id)!;
const decimals = await readLToken(config, {
const decimals = await readLToken(wagmiConfig, {
address: lTokenAddress,
functionName: "decimals",
});
const _balanceBefore = await readLToken(config, {
const _balanceBefore = await readLToken(wagmiConfig, {
address: lTokenAddress,
functionName: "realBalanceOf",
args: [account.address || zeroAddress],
});
const unclaimedRewards = await readLToken(config, {
const unclaimedRewards = await readLToken(wagmiConfig, {
address: lTokenAddress,
functionName: "unmintedRewardsOf",
args: [account.address || zeroAddress],
Expand Down
6 changes: 3 additions & 3 deletions src/components/app/invest/AppInvestTVL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getContractAddress } from "@/lib/getContractAddress";
import { lTokenAbi } from "@/generated";
import { formatUnits, parseUnits } from "viem";
import { watchBlockNumber, readContracts } from "@wagmi/core";
import { config } from "@/lib/dapp/config";
import { wagmiConfig } from "@/lib/dapp/wagmi";
import { useCurrentChain } from "@/hooks/useCurrentChain";

const availableChains = [42161, 59144];
Expand Down Expand Up @@ -63,11 +63,11 @@ export const AppInvestTVL: FC<Props> = (props) => {

useEffect(
() =>
watchBlockNumber(config, {
watchBlockNumber(wagmiConfig, {
async onBlockNumber() {
if (!currentChain) return;

const data = await readContracts(config, {
const data = await readContracts(wagmiConfig, {
contracts: readsConfig,
});

Expand Down
6 changes: 3 additions & 3 deletions src/components/app/invest/AppInvestTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getContractAddress } from "@/lib/getContractAddress";
import { Spinner } from "@/components/ui/Spinner";
import { zeroAddress } from "viem";
import { watchBlockNumber, readContracts } from "@wagmi/core";
import { config } from "@/lib/dapp/config";
import { wagmiConfig } from "@/lib/dapp/wagmi";
import { useAccount } from "wagmi";
import { JSONStringify } from "@/lib/jsonStringify";
import { useSwitchAppTab } from "@/hooks/useSwitchAppTab";
Expand Down Expand Up @@ -260,11 +260,11 @@ export const AppInvestTokens: FC<Props> = ({ className }) => {

useEffect(
() =>
watchBlockNumber(config, {
watchBlockNumber(wagmiConfig, {
async onBlockNumber() {
if (!currentChain) return;

const data = await readContracts(config, {
const data = await readContracts(wagmiConfig, {
contracts: readsConfig,
});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/dapp/config.ts → src/lib/dapp/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { env } from "../../../env.mjs";
import { wallets } from "./wallets";
import { getDefaultConfig } from "@rainbow-me/rainbowkit";

export const config = getDefaultConfig({
export const wagmiConfig = getDefaultConfig({
appName: "Ledgity Yield",
projectId: env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID,
// ssr: true,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dapp/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const wallets = [
groupName: "Popular",
wallets: [
metaMaskWallet,
rabbyWallet,
rainbowWallet,
safeWallet,
ledgerWallet,
Expand All @@ -46,7 +47,6 @@ export const wallets = [
dawnWallet,
imTokenWallet,
omniWallet,
rabbyWallet,
tahoWallet,
xdefiWallet,
zerionWallet,
Expand Down

0 comments on commit e4854c6

Please sign in to comment.