From 9a5e5885d6ea8a49500cba287eeb686a5679a2e4 Mon Sep 17 00:00:00 2001 From: Yongfeng LI Date: Wed, 6 Nov 2024 20:25:53 +0800 Subject: [PATCH] Fix account search api, #925 --- backend/packages/common/src/utils/isValidAddress.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/packages/common/src/utils/isValidAddress.js b/backend/packages/common/src/utils/isValidAddress.js index 411d82113..99146bd7e 100644 --- a/backend/packages/common/src/utils/isValidAddress.js +++ b/backend/packages/common/src/utils/isValidAddress.js @@ -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));