Skip to content

Commit

Permalink
[#239 #240 #338] Fixes after CR
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJaroszczak committed Feb 28, 2024
1 parent 76913d5 commit 81df058
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 28 deletions.
4 changes: 2 additions & 2 deletions govtool/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import {
removeItemFromLocalStorage,
} from "@utils";
import { SetupInterceptors } from "./services";
import { useGetDRepInfo, useWalletConnectionListener } from "./hooks";
import { useGetVoterInfo, useWalletConnectionListener } from "./hooks";
import { RegisterAsSoleVoter } from "./pages/RegisterAsSoleVoter";

export default function App() {
const { enable, setVoter, setIsDrepLoading } = useCardano();
const navigate = useNavigate();
const { data } = useGetDRepInfo();
const { data } = useGetVoterInfo();
const { modal, openModal, modals } = useModal();

useWalletConnectionListener();
Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/src/context/walletUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAdaHolderCurrentDelegation, getDRepInfo } from "@services";
import { getAdaHolderCurrentDelegation, getVoterInfo } from "@services";
import { DRepActionType } from "./wallet";
import { VoterInfo } from "@models";

Expand All @@ -18,7 +18,7 @@ export const setLimitedRegistrationInterval = (
count++;

try {
const data = await getDRepInfo(dRepID);
const data = await getVoterInfo(dRepID);

if (
data.isRegisteredAsDRep === desiredResult ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ export const useRegisterAsdRepFormContext = () => {
const { url, hash } = values;

// Temporary solution. To modify later.
const urlSubmitValue =
!url || url === ""
? "https://raw.githubusercontent.com/Thomas-Upfield/test-metadata/main/placeholder.json"
: url;
const hashSubmitValue =
!hash || hash === ""
? "654e483feefc4d208ea02637a981a2046e17c73c09583e9dd0c84c25dab42749"
: hash;
const urlSubmitValue = !url
? "https://raw.githubusercontent.com/Thomas-Upfield/test-metadata/main/placeholder.json"
: url;
const hashSubmitValue = !hash
? "654e483feefc4d208ea02637a981a2046e17c73c09583e9dd0c84c25dab42749"
: hash;
setIsLoading(true);

try {
Expand Down
14 changes: 6 additions & 8 deletions govtool/frontend/src/hooks/forms/useUpdatedRepMetadataForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ export const useUpdatedRepMetadataForm = () => {
const { url, hash } = values;

// Temporary solution. To modify later.
const urlSubmitValue =
!url || url === ""
? "https://raw.githubusercontent.com/Thomas-Upfield/test-metadata/main/placeholder.json"
: url;
const hashSubmitValue =
!hash || hash === ""
? "654e483feefc4d208ea02637a981a2046e17c73c09583e9dd0c84c25dab42749"
: hash;
const urlSubmitValue = !url
? "https://raw.githubusercontent.com/Thomas-Upfield/test-metadata/main/placeholder.json"
: url;
const hashSubmitValue = !hash
? "654e483feefc4d208ea02637a981a2046e17c73c09583e9dd0c84c25dab42749"
: hash;
setIsLoading(true);
try {
const certBuilder = await buildDRepUpdateCert(
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/hooks/queries/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from "./useGetAdaHolderCurrentDelegationQuery";
export * from "./useGetAdaHolderVotingPowerQuery";
export * from "./useGetDRepInfoQuery";
export * from "./useGetVoterInfoQuery";
export * from "./useGetDRepListQuery";
export * from "./useGetDRepVotesQuery";
export * from "./useGetDRepVotingPowerQuery";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { useQuery } from "react-query";

import { QUERY_KEYS } from "@consts";
import { useCardano } from "@context";
import { getDRepInfo } from "@services";
import { getVoterInfo } from "@services";

export const useGetDRepInfo = () => {
export const useGetVoterInfo = () => {
const { dRepID, registerTransaction, soleVoterTransaction } = useCardano();

const { data, isLoading } = useQuery({
Expand All @@ -14,7 +14,7 @@ export const useGetDRepInfo = () => {
soleVoterTransaction?.transactionHash,
],
enabled: !!dRepID,
queryFn: async () => await getDRepInfo(dRepID),
queryFn: async () => await getVoterInfo(dRepID),
});

return { data, isLoading };
Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ export const en = {
retire: "Retire",
wasSoleVoterTitle: "You Have Retired as a Sole Voter",
retirement: "Sole Voter Retirement",
wasRegisteredDescription:
"You cannot vote on Governance Actions using your own voting power of ₳<strong>{{votingPower}}</strong>. until you re-register.",
retirementInProgress:
"The retirement process is ongoing. This may take several minutes.",
wasRegisteredDescription:
"You cannot vote on Governance Actions using your own voting power of ₳<strong>{{votingPower}}</strong>. until you re-register.",
youAreSoleVoterTitle: "You are a Sole Voter",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { API } from "../API";

import type { VoterInfo } from "@models";

export const getDRepInfo = async (dRepID: string) => {
export const getVoterInfo = async (dRepID: string) => {
const response = await API.get<VoterInfo>(`/drep/info/${dRepID}`);

return response.data;
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/services/requests/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from "./getAdaHolderCurrentDelegation";
export * from "./getAdaHolderVotingPower";
export * from "./getDRepInfo";
export * from "./getVoterInfo";
export * from "./getDRepList";
export * from "./getDRepVotes";
export * from "./getDRepVotingPower";
Expand Down

0 comments on commit 81df058

Please sign in to comment.