From 7a0fddb3274a67d96ab714cdee3308f399b2205b Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 30 Jul 2025 08:28:57 -0700 Subject: [PATCH] Reorder static methods. --- src/lib/bip39-mnemonic.ts | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) 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. * -- 2.47.3