UNPKG

@nawab_kibria/bitcoin-lib

Version:

A comprehensive Bitcoin HD wallet library with BIP84, BIP44, BIP49 support, mnemonic generation and restoration

90 lines (89 loc) 2.83 kB
import * as bitcoin from "bitcoinjs-lib"; /** * Convert standard extended key to BIP84-specific format with proper version bytes */ export declare function convertToBip84Format(extendedKey: string, network: bitcoin.Network, isPrivate?: boolean): string; /** * Get BIP84-specific extended keys for a given seed and network * This generates proper BIP84 extended keys with correct version bytes */ export declare function getBip84ExtendedKeys(seed: Buffer, network: bitcoin.Network): { zpub: string; zprv: string; }; /** * Get coin type for a given network (BIP44 standard) */ export declare function getCoinType(network: bitcoin.Network): number; /** * Get derivation path for different BIP standards */ export declare function getDerivationPath(purpose: 44 | 49 | 84 | 86, network: bitcoin.Network, account?: number, change?: number, addressIndex?: number): string; /** * Import and derive address and keys for any index from mnemonic or root key * This is a flexible utility for wallet recovery and address generation */ export declare function importAndDerive(options: { mnemonic?: string; rootKey?: string; purpose: 44 | 49 | 84 | 86; network?: bitcoin.Network; account?: number; change?: number; index: number; addressType?: 'legacy' | 'segwit' | 'native-segwit'; }): { address: string; publicKey: string; privateKey: string; derivationPath: string; addressType: 'legacy' | 'segwit' | 'native-segwit'; internalKey?: string; signingKey?: string; }; /** * Batch import and derive multiple addresses from mnemonic or root key */ export declare function importAndDeriveBatch(options: { mnemonic?: string; rootKey?: string; purpose: 44 | 49 | 84 | 86; network?: bitcoin.Network; account?: number; change?: number; startIndex?: number; count: number; addressType?: 'legacy' | 'segwit' | 'native-segwit'; }): Array<{ address: string; publicKey: string; privateKey: string; derivationPath: string; addressType: 'legacy' | 'segwit' | 'native-segwit'; internalKey?: string; signingKey?: string; index: number; }>; /** * Import from extended key and get account-level information */ export declare function importExtendedKey(extendedKey: string, network?: bitcoin.Network): { isPrivate: boolean; depth: number; parentFingerprint: number; childNumber: number; chainCode: string; key: string; xpub: string; xprv?: string; network: bitcoin.Network; }; /** * Quick address lookup - derive single address from any source */ export declare function quickDerive(source: string, // mnemonic or extended key purpose: 44 | 49 | 84 | 86, index: number, network?: bitcoin.Network): { address: string; derivationPath: string; addressType: string; };