From a40019873c292d3369c7b660edef7711acab9a7a Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Tue, 3 Feb 2026 21:54:37 +0100 Subject: [PATCH 1/4] refactor: improve governance participation logic Fix participation logic so it works when orchestrators are activated and deactivated. Also improve caching behavoir. --- apollo/subgraph.ts | 356 +++++++++++++++----- components/OrchestratingView/index.tsx | 60 +--- hooks/useGovernanceParticipation.tsx | 122 +++++++ queries/transcoderActivatedEvents.graphql | 16 - queries/transcoderActivationHistory.graphql | 16 + 5 files changed, 414 insertions(+), 156 deletions(-) create mode 100644 hooks/useGovernanceParticipation.tsx delete mode 100644 queries/transcoderActivatedEvents.graphql create mode 100644 queries/transcoderActivationHistory.graphql diff --git a/apollo/subgraph.ts b/apollo/subgraph.ts index 2a53b8fc..1d1be403 100644 --- a/apollo/subgraph.ts +++ b/apollo/subgraph.ts @@ -41,7 +41,10 @@ export type Block_Height = { number_gte?: InputMaybe; }; -/** BondEvent entities are created for every emitted Bond event. */ +/** + * BondEvent entities are created for every emitted Bond event. + * + */ export type BondEvent = Event & { __typename: 'BondEvent'; /** Additional amount added to bonded amount */ @@ -289,7 +292,10 @@ export enum BondEvent_OrderBy { TransactionTo = 'transaction__to' } -/** Broadcasters pay transcoders to do the work of transcoding in exchange for fees */ +/** + * Broadcasters pay transcoders to do the work of transcoding in exchange for fees + * + */ export type Broadcaster = { __typename: 'Broadcaster'; /** Days in which this broadcaster paid out fees */ @@ -317,7 +323,10 @@ export type Broadcaster = { }; -/** Broadcasters pay transcoders to do the work of transcoding in exchange for fees */ +/** + * Broadcasters pay transcoders to do the work of transcoding in exchange for fees + * + */ export type BroadcasterBroadcasterDaysArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -326,7 +335,10 @@ export type BroadcasterBroadcasterDaysArgs = { where?: InputMaybe; }; -/** Broadcaster data accumulated and condensed into day stats */ +/** + * Broadcaster data accumulated and condensed into day stats + * + */ export type BroadcasterDay = { __typename: 'BroadcasterDay'; /** Broadcaster associated with the day */ @@ -527,7 +539,10 @@ export enum Broadcaster_OrderBy { TotalVolumeUsd = 'totalVolumeUSD' } -/** BurnEvent entities are created for every emitted Burn event. */ +/** + * BurnEvent entities are created for every emitted Burn event. + * + */ export type BurnEvent = Event & { __typename: 'BurnEvent'; /** Ethereum transaction hash + event log index */ @@ -648,7 +663,10 @@ export enum BurnEvent_OrderBy { Value = 'value' } -/** Protocol data accumulated and condensed into day stats */ +/** + * Protocol data accumulated and condensed into day stats + * + */ export type Day = { __typename: 'Day'; /** Total active transcoders (up to the limit) */ @@ -784,7 +802,10 @@ export enum Day_OrderBy { VolumeUsd = 'volumeUSD' } -/** Bonded accounts who have delegated their stake towards a transcoder candidate */ +/** + * Bonded accounts who have delegated their stake towards a transcoder candidate + * + */ export type Delegator = { __typename: 'Delegator'; /** Amount of Livepeer Token a delegator currently has bonded */ @@ -812,7 +833,10 @@ export type Delegator = { }; -/** Bonded accounts who have delegated their stake towards a transcoder candidate */ +/** + * Bonded accounts who have delegated their stake towards a transcoder candidate + * + */ export type DelegatorUnbondingLocksArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -985,7 +1009,10 @@ export enum Delegator_OrderBy { WithdrawnFees = 'withdrawnFees' } -/** DepositFundedEvent entities are created for every emitted DepositFunded event. */ +/** + * DepositFundedEvent entities are created for every emitted DepositFunded event. + * + */ export type DepositFundedEvent = Event & { __typename: 'DepositFundedEvent'; /** Amount of broadcasting fees deposited */ @@ -1140,7 +1167,10 @@ export enum DepositFundedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** EarningsClaimedEvent entities are created for every emitted EarningsClaimed event. */ +/** + * EarningsClaimedEvent entities are created for every emitted EarningsClaimed event. + * + */ export type EarningsClaimedEvent = Event & { __typename: 'EarningsClaimedEvent'; /** Reference to the delegator's delegate */ @@ -1503,7 +1533,10 @@ export enum Event_OrderBy { TransactionTo = 'transaction__to' } -/** Abstraction for accounts/delegators bonded with the protocol */ +/** + * Abstraction for accounts/delegators bonded with the protocol + * + */ export type LivepeerAccount = { __typename: 'LivepeerAccount'; /** Reference to the Delegate this address is bonded to */ @@ -1614,7 +1647,10 @@ export enum LivepeerAccount_OrderBy { LastUpdatedTimestamp = 'lastUpdatedTimestamp' } -/** MigrateDelegatorFinalizedEvent entities are created for every emitted WithdrawStake event. */ +/** + * MigrateDelegatorFinalizedEvent entities are created for every emitted WithdrawStake event. + * + */ export type MigrateDelegatorFinalizedEvent = Event & { __typename: 'MigrateDelegatorFinalizedEvent'; delegate: Scalars['String']; @@ -1820,7 +1856,10 @@ export enum MigrateDelegatorFinalizedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** MintEvent entities are created for every emitted Mint event. */ +/** + * MintEvent entities are created for every emitted Mint event. + * + */ export type MintEvent = Event & { __typename: 'MintEvent'; /** Amount of tokens minted */ @@ -1964,7 +2003,10 @@ export enum MintEvent_OrderBy { TransactionTo = 'transaction__to' } -/** NewRoundEvent entities are created for every emitted NewRound event. */ +/** + * NewRoundEvent entities are created for every emitted NewRound event. + * + */ export type NewRoundEvent = Event & { __typename: 'NewRoundEvent'; /** Block hash for the round */ @@ -2103,7 +2145,10 @@ export enum OrderDirection { Desc = 'desc' } -/** ParameterUpdateEvent entities are created for every emitted ParameterUpdate event. */ +/** + * ParameterUpdateEvent entities are created for every emitted ParameterUpdate event. + * + */ export type ParameterUpdateEvent = Event & { __typename: 'ParameterUpdateEvent'; /** Ethereum transaction hash + event log index */ @@ -2236,7 +2281,10 @@ export enum ParameterUpdateEvent_OrderBy { TransactionTo = 'transaction__to' } -/** PauseEvent entities are created for every emitted Pause event. */ +/** + * PauseEvent entities are created for every emitted Pause event. + * + */ export type PauseEvent = Event & { __typename: 'PauseEvent'; /** Ethereum transaction hash + event log index */ @@ -2346,7 +2394,10 @@ export enum PauseEvent_OrderBy { TransactionTo = 'transaction__to' } -/** Stake weighted poll */ +/** + * Stake weighted poll + * + */ export type Poll = { __typename: 'Poll'; /** Block at which the poll ends and votes can no longer be submitted */ @@ -2366,7 +2417,10 @@ export type Poll = { }; -/** Stake weighted poll */ +/** + * Stake weighted poll + * + */ export type PollVotesArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -2380,7 +2434,10 @@ export enum PollChoice { Yes = 'Yes' } -/** PollCreatedEvent entities are created for every emitted PollCreated event. */ +/** + * PollCreatedEvent entities are created for every emitted PollCreated event. + * + */ export type PollCreatedEvent = Event & { __typename: 'PollCreatedEvent'; /** Ethereum block in which this poll ends */ @@ -2565,7 +2622,10 @@ export enum PollCreatedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** Stake weighted tally associated with a poll */ +/** + * Stake weighted tally associated with a poll + * + */ export type PollTally = { __typename: 'PollTally'; /** Poll address */ @@ -2713,7 +2773,10 @@ export enum Poll_OrderBy { Votes = 'votes' } -/** Represents a transcoder's rewards and fees to be distributed to delegators */ +/** + * Represents a transcoder's rewards and fees to be distributed to delegators + * + */ export type Pool = { __typename: 'Pool'; /** Transcoder associated with the pool */ @@ -2878,7 +2941,10 @@ export enum Pool_OrderBy { TotalStake = 'totalStake' } -/** Livepeer protocol global parameters */ +/** + * Livepeer protocol global parameters + * + */ export type Protocol = { __typename: 'Protocol'; /** Broadcasters active within the current 90 day fee window */ @@ -2938,7 +3004,10 @@ export type Protocol = { }; -/** Livepeer protocol global parameters */ +/** + * Livepeer protocol global parameters + * + */ export type ProtocolPendingActivationArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -2948,7 +3017,10 @@ export type ProtocolPendingActivationArgs = { }; -/** Livepeer protocol global parameters */ +/** + * Livepeer protocol global parameters + * + */ export type ProtocolPendingDeactivationArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -4306,7 +4378,10 @@ export type QueryWithdrawalEventsArgs = { where?: InputMaybe; }; -/** RebondEvent entities are created for every emitted Rebond event. */ +/** + * RebondEvent entities are created for every emitted Rebond event. + * + */ export type RebondEvent = Event & { __typename: 'RebondEvent'; amount: Scalars['BigDecimal']; @@ -4509,7 +4584,10 @@ export enum RebondEvent_OrderBy { UnbondingLockId = 'unbondingLockId' } -/** ReserveClaimedEvent entities are created for every emitted ReserveClaimed event. */ +/** + * ReserveClaimedEvent entities are created for every emitted ReserveClaimed event. + * + */ export type ReserveClaimedEvent = Event & { __typename: 'ReserveClaimedEvent'; /** Amount of funds claimed by claimant from the reserve for the reserve holder */ @@ -4706,7 +4784,10 @@ export enum ReserveClaimedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** ReserveFundedEvent entities are created for every emitted ReserveFunded event. */ +/** + * ReserveFundedEvent entities are created for every emitted ReserveFunded event. + * + */ export type ReserveFundedEvent = Event & { __typename: 'ReserveFundedEvent'; /** Amount of funds added to reserve */ @@ -4861,7 +4942,10 @@ export enum ReserveFundedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** RewardEvent entities are created for every emitted Reward event. */ +/** + * RewardEvent entities are created for every emitted Reward event. + * + */ export type RewardEvent = Event & { __typename: 'RewardEvent'; /** Reference to the delegate that claimed its inflationary token reward */ @@ -5024,7 +5108,10 @@ export enum RewardEvent_OrderBy { TransactionTo = 'transaction__to' } -/** The Livepeer protocol is round based and each round is represented by some number of Ethereum blocks. */ +/** + * The Livepeer protocol is round based and each round is represented by some number of Ethereum blocks. + * + */ export type Round = { __typename: 'Round'; /** Total active transcoders (up to the limit) */ @@ -5068,7 +5155,10 @@ export type Round = { }; -/** The Livepeer protocol is round based and each round is represented by some number of Ethereum blocks. */ +/** + * The Livepeer protocol is round based and each round is represented by some number of Ethereum blocks. + * + */ export type RoundPoolsArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -5247,7 +5337,10 @@ export enum Round_OrderBy { VolumeUsd = 'volumeUSD' } -/** ServiceURIUpdateEvent entities are created for every emitted ServiceURIUpdate event. */ +/** + * ServiceURIUpdateEvent entities are created for every emitted ServiceURIUpdate event. + * + */ export type ServiceUriUpdateEvent = Event & { __typename: 'ServiceURIUpdateEvent'; /** Address of sender */ @@ -5403,7 +5496,10 @@ export enum ServiceUriUpdateEvent_OrderBy { TransactionTo = 'transaction__to' } -/** SetCurrentRewardTokensEvent entities are created for every emitted SetCurrentRewardTokens event. */ +/** + * SetCurrentRewardTokensEvent entities are created for every emitted SetCurrentRewardTokens event. + * + */ export type SetCurrentRewardTokensEvent = Event & { __typename: 'SetCurrentRewardTokensEvent'; /** Current inflation during the round */ @@ -5535,7 +5631,10 @@ export enum SetCurrentRewardTokensEvent_OrderBy { TransactionTo = 'transaction__to' } -/** StakeClaimedEvent entities are created for every emitted StakeClaimed event. */ +/** + * StakeClaimedEvent entities are created for every emitted StakeClaimed event. + * + */ export type StakeClaimedEvent = Event & { __typename: 'StakeClaimedEvent'; delegate: Scalars['String']; @@ -5709,7 +5808,10 @@ export enum StakeClaimedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** Transaction entities are created for each Ethereum transaction that contains an interaction within Livepeer contracts. */ +/** + * Transaction entities are created for each Ethereum transaction that contains an interaction within Livepeer contracts. + * + */ export type Transaction = { __typename: 'Transaction'; /** Block transaction was mined in */ @@ -5731,7 +5833,10 @@ export type Transaction = { }; -/** Transaction entities are created for each Ethereum transaction that contains an interaction within Livepeer contracts. */ +/** + * Transaction entities are created for each Ethereum transaction that contains an interaction within Livepeer contracts. + * + */ export type TransactionEventsArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -5839,7 +5944,10 @@ export enum Transaction_OrderBy { To = 'to' } -/** Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. */ +/** + * Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. + * + */ export type Transcoder = { __typename: 'Transcoder'; /** Round in which the transcoder became active - 0 if inactive */ @@ -5891,7 +5999,10 @@ export type Transcoder = { }; -/** Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. */ +/** + * Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. + * + */ export type TranscoderDelegatorsArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -5901,7 +6012,10 @@ export type TranscoderDelegatorsArgs = { }; -/** Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. */ +/** + * Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. + * + */ export type TranscoderPoolsArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -5911,7 +6025,10 @@ export type TranscoderPoolsArgs = { }; -/** Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. */ +/** + * Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. + * + */ export type TranscoderTranscoderDaysArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -5920,7 +6037,10 @@ export type TranscoderTranscoderDaysArgs = { where?: InputMaybe; }; -/** TranscoderActivatedEvent entities are created for every emitted TranscoderActivated event. */ +/** + * TranscoderActivatedEvent entities are created for every emitted TranscoderActivated event. + * + */ export type TranscoderActivatedEvent = Event & { __typename: 'TranscoderActivatedEvent'; /** Future round in which the delegate will become active */ @@ -6083,7 +6203,10 @@ export enum TranscoderActivatedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** Transcoder data accumulated and condensed into day stats */ +/** + * Transcoder data accumulated and condensed into day stats + * + */ export type TranscoderDay = { __typename: 'TranscoderDay'; /** The date beginning at 12:00am UTC */ @@ -6184,7 +6307,10 @@ export enum TranscoderDay_OrderBy { VolumeUsd = 'volumeUSD' } -/** TranscoderDeactivatedEvent entities are created for every emitted TranscoderDeactivated event. */ +/** + * TranscoderDeactivatedEvent entities are created for every emitted TranscoderDeactivated event. + * + */ export type TranscoderDeactivatedEvent = Event & { __typename: 'TranscoderDeactivatedEvent'; /** Future round in which the delegate will become deactive */ @@ -6347,7 +6473,10 @@ export enum TranscoderDeactivatedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** TranscoderEvictedEvent entities are created for every emitted TranscoderEvicted event. */ +/** + * TranscoderEvictedEvent entities are created for every emitted TranscoderEvicted event. + * + */ export type TranscoderEvictedEvent = Event & { __typename: 'TranscoderEvictedEvent'; /** Reference to the delegate that was evicted */ @@ -6499,7 +6628,10 @@ export enum TranscoderEvictedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** TranscoderResignedEvent entities are created for every emitted TranscoderResigned event. */ +/** + * TranscoderResignedEvent entities are created for every emitted TranscoderResigned event. + * + */ export type TranscoderResignedEvent = Event & { __typename: 'TranscoderResignedEvent'; /** Reference to the delegate that resigned */ @@ -6651,7 +6783,10 @@ export enum TranscoderResignedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** TranscoderSlashedEvent entities are created for every emitted TranscoderSlashed event. */ +/** + * TranscoderSlashedEvent entities are created for every emitted TranscoderSlashed event. + * + */ export type TranscoderSlashedEvent = Event & { __typename: 'TranscoderSlashedEvent'; /** Reference to the delegate that was slashed */ @@ -6843,7 +6978,10 @@ export enum TranscoderStatus { Registered = 'Registered' } -/** TranscoderUpdateEvent entities are created for every emitted TranscoderUpdate event. */ +/** + * TranscoderUpdateEvent entities are created for every emitted TranscoderUpdate event. + * + */ export type TranscoderUpdateEvent = Event & { __typename: 'TranscoderUpdateEvent'; /** Reference to the delegate that was updated */ @@ -7275,7 +7413,10 @@ export enum Transcoder_OrderBy { TranscoderDays = 'transcoderDays' } -/** TransferBond entities are created for every emitted TransferBond event. */ +/** + * TransferBond entities are created for every emitted TransferBond event. + * + */ export type TransferBondEvent = Event & { __typename: 'TransferBondEvent'; amount: Scalars['BigDecimal']; @@ -7477,7 +7618,10 @@ export enum TransferBondEvent_OrderBy { TransactionTo = 'transaction__to' } -/** Stake weighted treasury proposal */ +/** + * Stake weighted treasury proposal + * + */ export type TreasuryProposal = { __typename: 'TreasuryProposal'; /** Total weight of abstaining votes */ @@ -7509,7 +7653,10 @@ export type TreasuryProposal = { }; -/** Stake weighted treasury proposal */ +/** + * Stake weighted treasury proposal + * + */ export type TreasuryProposalVotesArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -7659,7 +7806,10 @@ export enum TreasuryProposal_OrderBy { Votes = 'votes' } -/** Stake weighted vote on a treasury proposal */ +/** + * Stake weighted vote on a treasury proposal + * + */ export type TreasuryVote = { __typename: 'TreasuryVote'; /** Proposal ID + voter address */ @@ -7676,7 +7826,10 @@ export type TreasuryVote = { weight: Scalars['BigDecimal']; }; -/** TreasuryVoteEvent entities are created for every emitted VoteCast/VoteCastWithParams event. */ +/** + * TreasuryVoteEvent entities are created for every emitted VoteCast/VoteCastWithParams event. + * + */ export type TreasuryVoteEvent = Event & { __typename: 'TreasuryVoteEvent'; /** Ethereum transaction hash + event log index */ @@ -7999,7 +8152,10 @@ export enum TreasuryVote_OrderBy { Weight = 'weight' } -/** UnbondEvent entities are created for every emitted Unbond event. */ +/** + * UnbondEvent entities are created for every emitted Unbond event. + * + */ export type UnbondEvent = Event & { __typename: 'UnbondEvent'; /** Amount unbonded in the transaction */ @@ -8216,7 +8372,10 @@ export enum UnbondEvent_OrderBy { WithdrawRound = 'withdrawRound' } -/** Get an unbonding lock for a delegator */ +/** + * Get an unbonding lock for a delegator + * + */ export type UnbondingLock = { __typename: 'UnbondingLock'; /** Amount being unbonded */ @@ -8372,7 +8531,10 @@ export enum UnbondingLock_OrderBy { WithdrawRound = 'withdrawRound' } -/** UnpauseEvent entities are created for every emitted Unpause event. */ +/** + * UnpauseEvent entities are created for every emitted Unpause event. + * + */ export type UnpauseEvent = Event & { __typename: 'UnpauseEvent'; /** Ethereum transaction hash + event log index */ @@ -8482,7 +8644,10 @@ export enum UnpauseEvent_OrderBy { TransactionTo = 'transaction__to' } -/** Vote data */ +/** + * Vote data + * + */ export type Vote = { __typename: 'Vote'; /** Vote choice */ @@ -8501,7 +8666,10 @@ export type Vote = { voter: Scalars['String']; }; -/** VoteEvent entities are created for every emitted Vote event. */ +/** + * VoteEvent entities are created for every emitted Vote event. + * + */ export type VoteEvent = Event & { __typename: 'VoteEvent'; /** Voter choice. Zero means yes and one means no */ @@ -8769,7 +8937,10 @@ export enum Vote_OrderBy { Voter = 'voter' } -/** WinningTicketRedeemedEvent entities are created for every emitted WinningTicketRedeemed event. */ +/** + * WinningTicketRedeemedEvent entities are created for every emitted WinningTicketRedeemed event. + * + */ export type WinningTicketRedeemedEvent = Event & { __typename: 'WinningTicketRedeemedEvent'; /** Auxilary data included in ticket used for additional validation */ @@ -9023,7 +9194,10 @@ export enum WinningTicketRedeemedEvent_OrderBy { WinProb = 'winProb' } -/** WithdrawFeesEvent entities are created for every emitted WithdrawFees event. */ +/** + * WithdrawFeesEvent entities are created for every emitted WithdrawFees event. + * + */ export type WithdrawFeesEvent = Event & { __typename: 'WithdrawFeesEvent'; /** Amount of fees withdrawn */ @@ -9199,7 +9373,10 @@ export enum WithdrawFeesEvent_OrderBy { TransactionTo = 'transaction__to' } -/** WithdrawStakeEvent entities are created for every emitted WithdrawStake event. */ +/** + * WithdrawStakeEvent entities are created for every emitted WithdrawStake event. + * + */ export type WithdrawStakeEvent = Event & { __typename: 'WithdrawStakeEvent'; /** Amount of stake withdrawn */ @@ -9363,7 +9540,10 @@ export enum WithdrawStakeEvent_OrderBy { UnbondingLockId = 'unbondingLockId' } -/** WithdrawalEvent entities are created for every emitted Withdrawal event. */ +/** + * WithdrawalEvent entities are created for every emitted Withdrawal event. + * + */ export type WithdrawalEvent = Event & { __typename: 'WithdrawalEvent'; /** Deposit amount withdrawn */ @@ -9549,6 +9729,7 @@ export type _Meta_ = { * will be null if the _meta field has a block constraint that asks for * a block number. It will be filled if the _meta field has no block constraint * and therefore asks for the latest block + * */ block: _Block_; /** The deployment ID */ @@ -9655,15 +9836,12 @@ export type TransactionsQueryVariables = Exact<{ export type TransactionsQuery = { __typename: 'Query', transactions: Array<{ __typename: 'Transaction', events?: Array<{ __typename: 'BondEvent', additionalAmount: string, delegator: { __typename: 'Delegator', id: string }, newDelegate: { __typename: 'Transcoder', id: string }, oldDelegate?: { __typename: 'Transcoder', id: string } | null, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'BurnEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'DepositFundedEvent', amount: string, sender: { __typename: 'Broadcaster', id: string }, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'EarningsClaimedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'MigrateDelegatorFinalizedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'MintEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'NewRoundEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'ParameterUpdateEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'PauseEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'PollCreatedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'RebondEvent', amount: string, delegate: { __typename: 'Transcoder', id: string }, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'ReserveClaimedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'ReserveFundedEvent', amount: string, reserveHolder: { __typename: 'Broadcaster', id: string }, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'RewardEvent', rewardTokens: string, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'ServiceURIUpdateEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'SetCurrentRewardTokensEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'StakeClaimedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'TranscoderActivatedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'TranscoderDeactivatedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'TranscoderEvictedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'TranscoderResignedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'TranscoderSlashedEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'TranscoderUpdateEvent', rewardCut: string, feeShare: string, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'TransferBondEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'TreasuryVoteEvent', id: string, reason?: string | null, support: TreasuryVoteSupport, timestamp: number, weight: string, proposal: { __typename: 'TreasuryProposal', id: string, targets: Array, description: string }, treasuryVoter: { __typename: 'LivepeerAccount', id: string }, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'UnbondEvent', amount: string, delegate: { __typename: 'Transcoder', id: string }, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'UnpauseEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'VoteEvent', voter: string, choiceID: string, id: string, timestamp: number, poll: { __typename: 'Poll', id: string, proposal: string, endBlock: string, quorum: string, quota: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number }, round: { __typename: 'Round', id: string } } | { __typename: 'WinningTicketRedeemedEvent', faceValue: string, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'WithdrawFeesEvent', amount: string, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'WithdrawStakeEvent', amount: string, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } } | { __typename: 'WithdrawalEvent', round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } }> | null }>, winningTicketRedeemedEvents: Array<{ __typename: 'WinningTicketRedeemedEvent', id: string, faceValue: string, round: { __typename: 'Round', id: string }, transaction: { __typename: 'Transaction', id: string, timestamp: number } }> }; -export type TranscoderActivatedEventsQueryVariables = Exact<{ - where?: InputMaybe; - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; +export type TranscoderActivationHistoryQueryVariables = Exact<{ + delegate: Scalars['String']; }>; -export type TranscoderActivatedEventsQuery = { __typename: 'Query', transcoderActivatedEvents: Array<{ __typename: 'TranscoderActivatedEvent', activationRound: string, id: string }> }; +export type TranscoderActivationHistoryQuery = { __typename: 'Query', transcoderActivatedEvents: Array<{ __typename: 'TranscoderActivatedEvent', activationRound: string }>, transcoderDeactivatedEvents: Array<{ __typename: 'TranscoderDeactivatedEvent', deactivationRound: string }> }; export type TreasuryProposalQueryVariables = Exact<{ id: Scalars['ID']; @@ -10637,50 +10815,52 @@ export function useTransactionsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptio export type TransactionsQueryHookResult = ReturnType; export type TransactionsLazyQueryHookResult = ReturnType; export type TransactionsQueryResult = Apollo.QueryResult; -export const TranscoderActivatedEventsDocument = gql` - query transcoderActivatedEvents($where: TranscoderActivatedEvent_filter, $first: Int, $orderBy: TranscoderActivatedEvent_orderBy, $orderDirection: OrderDirection) { +export const TranscoderActivationHistoryDocument = gql` + query transcoderActivationHistory($delegate: String!) { transcoderActivatedEvents( - where: $where - first: $first - orderBy: $orderBy - orderDirection: $orderDirection + where: {delegate: $delegate} + orderBy: activationRound + orderDirection: asc ) { activationRound - id + } + transcoderDeactivatedEvents( + where: {delegate: $delegate} + orderBy: deactivationRound + orderDirection: asc + ) { + deactivationRound } } `; /** - * __useTranscoderActivatedEventsQuery__ + * __useTranscoderActivationHistoryQuery__ * - * To run a query within a React component, call `useTranscoderActivatedEventsQuery` and pass it any options that fit your needs. - * When your component renders, `useTranscoderActivatedEventsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * To run a query within a React component, call `useTranscoderActivationHistoryQuery` and pass it any options that fit your needs. + * When your component renders, `useTranscoderActivationHistoryQuery` 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 } = useTranscoderActivatedEventsQuery({ + * const { data, loading, error } = useTranscoderActivationHistoryQuery({ * variables: { - * where: // value for 'where' - * first: // value for 'first' - * orderBy: // value for 'orderBy' - * orderDirection: // value for 'orderDirection' + * delegate: // value for 'delegate' * }, * }); */ -export function useTranscoderActivatedEventsQuery(baseOptions?: Apollo.QueryHookOptions) { +export function useTranscoderActivationHistoryQuery(baseOptions: Apollo.QueryHookOptions) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(TranscoderActivatedEventsDocument, options); + return Apollo.useQuery(TranscoderActivationHistoryDocument, options); } -export function useTranscoderActivatedEventsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { +export function useTranscoderActivationHistoryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(TranscoderActivatedEventsDocument, options); + return Apollo.useLazyQuery(TranscoderActivationHistoryDocument, options); } -export type TranscoderActivatedEventsQueryHookResult = ReturnType; -export type TranscoderActivatedEventsLazyQueryHookResult = ReturnType; -export type TranscoderActivatedEventsQueryResult = Apollo.QueryResult; +export type TranscoderActivationHistoryQueryHookResult = ReturnType; +export type TranscoderActivationHistoryLazyQueryHookResult = ReturnType; +export type TranscoderActivationHistoryQueryResult = Apollo.QueryResult; export const TreasuryProposalDocument = gql` query treasuryProposal($id: ID!) { treasuryProposal(id: $id) { diff --git a/components/OrchestratingView/index.tsx b/components/OrchestratingView/index.tsx index f6fb506a..3417924d 100644 --- a/components/OrchestratingView/index.tsx +++ b/components/OrchestratingView/index.tsx @@ -2,15 +2,9 @@ import Stat from "@components/Stat"; import dayjs from "@lib/dayjs"; import { Box, Flex, Link as A, Text } from "@livepeer/design-system"; import { ArrowTopRightIcon, CheckIcon, Cross1Icon } from "@modulz/radix-icons"; -import { - AccountQueryResult, - OrderDirection, - TranscoderActivatedEvent_OrderBy, - useTranscoderActivatedEventsQuery, - useTreasuryProposalsQuery, - useTreasuryVotesQuery, -} from "apollo"; +import { AccountQueryResult } from "apollo"; import { useScoreData } from "hooks"; +import { useGovernanceParticipation } from "hooks/useGovernanceParticipation"; import { useRegionsData } from "hooks/useSwr"; import Link from "next/link"; import numbro from "numbro"; @@ -40,48 +34,7 @@ const Index = ({ currentRound, transcoder, isActive }: Props) => { const scores = useScoreData(transcoder?.id); const knownRegions = useRegionsData(); - - const { data: firstTranscoderActivatedEventsData } = - useTranscoderActivatedEventsQuery({ - variables: { - where: { - delegate: transcoder?.id, - }, - first: 1, - orderBy: TranscoderActivatedEvent_OrderBy.ActivationRound, - orderDirection: OrderDirection.Asc, - }, - }); - - const firstActivationRound = useMemo(() => { - return firstTranscoderActivatedEventsData?.transcoderActivatedEvents[0] - ?.activationRound; - }, [firstTranscoderActivatedEventsData]); - - const { data: treasuryVotesData } = useTreasuryVotesQuery({ - variables: { - where: { - voter: transcoder?.id, - }, - }, - }); - - const { data: eligebleProposalsData } = useTreasuryProposalsQuery({ - variables: { - where: { - voteStart_gt: firstActivationRound, - }, - }, - skip: !firstActivationRound, - }); - - const govStats = useMemo(() => { - if (!treasuryVotesData || !eligebleProposalsData) return null; - return { - voted: treasuryVotesData?.treasuryVotes.length ?? 0, - eligible: eligebleProposalsData?.treasuryProposals.length ?? 0, - }; - }, [treasuryVotesData, eligebleProposalsData]); + const { treasury: govStats } = useGovernanceParticipation(transcoder?.id); const maxScore = useMemo(() => { const topTransData = Object.keys(scores?.scores ?? {}).reduce( @@ -145,6 +98,9 @@ const Index = ({ currentRound, transcoder, isActive }: Props) => { : { score: "N/A", modelText: "" }; }, [knownRegions?.regions, maxScore]); + const govParticipation = + govStats && govStats.eligible > 0 ? govStats.voted / govStats.eligible : 0; + return ( { > { size="2" css={{ color: "$neutral11", fontWeight: 600 }} > - {numbro(govStats.voted / govStats.eligible).format({ + {numbro(govParticipation).format({ output: "percent", mantissa: 0, })}{" "} diff --git a/hooks/useGovernanceParticipation.tsx b/hooks/useGovernanceParticipation.tsx new file mode 100644 index 00000000..4217472e --- /dev/null +++ b/hooks/useGovernanceParticipation.tsx @@ -0,0 +1,122 @@ +import { + useTranscoderActivationHistoryQuery, + useTreasuryProposalsQuery, + useTreasuryVotesQuery, +} from "apollo"; +import { useMemo } from "react"; + +type ActivationWindow = { start: number; end: number }; +type Participation = { voted: number; eligible: number }; + +const buildActiveWindows = ( + activations: { activationRound: string }[], + deactivations: { deactivationRound: string }[] +): ActivationWindow[] => { + const timeline = [ + ...activations.map((a) => ({ + round: Number(a.activationRound), + type: "activation" as const, + })), + ...deactivations.map((d) => ({ + round: Number(d.deactivationRound), + type: "deactivation" as const, + })), + ].sort((a, b) => a.round - b.round || (a.type === "deactivation" ? -1 : 1)); + + const windows: ActivationWindow[] = []; + let start: number | null = null; + + for (const { type, round } of timeline) { + if (type === "activation") { + start = round; + } else if (start !== null && round > start) { + windows.push({ start, end: round }); + start = null; + } + } + + return start !== null + ? [...windows, { start, end: Number.POSITIVE_INFINITY }] + : windows; +}; + +const isDuringWindow = (round: number, windows: ActivationWindow[]) => + windows.some((w) => round >= w.start && round < w.end); + +export const useGovernanceParticipation = ( + delegateId?: string +): { treasury: Participation | null; loading: boolean } => { + const hasDelegate = Boolean(delegateId); + + const { data: activationData, loading: activationLoading } = + useTranscoderActivationHistoryQuery({ + variables: { delegate: delegateId ?? "" }, + fetchPolicy: "cache-and-network", + skip: !hasDelegate, + }); + + const { data: votesData, loading: votesLoading } = useTreasuryVotesQuery({ + variables: { where: { voter: delegateId ?? "" } }, + fetchPolicy: "cache-and-network", + skip: !hasDelegate, + }); + + const activations = useMemo( + () => activationData?.transcoderActivatedEvents ?? [], + [activationData?.transcoderActivatedEvents] + ); + const deactivations = useMemo( + () => activationData?.transcoderDeactivatedEvents ?? [], + [activationData?.transcoderDeactivatedEvents] + ); + + const firstActivationRound = activations[0]?.activationRound; + const hasMultipleWindows = + activations.length > 1 || (deactivations?.length ?? 0) > 0; + + const windows = useMemo( + () => + hasMultipleWindows ? buildActiveWindows(activations, deactivations) : [], + [activations, deactivations, hasMultipleWindows] + ); + + const { data: proposalsData, loading: proposalsLoading } = + useTreasuryProposalsQuery({ + variables: firstActivationRound + ? { where: { voteStart_gte: firstActivationRound } } + : undefined, + skip: !firstActivationRound, + fetchPolicy: "cache-and-network", + }); + + const treasuryParticipation = useMemo(() => { + if (!proposalsData || !votesData) return null; + if (!firstActivationRound) return null; + + if (!hasMultipleWindows) { + return { + voted: votesData.treasuryVotes?.length ?? 0, + eligible: proposalsData.treasuryProposals?.length ?? 0, + }; + } + + const eligible = proposalsData.treasuryProposals.filter((proposal) => + isDuringWindow(Number(proposal.voteStart), windows) + ).length; + const voted = votesData.treasuryVotes.filter((vote) => + isDuringWindow(Number(vote.proposal.voteStart), windows) + ).length; + return { voted, eligible }; + }, [ + proposalsData, + votesData, + firstActivationRound, + hasMultipleWindows, + windows, + ]); + + return { + treasury: treasuryParticipation, + loading: activationLoading || votesLoading || proposalsLoading, + }; +}; diff --git a/queries/transcoderActivatedEvents.graphql b/queries/transcoderActivatedEvents.graphql deleted file mode 100644 index de44c762..00000000 --- a/queries/transcoderActivatedEvents.graphql +++ /dev/null @@ -1,16 +0,0 @@ -query transcoderActivatedEvents( - $where: TranscoderActivatedEvent_filter - $first: Int - $orderBy: TranscoderActivatedEvent_orderBy - $orderDirection: OrderDirection -) { - transcoderActivatedEvents( - where: $where - first: $first - orderBy: $orderBy - orderDirection: $orderDirection - ) { - activationRound - id - } -} diff --git a/queries/transcoderActivationHistory.graphql b/queries/transcoderActivationHistory.graphql new file mode 100644 index 00000000..8e05db3d --- /dev/null +++ b/queries/transcoderActivationHistory.graphql @@ -0,0 +1,16 @@ +query transcoderActivationHistory($delegate: String!) { + transcoderActivatedEvents( + where: { delegate: $delegate } + orderBy: activationRound + orderDirection: asc + ) { + activationRound + } + transcoderDeactivatedEvents( + where: { delegate: $delegate } + orderBy: deactivationRound + orderDirection: asc + ) { + deactivationRound + } +} From 16251e8b1fc31d2887d5623b9e0ce69e152f9495 Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Thu, 5 Feb 2026 10:59:53 +0100 Subject: [PATCH 2/4] refactor: apply codex window logic suggestions Co-authored-by: copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> --- components/OrchestratingView/index.tsx | 110 +++++++++++++++++++++- hooks/useGovernanceParticipation.tsx | 122 ------------------------- 2 files changed, 108 insertions(+), 124 deletions(-) delete mode 100644 hooks/useGovernanceParticipation.tsx diff --git a/components/OrchestratingView/index.tsx b/components/OrchestratingView/index.tsx index 3417924d..47e62fa2 100644 --- a/components/OrchestratingView/index.tsx +++ b/components/OrchestratingView/index.tsx @@ -2,9 +2,13 @@ import Stat from "@components/Stat"; import dayjs from "@lib/dayjs"; import { Box, Flex, Link as A, Text } from "@livepeer/design-system"; import { ArrowTopRightIcon, CheckIcon, Cross1Icon } from "@modulz/radix-icons"; -import { AccountQueryResult } from "apollo"; +import { + AccountQueryResult, + useTranscoderActivationHistoryQuery, + useTreasuryProposalsQuery, + useTreasuryVotesQuery, +} from "apollo"; import { useScoreData } from "hooks"; -import { useGovernanceParticipation } from "hooks/useGovernanceParticipation"; import { useRegionsData } from "hooks/useSwr"; import Link from "next/link"; import numbro from "numbro"; @@ -26,6 +30,108 @@ interface Props { isActive: boolean; } +type ActivationWindow = { start: number; end: number }; +type Participation = { voted: number; eligible: number }; + +const buildActiveWindows = ( + activations: { activationRound: string }[], + deactivations: { deactivationRound: string }[] +): ActivationWindow[] => { + const timeline = [ + ...activations.map((a) => ({ + round: Number(a.activationRound), + type: "activation" as const, + })), + ...deactivations.map((d) => ({ + round: Number(d.deactivationRound), + type: "deactivation" as const, + })), + ].sort((a, b) => a.round - b.round || (a.type === "deactivation" ? -1 : 1)); + + const windows: ActivationWindow[] = []; + let start: number | null = null; + + for (const { type, round } of timeline) { + if (type === "activation") { + if (start === null) { + start = round; + } + } else if (start !== null && round >= start) { + windows.push({ start, end: round }); + start = null; + } + } + + return start !== null + ? [...windows, { start, end: Number.POSITIVE_INFINITY }] + : windows; +}; + +const isDuringWindow = (round: number, windows: ActivationWindow[]) => + windows.some((w) => round >= w.start && round < w.end); + +const useGovernanceParticipation = ( + delegateId?: string +): { treasury: Participation | null; loading: boolean } => { + const hasDelegate = Boolean(delegateId); + + const { data: activationData, loading: activationLoading } = + useTranscoderActivationHistoryQuery({ + ...(hasDelegate ? { variables: { delegate: delegateId! } } : {}), + fetchPolicy: "cache-and-network", + skip: !hasDelegate, + }); + + const { data: votesData, loading: votesLoading } = useTreasuryVotesQuery({ + ...(hasDelegate ? { variables: { where: { voter: delegateId! } } } : {}), + fetchPolicy: "cache-and-network", + skip: !hasDelegate, + }); + + const activations = useMemo( + () => activationData?.transcoderActivatedEvents ?? [], + [activationData?.transcoderActivatedEvents] + ); + const deactivations = useMemo( + () => activationData?.transcoderDeactivatedEvents ?? [], + [activationData?.transcoderDeactivatedEvents] + ); + + const firstActivationRound = activations[0]?.activationRound; + + const windows = useMemo( + () => buildActiveWindows(activations, deactivations), + [activations, deactivations] + ); + + const { data: proposalsData, loading: proposalsLoading } = + useTreasuryProposalsQuery({ + variables: firstActivationRound + ? { where: { voteStart_gte: firstActivationRound } } + : undefined, + skip: !firstActivationRound, + fetchPolicy: "cache-and-network", + }); + + const treasuryParticipation = useMemo(() => { + if (!proposalsData || !votesData) return null; + if (!firstActivationRound) return null; + + const eligible = proposalsData.treasuryProposals.filter((proposal) => + isDuringWindow(Number(proposal.voteStart), windows) + ).length; + const voted = votesData.treasuryVotes.filter((vote) => + isDuringWindow(Number(vote.proposal.voteStart), windows) + ).length; + return { voted, eligible }; + }, [proposalsData, votesData, firstActivationRound, windows]); + + return { + treasury: treasuryParticipation, + loading: activationLoading || votesLoading || proposalsLoading, + }; +}; + const Index = ({ currentRound, transcoder, isActive }: Props) => { const callsMade = useMemo( () => transcoder?.pools?.filter((r) => r.rewardTokens != null)?.length ?? 0, diff --git a/hooks/useGovernanceParticipation.tsx b/hooks/useGovernanceParticipation.tsx deleted file mode 100644 index 4217472e..00000000 --- a/hooks/useGovernanceParticipation.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import { - useTranscoderActivationHistoryQuery, - useTreasuryProposalsQuery, - useTreasuryVotesQuery, -} from "apollo"; -import { useMemo } from "react"; - -type ActivationWindow = { start: number; end: number }; -type Participation = { voted: number; eligible: number }; - -const buildActiveWindows = ( - activations: { activationRound: string }[], - deactivations: { deactivationRound: string }[] -): ActivationWindow[] => { - const timeline = [ - ...activations.map((a) => ({ - round: Number(a.activationRound), - type: "activation" as const, - })), - ...deactivations.map((d) => ({ - round: Number(d.deactivationRound), - type: "deactivation" as const, - })), - ].sort((a, b) => a.round - b.round || (a.type === "deactivation" ? -1 : 1)); - - const windows: ActivationWindow[] = []; - let start: number | null = null; - - for (const { type, round } of timeline) { - if (type === "activation") { - start = round; - } else if (start !== null && round > start) { - windows.push({ start, end: round }); - start = null; - } - } - - return start !== null - ? [...windows, { start, end: Number.POSITIVE_INFINITY }] - : windows; -}; - -const isDuringWindow = (round: number, windows: ActivationWindow[]) => - windows.some((w) => round >= w.start && round < w.end); - -export const useGovernanceParticipation = ( - delegateId?: string -): { treasury: Participation | null; loading: boolean } => { - const hasDelegate = Boolean(delegateId); - - const { data: activationData, loading: activationLoading } = - useTranscoderActivationHistoryQuery({ - variables: { delegate: delegateId ?? "" }, - fetchPolicy: "cache-and-network", - skip: !hasDelegate, - }); - - const { data: votesData, loading: votesLoading } = useTreasuryVotesQuery({ - variables: { where: { voter: delegateId ?? "" } }, - fetchPolicy: "cache-and-network", - skip: !hasDelegate, - }); - - const activations = useMemo( - () => activationData?.transcoderActivatedEvents ?? [], - [activationData?.transcoderActivatedEvents] - ); - const deactivations = useMemo( - () => activationData?.transcoderDeactivatedEvents ?? [], - [activationData?.transcoderDeactivatedEvents] - ); - - const firstActivationRound = activations[0]?.activationRound; - const hasMultipleWindows = - activations.length > 1 || (deactivations?.length ?? 0) > 0; - - const windows = useMemo( - () => - hasMultipleWindows ? buildActiveWindows(activations, deactivations) : [], - [activations, deactivations, hasMultipleWindows] - ); - - const { data: proposalsData, loading: proposalsLoading } = - useTreasuryProposalsQuery({ - variables: firstActivationRound - ? { where: { voteStart_gte: firstActivationRound } } - : undefined, - skip: !firstActivationRound, - fetchPolicy: "cache-and-network", - }); - - const treasuryParticipation = useMemo(() => { - if (!proposalsData || !votesData) return null; - if (!firstActivationRound) return null; - - if (!hasMultipleWindows) { - return { - voted: votesData.treasuryVotes?.length ?? 0, - eligible: proposalsData.treasuryProposals?.length ?? 0, - }; - } - - const eligible = proposalsData.treasuryProposals.filter((proposal) => - isDuringWindow(Number(proposal.voteStart), windows) - ).length; - const voted = votesData.treasuryVotes.filter((vote) => - isDuringWindow(Number(vote.proposal.voteStart), windows) - ).length; - return { voted, eligible }; - }, [ - proposalsData, - votesData, - firstActivationRound, - hasMultipleWindows, - windows, - ]); - - return { - treasury: treasuryParticipation, - loading: activationLoading || votesLoading || proposalsLoading, - }; -}; From 836e9fd49e0905545bae5dcc6ce44b593453f397 Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Thu, 5 Feb 2026 11:32:06 +0100 Subject: [PATCH 3/4] feat: omit pending proposals Ensure pending proposals are ommited in the participation calculation. --- components/OrchestratingView/index.tsx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/components/OrchestratingView/index.tsx b/components/OrchestratingView/index.tsx index 47e62fa2..b0e6368a 100644 --- a/components/OrchestratingView/index.tsx +++ b/components/OrchestratingView/index.tsx @@ -70,8 +70,12 @@ const buildActiveWindows = ( const isDuringWindow = (round: number, windows: ActivationWindow[]) => windows.some((w) => round >= w.start && round < w.end); +const isActiveProposal = (voteStart: string, currentRoundId?: string) => + currentRoundId ? Number(voteStart) <= Number(currentRoundId) : true; + const useGovernanceParticipation = ( - delegateId?: string + delegateId?: string, + currentRoundId?: string ): { treasury: Participation | null; loading: boolean } => { const hasDelegate = Boolean(delegateId); @@ -117,14 +121,18 @@ const useGovernanceParticipation = ( if (!proposalsData || !votesData) return null; if (!firstActivationRound) return null; - const eligible = proposalsData.treasuryProposals.filter((proposal) => - isDuringWindow(Number(proposal.voteStart), windows) + const eligible = proposalsData.treasuryProposals.filter( + (proposal) => + isActiveProposal(proposal.voteStart, currentRoundId) && + isDuringWindow(Number(proposal.voteStart), windows) ).length; - const voted = votesData.treasuryVotes.filter((vote) => - isDuringWindow(Number(vote.proposal.voteStart), windows) + const voted = votesData.treasuryVotes.filter( + (vote) => + isActiveProposal(vote.proposal.voteStart, currentRoundId) && + isDuringWindow(Number(vote.proposal.voteStart), windows) ).length; return { voted, eligible }; - }, [proposalsData, votesData, firstActivationRound, windows]); + }, [proposalsData, votesData, firstActivationRound, windows, currentRoundId]); return { treasury: treasuryParticipation, @@ -140,7 +148,10 @@ const Index = ({ currentRound, transcoder, isActive }: Props) => { const scores = useScoreData(transcoder?.id); const knownRegions = useRegionsData(); - const { treasury: govStats } = useGovernanceParticipation(transcoder?.id); + const { treasury: govStats } = useGovernanceParticipation( + transcoder?.id, + currentRound?.id + ); const maxScore = useMemo(() => { const topTransData = Object.keys(scores?.scores ?? {}).reduce( From 6197c28d744bd9e8933879a3604c7f834ddbcd2d Mon Sep 17 00:00:00 2001 From: ECWireless Date: Mon, 23 Feb 2026 17:02:14 -0700 Subject: [PATCH 4/4] chore: update codegen --- apollo/subgraph.ts | 301 +++++++++------------------------------------ 1 file changed, 60 insertions(+), 241 deletions(-) diff --git a/apollo/subgraph.ts b/apollo/subgraph.ts index 1d1be403..83dffd79 100644 --- a/apollo/subgraph.ts +++ b/apollo/subgraph.ts @@ -41,10 +41,7 @@ export type Block_Height = { number_gte?: InputMaybe; }; -/** - * BondEvent entities are created for every emitted Bond event. - * - */ +/** BondEvent entities are created for every emitted Bond event. */ export type BondEvent = Event & { __typename: 'BondEvent'; /** Additional amount added to bonded amount */ @@ -292,10 +289,7 @@ export enum BondEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * Broadcasters pay transcoders to do the work of transcoding in exchange for fees - * - */ +/** Broadcasters pay transcoders to do the work of transcoding in exchange for fees */ export type Broadcaster = { __typename: 'Broadcaster'; /** Days in which this broadcaster paid out fees */ @@ -323,10 +317,7 @@ export type Broadcaster = { }; -/** - * Broadcasters pay transcoders to do the work of transcoding in exchange for fees - * - */ +/** Broadcasters pay transcoders to do the work of transcoding in exchange for fees */ export type BroadcasterBroadcasterDaysArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -335,10 +326,7 @@ export type BroadcasterBroadcasterDaysArgs = { where?: InputMaybe; }; -/** - * Broadcaster data accumulated and condensed into day stats - * - */ +/** Broadcaster data accumulated and condensed into day stats */ export type BroadcasterDay = { __typename: 'BroadcasterDay'; /** Broadcaster associated with the day */ @@ -539,10 +527,7 @@ export enum Broadcaster_OrderBy { TotalVolumeUsd = 'totalVolumeUSD' } -/** - * BurnEvent entities are created for every emitted Burn event. - * - */ +/** BurnEvent entities are created for every emitted Burn event. */ export type BurnEvent = Event & { __typename: 'BurnEvent'; /** Ethereum transaction hash + event log index */ @@ -663,10 +648,7 @@ export enum BurnEvent_OrderBy { Value = 'value' } -/** - * Protocol data accumulated and condensed into day stats - * - */ +/** Protocol data accumulated and condensed into day stats */ export type Day = { __typename: 'Day'; /** Total active transcoders (up to the limit) */ @@ -802,10 +784,7 @@ export enum Day_OrderBy { VolumeUsd = 'volumeUSD' } -/** - * Bonded accounts who have delegated their stake towards a transcoder candidate - * - */ +/** Bonded accounts who have delegated their stake towards a transcoder candidate */ export type Delegator = { __typename: 'Delegator'; /** Amount of Livepeer Token a delegator currently has bonded */ @@ -833,10 +812,7 @@ export type Delegator = { }; -/** - * Bonded accounts who have delegated their stake towards a transcoder candidate - * - */ +/** Bonded accounts who have delegated their stake towards a transcoder candidate */ export type DelegatorUnbondingLocksArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -1009,10 +985,7 @@ export enum Delegator_OrderBy { WithdrawnFees = 'withdrawnFees' } -/** - * DepositFundedEvent entities are created for every emitted DepositFunded event. - * - */ +/** DepositFundedEvent entities are created for every emitted DepositFunded event. */ export type DepositFundedEvent = Event & { __typename: 'DepositFundedEvent'; /** Amount of broadcasting fees deposited */ @@ -1167,10 +1140,7 @@ export enum DepositFundedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * EarningsClaimedEvent entities are created for every emitted EarningsClaimed event. - * - */ +/** EarningsClaimedEvent entities are created for every emitted EarningsClaimed event. */ export type EarningsClaimedEvent = Event & { __typename: 'EarningsClaimedEvent'; /** Reference to the delegator's delegate */ @@ -1533,10 +1503,7 @@ export enum Event_OrderBy { TransactionTo = 'transaction__to' } -/** - * Abstraction for accounts/delegators bonded with the protocol - * - */ +/** Abstraction for accounts/delegators bonded with the protocol */ export type LivepeerAccount = { __typename: 'LivepeerAccount'; /** Reference to the Delegate this address is bonded to */ @@ -1647,10 +1614,7 @@ export enum LivepeerAccount_OrderBy { LastUpdatedTimestamp = 'lastUpdatedTimestamp' } -/** - * MigrateDelegatorFinalizedEvent entities are created for every emitted WithdrawStake event. - * - */ +/** MigrateDelegatorFinalizedEvent entities are created for every emitted WithdrawStake event. */ export type MigrateDelegatorFinalizedEvent = Event & { __typename: 'MigrateDelegatorFinalizedEvent'; delegate: Scalars['String']; @@ -1856,10 +1820,7 @@ export enum MigrateDelegatorFinalizedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * MintEvent entities are created for every emitted Mint event. - * - */ +/** MintEvent entities are created for every emitted Mint event. */ export type MintEvent = Event & { __typename: 'MintEvent'; /** Amount of tokens minted */ @@ -2003,10 +1964,7 @@ export enum MintEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * NewRoundEvent entities are created for every emitted NewRound event. - * - */ +/** NewRoundEvent entities are created for every emitted NewRound event. */ export type NewRoundEvent = Event & { __typename: 'NewRoundEvent'; /** Block hash for the round */ @@ -2145,10 +2103,7 @@ export enum OrderDirection { Desc = 'desc' } -/** - * ParameterUpdateEvent entities are created for every emitted ParameterUpdate event. - * - */ +/** ParameterUpdateEvent entities are created for every emitted ParameterUpdate event. */ export type ParameterUpdateEvent = Event & { __typename: 'ParameterUpdateEvent'; /** Ethereum transaction hash + event log index */ @@ -2281,10 +2236,7 @@ export enum ParameterUpdateEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * PauseEvent entities are created for every emitted Pause event. - * - */ +/** PauseEvent entities are created for every emitted Pause event. */ export type PauseEvent = Event & { __typename: 'PauseEvent'; /** Ethereum transaction hash + event log index */ @@ -2394,10 +2346,7 @@ export enum PauseEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * Stake weighted poll - * - */ +/** Stake weighted poll */ export type Poll = { __typename: 'Poll'; /** Block at which the poll ends and votes can no longer be submitted */ @@ -2417,10 +2366,7 @@ export type Poll = { }; -/** - * Stake weighted poll - * - */ +/** Stake weighted poll */ export type PollVotesArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -2434,10 +2380,7 @@ export enum PollChoice { Yes = 'Yes' } -/** - * PollCreatedEvent entities are created for every emitted PollCreated event. - * - */ +/** PollCreatedEvent entities are created for every emitted PollCreated event. */ export type PollCreatedEvent = Event & { __typename: 'PollCreatedEvent'; /** Ethereum block in which this poll ends */ @@ -2622,10 +2565,7 @@ export enum PollCreatedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * Stake weighted tally associated with a poll - * - */ +/** Stake weighted tally associated with a poll */ export type PollTally = { __typename: 'PollTally'; /** Poll address */ @@ -2773,10 +2713,7 @@ export enum Poll_OrderBy { Votes = 'votes' } -/** - * Represents a transcoder's rewards and fees to be distributed to delegators - * - */ +/** Represents a transcoder's rewards and fees to be distributed to delegators */ export type Pool = { __typename: 'Pool'; /** Transcoder associated with the pool */ @@ -2941,10 +2878,7 @@ export enum Pool_OrderBy { TotalStake = 'totalStake' } -/** - * Livepeer protocol global parameters - * - */ +/** Livepeer protocol global parameters */ export type Protocol = { __typename: 'Protocol'; /** Broadcasters active within the current 90 day fee window */ @@ -3004,10 +2938,7 @@ export type Protocol = { }; -/** - * Livepeer protocol global parameters - * - */ +/** Livepeer protocol global parameters */ export type ProtocolPendingActivationArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -3017,10 +2948,7 @@ export type ProtocolPendingActivationArgs = { }; -/** - * Livepeer protocol global parameters - * - */ +/** Livepeer protocol global parameters */ export type ProtocolPendingDeactivationArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -4378,10 +4306,7 @@ export type QueryWithdrawalEventsArgs = { where?: InputMaybe; }; -/** - * RebondEvent entities are created for every emitted Rebond event. - * - */ +/** RebondEvent entities are created for every emitted Rebond event. */ export type RebondEvent = Event & { __typename: 'RebondEvent'; amount: Scalars['BigDecimal']; @@ -4584,10 +4509,7 @@ export enum RebondEvent_OrderBy { UnbondingLockId = 'unbondingLockId' } -/** - * ReserveClaimedEvent entities are created for every emitted ReserveClaimed event. - * - */ +/** ReserveClaimedEvent entities are created for every emitted ReserveClaimed event. */ export type ReserveClaimedEvent = Event & { __typename: 'ReserveClaimedEvent'; /** Amount of funds claimed by claimant from the reserve for the reserve holder */ @@ -4784,10 +4706,7 @@ export enum ReserveClaimedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * ReserveFundedEvent entities are created for every emitted ReserveFunded event. - * - */ +/** ReserveFundedEvent entities are created for every emitted ReserveFunded event. */ export type ReserveFundedEvent = Event & { __typename: 'ReserveFundedEvent'; /** Amount of funds added to reserve */ @@ -4942,10 +4861,7 @@ export enum ReserveFundedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * RewardEvent entities are created for every emitted Reward event. - * - */ +/** RewardEvent entities are created for every emitted Reward event. */ export type RewardEvent = Event & { __typename: 'RewardEvent'; /** Reference to the delegate that claimed its inflationary token reward */ @@ -5108,10 +5024,7 @@ export enum RewardEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * The Livepeer protocol is round based and each round is represented by some number of Ethereum blocks. - * - */ +/** The Livepeer protocol is round based and each round is represented by some number of Ethereum blocks. */ export type Round = { __typename: 'Round'; /** Total active transcoders (up to the limit) */ @@ -5155,10 +5068,7 @@ export type Round = { }; -/** - * The Livepeer protocol is round based and each round is represented by some number of Ethereum blocks. - * - */ +/** The Livepeer protocol is round based and each round is represented by some number of Ethereum blocks. */ export type RoundPoolsArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -5337,10 +5247,7 @@ export enum Round_OrderBy { VolumeUsd = 'volumeUSD' } -/** - * ServiceURIUpdateEvent entities are created for every emitted ServiceURIUpdate event. - * - */ +/** ServiceURIUpdateEvent entities are created for every emitted ServiceURIUpdate event. */ export type ServiceUriUpdateEvent = Event & { __typename: 'ServiceURIUpdateEvent'; /** Address of sender */ @@ -5496,10 +5403,7 @@ export enum ServiceUriUpdateEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * SetCurrentRewardTokensEvent entities are created for every emitted SetCurrentRewardTokens event. - * - */ +/** SetCurrentRewardTokensEvent entities are created for every emitted SetCurrentRewardTokens event. */ export type SetCurrentRewardTokensEvent = Event & { __typename: 'SetCurrentRewardTokensEvent'; /** Current inflation during the round */ @@ -5631,10 +5535,7 @@ export enum SetCurrentRewardTokensEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * StakeClaimedEvent entities are created for every emitted StakeClaimed event. - * - */ +/** StakeClaimedEvent entities are created for every emitted StakeClaimed event. */ export type StakeClaimedEvent = Event & { __typename: 'StakeClaimedEvent'; delegate: Scalars['String']; @@ -5808,10 +5709,7 @@ export enum StakeClaimedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * Transaction entities are created for each Ethereum transaction that contains an interaction within Livepeer contracts. - * - */ +/** Transaction entities are created for each Ethereum transaction that contains an interaction within Livepeer contracts. */ export type Transaction = { __typename: 'Transaction'; /** Block transaction was mined in */ @@ -5833,10 +5731,7 @@ export type Transaction = { }; -/** - * Transaction entities are created for each Ethereum transaction that contains an interaction within Livepeer contracts. - * - */ +/** Transaction entities are created for each Ethereum transaction that contains an interaction within Livepeer contracts. */ export type TransactionEventsArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -5944,10 +5839,7 @@ export enum Transaction_OrderBy { To = 'to' } -/** - * Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. - * - */ +/** Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. */ export type Transcoder = { __typename: 'Transcoder'; /** Round in which the transcoder became active - 0 if inactive */ @@ -5999,10 +5891,7 @@ export type Transcoder = { }; -/** - * Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. - * - */ +/** Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. */ export type TranscoderDelegatorsArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -6012,10 +5901,7 @@ export type TranscoderDelegatorsArgs = { }; -/** - * Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. - * - */ +/** Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. */ export type TranscoderPoolsArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -6025,10 +5911,7 @@ export type TranscoderPoolsArgs = { }; -/** - * Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. - * - */ +/** Perform transcoding work for the network. The transcoders with the most delegated stake are elected as active transcoders that process transcode jobs for the network. */ export type TranscoderTranscoderDaysArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -6037,10 +5920,7 @@ export type TranscoderTranscoderDaysArgs = { where?: InputMaybe; }; -/** - * TranscoderActivatedEvent entities are created for every emitted TranscoderActivated event. - * - */ +/** TranscoderActivatedEvent entities are created for every emitted TranscoderActivated event. */ export type TranscoderActivatedEvent = Event & { __typename: 'TranscoderActivatedEvent'; /** Future round in which the delegate will become active */ @@ -6203,10 +6083,7 @@ export enum TranscoderActivatedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * Transcoder data accumulated and condensed into day stats - * - */ +/** Transcoder data accumulated and condensed into day stats */ export type TranscoderDay = { __typename: 'TranscoderDay'; /** The date beginning at 12:00am UTC */ @@ -6307,10 +6184,7 @@ export enum TranscoderDay_OrderBy { VolumeUsd = 'volumeUSD' } -/** - * TranscoderDeactivatedEvent entities are created for every emitted TranscoderDeactivated event. - * - */ +/** TranscoderDeactivatedEvent entities are created for every emitted TranscoderDeactivated event. */ export type TranscoderDeactivatedEvent = Event & { __typename: 'TranscoderDeactivatedEvent'; /** Future round in which the delegate will become deactive */ @@ -6473,10 +6347,7 @@ export enum TranscoderDeactivatedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * TranscoderEvictedEvent entities are created for every emitted TranscoderEvicted event. - * - */ +/** TranscoderEvictedEvent entities are created for every emitted TranscoderEvicted event. */ export type TranscoderEvictedEvent = Event & { __typename: 'TranscoderEvictedEvent'; /** Reference to the delegate that was evicted */ @@ -6628,10 +6499,7 @@ export enum TranscoderEvictedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * TranscoderResignedEvent entities are created for every emitted TranscoderResigned event. - * - */ +/** TranscoderResignedEvent entities are created for every emitted TranscoderResigned event. */ export type TranscoderResignedEvent = Event & { __typename: 'TranscoderResignedEvent'; /** Reference to the delegate that resigned */ @@ -6783,10 +6651,7 @@ export enum TranscoderResignedEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * TranscoderSlashedEvent entities are created for every emitted TranscoderSlashed event. - * - */ +/** TranscoderSlashedEvent entities are created for every emitted TranscoderSlashed event. */ export type TranscoderSlashedEvent = Event & { __typename: 'TranscoderSlashedEvent'; /** Reference to the delegate that was slashed */ @@ -6978,10 +6843,7 @@ export enum TranscoderStatus { Registered = 'Registered' } -/** - * TranscoderUpdateEvent entities are created for every emitted TranscoderUpdate event. - * - */ +/** TranscoderUpdateEvent entities are created for every emitted TranscoderUpdate event. */ export type TranscoderUpdateEvent = Event & { __typename: 'TranscoderUpdateEvent'; /** Reference to the delegate that was updated */ @@ -7413,10 +7275,7 @@ export enum Transcoder_OrderBy { TranscoderDays = 'transcoderDays' } -/** - * TransferBond entities are created for every emitted TransferBond event. - * - */ +/** TransferBond entities are created for every emitted TransferBond event. */ export type TransferBondEvent = Event & { __typename: 'TransferBondEvent'; amount: Scalars['BigDecimal']; @@ -7618,10 +7477,7 @@ export enum TransferBondEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * Stake weighted treasury proposal - * - */ +/** Stake weighted treasury proposal */ export type TreasuryProposal = { __typename: 'TreasuryProposal'; /** Total weight of abstaining votes */ @@ -7653,10 +7509,7 @@ export type TreasuryProposal = { }; -/** - * Stake weighted treasury proposal - * - */ +/** Stake weighted treasury proposal */ export type TreasuryProposalVotesArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -7806,10 +7659,7 @@ export enum TreasuryProposal_OrderBy { Votes = 'votes' } -/** - * Stake weighted vote on a treasury proposal - * - */ +/** Stake weighted vote on a treasury proposal */ export type TreasuryVote = { __typename: 'TreasuryVote'; /** Proposal ID + voter address */ @@ -7826,10 +7676,7 @@ export type TreasuryVote = { weight: Scalars['BigDecimal']; }; -/** - * TreasuryVoteEvent entities are created for every emitted VoteCast/VoteCastWithParams event. - * - */ +/** TreasuryVoteEvent entities are created for every emitted VoteCast/VoteCastWithParams event. */ export type TreasuryVoteEvent = Event & { __typename: 'TreasuryVoteEvent'; /** Ethereum transaction hash + event log index */ @@ -8152,10 +7999,7 @@ export enum TreasuryVote_OrderBy { Weight = 'weight' } -/** - * UnbondEvent entities are created for every emitted Unbond event. - * - */ +/** UnbondEvent entities are created for every emitted Unbond event. */ export type UnbondEvent = Event & { __typename: 'UnbondEvent'; /** Amount unbonded in the transaction */ @@ -8372,10 +8216,7 @@ export enum UnbondEvent_OrderBy { WithdrawRound = 'withdrawRound' } -/** - * Get an unbonding lock for a delegator - * - */ +/** Get an unbonding lock for a delegator */ export type UnbondingLock = { __typename: 'UnbondingLock'; /** Amount being unbonded */ @@ -8531,10 +8372,7 @@ export enum UnbondingLock_OrderBy { WithdrawRound = 'withdrawRound' } -/** - * UnpauseEvent entities are created for every emitted Unpause event. - * - */ +/** UnpauseEvent entities are created for every emitted Unpause event. */ export type UnpauseEvent = Event & { __typename: 'UnpauseEvent'; /** Ethereum transaction hash + event log index */ @@ -8644,10 +8482,7 @@ export enum UnpauseEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * Vote data - * - */ +/** Vote data */ export type Vote = { __typename: 'Vote'; /** Vote choice */ @@ -8666,10 +8501,7 @@ export type Vote = { voter: Scalars['String']; }; -/** - * VoteEvent entities are created for every emitted Vote event. - * - */ +/** VoteEvent entities are created for every emitted Vote event. */ export type VoteEvent = Event & { __typename: 'VoteEvent'; /** Voter choice. Zero means yes and one means no */ @@ -8937,10 +8769,7 @@ export enum Vote_OrderBy { Voter = 'voter' } -/** - * WinningTicketRedeemedEvent entities are created for every emitted WinningTicketRedeemed event. - * - */ +/** WinningTicketRedeemedEvent entities are created for every emitted WinningTicketRedeemed event. */ export type WinningTicketRedeemedEvent = Event & { __typename: 'WinningTicketRedeemedEvent'; /** Auxilary data included in ticket used for additional validation */ @@ -9194,10 +9023,7 @@ export enum WinningTicketRedeemedEvent_OrderBy { WinProb = 'winProb' } -/** - * WithdrawFeesEvent entities are created for every emitted WithdrawFees event. - * - */ +/** WithdrawFeesEvent entities are created for every emitted WithdrawFees event. */ export type WithdrawFeesEvent = Event & { __typename: 'WithdrawFeesEvent'; /** Amount of fees withdrawn */ @@ -9373,10 +9199,7 @@ export enum WithdrawFeesEvent_OrderBy { TransactionTo = 'transaction__to' } -/** - * WithdrawStakeEvent entities are created for every emitted WithdrawStake event. - * - */ +/** WithdrawStakeEvent entities are created for every emitted WithdrawStake event. */ export type WithdrawStakeEvent = Event & { __typename: 'WithdrawStakeEvent'; /** Amount of stake withdrawn */ @@ -9540,10 +9363,7 @@ export enum WithdrawStakeEvent_OrderBy { UnbondingLockId = 'unbondingLockId' } -/** - * WithdrawalEvent entities are created for every emitted Withdrawal event. - * - */ +/** WithdrawalEvent entities are created for every emitted Withdrawal event. */ export type WithdrawalEvent = Event & { __typename: 'WithdrawalEvent'; /** Deposit amount withdrawn */ @@ -9729,7 +9549,6 @@ export type _Meta_ = { * will be null if the _meta field has a block constraint that asks for * a block number. It will be filled if the _meta field has no block constraint * and therefore asks for the latest block - * */ block: _Block_; /** The deployment ID */