Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isValidAddressPolkadotAddress = () => {
try {
encodeAddress(isHex(address) ? hexToU8a(address) : decodeAddress(address));
return true;
} catch (error) {
return false;
}
};
static encode (value: Uint8Array): string {
return encodeAddress(value);
}
toString (): string {
const length = AccountIndex.calcLength(this.raw);
return encodeAddress(this.toU8a().subarray(0, length));
}