> For the complete documentation index, see [llms.txt](https://confluxnetwork.gitbook.io/js-conflux-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://confluxnetwork.gitbook.io/js-conflux-sdk/api/wallet.md).

# Wallet

### Wallet

Wallet to manager accounts.

**Kind**: global class

* [Wallet](#Wallet)
  * [new Wallet(networkId)](#new_Wallet_new)
  * [.setNetworkId(networkId)](#Wallet+setNetworkId)
  * [.has(address)](#Wallet+has) ⇒ `boolean`
  * [.delete(address)](#Wallet+delete) ⇒ `boolean`
  * [.clear()](#Wallet+clear)
  * [.set(address, account)](#Wallet+set) ⇒ `any`
  * [.get(address)](#Wallet+get) ⇒ `Account`
  * [.addPrivateKey(privateKey)](#Wallet+addPrivateKey) ⇒ `PrivateKeyAccount`
  * [.addRandom(\[entropy\])](#Wallet+addRandom) ⇒ `PrivateKeyAccount`
  * [.addKeystore(keystore, password)](#Wallet+addKeystore) ⇒ `PrivateKeyAccount`

#### new Wallet(networkId)

| Param     | Type     |
| --------- | -------- |
| networkId | `number` |

#### wallet.setNetworkId(networkId)

Set network id

**Kind**: instance method of [`Wallet`](#Wallet)

| Param     | Type     |
| --------- | -------- |
| networkId | `number` |

#### wallet.has(address) ⇒ `boolean`

Check if address exist

**Kind**: instance method of [`Wallet`](#Wallet)

| Param   | Type     |
| ------- | -------- |
| address | `string` |

#### wallet.delete(address) ⇒ `boolean`

Drop one account by address

**Kind**: instance method of [`Wallet`](#Wallet)

| Param   | Type     |
| ------- | -------- |
| address | `string` |

#### wallet.clear()

Drop all account in wallet

**Kind**: instance method of [`Wallet`](#Wallet)<br>

#### wallet.set(address, account) ⇒ `any`

**Kind**: instance method of [`Wallet`](#Wallet)

| Param   | Type  | Description                          |
| ------- | ----- | ------------------------------------ |
| address | `any` | Key of account, usually is `address` |
| account | `any` | Account instance                     |

#### wallet.get(address) ⇒ `Account`

**Kind**: instance method of [`Wallet`](#Wallet)

| Param   | Type     |
| ------- | -------- |
| address | `string` |

#### wallet.addPrivateKey(privateKey) ⇒ `PrivateKeyAccount`

**Kind**: instance method of [`Wallet`](#Wallet)

| Param      | Type                 | Description            |
| ---------- | -------------------- | ---------------------- |
| privateKey | `string` \| `Buffer` | Private key of account |

#### wallet.addRandom(\[entropy]) ⇒ `PrivateKeyAccount`

**Kind**: instance method of [`Wallet`](#Wallet)

| Param      | Type                 | Description               |
| ---------- | -------------------- | ------------------------- |
| \[entropy] | `string` \| `Buffer` | Entropy of random account |

#### wallet.addKeystore(keystore, password) ⇒ `PrivateKeyAccount`

**Kind**: instance method of [`Wallet`](#Wallet)

| Param    | Type                 | Description                            |
| -------- | -------------------- | -------------------------------------- |
| keystore | `object`             | Keystore version 3 object.             |
| password | `string` \| `Buffer` | Password for keystore to decrypt with. |
