Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Wallet

Wallet is an API module for initializing wallets and creating/accessing accounts

A wallet is represented by mnemonic phrase, and in practice is a BIP32 Hierarchical Deterministic Wallet based on Stellar's implementation of SLIP-0010. You can think of a wallet as a master key, and the account represent keys specific to a given application or use-case. Any given wallet may create an arbitrary number of accounts.

Accounts are generated via the wallet pass-phrase and are an Ed25519 public/private keypair used to sign backups, provision libp2p identities, etc. Textile uses Ed25519 here because it's fast, compact, secure, and widely used. See the EdDSA Wikipedia page for more details.

Hierarchy

  • Wallet

Index

Constructors

constructor

  • new Wallet(recoveryPhrase: string, check?: boolean): Wallet
  • Initialize a new Wallet

    Parameters

    • recoveryPhrase: string

      Mnemonic pass-phrase (aka wordlist, recovery phrase, etc)

    • Default value check: boolean = false

      Whether to validate the input recovery phrase

    Returns Wallet

Methods

accountAt

  • accountAt(index: number | number[], password?: undefined | string): Account
  • Derives accounts (address/seed pairs) from a Textile wallet

    Uses wallet seed to derive (hardened) BIP-32 hierarchical key for a path in BIP-44 format.

    Parameters

    • index: number | number[]

      Account index. This is the (possibly multi-dimensional) index at which to derive an account key. For highly hierarchical systems, an index of arbitrary dimension can be used. For example, to derive the 3rd 2nd-level keypair, of the 1st account, index would be [0, 3].

    • Optional password: undefined | string

      mnemonic recovery phrase password (omit if none)

    Returns Account

    The specified index and associated keypair

Static fromEntropy

  • fromEntropy(strength?: undefined | number): Wallet
  • Generate a new Walet from a given entropy level

    Parameters

    • Optional strength: undefined | number

      The bits of entropy to use (defaults to 128)

    Returns Wallet

Static fromWordCount

  • fromWordCount(wordCount: number): Wallet
  • Generate a new Wallet from a given word count

    Parameters

    • wordCount: number

    Returns Wallet