Skip to content

Commit

Permalink
[#280] Fix get drep voting power request
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Feb 23, 2024
1 parent da200b0 commit 903b950
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ changes.
- Fixed vote calculation problems related to NoConfidence DRep [Issue 59](https://github.com/IntersectMBO/govtool/issues/59)
- Fixed ada-holder/get-current-delegation error when delegated to NoConfidence or AlwaysAbstain dreps. [Issue 82](https://github.com/IntersectMBO/govtool/issues/82)
- Fixed deployment scripts to address [Issue 171](https://github.com/IntersectMBO/govtool/issues/171).
- Fixed get drep voting power incorrectly executed endpoint [Issue 280](https://github.com/IntersectMBO/govtool/issues/280)

### Changed
- Update Cardano-Serialization-Lib to 12.0.0-alpha.16 [Issue 156](https://github.com/IntersectMBO/govtool/issues/156)
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function App() {
const timer = setTimeout(() => setIsDrepLoading(false), 1000);

return () => clearTimeout(timer);
}, [data?.isRegistered]);
}, [data?.isRegisteredAsDRep]);

const checkTheWalletIsActive = useCallback(() => {
const hrefCondition =
Expand Down
11 changes: 9 additions & 2 deletions govtool/frontend/src/hooks/queries/useGetDRepVotingPowerQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ import { getDRepVotingPower } from "@services";
export const useGetDRepVotingPowerQuery = () => {
const { dRepID, dRep } = useCardano();

console.log({ dRepID, dRep, cond: !!dRepID && dRep?.isRegisteredAsDRep });

const { data, isLoading } = useQuery({
queryKey: [QUERY_KEYS.useGetDRepVotingPowerKey, dRepID, dRep?.isRegistered],
queryKey: [
QUERY_KEYS.useGetDRepVotingPowerKey,
dRepID,
dRep?.isRegisteredAsDRep,
],
queryFn: async () => {
console.log({ dRepID });
return await getDRepVotingPower({ dRepID });
},
enabled: !!dRepID && dRep?.isRegistered,
enabled: !!dRepID && dRep?.isRegisteredAsDRep,
});

return { dRepVotingPower: data, isDRepVotingPowerLoading: isLoading };
Expand Down
8 changes: 5 additions & 3 deletions govtool/frontend/src/models/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export interface DRepInfo {
isRegistered: boolean;
wasRegistered: boolean;
deposit: number;
isRegisteredAsDRep: boolean;
isRegisteredAsSoleVoter: boolean;
wasRegisteredAsDRep: boolean;
wasRegisteredAsSoleVoter: boolean;
deposit: number | null;
}

export interface DRepData {
Expand Down

0 comments on commit 903b950

Please sign in to comment.