From d8d2f99a18e6ac6329daf85eef63a9e6e97209c9 Mon Sep 17 00:00:00 2001 From: Yana Date: Mon, 31 Mar 2025 18:53:31 +0200 Subject: [PATCH] clean up, optimise homepage layout --- explorer-v2/src/app/page.tsx | 9 ++--- explorer-v2/src/app/react-query.ts | 12 +----- .../staking/SubHeaderRowActions.tsx | 38 ++++--------------- 3 files changed, 12 insertions(+), 47 deletions(-) diff --git a/explorer-v2/src/app/page.tsx b/explorer-v2/src/app/page.tsx index f5bbe35eb7..eeb37f361e 100644 --- a/explorer-v2/src/app/page.tsx +++ b/explorer-v2/src/app/page.tsx @@ -15,21 +15,20 @@ export default async function Home() { return ( - - + @@ -39,10 +38,10 @@ export default async function Home() { - + - + diff --git a/explorer-v2/src/app/react-query.ts b/explorer-v2/src/app/react-query.ts index 8828ebba3f..0b59434e68 100644 --- a/explorer-v2/src/app/react-query.ts +++ b/explorer-v2/src/app/react-query.ts @@ -4,17 +4,7 @@ let queryClient: QueryClient | null = null; export function getQueryClient() { if (!queryClient) { - queryClient = new QueryClient( - // { - // defaultOptions: { - // queries: { - // staleTime: 10 * 60 * 1000, // 10 mins - // refetchOnWindowFocus: false, - // refetchOnReconnect: false, - // }, - // }, - // } - ); + queryClient = new QueryClient(); } return queryClient; } diff --git a/explorer-v2/src/components/staking/SubHeaderRowActions.tsx b/explorer-v2/src/components/staking/SubHeaderRowActions.tsx index 9219e0d2e6..68b1f484f5 100644 --- a/explorer-v2/src/components/staking/SubHeaderRowActions.tsx +++ b/explorer-v2/src/components/staking/SubHeaderRowActions.tsx @@ -1,9 +1,11 @@ "use client"; +import { useCallback, useState } from "react"; import { useChain } from "@cosmos-kit/react"; +import { GasPrice } from "@cosmjs/stargate"; +import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; import { Button, Stack } from "@mui/material"; import type { Delegation } from "@nymproject/contract-clients/Mixnet.types"; -import { useCallback, useState } from "react"; import { useQuery, useQueryClient } from "@tanstack/react-query"; import { fetchTotalStakerRewards } from "../../app/api"; import type { NodeRewardDetails } from "../../app/api/types"; @@ -12,25 +14,6 @@ import { useNymClient } from "../../hooks/useNymClient"; import Loading from "../loading"; import InfoModal, { type InfoModalProps } from "../modal/InfoModal"; import RedeemRewardsModal from "../redeemRewards/RedeemRewardsModal"; -import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { GasPrice } from "@cosmjs/stargate"; - - - -// const fee = { gas: "1000000", amount: [{ amount: "1000000", denom: "unym" }] }; -// function createFee(gas: number, gasPrice: number, denom: string) { -// return { -// gas: gas.toString(), -// amount: [ -// { -// amount: Math.ceil(gas * gasPrice).toString(), -// denom, -// }, -// ], -// }; -// } - -// const fee = createFee(1_000_000, 0.025, "unym"); // Fetch delegations @@ -54,10 +37,6 @@ const SubHeaderRowActions = () => { const { address, nymClient } = useNymClient(); const { getSigningCosmWasmClient, getOfflineSigner } = useChain(COSMOS_KIT_USE_CHAIN); - - - - const queryClient = useQueryClient(); // Fetch delegations using React Query @@ -104,10 +83,10 @@ const SubHeaderRowActions = () => { const gasPrice = GasPrice.fromString("0.025unym"); const client = await SigningCosmWasmClient.connectWithSigner( - "https://rpc.nymtech.net/", // rpc endpoint from CosmosKit - signer, - { gasPrice } -); + "https://rpc.nymtech.net/", + signer, + { gasPrice } + ); const messages = delegations.map((delegation: NodeRewardDetails) => ({ contractAddress: NYM_MIXNET_CONTRACT, @@ -119,9 +98,6 @@ const SubHeaderRowActions = () => { }, })); - // const cosmWasmSigningClient = await getSigningCosmWasmClient(); - - const result = await client.executeMultiple( address, messages,