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.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PublicKeyWallet = void 0; const ViewOnlyWallet_1 = require("../ViewOnlyWallet"); /** * Read-only wallet from a single public key. No derivation, no signing. * * @example * ```ts * const wallet = new PublicKeyWallet(new PublicKey('02deadbeef...')); * console.log(wallet.publicKey); * ``` */ class PublicKeyWallet extends ViewOnlyWallet_1.ViewOnlyWallet { /** * @param publicKey - The public key entity. */ constructor(publicKey) { super(); this.walletType = 'publicKey'; this._publicKey = publicKey; } /** The public key as hex. */ get publicKey() { return this._publicKey.hex; } /** Returns the {@link PublicKey} entity. */ getPublicKey() { return this._publicKey; } /** @inheritdoc */ async serialize() { return { type: 'publicKey', publicKey: this._publicKey.hex }; } } exports.PublicKeyWallet = PublicKeyWallet;