@thorwallet/xchain-ethereum
Version:
Ethereum client for XChainJS
45 lines (44 loc) • 2.09 kB
TypeScript
/// <reference types="node" />
import { ExternallyOwnedAccount } from '@ethersproject/abstract-signer';
import { BytesLike } from '@ethersproject/bytes';
import { Wordlist } from '@ethersproject/wordlists';
export declare function sha256(data: BytesLike): Promise<string>;
export declare function mnemonicToSeed(mnemonic: string, password?: string): Promise<Buffer>;
export declare function mnemonicToEntropy(mnemonic: string, wordlist?: string | Wordlist): Promise<string>;
export declare function entropyToMnemonic(entropy: BytesLike, wordlist?: string | Wordlist): Promise<string>;
export declare const defaultPath = "m/44'/60'/0'/0/0";
export interface Mnemonic {
readonly phrase: string;
readonly path: string;
readonly locale: string;
}
export declare class HDNode implements ExternallyOwnedAccount {
readonly privateKey: string;
readonly publicKey: string;
readonly fingerprint: () => Promise<string>;
readonly parentFingerprint: string;
readonly address: string;
readonly mnemonic?: Mnemonic;
readonly path: string;
readonly chainCode: string;
readonly index: number;
readonly depth: number;
/**
* This constructor should not be called directly.
*
* Please use:
* - fromMnemonic
* - fromSeed
*/
constructor(constructorGuard: any, privateKey: string, publicKey: string, parentFingerprint: string, chainCode: string, index: number, depth: number, mnemonicOrPath: Mnemonic | string);
extendedKey(): Promise<string>;
neuter(): HDNode;
private _derive;
derivePath(path: string): Promise<Promise<HDNode>>;
static _fromSeed(seed: BytesLike, mnemonic: Mnemonic): Promise<HDNode>;
static fromMnemonic(mnemonic: string, password?: string, wordlist?: string | Wordlist): Promise<HDNode>;
static fromSeed(seed: BytesLike): Promise<HDNode>;
static fromExtendedKey(extendedKey: string): Promise<HDNode>;
}
export declare function isValidMnemonic(mnemonic: string, wordlist?: Wordlist): Promise<boolean>;
export declare function getAccountPath(index: number): string;