@sei-js/cosmjs
Version:
TypeScript library for CosmJS interactions on the Sei blockchain
19 lines (18 loc) • 546 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBech32 = void 0;
const bech32_1 = require("bech32");
/**
* Converts a given address to Bech32 format.
* @param address The address to convert.
* @returns The bech32 formatted address.
* @category Utils
*/
const toBech32 = (address) => {
if (!address.length) {
throw new Error('Invalid address length');
}
const words = bech32_1.bech32.toWords(address);
return bech32_1.bech32.encode('sei', words);
};
exports.toBech32 = toBech32;