Icon LinkClass: Mnemonic

@fuel-ts/account .Mnemonic

Icon LinkConstructors

Icon Linkconstructor

new Mnemonic(wordlist?): Mnemonic

Icon LinkParameters

NameTypeDefault valueDescription
wordliststring[]englishProvide a wordlist with the list of words used to generate the mnemonic phrase. The default value is the English list.

Icon LinkReturns

Mnemonic

Mnemonic instance

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:58 Icon Link

Icon LinkProperties

Icon Linkwordlist

wordlist: string[]

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:51 Icon Link

Icon LinkMethods

Icon LinkentropyToMnemonic

entropyToMnemonic(entropy): string

Icon LinkParameters

NameTypeDescription
entropyBytesLike Entropy source to the mnemonic phrase.

Icon LinkReturns

string

Mnemonic phrase

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:78 Icon Link


Icon LinkmnemonicToEntropy

mnemonicToEntropy(phrase): string

Icon LinkParameters

NameTypeDescription
phraseMnemonicPhrase Mnemonic phrase composed by words from the provided wordlist

Icon LinkReturns

string

Entropy hash

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:69 Icon Link


Icon LinkbinarySearch

binarySearch(target): boolean

Icon LinkParameters

NameType
targetstring

Icon LinkReturns

boolean

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:162 Icon Link


Icon LinkentropyToMnemonic

entropyToMnemonic(entropy, wordlist?): string

Icon LinkParameters

NameTypeDefault valueDescription
entropyBytesLike undefinedEntropy source to the mnemonic phrase.
wordliststring[]english-

Icon LinkReturns

string

64-byte array contains privateKey and chainCode as described on BIP39

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:101 Icon Link


Icon Linkgenerate

generate(size?, extraEntropy?): string

Create a new mnemonic using a randomly generated number as entropy. As defined in BIP39, the entropy must be a multiple of 32 bits, and its size must be between 128 and 256 bits. Therefore, the possible values for strength are 128, 160, 192, 224, and 256. If not provided, the default entropy length will be set to 256 bits. The return is a list of words that encodes the generated entropy.

Icon LinkParameters

NameTypeDefault valueDescription
sizenumber32Number of bytes used as an entropy
extraEntropyBytesLike ''Optional extra entropy to increase randomness

Icon LinkReturns

string

A randomly generated mnemonic

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:243 Icon Link


Icon LinkisMnemonicValid

isMnemonicValid(phrase): boolean

Validates if given mnemonic is valid

Icon LinkParameters

NameTypeDescription
phrasestringMnemonic phrase composed by words from the provided wordlist

Icon LinkReturns

boolean

true if phrase is a valid mnemonic

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:141 Icon Link


Icon LinkmasterKeysFromSeed

masterKeysFromSeed(seed): Uint8Array

Icon LinkParameters

NameTypeDescription
seedstringBIP39 seed

Icon LinkReturns

Uint8Array

64-byte array contains privateKey and chainCode as described on BIP39

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:188 Icon Link


Icon LinkmnemonicToEntropy

mnemonicToEntropy(phrase, wordlist?): string

Icon LinkParameters

NameTypeDefault valueDescription
phraseMnemonicPhrase undefinedMnemonic phrase composed by words from the provided wordlist
wordliststring[]englishProvide a wordlist with the list of words used to generate the mnemonic phrase. The default value is the English list.

Icon LinkReturns

string

Mnemonic phrase

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:88 Icon Link


Icon LinkmnemonicToMasterKeys

mnemonicToMasterKeys(phrase, passphrase?): Uint8Array

Icon LinkParameters

NameTypeDefault valueDescription
phraseMnemonicPhrase undefinedMnemonic phrase composed by words from the provided wordlist
passphraseBytesLike ''Add additional security to protect the generated seed with a memorized passphrase. Note: if the owner forgot the passphrase, all wallets and accounts derive from the phrase will be lost.

Icon LinkReturns

Uint8Array

64-byte array contains privateKey and chainCode as described on BIP39

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:131 Icon Link


Icon LinkmnemonicToSeed

mnemonicToSeed(phrase, passphrase?): string

Icon LinkParameters

NameTypeDefault valueDescription
phraseMnemonicPhrase undefinedMnemonic phrase composed by words from the provided wordlist
passphraseBytesLike ''Add additional security to protect the generated seed with a memorized passphrase. Note: if the owner forgot the passphrase, all wallets and accounts derive from the phrase will be lost.

Icon LinkReturns

string

64-byte array contains privateKey and chainCode as described on BIP39

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:117 Icon Link


Icon LinkseedToExtendedKey

seedToExtendedKey(seed, testnet?): string

Get the extendKey as defined on BIP-32 from the provided seed

Icon LinkParameters

NameTypeDefault valueDescription
seedstringundefinedBIP39 seed
testnetbooleanfalseInform if should use testnet or mainnet prefix, default value is true (mainnet).

Icon LinkReturns

string

BIP-32 extended private key

Icon LinkDefined in

packages/account/src/mnemonic/mnemonic.ts:208 Icon Link