# Class: MoneroWalletKeys

## MoneroWalletKeys

Implements a MoneroWallet which only manages keys using WebAssembly.

Implements:
  - MoneroWallet
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 17

### Methods

#### (async) addListener(listener)

Register a listener to receive wallet notifications.

##### Parameters:

Name | Type | Description
--- | --- | ---
`listener` | MoneroWalletListener | listener to receive wallet notifications

Implements:
  - MoneroWallet#addListener
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 173

#### (async) close(save)

Optionally save then close the wallet.

##### Parameters:

Name | Type | Description
--- | --- | ---
`save` | boolean | specifies if the wallet should be saved before being closed (default false)

Implements:
  - MoneroWallet#close
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 293

#### getAccounts(includeSubaddresses, tag) → {Array.<MoneroAccount>}

Get accounts with a given tag.

##### Parameters:

Name | Type | Description
--- | --- | ---
`includeSubaddresses` | boolean | include subaddresses if true
`tag` | string | tag for filtering accounts, all accounts if undefined

Implements:
  - MoneroWallet#getAccounts
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 285

##### Returns:

all accounts with the given tag

Type
  Array.<MoneroAccount>

#### (async) getAddress(accountIdx, subaddressIdx) → {string}

Get the address of a specific subaddress.

##### Parameters:

Name | Type | Description
--- | --- | ---
`accountIdx` | int | the account index of the address's subaddress
`subaddressIdx` | int | the subaddress index within the account

Implements:
  - MoneroWallet#getAddress
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 264

##### Returns:

the receive address of the specified subaddress

Type
  string

#### (async) getAddressIndex(address) → {MoneroSubaddress}

Get the account and subaddress index of the given address.

##### Parameters:

Name | Type | Description
--- | --- | ---
`address` | string | address to get the account and subaddress index from

Implements:
  - MoneroWallet#getAddressIndex
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 274

##### Returns:

the account and subaddress indices

Type
  MoneroSubaddress

#### (async) getMnemonic() → {string}

Get the wallet's mnemonic phrase derived from the seed.

Implements:
  - MoneroWallet#getMnemonic
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 211

##### Returns:

the wallet's mnemonic phrase

Type
  string

#### (async) getMnemonicLanguage() → {string}

Get the language of the wallet's mnemonic phrase.

Implements:
  - MoneroWallet#getMnemonicLanguage
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 222

##### Returns:

the language of the wallet's mnemonic phrase

Type
  string

#### (async) getPrimaryAddress() → {string}

Get the wallet's primary address.

Implements:
  - MoneroWallet#getPrimaryAddress
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 327

##### Returns:

the wallet's primary address

Type
  string

#### (async) getPrivateSpendKey() → {string}

Get the wallet's private spend key.

Implements:
  - MoneroWallet#getPrivateSpendKey
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 231

##### Returns:

the wallet's private spend key

Type
  string

#### (async) getPrivateViewKey() → {string}

Get the wallet's private view key.

Implements:
  - MoneroWallet#getPrivateViewKey
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 240

##### Returns:

the wallet's private view key

Type
  string

#### (async) getPublicSpendKey() → {string}

Get the wallet's public spend key.

Implements:
  - MoneroWallet#getPublicSpendKey
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 256

##### Returns:

the wallet's public spend key

Type
  string

#### (async) getPublicViewKey() → {string}

Get the wallet's public view key.

Implements:
  - MoneroWallet#getPublicViewKey
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 248

##### Returns:

the wallet's public view key

Type
  string

#### (async) getSubaddress(accountIdx, subaddressIdx) → {MoneroSubaddress}

Get a subaddress.

##### Parameters:

Name | Type | Description
--- | --- | ---
`accountIdx` | int | index of the subaddress's account
`subaddressIdx` | int | index of the subaddress within the account

Implements:
  - MoneroWallet#getSubaddress
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 328

##### Returns:

the retrieved subaddress

Type
  MoneroSubaddress

#### (async) getVersion() → {MoneroVersion}

Gets the version of the wallet.

Implements:
  - MoneroWallet#getVersion
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 193

##### Returns:

the version of the wallet

Type
  MoneroVersion

#### (async) isClosed() → {boolean}

Indicates if this wallet is closed or not.

Implements:
  - MoneroWallet#isClosed
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 321

##### Returns:

true if the wallet is closed, false otherwise

Type
  boolean

#### (async) isConnectedToDaemon() → {boolean}

Indicates if the wallet is connected to daemon.

Implements:
  - MoneroWallet#isConnectedToDaemon
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 189

##### Returns:

true if the wallet is connected to a daemon, false otherwise

Type
  boolean

#### (async) isViewOnly() → {bool}

Indicates if the wallet is view-only, meaning it does not have the private spend key and can therefore only observe incoming outputs.

Implements:
  - MoneroWallet#isViewOnly
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 181

##### Returns:

true if the wallet is view-only, false otherwise

Type
  bool

#### (async) removeListener(listener)

Unregister a listener to receive wallet notifications.

##### Parameters:

Name | Type | Description
--- | --- | ---
`listener` | MoneroWalletListener | listener to unregister

Implements:
  - MoneroWallet#removeListener
Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 177

#### (async, static) createWallet(config) → {MoneroWalletKeys}

Create a wallet using WebAssembly bindings to monero-project.

Example:

`let wallet = await MoneroWalletKeys.createWallet({
password: "abc123",
networkType: MoneroNetworkType.STAGENET,
mnemonic: "coexist igloo pamphlet lagoon..."
});`

##### Parameters:

Name | Type | Description
--- | --- | ---
`config` | MoneroWalletConfig | object | MoneroWalletConfig or equivalent config object ###### Properties
Name | Type | Description
--- | --- | ---
`networkType` | string | number | network type of the wallet to create (one of "mainnet", "testnet", "stagenet" or MoneroNetworkType.MAINNET|TESTNET|STAGENET)
`mnemonic` | string | mnemonic of the wallet to create (optional, random wallet created if neither mnemonic nor keys given)
`seedOffset` | string | the offset used to derive a new seed from the given mnemonic to recover a secret wallet from the mnemonic phrase
`primaryAddress` | string | primary address of the wallet to create (only provide if restoring from keys)
`privateViewKey` | string | private view key of the wallet to create (optional)
`privateSpendKey` | string | private spend key of the wallet to create (optional)
`language` | string | language of the wallet's mnemonic phrase (defaults to "English" or auto-detected)

Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 44

##### Returns:

the created wallet

Type
  MoneroWalletKeys

#### (async, static) getMnemonicLanguages()

Source:
  - src/main/js/wallet/MoneroWalletKeys.js, line 148