Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#280] Fix get drep voting power incorrectly executed #285

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export const useDRepRegisterMutation = () => {

const { mutateAsync, isLoading } = useMutation(postDRepRegister, {
onSuccess: () => {
setDRep({ deposit: 100, isRegistered: true, wasRegistered: false });
setDRep({
deposit: 100,
isRegistered: true,
wasRegistered: false,
});
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ export const useDRepRetireMutation = () => {

const { mutateAsync } = useMutation(postDRepRetire, {
onSuccess: () => {
setDRep({ deposit: 100, wasRegistered: true, isRegistered: false });
setDRep({
deposit: 100,
wasRegistered: true,
isRegistered: false,
});
addSuccessAlert("DRep retired.");
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { useCardano } from "@context";
import { getDRepVotingPower } from "@services";

export const useGetDRepVotingPowerQuery = () => {
const { dRepID } = useCardano();
const { dRepID, dRep } = useCardano();

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

return { dRepVotingPower: data, isDRepVotingPowerLoading: isLoading };
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/models/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface DRepInfo {
isRegistered: boolean;
wasRegistered: boolean;
deposit: number;
deposit: number | null;
}

export interface DRepData {
Expand Down