From 15f31456d9a111943fb4e7ac0a8553a6387cc965 Mon Sep 17 00:00:00 2001 From: Corantin Date: Sun, 20 Oct 2024 13:03:49 -0400 Subject: [PATCH] :recycle: Removed unused imports and debug logs - Removed unused import `abiWithErrors` from multiple files - Changed default value of `showToolTip` in Button.tsx to false - Commented out line fetching element with id "dialog" in EthAddress.tsx - Adjusted TooltipIfOverflow usage in GardenCard.tsx for better readability - Simplified calculation of allocatedInProposal in ProposalCard.tsx - Added console.debug for proposal differences array in Proposals.tsx - Enhanced error logging in useContractWriteWithConfirmations hook by including error message - Added Sentry.extraErrorDataIntegration configuration to sentry.client.config.ts --- .../[garden]/[community]/[poolId]/[proposalId]/page.tsx | 2 +- apps/web/components/ActivatePoints.tsx | 1 - apps/web/components/Button.tsx | 2 +- apps/web/components/CancelButton.tsx | 1 - apps/web/components/DisputeButton.tsx | 4 +--- apps/web/components/EthAddress.tsx | 2 +- apps/web/components/Forms/AllowListInput.tsx | 1 - apps/web/components/Forms/CommunityForm.tsx | 1 - apps/web/components/Forms/ProposalForm.tsx | 1 - apps/web/components/GardenCard.tsx | 6 ++++-- apps/web/components/IncreasePower.tsx | 1 - apps/web/components/PoolHeader.tsx | 3 +-- apps/web/components/PoolMetrics.tsx | 1 - apps/web/components/ProposalCard.tsx | 7 +------ apps/web/components/Proposals.tsx | 6 ++---- apps/web/components/RegisterMember.tsx | 1 - apps/web/hooks/useContractWriteWithConfirmations.ts | 2 +- apps/web/hooks/useHandleAllowance.tsx | 1 - apps/web/hooks/useHandleRegistration.tsx | 1 - apps/web/sentry.client.config.ts | 4 ++++ 20 files changed, 17 insertions(+), 31 deletions(-) diff --git a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx index fd490e9d7..83759f837 100644 --- a/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx +++ b/apps/web/app/(app)/gardens/[chain]/[garden]/[community]/[poolId]/[proposalId]/page.tsx @@ -30,7 +30,7 @@ import { useMetadataIpfsFetch } from "@/hooks/useIpfsFetch"; import { useSubgraphQuery } from "@/hooks/useSubgraphQuery"; import { alloABI } from "@/src/generated"; import { PoolTypes, ProposalStatus } from "@/types"; -import { abiWithErrors } from "@/utils/abi"; + import { useErrorDetails } from "@/utils/getErrorName"; import { prettyTimestamp } from "@/utils/text"; diff --git a/apps/web/components/ActivatePoints.tsx b/apps/web/components/ActivatePoints.tsx index ea67220a1..f62c26d89 100644 --- a/apps/web/components/ActivatePoints.tsx +++ b/apps/web/components/ActivatePoints.tsx @@ -11,7 +11,6 @@ import useCheckAllowList from "@/hooks/useCheckAllowList"; import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations"; import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { cvStrategyABI } from "@/src/generated"; -import { abiWithErrors } from "@/utils/abi"; import { useErrorDetails } from "@/utils/getErrorName"; type ActiveMemberProps = { diff --git a/apps/web/components/Button.tsx b/apps/web/components/Button.tsx index eba123cb3..2aa2c844c 100644 --- a/apps/web/components/Button.tsx +++ b/apps/web/components/Button.tsx @@ -73,7 +73,7 @@ export function Button({ className: styles = "", disabled = false, tooltip, - showToolTip = true, + showToolTip = false, tooltipClassName: tooltipStyles = "", tooltipSide = "tooltip-top", children, diff --git a/apps/web/components/CancelButton.tsx b/apps/web/components/CancelButton.tsx index a6a893320..677c97d11 100644 --- a/apps/web/components/CancelButton.tsx +++ b/apps/web/components/CancelButton.tsx @@ -9,7 +9,6 @@ import { useChainIdFromPath } from "@/hooks/useChainIdFromPath"; import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations"; import { MetadataV1 } from "@/hooks/useIpfsFetch"; import { cvStrategyABI } from "@/src/generated"; -import { abiWithErrors } from "@/utils/abi"; type Props = { proposalData: Maybe< diff --git a/apps/web/components/DisputeButton.tsx b/apps/web/components/DisputeButton.tsx index b678d76de..f0ae76f5a 100644 --- a/apps/web/components/DisputeButton.tsx +++ b/apps/web/components/DisputeButton.tsx @@ -42,11 +42,9 @@ import { safeArbitratorABI, } from "@/src/generated"; import { DisputeStatus, ProposalStatus } from "@/types"; -import { abiWithErrors } from "@/utils/abi"; import { delayAsync } from "@/utils/delayAsync"; import { ipfsJsonUpload } from "@/utils/ipfsUtils"; import { convertSecondsToReadableTime } from "@/utils/numbers"; -import { shortenAddress } from "@/utils/text"; type Props = { proposalData: Maybe< @@ -313,7 +311,7 @@ export const DisputeButton: FC = ({ proposalData }) => { const disableTribunalSafeBtnCondition: ConditionObject[] = [ { condition: !isTribunalSafe, - message: `Connect with Tribunal safe`, + message: "Connect with Tribunal safe", }, ]; diff --git a/apps/web/components/EthAddress.tsx b/apps/web/components/EthAddress.tsx index 665be4740..d55d20f6c 100644 --- a/apps/web/components/EthAddress.tsx +++ b/apps/web/components/EthAddress.tsx @@ -30,7 +30,7 @@ export const EthAddress = ({ }: EthAddressProps) => { const divParentRef = React.useRef(null); const chain = useChainFromPath(); - const topLayerNode = document.getElementById("dialog"); + // const topLayerNode = document.getElementById("dialog"); // const theme: ThemeDeclaration = { // textColor: "black", // // secondaryColor: "black", diff --git a/apps/web/components/Forms/AllowListInput.tsx b/apps/web/components/Forms/AllowListInput.tsx index c4d7e1bd3..d87459893 100644 --- a/apps/web/components/Forms/AllowListInput.tsx +++ b/apps/web/components/Forms/AllowListInput.tsx @@ -244,7 +244,6 @@ export function AllowListInput({ className={`!p-2 font-normal text-[14px] leading-4 ${!isUnlimited ? "" : "!text-black !border-black"}`} onClick={handleAllowEveryone} - showToolTip disabled={!isUnlimited} icon={} tooltip={ diff --git a/apps/web/components/Forms/CommunityForm.tsx b/apps/web/components/Forms/CommunityForm.tsx index f384eb99c..2b49ae14d 100644 --- a/apps/web/components/Forms/CommunityForm.tsx +++ b/apps/web/components/Forms/CommunityForm.tsx @@ -17,7 +17,6 @@ import { useChainFromPath } from "@/hooks/useChainFromPath"; import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations"; import { useDisableButtons } from "@/hooks/useDisableButtons"; import { registryFactoryABI, safeABI } from "@/src/generated"; -import { abiWithErrors } from "@/utils/abi"; import { getEventFromReceipt } from "@/utils/contracts"; import { ipfsJsonUpload } from "@/utils/ipfsUtils"; import { diff --git a/apps/web/components/Forms/ProposalForm.tsx b/apps/web/components/Forms/ProposalForm.tsx index b70626256..8d9a044ca 100644 --- a/apps/web/components/Forms/ProposalForm.tsx +++ b/apps/web/components/Forms/ProposalForm.tsx @@ -23,7 +23,6 @@ import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithC import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { alloABI } from "@/src/generated"; import { PoolTypes } from "@/types"; -import { abiWithErrors } from "@/utils/abi"; import { getEventFromReceipt } from "@/utils/contracts"; import { ipfsJsonUpload } from "@/utils/ipfsUtils"; import { formatTokenAmount } from "@/utils/numbers"; diff --git a/apps/web/components/GardenCard.tsx b/apps/web/components/GardenCard.tsx index 4a613116c..d27e26517 100644 --- a/apps/web/components/GardenCard.tsx +++ b/apps/web/components/GardenCard.tsx @@ -8,10 +8,10 @@ import Image from "next/image"; import { Address } from "viem"; import { getTokenGardensQuery } from "#/subgraph/.graphclient"; import { Statistic, TokenLabel } from "."; +import TooltipIfOverflow from "./TooltipIfOverflow"; import { gardenLand } from "@/assets"; import { Card } from "@/components/Card"; import { ChainIcon, getConfigByChain } from "@/configs/chains"; -import TooltipIfOverflow from "./TooltipIfOverflow"; type TokenGarden = getTokenGardensQuery["tokenGardens"][number]; @@ -45,7 +45,9 @@ export function GardenCard({ garden }: { garden: TokenGarden }) {
{/* TODO: find appropiate token image */}

- {name} + + {name} +

diff --git a/apps/web/components/IncreasePower.tsx b/apps/web/components/IncreasePower.tsx index 7532becd9..9d29e3541 100644 --- a/apps/web/components/IncreasePower.tsx +++ b/apps/web/components/IncreasePower.tsx @@ -20,7 +20,6 @@ import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithC import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { useHandleAllowance } from "@/hooks/useHandleAllowance"; import { registryCommunityABI } from "@/src/generated"; -import { abiWithErrors } from "@/utils/abi"; import { parseToken } from "@/utils/numbers"; import { getTxMessage } from "@/utils/transactionMessages"; diff --git a/apps/web/components/PoolHeader.tsx b/apps/web/components/PoolHeader.tsx index 1c3b64c19..b4c392987 100644 --- a/apps/web/components/PoolHeader.tsx +++ b/apps/web/components/PoolHeader.tsx @@ -44,7 +44,6 @@ import { ProposalStatus, SybilResistanceType, } from "@/types"; -import { abiWithErrors } from "@/utils/abi"; import { convertSecondsToReadableTime, CV_PASSPORT_THRESHOLD_SCALE, @@ -286,7 +285,7 @@ export default function PoolHeader({ const disableCouncilSafeBtnCondition: ConditionObject[] = [ { condition: !isCouncilSafe, - message: `Connect with Council safe`, + message: "Connect with Council safe", }, ]; diff --git a/apps/web/components/PoolMetrics.tsx b/apps/web/components/PoolMetrics.tsx index 0083edf61..db40b1401 100644 --- a/apps/web/components/PoolMetrics.tsx +++ b/apps/web/components/PoolMetrics.tsx @@ -14,7 +14,6 @@ import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithC import { useDisableButtons } from "@/hooks/useDisableButtons"; import { useHandleAllowance } from "@/hooks/useHandleAllowance"; import { alloABI } from "@/src/generated"; -import { abiWithErrors } from "@/utils/abi"; import { getTxMessage } from "@/utils/transactionMessages"; interface PoolMetricsProps { diff --git a/apps/web/components/ProposalCard.tsx b/apps/web/components/ProposalCard.tsx index dd8fd78d4..7e03dc3c6 100644 --- a/apps/web/components/ProposalCard.tsx +++ b/apps/web/components/ProposalCard.tsx @@ -96,11 +96,6 @@ export function ProposalCard({ const inputValue = inputData ? calculatePercentage(inputData.value, memberActivatedPoints) : 0; - const allocatedInProposal = calculatePercentage( - stakedFilter?.value, - memberActivatedPoints, - ); - const poolWeightAllocatedInProposal = ( (inputValue * memberPoolWeight) / 100 @@ -261,7 +256,7 @@ export function ProposalCard({ /{memberPoolWeight}%{" "} - ({allocatedInProposal}% of your total support) + ({inputValue}% of your total support)

{/*

Support

*/} diff --git a/apps/web/components/Proposals.tsx b/apps/web/components/Proposals.tsx index e1de2c89f..8e72f66ed 100644 --- a/apps/web/components/Proposals.tsx +++ b/apps/web/components/Proposals.tsx @@ -7,6 +7,7 @@ import { } from "@heroicons/react/24/outline"; import { FetchTokenResult } from "@wagmi/core"; import Link from "next/link"; +import { Id, toast } from "react-toastify"; import { parseAbiParameters, encodeAbiParameters } from "viem"; import { Address, useAccount, useContractRead } from "wagmi"; import { @@ -38,10 +39,8 @@ import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { useSubgraphQuery } from "@/hooks/useSubgraphQuery"; import { alloABI, cvStrategyABI, registryCommunityABI } from "@/src/generated"; import { ProposalStatus } from "@/types"; -import { abiWithErrors } from "@/utils/abi"; import { useErrorDetails } from "@/utils/getErrorName"; import { calculatePercentage } from "@/utils/numbers"; -import { Id, toast } from "react-toastify"; // Types export type ProposalInputItem = { @@ -128,7 +127,6 @@ export function Proposals({ topic: "member", id: wallet, containerId: strategy.poolId, - type: ["add", "delete"], }, { topic: "proposal", @@ -403,7 +401,7 @@ export function Proposals({ inputs, stakedFilters, ); - + console.debug("Proposal Deltas", proposalsDifferencesArr); const abiTypes = parseAbiParameters( "(uint256 proposalId, int256 deltaSupport)[]", ); diff --git a/apps/web/components/RegisterMember.tsx b/apps/web/components/RegisterMember.tsx index 4b002856a..ddb5d617e 100644 --- a/apps/web/components/RegisterMember.tsx +++ b/apps/web/components/RegisterMember.tsx @@ -17,7 +17,6 @@ import { ConditionObject, useDisableButtons } from "@/hooks/useDisableButtons"; import { useHandleAllowance } from "@/hooks/useHandleAllowance"; import { useHandleRegistration } from "@/hooks/useHandleRegistration"; import { registryCommunityABI } from "@/src/generated"; -import { abiWithErrors } from "@/utils/abi"; import { useErrorDetails } from "@/utils/getErrorName"; import { gte } from "@/utils/numbers"; diff --git a/apps/web/hooks/useContractWriteWithConfirmations.ts b/apps/web/hooks/useContractWriteWithConfirmations.ts index f8053bc74..07e231f84 100644 --- a/apps/web/hooks/useContractWriteWithConfirmations.ts +++ b/apps/web/hooks/useContractWriteWithConfirmations.ts @@ -99,7 +99,7 @@ export function useContractWriteWithConfirmations< console.error( `Error with transaction [${props.contractName} -> ${props.functionName}]`, - { error, variables, context, rawData, contract: props.address }, + { error, variables, context, rawData, contract: props.address, message: error.message }, ); } diff --git a/apps/web/hooks/useHandleAllowance.tsx b/apps/web/hooks/useHandleAllowance.tsx index 70851da08..5fc227043 100644 --- a/apps/web/hooks/useHandleAllowance.tsx +++ b/apps/web/hooks/useHandleAllowance.tsx @@ -4,7 +4,6 @@ import { useChainIdFromPath } from "./useChainIdFromPath"; import { useContractWriteWithConfirmations } from "./useContractWriteWithConfirmations"; import { TransactionProps } from "@/components/TransactionModal"; import { erc20ABI } from "@/src/generated"; -import { abiWithErrors } from "@/utils/abi"; import { getTxMessage } from "@/utils/transactionMessages"; export function useHandleAllowance( diff --git a/apps/web/hooks/useHandleRegistration.tsx b/apps/web/hooks/useHandleRegistration.tsx index 4b0f2cf8b..8b9af261d 100644 --- a/apps/web/hooks/useHandleRegistration.tsx +++ b/apps/web/hooks/useHandleRegistration.tsx @@ -4,7 +4,6 @@ import { TransactionProps } from "@/components/TransactionModal"; import { usePubSubContext } from "@/contexts/pubsub.context"; import { useContractWriteWithConfirmations } from "@/hooks/useContractWriteWithConfirmations"; import { registryCommunityABI } from "@/src/generated"; -import { abiWithErrors } from "@/utils/abi"; import { getTxMessage } from "@/utils/transactionMessages"; export function useHandleRegistration( diff --git a/apps/web/sentry.client.config.ts b/apps/web/sentry.client.config.ts index 535c04b5f..e91b877e1 100644 --- a/apps/web/sentry.client.config.ts +++ b/apps/web/sentry.client.config.ts @@ -31,5 +31,9 @@ Sentry.init({ colorScheme: "light", showBranding: false, }), + Sentry.extraErrorDataIntegration({ + depth: 3, + captureErrorCause: true, + }), ], });