Skip to content

Commit 46b9367

Browse files
authored
Merge pull request #3021 from IntersectMBO/feat/2384-no-feedback-on-governance-action-submission-if-the-stake-is-not-registered
feat(#2384): add `isStakeKeyRegistered` utility method
2 parents 2cacfb8 + a6047fe commit 46b9367

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ changes.
2121
- Allow searching for yourself in DRep Directory [Issue 2993](https://github.com/IntersectMBO/govtool/issues/2993)
2222
- Add mathematical styling for governance actions [Issue 2984](https://github.com/IntersectMBO/govtool/issues/2984)
2323
- Add script to update GovTool version
24+
- Add `isStakeKeyRegistered` for the usage by pillars [Issue 2384](https://github.com/IntersectMBO/govtool/issues/2384)
2425

2526
### Fixed
2627

govtool/frontend/src/context/wallet.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ interface CardanoContextType {
249249
) => Promise<VotingBuilder>;
250250
pendingTransaction: PendingTransaction;
251251
isPendingTransaction: () => boolean;
252+
isStakeKeyRegistered: () => boolean;
252253
buildNewInfoGovernanceAction: (
253254
infoProps: InfoProps,
254255
) => Promise<VotingProposalBuilder | undefined>;
@@ -347,6 +348,12 @@ const CardanoProvider = (props: Props) => {
347348
}
348349
};
349350

351+
/**
352+
* Checks if there are any registered stake keys.
353+
* @returns {boolean} True if there are registered stake keys, false otherwise.
354+
*/
355+
const isStakeKeyRegistered = () => !!registeredStakeKeysListState.length;
356+
350357
const enable = useCallback(
351358
async (walletName: string) => {
352359
setIsEnableLoading(walletName);
@@ -1474,6 +1481,7 @@ const CardanoProvider = (props: Props) => {
14741481
isEnabled,
14751482
isMainnet,
14761483
isPendingTransaction,
1484+
isStakeKeyRegistered,
14771485
pendingTransaction,
14781486
pubDRepKey,
14791487
registeredStakeKeysListState,
@@ -1507,6 +1515,7 @@ const CardanoProvider = (props: Props) => {
15071515
isEnabled,
15081516
isMainnet,
15091517
isPendingTransaction,
1518+
isStakeKeyRegistered,
15101519
pendingTransaction,
15111520
pubDRepKey,
15121521
registeredStakeKeysListState,

0 commit comments

Comments
 (0)