"use strict";
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
};
|
Object.defineProperty(exports, "__esModule", { value: true });
|
exports.Key = void 0;
|
const encoding_1 = require("./encoding");
|
const bech32_1 = __importDefault(require("bech32"));
|
class Key {
|
value;
|
constructor(value) {
|
this.value = value;
|
}
|
static from(value) {
|
return new Key(value);
|
}
|
static fromHex(value) {
|
return new Key((0, encoding_1.fromHex)(value));
|
}
|
static fromBase64(value) {
|
return new Key((0, encoding_1.fromBase64)(value));
|
}
|
static fromBigInt(value) {
|
return new Key((0, encoding_1.fromBigInt)(value));
|
}
|
toHex() {
|
return (0, encoding_1.toHex)(this.value);
|
}
|
toPrefixedHex() {
|
return `0x${this.toHex()}`;
|
}
|
toBase64() {
|
return (0, encoding_1.toBase64)(this.value);
|
}
|
toBigInt() {
|
return (0, encoding_1.toBigInt)(this.value);
|
}
|
toBech32(prefix, limit) {
|
return bech32_1.default.encode(prefix, bech32_1.default.toWords(this.value), limit);
|
}
|
slice(start, end) {
|
return Key.from(this.value.slice(start, end));
|
}
|
concat(key) {
|
return Key.from(new Uint8Array([...this.value, ...key.value]));
|
}
|
}
|
exports.Key = Key;
|
//# sourceMappingURL=key.js.map
|