From 079d3b0d8357581d154f34e9f541fa1f07f2fb75 Mon Sep 17 00:00:00 2001 From: Oleksandr Date: Thu, 25 Jan 2024 08:37:48 +0200 Subject: [PATCH] feat!: update caching system (#59) * fix: update bgd helper package * fix: proposal history events (added cached data) * fix: dayjs format typo * fix: tutorial open behavior * fix: zero payloads in payloads controller * feat: finished cache system update --- app/page.page.tsx | 2 +- app/proposal/page.page.tsx | 8 +- next.config.js | 2 + package.json | 4 +- .../components/PayloadExploreItem.tsx | 2 +- .../components/PayloadExploreItemLoading.tsx | 244 ++++++------ .../components/PayloadItemDetailsModal.tsx | 2 +- .../components/PayloadStatus.tsx | 10 +- .../components/PayloadsExplorerPage.tsx | 17 +- .../store/payloadsExplorerSlice.ts | 10 +- .../store/proposalCreateOverviewSlice.ts | 4 +- .../components/ProposalEstimatedStatus.tsx | 2 +- src/proposals/components/ProposalStatus.tsx | 10 +- .../components/actionModals/VoteModal.tsx | 20 +- .../components/proposal/PayloadActions.tsx | 85 ++-- .../proposal/ProposalClientPage.tsx | 2 +- .../components/proposal/ProposalPage.tsx | 50 +-- .../proposal/ProposalPageWrapper.tsx | 14 +- .../proposal/ProposalPageWrapperSSR.tsx | 2 +- .../proposal/ProposalPageWrapperWithCache.tsx | 2 +- .../proposal/ProposalStatusDetails.tsx | 30 +- .../components/proposal/ProposalTimeline.tsx | 8 +- .../components/proposal/ProposalVoteInfo.tsx | 2 +- .../proposalHistory/ProposalHistoryItem.tsx | 6 +- .../proposalHistory/ProposalHistoryModal.tsx | 11 +- .../proposalList/ActiveProposalListItem.tsx | 16 +- .../proposalList/CachedProposalListItem.tsx | 2 +- .../ProposalListItemFinalStatus.tsx | 20 +- .../proposalList/ProposalListItemWrapper.tsx | 2 +- .../components/proposalList/ProposalsList.tsx | 2 +- src/proposals/store/proposalsHistorySlice.ts | 362 ++++++++++-------- src/proposals/store/proposalsSelectors.ts | 19 +- src/proposals/store/proposalsSlice.ts | 18 +- src/proposals/utils/statuses.ts | 2 +- src/ui/helpModals/HelpModalProvider.tsx | 21 +- src/ui/helpModals/HelpStatusesModal.tsx | 6 +- src/ui/helpModals/HelpVoteTx.tsx | 5 +- src/ui/helpModals/getProposalData.ts | 8 +- src/ui/utils/texts.ts | 3 +- src/utils/cacheGithubLinks.ts | 5 +- src/utils/configs.ts | 3 +- src/utils/githubCacheRequests.ts | 5 + src/utils/localStorage.ts | 14 - src/web3/services/govDataService.ts | 12 +- yarn.lock | 201 +++++++++- 45 files changed, 755 insertions(+), 520 deletions(-) diff --git a/app/page.page.tsx b/app/page.page.tsx index 5d96c0c5..a00a6ab2 100644 --- a/app/page.page.tsx +++ b/app/page.page.tsx @@ -105,7 +105,7 @@ export default async function Page({ title: proposal.title, ipfsHash: proposal.ipfsHash, }, - state: proposal.state, + combineState: proposal.combineState, }, } as CachedProposalDataItemWithId; }); diff --git a/app/proposal/page.page.tsx b/app/proposal/page.page.tsx index 02cb545e..122ae2d5 100644 --- a/app/proposal/page.page.tsx +++ b/app/proposal/page.page.tsx @@ -44,11 +44,11 @@ export async function generateMetadata({ return { title: `${metaTexts.main}${metaTexts.proposalId(proposalId)}`, - description: ipfsData.title, + description: ipfsData?.title || '', openGraph: { images: ['/metaLogo.jpg'], title: `${metaTexts.main}${metaTexts.proposalId(proposalId)}`, - description: ipfsData.title, + description: ipfsData?.title || '', }, }; } @@ -152,7 +152,7 @@ export default async function ProposalPage({ }, }; - const state = getProposalState({ + const combineState = getProposalState({ proposalData: proposalDataWithoutState.data, quorum: proposalDataWithoutState.config.quorum, differential: proposalDataWithoutState.config.differential, @@ -166,7 +166,7 @@ export default async function ProposalPage({ balanceLoading: true, proposal: { ...proposalDataWithoutState, - state, + combineState, }, } as ProposalWithLoadings; } diff --git a/next.config.js b/next.config.js index 5c3f032d..69e4c2a0 100644 --- a/next.config.js +++ b/next.config.js @@ -6,6 +6,8 @@ const nextConfig = { webpackBuildWorker: true, }, webpack(config) { + config.resolve.fallback = { fs: false, path: false }; + // Grab the existing rule that handles SVG imports const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'), diff --git a/package.json b/package.json index 36959bec..6fd3cbf5 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "test": "NODE_OPTIONS=--experimental-vm-modules jest --watch" }, "dependencies": { - "@bgd-labs/aave-address-book": "^2.15.2", - "@bgd-labs/aave-governance-ui-helpers": "^1.1.1", + "@bgd-labs/aave-address-book": "^2.18.0", + "@bgd-labs/aave-governance-ui-helpers": "^2.0.0", "@bgd-labs/frontend-web3-utils": "^1.1.0", "@emotion/cache": "^11.11.0", "@emotion/react": "^11.11.3", diff --git a/src/payloadsExplorer/components/PayloadExploreItem.tsx b/src/payloadsExplorer/components/PayloadExploreItem.tsx index 92eb8f71..2afaca5a 100644 --- a/src/payloadsExplorer/components/PayloadExploreItem.tsx +++ b/src/payloadsExplorer/components/PayloadExploreItem.tsx @@ -211,7 +211,7 @@ export function PayloadExploreItem({ }, }}> {texts.proposals.payloadsDetails.actions( - payload.actionAddresses?.length || 0, + payload.actions?.length || 0, )} : diff --git a/src/payloadsExplorer/components/PayloadExploreItemLoading.tsx b/src/payloadsExplorer/components/PayloadExploreItemLoading.tsx index 52187b3a..93c3493f 100644 --- a/src/payloadsExplorer/components/PayloadExploreItemLoading.tsx +++ b/src/payloadsExplorer/components/PayloadExploreItemLoading.tsx @@ -3,13 +3,16 @@ import React from 'react'; import { BoxWith3D } from '../../ui'; import { CustomSkeleton } from '../../ui/components/CustomSkeleton'; +import { texts } from '../../ui/utils/texts'; import { media } from '../../ui/utils/themeMUI'; import { useMediaQuery } from '../../ui/utils/useMediaQuery'; export function PayloadExploreItemLoading({ isColumns, + noData, }: { isColumns: boolean; + noData?: boolean; }) { const theme = useTheme(); const xsm = useMediaQuery(media.xs); @@ -44,139 +47,148 @@ export function PayloadExploreItemLoading({ p: isColumn ? '14px 12px' : '22px 30px', }, }}> - + {noData ? ( - - - - - - - - + sx={{ typography: 'h2', p: 8, width: '100%', textAlign: 'center' }}> + {texts.other.noPayloadsInController} + ) : ( + <> + + + + + + + + + + + - - - + + + - - - - - + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - + + + + + - - - - + + + + + + )} ); } diff --git a/src/payloadsExplorer/components/PayloadItemDetailsModal.tsx b/src/payloadsExplorer/components/PayloadItemDetailsModal.tsx index d6af7dc5..a9a952f1 100644 --- a/src/payloadsExplorer/components/PayloadItemDetailsModal.tsx +++ b/src/payloadsExplorer/components/PayloadItemDetailsModal.tsx @@ -193,7 +193,7 @@ export function PayloadItemDetailsModal({ {texts.proposals.payloadsDetails.actions( - payload.actionAddresses?.length || 0, + payload.actions?.length || 0, )} : diff --git a/src/payloadsExplorer/components/PayloadStatus.tsx b/src/payloadsExplorer/components/PayloadStatus.tsx index 979922a0..ea7ee194 100644 --- a/src/payloadsExplorer/components/PayloadStatus.tsx +++ b/src/payloadsExplorer/components/PayloadStatus.tsx @@ -61,9 +61,7 @@ export function PayloadStatus({ titleTypography={titleTypography} textTypography={textTypography} title={texts.proposals.payloadsDetails.executedAt}> - <> - {dayjs.unix(payload.executedAt).format('MMM D, YYYY, , h:mm A')} - + <>{dayjs.unix(payload.executedAt).format('MMM D, YYYY, h:mm A')} )} @@ -72,9 +70,7 @@ export function PayloadStatus({ titleTypography={titleTypography} textTypography={textTypography} title={texts.proposals.payloadsDetails.cancelledAt}> - <> - {dayjs.unix(payload.cancelledAt).format('MMM D, YYYY, , h:mm A')} - + <>{dayjs.unix(payload.cancelledAt).format('MMM D, YYYY, h:mm A')} )} @@ -90,7 +86,7 @@ export function PayloadStatus({ ? payload.expirationTime : payload.queuedAt + payload.delay + payload.gracePeriod, ) - .format('MMM D, YYYY, , h:mm A')} + .format('MMM D, YYYY, h:mm A')} )} diff --git a/src/payloadsExplorer/components/PayloadsExplorerPage.tsx b/src/payloadsExplorer/components/PayloadsExplorerPage.tsx index 4783a726..6c833974 100644 --- a/src/payloadsExplorer/components/PayloadsExplorerPage.tsx +++ b/src/payloadsExplorer/components/PayloadsExplorerPage.tsx @@ -380,10 +380,19 @@ export function PayloadsExplorerPage() { ))} )} - {!payloadsExplorePagination[controllerAddress]?.currentIds.length && - !filteredPayloadsData.length && ( - - )} + + {payloadsExplorePagination[controllerAddress]?.currentIds.length === + 0 ? ( + + ) : ( + <> + {!payloadsExplorePagination[controllerAddress]?.currentIds + .length && + !filteredPayloadsData.length && ( + + )} + + )} diff --git a/src/payloadsExplorer/store/payloadsExplorerSlice.ts b/src/payloadsExplorer/store/payloadsExplorerSlice.ts index e01bb421..1bd48547 100644 --- a/src/payloadsExplorer/store/payloadsExplorerSlice.ts +++ b/src/payloadsExplorer/store/payloadsExplorerSlice.ts @@ -1,6 +1,6 @@ import { Payload, PayloadState } from '@bgd-labs/aave-governance-ui-helpers'; import { StoreSlice } from '@bgd-labs/frontend-web3-utils'; -import { produce } from 'immer'; +import { Draft, produce } from 'immer'; import { Hex } from 'viem'; import { IProposalsSlice } from '../../proposals/store/proposalsSlice'; @@ -187,12 +187,12 @@ export const createPayloadsExplorerSlice: StoreSlice< idsForRequest, ); - const formattedPayloadsData: Record = {}; + const formattedPayloadsData: Record> = {}; payloadsData.forEach((payload) => { if (payload) { formattedPayloadsData[ `${payload.payloadsController}_${payload.id}` - ] = payload; + ] = payload as Draft; } }); @@ -220,11 +220,11 @@ export const createPayloadsExplorerSlice: StoreSlice< [payloadId], ); - const formattedPayloadsData: Record = {}; + const formattedPayloadsData: Record> = {}; payloadsData.forEach((payload) => { if (payload) { formattedPayloadsData[`${payload.payloadsController}_${payload.id}`] = - payload; + payload as Draft; } }); diff --git a/src/proposalCreateOverview/store/proposalCreateOverviewSlice.ts b/src/proposalCreateOverview/store/proposalCreateOverviewSlice.ts index 7baa0d29..8f893156 100644 --- a/src/proposalCreateOverview/store/proposalCreateOverviewSlice.ts +++ b/src/proposalCreateOverview/store/proposalCreateOverviewSlice.ts @@ -4,7 +4,7 @@ import { PayloadState, } from '@bgd-labs/aave-governance-ui-helpers'; import { StoreSlice } from '@bgd-labs/frontend-web3-utils'; -import { produce } from 'immer'; +import { Draft, produce } from 'immer'; import { Hex } from 'viem'; import { IProposalsSlice } from '../../proposals/store/proposalsSlice'; @@ -58,7 +58,7 @@ export const createProposalCreateOverviewSlice: StoreSlice< ] = { ...oldData, ...payload, - }; + } as Draft; }), ); }); diff --git a/src/proposals/components/ProposalEstimatedStatus.tsx b/src/proposals/components/ProposalEstimatedStatus.tsx index 8b193b68..ca5ccab0 100644 --- a/src/proposals/components/ProposalEstimatedStatus.tsx +++ b/src/proposals/components/ProposalEstimatedStatus.tsx @@ -47,7 +47,7 @@ export function ProposalEstimatedStatus({ typography: 'headline', mr: 4, color: - estimatedStatus === ProposalEstimatedState.Defeated + estimatedStatus === ProposalEstimatedState.Failed ? isForModal ? '$mainAgainst' : '$text' diff --git a/src/proposals/components/ProposalStatus.tsx b/src/proposals/components/ProposalStatus.tsx index d086fa66..f44e596d 100644 --- a/src/proposals/components/ProposalStatus.tsx +++ b/src/proposals/components/ProposalStatus.tsx @@ -1,10 +1,10 @@ -import { ProposalState } from '@bgd-labs/aave-governance-ui-helpers'; +import { CombineProposalState } from '@bgd-labs/aave-governance-ui-helpers'; import { Box } from '@mui/system'; import { proposalStatuses } from '../utils/statuses'; export interface ProposalStatusProps { - status: ProposalState; + status: CombineProposalState; isSecondary?: boolean; isFinished?: boolean; } @@ -25,11 +25,11 @@ export function ProposalStatus({ mr: 4, color: isFinished ? '$text' - : status === ProposalState.Defeated + : status === CombineProposalState.Failed ? '$mainAgainst' - : status === ProposalState.Succeed + : status === CombineProposalState.Succeed ? '$mainFor' - : status === ProposalState.Expired + : status === CombineProposalState.Expired ? '$textDisabled' : isSecondary ? '$textSecondary' diff --git a/src/proposals/components/actionModals/VoteModal.tsx b/src/proposals/components/actionModals/VoteModal.tsx index 71497116..c43aea9b 100644 --- a/src/proposals/components/actionModals/VoteModal.tsx +++ b/src/proposals/components/actionModals/VoteModal.tsx @@ -1,8 +1,8 @@ import { Balance, + CombineProposalState, formatProposal, getEstimatedState, - ProposalState, valueToBigNumber, } from '@bgd-labs/aave-governance-ui-helpers'; import { Box, useTheme } from '@mui/system'; @@ -72,10 +72,10 @@ export function VoteModal({ useEffect(() => { if (proposalData) { const isFinished = - proposalData.proposal.state === ProposalState.Executed || - proposalData.proposal.state === ProposalState.Defeated || - proposalData.proposal.state === ProposalState.Canceled || - proposalData.proposal.state === ProposalState.Expired; + proposalData.proposal.combineState === CombineProposalState.Executed || + proposalData.proposal.combineState === CombineProposalState.Failed || + proposalData.proposal.combineState === CombineProposalState.Canceled || + proposalData.proposal.combineState === CombineProposalState.Expired; if (!isFinished) { checkIsGelatoAvailableWithApiKey( @@ -88,10 +88,10 @@ export function VoteModal({ useEffect(() => { if (proposalData) { const isFinished = - proposalData.proposal.state === ProposalState.Executed || - proposalData.proposal.state === ProposalState.Defeated || - proposalData.proposal.state === ProposalState.Canceled || - proposalData.proposal.state === ProposalState.Expired; + proposalData.proposal.combineState === CombineProposalState.Executed || + proposalData.proposal.combineState === CombineProposalState.Failed || + proposalData.proposal.combineState === CombineProposalState.Canceled || + proposalData.proposal.combineState === CombineProposalState.Expired; if (!isFinished) { checkIsGaslessVote(proposalData.proposal.data.votingChainId); @@ -475,7 +475,7 @@ export function VoteModal({ loading={loading} disabled={ loading || - proposal.state > ProposalState.Active || + proposal.combineState > CombineProposalState.Active || localVotingPower <= 0 } activeColorType={support ? 'against' : 'for'} diff --git a/src/proposals/components/proposal/PayloadActions.tsx b/src/proposals/components/proposal/PayloadActions.tsx index 8ba097a3..388f1fc5 100644 --- a/src/proposals/components/proposal/PayloadActions.tsx +++ b/src/proposals/components/proposal/PayloadActions.tsx @@ -34,7 +34,7 @@ export function PayloadActions({ showMoreClick, withoutEllipsis, }: PayloadActionsProps) { - const isWithShowMore = !!showMoreClick && payload.actionAddresses.length > 2; + const isWithShowMore = !!showMoreClick && payload.actions.length > 2; return ( <> @@ -50,7 +50,7 @@ export function PayloadActions({ {!withoutTitle && ( {texts.proposals.payloadsDetails.actions( - payload.actionAddresses?.length || 0, + payload.actions?.length || 0, )} : @@ -62,48 +62,47 @@ export function PayloadActions({ display: 'flex', flexDirection: 'column', }}> - {(isWithShowMore - ? payload.actionAddresses.slice(-2) - : payload.actionAddresses - )?.map((address, index) => ( - - - - {withoutEllipsis - ? address - : textCenterEllipsis(address, 6, 6)} - - + {(isWithShowMore ? payload.actions.slice(-2) : payload.actions)?.map( + (action, index) => ( + + + + {withoutEllipsis + ? action.target + : textCenterEllipsis(action.target, 6, 6)} + + - - - ))} + + + ), + )} diff --git a/src/proposals/components/proposal/ProposalClientPage.tsx b/src/proposals/components/proposal/ProposalClientPage.tsx index 10bb476b..40ad9bea 100644 --- a/src/proposals/components/proposal/ProposalClientPage.tsx +++ b/src/proposals/components/proposal/ProposalClientPage.tsx @@ -62,7 +62,7 @@ export function ProposalClientPage() { ); if (store.detailedProposalsData[id]) { - if (store.detailedProposalsData[id].prerender) { + if (store.detailedProposalsData[id].isFinished) { return ( diff --git a/src/proposals/components/proposal/ProposalPage.tsx b/src/proposals/components/proposal/ProposalPage.tsx index 6f160aff..79ee7474 100644 --- a/src/proposals/components/proposal/ProposalPage.tsx +++ b/src/proposals/components/proposal/ProposalPage.tsx @@ -1,5 +1,5 @@ import { - BasicProposalState, + CombineProposalState, formatProposal, getProposalStepsAndAmounts, InitialPayload, @@ -104,7 +104,7 @@ export function ProposalPage({ const totalVotes = forVotes + againstVotes; if (startBlock > 0) { - if (totalVotes > 0 && !proposal.data.prerender && isVotingActive) { + if (totalVotes > 0 && !proposal.data.isFinished && isVotingActive) { getVoters( proposal.data.id, proposal.data.votingChainId, @@ -144,8 +144,8 @@ export function ProposalPage({ const isFinished = !loading && - (proposal.state >= ProposalState.Executed || - proposal.state === ProposalState.Defeated); + (proposal.combineState >= CombineProposalState.Executed || + proposal.combineState === CombineProposalState.Failed); if (!isFinished) { getProposalCreatorBalance( @@ -192,12 +192,14 @@ export function ProposalPage({ votedPower, } = formatProposal(proposal); - const isVotingActive = !loading && proposal.state === ProposalState.Active; - const isVotingFinished = !loading && proposal.state > ProposalState.Active; + const isVotingActive = + !loading && proposal.combineState === CombineProposalState.Active; + const isVotingFinished = + !loading && proposal.combineState > CombineProposalState.Active; const isFinished = !loading && - (proposal.state >= ProposalState.Executed || - proposal.state === ProposalState.Defeated); + (proposal.combineState >= CombineProposalState.Executed || + proposal.combineState === CombineProposalState.Failed); const now = dayjs().unix(); @@ -273,7 +275,7 @@ export function ProposalPage({ s.value === proposal?.state)?.title || - ProposalStateWithName.Created + proposalStatuses.find((s) => s.value === proposal?.combineState) + ?.title || ProposalStateWithName.Created } /> @@ -368,7 +370,9 @@ export function ProposalPage({ requiredAgainstVotes={requiredAgainstVotes} estimatedStatus={estimatedState} isFinished={isFinished} - isStarted={!loading && proposal.state > ProposalState.Created} + isStarted={ + !loading && proposal.combineState > CombineProposalState.Created + } isVotingFinished={isVotingFinished} voters={votersForCurrentProposal} votersInitialLoading={ @@ -440,8 +444,8 @@ export function ProposalPage({ coolDownBeforeVotingStart={ proposal.config.coolDownBeforeVotingStart } - proposalBasicStatus={proposal.data.basicState} - proposalStatus={proposal.state} + proposalBasicStatus={proposal.data.state} + combineProposalStatus={proposal.combineState} proposalId={proposal.data.id} votingMachineState={proposal.data.votingMachineState} proposalResultsSent={ @@ -480,7 +484,7 @@ export function ProposalPage({ discussionLink={ipfsData?.discussions} ipfsHash={proposal.data.ipfsHash} proposalId={proposal.data.id} - prerender={proposal.data.prerender} + prerender={proposal.data.isFinished} /> @@ -517,7 +521,7 @@ export function ProposalPage({ discussionLink={ipfsData?.discussions} ipfsHash={proposal.data.ipfsHash} proposalId={proposal.data.id} - prerender={proposal.data.prerender} + prerender={proposal.data.isFinished} /> @@ -564,11 +568,13 @@ export function ProposalPage({ /> )} - + {isProposalHistoryModalOpen && ( + + )} { diff --git a/src/proposals/components/proposal/ProposalPageWrapperWithCache.tsx b/src/proposals/components/proposal/ProposalPageWrapperWithCache.tsx index 1b55a379..21dd4ef0 100644 --- a/src/proposals/components/proposal/ProposalPageWrapperWithCache.tsx +++ b/src/proposals/components/proposal/ProposalPageWrapperWithCache.tsx @@ -37,7 +37,7 @@ export function ProposalPageWrapperWithCache({ ), payloads: detailsData.payloads || [], title: detailsData.ipfs.title || `Proposal #${id}`, - prerender: true, + isFinished: true, }; detailsData.payloads.forEach((payload) => { diff --git a/src/proposals/components/proposal/ProposalStatusDetails.tsx b/src/proposals/components/proposal/ProposalStatusDetails.tsx index adcb398f..c7ec3f84 100644 --- a/src/proposals/components/proposal/ProposalStatusDetails.tsx +++ b/src/proposals/components/proposal/ProposalStatusDetails.tsx @@ -1,6 +1,6 @@ import { - BasicProposalState, checkHash, + CombineProposalState, ProposalState, VotingMachineProposalState, } from '@bgd-labs/aave-governance-ui-helpers'; @@ -40,8 +40,8 @@ interface ProposalStatusDetailsProps { votingBlockHash: string; creationTime: number; coolDownBeforeVotingStart: number; - proposalBasicStatus: BasicProposalState; - proposalStatus: ProposalState; + proposalBasicStatus: ProposalState; + combineProposalStatus: CombineProposalState; votingMachineState: VotingMachineProposalState; proposalId: number; proposalResultsSent: boolean; @@ -58,7 +58,7 @@ export function ProposalStatusDetails({ creationTime, coolDownBeforeVotingStart, proposalBasicStatus, - proposalStatus, + combineProposalStatus, proposalId, votingMachineState, proposalResultsSent, @@ -110,12 +110,16 @@ export function ProposalStatusDetails({ const isExpertMode = appMode === 'expert'; const isExecuted = - proposalStatus === ProposalState.Expired || - proposalStatus === ProposalState.Executed || - proposalStatus === ProposalState.Canceled || - proposalStatus === ProposalState.Defeated; + combineProposalStatus === CombineProposalState.Expired || + combineProposalStatus === CombineProposalState.Executed || + combineProposalStatus === CombineProposalState.Canceled || + combineProposalStatus === CombineProposalState.Failed; - if (proposalStatus === ProposalState.Active || isExecuted || !isExpertMode) + if ( + combineProposalStatus === CombineProposalState.Active || + isExecuted || + !isExpertMode + ) return null; const getTxStatus = ({ @@ -208,7 +212,7 @@ export function ProposalStatusDetails({ const actions = () => { if (activeWallet?.isActive) { if ( - proposalBasicStatus === BasicProposalState.Created && + proposalBasicStatus === ProposalState.Created && votingMachineState === VotingMachineProposalState.NotCreated && checkHash(blockHash).zero ) { @@ -255,7 +259,7 @@ export function ProposalStatusDetails({ ), }; } else if ( - proposalBasicStatus <= BasicProposalState.Active && + proposalBasicStatus <= ProposalState.Active && votingMachineState === VotingMachineProposalState.NotCreated && checkHash(blockHash).notZero && !hasRequiredRoots @@ -299,7 +303,7 @@ export function ProposalStatusDetails({ ), }; } else if ( - proposalBasicStatus <= BasicProposalState.Active && + proposalBasicStatus <= ProposalState.Active && votingMachineState === VotingMachineProposalState.NotCreated && checkHash(blockHash).notZero && hasRequiredRoots @@ -393,7 +397,7 @@ export function ProposalStatusDetails({ } else if ( proposalResultsSent && proposalQueuingTime !== 0 && - proposalBasicStatus !== BasicProposalState.Executed && + proposalBasicStatus !== ProposalState.Executed && !isExecuted ) { const returnObject = { diff --git a/src/proposals/components/proposal/ProposalTimeline.tsx b/src/proposals/components/proposal/ProposalTimeline.tsx index 4031b16f..97cda2fa 100644 --- a/src/proposals/components/proposal/ProposalTimeline.tsx +++ b/src/proposals/components/proposal/ProposalTimeline.tsx @@ -400,7 +400,7 @@ export function ProposalTimeline({ (state === ProposalStateWithName.Executed || state === ProposalStateWithName.Canceled || state === ProposalStateWithName.Expired || - state === ProposalStateWithName.Defeated) && + state === ProposalStateWithName.Failed) && isWrapperWithScroll ) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -420,14 +420,14 @@ export function ProposalTimeline({ .toNumber(); const isExecuted = state === ProposalStateWithName.Executed; - const isFailed = state === ProposalStateWithName.Defeated; + const isFailed = state === ProposalStateWithName.Failed; const isExpired = state === ProposalStateWithName.Expired; const getVotingClosedState = () => { if (now >= votingClosedTimestamp || !!canceledTimestamp) { if (isExecuted || state === ProposalStateWithName.Succeed) { return ProposalStateWithName.Succeed; - } else if (state === ProposalStateWithName.Defeated) { + } else if (state === ProposalStateWithName.Failed) { return ProposalStateWithName.Failed; } } else { @@ -702,7 +702,7 @@ export function ProposalTimeline({ color={ timeline.state === ProposalStateWithName.Executed ? 'success' - : timeline.state === ProposalStateWithName.Defeated + : timeline.state === ProposalStateWithName.Failed ? 'error' : 'expired' }> diff --git a/src/proposals/components/proposal/ProposalVoteInfo.tsx b/src/proposals/components/proposal/ProposalVoteInfo.tsx index 2d94f149..d515838f 100644 --- a/src/proposals/components/proposal/ProposalVoteInfo.tsx +++ b/src/proposals/components/proposal/ProposalVoteInfo.tsx @@ -127,7 +127,7 @@ export function ProposalVoteInfo({ borderSize={10} contentColor="$mainLight" bottomBorderColor={ - estimatedStatus === ProposalEstimatedState.Defeated && !isFinished + estimatedStatus === ProposalEstimatedState.Failed && !isFinished ? '$secondaryAgainst' : estimatedStatus === ProposalEstimatedState.Succeed && !isFinished ? '$secondaryFor' diff --git a/src/proposals/components/proposalHistory/ProposalHistoryItem.tsx b/src/proposals/components/proposalHistory/ProposalHistoryItem.tsx index 02b6aafe..5ac46b9b 100644 --- a/src/proposals/components/proposalHistory/ProposalHistoryItem.tsx +++ b/src/proposals/components/proposalHistory/ProposalHistoryItem.tsx @@ -1,5 +1,7 @@ import { getProposalStepsAndAmounts, + HistoryItemType, + ProposalHistoryItem as IProposalHistoryItem, ProposalWithLoadings, } from '@bgd-labs/aave-governance-ui-helpers'; import { Box, useTheme } from '@mui/system'; @@ -8,10 +10,6 @@ import React from 'react'; import { FormattedNumber } from '../../../ui/components/FormattedNumber'; import { NetworkIcon } from '../../../ui/components/NetworkIcon'; -import { - HistoryItemType, - ProposalHistoryItem as IProposalHistoryItem, -} from '../../store/proposalsHistorySlice'; import { ProposalHistoryItemTxLink } from './ProposalHistoryItemTxLink'; export interface ProposalHistoryItemProps { diff --git a/src/proposals/components/proposalHistory/ProposalHistoryModal.tsx b/src/proposals/components/proposalHistory/ProposalHistoryModal.tsx index ad54ed23..37eeabfd 100644 --- a/src/proposals/components/proposalHistory/ProposalHistoryModal.tsx +++ b/src/proposals/components/proposalHistory/ProposalHistoryModal.tsx @@ -1,7 +1,9 @@ +import { HistoryItemType, TxInfo } from '@bgd-labs/aave-governance-ui-helpers'; +import { useRequest } from 'alova'; import React, { useEffect } from 'react'; import { useStore } from '../../../store'; -import { HistoryItemType, TxInfo } from '../../store/proposalsHistorySlice'; +import { getProposalEventsCache } from '../../../utils/githubCacheRequests'; import { getProposalDataById } from '../../store/proposalsSelectors'; import { DetailsModalWrapper } from '../DetailsModalWrapper'; import { ProposalHistoryItem } from './ProposalHistoryItem'; @@ -20,12 +22,15 @@ export function ProposalHistoryModal({ const store = useStore(); const proposalData = getProposalDataById(store, proposalId); + const { loading: cacheEventsLoading, data: cacheEventsData } = useRequest( + getProposalEventsCache(proposalId), + ); useEffect(() => { if (proposalData?.proposal) { - store.initProposalHistory(proposalData.proposal); + store.initProposalHistory(proposalData.proposal, cacheEventsData); } - }, [isOpen, proposalId, proposalData?.loading]); + }, [isOpen, proposalId, proposalData?.loading, cacheEventsLoading]); if (!proposalData?.proposal) return null; diff --git a/src/proposals/components/proposalList/ActiveProposalListItem.tsx b/src/proposals/components/proposalList/ActiveProposalListItem.tsx index c7de48d1..ae7d993e 100644 --- a/src/proposals/components/proposalList/ActiveProposalListItem.tsx +++ b/src/proposals/components/proposalList/ActiveProposalListItem.tsx @@ -1,6 +1,6 @@ import { + CombineProposalState, formatProposal, - ProposalState, ProposalWithLoadings, } from '@bgd-labs/aave-governance-ui-helpers'; import { WalletType } from '@bgd-labs/frontend-web3-utils'; @@ -74,12 +74,14 @@ export function ActiveProposalListItem({ votedPower, } = formatProposal(proposal); - const isVotingActive = !loading && proposal.state === ProposalState.Active; - const isVotingFinished = !loading && proposal.state > ProposalState.Active; + const isVotingActive = + !loading && proposal.combineState === CombineProposalState.Active; + const isVotingFinished = + !loading && proposal.combineState > CombineProposalState.Active; const isFinished = !loading && - (proposal.state >= ProposalState.Executed || - proposal.state === ProposalState.Defeated); + (proposal.combineState >= CombineProposalState.Executed || + proposal.combineState === CombineProposalState.Failed); const support = proposal.data.votingMachineData.votedInfo.support; @@ -196,7 +198,7 @@ export function ActiveProposalListItem({ }}> ) : ( diff --git a/src/proposals/components/proposalList/ProposalListItemFinalStatus.tsx b/src/proposals/components/proposalList/ProposalListItemFinalStatus.tsx index 6bc989cc..9dbf365b 100644 --- a/src/proposals/components/proposalList/ProposalListItemFinalStatus.tsx +++ b/src/proposals/components/proposalList/ProposalListItemFinalStatus.tsx @@ -1,4 +1,4 @@ -import { ProposalState } from '@bgd-labs/aave-governance-ui-helpers'; +import { CombineProposalState } from '@bgd-labs/aave-governance-ui-helpers'; import { Box, useTheme } from '@mui/system'; import dayjs from 'dayjs'; @@ -10,7 +10,7 @@ import { proposalStatuses } from '../../utils/statuses'; interface ProposalListItemFinalStatusProps { timestamp: number; - status: ProposalState; + status: CombineProposalState; } export function ProposalListItemFinalStatus({ @@ -21,14 +21,16 @@ export function ProposalListItemFinalStatus({ const statusTitle = proposalStatuses.find((s) => s.value === status)?.title; const color = - status === ProposalState.Defeated + status === CombineProposalState.Failed ? '$mainAgainst' - : status === ProposalState.Executed || status === ProposalState.Succeed + : status === CombineProposalState.Executed || + status === CombineProposalState.Succeed ? '$mainFor' : '$disabled'; const icon = - status === ProposalState.Executed || status === ProposalState.Succeed + status === CombineProposalState.Executed || + status === CombineProposalState.Succeed ? SuccessIcon : ErrorIcon; @@ -84,11 +86,11 @@ export function ProposalListItemFinalStatus({ }}> svg': { - width: status === ProposalState.Executed ? 14 : 12, - height: status === ProposalState.Executed ? 14 : 12, + width: status === CombineProposalState.Executed ? 14 : 12, + height: status === CombineProposalState.Executed ? 14 : 12, }, position: 'relative', mr: 5, diff --git a/src/proposals/components/proposalList/ProposalListItemWrapper.tsx b/src/proposals/components/proposalList/ProposalListItemWrapper.tsx index 3e30c87e..dca30c01 100644 --- a/src/proposals/components/proposalList/ProposalListItemWrapper.tsx +++ b/src/proposals/components/proposalList/ProposalListItemWrapper.tsx @@ -34,7 +34,7 @@ export function ProposalListItemWrapper({ disableActiveState={isVotingActive} contentColor="$mainLight" bottomBorderColor={ - estimatedState === ProposalEstimatedState.Defeated && !isFinished + estimatedState === ProposalEstimatedState.Failed && !isFinished ? '$secondaryAgainst' : estimatedState === ProposalEstimatedState.Succeed && !isFinished ? '$secondaryFor' diff --git a/src/proposals/components/proposalList/ProposalsList.tsx b/src/proposals/components/proposalList/ProposalsList.tsx index 85a117a2..ff127f14 100644 --- a/src/proposals/components/proposalList/ProposalsList.tsx +++ b/src/proposals/components/proposalList/ProposalsList.tsx @@ -483,7 +483,7 @@ export function ProposalsList({ return (
diff --git a/src/proposals/store/proposalsHistorySlice.ts b/src/proposals/store/proposalsHistorySlice.ts index c632dee9..9c958343 100644 --- a/src/proposals/store/proposalsHistorySlice.ts +++ b/src/proposals/store/proposalsHistorySlice.ts @@ -1,12 +1,16 @@ import { - BasicProposalState, checkHash, + CombineProposalState, + FilteredEvent, getBlockNumberByTimestamp, getProposalStepsAndAmounts, + HistoryItemType, PayloadState, Proposal, + ProposalHistoryItem, ProposalState, ProposalWithLoadings, + TxInfo, } from '@bgd-labs/aave-governance-ui-helpers'; import { StoreSlice } from '@bgd-labs/frontend-web3-utils'; import { produce } from 'immer'; @@ -17,54 +21,30 @@ import { texts } from '../../ui/utils/texts'; import { appConfig } from '../../utils/appConfig'; import { IWeb3Slice } from '../../web3/store/web3Slice'; -export enum HistoryItemType { - PAYLOADS_CREATED, - CREATED, - PROPOSAL_ACTIVATE, - OPEN_TO_VOTE, - VOTING_OVER, - VOTING_CLOSED, - RESULTS_SENT, - PROPOSAL_QUEUED, - PROPOSAL_EXECUTED, - PAYLOADS_QUEUED, - PAYLOADS_EXECUTED, - PROPOSAL_CANCELED, - PAYLOADS_EXPIRED, - PROPOSAL_EXPIRED, -} - -type FilteredEvent = { - transactionHash: string; -}; - -export type TxInfo = { - id: number; - hash: string; - chainId: number; - hashLoading: boolean; -}; - -export type ProposalHistoryItem = { - type: HistoryItemType; - title: string; - txInfo: TxInfo; - timestamp?: number; - addresses?: string[]; -}; - export interface IProposalsHistorySlice { proposalHistory: Record; - initProposalHistoryItem: ( - historyId: string, - type: HistoryItemType, - title: string, - txId: number, - txChainId: number, - timestamp?: number, - addresses?: string[], + initProposalHistoryItem: ({ + historyId, + type, + title, + txId, + txChainId, + timestamp, + addresses, + }: { + historyId: string; + type: HistoryItemType; + title: string; + txId: number; + txChainId: number; + timestamp?: number; + addresses?: string[]; + txHash?: string; + }) => void; + initProposalHistory: ( + proposal: Proposal, + proposalEvents?: Record, ) => void; - initProposalHistory: (proposal: Proposal) => void; setHistoryItemLoading: (historyId: string) => void; setHistoryItemHash: ( historyId: string, @@ -118,7 +98,7 @@ export const createProposalsHistorySlice: StoreSlice< > = (set, get) => ({ // initial proposalHistory: {}, - initProposalHistoryItem: ( + initProposalHistoryItem: ({ historyId, type, title, @@ -126,7 +106,8 @@ export const createProposalsHistorySlice: StoreSlice< txChainId, timestamp, addresses, - ) => { + txHash, + }) => { set((state) => produce(state, (draft) => { const historyItem = draft.proposalHistory[historyId]; @@ -142,7 +123,7 @@ export const createProposalsHistorySlice: StoreSlice< typeof historyItem?.txInfo.hash !== 'undefined' && historyItem?.txInfo.hash !== zeroHash ? historyItem?.txInfo.hash - : zeroHash, + : txHash || zeroHash, chainId: txChainId, hashLoading: false, }, @@ -150,7 +131,7 @@ export const createProposalsHistorySlice: StoreSlice< }), ); }, - initProposalHistory: (proposal) => { + initProposalHistory: (proposal, proposalEvents) => { const { isVotingFailed, isVotingEnded, @@ -168,70 +149,90 @@ export const createProposalsHistorySlice: StoreSlice< // PAYLOADS_CREATED proposal.data.payloads.forEach((payload, index) => { const historyId = `${proposal.data.id}_${HistoryItemType.PAYLOADS_CREATED}_${payload.id}_${payload.chainId}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PAYLOADS_CREATED, - texts.proposalHistory.payloadCreated( + type: HistoryItemType.PAYLOADS_CREATED, + title: texts.proposalHistory.payloadCreated( index + 1, proposal.data.payloads.length, ), - payload.id, - payload.chainId, - payload.createdAt, - payload.actionAddresses, - ); + txId: payload.id, + txChainId: payload.chainId, + timestamp: payload.createdAt, + addresses: payload.actions.map((action) => action.target), + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); }); // PROPOSAL_CREATED const historyIdProposalCreated = `${proposal.data.id}_${HistoryItemType.CREATED}`; - get().initProposalHistoryItem( - historyIdProposalCreated, - HistoryItemType.CREATED, - texts.proposalHistory.proposalCreated(proposal.data.id), - proposal.data.id, - appConfig.govCoreChainId, - proposal.data.creationTime, - ); + get().initProposalHistoryItem({ + historyId: historyIdProposalCreated, + type: HistoryItemType.CREATED, + title: texts.proposalHistory.proposalCreated(proposal.data.id), + txId: proposal.data.id, + txChainId: appConfig.govCoreChainId, + timestamp: proposal.data.creationTime, + txHash: + proposalEvents && proposalEvents[historyIdProposalCreated] + ? proposalEvents[historyIdProposalCreated].txInfo.hash + : undefined, + }); // PROPOSAL_ACTIVATE if (checkHash(proposal.data.snapshotBlockHash).notZero) { const historyId = `${proposal.data.id}_${HistoryItemType.PROPOSAL_ACTIVATE}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PROPOSAL_ACTIVATE, - texts.proposalHistory.proposalActivated(proposal.data.id), - proposal.data.id, - appConfig.govCoreChainId, - proposal.data.votingActivationTime, - ); + type: HistoryItemType.PROPOSAL_ACTIVATE, + title: texts.proposalHistory.proposalActivated(proposal.data.id), + txId: proposal.data.id, + txChainId: appConfig.govCoreChainId, + timestamp: proposal.data.votingActivationTime, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } // OPEN_TO_VOTE if (proposal.data.votingMachineData.createdBlock > 0) { const historyId = `${proposal.data.id}_${HistoryItemType.OPEN_TO_VOTE}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.OPEN_TO_VOTE, - texts.proposalHistory.proposalOpenForVoting(proposal.data.id), - proposal.data.id, - proposal.data.votingChainId, - proposal.data.votingMachineData.startTime, - ); + type: HistoryItemType.OPEN_TO_VOTE, + title: texts.proposalHistory.proposalOpenForVoting(proposal.data.id), + txId: proposal.data.id, + txChainId: proposal.data.votingChainId, + timestamp: proposal.data.votingMachineData.startTime, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } // VOTING_OVER if (isVotingEnded) { const historyId = `${proposal.data.id}_${HistoryItemType.VOTING_OVER}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.VOTING_OVER, - isVotingFailed + type: HistoryItemType.VOTING_OVER, + title: isVotingFailed ? texts.proposalHistory.votingFailed : texts.proposalHistory.votingOver, - proposal.data.id, - proposal.data.votingChainId, - proposal.data.votingMachineData.endTime, - ); + txId: proposal.data.id, + txChainId: proposal.data.votingChainId, + timestamp: proposal.data.votingMachineData.endTime, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } // VOTING_CLOSED @@ -240,51 +241,75 @@ export const createProposalsHistorySlice: StoreSlice< !isVotingFailed ) { const historyId = `${proposal.data.id}_${HistoryItemType.VOTING_CLOSED}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.VOTING_CLOSED, - texts.proposalHistory.proposalVotingClosed(proposal.data.id), - proposal.data.id, - proposal.data.votingChainId, - proposal.data.votingMachineData.votingClosedAndSentTimestamp, - ); + type: HistoryItemType.VOTING_CLOSED, + title: texts.proposalHistory.proposalVotingClosed(proposal.data.id), + txId: proposal.data.id, + txChainId: proposal.data.votingChainId, + timestamp: proposal.data.votingMachineData.votingClosedAndSentTimestamp, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } // RESULTS_SENT if (proposal.data.votingMachineData.sentToGovernance && !isVotingFailed) { const historyId = `${proposal.data.id}_${HistoryItemType.RESULTS_SENT}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.RESULTS_SENT, - texts.proposalHistory.votingResultsSent, - proposal.data.id, - appConfig.govCoreChainId, - ); + type: HistoryItemType.RESULTS_SENT, + title: texts.proposalHistory.votingResultsSent, + txId: proposal.data.id, + txChainId: appConfig.govCoreChainId, + timestamp: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].timestamp + : undefined, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } // PROPOSAL_QUEUED if (proposal.data.queuingTime > 0 && !isVotingFailed) { const historyId = `${proposal.data.id}_${HistoryItemType.PROPOSAL_QUEUED}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PROPOSAL_QUEUED, - texts.proposalHistory.proposalTimeLocked(proposal.data.id), - proposal.data.id, - appConfig.govCoreChainId, - proposal.data.queuingTime, - ); + type: HistoryItemType.PROPOSAL_QUEUED, + title: texts.proposalHistory.proposalTimeLocked(proposal.data.id), + txId: proposal.data.id, + txChainId: appConfig.govCoreChainId, + timestamp: proposal.data.queuingTime, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } // PROPOSAL_EXECUTED - if (proposal.data.basicState === BasicProposalState.Executed) { + if (proposal.data.state === ProposalState.Executed) { const historyId = `${proposal.data.id}_${HistoryItemType.PROPOSAL_EXECUTED}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PROPOSAL_EXECUTED, - texts.proposalHistory.proposalExecuted(proposal.data.id), - proposal.data.id, - appConfig.govCoreChainId, - ); + type: HistoryItemType.PROPOSAL_EXECUTED, + title: texts.proposalHistory.proposalExecuted(proposal.data.id), + txId: proposal.data.id, + txChainId: appConfig.govCoreChainId, + timestamp: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].timestamp + : undefined, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } // PAYLOADS_QUEUED @@ -296,17 +321,21 @@ export const createProposalsHistorySlice: StoreSlice< proposal.data.payloads.forEach((payload, index) => { if (payload?.queuedAt > 0) { const historyId = `${proposal.data.id}_${HistoryItemType.PAYLOADS_QUEUED}_${payload.id}_${payload.chainId}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PAYLOADS_QUEUED, - texts.proposalHistory.payloadTimeLocked( + type: HistoryItemType.PAYLOADS_QUEUED, + title: texts.proposalHistory.payloadTimeLocked( index + 1, proposal.data.payloads.length, ), - payload.id, - payload.chainId, - payload.queuedAt, - ); + txId: payload.id, + txChainId: payload.chainId, + timestamp: payload.queuedAt, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } }); } @@ -320,34 +349,43 @@ export const createProposalsHistorySlice: StoreSlice< proposal.data.payloads.forEach((payload, index) => { if (payload?.executedAt > 0) { const historyId = `${proposal.data.id}_${HistoryItemType.PAYLOADS_EXECUTED}_${payload.id}_${payload.chainId}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PAYLOADS_EXECUTED, - texts.proposalHistory.payloadExecuted( + type: HistoryItemType.PAYLOADS_EXECUTED, + title: texts.proposalHistory.payloadExecuted( index + 1, proposal.data.payloads.length, ), - payload.id, - payload.chainId, - payload.executedAt, - ); + txId: payload.id, + txChainId: payload.chainId, + timestamp: payload.executedAt, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } }); } // PROPOSAL_CANCELED - if (proposal.state === ProposalState.Canceled) { + if (proposal.combineState === CombineProposalState.Canceled) { const historyId = `${proposal.data.id}_${HistoryItemType.PROPOSAL_CANCELED}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PROPOSAL_CANCELED, - texts.proposalHistory.proposalCanceled(proposal.data.id), - proposal.data.id, - appConfig.govCoreChainId, - lastPayloadCanceledAt > proposal.data.canceledAt - ? lastPayloadCanceledAt - : proposal.data.canceledAt, - ); + type: HistoryItemType.PROPOSAL_CANCELED, + title: texts.proposalHistory.proposalCanceled(proposal.data.id), + txId: proposal.data.id, + txChainId: appConfig.govCoreChainId, + timestamp: + lastPayloadCanceledAt > proposal.data.canceledAt + ? lastPayloadCanceledAt + : proposal.data.canceledAt, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } // PAYLOADS_EXPIRED @@ -359,36 +397,46 @@ export const createProposalsHistorySlice: StoreSlice< proposal.data.payloads.forEach((payload, index) => { if (payload.state === PayloadState.Expired) { const historyId = `${proposal.data.id}_${HistoryItemType.PAYLOADS_EXPIRED}_${payload.id}_${payload.chainId}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PAYLOADS_EXPIRED, - texts.proposalHistory.payloadExpired( + type: HistoryItemType.PAYLOADS_EXPIRED, + title: texts.proposalHistory.payloadExpired( index + 1, proposal.data.payloads.length, ), - payload.id, - payload.chainId, - payload.queuedAt <= 0 - ? payload.createdAt + payload.expirationTime - : payload.queuedAt + payload.delay + payload.gracePeriod, - ); + txId: payload.id, + txChainId: payload.chainId, + timestamp: + payload.queuedAt <= 0 + ? payload.createdAt + payload.expirationTime + : payload.queuedAt + payload.delay + payload.gracePeriod, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } }); } // PROPOSAL_EXPIRED - if (proposal.state === ProposalState.Expired) { + if (proposal.combineState === CombineProposalState.Expired) { const historyId = `${proposal.data.id}_${HistoryItemType.PROPOSAL_EXPIRED}`; - get().initProposalHistoryItem( + get().initProposalHistoryItem({ historyId, - HistoryItemType.PROPOSAL_EXPIRED, - texts.proposalHistory.proposalExpired(proposal.data.id), - proposal.data.id, - appConfig.govCoreChainId, - proposal.data.basicState === BasicProposalState.Executed - ? lastPayloadExpiredAt - : proposal.data.creationTime + proposal.timings.expirationTime, - ); + type: HistoryItemType.PROPOSAL_EXPIRED, + title: texts.proposalHistory.proposalExpired(proposal.data.id), + txId: proposal.data.id, + txChainId: appConfig.govCoreChainId, + timestamp: + proposal.data.state === ProposalState.Executed + ? lastPayloadExpiredAt + : proposal.data.creationTime + proposal.timings.expirationTime, + txHash: + proposalEvents && proposalEvents[historyId] + ? proposalEvents[historyId].txInfo.hash + : undefined, + }); } }, setHistoryItemLoading: (historyId) => { diff --git a/src/proposals/store/proposalsSelectors.ts b/src/proposals/store/proposalsSelectors.ts index b0b5fcff..43a66741 100644 --- a/src/proposals/store/proposalsSelectors.ts +++ b/src/proposals/store/proposalsSelectors.ts @@ -60,7 +60,7 @@ export const getCachedProposalDataById = (store: RootState, id: number) => { title: cachedProposalData.title, ipfsHash: cachedProposalData.ipfsHash, }, - state: cachedProposalData.state, + combineState: cachedProposalData.combineState, }, }; } @@ -128,7 +128,7 @@ export const getProposalDataById = (store: RootState, id: number) => { }, }; - const state = getProposalState({ + const combineState = getProposalState({ proposalData: proposalDataWithoutState.data, quorum: proposalDataWithoutState.config.quorum, differential: proposalDataWithoutState.config.differential, @@ -142,7 +142,7 @@ export const getProposalDataById = (store: RootState, id: number) => { balanceLoading, proposal: { ...proposalDataWithoutState, - state, + combineState, }, } as ProposalWithLoadings; } @@ -209,10 +209,10 @@ const selectFilteredProposalIds = (store: RootState) => { ? detailedData .filter((proposal) => store.filteredState !== 7 - ? proposal?.proposal.state === store.filteredState - : proposal?.proposal.state === 0 || - proposal?.proposal.state === 1 || - proposal?.proposal.state === 2, + ? proposal?.proposal.combineState === store.filteredState + : proposal?.proposal.combineState === 0 || + proposal?.proposal.combineState === 1 || + proposal?.proposal.combineState === 2, ) .map((proposal) => proposal?.proposal.data.id || 0) : store.filteredState === null && store.titleSearchValue !== undefined @@ -221,7 +221,10 @@ const selectFilteredProposalIds = (store: RootState) => { .map((item) => item.item?.proposal.data.id || 0) : fuse .search(store.titleSearchValue || '') - .filter((item) => item.item?.proposal.state === store.filteredState) + .filter( + (item) => + item.item?.proposal.combineState === store.filteredState, + ) .map((item) => item.item?.proposal.data.id || 0); }; diff --git a/src/proposals/store/proposalsSlice.ts b/src/proposals/store/proposalsSlice.ts index fa2d9c97..a72989b9 100644 --- a/src/proposals/store/proposalsSlice.ts +++ b/src/proposals/store/proposalsSlice.ts @@ -374,7 +374,7 @@ export const createProposalsSlice: StoreSlice< draft.detailedProposalsData[id] = { ...proposalData, title: getProposalTitle(get(), id, proposalData.ipfsHash), - prerender: true, + isFinished: true, }; } }); @@ -415,7 +415,7 @@ export const createProposalsSlice: StoreSlice< if (!get().detailedPayloadsData[key]) { set((state) => produce(state, (draft) => { - draft.detailedPayloadsData[key] = data; + draft.detailedPayloadsData[key] = data as Draft; }), ); } @@ -441,7 +441,7 @@ export const createProposalsSlice: StoreSlice< payloadsData.forEach((payload) => { draft.detailedPayloadsData[ `${payload.payloadsController}_${payload.id}` - ] = payload; + ] = payload as Draft; }); }), ); @@ -506,7 +506,9 @@ export const createProposalsSlice: StoreSlice< set((state) => produce(state, (draft) => { allIpfsData.forEach((ipfs, index) => { - draft.ipfsData[filteredNewIpfsHashes[index]] = ipfs; + if (ipfs) { + draft.ipfsData[filteredNewIpfsHashes[index]] = ipfs; + } }); ids.forEach((id) => { const proposalData = draft.detailedProposalsData[id]; @@ -720,11 +722,11 @@ export const createProposalsSlice: StoreSlice< proposalsData.forEach((proposal) => { draft.detailedProposalsData[proposal.id] = { ...proposal, - prerender: !draft.detailedProposalsData[proposal.id]?.prerender - ? proposal.prerender - : !!draft.detailedProposalsData[proposal.id]?.prerender, + isFinished: !draft.detailedProposalsData[proposal.id]?.isFinished + ? proposal.isFinished + : !!draft.detailedProposalsData[proposal.id]?.isFinished, votingMachineState: getVotingMachineProposalState(proposal), - payloads: !!draft.detailedProposalsData[proposal.id]?.prerender + payloads: !!draft.detailedProposalsData[proposal.id]?.isFinished ? draft.detailedProposalsData[proposal.id].payloads : proposalPayloadsData.filter( (payload) => payload.proposalId === proposal.id, diff --git a/src/proposals/utils/statuses.ts b/src/proposals/utils/statuses.ts index 9025bb1d..4ed77e8b 100644 --- a/src/proposals/utils/statuses.ts +++ b/src/proposals/utils/statuses.ts @@ -20,7 +20,7 @@ export const proposalStatuses = [ }, { value: 3, - title: ProposalStateWithName.Defeated, + title: ProposalStateWithName.Failed, }, { value: 4, diff --git a/src/ui/helpModals/HelpModalProvider.tsx b/src/ui/helpModals/HelpModalProvider.tsx index 53f372f9..02431f32 100644 --- a/src/ui/helpModals/HelpModalProvider.tsx +++ b/src/ui/helpModals/HelpModalProvider.tsx @@ -2,10 +2,6 @@ import { Box, useTheme } from '@mui/system'; import { useEffect, useState } from 'react'; import { useStore } from '../../store'; -import { - getLocalStorageIsHelpModalVisible, - setLocalStorageIsHelpModalVisible, -} from '../../utils/localStorage'; import { BigButton } from '../components/BigButton'; import { setRelativePath } from '../utils/relativePath'; import { texts } from '../utils/texts'; @@ -23,8 +19,6 @@ import { HelpVotingModal } from './HelpVotingModal'; import { HelpVotingPowerModal } from './HelpVotingPowerModal'; import { HelpWalletModal } from './HelpWalletModal'; -export type IsHelpModalVisible = 'true' | 'false'; - export function HelpModalProvider() { const theme = useTheme(); const { @@ -32,24 +26,13 @@ export function HelpModalProvider() { isModalOpen, setIsHelpNavigationModalOpen, setIsClickedOnStartButtonOnHelpModal, - isAppBlockedByTerms, - isRendered, + closeHelpModals, isClickedOnStartButtonOnHelpModal, } = useStore(); const [infoType, setInfoType] = useState(undefined); - useEffect(() => { - const isHelpModalVisible = getLocalStorageIsHelpModalVisible(); - - if (isHelpModalVisible && !isAppBlockedByTerms) { - setIsHelpModalOpen(isHelpModalVisible === 'true'); - } else if (!isClickedOnStartButtonOnHelpModal) { - setIsHelpModalOpen(!isAppBlockedByTerms); - } - }, [isRendered]); - useEffect(() => { setInfoType(undefined); }, [isModalOpen]); @@ -82,7 +65,6 @@ export function HelpModalProvider() { alwaysWithBorders color="white" onClick={() => { - setLocalStorageIsHelpModalVisible('false'); closeHelpModals(); setIsHelpModalOpen(false); }}> @@ -92,7 +74,6 @@ export function HelpModalProvider() { alwaysWithBorders css={{ ml: 8 }} onClick={() => { - setLocalStorageIsHelpModalVisible('false'); setIsClickedOnStartButtonOnHelpModal(true); setIsHelpNavigationModalOpen(true); }}> diff --git a/src/ui/helpModals/HelpStatusesModal.tsx b/src/ui/helpModals/HelpStatusesModal.tsx index 61fe8efd..7c205a48 100644 --- a/src/ui/helpModals/HelpStatusesModal.tsx +++ b/src/ui/helpModals/HelpStatusesModal.tsx @@ -169,7 +169,7 @@ export function HelpStatusesModal({ infoType }: HelpStatusesModalProps) { statusInfoText: texts.faq.lifeCycles.finishedFailed.description, buttonText: texts.faq.lifeCycles.finishedFailed.nextButtonTitle, backButtonText: texts.faq.lifeCycles.finishedFailed.prevButtonTitle, - state: ProposalStateWithName.Defeated, + state: ProposalStateWithName.Failed, createdTimestamp: now - 60 * 8, openToVoteTimestamp: now - 60 * 4, votingClosedTimestamp: now - 60 * 2, @@ -201,7 +201,7 @@ export function HelpStatusesModal({ infoType }: HelpStatusesModalProps) { const isFinished = statusInfo.state === ProposalStateWithName.Executed || - statusInfo.state === ProposalStateWithName.Defeated || + statusInfo.state === ProposalStateWithName.Failed || statusInfo.state === ProposalStateWithName.Canceled || statusInfo.state === ProposalStateWithName.Expired; @@ -306,7 +306,7 @@ export function HelpStatusesModal({ infoType }: HelpStatusesModalProps) { votingClosedTimestamp={statusInfo.votingClosedTimestamp} finishedTimestamp={statusInfo.finishedTimestamp} failedTimestamp={ - statusInfo.state === ProposalStateWithName.Defeated + statusInfo.state === ProposalStateWithName.Failed ? statusInfo.votingClosedTimestamp : undefined } diff --git a/src/ui/helpModals/HelpVoteTx.tsx b/src/ui/helpModals/HelpVoteTx.tsx index eb30324f..0b7142bd 100644 --- a/src/ui/helpModals/HelpVoteTx.tsx +++ b/src/ui/helpModals/HelpVoteTx.tsx @@ -1,8 +1,8 @@ import { Balance, + CombineProposalState, formatProposal, getEstimatedState, - ProposalState, ProposalWithLoadings, valueToBigNumber, } from '@bgd-labs/aave-governance-ui-helpers'; @@ -357,7 +357,8 @@ export function HelpVoteTx({ activeColorType={support ? 'against' : 'for'} disabled={ localVotingPower <= 0 || - proposalData.proposal.state > ProposalState.Active + proposalData.proposal.combineState > + CombineProposalState.Active } onClick={() => { setTxPending(true); diff --git a/src/ui/helpModals/getProposalData.ts b/src/ui/helpModals/getProposalData.ts index ab3e4542..c0001def 100644 --- a/src/ui/helpModals/getProposalData.ts +++ b/src/ui/helpModals/getProposalData.ts @@ -15,7 +15,7 @@ export function getProposalData() { votingDuration: 600, creationTime: dayjs().unix() - 1200, accessLevel: 1, - basicState: 2, + state: 2, queuingTime: 0, ipfsHash: '0x0a387fa966f5616423bea53801a843496b1eac5cab5e6bc9426c0958e6496e77', @@ -34,7 +34,7 @@ export function getProposalData() { canceledAt: 0, votingActivationTime: dayjs().unix() - 600, votingChainId: appConfig.govCoreChainId, - prerender: true, + isFinished: false, votingMachineData: { id: 0, forVotes: '0', @@ -76,7 +76,7 @@ export function getProposalData() { payloadsController: appConfig.payloadsControllerConfig[appConfig.govCoreChainId] .contractAddresses[0], - actionAddresses: [], + actions: [], }, ], title: 'Test proposal', @@ -127,7 +127,7 @@ export function getProposalData() { expirationTime: 2592000, executionDelay: 600, }, - state: 1, + combineState: 1, }, } as ProposalWithLoadings; } diff --git a/src/ui/utils/texts.ts b/src/ui/utils/texts.ts index 88a7f2d3..6875761b 100644 --- a/src/ui/utils/texts.ts +++ b/src/ui/utils/texts.ts @@ -53,7 +53,6 @@ export const texts = { fallbackVoteTitle: 'Fallback vote', fallbackVoteDescription: "If you don't want to relay your vote via Gelato, it is always possible to submit and pay for your own vote transaction by disabling the gas-less mode. Beware that you will need to pay on the gas token of the voting network (e.g. MATIC for Polygon)", - noVotersData: (type: 'for' | 'against') => `No votes '${type}'`, payloadsDetails: { payload: 'Payload', payloads: 'Payloads', @@ -343,6 +342,8 @@ export const texts = { }. Try to use the application later or go to the RPC change screen.`, payloadsNetwork: 'Payloads network', voted: 'Voted', + noPayloadsInController: + 'There are no payloads created in this payloads controller yet', }, terms: { description: diff --git a/src/utils/cacheGithubLinks.ts b/src/utils/cacheGithubLinks.ts index 52d80340..662fcb37 100644 --- a/src/utils/cacheGithubLinks.ts +++ b/src/utils/cacheGithubLinks.ts @@ -1,6 +1,6 @@ import { coreName } from './appConfig'; -export const githubStartUrl = `https://raw.githubusercontent.com/bgd-labs/aave-governance-ui-helpers/main/src/generated-cache/${coreName}`; +export const githubStartUrl = `https://raw.githubusercontent.com/bgd-labs/aave-governance-ui-helpers/main/cache/ui/${coreName}`; export const listViewPath = '/list_view_proposals.json'; export const cachedProposalsIdsPath = '/cached_proposals_ids.json'; @@ -9,3 +9,6 @@ export const cachedDetailsPath = (id: number) => export const cachedVotesPath = (id: number) => `/votes/vote_for_proposal_${id}.json`; + +export const cachedEventsPath = (id: number) => + `/events/proposal_${id}_events.json`; diff --git a/src/utils/configs.ts b/src/utils/configs.ts index 2f9cf42c..7ce09cc2 100644 --- a/src/utils/configs.ts +++ b/src/utils/configs.ts @@ -1,9 +1,8 @@ -import { ipfsGateway as baseIpfsGateway } from '@bgd-labs/aave-governance-ui-helpers'; import { initChainInformationConfig } from '@bgd-labs/frontend-web3-utils'; import { CHAINS } from './chains'; // ipfs gateway to get proposals metadata -export const ipfsGateway = baseIpfsGateway; +export const ipfsGateway = 'https://cloudflare-ipfs.com/ipfs'; export const chainInfoHelper = initChainInformationConfig(CHAINS); diff --git a/src/utils/githubCacheRequests.ts b/src/utils/githubCacheRequests.ts index 7a0afd9e..c338c1aa 100644 --- a/src/utils/githubCacheRequests.ts +++ b/src/utils/githubCacheRequests.ts @@ -1,6 +1,7 @@ import { CachedDetails, FinishedProposalForList, + ProposalHistoryItem, VotersData, } from '@bgd-labs/aave-governance-ui-helpers'; import { createAlova } from 'alova'; @@ -9,6 +10,7 @@ import ReactHook from 'alova/react'; import { cachedDetailsPath, + cachedEventsPath, cachedProposalsIdsPath, cachedVotesPath, githubStartUrl, @@ -41,3 +43,6 @@ export const getProposalDetailsCache = (id: number) => export const getProposalVotesCache = (id: number) => alovaInstance.Get<{ votes: VotersData[] }>(cachedVotesPath(id)); + +export const getProposalEventsCache = (id: number) => + alovaInstance.Get>(cachedEventsPath(id)); diff --git a/src/utils/localStorage.ts b/src/utils/localStorage.ts index 342ecfb6..a122d713 100644 --- a/src/utils/localStorage.ts +++ b/src/utils/localStorage.ts @@ -5,7 +5,6 @@ import { import { RepresentativeAddress } from '../representations/store/representationsSlice'; import { AppClientsStorage } from '../rpcSwitcher/store/rpcSwitcherSlice'; -import { IsHelpModalVisible } from '../ui/helpModals/HelpModalProvider'; import { AppModeType, IsGaslessVote } from '../ui/store/uiSlice'; import { EnsDataItem } from '../web3/store/ensSlice'; @@ -13,7 +12,6 @@ export enum LocalStorageKeys { EnsAddresses = 'EnsAddresses', RpcUrls = 'rpcUrls', RepresentingAddresses = 'representingAddresses', - HelpModalVisible = 'isHelpModalVisible', GaslessVote = 'isGaslessVote', TermsAccept = 'termsAccept', AppMode = 'appMode', @@ -75,18 +73,6 @@ export const getLocalStorageLastConnectedWallet = () => { | undefined; }; -export const getLocalStorageIsHelpModalVisible = () => { - return localStorage?.getItem( - LocalStorageKeys.HelpModalVisible, - ) as IsHelpModalVisible; -}; - -export const setLocalStorageIsHelpModalVisible = ( - value: IsHelpModalVisible, -) => { - return localStorage?.setItem(LocalStorageKeys.HelpModalVisible, value); -}; - export const getLocalStorageGaslessVote = () => { return localStorage?.getItem(LocalStorageKeys.GaslessVote) as IsGaslessVote; }; diff --git a/src/web3/services/govDataService.ts b/src/web3/services/govDataService.ts index fb9709ca..267df01e 100644 --- a/src/web3/services/govDataService.ts +++ b/src/web3/services/govDataService.ts @@ -303,19 +303,9 @@ export class GovDataService { return initialPayloadsData.map((payload) => { return { - creator: payload.data.creator, + ...payload.data, id: Number(payload.id), chainId, - maximumAccessLevelRequired: payload.data.maximumAccessLevelRequired, - state: payload.data.state, - createdAt: payload.data.createdAt, - queuedAt: payload.data.queuedAt, - executedAt: payload.data.executedAt, - cancelledAt: payload.data.cancelledAt, - expirationTime: payload.data.expirationTime, - delay: payload.data.delay, - gracePeriod: payload.data.gracePeriod, - actionAddresses: payload.data.actions.map((action) => action.target), payloadsController, }; }); diff --git a/yarn.lock b/yarn.lock index f843aa5b..4d90d0f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1301,17 +1301,17 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" -"@bgd-labs/aave-address-book@^2.15.2": - version "2.15.2" - resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.15.2.tgz#9742da4118c5e02181a6d4e2606825c2b5c4473c" - integrity sha512-OrKzdc2y5QIKqviQD/AI3cugGNOuYsGF/mJ5Uo2E77mmCxF/lcNnupfOthednVEfkCvUadDeOAR2wst0Fj3/Jw== +"@bgd-labs/aave-address-book@^2.18.0": + version "2.18.0" + resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.18.0.tgz#f0e62da3935246c70d0f6dd07d394448dd505852" + integrity sha512-REfTbwYLnazYALXOC1eiuBELirYypk3vXPv2Ale5ZnyD+uQhemc7ya6y75iKGm3BuYC6jLIsGwSHczX8D10UEQ== -"@bgd-labs/aave-governance-ui-helpers@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@bgd-labs/aave-governance-ui-helpers/-/aave-governance-ui-helpers-1.1.1.tgz#3887716512c076fa55b39890523626b55cda5061" - integrity sha512-Y0m0SiFyCaOOczhtRNEg6HmTLcOv5snbx9QUuXgKxjPM9tza4EBobJi+nvyN4upxoSvPy6rdM1v/Q0W6Wt5mQg== +"@bgd-labs/aave-governance-ui-helpers@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@bgd-labs/aave-governance-ui-helpers/-/aave-governance-ui-helpers-2.0.0.tgz#494e3556a2ea88b3c48d1bb8ca7c2849d665e53e" + integrity sha512-IqlAeoFdnR6A83vfEjgBpTsLLOqJ329aRMNuIYVrRGMsVq6JwUpxUW1xkIADte8FRCOUZAaKHTXWGJUcGB6urQ== dependencies: - bs58 "^5.0.0" + "@bgd-labs/js-utils" "1.1.1" dayjs "^1.11.10" gray-matter "^4.0.3" @@ -1323,6 +1323,16 @@ "@tanstack/react-query" "^5.17.12" dayjs "^1.11.10" +"@bgd-labs/js-utils@1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@bgd-labs/js-utils/-/js-utils-1.1.1.tgz#0e400061169cd38d1dd44b401dc3c05b904cbd76" + integrity sha512-CWzoY+3IWpu/YhDgVYbnZhBEGQ8kGJwAgqZexrIkD9+GJh5raEcOWByV8psWapOwttWO4ppxS/RgmMdJQ5Hhxg== + dependencies: + "@supercharge/promise-pool" "^3.1.0" + bs58 "^5.0.0" + gray-matter "^4.0.3" + tsx "^4.4.0" + "@coinbase/wallet-sdk@3.9.1": version "3.9.1" resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.9.1.tgz#503a14671bb392d653623ef2340934e213ac971f" @@ -1466,6 +1476,121 @@ resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.3.1.tgz#d0fce5d07b0620caa282b5131c297bb60f9d87e6" integrity sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww== +"@esbuild/aix-ppc64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz#2acd20be6d4f0458bc8c784103495ff24f13b1d3" + integrity sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g== + +"@esbuild/android-arm64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz#b45d000017385c9051a4f03e17078abb935be220" + integrity sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q== + +"@esbuild/android-arm@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.11.tgz#f46f55414e1c3614ac682b29977792131238164c" + integrity sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw== + +"@esbuild/android-x64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.11.tgz#bfc01e91740b82011ef503c48f548950824922b2" + integrity sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg== + +"@esbuild/darwin-arm64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz#533fb7f5a08c37121d82c66198263dcc1bed29bf" + integrity sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ== + +"@esbuild/darwin-x64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz#62f3819eff7e4ddc656b7c6815a31cf9a1e7d98e" + integrity sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g== + +"@esbuild/freebsd-arm64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz#d478b4195aa3ca44160272dab85ef8baf4175b4a" + integrity sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA== + +"@esbuild/freebsd-x64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz#7bdcc1917409178257ca6a1a27fe06e797ec18a2" + integrity sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw== + +"@esbuild/linux-arm64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz#58ad4ff11685fcc735d7ff4ca759ab18fcfe4545" + integrity sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg== + +"@esbuild/linux-arm@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz#ce82246d873b5534d34de1e5c1b33026f35e60e3" + integrity sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q== + +"@esbuild/linux-ia32@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz#cbae1f313209affc74b80f4390c4c35c6ab83fa4" + integrity sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA== + +"@esbuild/linux-loong64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz#5f32aead1c3ec8f4cccdb7ed08b166224d4e9121" + integrity sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg== + +"@esbuild/linux-mips64el@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz#38eecf1cbb8c36a616261de858b3c10d03419af9" + integrity sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg== + +"@esbuild/linux-ppc64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz#9c5725a94e6ec15b93195e5a6afb821628afd912" + integrity sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA== + +"@esbuild/linux-riscv64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz#2dc4486d474a2a62bbe5870522a9a600e2acb916" + integrity sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ== + +"@esbuild/linux-s390x@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz#4ad8567df48f7dd4c71ec5b1753b6f37561a65a8" + integrity sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q== + +"@esbuild/linux-x64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz#b7390c4d5184f203ebe7ddaedf073df82a658766" + integrity sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA== + +"@esbuild/netbsd-x64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz#d633c09492a1721377f3bccedb2d821b911e813d" + integrity sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ== + +"@esbuild/openbsd-x64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz#17388c76e2f01125bf831a68c03a7ffccb65d1a2" + integrity sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw== + +"@esbuild/sunos-x64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz#e320636f00bb9f4fdf3a80e548cb743370d41767" + integrity sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ== + +"@esbuild/win32-arm64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz#c778b45a496e90b6fc373e2a2bb072f1441fe0ee" + integrity sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ== + +"@esbuild/win32-ia32@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz#481a65fee2e5cce74ec44823e6b09ecedcc5194c" + integrity sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg== + +"@esbuild/win32-x64@0.19.11": + version "0.19.11" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz#a5d300008960bb39677c46bf16f53ec70d8dee04" + integrity sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw== + "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -2345,6 +2470,11 @@ "@stablelib/random" "^1.0.2" "@stablelib/wipe" "^1.0.1" +"@supercharge/promise-pool@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@supercharge/promise-pool/-/promise-pool-3.1.0.tgz#308b9f4d4bf1d607695f916d9454a3556cd4c2b4" + integrity sha512-gB3NukbIcYzRtPoE6dx9svQYPodxvnfQlaaQd8N/z87E6WaMfRE7o5HwB+LZ+KeM0nsNAq1n4TmBtfz1VCUR+Q== + "@svgr/babel-plugin-add-jsx-attribute@8.0.0": version "8.0.0" resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz#4001f5d5dd87fa13303e36ee106e3ff3a7eb8b22" @@ -4516,6 +4646,35 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +esbuild@~0.19.10: + version "0.19.11" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.11.tgz#4a02dca031e768b5556606e1b468fe72e3325d96" + integrity sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA== + optionalDependencies: + "@esbuild/aix-ppc64" "0.19.11" + "@esbuild/android-arm" "0.19.11" + "@esbuild/android-arm64" "0.19.11" + "@esbuild/android-x64" "0.19.11" + "@esbuild/darwin-arm64" "0.19.11" + "@esbuild/darwin-x64" "0.19.11" + "@esbuild/freebsd-arm64" "0.19.11" + "@esbuild/freebsd-x64" "0.19.11" + "@esbuild/linux-arm" "0.19.11" + "@esbuild/linux-arm64" "0.19.11" + "@esbuild/linux-ia32" "0.19.11" + "@esbuild/linux-loong64" "0.19.11" + "@esbuild/linux-mips64el" "0.19.11" + "@esbuild/linux-ppc64" "0.19.11" + "@esbuild/linux-riscv64" "0.19.11" + "@esbuild/linux-s390x" "0.19.11" + "@esbuild/linux-x64" "0.19.11" + "@esbuild/netbsd-x64" "0.19.11" + "@esbuild/openbsd-x64" "0.19.11" + "@esbuild/sunos-x64" "0.19.11" + "@esbuild/win32-arm64" "0.19.11" + "@esbuild/win32-ia32" "0.19.11" + "@esbuild/win32-x64" "0.19.11" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -5152,7 +5311,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@~2.3.2: +fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -5235,6 +5394,13 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" +get-tsconfig@^4.7.2: + version "4.7.2" + resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.2.tgz#0dcd6fb330391d46332f4c6c1bf89a6514c2ddce" + integrity sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A== + dependencies: + resolve-pkg-maps "^1.0.0" + github-from-package@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" @@ -7513,6 +7679,11 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== +resolve-pkg-maps@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f" + integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== + resolve@^1.14.2, resolve@^1.19.0, resolve@^1.22.4: version "1.22.8" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" @@ -8292,6 +8463,16 @@ tsutils@^3.21.0: dependencies: tslib "^1.8.1" +tsx@^4.4.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/tsx/-/tsx-4.7.0.tgz#1689cfe7dda495ca1f9a66d4cad79cb57b9f6f4a" + integrity sha512-I+t79RYPlEYlHn9a+KzwrvEwhJg35h/1zHsLC2JXvhC2mdynMv6Zxzvhv5EMV6VF5qJlLlkSnMVvdZV3PSIGcg== + dependencies: + esbuild "~0.19.10" + get-tsconfig "^4.7.2" + optionalDependencies: + fsevents "~2.3.3" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"