Skip to content

Commit 87ce23c

Browse files
authored
Merge pull request #3424 from IntersectMBO/feat/2243-insufficient-balance-check-should-be-earlier-in-ga-submission
feat(#2243): add epochParams and ada holder balance to Proposal pillar
2 parents 194df33 + d9cbd2a commit 87ce23c

File tree

3 files changed

+45
-32
lines changed

3 files changed

+45
-32
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ changes.
1313
### Added
1414

1515
- Add Proposal discussion context that manages username [Issue 3341](https://github.com/IntersectMBO/govtool/issues/3341)
16+
- Add epochParams and ada holder balance to Proposal Discussion Pillar [Issue 2243](https://github.com/IntersectMBO/govtool/issues/2243)
1617

1718
### Fixed
1819

govtool/frontend/src/pages/ProposalDiscussion.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,34 @@ import React, { ComponentProps, Suspense } from "react";
22
import { Box, CircularProgress } from "@mui/material";
33
import "@intersect.mbo/pdf-ui/style";
44
import {
5+
useAppContext,
56
useCardano,
67
useGovernanceActions,
78
useProposalDiscussion,
89
} from "@/context";
910
import { useValidateMutation } from "@/hooks/mutations";
1011
import { useScreenDimension } from "@/hooks/useScreenDimension";
1112
import { Footer, TopNav } from "@/components/organisms";
12-
import { useGetDRepVotingPowerList, useGetVoterInfo } from "@/hooks";
13+
import {
14+
useGetAdaHolderVotingPowerQuery,
15+
useGetDRepVotingPowerList,
16+
useGetVoterInfo,
17+
} from "@/hooks";
1318

1419
const ProposalDiscussion = React.lazy(
1520
() => import("@intersect.mbo/pdf-ui/cjs"),
1621
);
1722

1823
export const ProposalDiscussionPillar = () => {
24+
const { epochParams } = useAppContext();
1925
const { pagePadding } = useScreenDimension();
2026
const { validateMetadata } = useValidateMutation();
2127
const { walletApi, ...context } = useCardano();
2228
const { voter } = useGetVoterInfo();
2329
const { createGovernanceActionJsonLD, createHash } = useGovernanceActions();
2430
const { fetchDRepVotingPowerList } = useGetDRepVotingPowerList();
2531
const { username, setUsername } = useProposalDiscussion();
32+
const { votingPower } = useGetAdaHolderVotingPowerQuery(context.stakeKey);
2633

2734
return (
2835
<Box
@@ -74,6 +81,8 @@ export const ProposalDiscussionPillar = () => {
7481
fetchDRepVotingPowerList={fetchDRepVotingPowerList}
7582
username={username}
7683
setUsername={setUsername}
84+
epochParams={epochParams}
85+
votingPower={votingPower}
7786
/>
7887
</Suspense>
7988
</Box>

govtool/frontend/src/types/@intersect.mbo.d.ts

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,44 @@ enum MetadataValidationStatus {
44
INVALID_HASH = "INVALID_HASH",
55
INCORRECT_FORMAT = "INCORRECT_FORMAT",
66
}
7+
declare module "@intersect.mbo/pdf-ui/cjs" {
8+
import { EpochParams } from "@/models";
79

8-
type ProposalDiscussionProps = {
9-
pdfApiUrl: string;
10-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11-
walletAPI: any;
12-
pathname: string;
13-
locale?: string;
14-
validateMetadata: ({
15-
url,
16-
hash,
17-
standard,
18-
}: {
19-
url: string;
20-
hash: string;
21-
standard: "CIP108";
22-
}) => Promise<
10+
type ProposalDiscussionProps = {
11+
pdfApiUrl: string;
2312
// eslint-disable-next-line @typescript-eslint/no-explicit-any
24-
| { status?: MetadataValidationStatus; metadata?: any; valid: boolean }
25-
| undefined
26-
>;
27-
fetchDRepVotingPowerList: (
28-
identifiers: string[],
29-
) => Promise<DRepVotingPowerListResponse>;
30-
username: string;
31-
setUsername: (username: string) => void;
32-
};
13+
walletAPI: any;
14+
pathname: string;
15+
locale?: string;
16+
validateMetadata: ({
17+
url,
18+
hash,
19+
standard,
20+
}: {
21+
url: string;
22+
hash: string;
23+
standard: "CIP108";
24+
}) => Promise<
25+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
26+
| { status?: MetadataValidationStatus; metadata?: any; valid: boolean }
27+
| undefined
28+
>;
29+
fetchDRepVotingPowerList: (
30+
identifiers: string[],
31+
) => Promise<DRepVotingPowerListResponse>;
32+
epochParams?: EpochParams;
33+
votingPower: number;
34+
username: string;
35+
setUsername: (username: string) => void;
36+
};
3337

34-
type GovernanceActionsOutcomesProps = {
35-
apiUrl?: string;
36-
ipfsGateway?: string;
37-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
38-
walletAPI?: any;
39-
};
38+
type GovernanceActionsOutcomesProps = {
39+
apiUrl?: string;
40+
ipfsGateway?: string;
41+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
42+
walletAPI?: any;
43+
};
4044

41-
declare module "@intersect.mbo/pdf-ui/cjs" {
4245
export default function ProposalDiscussion(
4346
props: ProposalDiscussionProps,
4447
): JSX.Element;

0 commit comments

Comments
 (0)