Skip to content

Commit

Permalink
fix cannot get value from undefined and improve sanchonet info modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Sworzen1 authored and MSzalowski committed Jun 21, 2024
1 parent 2181a36 commit 781914d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
8 changes: 4 additions & 4 deletions govtool/frontend/src/context/pendingTransaction/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ export const refetchData = async (
resourceId === AutomatedVotingOptionDelegationId.no_confidence ||
resourceId === AutomatedVotingOptionDelegationId.abstain
) {
return data.dRepView;
return data?.dRepView;
}
return data.dRepHash;
return data?.dRepHash;
}
if (type === "registerAsDrep" || type === "retireAsDrep")
return data.isRegisteredAsDRep;
return data?.isRegisteredAsDRep;
if (type === "registerAsDirectVoter" || type === "retireAsDirectVoter")
return data.isRegisteredAsSoleVoter;
return data?.isRegisteredAsSoleVoter;
return undefined;
};
30 changes: 11 additions & 19 deletions govtool/frontend/src/context/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ const CardanoProvider = (props: Props) => {
try {
const raw = await enabledApi.getUsedAddresses();
const rawFirst = raw[0];
if (!rawFirst) return [];
const usedAddress = Address.from_bytes(
Buffer.from(rawFirst, "hex"),
).to_bech32();
Expand Down Expand Up @@ -932,26 +933,17 @@ function useCardano() {
status: "info",
dataTestId: "info-about-sancho-net-modal",
message: (
<p style={{ margin: 0 }}>
{t("system.sanchoNetIsBeta")}
<Link
onClick={() => openInNewTab("https://sancho.network/")}
sx={{ cursor: "pointer" }}
>
{t("system.sanchoNet")}
</Link>
.
<br />
<br />
<Trans
i18nKey="system.testAdaNote"
components={[
<span style={{ fontWeight: 700 }} key="0" />,
]}
/>
</p>
<Trans
i18nKey="system.testnetDescription"
components={[
<Link
onClick={() => openInNewTab("https://sancho.network/")}
sx={{ cursor: "pointer" }}
/>,
]}
/>
),
title: t("system.toolConnectedToSanchonet"),
title: t("system.testnetTitle"),
buttonText: t("ok"),
},
});
Expand Down

0 comments on commit 781914d

Please sign in to comment.