@exodus/wallet
v15.1.1
Published
Primary module for managing bip39 mnemonic(s) for a single-seed or multi-seed wallet.
Downloads
7,675
Readme
@exodus/wallet
Exodus SDK feature that manages bip39 mnemonic phrase(s) for a single-seed or multi-seed wallet.
[!IMPORTANT] This feature uses the injected
seedStorage
implementation to store mnemonic phrases. It passes thepassphrase
provided towallet.create|import|changePassphrase
down toseedStorage.set
, e.g.seedStorage.set(value, { passphrase })
. Depending on the security of the platform where you're running the wallet, and the media thatseedStorage
uses on that platform, you may want to use aseedStorage
implementation that supports encryption, e.g. storage-seco.
Install
yarn add @exodus/wallet
Usage
This feature is designed to be used together with @exodus/headless
. See using the sdk.
Play with it
- Open the playground https://exodus-hydra.pages.dev/features/wallet
- Try out some methods via the UI. These correspond 1:1 with the
exodus.wallet
API. - Run the following in the Dev Tools Console:
await exodus.wallet.isLocked() // false. The playground auto-unlocks for ease of use
await exodus.wallet.lock()
await exodus.wallet.isLocked() // true
await exodus.wallet.unlock({ passphrase: 'abracadabra' }) // passphrase used in playground
API Side
See using the sdk for more details on how features plug into the SDK and the API interface in the type declaration.
Usage example:
// kick of various processes that might not require a mnemonic to be present
await exodus.application.start()
await exodus.application.load()
// create a new wallet
await exodus.wallet.create({ passphrase })
// alternatively, import a 12 word mnemonic phrase
// await exodus.wallet.import({ mnemonic, passphrase })
await exodus.wallet.exists() // now true
// by default a wallet is locked until explicitly unlocked
await exodus.wallet.isLocked() // true
await exodus.wallet.unlock({ passphrase })
await exodus.wallet.isLocked() // false
await exodus.wallet.lock()
// change the passphrase. Reminder: encryption is the responsibility of `seedStorage`!
await exodus.wallet.changePassphrase({ currentPassphrase, newPassphrase })
UI Side
This feature doesn't export any redux state or selectors.