UNPKG

chaingate

Version:

Multi-chain cryptocurrency SDK for TypeScript — unified API for Bitcoin, Ethereum, Litecoin, Dogecoin, Bitcoin Cash, Polygon, Arbitrum, and any EVM-compatible chain. Create wallets, query balances, send transactions, and manage tokens and NFTs across UTXO

35 lines (34 loc) 935 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Xpriv = void 0; const Secret_1 = require("../../../Secret"); const utils_1 = require("../../../../utils"); /** * An extended private key (xpriv). Supports encryption. * * @example * ```ts * const xpriv = new Xpriv('xprv9s21ZrQH143K...'); * console.log(xpriv.key); * ``` */ class Xpriv extends Secret_1.Secret { /** @param source - The xpriv string or {@link EncryptedState}. */ constructor(source) { const resolved = Secret_1.Secret.resolveInput(source, (s) => new TextEncoder().encode(s)); super(resolved); } /** The raw bytes. */ get raw() { return this.data; } /** The xpriv as hex. */ get hex() { return (0, utils_1.bytesToHex)(this.data); } /** The xpriv string. */ get key() { return new TextDecoder().decode(this.data); } } exports.Xpriv = Xpriv;