Skip to content

Commit

Permalink
Fix account search api, #925
Browse files Browse the repository at this point in the history
  • Loading branch information
wliyongfeng committed Nov 6, 2024
1 parent e760190 commit 9a5e588
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/packages/common/src/utils/isValidAddress.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const { decodeAddress, encodeAddress } = require("@polkadot/keyring");
const { hexToU8a, isHex } = require("@polkadot/util");
const { isEthereumAddress } = require("@polkadot/util-crypto");

function isValidAddress(address = "") {
if (isEthereumAddress(address)) {
return true;
}

try {
encodeAddress(isHex(address) ? hexToU8a(address) : decodeAddress(address));

Expand Down

0 comments on commit 9a5e588

Please sign in to comment.