Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/common/src/utils/address.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@ import { BinaryUtils } from "./binary.utils";

export class AddressUtils {
static bech32Encode(publicKey: string) {
return Address.fromHex(publicKey).bech32();
return Address.newFromHex(publicKey).bech32();
}

static bech32Decode(address: string) {
return Address.fromBech32(address).hex();
return Address.newFromBech32(address).hex();
}

static isAddressValid(address: string): boolean {
try {
Address.fromBech32(address);
Address.newFromBech32(address);
return true;
} catch (error) {
return false;
}
}


static isValidHexAddress(address: string): boolean {
try {
Address.fromHex(address);
Address.newFromHex(address);
return true;
} catch (error) {
return false;
Expand Down