@fuel-ts/account .Mnemonic
• new Mnemonic(wordlist?
): Mnemonic
Name | Type | Default value | Description |
---|---|---|---|
wordlist | string [] | english | Provide a wordlist with the list of words used to generate the mnemonic phrase. The default value is the English list. |
Mnemonic instance
packages/account/src/mnemonic/mnemonic.ts:58
• wordlist: string
[]
packages/account/src/mnemonic/mnemonic.ts:51
▸ entropyToMnemonic(entropy
): string
Name | Type | Description |
---|---|---|
entropy | BytesLike | Entropy source to the mnemonic phrase. |
string
Mnemonic phrase
packages/account/src/mnemonic/mnemonic.ts:78
▸ mnemonicToEntropy(phrase
): string
Name | Type | Description |
---|---|---|
phrase | MnemonicPhrase | Mnemonic phrase composed by words from the provided wordlist |
string
Entropy hash
packages/account/src/mnemonic/mnemonic.ts:69
▸ binarySearch(target
): boolean
Name | Type |
---|---|
target | string |
boolean
packages/account/src/mnemonic/mnemonic.ts:162
▸ entropyToMnemonic(entropy
, wordlist?
): string
Name | Type | Default value | Description |
---|---|---|---|
entropy | BytesLike | undefined | Entropy source to the mnemonic phrase. |
wordlist | string [] | english | - |
string
64-byte array contains privateKey and chainCode as described on BIP39
packages/account/src/mnemonic/mnemonic.ts:101
▸ 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.
Name | Type | Default value | Description |
---|---|---|---|
size | number | 32 | Number of bytes used as an entropy |
extraEntropy | BytesLike | '' | Optional extra entropy to increase randomness |
string
A randomly generated mnemonic
packages/account/src/mnemonic/mnemonic.ts:243
▸ isMnemonicValid(phrase
): boolean
Validates if given mnemonic is valid
Name | Type | Description |
---|---|---|
phrase | string | Mnemonic phrase composed by words from the provided wordlist |
boolean
true if phrase is a valid mnemonic
packages/account/src/mnemonic/mnemonic.ts:141
▸ masterKeysFromSeed(seed
): Uint8Array
Name | Type | Description |
---|---|---|
seed | string | BIP39 seed |
Uint8Array
64-byte array contains privateKey and chainCode as described on BIP39
packages/account/src/mnemonic/mnemonic.ts:188
▸ mnemonicToEntropy(phrase
, wordlist?
): string
Name | Type | Default value | Description |
---|---|---|---|
phrase | MnemonicPhrase | undefined | Mnemonic phrase composed by words from the provided wordlist |
wordlist | string [] | english | Provide a wordlist with the list of words used to generate the mnemonic phrase. The default value is the English list. |
string
Mnemonic phrase
packages/account/src/mnemonic/mnemonic.ts:88
▸ mnemonicToMasterKeys(phrase
, passphrase?
): Uint8Array
Name | Type | Default value | Description |
---|---|---|---|
phrase | MnemonicPhrase | undefined | Mnemonic phrase composed by words from the provided wordlist |
passphrase | BytesLike | '' | 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. |
Uint8Array
64-byte array contains privateKey and chainCode as described on BIP39
packages/account/src/mnemonic/mnemonic.ts:131
▸ mnemonicToSeed(phrase
, passphrase?
): string
Name | Type | Default value | Description |
---|---|---|---|
phrase | MnemonicPhrase | undefined | Mnemonic phrase composed by words from the provided wordlist |
passphrase | BytesLike | '' | 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. |
string
64-byte array contains privateKey and chainCode as described on BIP39
packages/account/src/mnemonic/mnemonic.ts:117
▸ seedToExtendedKey(seed
, testnet?
): string
Get the extendKey as defined on BIP-32 from the provided seed
Name | Type | Default value | Description |
---|---|---|---|
seed | string | undefined | BIP39 seed |
testnet | boolean | false | Inform if should use testnet or mainnet prefix, default value is true (mainnet ). |
string
BIP-32 extended private key