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
36 lines (35 loc) • 1.29 kB
TypeScript
import { Secret, EncryptedState } from '../../Secret';
/**
* A private key. Accepts hex, WIF, raw bytes, or encrypted state. Supports encryption.
*
* @example
* ```ts
* const pk = new PrivateKey('deadbeef...');
* const pk = new PrivateKey('5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ'); // WIF
* pk.publicKey; // compressed public key bytes
* pk.getWif(); // export as WIF
* ```
*/
export declare class PrivateKey extends Secret {
private readonly wifVersion;
/**
* @param source - Hex, WIF, `Uint8Array`, or {@link EncryptedState}.
* @param wifVersion - WIF version byte. Defaults to `128` (Bitcoin mainnet).
* @throws {@link InvalidPrivateKeyError} if the format is invalid.
*/
constructor(source: string | Uint8Array | EncryptedState, wifVersion?: number);
/** The raw private key bytes. */
get raw(): Uint8Array;
/** The private key as hex. */
get hex(): string;
/** The corresponding compressed public key. */
get publicKey(): Uint8Array;
/**
* Exports the private key as a WIF string.
*
* @param version - WIF version byte. Defaults to the version set in the constructor.
*/
getWif(version?: number): string;
/** Zeros out the private key in memory. */
zeroize(): void;
}