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

37 lines (36 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.XprivWallet = void 0; const Xpriv_1 = require("./Xpriv"); const HDWallet_1 = require("../HDWallet"); /** * HD wallet created from an extended private key (xpriv). * * @example * ```ts * const wallet = new XprivWallet(new Xpriv('xprv9s21ZrQH143K...')); * const key = await wallet.derive("m/44'/60'/0'/0/0"); * ``` */ class XprivWallet extends HDWallet_1.HDWallet { /** @param xpriv - The extended private key. */ constructor(xpriv, restoreData) { super(xpriv, restoreData); this.walletType = 'xpriv'; } /** @internal */ getKeySource() { return { xpriv: this.secret.key }; } /** Returns the {@link Xpriv}. Prompts for password if encrypted. */ async getXpriv() { if (!this.secret.encrypted) return this.secret; return this.secret.withDecrypted(() => new Xpriv_1.Xpriv(this.secret.key)); } /** @internal */ doSerialize() { return { type: 'xpriv', xpriv: this.secret.key }; } } exports.XprivWallet = XprivWallet;