Skip to content

Commit

Permalink
fix: Code review for validate address
Browse files Browse the repository at this point in the history
  • Loading branch information
Faizal-aelf committed Nov 15, 2023
1 parent 13b01e2 commit 5febf91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/validateAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export const validateAddress = (
) => {
if (addr.trim().length === 0) {
return;
} else if (addr.split("_").length !== 3) {
throw new Error("Oops! Please input a valid AELF network address!");
} else if (addr.split("_").length === 1) {
addr = `ELF_${addr}_${chain}`;
}
} else if (addr.split("_").length !== 3) {
throw new Error("Oops! Please input a valid AELF network address!");
}

const [_, mid, end] = addr.split("_");
if (end !== chain)
Expand Down

0 comments on commit 5febf91

Please sign in to comment.