Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link

@fuel-ts/account v0.96.1 Docs


Icon LinkClass: Mnemonic

Icon LinkConstructors

Icon Linknew Mnemonic()

Icon InfoCircle

new Mnemonic(wordlist): Mnemonic

Icon LinkParameters

wordlist: string[] = english

Provide 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

Icon InfoCircle

wordlist: string[]

Icon LinkDefined in

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

Icon LinkMethods

Icon LinkentropyToMnemonic()

Icon InfoCircle

entropyToMnemonic(entropy): string

Icon LinkParameters

entropy: BytesLike

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()

Icon InfoCircle

mnemonicToEntropy(phrase): string

Icon LinkParameters

phrase: MnemonicPhrase

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()

Icon InfoCircle

static binarySearch(target): boolean

Icon LinkParameters

target: string

Icon LinkReturns

boolean

Icon LinkDefined in

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


Icon LinkentropyToMnemonic()

Icon InfoCircle

static entropyToMnemonic(entropy, wordlist): string

Icon LinkParameters

entropy: BytesLike

Entropy source to the mnemonic phrase.

wordlist: string[] = 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()

Icon InfoCircle

static 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

size: number = 32

Number of bytes used as an entropy

extraEntropy: BytesLike = ''

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()

Icon InfoCircle

static isMnemonicValid(phrase): boolean

Validates if given mnemonic is valid

Icon LinkParameters

phrase: string

Mnemonic 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()

Icon InfoCircle

static masterKeysFromSeed(seed): Uint8Array

Icon LinkParameters

seed: string

BIP39 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()

Icon InfoCircle

static mnemonicToEntropy(phrase, wordlist): string

Icon LinkParameters

phrase: MnemonicPhrase

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.

Icon LinkReturns

string

Mnemonic phrase

Icon LinkDefined in

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


Icon LinkmnemonicToMasterKeys()

Icon InfoCircle

static mnemonicToMasterKeys(phrase, passphrase): Uint8Array

Icon LinkParameters

phrase: MnemonicPhrase

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.

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()

Icon InfoCircle

static mnemonicToSeed(phrase, passphrase): string

Icon LinkParameters

phrase: MnemonicPhrase

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.

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()

Icon InfoCircle

static seedToExtendedKey(seed, testnet): string

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

Icon LinkParameters

seed: string

BIP39 seed

testnet: boolean = false

Inform 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