60 lines
2.2 KiB
TypeScript
60 lines
2.2 KiB
TypeScript
/**
|
|
* HD wallet derivation and key management.
|
|
* BIP39/BIP44 address generation for TRON and Polygon, plus encrypted private key helpers.
|
|
*/
|
|
import TronWeb from 'tronweb';
|
|
/**
|
|
* Returns a singleton TronWeb client for address conversion and chain calls.
|
|
* @returns Configured TronWeb instance (TRON_NODE_URL or TronGrid default)
|
|
*/
|
|
export declare function getTronWeb(): InstanceType<typeof TronWeb>;
|
|
/**
|
|
* Generates a new 24-word BIP39 mnemonic (256 bits of entropy).
|
|
* @returns Space-separated mnemonic phrase
|
|
*/
|
|
export declare function generateMnemonic(): string;
|
|
/**
|
|
* Derives a BIP39 seed buffer from a mnemonic (sync).
|
|
* @param mnemonic Valid BIP39 mnemonic phrase
|
|
* @returns 64-byte seed buffer
|
|
*/
|
|
export declare function mnemonicToSeed(mnemonic: string): Buffer;
|
|
/**
|
|
* Derives TRON address and private key at index using BIP44 path m/44'/195'/0'/0/index.
|
|
* @param mnemonic Platform BIP39 mnemonic
|
|
* @param index Derivation index (0-based)
|
|
* @returns Base58 TRON address and hex private key
|
|
*/
|
|
export declare function deriveTronFromMnemonic(mnemonic: string, index: number): {
|
|
address: string;
|
|
privateKey: string;
|
|
};
|
|
/**
|
|
* Derives Polygon (Ethereum-compatible) address and private key at index using BIP44 path m/44'/60'/0'/0/index.
|
|
* @param mnemonic Platform BIP39 mnemonic
|
|
* @param index Derivation index (0-based)
|
|
* @returns Checksummed 0x address and hex private key (without 0x prefix)
|
|
*/
|
|
export declare function derivePolygonFromMnemonic(mnemonic: string, index: number): {
|
|
address: string;
|
|
privateKey: string;
|
|
};
|
|
/**
|
|
* Encrypts a private key for storage (AES via app crypto utils).
|
|
* @param privateKey Hex private key string
|
|
* @returns Encrypted ciphertext string
|
|
*/
|
|
export declare function encryptPrivateKey(privateKey: string): string;
|
|
/**
|
|
* Decrypts a stored private key.
|
|
* @param encrypted Ciphertext from encryptPrivateKey
|
|
* @returns Plain hex private key
|
|
*/
|
|
export declare function decryptPrivateKey(encrypted: string): string;
|
|
/**
|
|
* Derives a TRON base58 address from a hex private key.
|
|
* @param privateKeyHex Private key in hex (with or without 0x)
|
|
* @returns TRON base58 address
|
|
*/
|
|
export declare function getTronAddressFromPrivateKey(privateKeyHex: string): string;
|
|
//# sourceMappingURL=hdWallet.d.ts.map
|