Skip to content

Commit

Permalink
feat(#1644): add missing network metrics model to frontend service
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Aug 6, 2024
1 parent cfd5b11 commit 63a5b0c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ changes.
### Added

- Add network name to GET /network/metrics [Issue 1644](https://github.com/IntersectMBO/govtool/issues/1644)
- Add network metrics model to frontend service

### Fixed

Expand Down
14 changes: 14 additions & 0 deletions govtool/frontend/src/models/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import { MetadataValidationStatus } from "@models";

export type NetworkMetrics = {
currentTime: string;
currentEpoch: number;
currentBlock: number;
uniqueDelegators: number;
totalDelegations: number;
totalGovernanceActions: number;
totalDRepVotes: number;
totalRegisteredDReps: number;
alwaysAbstainVotingPower: number;
alwaysNoConfidenceVotingPower: number;
networkName: string;
};

export interface VoterInfo {
isRegisteredAsDRep: boolean;
wasRegisteredAsDRep: boolean;
Expand Down
3 changes: 2 additions & 1 deletion govtool/frontend/src/services/requests/getNetworkMetrics.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { NetworkMetrics } from "@models";
import { API } from "../API";

export const getNetworkMetrics = async () => {
const response = await API.get("/network/metrics");
const response = await API.get<NetworkMetrics>("/network/metrics");

return response.data;
};

0 comments on commit 63a5b0c

Please sign in to comment.