From: Chris Duncan Date: Wed, 30 Jul 2025 15:28:57 +0000 (-0700) Subject: Reorder static methods. X-Git-Tag: v0.10.5~48^2~1 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=7a0fddb3274a67d96ab714cdee3308f399b2205b;p=libnemo.git Reorder static methods. --- diff --git a/src/lib/bip39-mnemonic.ts b/src/lib/bip39-mnemonic.ts index 8d72264..758bf3e 100644 --- a/src/lib/bip39-mnemonic.ts +++ b/src/lib/bip39-mnemonic.ts @@ -25,27 +25,6 @@ export class Bip39Mnemonic { return checksum } - /** - * Imports and validates an existing mnemonic phrase. - * - * The phrase must be valid according to the BIP-39 specification. Typically - * wallets use the maximum of 24 words. - * - * @param {string} phrase - String of 12, 15, 18, 21, or 24 words - * @returns {string} Mnemonic phrase validated using the BIP-39 wordlist - */ - static async fromPhrase (phrase: string): Promise { - this.#isInternal = true - const self = new this() - const isValid = await this.validate(phrase) - if (isValid) { - self.#phrase = phrase.normalize('NFKD').split(' ') - return self - } else { - throw new Error('Invalid mnemonic phrase.') - } - } - /** * Derives a mnemonic phrase from source of entropy or seed. * @@ -80,6 +59,27 @@ export class Bip39Mnemonic { return this.fromPhrase(sentence) } + /** + * Imports and validates an existing mnemonic phrase. + * + * The phrase must be valid according to the BIP-39 specification. Typically + * wallets use the maximum of 24 words. + * + * @param {string} phrase - String of 12, 15, 18, 21, or 24 words + * @returns {string} Mnemonic phrase validated using the BIP-39 wordlist + */ + static async fromPhrase (phrase: string): Promise { + this.#isInternal = true + const self = new this() + const isValid = await this.validate(phrase) + if (isValid) { + self.#phrase = phrase.normalize('NFKD').split(' ') + return self + } else { + throw new Error('Invalid mnemonic phrase.') + } + } + /** * Validates a mnemonic phrase. *