]> git.codecow.com Git - libnemo.git/commitdiff
Reorder static methods.
authorChris Duncan <chris@zoso.dev>
Wed, 30 Jul 2025 15:28:57 +0000 (08:28 -0700)
committerChris Duncan <chris@zoso.dev>
Wed, 30 Jul 2025 15:28:57 +0000 (08:28 -0700)
src/lib/bip39-mnemonic.ts

index 8d72264ecc24eb82c2818f9c50223f9fcc01ff0a..758bf3e6f66cdc990823e2e6d2eac86a84849d03 100644 (file)
@@ -25,27 +25,6 @@ export class Bip39Mnemonic {
                return checksum\r
        }\r
 \r
-       /**\r
-       * Imports and validates an existing mnemonic phrase.\r
-       *\r
-       * The phrase must be valid according to the BIP-39 specification. Typically\r
-       * wallets use the maximum of 24 words.\r
-       *\r
-       * @param {string} phrase - String of 12, 15, 18, 21, or 24 words\r
-       * @returns {string} Mnemonic phrase validated using the BIP-39 wordlist\r
-       */\r
-       static async fromPhrase (phrase: string): Promise<Bip39Mnemonic> {\r
-               this.#isInternal = true\r
-               const self = new this()\r
-               const isValid = await this.validate(phrase)\r
-               if (isValid) {\r
-                       self.#phrase = phrase.normalize('NFKD').split(' ')\r
-                       return self\r
-               } else {\r
-                       throw new Error('Invalid mnemonic phrase.')\r
-               }\r
-       }\r
-\r
        /**\r
        * Derives a mnemonic phrase from source of entropy or seed.\r
        *\r
@@ -80,6 +59,27 @@ export class Bip39Mnemonic {
                return this.fromPhrase(sentence)\r
        }\r
 \r
+       /**\r
+       * Imports and validates an existing mnemonic phrase.\r
+       *\r
+       * The phrase must be valid according to the BIP-39 specification. Typically\r
+       * wallets use the maximum of 24 words.\r
+       *\r
+       * @param {string} phrase - String of 12, 15, 18, 21, or 24 words\r
+       * @returns {string} Mnemonic phrase validated using the BIP-39 wordlist\r
+       */\r
+       static async fromPhrase (phrase: string): Promise<Bip39Mnemonic> {\r
+               this.#isInternal = true\r
+               const self = new this()\r
+               const isValid = await this.validate(phrase)\r
+               if (isValid) {\r
+                       self.#phrase = phrase.normalize('NFKD').split(' ')\r
+                       return self\r
+               } else {\r
+                       throw new Error('Invalid mnemonic phrase.')\r
+               }\r
+       }\r
+\r
        /**\r
        * Validates a mnemonic phrase.\r
        *\r