# eth2-wallet-js

> NodeJS implementation of an Ethereum 2 Wallet keystore.

Latest version **0.3.6** (published 2020-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install eth2-wallet-js
pnpm add eth2-wallet-js
yarn add eth2-wallet-js
bun add eth2-wallet-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.6 |
| Published | 2020-12-05 |
| First published | 2020-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 16 |
| Unpacked size | 227.3 KB |
| Known vulnerabilities | 0 (+5 in 4 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | copernicrypt |

## Links

- npm: https://www.npmjs.com/package/eth2-wallet-js
- Repository: https://github.com/copernicrypt/eth2-wallet-js
- Homepage: https://github.com/copernicrypt/eth2-wallet-js#readme
- Issues: https://github.com/copernicrypt/eth2-wallet-js/issues
- npm.io page: https://npm.io/package/eth2-wallet-js

## Dependencies (16)

- [uuid](https://npm.io/package/uuid.md) ^8.3.1
- [bip39](https://npm.io/package/bip39.md) ^3.0.2
- [ethers](https://npm.io/package/ethers.md) ^5.0.17
- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [bcrypto](https://npm.io/package/bcrypto.md) ^5.3.0
- [p-queue](https://npm.io/package/p-queue.md) ^6.6.2
- [archiver](https://npm.io/package/archiver.md) ^5.0.2
- [commander](https://npm.io/package/commander.md) ^6.1.0
- [babel-node](https://npm.io/package/babel-node.md) ^0.0.1-security
- [@babel/node](https://npm.io/package/@babel/node.md) ^7.12.1
- [extract-zip](https://npm.io/package/extract-zip.md) ^2.0.1
- [bls-eth-wasm](https://npm.io/package/bls-eth-wasm.md) ^0.4.1
- [bigint-buffer](https://npm.io/package/bigint-buffer.md) ^1.1.5
- [@chainsafe/ssz](https://npm.io/package/@chainsafe/ssz.md) ^0.6.13
- [@chainsafe/lodestar-types](https://npm.io/package/@chainsafe/lodestar-types.md) ^0.11.0
- [@chainsafe/lodestar-config](https://npm.io/package/@chainsafe/lodestar-config.md) ^0.11.0

## Recent versions

- 0.3.6 (latest) — 2020-12-05
- 0.3.5 — 2020-12-01
- 0.3.4 — 2020-12-01
- 0.3.1 — 2020-11-16
- 0.3.0 — 2020-11-16
- 0.2.6 — 2020-11-10
- 0.2.5 — 2020-11-10
- 0.2.4 — 2020-10-19
- 0.2.3 — 2020-10-19
- 0.2.2 — 2020-10-19
- 0.2.1 — 2020-10-19
- 0.2.0 — 2020-09-28

## README

# eth2-wallet-js
![Release](https://img.shields.io/github/v/release/copernicrypt/eth2-wallet-js?include_prereleases)
![License](https://img.shields.io/github/license/copernicrypt/eth2-wallet-js?style=flat) ![Unit Tests](https://github.com/copernicrypt/eth2-wallet-js/workflows/Tests/badge.svg)

VanillaJS implementation of an Ethereum 2 Wallet keystore.

**\*\*USE AT YOUR OWN RISK\*\***

-   [Highlights](#highlights)
-   [Dependencies](#dependencies)
-   [Install](#install)
-   [Test](#test)
-   [Module Usage](#module-usage)
    -   [Basic NodeJS](#basic-nodejs-usage)
    -   [Instance Options](#instance-options)
    -   [Functions](#functions)
    -   [Custom Store](#custom-store)
    -   [Custom Key](#custom-key)
-   [CLI Usage](#cli-usage)
-   [Notes/Limitations](#noteslimitations)
-   [Roadmap](#roadmap)
-   [Thanks](#thanks)

## Highlights
-   Use as [Module](#functions) and/or [CLI](#cli-usage)
-   [EIP-2335]((https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2335.md)) compatible.
-   Supports Customizable [Store](#custom-store) and [Key](#custom-key) implementations. Write your own Storage or Key classes.
-   Default Storage in `~/.eth2-wallet-js`

## Dependencies
-   [Nodejs](https://nodejs.org/en/download/) >= 12.0.0

## Install

### NodeJS Module
```shell
yarn add https://github.com/copernicrypt/eth2-wallet-js
yarn install
```

### CLI
```shell
git clone https://github.com/copernicrypt/eth2-wallet-js
yarn install
```

## Test

```shell
yarn test
```

## Module Usage

### Basic NodeJS Usage
```javascript
import { Wallet } from 'eth2-wallet-js';

let w = new Wallet();
await w.init();
let wallet = await w.walletCreate();
let key = await w.keyCreate(wallet, 'mypassword');
```

### Instance Options
See [Custom Key](#custom-key) and [Custom Store](#custom-store) documentation on writing your own key/store implementations.

```javascript
import { Wallet } from 'eth2-wallet-js';
import { CustomStore } from 'custom-store';
import { CustomKey } from 'custom-key';

const cStore = new CustomStore();
const cKey = new CustomKey();

let opts = {
  algorithm: 'aes-256-cbc', // Used to encrypt keys and mnemonic
  wallet_path: '~/.eth2-wallet-js/wallet',
  fork_version: 'pyrmont', // or 'mainnet' or 'medalla'
  store: cStore,
  key: cKey
}

let w = new Wallet(opts);
await w.init();
```

### Functions

<a name="module_Wallet"></a>
## Wallet

* [Wallet](#module_Wallet)
    * [.Wallet](#module_Wallet.Wallet) : <code>Object</code>
        * [.init()](#module_Wallet.Wallet+init) ⇒ <code>Null</code>
        * [.depositData(walletId, keyId, password, withdrawalOpts, [forkVersion])](#module_Wallet.Wallet+depositData) ⇒ <code>Object</code> \| <code>String</code>
        * [.keyCreate(wallet_id, password)](#module_Wallet.Wallet+keyCreate) ⇒ <code>Object</code>
        * [.keyDelete(walletId, keyId, password)](#module_Wallet.Wallet+keyDelete) ⇒ <code>Boolean</code>
        * [.keyImport(walletId, privateKey, password)](#module_Wallet.Wallet+keyImport) ⇒ <code>Object</code>
        * [.keyList(id)](#module_Wallet.Wallet+keyList) ⇒ <code>Array</code>
        * [.keyPrivate(walletId, keyId, password)](#module_Wallet.Wallet+keyPrivate) ⇒ <code>String</code>
        * [.keySearch(search, walletId)](#module_Wallet.Wallet+keySearch) ⇒ <code>Object</code>
        * [.parsePasswordFile(file, wallet, key)](#module_Wallet.Wallet+parsePasswordFile) ⇒ <code>String</code>
        * [.sign(message, walletId, search, password)](#module_Wallet.Wallet+sign) ⇒ <code>Array</code>
        * [.walletBackup(walletId, [destination])](#module_Wallet.Wallet+walletBackup) ⇒ <code>Promise</code>
        * [.walletCreate([opts])](#module_Wallet.Wallet+walletCreate) ⇒ <code>String</code>
        * [.walletDelete(id)](#module_Wallet.Wallet+walletDelete) ⇒ <code>Boolean</code>
        * [.walletList()](#module_Wallet.Wallet+walletList) ⇒ <code>Array</code>
        * [.walletMnemonic(walletId, password)](#module_Wallet.Wallet+walletMnemonic) ⇒ <code>String</code>
        * [.walletRestore(source, [wallet])](#module_Wallet.Wallet+walletRestore) ⇒ <code>Boolean</code>

<a name="module_Wallet.Wallet"></a>

### Wallet.Wallet : <code>Object</code>
An implementation of ETH2 Wallet

**Kind**: static class of [<code>Wallet</code>](#module_Wallet)  

* [.Wallet](#module_Wallet.Wallet) : <code>Object</code>
    * [.init()](#module_Wallet.Wallet+init) ⇒ <code>Null</code>
    * [.depositData(walletId, keyId, password, withdrawalOpts, [forkVersion])](#module_Wallet.Wallet+depositData) ⇒ <code>Object</code> \| <code>String</code>
    * [.keyCreate(wallet_id, password)](#module_Wallet.Wallet+keyCreate) ⇒ <code>Object</code>
    * [.keyDelete(walletId, keyId, password)](#module_Wallet.Wallet+keyDelete) ⇒ <code>Boolean</code>
    * [.keyImport(walletId, privateKey, password)](#module_Wallet.Wallet+keyImport) ⇒ <code>Object</code>
    * [.keyList(id)](#module_Wallet.Wallet+keyList) ⇒ <code>Array</code>
    * [.keyPrivate(walletId, keyId, password)](#module_Wallet.Wallet+keyPrivate) ⇒ <code>String</code>
    * [.keySearch(search, walletId)](#module_Wallet.Wallet+keySearch) ⇒ <code>Object</code>
    * [.parsePasswordFile(file, wallet, key)](#module_Wallet.Wallet+parsePasswordFile) ⇒ <code>String</code>
    * [.sign(message, walletId, search, password)](#module_Wallet.Wallet+sign) ⇒ <code>Array</code>
    * [.walletBackup(walletId, [destination])](#module_Wallet.Wallet+walletBackup) ⇒ <code>Promise</code>
    * [.walletCreate([opts])](#module_Wallet.Wallet+walletCreate) ⇒ <code>String</code>
    * [.walletDelete(id)](#module_Wallet.Wallet+walletDelete) ⇒ <code>Boolean</code>
    * [.walletList()](#module_Wallet.Wallet+walletList) ⇒ <code>Array</code>
    * [.walletMnemonic(walletId, password)](#module_Wallet.Wallet+walletMnemonic) ⇒ <code>String</code>
    * [.walletRestore(source, [wallet])](#module_Wallet.Wallet+walletRestore) ⇒ <code>Boolean</code>

<a name="module_Wallet.Wallet+init"></a>

#### wallet.init() ⇒ <code>Null</code>
This just awaits the initialization of the BLS package.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
<a name="module_Wallet.Wallet+depositData"></a>

#### wallet.depositData(walletId, keyId, password, withdrawalOpts, [forkVersion]) ⇒ <code>Object</code> \| <code>String</code>
Gets the deposit data fields for a validator deposit on the ETH1 chain.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Object</code> \| <code>String</code> - Either an object containing the depoosit fields, or the raw TX data string.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| walletId | <code>String</code> |  | The wallet ID where the validator key is stored. |
| keyId | <code>String</code> |  | The key ID of the validator to generate data for. |
| password | <code>String</code> |  | The password of the validator key. |
| withdrawalOpts | <code>Object</code> |  | Withdrawal Parameters. Either withdrawalOpts.withdrawal_public_key, withdrawalOpts.withdrawal_key_id or withdrawalOpts.withdrawal_key_wallet must be specified. |
| [withdrawalOpts.withdrawal_key_id] | <code>String</code> | <code>&lt;keyId&gt;</code> | The keyID of the Withdrawal key. |
| [withdrawalOpts.withdrawal_key_wallet] | <code>String</code> | <code>&lt;walletId&gt;</code> | The wallet ID where the withdrawal key is stored. |
| [withdrawalOpts.withdrawal_public_key] | <code>String</code> | <code></code> | The public key of the withdrawal key. Overrides withdrawal_key_wallet and withdrawal_key_id. |
| [forkVersion] | <code>String</code> | <code></code> | Optionally override the Instance fork version. |

<a name="module_Wallet.Wallet+keyCreate"></a>

#### wallet.keyCreate(wallet_id, password) ⇒ <code>Object</code>
Creates a new ETH2 keypair.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Object</code> - An object containing the wallet_id, key_id and public_key.  
**Throws**: On failure


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| wallet_id | <code>String</code> |  | The name of the wallet to create an key in. |
| password | <code>String</code> |  | The password to protect the key. |
| [opts.keyId] | <code>String</code> | <code>UUID</code> | The name of the key to create. |
| [opts.walletPassword] | <code>String</code> | <code></code> | Wallet password for HD wallets. |

<a name="module_Wallet.Wallet+keyDelete"></a>

#### wallet.keyDelete(walletId, keyId, password) ⇒ <code>Boolean</code>
Removes a key from a wallet.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Boolean</code> - True on successful deletion.  
**Throws**: On failure


| Param | Type | Description |
| --- | --- | --- |
| walletId | <code>String</code> | The wallet ID. |
| keyId | <code>String</code> | The Key ID. |
| password | <code>String</code> | The password protecting the key. |

<a name="module_Wallet.Wallet+keyImport"></a>

#### wallet.keyImport(walletId, privateKey, password) ⇒ <code>Object</code>
Import a private key into the keystore

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Object</code> - An object containing the walletId <string> key ID <UUID> and public key <48-byte HEX>  
**Throws**: On failure


| Param | Type | Description |
| --- | --- | --- |
| walletId | <code>String</code> | The wallet to import into. |
| privateKey | <code>String</code> | A 32byte HEX-format private key |
| password | <code>String</code> | A password to protect the key. |
| [opts.keyId] | <code>String</code> | The ID reference for the key. |
| [opts.path] | <code>String</code> | Optional derivation path reference. |

<a name="module_Wallet.Wallet+keyList"></a>

#### wallet.keyList(id) ⇒ <code>Array</code>
List of available keys in a wallet.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Array</code> - An array of key objects.  

| Param | Type | Description |
| --- | --- | --- |
| id | <code>String</code> | The wallet ID to search |

<a name="module_Wallet.Wallet+keyPrivate"></a>

#### wallet.keyPrivate(walletId, keyId, password) ⇒ <code>String</code>
Get a private key

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>String</code> - The 64-byte HEX formatted private key.  
**Throws**: On failure


| Param | Type | Description |
| --- | --- | --- |
| walletId | <code>String</code> | The wallet ID. |
| keyId | <code>String</code> | The Key ID. |
| password | <code>String</code> | The password protecting the key. |

<a name="module_Wallet.Wallet+keySearch"></a>

#### wallet.keySearch(search, walletId) ⇒ <code>Object</code>
Finds a key in the store.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Object</code> - The key object.  

| Param | Type | Description |
| --- | --- | --- |
| search | <code>String</code> | The keyId or public key to search for. |
| walletId | <code>String</code> | The wallet storing the key. |

<a name="module_Wallet.Wallet+sign"></a>

#### wallet.sign(message, walletId, search, password) ⇒ <code>Array</code>
Signs a generic message with a private key.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Array</code> - The 96-byte BLS signature.  

| Param | Type | Description |
| --- | --- | --- |
| message | <code>String</code> | The message to sign (32-Byte HEX) |
| walletId | <code>String</code> | Wallet ID where the key is stored. |
| search | <code>String</code> | The key to search for. Accepts keyID, publicKey, and privateKey. |
| password | <code>String</code> | Password protecting the signing key. |

<a name="module_Wallet.Wallet+walletBackup"></a>

#### wallet.walletBackup(walletId, [destination]) ⇒ <code>Promise</code>
Creates a wallet backup file

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Promise</code> - Resolves to save destination path on success.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| walletId | <code>String</code> |  | The ID of the wallet to backup. |
| [destination] | <code>String</code> | <code></code> | The destination to write the backup file. |

<a name="module_Wallet.Wallet+walletCreate"></a>

#### wallet.walletCreate([opts]) ⇒ <code>String</code>
Creates a new wallet to store keys.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>String</code> - The wallet identifier.  
**Throws**: On failure


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [opts] | <code>Object</code> | <code>{}</code> | Optional parameters. |
| [opts.wallet_id] | <code>String</code> | <code>uuidv4</code> | Wallet identifer. If not provided, will be random. |
| [opts.type] | <code>String</code> | <code>1</code> | The type of wallet to create. 1=Simple, 2=Hierarchical deterministic. |
| [opts.password] | <code>String</code> | <code></code> | Password for HD wallets. |
| [opts.mnemonic] | <code>String</code> | <code></code> | BIP39 mnemonic for HD wallets. |

<a name="module_Wallet.Wallet+walletDelete"></a>

#### wallet.walletDelete(id) ⇒ <code>Boolean</code>
Delete a wallet

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Boolean</code> - True if the delete was successful.  
**Throws**: On failure


| Param | Type | Description |
| --- | --- | --- |
| id | <code>String</code> | The wallet identifier |

<a name="module_Wallet.Wallet+walletList"></a>

#### wallet.walletList() ⇒ <code>Array</code>
Return a list of available wallet IDs

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Array</code> - A list of wallet IDs.  
**Throws**: On failure

<a name="module_Wallet.Wallet+walletMnemonic"></a>

#### wallet.walletMnemonic(walletId, password) ⇒ <code>String</code>
Returns the wallet mnemonic phrase.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>String</code> - The mnemonic phrase.  

| Param | Type | Description |
| --- | --- | --- |
| walletId | <code>String</code> | The wallet ID. |
| password | <code>String</code> | The password protecting the mnemonic. |

<a name="module_Wallet.Wallet+walletRestore"></a>

#### wallet.walletRestore(source, [opts]) ⇒ <code>Object</code>
Restores a wallet from file.

**Kind**: instance method of [<code>Wallet</code>](#module_Wallet.Wallet)  
**Returns**: <code>Boolean</code> - Returns true on success.  
**Throws**: On failure.


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| source | <code>String</code> |  | The absolute path of the source file. |
| [wallet] | <code>String</code> | <code></code> | Optional wallet name to import into. Defaults to filename. |
| [opts] | <code>Object</code> | <code>{}</code> | Optional parameters. |
| [opts.wallet] | <code>String</code> | <code>null</code> | Optional wallet name to import into. Defaults to filename. |
| [opts.rebuild] | <code>Boolean</code> | <code>false</code> | Whether to rebuild the index. Useful if importing from a different wallet provider like the official CLI. |

### Custom Store
Standard Javascript Class. See examples in `src/store`.

#### Specifications
-   Implements:
    -   `indexAccountNext([path=null]) returns Integer`
    -   `indexCreate([path=null], [keyType=1]) returns Object`
    -   `indexExists([path=null]) returns Boolean`
    -   `keyDelete(<search>, [path=null]) returns Boolean | throws`
    -   `keyList([path=null]) returns Array | throws`
    -   `keySearch(<search>, [path=null]) returns { key_id, public_key, key_object } | throws`
    -   `keyWrite(<keyData>, [opts={ keyId, publicKey, path }]) returns Boolean | throws`
    -   `mnemonicCreate(<mnemonic>, [path=null]) returns Boolean | throws`
    -   `mnemonicGet([path=null]) returns Object | String | throws`
    -   `pathBackup(<path>, [destination=null]) returns undefined | throws`
    -   `pathDelete([path=null]) returns Boolean | throws`
    -   `pathList([path=null]) returns Array | throws`
    -   `pathRestore(<source>, [opts]) returns Boolean | throws`

### Custom Key
Standard Javascript Class. See examples in `src/key`.

#### Specifications
-   JSON formatted
-   Properties: One of `key_id` or `uuid`
-   `constructor(<algorithm>, <version>)`
    -   **algorithm**: Encryption algorithm protecting the key.
    -   **version**: Key version
-   Implements `encrypt` and `decrypt` functions
    -   `encrypt(<privateKey>, <password>, <publicKey>, [opts]) returns <jsonObject>`
    -   `decrypt(<jsonObject>, <password>) returns <privateKey>`

## CLI Usage
The CLI can be invoked using yarn or npm:

```shell
yarn run cli <command> [...args]
```

-   \<parameters\> are required.
-   \[options\] are optional.

### keyCreate \<wallet\> \<password\> \[key\] \[walletPassword\]
Imports a private key into a wallet.
**HD Wallets require the `--walletPassword` flag.**

```shell
$ yarn run cli keyCreate --wallet=primary --password=testpassword --key=testaccountID
{
  wallet_id: "primary",
  public_key: "b6de3f6dd56a863f69bca81af4dc9877d04a81df361bbe555d6944b9d84fce18fdfb939d9ef3c312ead638b759b207c9",
  key_id: "testaccoundID"
}
```

### keyDelete \<wallet\> \<key\> \<password\>
Deletes a key from a wallet.
**Not available for HD Wallets**

```shell
$ yarn run cli keyDelete --wallet=primary --key=testaccountID --password=testpassword
Key Deleted: testaccountID ---- Wallet: primary
```

### keyImport \<wallet\> \<privatekey\> \<password\> \[key\]
Imports a private key into a wallet.
**Not available for HD Wallets**

```shell
$ yarn run cli keyImport --wallet=primary --privatekey=1e16b2c1947fd9fd4045a88177313db10198ed6abd1b0f165d49cd13a72546e2 --password=testpassword --key=testaccountID
{
  wallet_id: "primary",
  public_key: "b6de3f6dd56a863f69bca81af4dc9877d04a81df361bbe555d6944b9d84fce18fdfb939d9ef3c312ead638b759b207c9",
  key_id: "testaccoundID"
}
```

### keyList \<wallet\>
Lists all keys for a given wallet.

```shell
$ yarn run cli keyList --wallet=test
[
  'test',
  'test2'
]
```

### keyPrivate \<wallet\> \<key\> \<password\>
Returns a private key HEX.

```shell
$ yarn run cli keyPrivate --wallet=primary --key=testaccountID --password=testpassword
1e16b2c1947fd9fd4045a88177313db10198ed6abd1b0f165d49cd13a72546e2
```

### keySearch \<wallet\> \<search\>
Finds a key by search term. Accepts key ID or public key.

```shell
$ yarn run cli keySearch --wallet=primary --search=testaccountID
{
  public_key: "HEX",
  key_id: "testaccoundID"
}
```

### sign \<message\> \<wallet\> \<search\> \<password\>
Signs a generic message with a key.

```shell
$ yarn run cli sign --message=9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 --wallet=primary --search=key1 --password=test
```

### walletBackup \<wallet\>\ [destination=null\]
Backs up a wallet to file.

```shell
$ yarn run cli walletBackup --wallet=test
Wallet "test" successfully backed up.
```

### walletCreate \[wallet=UUID\]\[type=1\]\[password]
Creates a new wallet.

Available Types: `1` (Random) or `2` (HD)
**HD wallets require the `--password` flag**

```shell
$ yarn run cli walletCreate --wallet=test
Created wallet: test
```

```shell
$ yarn run cli walletCreate --wallet=HDTest --password=protectMnemonic
Created wallet: HDTest
```

### walletDelete \<wallet\>
Deletes a wallet.

```shell
$ yarn run cli walletDelete --wallet=test
Deleted wallet: test
```

### walletList
Lists all available wallets

```shell
$ yarn run cli walletList
[
  'test',
  'test2'
]
```

### walletMnemonic
Returns the mnemonic for a wallet.
**Not available for Simple Wallets**

```shell
$ yarn run cli walletMnemonic --wallet=test --password=test
explain fix pink title village payment sell under critic adapt zone upset explain fix pink title village payment sell under critic adapt zone upset
```

### walletRestore \<source\> \[wallet=null\] \[rebuild=false\]
Restores a wallet from file. If you want to import from the official Launchpad CLI, simply place all of the keys in the top-level path of a zip file and import with the `--rebuild=true` option.

```shell
$ yarn run cli walletRestore --source=/user/home/test.zip
Wallet "test" successfully restored.
```

### depositData \<wallet\> \<password\> \<key\> \[withdrawalwallet=\<wallet\>\] \[withdrawalkey=\<key\>\] \[withdrawalpublickey=null\] \[amount=32000000000\] \[raw=false\] \[fork=null\]
Generates deposit data for submitting to the deposit contract.  

```shell
$ yarn run cli depositData --wallet=primary --password=testpassword --key=testaccountId --withdrawalpublickey=b6de3f6dd56a863f69bca81af4dc9877d04a81df361bbe555d6944b9d84fce18fdfb939d9ef3c312ead638b759b207c9 --fork=mainnet
{
  pubkey: 'b88f5ff7e293d26d24a2655a8c72c8b92d495393548f7b86a31c2fe0923fd1ba292f31c11bb740e8acd7f599fb2ae06d',
  withdrawal_credentials: '00756e0bd4defe8a84f4303f6004e7f1b6978ddbe7fc7d22e2b0bd5f1c895e4c',
  signature: '92543970b5d2ab17666c9db957252d3a46ebf47782dfd8c53fc74d3cdce99883f35468d07d48094cfb8c986569e54f4619cdc64242e3c478a3899e4264a8d6d6a872311523c60f39b788d0398da77322dd2b8922e6f7b7ce4a8696b625bb59a3',
  amount: '32000000000',
  deposit_data_root: 'ea0c696c122426c32e5d6abe3caa4334cdc22fb08caa2601a6737e842fa73554'
}

```

```shell
$ yarn run cli depositData --wallet=primary --password=testpassword --key=testaccountId --withdrawalpublickey=b6de3f6dd56a863f69bca81af4dc9877d04a81df361bbe555d6944b9d84fce18fdfb939d9ef3c312ead638b759b207c9 --raw
0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120ea0c696c122426c32e5d6abe3caa4334cdc22fb08caa2601a6737e842fa735540000000000000000000000000000000000000000000000000000000000000030b88f5ff7e293d26d24a2655a8c72c8b92d495393548f7b86a31c2fe0923fd1ba292f31c11bb740e8acd7f599fb2ae06d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000756e0bd4defe8a84f4303f6004e7f1b6978ddbe7fc7d22e2b0bd5f1c895e4c000000000000000000000000000000000000000000000000000000000000006092543970b5d2ab17666c9db957252d3a46ebf47782dfd8c53fc74d3cdce99883f35468d07d48094cfb8c986569e54f4619cdc64242e3c478a3899e4264a8d6d6a872311523c60f39b788d0398da77322dd2b8922e6f7b7ce4a8696b625bb59a3
```

## Notes/Limitations
-   Use at your own risk.

## Roadmap
-   ~Implement [EIP-2335](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2335.md)~
-   ~Add Import/Export function~
-   ~Add support for BIP-39 HD wallets~
-   Add support for password files

## Thanks
Would not be possible without the work being done by [@chainsafe](https://github.com/ChainSafe/) and [@herumi](https://github.com/herumi/)

---
_Source: https://npm.io/package/eth2-wallet-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
