diff --git a/apps/api-gateway/meshrc.ts b/apps/api-gateway/meshrc.ts index e01533879..621bc76de 100644 --- a/apps/api-gateway/meshrc.ts +++ b/apps/api-gateway/meshrc.ts @@ -45,13 +45,15 @@ export default processConfig( "Query.!{transfers}", "Query.!{transfer}", "Query.!{votingPowerHistory}", - 'Query.!{accountBalances}', - 'Query.!{accountBalance}', - 'Query.!{delegation}', - 'Query.!{tokens}', - 'Query.!{token}', - // 'Query.!{votingPowerHistorys}' FIXME: Leave endpoint active for now as it is still used by the notification bot - ] + "Query.!{accountBalances}", + "Query.!{accountBalance}", + "Query.!{delegation}", + "Query.!{tokens}", + "Query.!{token}", + "Query.!{votesOnchain}", + // "Query.!{votesOnchains}", TODO: Leave endpoint active for now as it is still used by the [notification bot](https://github.com/blockful/notification-system/blob/main/packages/anticapture-client/queries/votes.graphql) + // 'Query.!{votingPowerHistorys}' TODO: Leave endpoint active for now as it is still used by the notification bot + ], }, }, ], diff --git a/apps/api-gateway/schema.graphql b/apps/api-gateway/schema.graphql index 7e1d14c7d..36e849693 100644 --- a/apps/api-gateway/schema.graphql +++ b/apps/api-gateway/schema.graphql @@ -13,85 +13,76 @@ directive @transport(subgraph: String, kind: String, location: String, headers: type Query { votingPowerHistorys(where: votingPowerHistoryFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): votingPowerHistoryPage! delegations(where: delegationFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): delegationPage! - votesOnchain(voterAccountId: String!, proposalId: String!): votesOnchain votesOnchains(where: votesOnchainFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): votesOnchainPage! - daoMetricsDayBuckets(where: daoMetricsDayBucketFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): daoMetricsDayBucketPage! _meta: Meta - """ - Get historical Liquid Treasury (treasury without DAO tokens) from external providers (DefiLlama/Dune) - """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/treasury/liquid`\nGet historical Liquid Treasury (treasury without DAO tokens) from external providers (DefiLlama/Dune)\n" getLiquidTreasury(days: queryInput_getLiquidTreasury_days = _365d, order: queryInput_getLiquidTreasury_order = asc): getLiquidTreasury_200_response - """ - Get historical DAO Token Treasury value (governance token quantity × token price) - """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/treasury/dao-token`\nGet historical DAO Token Treasury value (governance token quantity × token price)\n" getDaoTokenTreasury(days: queryInput_getDaoTokenTreasury_days = _365d, order: queryInput_getDaoTokenTreasury_order = asc): getDaoTokenTreasury_200_response - """Get historical Total Treasury (liquid treasury + DAO token treasury)""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/treasury/total`\nGet historical Total Treasury (liquid treasury + DAO token treasury)\n" getTotalTreasury(days: queryInput_getTotalTreasury_days = _365d, order: queryInput_getTotalTreasury_order = asc): getTotalTreasury_200_response - """Get historical market data for a specific token""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/token/historical-data`\nGet historical market data for a specific token\n" historicalTokenData(skip: NonNegativeInt, limit: Float = 365): [query_historicalTokenData_items] - """Get property data for a specific token""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/token`\nGet property data for a specific token\n" token(currency: queryInput_token_currency = usd): token_200_response - """Compare total supply between periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/total-supply/compare`\nCompare total supply between periods\n" compareTotalSupply(days: queryInput_compareTotalSupply_days = _90d): compareTotalSupply_200_response - """Compare delegated supply between periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/delegated-supply/compare`\nCompare delegated supply between periods\n" compareDelegatedSupply(days: queryInput_compareDelegatedSupply_days = _90d): compareDelegatedSupply_200_response - """Compare circulating supply between periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/circulating-supply/compare`\nCompare circulating supply between periods\n" compareCirculatingSupply(days: queryInput_compareCirculatingSupply_days = _90d): compareCirculatingSupply_200_response - """Compare treasury between periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/treasury/compare`\nCompare treasury between periods\n" compareTreasury(days: queryInput_compareTreasury_days = _90d): compareTreasury_200_response - """Compare cex supply between periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/cex-supply/compare`\nCompare cex supply between periods\n" compareCexSupply(days: queryInput_compareCexSupply_days = _90d): compareCexSupply_200_response - """Compare dex supply between periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/dex-supply/compare`\nCompare dex supply between periods\n" compareDexSupply(days: queryInput_compareDexSupply_days = _90d): compareDexSupply_200_response - """Compare lending supply between periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/lending-supply/compare`\nCompare lending supply between periods\n" compareLendingSupply(days: queryInput_compareLendingSupply_days = _90d): compareLendingSupply_200_response - """Get active token supply for DAO""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/active-supply/compare`\nGet active token supply for DAO\n" compareActiveSupply(days: queryInput_compareActiveSupply_days = _90d): compareActiveSupply_200_response - """Compare number of proposals between time periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals/compare`\nCompare number of proposals between time periods\n" compareProposals(days: queryInput_compareProposals_days = _90d): compareProposals_200_response - """Compare number of votes between time periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/votes/compare`\nCompare number of votes between time periods\n" compareVotes(days: queryInput_compareVotes_days = _90d): compareVotes_200_response - """Compare average turnout between time periods""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/average-turnout/compare`\nCompare average turnout between time periods\n" compareAverageTurnout(days: queryInput_compareAverageTurnout_days = _90d): compareAverageTurnout_200_response - """ - Returns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window - """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals-activity`\nReturns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window\n" proposalsActivity(address: String!, fromDate: String, skip: NonNegativeInt, limit: PositiveInt = 10, orderBy: queryInput_proposalsActivity_orderBy = timestamp, orderDirection: queryInput_proposalsActivity_orderDirection = desc, userVoteFilter: queryInput_proposalsActivity_userVoteFilter): proposalsActivity_200_response - """Returns a list of proposal""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals`\nReturns a list of proposal\n" proposals(skip: NonNegativeInt, limit: PositiveInt = 10, orderDirection: queryInput_proposals_orderDirection = desc, status: JSON, fromDate: Float, fromEndDate: Float, includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals = TRUE): proposals_200_response - """Returns a single proposal by its ID""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals/{args.id}`\nReturns a single proposal by its ID\n" proposal(id: String!): proposal_200_response - """Returns the active delegates that did not vote on a given proposal""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals/{args.id}/non-voters`\nReturns the active delegates that did not vote on a given proposal\n" proposalNonVoters(id: String!, skip: NonNegativeInt, limit: PositiveInt = 10, orderDirection: queryInput_proposalNonVoters_orderDirection = desc, addresses: JSON): proposalNonVoters_200_response - """ - Fetch historical token balances for multiple addresses at a specific time period using multicall - """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals/{args.id}/votes`\nReturns a paginated list of votes cast on a specific proposal\n" + votes(id: String!, skip: NonNegativeInt, limit: PositiveInt = 10, voterAddressIn: JSON, orderBy: queryInput_votes_orderBy = timestamp, orderDirection: queryInput_votes_orderDirection = desc, support: Float): votes_200_response + + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/balances/historical`\nFetch historical token balances for multiple addresses at a specific time period using multicall\n" historicalBalances(addresses: JSON!, days: queryInput_historicalBalances_days = _7d): [query_historicalBalances_items] - """ - Get transactions with their associated transfers and delegations, with optional filtering and sorting - """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/transactions`\nGet transactions with their associated transfers and delegations, with optional filtering and sorting\n" transactions( limit: PositiveInt = 50 offset: NonNegativeInt @@ -113,59 +104,46 @@ type Query { includes: JSON ): transactions_200_response - """Get the last update time""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/last-update`\nGet the last update time\n" lastUpdate(chart: queryInput_lastUpdate_chart!): lastUpdate_200_response - """Get delegation percentage day buckets with forward-fill""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/delegation-percentage`\nGet delegation percentage day buckets with forward-fill\n" delegationPercentageByDay(startDate: String, endDate: String, orderDirection: queryInput_delegationPercentageByDay_orderDirection = asc, limit: NonNegativeInt = 365, after: String, before: String): delegationPercentageByDay_200_response - """Returns a list of voting power changes""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/voting-powers/{args.accountId}/historical`\nReturns a list of voting power changes\n" historicalVotingPowers(accountId: String!, skip: NonNegativeInt, limit: PositiveInt = 10, orderBy: queryInput_historicalVotingPowers_orderBy = timestamp, orderDirection: queryInput_historicalVotingPowers_orderDirection = desc, fromDate: String, toDate: String, fromValue: String, toValue: String): historicalVotingPowers_200_response - """ - Returns a mapping of the voting power changes within a time frame for the given addresses - """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/accounts/voting-powers/variations`\nReturns a mapping of the voting power changes within a time frame for the given addresses\n" votingPowerVariations(addresses: JSON, limit: PositiveInt = 10, skip: NonNegativeInt, orderDirection: queryInput_votingPowerVariations_orderDirection = desc, fromDate: String, toDate: String): votingPowerVariations_200_response - """Returns a the changes to voting power by period and accountId""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/accounts/{args.address}/voting-powers/variations`\nReturns a the changes to voting power by period and accountId\n" votingPowerVariationsByAccountId(address: String!, fromDate: String, toDate: String): votingPowerVariationsByAccountId_200_response - """Returns sorted and paginated account voting power records""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/voting-powers`\nReturns sorted and paginated account voting power records\n" votingPowers(limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_votingPowers_orderDirection = desc, orderBy: queryInput_votingPowers_orderBy = votingPower, addresses: JSON, fromValue: String, toValue: String): votingPowers_200_response - """Returns voting power information for a specific address (account)""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/voting-powers/{args.accountId}`\nReturns voting power information for a specific address (account)\n" votingPowerByAccountId(accountId: String!): votingPowerByAccountId_200_response - """ - Returns a mapping of the biggest variations to account balances associated by account address - """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/balances/variations`\nReturns a mapping of the biggest variations to account balances associated by account address\n" accountBalanceVariations(days: queryInput_accountBalanceVariations_days = _90d, limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_accountBalanceVariations_orderDirection = desc): accountBalanceVariations_200_response - """Returns sorted and paginated account balance records""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/balances`\nReturns sorted and paginated account balance records\n" accountBalances(limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_accountBalances_orderDirection = desc, addresses: JSON, delegates: JSON, fromValue: String, toValue: String): accountBalances_200_response - """Returns account balance information for a specific address""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/accounts/{args.address}/balances`\nReturns account balance information for a specific address\n" accountBalanceByAccountId(address: String!): accountBalanceByAccountId_200_response - """ - Returns a mapping of the largest interactions between accounts. - Positive amounts signify net token transfers FROM
, whilst negative amounts refer to net transfers TO
- """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/balances/{args.address}/interactions`\nReturns a mapping of the largest interactions between accounts. \nPositive amounts signify net token transfers FROM
, whilst negative amounts refer to net transfers TO
\n" accountInteractions(address: String!, days: queryInput_accountInteractions_days = _90d, limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_accountInteractions_orderDirection = desc, minAmount: String, maxAmount: String, orderBy: queryInput_accountInteractions_orderBy = count, filterAddress: String): accountInteractions_200_response - """Get transfers of a given address""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/accounts/{args.address}/transfers`\nGet transfers of a given address\n" transfers(address: String!, limit: Float = 10, offset: Float, sortBy: queryInput_transfers_sortBy = timestamp, sortOrder: queryInput_transfers_sortOrder = asc, from: String, to: String, fromDate: Float, toDate: Float, fromValue: String, toValue: String): transfers_200_response - """Returns current governance parameters for this DAO""" + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/dao`\nReturns current governance parameters for this DAO\n" dao: dao_200_response - """Returns a mapping of the top voting power changes within a time frame""" - topVotingPowerVariations(limit: PositiveInt = 10, skip: NonNegativeInt, orderDirection: queryInput_topVotingPowerVariations_orderDirection = desc, fromDate: String, toDate: String): topVotingPowerVariations_200_response - - """ - Returns token related metrics for a single metric type. - Available types: TOTAL_SUPPLY, DELEGATED_SUPPLY, CEX_SUPPLY, DEX_SUPPLY, LENDING_SUPPLY, CIRCULATING_SUPPLY, TREASURY - """ + "\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/token-metrics`\nReturns token related metrics for a single metric type.\n Available types: TOTAL_SUPPLY, DELEGATED_SUPPLY, CEX_SUPPLY, DEX_SUPPLY, LENDING_SUPPLY, CIRCULATING_SUPPLY, TREASURY\n" tokenMetrics(metricType: queryInput_tokenMetrics_metricType!, startDate: Float, endDate: Float, orderDirection: queryInput_tokenMetrics_orderDirection = asc, limit: NonNegativeInt = 365, skip: NonNegativeInt): tokenMetrics_200_response """ @@ -1750,6 +1728,31 @@ enum queryInput_proposalNonVoters_orderDirection { desc } +type votes_200_response { + items: [query_votes_items_items]! + totalCount: Float! +} + +type query_votes_items_items { + voterAddress: String! + transactionHash: String! + proposalId: String! + support: Float! + votingPower: String! + reason: String + timestamp: Float! +} + +enum queryInput_votes_orderBy { + timestamp + votingPower +} + +enum queryInput_votes_orderDirection { + asc + desc +} + type query_historicalBalances_items { address: String! balance: String! @@ -2097,43 +2100,6 @@ type dao_200_response { timelockDelay: String! } -scalar ObjMap - -enum HTTPMethod { - GET - HEAD - POST - PUT - DELETE - CONNECT - OPTIONS - TRACE - PATCH -} - -type topVotingPowerVariations_200_response { - period: query_topVotingPowerVariations_period! - items: [query_topVotingPowerVariations_items_items]! -} - -type query_topVotingPowerVariations_period { - startTimestamp: String! - endTimestamp: String! -} - -type query_topVotingPowerVariations_items_items { - accountId: String! - previousVotingPower: String! - currentVotingPower: String! - absoluteChange: String! - percentageChange: String! -} - -enum queryInput_topVotingPowerVariations_orderDirection { - asc - desc -} - type tokenMetrics_200_response { items: [query_tokenMetrics_items_items]! pageInfo: query_tokenMetrics_pageInfo! @@ -2166,6 +2132,20 @@ enum queryInput_tokenMetrics_orderDirection { desc } +scalar ObjMap + +enum HTTPMethod { + GET + HEAD + POST + PUT + DELETE + CONNECT + OPTIONS + TRACE + PATCH +} + type AverageDelegationPercentageItem { date: String! high: String! diff --git a/apps/api-gateway/src/resolvers/rest.ts b/apps/api-gateway/src/resolvers/rest.ts index 595755239..1f4880b76 100644 --- a/apps/api-gateway/src/resolvers/rest.ts +++ b/apps/api-gateway/src/resolvers/rest.ts @@ -28,6 +28,7 @@ const daoItemQueries = [ "proposal", "proposalNonVoters", "proposals", + "votes", "proposalsActivity", "token", "tokenMetrics", diff --git a/apps/dashboard/features/governance/components/proposal-overview/ProposalHeader.tsx b/apps/dashboard/features/governance/components/proposal-overview/ProposalHeader.tsx index a8b758a74..6b17bd860 100644 --- a/apps/dashboard/features/governance/components/proposal-overview/ProposalHeader.tsx +++ b/apps/dashboard/features/governance/components/proposal-overview/ProposalHeader.tsx @@ -12,7 +12,7 @@ interface ProposalHeaderProps { daoId: string; setIsVotingModalOpen: (isOpen: boolean) => void; votingPower: string; - votesOnchain: GetAccountPowerQuery["votesOnchain"] | null; + votes: GetAccountPowerQuery["votes"] | null; address: string | undefined; proposalStatus: string; } @@ -20,11 +20,13 @@ interface ProposalHeaderProps { export const ProposalHeader = ({ daoId, votingPower, - votesOnchain, + votes, setIsVotingModalOpen, address, proposalStatus, }: ProposalHeaderProps) => { + const supportValue = votes?.items[0]?.support; + return (
@@ -53,7 +55,7 @@ export const ProposalHeader = ({

Your VP: {votingPower}{" "} - {/* {daoId.toUpperCase()} voted {votesOnchain?.support} on this proposal */} + {/* {daoId.toUpperCase()} voted {votes?.support} on this proposal */}

{address && ( @@ -69,7 +71,7 @@ export const ProposalHeader = ({ {/* If already voted: show voted badge */} {address ? ( - !votesOnchain?.support ? ( + !supportValue ? ( proposalStatus.toLowerCase() === "ongoing" && ( ) : ( - + ) ) : (
@@ -114,7 +116,7 @@ export const ProposalSection = () => { export const VotedBadge = ({ vote }: { vote: number }) => { return (
-

+

You voted

{getVoteText(vote)} diff --git a/apps/dashboard/features/governance/components/proposal-overview/TabsVotedContent.tsx b/apps/dashboard/features/governance/components/proposal-overview/TabsVotedContent.tsx index c6652bf84..7d170f260 100644 --- a/apps/dashboard/features/governance/components/proposal-overview/TabsVotedContent.tsx +++ b/apps/dashboard/features/governance/components/proposal-overview/TabsVotedContent.tsx @@ -84,10 +84,10 @@ export const TabsVotedContent = ({ const columns: ColumnDef[] = useMemo( () => [ { - accessorKey: "voterAccountId", + accessorKey: "voterAddress", size: 200, cell: ({ row }) => { - const voterAddress = row.getValue("voterAccountId") as string; + const voterAddress = row.getValue("voterAddress") as string; const vote = row.original; // Handle loading row @@ -156,8 +156,8 @@ export const TabsVotedContent = ({ accessorKey: "support", size: 120, cell: ({ row }) => { - const support = row.getValue("support") as string; - const voterAddress = row.getValue("voterAccountId") as string; + const support = row.getValue("support") as number; + const voterAddress = row.getValue("voterAddress") as string; const vote = row.original; // Handle loading row @@ -189,19 +189,19 @@ export const TabsVotedContent = ({ return
; } - const getChoiceInfo = (support: string) => { + const getChoiceInfo = (support: number) => { switch (support) { - case "1": + case 1: return { label: "For", icon: , }; - case "0": + case 0: return { label: "Against", icon: , }; - case "2": + case 2: return { label: "Abstain", icon: , @@ -240,7 +240,7 @@ export const TabsVotedContent = ({ size: 120, cell: ({ row }) => { const timestamp = row.getValue("timestamp") as string; - const voterAddress = row.getValue("voterAccountId") as string; + const voterAddress = row.getValue("voterAddress") as string; const vote = row.original; // Handle loading row @@ -315,7 +315,7 @@ export const TabsVotedContent = ({ size: 160, cell: ({ row }) => { const votingPower = row.getValue("votingPower") as string; - const voterAddress = row.getValue("voterAccountId") as string; + const voterAddress = row.getValue("voterAddress") as string; const vote = row.original; // Handle loading row @@ -397,7 +397,7 @@ export const TabsVotedContent = ({ accessorKey: "votingPowerVariation", size: 160, cell: ({ row }) => { - const voterAddress = row.getValue("voterAccountId") as string; + const voterAddress = row.getValue("voterAddress") as string; const votingPowerVariation = row.getValue("votingPowerVariation") as { previousVotingPower: string; currentVotingPower: string; @@ -503,14 +503,13 @@ export const TabsVotedContent = ({ // Add description row if the vote has a reason if (vote.reason && vote.reason.trim() !== "") { data.push({ - voterAccountId: `__DESCRIPTION_${vote.voterAccountId}__`, - txHash: "", - daoId: vote.daoId, + voterAddress: `__DESCRIPTION_${vote.voterAddress}__`, + transactionHash: "", proposalId: vote.proposalId, - support: "", + support: 0, votingPower: "", reason: vote.reason, - timestamp: "", + timestamp: 0, isSubRow: true, } as VoteWithHistoricalPower); } @@ -519,14 +518,13 @@ export const TabsVotedContent = ({ // Add loading row if there are more pages or currently loading if (hasNextPage || isLoadingMore) { data.push({ - voterAccountId: "__LOADING_ROW__", - txHash: "", - daoId: "", + voterAddress: "__LOADING_ROW__", + transactionHash: "", proposalId: "", - support: "", + support: 0, votingPower: "", reason: "", - timestamp: "", + timestamp: 0, isSubRow: false, } as VoteWithHistoricalPower); } @@ -538,8 +536,7 @@ export const TabsVotedContent = ({ const hasValidData = votes.length > 0 && votes.some( - (vote) => - vote.voterAccountId && vote.voterAccountId !== "__LOADING_ROW__", + (vote) => vote.voterAddress && vote.voterAddress !== "__LOADING_ROW__", ); if (error) { diff --git a/apps/dashboard/features/governance/components/proposal-overview/VotesTabContent.tsx b/apps/dashboard/features/governance/components/proposal-overview/VotesTabContent.tsx index a0bafb497..68396a574 100644 --- a/apps/dashboard/features/governance/components/proposal-overview/VotesTabContent.tsx +++ b/apps/dashboard/features/governance/components/proposal-overview/VotesTabContent.tsx @@ -8,8 +8,8 @@ import { TabsVotedContent } from "@/features/governance/components/proposal-over import { DaoIdEnum } from "@/shared/types/daos"; import { useParams } from "next/navigation"; import { - useGetVotesOnchainsTotalCountQuery, useGetProposalNonVotersQuery, + useGetVotesQuery, } from "@anticapture/graphql-client/hooks"; import { formatUnits } from "viem"; import { TabsDidntVoteContent } from "@/features/governance/components/proposal-overview/TabsDidntVoteContent"; @@ -29,7 +29,7 @@ export const VotesTabContent = ({ const TabsContent = TabsContentMapping[activeTab]; // Get votes for this proposal - const { data } = useGetVotesOnchainsTotalCountQuery({ + const { data } = useGetVotesQuery({ variables: { proposalId: proposal.id, }, @@ -76,7 +76,7 @@ export const VotesTabContent = ({ > Voted
- {data?.votesOnchains?.totalCount} voters / {totalVotes} VP + {data?.votes?.totalCount} voters / {totalVotes} VP
["items"][number] +> & { + votingPowerVariation?: VotingPowerVariation; + isSubRow?: boolean; +}; export interface UseVotesResult { votes: VoteWithHistoricalPower[]; @@ -52,32 +58,21 @@ export const useVotes = ({ }: UseVotesParams = {}): UseVotesResult => { // State for infinite scroll const [allVotes, setAllVotes] = useState([]); - const [currentCursor, setCurrentCursor] = useState(null); const [isLoadingMore, setIsLoadingMore] = useState(false); - // Build query variables for infinite scroll (forward only) + // Build query variables for skip-based pagination const queryVariables = useMemo(() => { - const baseVars = { - proposalId, - limit, - orderBy, - orderDirection, - }; - - if (!currentCursor) { - // First page - return baseVars; - } - - // Always forward for infinite scroll return { - ...baseVars, - after: currentCursor, + proposalId: proposalId!, + limit, + skip: 0, // Always fetch from beginning, we'll handle append in fetchMore + orderBy: orderBy as QueryInput_Votes_OrderBy, + orderDirection: orderDirection as QueryInput_Votes_OrderDirection, }; - }, [proposalId, limit, orderBy, orderDirection, currentCursor]); + }, [proposalId, limit, orderBy, orderDirection]); // Main votes query - const { data, loading, error, fetchMore } = useGetVotesOnchainsQuery({ + const { data, loading, error, fetchMore } = useGetVotesQuery({ variables: queryVariables, context: { headers: { @@ -104,7 +99,7 @@ export const useVotes = ({ return; try { - const addresses = votesNeedingData.map((vote) => vote.voterAccountId); + const addresses = votesNeedingData.map((vote) => vote.voterAddress); const result = await getVotingPowerChange({ variables: { @@ -137,12 +132,12 @@ export const useVotes = ({ prevVotes.map((vote) => { // Only update if this vote was in the fetch list const wasFetched = votesNeedingData.some( - (v) => v.voterAccountId === vote.voterAccountId, + (v) => v.voterAddress === vote.voterAddress, ); if (wasFetched) { return { ...vote, - votingPowerVariation: powerChanges[vote.voterAccountId], + votingPowerVariation: powerChanges[vote.voterAddress], }; } // Return the vote unchanged @@ -160,49 +155,35 @@ export const useVotes = ({ // Reset accumulated votes when sorting parameters change useEffect(() => { setAllVotes([]); - setCurrentCursor(null); setIsLoadingMore(false); }, [orderBy, orderDirection]); // Initialize allVotes on first load or when data changes after reset useEffect(() => { - if (data?.votesOnchains?.items && allVotes.length === 0 && !currentCursor) { - const initialVotes = data.votesOnchains - .items as VoteWithHistoricalPower[]; + if (data?.votes?.items && allVotes.length === 0) { + const initialVotes = data.votes.items as VoteWithHistoricalPower[]; setAllVotes(initialVotes); // Fetch voting power for initial votes fetchVotingPowerForVotes(initialVotes); } - }, [ - data?.votesOnchains?.items, - allVotes.length, - currentCursor, - fetchVotingPowerForVotes, - ]); + }, [data?.votes?.items, allVotes.length, fetchVotingPowerForVotes]); // Use accumulated votes for infinite scroll const votes = allVotes; - // Extract pagination info - const pageInfo = useMemo(() => { - return ( - data?.votesOnchains?.pageInfo || { - startCursor: null, - endCursor: null, - hasNextPage: false, - hasPreviousPage: false, - } - ); - }, [data?.votesOnchains?.pageInfo]); - // Extract total count const totalCount = useMemo(() => { - return data?.votesOnchains?.totalCount || 0; - }, [data?.votesOnchains?.totalCount]); + return data?.votes?.totalCount || 0; + }, [data?.votes?.totalCount]); + + // Calculate if there are more pages + const hasNextPage = useMemo(() => { + return allVotes.length < totalCount; + }, [allVotes.length, totalCount]); - // Load more votes for infinite scroll + // Load more votes for infinite scroll with skip-based pagination const loadMore = useCallback(async () => { - if (!pageInfo.hasNextPage || isLoadingMore) return; + if (!hasNextPage || isLoadingMore) return; setIsLoadingMore(true); @@ -211,46 +192,41 @@ export const useVotes = ({ variables: { proposalId, limit, - after: pageInfo.endCursor, + skip: allVotes.length, // Skip already loaded votes }, updateQuery: (previousResult, { fetchMoreResult }) => { - if (!fetchMoreResult) return previousResult; + if (!fetchMoreResult?.votes?.items) return previousResult; // Append new votes to existing ones in the GraphQL cache - const newVotes = (fetchMoreResult.votesOnchains?.items || - []) as VoteWithHistoricalPower[]; + const newVotes = fetchMoreResult.votes + .items as VoteWithHistoricalPower[]; setAllVotes((prev) => [...prev, ...newVotes]); // Fetch voting power for new votes fetchVotingPowerForVotes(newVotes); - // Return the new result for the cache + // Return the merged result for the cache return { - ...fetchMoreResult, - votesOnchains: { - ...fetchMoreResult.votesOnchains, - items: [ - ...(previousResult.votesOnchains?.items || []), - ...newVotes, - ], + votes: { + ...fetchMoreResult.votes, + items: [...(previousResult.votes?.items || []), ...newVotes], + totalCount: fetchMoreResult.votes.totalCount || 0, }, }; }, }); - - setCurrentCursor(pageInfo.endCursor || null); } catch (error) { console.error("Error loading more votes:", error); } finally { setIsLoadingMore(false); } }, [ - pageInfo.hasNextPage, - pageInfo.endCursor, + hasNextPage, isLoadingMore, fetchMore, proposalId, limit, + allVotes.length, fetchVotingPowerForVotes, ]); @@ -260,7 +236,7 @@ export const useVotes = ({ loading, error, loadMore, - hasNextPage: pageInfo.hasNextPage, + hasNextPage, isLoadingMore, }; }; diff --git a/apps/dashboard/features/governance/types/index.ts b/apps/dashboard/features/governance/types/index.ts index 60c93138c..e507d38b9 100644 --- a/apps/dashboard/features/governance/types/index.ts +++ b/apps/dashboard/features/governance/types/index.ts @@ -18,7 +18,7 @@ export enum ProposalState { COMPLETED = "completed", } -export interface ProposalVotes { +export interface Votes { for: string; against: string; total: string; @@ -42,7 +42,7 @@ export interface Proposal extends Omit< status: ProposalStatus; state: ProposalState; proposer: string; // Alias for proposerAccountId - votes: ProposalVotes; + votes: Votes; quorum: string; timeText?: string; timeRemaining?: string; diff --git a/apps/dashboard/shared/services/umami/index.tsx b/apps/dashboard/shared/services/umami/index.tsx index fdfdc3b9e..d4de015e1 100644 --- a/apps/dashboard/shared/services/umami/index.tsx +++ b/apps/dashboard/shared/services/umami/index.tsx @@ -10,7 +10,7 @@ const UmamiScript: FC = () => { if (process.env.NODE_ENV === "production") { if (!UMAMI_WEBSITE_ID) { console.error( - "Umami website ID is not configured. Set NEXT_PUBLIC_UMAMI_WEBSITE_ID." + "Umami website ID is not configured. Set NEXT_PUBLIC_UMAMI_WEBSITE_ID.", ); return null; } diff --git a/apps/indexer/src/api/controllers/proposals/proposals.ts b/apps/indexer/src/api/controllers/proposals/proposals.ts index 00c2e7bfa..db54730a0 100644 --- a/apps/indexer/src/api/controllers/proposals/proposals.ts +++ b/apps/indexer/src/api/controllers/proposals/proposals.ts @@ -9,6 +9,8 @@ import { ProposalMapper, VotersRequestSchema, VotersResponseSchema, + VotesRequestSchema, + VotesResponseSchema, } from "@/api/mappers"; import { DAOClient } from "@/interfaces"; @@ -162,4 +164,49 @@ export function proposals( return context.json({ totalCount, items }); }, ); + + app.openapi( + createRoute({ + method: "get", + operationId: "votes", + path: "/proposals/{id}/votes", + summary: "List of votes for a given proposal", + description: + "Returns a paginated list of votes cast on a specific proposal", + tags: ["proposals"], + request: { + params: z.object({ + id: z.string(), + }), + query: VotesRequestSchema, + }, + responses: { + 200: { + description: "Successfully retrieved votes", + content: { + "application/json": { + schema: VotesResponseSchema, + }, + }, + }, + }, + }), + async (context) => { + const { id } = context.req.valid("param"); + const { skip, limit, voterAddressIn, orderBy, orderDirection, support } = + context.req.valid("query"); + + const { totalCount, items } = await service.getVotes( + id, + skip, + limit, + orderBy, + orderDirection, + voterAddressIn, + support, + ); + + return context.json({ totalCount, items }); + }, + ); } diff --git a/apps/indexer/src/api/mappers/proposals/index.ts b/apps/indexer/src/api/mappers/proposals/index.ts index 5c5519b96..f6f52dbbb 100644 --- a/apps/indexer/src/api/mappers/proposals/index.ts +++ b/apps/indexer/src/api/mappers/proposals/index.ts @@ -1,2 +1,3 @@ export * from "./voters"; export * from "./proposals"; +export * from "./votes"; diff --git a/apps/indexer/src/api/mappers/proposals/votes.ts b/apps/indexer/src/api/mappers/proposals/votes.ts new file mode 100644 index 000000000..f27cd3f21 --- /dev/null +++ b/apps/indexer/src/api/mappers/proposals/votes.ts @@ -0,0 +1,76 @@ +import { z } from "@hono/zod-openapi"; +import { votesOnchain } from "ponder:schema"; +import { getAddress, isAddress } from "viem"; + +export type DBVote = typeof votesOnchain.$inferSelect; + +export const VotesRequestSchema = z.object({ + skip: z.coerce + .number() + .int() + .min(0, "Skip must be a non-negative integer") + .optional() + .default(0), + limit: z.coerce + .number() + .int() + .min(1, "Limit must be a positive integer") + .max(1000, "Limit cannot exceed 1000") + .optional() + .default(10), + voterAddressIn: z + .union([ + z + .string() + .refine((val) => isAddress(val, { strict: false })) + .transform((val) => [getAddress(val)]), + z.array( + z + .string() + .refine((val) => isAddress(val, { strict: false })) + .transform((val) => getAddress(val)), + ), + ]) + .optional(), + orderBy: z.enum(["timestamp", "votingPower"]).optional().default("timestamp"), + orderDirection: z.enum(["asc", "desc"]).optional().default("desc"), + support: z.coerce + .number() + .transform((val) => String(val)) // Support for the vote like For, Against, Abstain + .optional(), +}); + +export type VotesRequest = z.infer; + +export const VoteResponseSchema = z.object({ + voterAddress: z.string(), + transactionHash: z.string(), + proposalId: z.string(), + support: z.number(), + votingPower: z.string(), + reason: z.string().nullable(), + timestamp: z.number(), +}); + +export type VoteResponse = z.infer; + +export const VotesResponseSchema = z.object({ + items: z.array(VoteResponseSchema), + totalCount: z.number(), +}); + +export type VotesResponse = z.infer; + +export const VotesMapper = { + toApi: (vote: DBVote): VoteResponse => { + return { + voterAddress: vote.voterAccountId, + transactionHash: vote.txHash, + proposalId: vote.proposalId, + support: Number(vote.support), + votingPower: vote.votingPower.toString(), + reason: vote.reason || null, + timestamp: Number(vote.timestamp), + }; + }, +}; diff --git a/apps/indexer/src/api/repositories/drizzle/index.ts b/apps/indexer/src/api/repositories/drizzle/index.ts index e3aa220cf..8c5afa98a 100644 --- a/apps/indexer/src/api/repositories/drizzle/index.ts +++ b/apps/indexer/src/api/repositories/drizzle/index.ts @@ -30,7 +30,7 @@ import { VotesCompareQueryResult, } from "@/api/controllers"; import { DaysEnum } from "@/lib/enums"; -import { DBProposal } from "@/api/mappers"; +import { DBProposal, DBVote } from "@/api/mappers"; export class DrizzleRepository { async getSupplyComparison(metricType: string, days: DaysEnum) { @@ -308,6 +308,62 @@ export class DrizzleRepository { ); } + async getVotes( + proposalId: string, + skip: number, + limit: number, + orderBy: "timestamp" | "votingPower", + orderDirection: "asc" | "desc", + voterAddresses?: Address[], + support?: string, + ): Promise { + const whereClauses: SQL[] = [ + eq(votesOnchain.proposalId, proposalId), + ]; + + if (support !== undefined) { + whereClauses.push(eq(votesOnchain.support, support)); + } + + if (voterAddresses !== undefined && voterAddresses.length > 0) { + whereClauses.push(inArray(votesOnchain.voterAccountId, voterAddresses)); + } + + const orderByColumn = + orderBy === "votingPower" + ? votesOnchain.votingPower + : votesOnchain.timestamp; + const orderFn = orderDirection === "asc" ? asc : desc; + + return await db + .select() + .from(votesOnchain) + .where(and(...whereClauses)) + .orderBy(orderFn(orderByColumn)) + .limit(limit) + .offset(skip); + } + + async getVotesCount( + proposalId: string, + voterAddressIn?: Address[], + support?: string, + ): Promise { + const whereClauses: SQL[] = [ + eq(votesOnchain.proposalId, proposalId), + ]; + + if (support !== undefined) { + whereClauses.push(eq(votesOnchain.support, support)); + } + + if (voterAddressIn !== undefined && voterAddressIn.length > 0) { + whereClauses.push(inArray(votesOnchain.voterAccountId, voterAddressIn)); + } + + return await db.$count(votesOnchain, and(...whereClauses)); + } + now() { return Math.floor(Date.now() / 1000); } diff --git a/apps/indexer/src/api/services/proposals/index.ts b/apps/indexer/src/api/services/proposals/index.ts index b9b8addc8..b9569f4bf 100644 --- a/apps/indexer/src/api/services/proposals/index.ts +++ b/apps/indexer/src/api/services/proposals/index.ts @@ -1,4 +1,11 @@ -import { DBProposal, ProposalsRequest, VotersResponse } from "@/api/mappers"; +import { + DBProposal, + ProposalsRequest, + VotersResponse, + VotesResponse, + DBVote, + VotesMapper, +} from "@/api/mappers"; import { DAOClient } from "@/interfaces/client"; import { ProposalStatus } from "@/lib/constants"; import { DaysEnum } from "@/lib/enums"; @@ -29,6 +36,20 @@ interface ProposalsRepository { voters: Address[], comparisonTimestamp: number, ): Promise>; + getVotes( + proposalId: string, + skip: number, + limit: number, + orderBy: "timestamp" | "votingPower", + orderDirection: "asc" | "desc", + voterAddressIn?: Address[], + support?: string, + ): Promise; + getVotesCount( + proposalId: string, + voterAddressIn?: Address[], + support?: string, + ): Promise; } export class ProposalsService { @@ -170,4 +191,35 @@ export class ProposalsService { })), }; } + + /** + * Returns the list of votes for a given proposal + */ + async getVotes( + proposalId: string, + skip: number = 0, + limit: number = 10, + orderBy: "timestamp" | "votingPower" = "timestamp", + orderDirection: "asc" | "desc" = "desc", + voterAddressIn?: Address[], + support?: string, + ): Promise { + const [votes, totalCount] = await Promise.all([ + this.proposalsRepo.getVotes( + proposalId, + skip, + limit, + orderBy, + orderDirection, + voterAddressIn, + support, + ), + this.proposalsRepo.getVotesCount(proposalId, voterAddressIn, support), + ]); + + return { + totalCount, + items: votes.map(VotesMapper.toApi), + }; + } } diff --git a/packages/graphql-client/documents/governance/proposals.graphql b/packages/graphql-client/documents/governance/proposals.graphql index 65ec4734f..2a9c9dc40 100644 --- a/packages/graphql-client/documents/governance/proposals.graphql +++ b/packages/graphql-client/documents/governance/proposals.graphql @@ -56,33 +56,24 @@ query GetProposal($id: String!) { } # Get proposal votes -query GetVotesOnchains( - $proposalId: String - $limit: Int - $after: String - $before: String - $orderBy: String = "timestamp" - $orderDirection: String = "desc" +query GetVotes( + $proposalId: String! + $limit: PositiveInt + $skip: NonNegativeInt + $orderBy: queryInput_votes_orderBy = timestamp + $orderDirection: queryInput_votes_orderDirection = desc ) { - votesOnchains( + votes( limit: $limit - after: $after - before: $before - where: { proposalId: $proposalId } + skip: $skip + id: $proposalId orderBy: $orderBy orderDirection: $orderDirection ) { - pageInfo { - startCursor - endCursor - hasNextPage - hasPreviousPage - } totalCount items { - voterAccountId - txHash - daoId + voterAddress + transactionHash proposalId support votingPower @@ -92,13 +83,6 @@ query GetVotesOnchains( } } -# Get proposal votes -query GetVotesOnchainsTotalCount($proposalId: String) { - votesOnchains(where: { proposalId: $proposalId }) { - totalCount - } -} - # Get voting power change query GetVotingPowerChange( $addresses: JSON! @@ -144,18 +128,23 @@ query GetProposalNonVoters( } # Get account power -query GetAccountPower($address: String!, $proposalId: String!) { +query GetAccountPower( + $address: String! + $addresses: JSON! + $proposalId: String! +) { votingPowerByAccountId(accountId: $address) { accountId votingPower } - votesOnchain(proposalId: $proposalId, voterAccountId: $address) { - support - votingPower - reason - timestamp - txHash - daoId + votes(id: $proposalId, voterAddressIn: $addresses) { + items { + support + votingPower + reason + timestamp + transactionHash + } + totalCount } } - diff --git a/packages/graphql-client/generated.ts b/packages/graphql-client/generated.ts index e629618a5..c91ce5e1c 100644 --- a/packages/graphql-client/generated.ts +++ b/packages/graphql-client/generated.ts @@ -78,15 +78,41 @@ export type PageInfo = { export type Query = { __typename?: 'Query'; _meta?: Maybe; - /** Returns account balance information for a specific address */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/accounts/{args.address}/balances` + * Returns account balance information for a specific address + * + */ accountBalanceByAccountId?: Maybe; - /** Returns a mapping of the biggest variations to account balances associated by account address */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/balances/variations` + * Returns a mapping of the biggest variations to account balances associated by account address + * + */ accountBalanceVariations?: Maybe; - /** Returns sorted and paginated account balance records */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/balances` + * Returns sorted and paginated account balance records + * + */ accountBalances?: Maybe; /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/balances/{args.address}/interactions` * Returns a mapping of the largest interactions between accounts. * Positive amounts signify net token transfers FROM
, whilst negative amounts refer to net transfers TO
+ * */ accountInteractions?: Maybe; /** @@ -95,74 +121,308 @@ export type Query = { * Only includes dates where ALL DAOs have data available. */ averageDelegationPercentageByDay: AverageDelegationPercentagePage; - /** Get active token supply for DAO */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/active-supply/compare` + * Get active token supply for DAO + * + */ compareActiveSupply?: Maybe; - /** Compare average turnout between time periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/average-turnout/compare` + * Compare average turnout between time periods + * + */ compareAverageTurnout?: Maybe; - /** Compare cex supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/cex-supply/compare` + * Compare cex supply between periods + * + */ compareCexSupply?: Maybe; - /** Compare circulating supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/circulating-supply/compare` + * Compare circulating supply between periods + * + */ compareCirculatingSupply?: Maybe; - /** Compare delegated supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/delegated-supply/compare` + * Compare delegated supply between periods + * + */ compareDelegatedSupply?: Maybe; - /** Compare dex supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/dex-supply/compare` + * Compare dex supply between periods + * + */ compareDexSupply?: Maybe; - /** Compare lending supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/lending-supply/compare` + * Compare lending supply between periods + * + */ compareLendingSupply?: Maybe; - /** Compare number of proposals between time periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals/compare` + * Compare number of proposals between time periods + * + */ compareProposals?: Maybe; - /** Compare total supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/total-supply/compare` + * Compare total supply between periods + * + */ compareTotalSupply?: Maybe; - /** Compare treasury between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/treasury/compare` + * Compare treasury between periods + * + */ compareTreasury?: Maybe; - /** Compare number of votes between time periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/votes/compare` + * Compare number of votes between time periods + * + */ compareVotes?: Maybe; - /** Returns current governance parameters for this DAO */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/dao` + * Returns current governance parameters for this DAO + * + */ dao?: Maybe; - daoMetricsDayBuckets: DaoMetricsDayBucketPage; /** Get all DAOs */ daos: DaoList; - /** Get delegation percentage day buckets with forward-fill */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/delegation-percentage` + * Get delegation percentage day buckets with forward-fill + * + */ delegationPercentageByDay?: Maybe; delegations: DelegationPage; - /** Get historical DAO Token Treasury value (governance token quantity × token price) */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/treasury/dao-token` + * Get historical DAO Token Treasury value (governance token quantity × token price) + * + */ getDaoTokenTreasury?: Maybe; - /** Get historical Liquid Treasury (treasury without DAO tokens) from external providers (DefiLlama/Dune) */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/treasury/liquid` + * Get historical Liquid Treasury (treasury without DAO tokens) from external providers (DefiLlama/Dune) + * + */ getLiquidTreasury?: Maybe; - /** Get historical Total Treasury (liquid treasury + DAO token treasury) */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/treasury/total` + * Get historical Total Treasury (liquid treasury + DAO token treasury) + * + */ getTotalTreasury?: Maybe; - /** Fetch historical token balances for multiple addresses at a specific time period using multicall */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/balances/historical` + * Fetch historical token balances for multiple addresses at a specific time period using multicall + * + */ historicalBalances?: Maybe>>; - /** Get historical market data for a specific token */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/token/historical-data` + * Get historical market data for a specific token + * + */ historicalTokenData?: Maybe>>; - /** Returns a list of voting power changes */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/voting-powers/{args.accountId}/historical` + * Returns a list of voting power changes + * + */ historicalVotingPowers?: Maybe; - /** Get the last update time */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/last-update` + * Get the last update time + * + */ lastUpdate?: Maybe; - /** Returns a single proposal by its ID */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals/{args.id}` + * Returns a single proposal by its ID + * + */ proposal?: Maybe; - /** Returns the active delegates that did not vote on a given proposal */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals/{args.id}/non-voters` + * Returns the active delegates that did not vote on a given proposal + * + */ proposalNonVoters?: Maybe; - /** Returns a list of proposal */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals` + * Returns a list of proposal + * + */ proposals?: Maybe; - /** Returns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals-activity` + * Returns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window + * + */ proposalsActivity?: Maybe; - /** Get property data for a specific token */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/token` + * Get property data for a specific token + * + */ token?: Maybe; - /** Get transactions with their associated transfers and delegations, with optional filtering and sorting */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/token-metrics` + * Returns token related metrics for a single metric type. + * Available types: TOTAL_SUPPLY, DELEGATED_SUPPLY, CEX_SUPPLY, DEX_SUPPLY, LENDING_SUPPLY, CIRCULATING_SUPPLY, TREASURY + * + */ + tokenMetrics?: Maybe; + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/transactions` + * Get transactions with their associated transfers and delegations, with optional filtering and sorting + * + */ transactions?: Maybe; - /** Get transfers of a given address */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/accounts/{args.address}/transfers` + * Get transfers of a given address + * + */ transfers?: Maybe; - votesOnchain?: Maybe; + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals/{args.id}/votes` + * Returns a paginated list of votes cast on a specific proposal + * + */ + votes?: Maybe; votesOnchains: VotesOnchainPage; - /** Returns voting power information for a specific address (account) */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/voting-powers/{args.accountId}` + * Returns voting power information for a specific address (account) + * + */ votingPowerByAccountId?: Maybe; votingPowerHistorys: VotingPowerHistoryPage; - /** Returns a mapping of the voting power changes within a time frame for the given addresses */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/accounts/voting-powers/variations` + * Returns a mapping of the voting power changes within a time frame for the given addresses + * + */ votingPowerVariations?: Maybe; - /** Returns a the changes to voting power by period and accountId */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/accounts/{args.address}/voting-powers/variations` + * Returns a the changes to voting power by period and accountId + * + */ votingPowerVariationsByAccountId?: Maybe; - /** Returns sorted and paginated account voting power records */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/voting-powers` + * Returns sorted and paginated account voting power records + * + */ votingPowers?: Maybe; }; @@ -269,16 +529,6 @@ export type QueryCompareVotesArgs = { }; -export type QueryDaoMetricsDayBucketsArgs = { - after?: InputMaybe; - before?: InputMaybe; - limit?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - where?: InputMaybe; -}; - - export type QueryDelegationPercentageByDayArgs = { after?: InputMaybe; before?: InputMaybe; @@ -388,6 +638,16 @@ export type QueryTokenArgs = { }; +export type QueryTokenMetricsArgs = { + endDate?: InputMaybe; + limit?: InputMaybe; + metricType: QueryInput_TokenMetrics_MetricType; + orderDirection?: InputMaybe; + skip?: InputMaybe; + startDate?: InputMaybe; +}; + + export type QueryTransactionsArgs = { affectedSupply?: InputMaybe; from?: InputMaybe; @@ -419,9 +679,14 @@ export type QueryTransfersArgs = { }; -export type QueryVotesOnchainArgs = { - proposalId: Scalars['String']['input']; - voterAccountId: Scalars['String']['input']; +export type QueryVotesArgs = { + id: Scalars['String']['input']; + limit?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + support?: InputMaybe; + voterAddressIn?: InputMaybe; }; @@ -1601,6 +1866,21 @@ export enum QueryInput_Proposals_OrderDirection { Desc = 'desc' } +export enum QueryInput_TokenMetrics_MetricType { + CexSupply = 'CEX_SUPPLY', + CirculatingSupply = 'CIRCULATING_SUPPLY', + DelegatedSupply = 'DELEGATED_SUPPLY', + DexSupply = 'DEX_SUPPLY', + LendingSupply = 'LENDING_SUPPLY', + TotalSupply = 'TOTAL_SUPPLY', + Treasury = 'TREASURY' +} + +export enum QueryInput_TokenMetrics_OrderDirection { + Asc = 'asc', + Desc = 'desc' +} + export enum QueryInput_Token_Currency { Eth = 'eth', Usd = 'usd' @@ -1621,6 +1901,16 @@ export enum QueryInput_Transfers_SortOrder { Desc = 'desc' } +export enum QueryInput_Votes_OrderBy { + Timestamp = 'timestamp', + VotingPower = 'votingPower' +} + +export enum QueryInput_Votes_OrderDirection { + Asc = 'asc', + Desc = 'desc' +} + export enum QueryInput_VotingPowerVariations_OrderDirection { Asc = 'asc', Desc = 'desc' @@ -1816,6 +2106,20 @@ export type Query_Proposals_Items_Items = { values: Array>; }; +export type Query_TokenMetrics_Items_Items = { + __typename?: 'query_tokenMetrics_items_items'; + date: Scalars['String']['output']; + high: Scalars['String']['output']; + volume: Scalars['String']['output']; +}; + +export type Query_TokenMetrics_PageInfo = { + __typename?: 'query_tokenMetrics_pageInfo'; + endDate?: Maybe; + hasNextPage: Scalars['Boolean']['output']; + startDate?: Maybe; +}; + export type Query_Transactions_Items_Items = { __typename?: 'query_transactions_items_items'; delegations: Array>; @@ -1878,6 +2182,17 @@ export type Query_Transfers_Items_Items = { transactionHash: Scalars['String']['output']; }; +export type Query_Votes_Items_Items = { + __typename?: 'query_votes_items_items'; + proposalId: Scalars['String']['output']; + reason?: Maybe; + support: Scalars['Float']['output']; + timestamp: Scalars['Float']['output']; + transactionHash: Scalars['String']['output']; + voterAddress: Scalars['String']['output']; + votingPower: Scalars['String']['output']; +}; + export type Query_VotingPowerVariationsByAccountId_Data = { __typename?: 'query_votingPowerVariationsByAccountId_data'; absoluteChange: Scalars['String']['output']; @@ -2024,6 +2339,12 @@ export type TokenFilter = { treasury_not_in?: InputMaybe>>; }; +export type TokenMetrics_200_Response = { + __typename?: 'tokenMetrics_200_response'; + items: Array>; + pageInfo: Query_TokenMetrics_PageInfo; +}; + export type TokenPage = { __typename?: 'tokenPage'; items: Array; @@ -2416,6 +2737,12 @@ export type VotesOnchainPage = { totalCount: Scalars['Int']['output']; }; +export type Votes_200_Response = { + __typename?: 'votes_200_response'; + items: Array>; + totalCount: Scalars['Float']['output']; +}; + export type VotingPowerByAccountId_200_Response = { __typename?: 'votingPowerByAccountId_200_response'; accountId: Scalars['String']['output']; @@ -2694,24 +3021,16 @@ export type GetProposalQueryVariables = Exact<{ export type GetProposalQuery = { __typename?: 'Query', proposal?: { __typename?: 'proposal_200_response', id: string, daoId: string, txHash: string, proposerAccountId: string, title: string, description: string, quorum: string, timestamp: string, status: string, forVotes: string, againstVotes: string, abstainVotes: string, startTimestamp: string, endTimestamp: string, calldatas: Array, targets: Array, values: Array } | null }; -export type GetVotesOnchainsQueryVariables = Exact<{ - proposalId?: InputMaybe; - limit?: InputMaybe; - after?: InputMaybe; - before?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; -}>; - - -export type GetVotesOnchainsQuery = { __typename?: 'Query', votesOnchains: { __typename?: 'votesOnchainPage', totalCount: number, pageInfo: { __typename?: 'PageInfo', startCursor?: string | null, endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean }, items: Array<{ __typename?: 'votesOnchain', voterAccountId: string, txHash: string, daoId: string, proposalId: string, support: string, votingPower: any, reason?: string | null, timestamp: any }> } }; - -export type GetVotesOnchainsTotalCountQueryVariables = Exact<{ - proposalId?: InputMaybe; +export type GetVotesQueryVariables = Exact<{ + proposalId: Scalars['String']['input']; + limit?: InputMaybe; + skip?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; }>; -export type GetVotesOnchainsTotalCountQuery = { __typename?: 'Query', votesOnchains: { __typename?: 'votesOnchainPage', totalCount: number } }; +export type GetVotesQuery = { __typename?: 'Query', votes?: { __typename?: 'votes_200_response', totalCount: number, items: Array<{ __typename?: 'query_votes_items_items', voterAddress: string, transactionHash: string, proposalId: string, support: number, votingPower: string, reason?: string | null, timestamp: number } | null> } | null }; export type GetVotingPowerChangeQueryVariables = Exact<{ addresses: Scalars['JSON']['input']; @@ -2734,11 +3053,12 @@ export type GetProposalNonVotersQuery = { __typename?: 'Query', proposalNonVoter export type GetAccountPowerQueryVariables = Exact<{ address: Scalars['String']['input']; + addresses: Scalars['JSON']['input']; proposalId: Scalars['String']['input']; }>; -export type GetAccountPowerQuery = { __typename?: 'Query', votingPowerByAccountId?: { __typename?: 'votingPowerByAccountId_200_response', accountId: string, votingPower: string } | null, votesOnchain?: { __typename?: 'votesOnchain', support: string, votingPower: any, reason?: string | null, timestamp: any, txHash: string, daoId: string } | null }; +export type GetAccountPowerQuery = { __typename?: 'Query', votingPowerByAccountId?: { __typename?: 'votingPowerByAccountId_200_response', accountId: string, votingPower: string } | null, votes?: { __typename?: 'votes_200_response', totalCount: number, items: Array<{ __typename?: 'query_votes_items_items', support: number, votingPower: string, reason?: string | null, timestamp: number, transactionHash: string } | null> } | null }; export type GetHistoricalBalancesQueryVariables = Exact<{ addresses: Scalars['JSON']['input']; @@ -3748,27 +4068,19 @@ export type GetProposalQueryHookResult = ReturnType; export type GetProposalLazyQueryHookResult = ReturnType; export type GetProposalSuspenseQueryHookResult = ReturnType; export type GetProposalQueryResult = Apollo.QueryResult; -export const GetVotesOnchainsDocument = gql` - query GetVotesOnchains($proposalId: String, $limit: Int, $after: String, $before: String, $orderBy: String = "timestamp", $orderDirection: String = "desc") { - votesOnchains( +export const GetVotesDocument = gql` + query GetVotes($proposalId: String!, $limit: PositiveInt, $skip: NonNegativeInt, $orderBy: queryInput_votes_orderBy = timestamp, $orderDirection: queryInput_votes_orderDirection = desc) { + votes( limit: $limit - after: $after - before: $before - where: {proposalId: $proposalId} + skip: $skip + id: $proposalId orderBy: $orderBy orderDirection: $orderDirection ) { - pageInfo { - startCursor - endCursor - hasNextPage - hasPreviousPage - } totalCount items { - voterAccountId - txHash - daoId + voterAddress + transactionHash proposalId support votingPower @@ -3780,82 +4092,41 @@ export const GetVotesOnchainsDocument = gql` `; /** - * __useGetVotesOnchainsQuery__ + * __useGetVotesQuery__ * - * To run a query within a React component, call `useGetVotesOnchainsQuery` and pass it any options that fit your needs. - * When your component renders, `useGetVotesOnchainsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * To run a query within a React component, call `useGetVotesQuery` and pass it any options that fit your needs. + * When your component renders, `useGetVotesQuery` returns an object from Apollo Client that contains loading, error, and data properties * you can use to render your UI. * * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; * * @example - * const { data, loading, error } = useGetVotesOnchainsQuery({ + * const { data, loading, error } = useGetVotesQuery({ * variables: { * proposalId: // value for 'proposalId' * limit: // value for 'limit' - * after: // value for 'after' - * before: // value for 'before' + * skip: // value for 'skip' * orderBy: // value for 'orderBy' * orderDirection: // value for 'orderDirection' * }, * }); */ -export function useGetVotesOnchainsQuery(baseOptions?: Apollo.QueryHookOptions) { +export function useGetVotesQuery(baseOptions: Apollo.QueryHookOptions & ({ variables: GetVotesQueryVariables; skip?: boolean; } | { skip: boolean; }) ) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(GetVotesOnchainsDocument, options); + return Apollo.useQuery(GetVotesDocument, options); } -export function useGetVotesOnchainsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { +export function useGetVotesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(GetVotesOnchainsDocument, options); + return Apollo.useLazyQuery(GetVotesDocument, options); } -export function useGetVotesOnchainsSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { +export function useGetVotesSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(GetVotesOnchainsDocument, options); + return Apollo.useSuspenseQuery(GetVotesDocument, options); } -export type GetVotesOnchainsQueryHookResult = ReturnType; -export type GetVotesOnchainsLazyQueryHookResult = ReturnType; -export type GetVotesOnchainsSuspenseQueryHookResult = ReturnType; -export type GetVotesOnchainsQueryResult = Apollo.QueryResult; -export const GetVotesOnchainsTotalCountDocument = gql` - query GetVotesOnchainsTotalCount($proposalId: String) { - votesOnchains(where: {proposalId: $proposalId}) { - totalCount - } -} - `; - -/** - * __useGetVotesOnchainsTotalCountQuery__ - * - * To run a query within a React component, call `useGetVotesOnchainsTotalCountQuery` and pass it any options that fit your needs. - * When your component renders, `useGetVotesOnchainsTotalCountQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetVotesOnchainsTotalCountQuery({ - * variables: { - * proposalId: // value for 'proposalId' - * }, - * }); - */ -export function useGetVotesOnchainsTotalCountQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(GetVotesOnchainsTotalCountDocument, options); - } -export function useGetVotesOnchainsTotalCountLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(GetVotesOnchainsTotalCountDocument, options); - } -export function useGetVotesOnchainsTotalCountSuspenseQuery(baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions) { - const options = baseOptions === Apollo.skipToken ? baseOptions : {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(GetVotesOnchainsTotalCountDocument, options); - } -export type GetVotesOnchainsTotalCountQueryHookResult = ReturnType; -export type GetVotesOnchainsTotalCountLazyQueryHookResult = ReturnType; -export type GetVotesOnchainsTotalCountSuspenseQueryHookResult = ReturnType; -export type GetVotesOnchainsTotalCountQueryResult = Apollo.QueryResult; +export type GetVotesQueryHookResult = ReturnType; +export type GetVotesLazyQueryHookResult = ReturnType; +export type GetVotesSuspenseQueryHookResult = ReturnType; +export type GetVotesQueryResult = Apollo.QueryResult; export const GetVotingPowerChangeDocument = gql` query GetVotingPowerChange($addresses: JSON!, $fromDate: String!, $toDate: String!) { votingPowerVariations( @@ -3963,18 +4234,20 @@ export type GetProposalNonVotersLazyQueryHookResult = ReturnType; export type GetProposalNonVotersQueryResult = Apollo.QueryResult; export const GetAccountPowerDocument = gql` - query GetAccountPower($address: String!, $proposalId: String!) { + query GetAccountPower($address: String!, $addresses: JSON!, $proposalId: String!) { votingPowerByAccountId(accountId: $address) { accountId votingPower } - votesOnchain(proposalId: $proposalId, voterAccountId: $address) { - support - votingPower - reason - timestamp - txHash - daoId + votes(id: $proposalId, voterAddressIn: $addresses) { + items { + support + votingPower + reason + timestamp + transactionHash + } + totalCount } } `; @@ -3992,6 +4265,7 @@ export const GetAccountPowerDocument = gql` * const { data, loading, error } = useGetAccountPowerQuery({ * variables: { * address: // value for 'address' + * addresses: // value for 'addresses' * proposalId: // value for 'proposalId' * }, * }); diff --git a/packages/graphql-client/types.ts b/packages/graphql-client/types.ts index 15f44555c..f0b3f7b0a 100644 --- a/packages/graphql-client/types.ts +++ b/packages/graphql-client/types.ts @@ -75,15 +75,41 @@ export type PageInfo = { export type Query = { __typename?: 'Query'; _meta?: Maybe; - /** Returns account balance information for a specific address */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/accounts/{args.address}/balances` + * Returns account balance information for a specific address + * + */ accountBalanceByAccountId?: Maybe; - /** Returns a mapping of the biggest variations to account balances associated by account address */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/balances/variations` + * Returns a mapping of the biggest variations to account balances associated by account address + * + */ accountBalanceVariations?: Maybe; - /** Returns sorted and paginated account balance records */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/balances` + * Returns sorted and paginated account balance records + * + */ accountBalances?: Maybe; /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/balances/{args.address}/interactions` * Returns a mapping of the largest interactions between accounts. * Positive amounts signify net token transfers FROM
, whilst negative amounts refer to net transfers TO
+ * */ accountInteractions?: Maybe; /** @@ -92,74 +118,308 @@ export type Query = { * Only includes dates where ALL DAOs have data available. */ averageDelegationPercentageByDay: AverageDelegationPercentagePage; - /** Get active token supply for DAO */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/active-supply/compare` + * Get active token supply for DAO + * + */ compareActiveSupply?: Maybe; - /** Compare average turnout between time periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/average-turnout/compare` + * Compare average turnout between time periods + * + */ compareAverageTurnout?: Maybe; - /** Compare cex supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/cex-supply/compare` + * Compare cex supply between periods + * + */ compareCexSupply?: Maybe; - /** Compare circulating supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/circulating-supply/compare` + * Compare circulating supply between periods + * + */ compareCirculatingSupply?: Maybe; - /** Compare delegated supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/delegated-supply/compare` + * Compare delegated supply between periods + * + */ compareDelegatedSupply?: Maybe; - /** Compare dex supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/dex-supply/compare` + * Compare dex supply between periods + * + */ compareDexSupply?: Maybe; - /** Compare lending supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/lending-supply/compare` + * Compare lending supply between periods + * + */ compareLendingSupply?: Maybe; - /** Compare number of proposals between time periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals/compare` + * Compare number of proposals between time periods + * + */ compareProposals?: Maybe; - /** Compare total supply between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/total-supply/compare` + * Compare total supply between periods + * + */ compareTotalSupply?: Maybe; - /** Compare treasury between periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/treasury/compare` + * Compare treasury between periods + * + */ compareTreasury?: Maybe; - /** Compare number of votes between time periods */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/votes/compare` + * Compare number of votes between time periods + * + */ compareVotes?: Maybe; - /** Returns current governance parameters for this DAO */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/dao` + * Returns current governance parameters for this DAO + * + */ dao?: Maybe; - daoMetricsDayBuckets: DaoMetricsDayBucketPage; /** Get all DAOs */ daos: DaoList; - /** Get delegation percentage day buckets with forward-fill */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/delegation-percentage` + * Get delegation percentage day buckets with forward-fill + * + */ delegationPercentageByDay?: Maybe; delegations: DelegationPage; - /** Get historical DAO Token Treasury value (governance token quantity × token price) */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/treasury/dao-token` + * Get historical DAO Token Treasury value (governance token quantity × token price) + * + */ getDaoTokenTreasury?: Maybe; - /** Get historical Liquid Treasury (treasury without DAO tokens) from external providers (DefiLlama/Dune) */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/treasury/liquid` + * Get historical Liquid Treasury (treasury without DAO tokens) from external providers (DefiLlama/Dune) + * + */ getLiquidTreasury?: Maybe; - /** Get historical Total Treasury (liquid treasury + DAO token treasury) */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/treasury/total` + * Get historical Total Treasury (liquid treasury + DAO token treasury) + * + */ getTotalTreasury?: Maybe; - /** Fetch historical token balances for multiple addresses at a specific time period using multicall */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/balances/historical` + * Fetch historical token balances for multiple addresses at a specific time period using multicall + * + */ historicalBalances?: Maybe>>; - /** Get historical market data for a specific token */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/token/historical-data` + * Get historical market data for a specific token + * + */ historicalTokenData?: Maybe>>; - /** Returns a list of voting power changes */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/voting-powers/{args.accountId}/historical` + * Returns a list of voting power changes + * + */ historicalVotingPowers?: Maybe; - /** Get the last update time */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/last-update` + * Get the last update time + * + */ lastUpdate?: Maybe; - /** Returns a single proposal by its ID */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals/{args.id}` + * Returns a single proposal by its ID + * + */ proposal?: Maybe; - /** Returns the active delegates that did not vote on a given proposal */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals/{args.id}/non-voters` + * Returns the active delegates that did not vote on a given proposal + * + */ proposalNonVoters?: Maybe; - /** Returns a list of proposal */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals` + * Returns a list of proposal + * + */ proposals?: Maybe; - /** Returns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals-activity` + * Returns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window + * + */ proposalsActivity?: Maybe; - /** Get property data for a specific token */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/token` + * Get property data for a specific token + * + */ token?: Maybe; - /** Get transactions with their associated transfers and delegations, with optional filtering and sorting */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/token-metrics` + * Returns token related metrics for a single metric type. + * Available types: TOTAL_SUPPLY, DELEGATED_SUPPLY, CEX_SUPPLY, DEX_SUPPLY, LENDING_SUPPLY, CIRCULATING_SUPPLY, TREASURY + * + */ + tokenMetrics?: Maybe; + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/transactions` + * Get transactions with their associated transfers and delegations, with optional filtering and sorting + * + */ transactions?: Maybe; - /** Get transfers of a given address */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/accounts/{args.address}/transfers` + * Get transfers of a given address + * + */ transfers?: Maybe; - votesOnchain?: Maybe; + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/proposals/{args.id}/votes` + * Returns a paginated list of votes cast on a specific proposal + * + */ + votes?: Maybe; votesOnchains: VotesOnchainPage; - /** Returns voting power information for a specific address (account) */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/voting-powers/{args.accountId}` + * Returns voting power information for a specific address (account) + * + */ votingPowerByAccountId?: Maybe; votingPowerHistorys: VotingPowerHistoryPage; - /** Returns a mapping of the voting power changes within a time frame for the given addresses */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/accounts/voting-powers/variations` + * Returns a mapping of the voting power changes within a time frame for the given addresses + * + */ votingPowerVariations?: Maybe; - /** Returns a the changes to voting power by period and accountId */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/accounts/{args.address}/voting-powers/variations` + * Returns a the changes to voting power by period and accountId + * + */ votingPowerVariationsByAccountId?: Maybe; - /** Returns sorted and paginated account voting power records */ + /** + * + * >**Method**: `GET` + * >**Base URL**: `http://localhost:42069` + * >**Path**: `/voting-powers` + * Returns sorted and paginated account voting power records + * + */ votingPowers?: Maybe; }; @@ -266,16 +526,6 @@ export type QueryCompareVotesArgs = { }; -export type QueryDaoMetricsDayBucketsArgs = { - after?: InputMaybe; - before?: InputMaybe; - limit?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - where?: InputMaybe; -}; - - export type QueryDelegationPercentageByDayArgs = { after?: InputMaybe; before?: InputMaybe; @@ -385,6 +635,16 @@ export type QueryTokenArgs = { }; +export type QueryTokenMetricsArgs = { + endDate?: InputMaybe; + limit?: InputMaybe; + metricType: QueryInput_TokenMetrics_MetricType; + orderDirection?: InputMaybe; + skip?: InputMaybe; + startDate?: InputMaybe; +}; + + export type QueryTransactionsArgs = { affectedSupply?: InputMaybe; from?: InputMaybe; @@ -416,9 +676,14 @@ export type QueryTransfersArgs = { }; -export type QueryVotesOnchainArgs = { - proposalId: Scalars['String']['input']; - voterAccountId: Scalars['String']['input']; +export type QueryVotesArgs = { + id: Scalars['String']['input']; + limit?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; + skip?: InputMaybe; + support?: InputMaybe; + voterAddressIn?: InputMaybe; }; @@ -1598,6 +1863,21 @@ export enum QueryInput_Proposals_OrderDirection { Desc = 'desc' } +export enum QueryInput_TokenMetrics_MetricType { + CexSupply = 'CEX_SUPPLY', + CirculatingSupply = 'CIRCULATING_SUPPLY', + DelegatedSupply = 'DELEGATED_SUPPLY', + DexSupply = 'DEX_SUPPLY', + LendingSupply = 'LENDING_SUPPLY', + TotalSupply = 'TOTAL_SUPPLY', + Treasury = 'TREASURY' +} + +export enum QueryInput_TokenMetrics_OrderDirection { + Asc = 'asc', + Desc = 'desc' +} + export enum QueryInput_Token_Currency { Eth = 'eth', Usd = 'usd' @@ -1618,6 +1898,16 @@ export enum QueryInput_Transfers_SortOrder { Desc = 'desc' } +export enum QueryInput_Votes_OrderBy { + Timestamp = 'timestamp', + VotingPower = 'votingPower' +} + +export enum QueryInput_Votes_OrderDirection { + Asc = 'asc', + Desc = 'desc' +} + export enum QueryInput_VotingPowerVariations_OrderDirection { Asc = 'asc', Desc = 'desc' @@ -1813,6 +2103,20 @@ export type Query_Proposals_Items_Items = { values: Array>; }; +export type Query_TokenMetrics_Items_Items = { + __typename?: 'query_tokenMetrics_items_items'; + date: Scalars['String']['output']; + high: Scalars['String']['output']; + volume: Scalars['String']['output']; +}; + +export type Query_TokenMetrics_PageInfo = { + __typename?: 'query_tokenMetrics_pageInfo'; + endDate?: Maybe; + hasNextPage: Scalars['Boolean']['output']; + startDate?: Maybe; +}; + export type Query_Transactions_Items_Items = { __typename?: 'query_transactions_items_items'; delegations: Array>; @@ -1875,6 +2179,17 @@ export type Query_Transfers_Items_Items = { transactionHash: Scalars['String']['output']; }; +export type Query_Votes_Items_Items = { + __typename?: 'query_votes_items_items'; + proposalId: Scalars['String']['output']; + reason?: Maybe; + support: Scalars['Float']['output']; + timestamp: Scalars['Float']['output']; + transactionHash: Scalars['String']['output']; + voterAddress: Scalars['String']['output']; + votingPower: Scalars['String']['output']; +}; + export type Query_VotingPowerVariationsByAccountId_Data = { __typename?: 'query_votingPowerVariationsByAccountId_data'; absoluteChange: Scalars['String']['output']; @@ -2021,6 +2336,12 @@ export type TokenFilter = { treasury_not_in?: InputMaybe>>; }; +export type TokenMetrics_200_Response = { + __typename?: 'tokenMetrics_200_response'; + items: Array>; + pageInfo: Query_TokenMetrics_PageInfo; +}; + export type TokenPage = { __typename?: 'tokenPage'; items: Array; @@ -2413,6 +2734,12 @@ export type VotesOnchainPage = { totalCount: Scalars['Int']['output']; }; +export type Votes_200_Response = { + __typename?: 'votes_200_response'; + items: Array>; + totalCount: Scalars['Float']['output']; +}; + export type VotingPowerByAccountId_200_Response = { __typename?: 'votingPowerByAccountId_200_response'; accountId: Scalars['String']['output']; @@ -2691,24 +3018,16 @@ export type GetProposalQueryVariables = Exact<{ export type GetProposalQuery = { __typename?: 'Query', proposal?: { __typename?: 'proposal_200_response', id: string, daoId: string, txHash: string, proposerAccountId: string, title: string, description: string, quorum: string, timestamp: string, status: string, forVotes: string, againstVotes: string, abstainVotes: string, startTimestamp: string, endTimestamp: string, calldatas: Array, targets: Array, values: Array } | null }; -export type GetVotesOnchainsQueryVariables = Exact<{ - proposalId?: InputMaybe; - limit?: InputMaybe; - after?: InputMaybe; - before?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; -}>; - - -export type GetVotesOnchainsQuery = { __typename?: 'Query', votesOnchains: { __typename?: 'votesOnchainPage', totalCount: number, pageInfo: { __typename?: 'PageInfo', startCursor?: string | null, endCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean }, items: Array<{ __typename?: 'votesOnchain', voterAccountId: string, txHash: string, daoId: string, proposalId: string, support: string, votingPower: any, reason?: string | null, timestamp: any }> } }; - -export type GetVotesOnchainsTotalCountQueryVariables = Exact<{ - proposalId?: InputMaybe; +export type GetVotesQueryVariables = Exact<{ + proposalId: Scalars['String']['input']; + limit?: InputMaybe; + skip?: InputMaybe; + orderBy?: InputMaybe; + orderDirection?: InputMaybe; }>; -export type GetVotesOnchainsTotalCountQuery = { __typename?: 'Query', votesOnchains: { __typename?: 'votesOnchainPage', totalCount: number } }; +export type GetVotesQuery = { __typename?: 'Query', votes?: { __typename?: 'votes_200_response', totalCount: number, items: Array<{ __typename?: 'query_votes_items_items', voterAddress: string, transactionHash: string, proposalId: string, support: number, votingPower: string, reason?: string | null, timestamp: number } | null> } | null }; export type GetVotingPowerChangeQueryVariables = Exact<{ addresses: Scalars['JSON']['input']; @@ -2731,11 +3050,12 @@ export type GetProposalNonVotersQuery = { __typename?: 'Query', proposalNonVoter export type GetAccountPowerQueryVariables = Exact<{ address: Scalars['String']['input']; + addresses: Scalars['JSON']['input']; proposalId: Scalars['String']['input']; }>; -export type GetAccountPowerQuery = { __typename?: 'Query', votingPowerByAccountId?: { __typename?: 'votingPowerByAccountId_200_response', accountId: string, votingPower: string } | null, votesOnchain?: { __typename?: 'votesOnchain', support: string, votingPower: any, reason?: string | null, timestamp: any, txHash: string, daoId: string } | null }; +export type GetAccountPowerQuery = { __typename?: 'Query', votingPowerByAccountId?: { __typename?: 'votingPowerByAccountId_200_response', accountId: string, votingPower: string } | null, votes?: { __typename?: 'votes_200_response', totalCount: number, items: Array<{ __typename?: 'query_votes_items_items', support: number, votingPower: string, reason?: string | null, timestamp: number, transactionHash: string } | null> } | null }; export type GetHistoricalBalancesQueryVariables = Exact<{ addresses: Scalars['JSON']['input'];