Skip to content

Commit

Permalink
fix(#1871): make payment address validation optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Aug 30, 2024
1 parent 83b3e9b commit 30346c8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
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.
- Fix voting on info actions in bootstrapping phase [Issue 1876](https://github.com/IntersectMBO/govtool/issues/1876)
- Fix missing DRep name whitespace validation [Issue 1873](https://github.com/IntersectMBO/govtool/issues/1873)
- Fix displaying wrongly formatted Governance Action ID [Issue 1866](https://github.com/IntersectMBO/govtool/issues/1866k)
- Make payment address optional in DRep registration and edit form [Issue 1871](https://github.com/IntersectMBO/govtool/issues/1871)

### Changed

Expand Down
11 changes: 8 additions & 3 deletions govtool/frontend/src/hooks/forms/useEditDRepInfoForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export const useEditDRepInfoForm = (
handleSubmit,
formState: { errors, isValid },
register,
resetField,
reset,
watch,
} = useFormContext<EditDRepInfoValues>();
Expand All @@ -91,7 +90,14 @@ export const useEditDRepInfoForm = (
const generateMetadata = useCallback(async () => {
const body = generateMetadataBody({
data: getValues(),
acceptedKeys: ["givenName", "objectives", "motivations", "qualifications", "paymentAddress", "references"],
acceptedKeys: [
"givenName",
"objectives",
"motivations",
"qualifications",
"paymentAddress",
"references",
],
standardReference: CIP_119,
});

Expand Down Expand Up @@ -204,7 +210,6 @@ export const useEditDRepInfoForm = (
onClickDownloadJson,
register,
editDRepInfo: handleSubmit(onSubmit),
resetField,
watch,
reset,
};
Expand Down
2 changes: 0 additions & 2 deletions govtool/frontend/src/hooks/forms/useRegisterAsdRepForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export const useRegisterAsdRepForm = (
handleSubmit,
formState: { errors, isValid },
register,
resetField,
watch,
} = useFormContext<RegisterAsDRepValues>();

Expand Down Expand Up @@ -250,7 +249,6 @@ export const useRegisterAsdRepForm = (
onClickDownloadJson,
register,
registerAsDrep: handleSubmit(onSubmit),
resetField,
watch,
};
};
5 changes: 4 additions & 1 deletion govtool/frontend/src/utils/isValidFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ export async function isRewardAddress(address: string) {
}
}

export async function isReceivingAddress(address: string) {
export async function isReceivingAddress(address?: string) {
try {
if (!address) {
return true;
}
const receivingAddress = Address.from_bech32(address);
return receivingAddress
? true
Expand Down

0 comments on commit 30346c8

Please sign in to comment.