diff --git a/apps/dispatcher/src/services/triggers/vote-confirmation-trigger.service.ts b/apps/dispatcher/src/services/triggers/vote-confirmation-trigger.service.ts index 19e21e0d..10420415 100644 --- a/apps/dispatcher/src/services/triggers/vote-confirmation-trigger.service.ts +++ b/apps/dispatcher/src/services/triggers/vote-confirmation-trigger.service.ts @@ -169,7 +169,7 @@ export class VoteConfirmationTriggerHandler extends BaseTriggerHandler p.daoId === config.headers['anticapture-dao-id']); } return Promise.resolve({ - data: { data: { offchainProposals: { items: filtered.map(p => ({ id: p.id, title: p.title, discussion: p.discussion, state: p.state, created: p.created })), totalCount: filtered.length } } } + data: { data: { offchainProposals: { items: filtered.map(p => ({ id: p.id, title: p.title, discussion: p.discussion, link: p.link, state: p.state, created: p.created })), totalCount: filtered.length } } } }); } diff --git a/apps/logic-system/src/app.ts b/apps/logic-system/src/app.ts index fd7d1d36..d43c12b3 100644 --- a/apps/logic-system/src/app.ts +++ b/apps/logic-system/src/app.ts @@ -7,6 +7,7 @@ import { VotingReminderTrigger } from './triggers/voting-reminder-trigger'; import { ProposalRepository } from './repositories/proposal.repository'; import { OffchainProposalRepository } from './repositories/offchain-proposal.repository'; import { VotingPowerRepository } from './repositories/voting-power.repository'; +import { ThresholdRepository } from './repositories/threshold.repository'; import { VotesRepository } from './repositories/votes.repository'; import { RabbitMQDispatcherService } from './api-clients/rabbitmq-dispatcher.service'; import { AnticaptureClient } from '@notification-system/anticapture-client'; @@ -41,9 +42,10 @@ export class App { const proposalRepository = new ProposalRepository(anticaptureClient); const offchainProposalRepository = new OffchainProposalRepository(anticaptureClient); const votingPowerRepository = new VotingPowerRepository(anticaptureClient); + const thresholdRepository = new ThresholdRepository(anticaptureClient); const votesRepository = new VotesRepository(anticaptureClient); - this.initPromise = this.initializeRabbitMQ(rabbitmqUrl, proposalRepository, offchainProposalRepository, votingPowerRepository, votesRepository, triggerInterval, initialTimestamp); + this.initPromise = this.initializeRabbitMQ(rabbitmqUrl, proposalRepository, offchainProposalRepository, votingPowerRepository, thresholdRepository, votesRepository, triggerInterval, initialTimestamp); } private async initializeRabbitMQ( @@ -51,6 +53,7 @@ export class App { proposalRepository: ProposalRepository, offchainProposalRepository: OffchainProposalRepository, votingPowerRepository: VotingPowerRepository, + thresholdRepository: ThresholdRepository, votesRepository: VotesRepository, triggerInterval: number, initialTimestamp?: string @@ -78,6 +81,7 @@ export class App { this.votingPowerTrigger = new VotingPowerChangedTrigger( dispatcherService, votingPowerRepository, + thresholdRepository, triggerInterval ); diff --git a/apps/logic-system/src/repositories/threshold.repository.ts b/apps/logic-system/src/repositories/threshold.repository.ts new file mode 100644 index 00000000..4f3e7787 --- /dev/null +++ b/apps/logic-system/src/repositories/threshold.repository.ts @@ -0,0 +1,46 @@ +import { + AnticaptureClient, + FeedEventType, + FeedRelevance +} from '@notification-system/anticapture-client'; + +interface CacheEntry { + value: string; + fetchedAt: number; +} + +const ONE_DAY_MS = 86_400_000; + +export class ThresholdRepository { + private cache = new Map(); + + constructor( + private readonly anticaptureClient: AnticaptureClient, + private readonly cacheTtlMs: number = ONE_DAY_MS + ) {} + + async getThreshold(daoId: string, type: FeedEventType): Promise { + const cacheKey = `${daoId}:${type}`; + const cached = this.cache.get(cacheKey); + + if (cached && Date.now() - cached.fetchedAt < this.cacheTtlMs) { + return cached.value; + } + + try { + const threshold = await this.anticaptureClient.getEventThreshold(daoId, type, FeedRelevance.High); + + if (threshold !== null) { + this.cache.set(cacheKey, { value: threshold, fetchedAt: Date.now() }); + } + + return threshold; + } catch (error) { + console.warn( + `[ThresholdRepository] Error fetching threshold for ${daoId}/${type}:`, + error instanceof Error ? error.message : error + ); + return null; + } + } +} diff --git a/apps/logic-system/src/triggers/voting-power-changed-trigger.ts b/apps/logic-system/src/triggers/voting-power-changed-trigger.ts index 70961b3f..0b047ac3 100644 --- a/apps/logic-system/src/triggers/voting-power-changed-trigger.ts +++ b/apps/logic-system/src/triggers/voting-power-changed-trigger.ts @@ -5,8 +5,9 @@ import { Trigger } from './base-trigger'; import { VotingPowerRepository } from '../repositories/voting-power.repository'; +import { ThresholdRepository } from '../repositories/threshold.repository'; import { DispatcherService, DispatcherMessage } from '../interfaces/dispatcher.interface'; -import { ProcessedVotingPowerHistory } from '@notification-system/anticapture-client'; +import { ProcessedVotingPowerHistory, FeedEventType } from '@notification-system/anticapture-client'; const triggerId = 'voting-power-changed'; @@ -16,6 +17,7 @@ export class VotingPowerChangedTrigger extends Trigger = { triggerId: this.id, - events: data + events: filtered }; await this.dispatcherService.sendMessage(message); + } - // Update the last processed timestamp to the most recent timestamp + 1 second - // Since data comes ordered by timestamp asc, the last item has the latest timestamp - // Adding 1 avoids reprocessing the same event since the API uses >= (gte) for fromDate - this.lastProcessedTimestamp = String(Number(data[data.length - 1].timestamp) + 1); + private async filterByThreshold( + data: ProcessedVotingPowerHistory[] + ): Promise { + const keep = await Promise.all( + data.map(async (event) => { + const type = event.changeType.toUpperCase(); + if (!Object.values(FeedEventType).includes(type as FeedEventType)) return true; + + const threshold = await this.thresholdRepository.getThreshold(event.daoId, type as FeedEventType); + return threshold === null || Math.abs(Number(event.delta)) >= Number(threshold); + }) + ); + + return data.filter((_, i) => keep[i]); } /** diff --git a/apps/logic-system/tests/mocks.ts b/apps/logic-system/tests/mocks.ts index 6a809d36..079796de 100644 --- a/apps/logic-system/tests/mocks.ts +++ b/apps/logic-system/tests/mocks.ts @@ -105,6 +105,13 @@ export const createMockVotingPowerRepository = () => ({ listVotingPowerHistory: jest.fn() }); +/** + * Creates a mocked ThresholdRepository + */ +export const createMockThresholdRepository = () => ({ + getThreshold: jest.fn<() => Promise>() +}); + // Sample voting power data for tests export const mockVotingPowerData = [ createVotingPowerHistory(), diff --git a/apps/logic-system/tests/threshold-repository.test.ts b/apps/logic-system/tests/threshold-repository.test.ts new file mode 100644 index 00000000..8565adb4 --- /dev/null +++ b/apps/logic-system/tests/threshold-repository.test.ts @@ -0,0 +1,102 @@ +import { describe, it, expect, jest, beforeEach } from '@jest/globals'; +import { ThresholdRepository } from '../src/repositories/threshold.repository'; +import { FeedEventType, FeedRelevance } from '@notification-system/anticapture-client'; + +const createMockAnticaptureClient = () => ({ + getEventThreshold: jest.fn<() => Promise>() +}); + +describe('ThresholdRepository', () => { + let repository: ThresholdRepository; + let mockClient: ReturnType; + + beforeEach(() => { + jest.clearAllMocks(); + mockClient = createMockAnticaptureClient(); + repository = new ThresholdRepository(mockClient as any, 300_000); + }); + + describe('getThreshold', () => { + it('should fetch threshold from client on cache miss', async () => { + mockClient.getEventThreshold.mockResolvedValue('40000000000000000000000'); + + const result = await repository.getThreshold('ENS', FeedEventType.Delegation); + + expect(result).toBe('40000000000000000000000'); + expect(mockClient.getEventThreshold).toHaveBeenCalledWith( + 'ENS', FeedEventType.Delegation, FeedRelevance.High + ); + }); + + it('should return cached value on cache hit', async () => { + mockClient.getEventThreshold.mockResolvedValue('40000000000000000000000'); + + await repository.getThreshold('ENS', FeedEventType.Delegation); + const result = await repository.getThreshold('ENS', FeedEventType.Delegation); + + expect(result).toBe('40000000000000000000000'); + expect(mockClient.getEventThreshold).toHaveBeenCalledTimes(1); + }); + + it('should cache separately per daoId and type', async () => { + mockClient.getEventThreshold + .mockResolvedValueOnce('1000') + .mockResolvedValueOnce('2000') + .mockResolvedValueOnce('3000'); + + const r1 = await repository.getThreshold('ENS', FeedEventType.Delegation); + const r2 = await repository.getThreshold('ENS', FeedEventType.Transfer); + const r3 = await repository.getThreshold('UNISWAP', FeedEventType.Delegation); + + expect(r1).toBe('1000'); + expect(r2).toBe('2000'); + expect(r3).toBe('3000'); + expect(mockClient.getEventThreshold).toHaveBeenCalledTimes(3); + }); + + it('should refetch after TTL expires', async () => { + const shortTtlRepo = new ThresholdRepository(mockClient as any, 100); + mockClient.getEventThreshold + .mockResolvedValueOnce('1000') + .mockResolvedValueOnce('2000'); + + const r1 = await shortTtlRepo.getThreshold('ENS', FeedEventType.Delegation); + expect(r1).toBe('1000'); + + await new Promise(resolve => setTimeout(resolve, 150)); + + const r2 = await shortTtlRepo.getThreshold('ENS', FeedEventType.Delegation); + expect(r2).toBe('2000'); + expect(mockClient.getEventThreshold).toHaveBeenCalledTimes(2); + }); + + it('should return null when client returns null (fail-open)', async () => { + mockClient.getEventThreshold.mockResolvedValue(null); + + const result = await repository.getThreshold('ENS', FeedEventType.Delegation); + + expect(result).toBeNull(); + }); + + it('should not cache null responses', async () => { + mockClient.getEventThreshold + .mockResolvedValueOnce(null) + .mockResolvedValueOnce('5000'); + + const r1 = await repository.getThreshold('ENS', FeedEventType.Delegation); + const r2 = await repository.getThreshold('ENS', FeedEventType.Delegation); + + expect(r1).toBeNull(); + expect(r2).toBe('5000'); + expect(mockClient.getEventThreshold).toHaveBeenCalledTimes(2); + }); + + it('should return null when client throws (fail-open)', async () => { + mockClient.getEventThreshold.mockRejectedValue(new Error('Network error')); + + const result = await repository.getThreshold('ENS', FeedEventType.Delegation); + + expect(result).toBeNull(); + }); + }); +}); diff --git a/apps/logic-system/tests/voting-power-trigger.test.ts b/apps/logic-system/tests/voting-power-trigger.test.ts index 13d402b5..1e746d04 100644 --- a/apps/logic-system/tests/voting-power-trigger.test.ts +++ b/apps/logic-system/tests/voting-power-trigger.test.ts @@ -4,20 +4,24 @@ import { describe, it, expect, jest, beforeEach } from '@jest/globals'; import { VotingPowerChangedTrigger } from '../src/triggers/voting-power-changed-trigger'; -import { createMockDispatcherService, createMockVotingPowerRepository, mockVotingPowerData } from './mocks'; +import { createMockDispatcherService, createMockVotingPowerRepository, createMockThresholdRepository, createVotingPowerHistory, mockVotingPowerData } from './mocks'; describe('VotingPowerChangedTrigger', () => { let trigger: VotingPowerChangedTrigger; let mockDispatcherService: ReturnType; let mockVotingPowerRepository: ReturnType; + let mockThresholdRepository: ReturnType; beforeEach(() => { jest.clearAllMocks(); mockDispatcherService = createMockDispatcherService(); mockVotingPowerRepository = createMockVotingPowerRepository(); + mockThresholdRepository = createMockThresholdRepository(); + mockThresholdRepository.getThreshold.mockResolvedValue(null); trigger = new VotingPowerChangedTrigger( mockDispatcherService, mockVotingPowerRepository as any, + mockThresholdRepository as any, 5000 // 5 second interval for testing ); }); @@ -27,6 +31,7 @@ describe('VotingPowerChangedTrigger', () => { const trigger2 = new VotingPowerChangedTrigger( createMockDispatcherService(), createMockVotingPowerRepository() as any, + createMockThresholdRepository() as any, 5000 ); @@ -139,9 +144,97 @@ describe('VotingPowerChangedTrigger', () => { }); it('should handle dispatcher errors gracefully', async () => { + mockThresholdRepository.getThreshold.mockResolvedValue(null); mockDispatcherService.sendMessage.mockRejectedValue(new Error('Dispatcher Error')); await expect(trigger.process(mockVotingPowerData)).rejects.toThrow('Dispatcher Error'); }); }); + + describe('Threshold Filtering', () => { + it('should drop delegation events below threshold', async () => { + mockThresholdRepository.getThreshold.mockResolvedValue('500'); + + const events = [ + createVotingPowerHistory({ delta: '100', changeType: 'delegation', timestamp: '1000' }), + createVotingPowerHistory({ delta: '600', changeType: 'delegation', timestamp: '1001' }), + ]; + + await trigger.process(events); + + expect(mockDispatcherService.sendMessage).toHaveBeenCalledWith({ + triggerId: 'voting-power-changed', + events: [events[1]] + }); + }); + + it('should drop transfer events below threshold', async () => { + mockThresholdRepository.getThreshold.mockResolvedValue('200'); + + const events = [ + createVotingPowerHistory({ + delta: '50', changeType: 'transfer', timestamp: '1000', + delegation: null, + transfer: { from: '0x1', to: '0x2', value: '50' } + }), + createVotingPowerHistory({ + delta: '300', changeType: 'transfer', timestamp: '1001', + delegation: null, + transfer: { from: '0x1', to: '0x2', value: '300' } + }), + ]; + + await trigger.process(events); + + expect(mockDispatcherService.sendMessage).toHaveBeenCalledWith({ + triggerId: 'voting-power-changed', + events: [events[1]] + }); + }); + + it('should use abs(delta) for negative deltas', async () => { + mockThresholdRepository.getThreshold.mockResolvedValue('200'); + + const events = [ + createVotingPowerHistory({ delta: '-300', changeType: 'delegation', timestamp: '1000' }), + createVotingPowerHistory({ delta: '-50', changeType: 'delegation', timestamp: '1001' }), + ]; + + await trigger.process(events); + + expect(mockDispatcherService.sendMessage).toHaveBeenCalledWith({ + triggerId: 'voting-power-changed', + events: [events[0]] + }); + }); + + it('should pass all events through when threshold is null (fail-open)', async () => { + mockThresholdRepository.getThreshold.mockResolvedValue(null); + + const events = [ + createVotingPowerHistory({ delta: '1', changeType: 'delegation', timestamp: '1000' }), + ]; + + await trigger.process(events); + + expect(mockDispatcherService.sendMessage).toHaveBeenCalledWith({ + triggerId: 'voting-power-changed', + events + }); + }); + + it('should always advance timestamp even when all events are filtered', async () => { + mockThresholdRepository.getThreshold.mockResolvedValue('99999999'); + + const events = [ + createVotingPowerHistory({ delta: '1', changeType: 'delegation', timestamp: '5000' }), + createVotingPowerHistory({ delta: '2', changeType: 'delegation', timestamp: '6000' }), + ]; + + await trigger.process(events); + + expect(mockDispatcherService.sendMessage).not.toHaveBeenCalled(); + expect((trigger as any).lastProcessedTimestamp).toBe('6001'); + }); + }); }); \ No newline at end of file diff --git a/packages/anticapture-client/dist/anticapture-client.d.ts b/packages/anticapture-client/dist/anticapture-client.d.ts index 7538f872..087a62d2 100644 --- a/packages/anticapture-client/dist/anticapture-client.d.ts +++ b/packages/anticapture-client/dist/anticapture-client.d.ts @@ -1,8 +1,7 @@ import { AxiosInstance } from 'axios'; import { z } from 'zod'; import type { GetProposalByIdQuery, ListProposalsQuery, ListProposalsQueryVariables, ListHistoricalVotingPowerQueryVariables, ListVotesQuery, ListVotesQueryVariables, ListOffchainProposalsQueryVariables } from './gql/graphql'; -import { SafeProposalNonVotersResponseSchema, ProcessedVotingPowerHistory } from './schemas'; -import type { OffchainProposalItem } from './schemas'; +import { SafeProposalNonVotersResponseSchema, ProcessedVotingPowerHistory, FeedEventType, FeedRelevance, OffchainProposalItem } from './schemas'; type ProposalItems = NonNullable['items']; type VotingPowerHistoryItems = ProcessedVotingPowerHistory[]; type ProposalNonVoter = z.infer['proposalNonVoters']['items'][0]; @@ -76,11 +75,11 @@ export declare class AnticaptureClient { */ listRecentVotesFromAllDaos(timestampGt: string, limit?: number): Promise; /** - * Lists offchain (Snapshot) proposals from all DAOs or a specific DAO - * @param variables Query variables (skip, limit, orderDirection, status, fromDate) - * @param daoId Optional specific DAO ID. If not provided, queries all DAOs - * @returns Array of offchain proposal items with daoId attached + * Fetches the event relevance threshold for a given DAO, event type, and relevance level. + * Used to filter out low-impact events (e.g., small delegation changes). + * @returns Threshold as a numeric string, or null if unavailable (fail-open) */ + getEventThreshold(daoId: string, type: FeedEventType, relevance: FeedRelevance): Promise; listOffchainProposals(variables?: ListOffchainProposalsQueryVariables, daoId?: string): Promise<(OffchainProposalItem & { daoId: string; })[]>; diff --git a/packages/anticapture-client/dist/anticapture-client.js b/packages/anticapture-client/dist/anticapture-client.js index edce5364..eb8924db 100644 --- a/packages/anticapture-client/dist/anticapture-client.js +++ b/packages/anticapture-client/dist/anticapture-client.js @@ -225,7 +225,7 @@ class AnticaptureClient { async listVotes(daoId, variables) { try { const validated = await this.query(graphql_2.ListVotesDocument, schemas_1.SafeVotesResponseSchema, variables, daoId); - return validated.votes.items.filter((item) => item !== null); + return validated.votes.items.filter(item => item !== null); } catch (error) { console.warn(`Error fetching votes for DAO ${daoId}:`, error); @@ -292,6 +292,22 @@ class AnticaptureClient { return allVotes; } /** + * Fetches the event relevance threshold for a given DAO, event type, and relevance level. + * Used to filter out low-impact events (e.g., small delegation changes). + * @returns Threshold as a numeric string, or null if unavailable (fail-open) + */ + async getEventThreshold(daoId, type, relevance) { + try { + const validated = await this.query(graphql_2.GetEventRelevanceThresholdDocument, schemas_1.EventThresholdResponseSchema, { type, relevance }, daoId); + return validated.getEventRelevanceThreshold.threshold; + } + catch (error) { + console.warn(`[AnticaptureClient] Error fetching threshold for ${daoId}/${type}:`, error instanceof Error ? error.message : error); + return null; + } + } + ; + /* * Lists offchain (Snapshot) proposals from all DAOs or a specific DAO * @param variables Query variables (skip, limit, orderDirection, status, fromDate) * @param daoId Optional specific DAO ID. If not provided, queries all DAOs diff --git a/packages/anticapture-client/dist/gql/gql.d.ts b/packages/anticapture-client/dist/gql/gql.d.ts index bd814514..b033562d 100644 --- a/packages/anticapture-client/dist/gql/gql.d.ts +++ b/packages/anticapture-client/dist/gql/gql.d.ts @@ -16,6 +16,7 @@ type Documents = { "query ListOffchainProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_offchainProposals_orderDirection, $status: JSON, $fromDate: Float) {\n offchainProposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n ) {\n items {\n id\n title\n discussion\n link\n state\n created\n }\n totalCount\n }\n}": typeof types.ListOffchainProposalsDocument; "query ProposalNonVoters($id: String!, $addresses: JSON) {\n proposalNonVoters(id: $id, addresses: $addresses) {\n items {\n voter\n }\n }\n}": typeof types.ProposalNonVotersDocument; "query GetProposalById($id: String!) {\n proposal(id: $id) {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n}\n\nquery ListProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_proposals_orderDirection, $status: JSON, $fromDate: Float, $fromEndDate: Float, $includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals) {\n proposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n fromEndDate: $fromEndDate\n includeOptimisticProposals: $includeOptimisticProposals\n ) {\n items {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n totalCount\n }\n}": typeof types.GetProposalByIdDocument; + "query GetEventRelevanceThreshold($relevance: queryInput_getEventRelevanceThreshold_relevance!, $type: queryInput_getEventRelevanceThreshold_type!) {\n getEventRelevanceThreshold(relevance: $relevance, type: $type) {\n threshold\n }\n}": typeof types.GetEventRelevanceThresholdDocument; "query ListVotes($voterAddressIn: JSON, $fromDate: Float, $toDate: Float, $limit: Float, $skip: NonNegativeInt, $orderBy: queryInput_votes_orderBy, $orderDirection: queryInput_votes_orderDirection, $support: Float) {\n votes(\n voterAddressIn: $voterAddressIn\n fromDate: $fromDate\n toDate: $toDate\n limit: $limit\n skip: $skip\n orderBy: $orderBy\n orderDirection: $orderDirection\n support: $support\n ) {\n items {\n transactionHash\n proposalId\n voterAddress\n support\n votingPower\n timestamp\n reason\n proposalTitle\n }\n totalCount\n }\n}": typeof types.ListVotesDocument; "query ListHistoricalVotingPower($limit: PositiveInt, $skip: NonNegativeInt, $orderBy: queryInput_historicalVotingPower_orderBy, $orderDirection: queryInput_historicalVotingPower_orderDirection, $fromDate: String, $address: String) {\n historicalVotingPower(\n limit: $limit\n skip: $skip\n orderBy: $orderBy\n orderDirection: $orderDirection\n fromDate: $fromDate\n address: $address\n ) {\n items {\n accountId\n timestamp\n votingPower\n delta\n daoId\n transactionHash\n logIndex\n delegation {\n from\n to\n value\n previousDelegate\n }\n transfer {\n from\n to\n value\n }\n }\n totalCount\n }\n}": typeof types.ListHistoricalVotingPowerDocument; }; @@ -49,6 +50,10 @@ export declare function graphql(source: "query ProposalNonVoters($id: String!, $ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export declare function graphql(source: "query GetProposalById($id: String!) {\n proposal(id: $id) {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n}\n\nquery ListProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_proposals_orderDirection, $status: JSON, $fromDate: Float, $fromEndDate: Float, $includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals) {\n proposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n fromEndDate: $fromEndDate\n includeOptimisticProposals: $includeOptimisticProposals\n ) {\n items {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n totalCount\n }\n}"): (typeof documents)["query GetProposalById($id: String!) {\n proposal(id: $id) {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n}\n\nquery ListProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_proposals_orderDirection, $status: JSON, $fromDate: Float, $fromEndDate: Float, $includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals) {\n proposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n fromEndDate: $fromEndDate\n includeOptimisticProposals: $includeOptimisticProposals\n ) {\n items {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n totalCount\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export declare function graphql(source: "query GetEventRelevanceThreshold($relevance: queryInput_getEventRelevanceThreshold_relevance!, $type: queryInput_getEventRelevanceThreshold_type!) {\n getEventRelevanceThreshold(relevance: $relevance, type: $type) {\n threshold\n }\n}"): (typeof documents)["query GetEventRelevanceThreshold($relevance: queryInput_getEventRelevanceThreshold_relevance!, $type: queryInput_getEventRelevanceThreshold_type!) {\n getEventRelevanceThreshold(relevance: $relevance, type: $type) {\n threshold\n }\n}"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/packages/anticapture-client/dist/gql/gql.js b/packages/anticapture-client/dist/gql/gql.js index 59e9b9f7..ecc698c6 100644 --- a/packages/anticapture-client/dist/gql/gql.js +++ b/packages/anticapture-client/dist/gql/gql.js @@ -41,6 +41,7 @@ const documents = { "query ListOffchainProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_offchainProposals_orderDirection, $status: JSON, $fromDate: Float) {\n offchainProposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n ) {\n items {\n id\n title\n discussion\n link\n state\n created\n }\n totalCount\n }\n}": types.ListOffchainProposalsDocument, "query ProposalNonVoters($id: String!, $addresses: JSON) {\n proposalNonVoters(id: $id, addresses: $addresses) {\n items {\n voter\n }\n }\n}": types.ProposalNonVotersDocument, "query GetProposalById($id: String!) {\n proposal(id: $id) {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n}\n\nquery ListProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_proposals_orderDirection, $status: JSON, $fromDate: Float, $fromEndDate: Float, $includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals) {\n proposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n fromEndDate: $fromEndDate\n includeOptimisticProposals: $includeOptimisticProposals\n ) {\n items {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n totalCount\n }\n}": types.GetProposalByIdDocument, + "query GetEventRelevanceThreshold($relevance: queryInput_getEventRelevanceThreshold_relevance!, $type: queryInput_getEventRelevanceThreshold_type!) {\n getEventRelevanceThreshold(relevance: $relevance, type: $type) {\n threshold\n }\n}": types.GetEventRelevanceThresholdDocument, "query ListVotes($voterAddressIn: JSON, $fromDate: Float, $toDate: Float, $limit: Float, $skip: NonNegativeInt, $orderBy: queryInput_votes_orderBy, $orderDirection: queryInput_votes_orderDirection, $support: Float) {\n votes(\n voterAddressIn: $voterAddressIn\n fromDate: $fromDate\n toDate: $toDate\n limit: $limit\n skip: $skip\n orderBy: $orderBy\n orderDirection: $orderDirection\n support: $support\n ) {\n items {\n transactionHash\n proposalId\n voterAddress\n support\n votingPower\n timestamp\n reason\n proposalTitle\n }\n totalCount\n }\n}": types.ListVotesDocument, "query ListHistoricalVotingPower($limit: PositiveInt, $skip: NonNegativeInt, $orderBy: queryInput_historicalVotingPower_orderBy, $orderDirection: queryInput_historicalVotingPower_orderDirection, $fromDate: String, $address: String) {\n historicalVotingPower(\n limit: $limit\n skip: $skip\n orderBy: $orderBy\n orderDirection: $orderDirection\n fromDate: $fromDate\n address: $address\n ) {\n items {\n accountId\n timestamp\n votingPower\n delta\n daoId\n transactionHash\n logIndex\n delegation {\n from\n to\n value\n previousDelegate\n }\n transfer {\n from\n to\n value\n }\n }\n totalCount\n }\n}": types.ListHistoricalVotingPowerDocument, }; diff --git a/packages/anticapture-client/dist/gql/graphql.d.ts b/packages/anticapture-client/dist/gql/graphql.d.ts index 12c94066..5283b599 100644 --- a/packages/anticapture-client/dist/gql/graphql.d.ts +++ b/packages/anticapture-client/dist/gql/graphql.d.ts @@ -149,7 +149,7 @@ export type Query = { daos: DaoList; /** Get delegation percentage day buckets with forward-fill */ delegationPercentageByDay?: Maybe; - /** Get current delegators of an account */ + /** Get current delegations for an account */ delegations?: Maybe; /** Get current delegators of an account with voting power */ delegators?: Maybe; @@ -161,6 +161,8 @@ export type Query = { getAddresses?: Maybe; /** Get historical DAO Token Treasury value (governance token quantity × token price) */ getDaoTokenTreasury?: Maybe; + /** Get event relevance threshold */ + getEventRelevanceThreshold?: Maybe; /** Get historical Liquid Treasury (treasury without DAO tokens) from external providers (DefiLlama/Dune) */ getLiquidTreasury?: Maybe; /** Get historical Total Treasury (liquid treasury + DAO token treasury) */ @@ -216,6 +218,8 @@ export type Query = { }; export type QueryAccountBalanceByAccountIdArgs = { address: Scalars['String']['input']; + fromDate?: InputMaybe; + toDate?: InputMaybe; }; export type QueryAccountBalanceVariationsArgs = { addresses?: InputMaybe; @@ -233,10 +237,13 @@ export type QueryAccountBalanceVariationsByAccountIdArgs = { export type QueryAccountBalancesArgs = { addresses?: InputMaybe; delegates?: InputMaybe; + fromDate?: InputMaybe; fromValue?: InputMaybe; limit?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; + toDate?: InputMaybe; toValue?: InputMaybe; }; export type QueryAccountInteractionsArgs = { @@ -330,6 +337,10 @@ export type QueryGetDaoTokenTreasuryArgs = { days?: InputMaybe; order?: InputMaybe; }; +export type QueryGetEventRelevanceThresholdArgs = { + relevance: QueryInput_GetEventRelevanceThreshold_Relevance; + type: QueryInput_GetEventRelevanceThreshold_Type; +}; export type QueryGetLiquidTreasuryArgs = { days?: InputMaybe; order?: InputMaybe; @@ -505,6 +516,8 @@ export type QueryVotesOffchainByProposalIdArgs = { }; export type QueryVotingPowerByAccountIdArgs = { accountId: Scalars['String']['input']; + fromDate?: InputMaybe; + toDate?: InputMaybe; }; export type QueryVotingPowerVariationsArgs = { addresses?: InputMaybe; @@ -521,21 +534,19 @@ export type QueryVotingPowerVariationsByAccountIdArgs = { }; export type QueryVotingPowersArgs = { addresses?: InputMaybe; + fromDate?: InputMaybe; fromValue?: InputMaybe; limit?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; + toDate?: InputMaybe; toValue?: InputMaybe; }; export type AccountBalanceByAccountId_200_Response = { __typename?: 'accountBalanceByAccountId_200_response'; - address: Scalars['String']['output']; - balance: Scalars['String']['output']; data: Query_AccountBalanceByAccountId_Data; - delegate: Scalars['String']['output']; period: Query_AccountBalanceByAccountId_Period; - tokenId: Scalars['String']['output']; }; export type AccountBalanceVariationsByAccountId_200_Response = { __typename?: 'accountBalanceVariationsByAccountId_200_response'; @@ -671,6 +682,10 @@ export type GetDaoTokenTreasury_200_Response = { /** Total number of items */ totalCount: Scalars['Float']['output']; }; +export type GetEventRelevanceThreshold_200_Response = { + __typename?: 'getEventRelevanceThreshold_200_response'; + threshold: Scalars['String']['output']; +}; export type GetLiquidTreasury_200_Response = { __typename?: 'getLiquidTreasury_200_response'; items: Array>; @@ -753,7 +768,7 @@ export type Proposal_200_Response = { status: Scalars['String']['output']; targets: Array>; timestamp: Scalars['String']['output']; - title: Scalars['String']['output']; + title?: Maybe; txHash: Scalars['String']['output']; values: Array>; }; @@ -779,6 +794,7 @@ export declare enum QueryInput_AccountBalanceVariations_OrderDirection { } export declare enum QueryInput_AccountBalances_OrderBy { Balance = "balance", + SignedVariation = "signedVariation", Variation = "variation" } export declare enum QueryInput_AccountBalances_OrderDirection { @@ -874,14 +890,6 @@ export declare enum QueryInput_DelegationPercentageByDay_OrderDirection { Asc = "asc", Desc = "desc" } -export declare enum QueryInput_Delegations_OrderBy { - Amount = "amount", - Timestamp = "timestamp" -} -export declare enum QueryInput_Delegations_OrderDirection { - Asc = "asc", - Desc = "desc" -} export declare enum QueryInput_Delegators_OrderBy { Amount = "amount", Timestamp = "timestamp" @@ -905,7 +913,6 @@ export declare enum QueryInput_FeedEvents_Relevance { } export declare enum QueryInput_FeedEvents_Type { Delegation = "DELEGATION", - DelegationVotesChanged = "DELEGATION_VOTES_CHANGED", Proposal = "PROPOSAL", ProposalExtended = "PROPOSAL_EXTENDED", Transfer = "TRANSFER", @@ -922,6 +929,18 @@ export declare enum QueryInput_GetDaoTokenTreasury_Order { Asc = "asc", Desc = "desc" } +export declare enum QueryInput_GetEventRelevanceThreshold_Relevance { + High = "HIGH", + Low = "LOW", + Medium = "MEDIUM" +} +export declare enum QueryInput_GetEventRelevanceThreshold_Type { + Delegation = "DELEGATION", + Proposal = "PROPOSAL", + ProposalExtended = "PROPOSAL_EXTENDED", + Transfer = "TRANSFER", + Vote = "VOTE" +} export declare enum QueryInput_GetLiquidTreasury_Days { '7d' = "_7d", '30d' = "_30d", @@ -1047,16 +1066,16 @@ export declare enum QueryInput_VotesByProposalId_OrderDirection { Desc = "desc" } export declare enum QueryInput_VotesOffchainByProposalId_OrderBy { - Created = "created", - Vp = "vp" + Timestamp = "timestamp", + VotingPower = "votingPower" } export declare enum QueryInput_VotesOffchainByProposalId_OrderDirection { Asc = "asc", Desc = "desc" } export declare enum QueryInput_VotesOffchain_OrderBy { - Created = "created", - Vp = "vp" + Timestamp = "timestamp", + VotingPower = "votingPower" } export declare enum QueryInput_VotesOffchain_OrderDirection { Asc = "asc", @@ -1076,6 +1095,7 @@ export declare enum QueryInput_VotingPowerVariations_OrderDirection { } export declare enum QueryInput_VotingPowers_OrderBy { DelegationsCount = "delegationsCount", + SignedVariation = "signedVariation", Variation = "variation", VotingPower = "votingPower" } @@ -1201,7 +1221,6 @@ export declare enum Query_FeedEvents_Items_Items_Relevance { } export declare enum Query_FeedEvents_Items_Items_Type { Delegation = "DELEGATION", - DelegationVotesChanged = "DELEGATION_VOTES_CHANGED", Proposal = "PROPOSAL", ProposalExtended = "PROPOSAL_EXTENDED", Transfer = "TRANSFER", @@ -1413,7 +1432,7 @@ export type Query_Proposals_Items_Items = { status: Scalars['String']['output']; targets: Array>; timestamp: Scalars['String']['output']; - title: Scalars['String']['output']; + title?: Maybe; txHash: Scalars['String']['output']; values: Array>; }; @@ -1490,10 +1509,10 @@ export type Query_Transfers_Items_Items = { export type Query_VotesByProposalId_Items_Items = { __typename?: 'query_votesByProposalId_items_items'; proposalId: Scalars['String']['output']; - proposalTitle: Scalars['String']['output']; + proposalTitle?: Maybe; reason?: Maybe; - support: Scalars['Float']['output']; - timestamp: Scalars['Float']['output']; + support?: Maybe; + timestamp: Scalars['Int']['output']; transactionHash: Scalars['String']['output']; voterAddress: Scalars['String']['output']; votingPower: Scalars['String']['output']; @@ -1506,7 +1525,7 @@ export type Query_VotesOffchainByProposalId_Items_Items = { proposalTitle: Scalars['String']['output']; reason: Scalars['String']['output']; voter: Scalars['String']['output']; - vp: Scalars['Float']['output']; + vp?: Maybe; }; export type Query_VotesOffchain_Items_Items = { __typename?: 'query_votesOffchain_items_items'; @@ -1516,15 +1535,15 @@ export type Query_VotesOffchain_Items_Items = { proposalTitle: Scalars['String']['output']; reason: Scalars['String']['output']; voter: Scalars['String']['output']; - vp: Scalars['Float']['output']; + vp?: Maybe; }; export type Query_Votes_Items_Items = { __typename?: 'query_votes_items_items'; proposalId: Scalars['String']['output']; - proposalTitle: Scalars['String']['output']; + proposalTitle?: Maybe; reason?: Maybe; - support: Scalars['Float']['output']; - timestamp: Scalars['Float']['output']; + support?: Maybe; + timestamp: Scalars['Int']['output']; transactionHash: Scalars['String']['output']; voterAddress: Scalars['String']['output']; votingPower: Scalars['String']['output']; @@ -1532,7 +1551,7 @@ export type Query_Votes_Items_Items = { export type Query_VotingPowerByAccountId_Variation = { __typename?: 'query_votingPowerByAccountId_variation'; absoluteChange: Scalars['String']['output']; - percentageChange: Scalars['Float']['output']; + percentageChange: Scalars['String']['output']; }; export type Query_VotingPowerVariationsByAccountId_Data = { __typename?: 'query_votingPowerVariationsByAccountId_data'; @@ -1572,7 +1591,7 @@ export type Query_VotingPowers_Items_Items = { export type Query_VotingPowers_Items_Items_Variation = { __typename?: 'query_votingPowers_items_items_variation'; absoluteChange: Scalars['String']['output']; - percentageChange: Scalars['Float']['output']; + percentageChange: Scalars['String']['output']; }; export declare enum Timestamp_Const { Timestamp = "timestamp" @@ -1712,7 +1731,7 @@ export type GetProposalByIdQuery = { id: string; daoId: string; proposerAccountId: string; - title: string; + title?: string | null; description: string; startBlock: number; endBlock: number; @@ -1744,7 +1763,7 @@ export type ListProposalsQuery = { id: string; daoId: string; proposerAccountId: string; - title: string; + title?: string | null; description: string; startBlock: number; endBlock: number; @@ -1758,6 +1777,17 @@ export type ListProposalsQuery = { } | null>; } | null; }; +export type GetEventRelevanceThresholdQueryVariables = Exact<{ + relevance: QueryInput_GetEventRelevanceThreshold_Relevance; + type: QueryInput_GetEventRelevanceThreshold_Type; +}>; +export type GetEventRelevanceThresholdQuery = { + __typename?: 'Query'; + getEventRelevanceThreshold?: { + __typename?: 'getEventRelevanceThreshold_200_response'; + threshold: string; + } | null; +}; export type ListVotesQueryVariables = Exact<{ voterAddressIn?: InputMaybe; fromDate?: InputMaybe; @@ -1778,11 +1808,11 @@ export type ListVotesQuery = { transactionHash: string; proposalId: string; voterAddress: string; - support: number; + support?: number | null; votingPower: string; timestamp: number; reason?: string | null; - proposalTitle: string; + proposalTitle?: string | null; } | null>; } | null; }; @@ -1829,5 +1859,6 @@ export declare const ListOffchainProposalsDocument: DocumentNode; export declare const GetProposalByIdDocument: DocumentNode; export declare const ListProposalsDocument: DocumentNode; +export declare const GetEventRelevanceThresholdDocument: DocumentNode; export declare const ListVotesDocument: DocumentNode; export declare const ListHistoricalVotingPowerDocument: DocumentNode; diff --git a/packages/anticapture-client/dist/gql/graphql.js b/packages/anticapture-client/dist/gql/graphql.js index f670e10e..2dcff416 100644 --- a/packages/anticapture-client/dist/gql/graphql.js +++ b/packages/anticapture-client/dist/gql/graphql.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.QueryInput_Token_Currency = exports.QueryInput_TokenMetrics_OrderDirection = exports.QueryInput_TokenMetrics_MetricType = exports.QueryInput_Proposals_OrderDirection = exports.QueryInput_Proposals_IncludeOptimisticProposals = exports.QueryInput_ProposalsActivity_UserVoteFilter = exports.QueryInput_ProposalsActivity_OrderDirection = exports.QueryInput_ProposalsActivity_OrderBy = exports.QueryInput_ProposalNonVoters_OrderDirection = exports.QueryInput_OffchainProposals_OrderDirection = exports.QueryInput_LastUpdate_Chart = exports.QueryInput_HistoricalVotingPower_OrderDirection = exports.QueryInput_HistoricalVotingPower_OrderBy = exports.QueryInput_HistoricalVotingPowerByAccountId_OrderDirection = exports.QueryInput_HistoricalVotingPowerByAccountId_OrderBy = exports.QueryInput_HistoricalDelegations_OrderDirection = exports.QueryInput_HistoricalBalances_OrderDirection = exports.QueryInput_HistoricalBalances_OrderBy = exports.QueryInput_GetTotalTreasury_Order = exports.QueryInput_GetTotalTreasury_Days = exports.QueryInput_GetLiquidTreasury_Order = exports.QueryInput_GetLiquidTreasury_Days = exports.QueryInput_GetDaoTokenTreasury_Order = exports.QueryInput_GetDaoTokenTreasury_Days = exports.QueryInput_FeedEvents_Type = exports.QueryInput_FeedEvents_Relevance = exports.QueryInput_FeedEvents_OrderDirection = exports.QueryInput_FeedEvents_OrderBy = exports.QueryInput_Delegators_OrderDirection = exports.QueryInput_Delegators_OrderBy = exports.QueryInput_Delegations_OrderDirection = exports.QueryInput_Delegations_OrderBy = exports.QueryInput_DelegationPercentageByDay_OrderDirection = exports.QueryInput_CompareVotes_Days = exports.QueryInput_CompareTreasury_Days = exports.QueryInput_CompareTotalSupply_Days = exports.QueryInput_CompareProposals_Days = exports.QueryInput_CompareLendingSupply_Days = exports.QueryInput_CompareDexSupply_Days = exports.QueryInput_CompareDelegatedSupply_Days = exports.QueryInput_CompareCirculatingSupply_Days = exports.QueryInput_CompareCexSupply_Days = exports.QueryInput_CompareAverageTurnout_Days = exports.QueryInput_CompareActiveSupply_Days = exports.QueryInput_AccountInteractions_OrderDirection = exports.QueryInput_AccountInteractions_OrderBy = exports.QueryInput_AccountBalances_OrderDirection = exports.QueryInput_AccountBalances_OrderBy = exports.QueryInput_AccountBalanceVariations_OrderDirection = exports.HttpMethod = void 0; -exports.ListHistoricalVotingPowerDocument = exports.ListVotesDocument = exports.ListProposalsDocument = exports.GetProposalByIdDocument = exports.ProposalNonVotersDocument = exports.ListOffchainProposalsDocument = exports.GetDaOsDocument = exports.Timestamp_Const = exports.Query_FeedEvents_Items_Items_Type = exports.Query_FeedEvents_Items_Items_Relevance = exports.QueryInput_VotingPowers_OrderDirection = exports.QueryInput_VotingPowers_OrderBy = exports.QueryInput_VotingPowerVariations_OrderDirection = exports.QueryInput_Votes_OrderDirection = exports.QueryInput_Votes_OrderBy = exports.QueryInput_VotesOffchain_OrderDirection = exports.QueryInput_VotesOffchain_OrderBy = exports.QueryInput_VotesOffchainByProposalId_OrderDirection = exports.QueryInput_VotesOffchainByProposalId_OrderBy = exports.QueryInput_VotesByProposalId_OrderDirection = exports.QueryInput_VotesByProposalId_OrderBy = exports.QueryInput_Transfers_SortOrder = exports.QueryInput_Transfers_SortBy = exports.QueryInput_Transactions_SortOrder = void 0; +exports.QueryInput_Token_Currency = exports.QueryInput_TokenMetrics_OrderDirection = exports.QueryInput_TokenMetrics_MetricType = exports.QueryInput_Proposals_OrderDirection = exports.QueryInput_Proposals_IncludeOptimisticProposals = exports.QueryInput_ProposalsActivity_UserVoteFilter = exports.QueryInput_ProposalsActivity_OrderDirection = exports.QueryInput_ProposalsActivity_OrderBy = exports.QueryInput_ProposalNonVoters_OrderDirection = exports.QueryInput_OffchainProposals_OrderDirection = exports.QueryInput_LastUpdate_Chart = exports.QueryInput_HistoricalVotingPower_OrderDirection = exports.QueryInput_HistoricalVotingPower_OrderBy = exports.QueryInput_HistoricalVotingPowerByAccountId_OrderDirection = exports.QueryInput_HistoricalVotingPowerByAccountId_OrderBy = exports.QueryInput_HistoricalDelegations_OrderDirection = exports.QueryInput_HistoricalBalances_OrderDirection = exports.QueryInput_HistoricalBalances_OrderBy = exports.QueryInput_GetTotalTreasury_Order = exports.QueryInput_GetTotalTreasury_Days = exports.QueryInput_GetLiquidTreasury_Order = exports.QueryInput_GetLiquidTreasury_Days = exports.QueryInput_GetEventRelevanceThreshold_Type = exports.QueryInput_GetEventRelevanceThreshold_Relevance = exports.QueryInput_GetDaoTokenTreasury_Order = exports.QueryInput_GetDaoTokenTreasury_Days = exports.QueryInput_FeedEvents_Type = exports.QueryInput_FeedEvents_Relevance = exports.QueryInput_FeedEvents_OrderDirection = exports.QueryInput_FeedEvents_OrderBy = exports.QueryInput_Delegators_OrderDirection = exports.QueryInput_Delegators_OrderBy = exports.QueryInput_DelegationPercentageByDay_OrderDirection = exports.QueryInput_CompareVotes_Days = exports.QueryInput_CompareTreasury_Days = exports.QueryInput_CompareTotalSupply_Days = exports.QueryInput_CompareProposals_Days = exports.QueryInput_CompareLendingSupply_Days = exports.QueryInput_CompareDexSupply_Days = exports.QueryInput_CompareDelegatedSupply_Days = exports.QueryInput_CompareCirculatingSupply_Days = exports.QueryInput_CompareCexSupply_Days = exports.QueryInput_CompareAverageTurnout_Days = exports.QueryInput_CompareActiveSupply_Days = exports.QueryInput_AccountInteractions_OrderDirection = exports.QueryInput_AccountInteractions_OrderBy = exports.QueryInput_AccountBalances_OrderDirection = exports.QueryInput_AccountBalances_OrderBy = exports.QueryInput_AccountBalanceVariations_OrderDirection = exports.HttpMethod = void 0; +exports.ListHistoricalVotingPowerDocument = exports.ListVotesDocument = exports.GetEventRelevanceThresholdDocument = exports.ListProposalsDocument = exports.GetProposalByIdDocument = exports.ProposalNonVotersDocument = exports.ListOffchainProposalsDocument = exports.GetDaOsDocument = exports.Timestamp_Const = exports.Query_FeedEvents_Items_Items_Type = exports.Query_FeedEvents_Items_Items_Relevance = exports.QueryInput_VotingPowers_OrderDirection = exports.QueryInput_VotingPowers_OrderBy = exports.QueryInput_VotingPowerVariations_OrderDirection = exports.QueryInput_Votes_OrderDirection = exports.QueryInput_Votes_OrderBy = exports.QueryInput_VotesOffchain_OrderDirection = exports.QueryInput_VotesOffchain_OrderBy = exports.QueryInput_VotesOffchainByProposalId_OrderDirection = exports.QueryInput_VotesOffchainByProposalId_OrderBy = exports.QueryInput_VotesByProposalId_OrderDirection = exports.QueryInput_VotesByProposalId_OrderBy = exports.QueryInput_Transfers_SortOrder = exports.QueryInput_Transfers_SortBy = exports.QueryInput_Transactions_SortOrder = void 0; var HttpMethod; (function (HttpMethod) { HttpMethod["Connect"] = "CONNECT"; @@ -22,6 +22,7 @@ var QueryInput_AccountBalanceVariations_OrderDirection; var QueryInput_AccountBalances_OrderBy; (function (QueryInput_AccountBalances_OrderBy) { QueryInput_AccountBalances_OrderBy["Balance"] = "balance"; + QueryInput_AccountBalances_OrderBy["SignedVariation"] = "signedVariation"; QueryInput_AccountBalances_OrderBy["Variation"] = "variation"; })(QueryInput_AccountBalances_OrderBy || (exports.QueryInput_AccountBalances_OrderBy = QueryInput_AccountBalances_OrderBy = {})); var QueryInput_AccountBalances_OrderDirection; @@ -132,16 +133,6 @@ var QueryInput_DelegationPercentageByDay_OrderDirection; QueryInput_DelegationPercentageByDay_OrderDirection["Asc"] = "asc"; QueryInput_DelegationPercentageByDay_OrderDirection["Desc"] = "desc"; })(QueryInput_DelegationPercentageByDay_OrderDirection || (exports.QueryInput_DelegationPercentageByDay_OrderDirection = QueryInput_DelegationPercentageByDay_OrderDirection = {})); -var QueryInput_Delegations_OrderBy; -(function (QueryInput_Delegations_OrderBy) { - QueryInput_Delegations_OrderBy["Amount"] = "amount"; - QueryInput_Delegations_OrderBy["Timestamp"] = "timestamp"; -})(QueryInput_Delegations_OrderBy || (exports.QueryInput_Delegations_OrderBy = QueryInput_Delegations_OrderBy = {})); -var QueryInput_Delegations_OrderDirection; -(function (QueryInput_Delegations_OrderDirection) { - QueryInput_Delegations_OrderDirection["Asc"] = "asc"; - QueryInput_Delegations_OrderDirection["Desc"] = "desc"; -})(QueryInput_Delegations_OrderDirection || (exports.QueryInput_Delegations_OrderDirection = QueryInput_Delegations_OrderDirection = {})); var QueryInput_Delegators_OrderBy; (function (QueryInput_Delegators_OrderBy) { QueryInput_Delegators_OrderBy["Amount"] = "amount"; @@ -171,7 +162,6 @@ var QueryInput_FeedEvents_Relevance; var QueryInput_FeedEvents_Type; (function (QueryInput_FeedEvents_Type) { QueryInput_FeedEvents_Type["Delegation"] = "DELEGATION"; - QueryInput_FeedEvents_Type["DelegationVotesChanged"] = "DELEGATION_VOTES_CHANGED"; QueryInput_FeedEvents_Type["Proposal"] = "PROPOSAL"; QueryInput_FeedEvents_Type["ProposalExtended"] = "PROPOSAL_EXTENDED"; QueryInput_FeedEvents_Type["Transfer"] = "TRANSFER"; @@ -190,6 +180,20 @@ var QueryInput_GetDaoTokenTreasury_Order; QueryInput_GetDaoTokenTreasury_Order["Asc"] = "asc"; QueryInput_GetDaoTokenTreasury_Order["Desc"] = "desc"; })(QueryInput_GetDaoTokenTreasury_Order || (exports.QueryInput_GetDaoTokenTreasury_Order = QueryInput_GetDaoTokenTreasury_Order = {})); +var QueryInput_GetEventRelevanceThreshold_Relevance; +(function (QueryInput_GetEventRelevanceThreshold_Relevance) { + QueryInput_GetEventRelevanceThreshold_Relevance["High"] = "HIGH"; + QueryInput_GetEventRelevanceThreshold_Relevance["Low"] = "LOW"; + QueryInput_GetEventRelevanceThreshold_Relevance["Medium"] = "MEDIUM"; +})(QueryInput_GetEventRelevanceThreshold_Relevance || (exports.QueryInput_GetEventRelevanceThreshold_Relevance = QueryInput_GetEventRelevanceThreshold_Relevance = {})); +var QueryInput_GetEventRelevanceThreshold_Type; +(function (QueryInput_GetEventRelevanceThreshold_Type) { + QueryInput_GetEventRelevanceThreshold_Type["Delegation"] = "DELEGATION"; + QueryInput_GetEventRelevanceThreshold_Type["Proposal"] = "PROPOSAL"; + QueryInput_GetEventRelevanceThreshold_Type["ProposalExtended"] = "PROPOSAL_EXTENDED"; + QueryInput_GetEventRelevanceThreshold_Type["Transfer"] = "TRANSFER"; + QueryInput_GetEventRelevanceThreshold_Type["Vote"] = "VOTE"; +})(QueryInput_GetEventRelevanceThreshold_Type || (exports.QueryInput_GetEventRelevanceThreshold_Type = QueryInput_GetEventRelevanceThreshold_Type = {})); var QueryInput_GetLiquidTreasury_Days; (function (QueryInput_GetLiquidTreasury_Days) { QueryInput_GetLiquidTreasury_Days["7d"] = "_7d"; @@ -343,8 +347,8 @@ var QueryInput_VotesByProposalId_OrderDirection; })(QueryInput_VotesByProposalId_OrderDirection || (exports.QueryInput_VotesByProposalId_OrderDirection = QueryInput_VotesByProposalId_OrderDirection = {})); var QueryInput_VotesOffchainByProposalId_OrderBy; (function (QueryInput_VotesOffchainByProposalId_OrderBy) { - QueryInput_VotesOffchainByProposalId_OrderBy["Created"] = "created"; - QueryInput_VotesOffchainByProposalId_OrderBy["Vp"] = "vp"; + QueryInput_VotesOffchainByProposalId_OrderBy["Timestamp"] = "timestamp"; + QueryInput_VotesOffchainByProposalId_OrderBy["VotingPower"] = "votingPower"; })(QueryInput_VotesOffchainByProposalId_OrderBy || (exports.QueryInput_VotesOffchainByProposalId_OrderBy = QueryInput_VotesOffchainByProposalId_OrderBy = {})); var QueryInput_VotesOffchainByProposalId_OrderDirection; (function (QueryInput_VotesOffchainByProposalId_OrderDirection) { @@ -353,8 +357,8 @@ var QueryInput_VotesOffchainByProposalId_OrderDirection; })(QueryInput_VotesOffchainByProposalId_OrderDirection || (exports.QueryInput_VotesOffchainByProposalId_OrderDirection = QueryInput_VotesOffchainByProposalId_OrderDirection = {})); var QueryInput_VotesOffchain_OrderBy; (function (QueryInput_VotesOffchain_OrderBy) { - QueryInput_VotesOffchain_OrderBy["Created"] = "created"; - QueryInput_VotesOffchain_OrderBy["Vp"] = "vp"; + QueryInput_VotesOffchain_OrderBy["Timestamp"] = "timestamp"; + QueryInput_VotesOffchain_OrderBy["VotingPower"] = "votingPower"; })(QueryInput_VotesOffchain_OrderBy || (exports.QueryInput_VotesOffchain_OrderBy = QueryInput_VotesOffchain_OrderBy = {})); var QueryInput_VotesOffchain_OrderDirection; (function (QueryInput_VotesOffchain_OrderDirection) { @@ -379,6 +383,7 @@ var QueryInput_VotingPowerVariations_OrderDirection; var QueryInput_VotingPowers_OrderBy; (function (QueryInput_VotingPowers_OrderBy) { QueryInput_VotingPowers_OrderBy["DelegationsCount"] = "delegationsCount"; + QueryInput_VotingPowers_OrderBy["SignedVariation"] = "signedVariation"; QueryInput_VotingPowers_OrderBy["Variation"] = "variation"; QueryInput_VotingPowers_OrderBy["VotingPower"] = "votingPower"; })(QueryInput_VotingPowers_OrderBy || (exports.QueryInput_VotingPowers_OrderBy = QueryInput_VotingPowers_OrderBy = {})); @@ -396,7 +401,6 @@ var Query_FeedEvents_Items_Items_Relevance; var Query_FeedEvents_Items_Items_Type; (function (Query_FeedEvents_Items_Items_Type) { Query_FeedEvents_Items_Items_Type["Delegation"] = "DELEGATION"; - Query_FeedEvents_Items_Items_Type["DelegationVotesChanged"] = "DELEGATION_VOTES_CHANGED"; Query_FeedEvents_Items_Items_Type["Proposal"] = "PROPOSAL"; Query_FeedEvents_Items_Items_Type["ProposalExtended"] = "PROPOSAL_EXTENDED"; Query_FeedEvents_Items_Items_Type["Transfer"] = "TRANSFER"; @@ -411,5 +415,6 @@ exports.ListOffchainProposalsDocument = { "kind": "Document", "definitions": [{ exports.ProposalNonVotersDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ProposalNonVoters" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "addresses" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "JSON" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "proposalNonVoters" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "addresses" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "addresses" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "items" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "voter" } }] } }] } }] } }] }; exports.GetProposalByIdDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetProposalById" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "proposal" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "daoId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "proposerAccountId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "description" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startBlock" } }, { "kind": "Field", "name": { "kind": "Name", "value": "endBlock" } }, { "kind": "Field", "name": { "kind": "Name", "value": "endTimestamp" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timestamp" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "forVotes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "againstVotes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "abstainVotes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "txHash" } }] } }] } }] }; exports.ListProposalsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ListProposals" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "skip" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "NonNegativeInt" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "PositiveInt" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "orderDirection" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "queryInput_proposals_orderDirection" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "JSON" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "fromDate" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Float" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "fromEndDate" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Float" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "includeOptimisticProposals" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "queryInput_proposals_includeOptimisticProposals" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "proposals" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "skip" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "skip" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "orderDirection" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "orderDirection" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "status" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "status" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "fromDate" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "fromDate" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "fromEndDate" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "fromEndDate" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "includeOptimisticProposals" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "includeOptimisticProposals" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "items" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "daoId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "proposerAccountId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "description" } }, { "kind": "Field", "name": { "kind": "Name", "value": "startBlock" } }, { "kind": "Field", "name": { "kind": "Name", "value": "endBlock" } }, { "kind": "Field", "name": { "kind": "Name", "value": "endTimestamp" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timestamp" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "forVotes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "againstVotes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "abstainVotes" } }, { "kind": "Field", "name": { "kind": "Name", "value": "txHash" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalCount" } }] } }] } }] }; +exports.GetEventRelevanceThresholdDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetEventRelevanceThreshold" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "relevance" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "queryInput_getEventRelevanceThreshold_relevance" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "queryInput_getEventRelevanceThreshold_type" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "getEventRelevanceThreshold" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "relevance" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "relevance" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "type" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "threshold" } }] } }] } }] }; exports.ListVotesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ListVotes" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "voterAddressIn" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "JSON" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "fromDate" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Float" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "toDate" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Float" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Float" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "skip" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "NonNegativeInt" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "orderBy" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "queryInput_votes_orderBy" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "orderDirection" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "queryInput_votes_orderDirection" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "support" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Float" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "votes" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "voterAddressIn" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "voterAddressIn" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "fromDate" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "fromDate" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "toDate" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "toDate" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "skip" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "skip" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "orderBy" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "orderBy" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "orderDirection" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "orderDirection" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "support" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "support" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "items" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "transactionHash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "proposalId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "voterAddress" } }, { "kind": "Field", "name": { "kind": "Name", "value": "support" } }, { "kind": "Field", "name": { "kind": "Name", "value": "votingPower" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timestamp" } }, { "kind": "Field", "name": { "kind": "Name", "value": "reason" } }, { "kind": "Field", "name": { "kind": "Name", "value": "proposalTitle" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalCount" } }] } }] } }] }; exports.ListHistoricalVotingPowerDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ListHistoricalVotingPower" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "PositiveInt" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "skip" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "NonNegativeInt" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "orderBy" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "queryInput_historicalVotingPower_orderBy" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "orderDirection" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "queryInput_historicalVotingPower_orderDirection" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "fromDate" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "address" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "historicalVotingPower" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "limit" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "limit" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "skip" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "skip" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "orderBy" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "orderBy" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "orderDirection" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "orderDirection" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "fromDate" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "fromDate" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "address" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "address" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "items" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "timestamp" } }, { "kind": "Field", "name": { "kind": "Name", "value": "votingPower" } }, { "kind": "Field", "name": { "kind": "Name", "value": "delta" } }, { "kind": "Field", "name": { "kind": "Name", "value": "daoId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "transactionHash" } }, { "kind": "Field", "name": { "kind": "Name", "value": "logIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "delegation" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "from" } }, { "kind": "Field", "name": { "kind": "Name", "value": "to" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }, { "kind": "Field", "name": { "kind": "Name", "value": "previousDelegate" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "transfer" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "from" } }, { "kind": "Field", "name": { "kind": "Name", "value": "to" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "totalCount" } }] } }] } }] }; diff --git a/packages/anticapture-client/dist/index.d.ts b/packages/anticapture-client/dist/index.d.ts index 37ca6054..d741186f 100644 --- a/packages/anticapture-client/dist/index.d.ts +++ b/packages/anticapture-client/dist/index.d.ts @@ -2,4 +2,5 @@ export { AnticaptureClient } from './anticapture-client'; export type { VoteWithDaoId } from './anticapture-client'; export type { GetDaOsQuery, GetProposalByIdQuery, GetProposalByIdQueryVariables, ListProposalsQuery, ListProposalsQueryVariables, ListVotesQuery, ListVotesQueryVariables, ListHistoricalVotingPowerQuery, ListHistoricalVotingPowerQueryVariables } from './gql/graphql'; export { QueryInput_Proposals_OrderDirection, QueryInput_HistoricalVotingPower_OrderBy, QueryInput_HistoricalVotingPower_OrderDirection, QueryInput_Votes_OrderBy, QueryInput_Votes_OrderDirection } from './gql/graphql'; +export { FeedEventType, FeedRelevance } from './schemas'; export type { ProcessedVotingPowerHistory, OffchainProposalItem } from './schemas'; diff --git a/packages/anticapture-client/dist/index.js b/packages/anticapture-client/dist/index.js index 21152cc1..bd19ec5f 100644 --- a/packages/anticapture-client/dist/index.js +++ b/packages/anticapture-client/dist/index.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.QueryInput_Votes_OrderDirection = exports.QueryInput_Votes_OrderBy = exports.QueryInput_HistoricalVotingPower_OrderDirection = exports.QueryInput_HistoricalVotingPower_OrderBy = exports.QueryInput_Proposals_OrderDirection = exports.AnticaptureClient = void 0; +exports.FeedRelevance = exports.FeedEventType = exports.QueryInput_Votes_OrderDirection = exports.QueryInput_Votes_OrderBy = exports.QueryInput_HistoricalVotingPower_OrderDirection = exports.QueryInput_HistoricalVotingPower_OrderBy = exports.QueryInput_Proposals_OrderDirection = exports.AnticaptureClient = void 0; var anticapture_client_1 = require("./anticapture-client"); Object.defineProperty(exports, "AnticaptureClient", { enumerable: true, get: function () { return anticapture_client_1.AnticaptureClient; } }); // Export GraphQL enums @@ -10,3 +10,6 @@ Object.defineProperty(exports, "QueryInput_HistoricalVotingPower_OrderBy", { enu Object.defineProperty(exports, "QueryInput_HistoricalVotingPower_OrderDirection", { enumerable: true, get: function () { return graphql_1.QueryInput_HistoricalVotingPower_OrderDirection; } }); Object.defineProperty(exports, "QueryInput_Votes_OrderBy", { enumerable: true, get: function () { return graphql_1.QueryInput_Votes_OrderBy; } }); Object.defineProperty(exports, "QueryInput_Votes_OrderDirection", { enumerable: true, get: function () { return graphql_1.QueryInput_Votes_OrderDirection; } }); +var schemas_1 = require("./schemas"); +Object.defineProperty(exports, "FeedEventType", { enumerable: true, get: function () { return schemas_1.FeedEventType; } }); +Object.defineProperty(exports, "FeedRelevance", { enumerable: true, get: function () { return schemas_1.FeedRelevance; } }); diff --git a/packages/anticapture-client/dist/schemas.d.ts b/packages/anticapture-client/dist/schemas.d.ts index ecca3558..e553a4bf 100644 --- a/packages/anticapture-client/dist/schemas.d.ts +++ b/packages/anticapture-client/dist/schemas.d.ts @@ -1,4 +1,5 @@ import { z } from 'zod'; +export { QueryInput_GetEventRelevanceThreshold_Type as FeedEventType, QueryInput_GetEventRelevanceThreshold_Relevance as FeedRelevance, } from './gql/graphql'; export declare const SafeDaosResponseSchema: z.ZodEffects; +export declare const EventThresholdResponseSchema: z.ZodObject<{ + getEventRelevanceThreshold: z.ZodObject<{ + threshold: z.ZodString; + }, "strip", z.ZodTypeAny, { + threshold: string; + }, { + threshold: string; + }>; +}, "strip", z.ZodTypeAny, { + getEventRelevanceThreshold: { + threshold: string; + }; +}, { + getEventRelevanceThreshold: { + threshold: string; + }; +}>; export declare const OffchainProposalItemSchema: z.ZodObject<{ id: z.ZodString; title: z.ZodString; @@ -568,18 +586,18 @@ export declare const OffchainProposalItemSchema: z.ZodObject<{ created: z.ZodNumber; }, "strip", z.ZodTypeAny, { link: string; - created: number; id: string; title: string; discussion: string; state: string; + created: number; }, { link: string; - created: number; id: string; title: string; discussion: string; state: string; + created: number; }>; export type OffchainProposalItem = z.infer; export declare const SafeOffchainProposalsResponseSchema: z.ZodEffects>, "many">; totalCount: z.ZodNumber; }, "strip", z.ZodTypeAny, { items: ({ link: string; - created: number; id: string; title: string; discussion: string; state: string; + created: number; } | null)[]; totalCount: number; }, { items: ({ link: string; - created: number; id: string; title: string; discussion: string; state: string; + created: number; } | null)[]; totalCount: number; }>>; @@ -632,11 +650,11 @@ export declare const SafeOffchainProposalsResponseSchema: z.ZodEffects['items']; type VotingPowerHistoryItems = ProcessedVotingPowerHistory[]; type ProposalNonVoter = z.infer['proposalNonVoters']['items'][0]; @@ -251,7 +263,7 @@ export class AnticaptureClient { variables, daoId ); - return validated.votes.items.filter((item): item is VoteItem => item !== null); + return validated.votes.items.filter(item => item !== null) as VoteItem[]; } catch (error) { console.warn(`Error fetching votes for DAO ${daoId}:`, error); return []; @@ -333,6 +345,33 @@ export class AnticaptureClient { } /** + * Fetches the event relevance threshold for a given DAO, event type, and relevance level. + * Used to filter out low-impact events (e.g., small delegation changes). + * @returns Threshold as a numeric string, or null if unavailable (fail-open) + */ + async getEventThreshold( + daoId: string, + type: FeedEventType, + relevance: FeedRelevance + ): Promise { + try { + const validated = await this.query( + GetEventRelevanceThresholdDocument, + EventThresholdResponseSchema, + { type, relevance }, + daoId + ); + return validated.getEventRelevanceThreshold.threshold; + } catch (error) { + console.warn( + `[AnticaptureClient] Error fetching threshold for ${daoId}/${type}:`, + error instanceof Error ? error.message : error + ); + return null; + + } + }; + /* * Lists offchain (Snapshot) proposals from all DAOs or a specific DAO * @param variables Query variables (skip, limit, orderDirection, status, fromDate) * @param daoId Optional specific DAO ID. If not provided, queries all DAOs diff --git a/packages/anticapture-client/src/gql/gql.ts b/packages/anticapture-client/src/gql/gql.ts index 98775c49..61f4301f 100644 --- a/packages/anticapture-client/src/gql/gql.ts +++ b/packages/anticapture-client/src/gql/gql.ts @@ -18,6 +18,7 @@ type Documents = { "query ListOffchainProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_offchainProposals_orderDirection, $status: JSON, $fromDate: Float) {\n offchainProposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n ) {\n items {\n id\n title\n discussion\n link\n state\n created\n }\n totalCount\n }\n}": typeof types.ListOffchainProposalsDocument, "query ProposalNonVoters($id: String!, $addresses: JSON) {\n proposalNonVoters(id: $id, addresses: $addresses) {\n items {\n voter\n }\n }\n}": typeof types.ProposalNonVotersDocument, "query GetProposalById($id: String!) {\n proposal(id: $id) {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n}\n\nquery ListProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_proposals_orderDirection, $status: JSON, $fromDate: Float, $fromEndDate: Float, $includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals) {\n proposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n fromEndDate: $fromEndDate\n includeOptimisticProposals: $includeOptimisticProposals\n ) {\n items {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n totalCount\n }\n}": typeof types.GetProposalByIdDocument, + "query GetEventRelevanceThreshold($relevance: queryInput_getEventRelevanceThreshold_relevance!, $type: queryInput_getEventRelevanceThreshold_type!) {\n getEventRelevanceThreshold(relevance: $relevance, type: $type) {\n threshold\n }\n}": typeof types.GetEventRelevanceThresholdDocument, "query ListVotes($voterAddressIn: JSON, $fromDate: Float, $toDate: Float, $limit: Float, $skip: NonNegativeInt, $orderBy: queryInput_votes_orderBy, $orderDirection: queryInput_votes_orderDirection, $support: Float) {\n votes(\n voterAddressIn: $voterAddressIn\n fromDate: $fromDate\n toDate: $toDate\n limit: $limit\n skip: $skip\n orderBy: $orderBy\n orderDirection: $orderDirection\n support: $support\n ) {\n items {\n transactionHash\n proposalId\n voterAddress\n support\n votingPower\n timestamp\n reason\n proposalTitle\n }\n totalCount\n }\n}": typeof types.ListVotesDocument, "query ListHistoricalVotingPower($limit: PositiveInt, $skip: NonNegativeInt, $orderBy: queryInput_historicalVotingPower_orderBy, $orderDirection: queryInput_historicalVotingPower_orderDirection, $fromDate: String, $address: String) {\n historicalVotingPower(\n limit: $limit\n skip: $skip\n orderBy: $orderBy\n orderDirection: $orderDirection\n fromDate: $fromDate\n address: $address\n ) {\n items {\n accountId\n timestamp\n votingPower\n delta\n daoId\n transactionHash\n logIndex\n delegation {\n from\n to\n value\n previousDelegate\n }\n transfer {\n from\n to\n value\n }\n }\n totalCount\n }\n}": typeof types.ListHistoricalVotingPowerDocument, }; @@ -26,6 +27,7 @@ const documents: Documents = { "query ListOffchainProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_offchainProposals_orderDirection, $status: JSON, $fromDate: Float) {\n offchainProposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n ) {\n items {\n id\n title\n discussion\n link\n state\n created\n }\n totalCount\n }\n}": types.ListOffchainProposalsDocument, "query ProposalNonVoters($id: String!, $addresses: JSON) {\n proposalNonVoters(id: $id, addresses: $addresses) {\n items {\n voter\n }\n }\n}": types.ProposalNonVotersDocument, "query GetProposalById($id: String!) {\n proposal(id: $id) {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n}\n\nquery ListProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_proposals_orderDirection, $status: JSON, $fromDate: Float, $fromEndDate: Float, $includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals) {\n proposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n fromEndDate: $fromEndDate\n includeOptimisticProposals: $includeOptimisticProposals\n ) {\n items {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n totalCount\n }\n}": types.GetProposalByIdDocument, + "query GetEventRelevanceThreshold($relevance: queryInput_getEventRelevanceThreshold_relevance!, $type: queryInput_getEventRelevanceThreshold_type!) {\n getEventRelevanceThreshold(relevance: $relevance, type: $type) {\n threshold\n }\n}": types.GetEventRelevanceThresholdDocument, "query ListVotes($voterAddressIn: JSON, $fromDate: Float, $toDate: Float, $limit: Float, $skip: NonNegativeInt, $orderBy: queryInput_votes_orderBy, $orderDirection: queryInput_votes_orderDirection, $support: Float) {\n votes(\n voterAddressIn: $voterAddressIn\n fromDate: $fromDate\n toDate: $toDate\n limit: $limit\n skip: $skip\n orderBy: $orderBy\n orderDirection: $orderDirection\n support: $support\n ) {\n items {\n transactionHash\n proposalId\n voterAddress\n support\n votingPower\n timestamp\n reason\n proposalTitle\n }\n totalCount\n }\n}": types.ListVotesDocument, "query ListHistoricalVotingPower($limit: PositiveInt, $skip: NonNegativeInt, $orderBy: queryInput_historicalVotingPower_orderBy, $orderDirection: queryInput_historicalVotingPower_orderDirection, $fromDate: String, $address: String) {\n historicalVotingPower(\n limit: $limit\n skip: $skip\n orderBy: $orderBy\n orderDirection: $orderDirection\n fromDate: $fromDate\n address: $address\n ) {\n items {\n accountId\n timestamp\n votingPower\n delta\n daoId\n transactionHash\n logIndex\n delegation {\n from\n to\n value\n previousDelegate\n }\n transfer {\n from\n to\n value\n }\n }\n totalCount\n }\n}": types.ListHistoricalVotingPowerDocument, }; @@ -60,6 +62,10 @@ export function graphql(source: "query ProposalNonVoters($id: String!, $addresse * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql(source: "query GetProposalById($id: String!) {\n proposal(id: $id) {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n}\n\nquery ListProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_proposals_orderDirection, $status: JSON, $fromDate: Float, $fromEndDate: Float, $includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals) {\n proposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n fromEndDate: $fromEndDate\n includeOptimisticProposals: $includeOptimisticProposals\n ) {\n items {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n totalCount\n }\n}"): (typeof documents)["query GetProposalById($id: String!) {\n proposal(id: $id) {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n}\n\nquery ListProposals($skip: NonNegativeInt, $limit: PositiveInt, $orderDirection: queryInput_proposals_orderDirection, $status: JSON, $fromDate: Float, $fromEndDate: Float, $includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals) {\n proposals(\n skip: $skip\n limit: $limit\n orderDirection: $orderDirection\n status: $status\n fromDate: $fromDate\n fromEndDate: $fromEndDate\n includeOptimisticProposals: $includeOptimisticProposals\n ) {\n items {\n id\n daoId\n proposerAccountId\n title\n description\n startBlock\n endBlock\n endTimestamp\n timestamp\n status\n forVotes\n againstVotes\n abstainVotes\n txHash\n }\n totalCount\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query GetEventRelevanceThreshold($relevance: queryInput_getEventRelevanceThreshold_relevance!, $type: queryInput_getEventRelevanceThreshold_type!) {\n getEventRelevanceThreshold(relevance: $relevance, type: $type) {\n threshold\n }\n}"): (typeof documents)["query GetEventRelevanceThreshold($relevance: queryInput_getEventRelevanceThreshold_relevance!, $type: queryInput_getEventRelevanceThreshold_type!) {\n getEventRelevanceThreshold(relevance: $relevance, type: $type) {\n threshold\n }\n}"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/packages/anticapture-client/src/gql/graphql.ts b/packages/anticapture-client/src/gql/graphql.ts index dda90737..cb88a415 100644 --- a/packages/anticapture-client/src/gql/graphql.ts +++ b/packages/anticapture-client/src/gql/graphql.ts @@ -115,7 +115,7 @@ export type Query = { daos: DaoList; /** Get delegation percentage day buckets with forward-fill */ delegationPercentageByDay?: Maybe; - /** Get current delegators of an account */ + /** Get current delegations for an account */ delegations?: Maybe; /** Get current delegators of an account with voting power */ delegators?: Maybe; @@ -127,6 +127,8 @@ export type Query = { getAddresses?: Maybe; /** Get historical DAO Token Treasury value (governance token quantity × token price) */ getDaoTokenTreasury?: Maybe; + /** Get event relevance threshold */ + getEventRelevanceThreshold?: Maybe; /** Get historical Liquid Treasury (treasury without DAO tokens) from external providers (DefiLlama/Dune) */ getLiquidTreasury?: Maybe; /** Get historical Total Treasury (liquid treasury + DAO token treasury) */ @@ -184,6 +186,8 @@ export type Query = { export type QueryAccountBalanceByAccountIdArgs = { address: Scalars['String']['input']; + fromDate?: InputMaybe; + toDate?: InputMaybe; }; @@ -207,10 +211,13 @@ export type QueryAccountBalanceVariationsByAccountIdArgs = { export type QueryAccountBalancesArgs = { addresses?: InputMaybe; delegates?: InputMaybe; + fromDate?: InputMaybe; fromValue?: InputMaybe; limit?: InputMaybe; + orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; + toDate?: InputMaybe; toValue?: InputMaybe; }; @@ -346,6 +353,12 @@ export type QueryGetDaoTokenTreasuryArgs = { }; +export type QueryGetEventRelevanceThresholdArgs = { + relevance: QueryInput_GetEventRelevanceThreshold_Relevance; + type: QueryInput_GetEventRelevanceThreshold_Type; +}; + + export type QueryGetLiquidTreasuryArgs = { days?: InputMaybe; order?: InputMaybe; @@ -565,6 +578,8 @@ export type QueryVotesOffchainByProposalIdArgs = { export type QueryVotingPowerByAccountIdArgs = { accountId: Scalars['String']['input']; + fromDate?: InputMaybe; + toDate?: InputMaybe; }; @@ -587,22 +602,20 @@ export type QueryVotingPowerVariationsByAccountIdArgs = { export type QueryVotingPowersArgs = { addresses?: InputMaybe; + fromDate?: InputMaybe; fromValue?: InputMaybe; limit?: InputMaybe; orderBy?: InputMaybe; orderDirection?: InputMaybe; skip?: InputMaybe; + toDate?: InputMaybe; toValue?: InputMaybe; }; export type AccountBalanceByAccountId_200_Response = { __typename?: 'accountBalanceByAccountId_200_response'; - address: Scalars['String']['output']; - balance: Scalars['String']['output']; data: Query_AccountBalanceByAccountId_Data; - delegate: Scalars['String']['output']; period: Query_AccountBalanceByAccountId_Period; - tokenId: Scalars['String']['output']; }; export type AccountBalanceVariationsByAccountId_200_Response = { @@ -762,6 +775,11 @@ export type GetDaoTokenTreasury_200_Response = { totalCount: Scalars['Float']['output']; }; +export type GetEventRelevanceThreshold_200_Response = { + __typename?: 'getEventRelevanceThreshold_200_response'; + threshold: Scalars['String']['output']; +}; + export type GetLiquidTreasury_200_Response = { __typename?: 'getLiquidTreasury_200_response'; items: Array>; @@ -854,7 +872,7 @@ export type Proposal_200_Response = { status: Scalars['String']['output']; targets: Array>; timestamp: Scalars['String']['output']; - title: Scalars['String']['output']; + title?: Maybe; txHash: Scalars['String']['output']; values: Array>; }; @@ -884,6 +902,7 @@ export enum QueryInput_AccountBalanceVariations_OrderDirection { export enum QueryInput_AccountBalances_OrderBy { Balance = 'balance', + SignedVariation = 'signedVariation', Variation = 'variation' } @@ -995,16 +1014,6 @@ export enum QueryInput_DelegationPercentageByDay_OrderDirection { Desc = 'desc' } -export enum QueryInput_Delegations_OrderBy { - Amount = 'amount', - Timestamp = 'timestamp' -} - -export enum QueryInput_Delegations_OrderDirection { - Asc = 'asc', - Desc = 'desc' -} - export enum QueryInput_Delegators_OrderBy { Amount = 'amount', Timestamp = 'timestamp' @@ -1033,7 +1042,6 @@ export enum QueryInput_FeedEvents_Relevance { export enum QueryInput_FeedEvents_Type { Delegation = 'DELEGATION', - DelegationVotesChanged = 'DELEGATION_VOTES_CHANGED', Proposal = 'PROPOSAL', ProposalExtended = 'PROPOSAL_EXTENDED', Transfer = 'TRANSFER', @@ -1053,6 +1061,20 @@ export enum QueryInput_GetDaoTokenTreasury_Order { Desc = 'desc' } +export enum QueryInput_GetEventRelevanceThreshold_Relevance { + High = 'HIGH', + Low = 'LOW', + Medium = 'MEDIUM' +} + +export enum QueryInput_GetEventRelevanceThreshold_Type { + Delegation = 'DELEGATION', + Proposal = 'PROPOSAL', + ProposalExtended = 'PROPOSAL_EXTENDED', + Transfer = 'TRANSFER', + Vote = 'VOTE' +} + export enum QueryInput_GetLiquidTreasury_Days { '7d' = '_7d', '30d' = '_30d', @@ -1205,8 +1227,8 @@ export enum QueryInput_VotesByProposalId_OrderDirection { } export enum QueryInput_VotesOffchainByProposalId_OrderBy { - Created = 'created', - Vp = 'vp' + Timestamp = 'timestamp', + VotingPower = 'votingPower' } export enum QueryInput_VotesOffchainByProposalId_OrderDirection { @@ -1215,8 +1237,8 @@ export enum QueryInput_VotesOffchainByProposalId_OrderDirection { } export enum QueryInput_VotesOffchain_OrderBy { - Created = 'created', - Vp = 'vp' + Timestamp = 'timestamp', + VotingPower = 'votingPower' } export enum QueryInput_VotesOffchain_OrderDirection { @@ -1241,6 +1263,7 @@ export enum QueryInput_VotingPowerVariations_OrderDirection { export enum QueryInput_VotingPowers_OrderBy { DelegationsCount = 'delegationsCount', + SignedVariation = 'signedVariation', Variation = 'variation', VotingPower = 'votingPower' } @@ -1386,7 +1409,6 @@ export enum Query_FeedEvents_Items_Items_Relevance { export enum Query_FeedEvents_Items_Items_Type { Delegation = 'DELEGATION', - DelegationVotesChanged = 'DELEGATION_VOTES_CHANGED', Proposal = 'PROPOSAL', ProposalExtended = 'PROPOSAL_EXTENDED', Transfer = 'TRANSFER', @@ -1622,7 +1644,7 @@ export type Query_Proposals_Items_Items = { status: Scalars['String']['output']; targets: Array>; timestamp: Scalars['String']['output']; - title: Scalars['String']['output']; + title?: Maybe; txHash: Scalars['String']['output']; values: Array>; }; @@ -1706,10 +1728,10 @@ export type Query_Transfers_Items_Items = { export type Query_VotesByProposalId_Items_Items = { __typename?: 'query_votesByProposalId_items_items'; proposalId: Scalars['String']['output']; - proposalTitle: Scalars['String']['output']; + proposalTitle?: Maybe; reason?: Maybe; - support: Scalars['Float']['output']; - timestamp: Scalars['Float']['output']; + support?: Maybe; + timestamp: Scalars['Int']['output']; transactionHash: Scalars['String']['output']; voterAddress: Scalars['String']['output']; votingPower: Scalars['String']['output']; @@ -1723,7 +1745,7 @@ export type Query_VotesOffchainByProposalId_Items_Items = { proposalTitle: Scalars['String']['output']; reason: Scalars['String']['output']; voter: Scalars['String']['output']; - vp: Scalars['Float']['output']; + vp?: Maybe; }; export type Query_VotesOffchain_Items_Items = { @@ -1734,16 +1756,16 @@ export type Query_VotesOffchain_Items_Items = { proposalTitle: Scalars['String']['output']; reason: Scalars['String']['output']; voter: Scalars['String']['output']; - vp: Scalars['Float']['output']; + vp?: Maybe; }; export type Query_Votes_Items_Items = { __typename?: 'query_votes_items_items'; proposalId: Scalars['String']['output']; - proposalTitle: Scalars['String']['output']; + proposalTitle?: Maybe; reason?: Maybe; - support: Scalars['Float']['output']; - timestamp: Scalars['Float']['output']; + support?: Maybe; + timestamp: Scalars['Int']['output']; transactionHash: Scalars['String']['output']; voterAddress: Scalars['String']['output']; votingPower: Scalars['String']['output']; @@ -1752,7 +1774,7 @@ export type Query_Votes_Items_Items = { export type Query_VotingPowerByAccountId_Variation = { __typename?: 'query_votingPowerByAccountId_variation'; absoluteChange: Scalars['String']['output']; - percentageChange: Scalars['Float']['output']; + percentageChange: Scalars['String']['output']; }; export type Query_VotingPowerVariationsByAccountId_Data = { @@ -1798,7 +1820,7 @@ export type Query_VotingPowers_Items_Items = { export type Query_VotingPowers_Items_Items_Variation = { __typename?: 'query_votingPowers_items_items_variation'; absoluteChange: Scalars['String']['output']; - percentageChange: Scalars['Float']['output']; + percentageChange: Scalars['String']['output']; }; export enum Timestamp_Const { @@ -1919,7 +1941,7 @@ export type GetProposalByIdQueryVariables = Exact<{ }>; -export type GetProposalByIdQuery = { __typename?: 'Query', proposal?: { __typename?: 'proposal_200_response', id: string, daoId: string, proposerAccountId: string, title: string, description: string, startBlock: number, endBlock: number, endTimestamp: string, timestamp: string, status: string, forVotes: string, againstVotes: string, abstainVotes: string, txHash: string } | null }; +export type GetProposalByIdQuery = { __typename?: 'Query', proposal?: { __typename?: 'proposal_200_response', id: string, daoId: string, proposerAccountId: string, title?: string | null, description: string, startBlock: number, endBlock: number, endTimestamp: string, timestamp: string, status: string, forVotes: string, againstVotes: string, abstainVotes: string, txHash: string } | null }; export type ListProposalsQueryVariables = Exact<{ skip?: InputMaybe; @@ -1932,7 +1954,15 @@ export type ListProposalsQueryVariables = Exact<{ }>; -export type ListProposalsQuery = { __typename?: 'Query', proposals?: { __typename?: 'proposals_200_response', totalCount: number, items: Array<{ __typename?: 'query_proposals_items_items', id: string, daoId: string, proposerAccountId: string, title: string, description: string, startBlock: number, endBlock: number, endTimestamp: string, timestamp: string, status: string, forVotes: string, againstVotes: string, abstainVotes: string, txHash: string } | null> } | null }; +export type ListProposalsQuery = { __typename?: 'Query', proposals?: { __typename?: 'proposals_200_response', totalCount: number, items: Array<{ __typename?: 'query_proposals_items_items', id: string, daoId: string, proposerAccountId: string, title?: string | null, description: string, startBlock: number, endBlock: number, endTimestamp: string, timestamp: string, status: string, forVotes: string, againstVotes: string, abstainVotes: string, txHash: string } | null> } | null }; + +export type GetEventRelevanceThresholdQueryVariables = Exact<{ + relevance: QueryInput_GetEventRelevanceThreshold_Relevance; + type: QueryInput_GetEventRelevanceThreshold_Type; +}>; + + +export type GetEventRelevanceThresholdQuery = { __typename?: 'Query', getEventRelevanceThreshold?: { __typename?: 'getEventRelevanceThreshold_200_response', threshold: string } | null }; export type ListVotesQueryVariables = Exact<{ voterAddressIn?: InputMaybe; @@ -1946,7 +1976,7 @@ export type ListVotesQueryVariables = Exact<{ }>; -export type ListVotesQuery = { __typename?: 'Query', votes?: { __typename?: 'votes_200_response', totalCount: number, items: Array<{ __typename?: 'query_votes_items_items', transactionHash: string, proposalId: string, voterAddress: string, support: number, votingPower: string, timestamp: number, reason?: string | null, proposalTitle: string } | null> } | null }; +export type ListVotesQuery = { __typename?: 'Query', votes?: { __typename?: 'votes_200_response', totalCount: number, items: Array<{ __typename?: 'query_votes_items_items', transactionHash: string, proposalId: string, voterAddress: string, support?: number | null, votingPower: string, timestamp: number, reason?: string | null, proposalTitle?: string | null } | null> } | null }; export type ListHistoricalVotingPowerQueryVariables = Exact<{ limit?: InputMaybe; @@ -1966,5 +1996,6 @@ export const ListOffchainProposalsDocument = {"kind":"Document","definitions":[{ export const ProposalNonVotersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ProposalNonVoters"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"addresses"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JSON"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposalNonVoters"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"addresses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"addresses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"voter"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetProposalByIdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProposalById"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposal"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"daoId"}},{"kind":"Field","name":{"kind":"Name","value":"proposerAccountId"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"startBlock"}},{"kind":"Field","name":{"kind":"Name","value":"endBlock"}},{"kind":"Field","name":{"kind":"Name","value":"endTimestamp"}},{"kind":"Field","name":{"kind":"Name","value":"timestamp"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"forVotes"}},{"kind":"Field","name":{"kind":"Name","value":"againstVotes"}},{"kind":"Field","name":{"kind":"Name","value":"abstainVotes"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}}]}}]}}]} as unknown as DocumentNode; export const ListProposalsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListProposals"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"skip"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"NonNegativeInt"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PositiveInt"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"queryInput_proposals_orderDirection"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"status"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JSON"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fromEndDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"includeOptimisticProposals"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"queryInput_proposals_includeOptimisticProposals"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposals"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"skip"},"value":{"kind":"Variable","name":{"kind":"Name","value":"skip"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}},{"kind":"Argument","name":{"kind":"Name","value":"status"},"value":{"kind":"Variable","name":{"kind":"Name","value":"status"}}},{"kind":"Argument","name":{"kind":"Name","value":"fromDate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}}},{"kind":"Argument","name":{"kind":"Name","value":"fromEndDate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fromEndDate"}}},{"kind":"Argument","name":{"kind":"Name","value":"includeOptimisticProposals"},"value":{"kind":"Variable","name":{"kind":"Name","value":"includeOptimisticProposals"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"daoId"}},{"kind":"Field","name":{"kind":"Name","value":"proposerAccountId"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"startBlock"}},{"kind":"Field","name":{"kind":"Name","value":"endBlock"}},{"kind":"Field","name":{"kind":"Name","value":"endTimestamp"}},{"kind":"Field","name":{"kind":"Name","value":"timestamp"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"forVotes"}},{"kind":"Field","name":{"kind":"Name","value":"againstVotes"}},{"kind":"Field","name":{"kind":"Name","value":"abstainVotes"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode; +export const GetEventRelevanceThresholdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetEventRelevanceThreshold"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"relevance"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"queryInput_getEventRelevanceThreshold_relevance"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"type"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"queryInput_getEventRelevanceThreshold_type"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getEventRelevanceThreshold"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"relevance"},"value":{"kind":"Variable","name":{"kind":"Name","value":"relevance"}}},{"kind":"Argument","name":{"kind":"Name","value":"type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"type"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threshold"}}]}}]}}]} as unknown as DocumentNode; export const ListVotesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListVotes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"voterAddressIn"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JSON"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"toDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"skip"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"NonNegativeInt"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"queryInput_votes_orderBy"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"queryInput_votes_orderDirection"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"support"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Float"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"votes"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"voterAddressIn"},"value":{"kind":"Variable","name":{"kind":"Name","value":"voterAddressIn"}}},{"kind":"Argument","name":{"kind":"Name","value":"fromDate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}}},{"kind":"Argument","name":{"kind":"Name","value":"toDate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"toDate"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"skip"},"value":{"kind":"Variable","name":{"kind":"Name","value":"skip"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}},{"kind":"Argument","name":{"kind":"Name","value":"support"},"value":{"kind":"Variable","name":{"kind":"Name","value":"support"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transactionHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalId"}},{"kind":"Field","name":{"kind":"Name","value":"voterAddress"}},{"kind":"Field","name":{"kind":"Name","value":"support"}},{"kind":"Field","name":{"kind":"Name","value":"votingPower"}},{"kind":"Field","name":{"kind":"Name","value":"timestamp"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}},{"kind":"Field","name":{"kind":"Name","value":"proposalTitle"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode; export const ListHistoricalVotingPowerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListHistoricalVotingPower"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PositiveInt"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"skip"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"NonNegativeInt"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"queryInput_historicalVotingPower_orderBy"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"queryInput_historicalVotingPower_orderDirection"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"address"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"historicalVotingPower"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"skip"},"value":{"kind":"Variable","name":{"kind":"Name","value":"skip"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}},{"kind":"Argument","name":{"kind":"Name","value":"fromDate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fromDate"}}},{"kind":"Argument","name":{"kind":"Name","value":"address"},"value":{"kind":"Variable","name":{"kind":"Name","value":"address"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountId"}},{"kind":"Field","name":{"kind":"Name","value":"timestamp"}},{"kind":"Field","name":{"kind":"Name","value":"votingPower"}},{"kind":"Field","name":{"kind":"Name","value":"delta"}},{"kind":"Field","name":{"kind":"Name","value":"daoId"}},{"kind":"Field","name":{"kind":"Name","value":"transactionHash"}},{"kind":"Field","name":{"kind":"Name","value":"logIndex"}},{"kind":"Field","name":{"kind":"Name","value":"delegation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"from"}},{"kind":"Field","name":{"kind":"Name","value":"to"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"previousDelegate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"transfer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"from"}},{"kind":"Field","name":{"kind":"Name","value":"to"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/packages/anticapture-client/src/index.ts b/packages/anticapture-client/src/index.ts index dcde5707..9968c74d 100644 --- a/packages/anticapture-client/src/index.ts +++ b/packages/anticapture-client/src/index.ts @@ -25,4 +25,5 @@ export { QueryInput_Votes_OrderDirection } from './gql/graphql'; -export type { ProcessedVotingPowerHistory, OffchainProposalItem } from './schemas'; \ No newline at end of file +export { FeedEventType, FeedRelevance } from './schemas'; +export type { ProcessedVotingPowerHistory, OffchainProposalItem } from './schemas'; diff --git a/packages/anticapture-client/src/schemas.ts b/packages/anticapture-client/src/schemas.ts index 4fd23d6f..4efb81a0 100644 --- a/packages/anticapture-client/src/schemas.ts +++ b/packages/anticapture-client/src/schemas.ts @@ -1,5 +1,10 @@ import { z } from 'zod'; +export { + QueryInput_GetEventRelevanceThreshold_Type as FeedEventType, + QueryInput_GetEventRelevanceThreshold_Relevance as FeedRelevance, +} from './gql/graphql'; + // Schema with built-in transformation and fallbacks export const SafeDaosResponseSchema = z.object({ daos: z.object({ @@ -120,6 +125,11 @@ export const SafeProposalNonVotersResponseSchema = z.object({ }; }); +export const EventThresholdResponseSchema = z.object({ + getEventRelevanceThreshold: z.object({ + threshold: z.string() + }) +}); export const OffchainProposalItemSchema = z.object({ id: z.string(), diff --git a/packages/anticapture-client/tests/anticapture-client.test.ts b/packages/anticapture-client/tests/anticapture-client.test.ts index 66ac671b..fabe44ba 100644 --- a/packages/anticapture-client/tests/anticapture-client.test.ts +++ b/packages/anticapture-client/tests/anticapture-client.test.ts @@ -1,5 +1,6 @@ import { describe, it, expect, jest, beforeEach, afterEach } from '@jest/globals'; import { AnticaptureClient } from '../src/anticapture-client'; +import { FeedEventType, FeedRelevance } from '../src/schemas'; import { createMockClient, createProposalResponse, createVotingPowerResponse } from './test-helpers'; import { TEST_FIXTURES } from './constants'; @@ -149,6 +150,34 @@ describe('AnticaptureClient', () => { }); }); + describe('getEventThreshold', () => { + it('returns threshold string for a valid response', async () => { + mockQuery.mockResolvedValue({ + getEventRelevanceThreshold: { threshold: '40000000000000000000000' } + }); + + const result = await client.getEventThreshold('ENS', FeedEventType.Delegation, FeedRelevance.High); + + expect(result).toBe('40000000000000000000000'); + }); + + it('returns null when query throws', async () => { + mockQuery.mockRejectedValue(new Error('Something went wrong')); + + const result = await client.getEventThreshold('ENS', FeedEventType.Vote, FeedRelevance.High); + + expect(result).toBeNull(); + }); + + it('returns null when response has unexpected shape', async () => { + mockQuery.mockResolvedValue({ unexpected: 'data' }); + + const result = await client.getEventThreshold('ENS', FeedEventType.Transfer, FeedRelevance.High); + + expect(result).toBeNull(); + }); + }); + describe('listVotingPowerHistory', () => { describe('error handling', () => { beforeEach(() => { diff --git a/packages/anticapture-client/tests/offchain-proposal.test.ts b/packages/anticapture-client/tests/offchain-proposal.test.ts index b4be4489..ad012b81 100644 --- a/packages/anticapture-client/tests/offchain-proposal.test.ts +++ b/packages/anticapture-client/tests/offchain-proposal.test.ts @@ -10,6 +10,7 @@ interface OffchainProposalStub { id: string; title: string; discussion: string; + link: string; state: string; created: number; } @@ -81,7 +82,7 @@ describe('listOffchainProposals', () => { server.use(handleGraphQL({ daos: [{ id: 'ENS' }], proposals: { - ENS: [{ id: 'snap-1', title: 'Test Proposal', discussion: 'https://forum.example.com', state: 'active', created: 1700000000 }], + ENS: [{ id: 'snap-1', title: 'Test Proposal', discussion: 'https://forum.example.com', link: 'https://snapshot.org/snap-1', state: 'active', created: 1700000000 }], }, })); @@ -96,8 +97,8 @@ describe('listOffchainProposals', () => { server.use(handleGraphQL({ daos: [{ id: 'DAO_A' }, { id: 'DAO_B' }], proposals: { - DAO_A: [{ id: 'snap-a', title: 'From A', discussion: '', state: 'active', created: 1700000100 }], - DAO_B: [{ id: 'snap-b', title: 'From B', discussion: '', state: 'pending', created: 1700000200 }], + DAO_A: [{ id: 'snap-a', title: 'From A', discussion: '', link: '', state: 'active', created: 1700000100 }], + DAO_B: [{ id: 'snap-b', title: 'From B', discussion: '', link: '', state: 'pending', created: 1700000200 }], }, })); @@ -112,7 +113,7 @@ describe('listOffchainProposals', () => { server.use(handleGraphQL({ daos: [{ id: 'OK_DAO' }, { id: 'BAD_DAO' }], proposals: { - OK_DAO: [{ id: 'snap-ok', title: 'OK', discussion: '', state: 'active', created: 1700000000 }], + OK_DAO: [{ id: 'snap-ok', title: 'OK', discussion: '', link: '', state: 'active', created: 1700000000 }], }, errors: { BAD_DAO: 'API exploded',