@stacks/bns
Version:
Library for working with the Stacks Blockchain Naming System BNS.
23 lines • 763 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getZonefileHash = exports.decodeFQN = void 0;
const common_1 = require("@stacks/common");
const transactions_1 = require("@stacks/transactions");
function decodeFQN(fqdn) {
const nameParts = fqdn.split('.');
if (nameParts.length > 2) {
return {
subdomain: nameParts[0],
name: nameParts[1],
namespace: nameParts[2],
};
}
return {
name: nameParts[0],
namespace: nameParts[1],
};
}
exports.decodeFQN = decodeFQN;
const getZonefileHash = (zonefile) => (0, transactions_1.hash160)((0, common_1.utf8ToBytes)(zonefile));
exports.getZonefileHash = getZonefileHash;
//# sourceMappingURL=utils.js.map
;