Skip to content

Commit

Permalink
fix quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gsteenkamp89 committed Mar 26, 2024
1 parent 75699bf commit 83203a8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/plugins/oSnap/components/Input/MethodParameter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ const errorMessageForDisplay = computed(() => {
}
});
// only suggest padding with zeros if too short but still valid bytes (even characters & starts with "0x")
const allowQuickFixForBytes32 = computed(() => {
if (errorMessageForDisplay?.value?.includes('short')) {
if (!errorMessageForDisplay?.value?.includes('long')) {
return true;
}
return false;
Expand Down Expand Up @@ -97,13 +96,15 @@ function validateBytes32Input(value: string) {
try {
const data = value?.slice(2) || '';
if (!isBytesLike(value)) {
throw new Error('Invalid bytes32');
}
if (data.length < 64) {
validationErrorMessage.value = 'Value too short';
throw new Error('Less than 32 bytes');
}
if (!isBytesLike(value)) {
throw new Error('Invalid bytes32');
}
if (data.length > 64) {
validationErrorMessage.value = 'Value too long';
throw new Error('More than 32 bytes');
Expand Down

0 comments on commit 83203a8

Please sign in to comment.