[API Reference](../README.md) > [AccountService](../classes/AccountService.md)

# Class: AccountService

Watch for changes in the default account.

For more information, see [Account Changes](/Configuration.md#accountchanges).

## Hierarchy

**AccountService**

## Index

### Properties

* [AccountChangedEventTopic](AccountService.md#AccountChangedEventTopic)
* [NetworkChangedEventTopic](AccountService.md#NetworkChangedEventTopic)

### Methods

* [endAccountWatch](AccountService.md#endAccountWatch)
* [endNetworkWatch](AccountService.md#endNetworkWatch)
* [initiateAccountWatch](AccountService.md#initiateAccountWatch)
* [initiateNetworkWatch](AccountService.md#initiateNetworkWatch)
* [subscribeToAccountChanges](AccountService.md#subscribeToAccountChanges)
* [subscribeToNetworkChanges](AccountService.md#subscribeToNetworkChanges)

---

## Properties

<a id="AccountChangedEventTopic"></a>

### `<Static>` AccountChangedEventTopic

**● AccountChangedEventTopic**: *`string`* = "AccountService.account.changed"

*Defined in accountService.ts:15*

___
<a id="NetworkChangedEventTopic"></a>

### `<Static>` NetworkChangedEventTopic

**● NetworkChangedEventTopic**: *`string`* = "AccountService.network.changed"

*Defined in accountService.ts:16*

___

## Methods

<a id="endAccountWatch"></a>

### `<Static>` endAccountWatch

▸ **endAccountWatch**(): `void`

*Defined in accountService.ts:119*

Turn off the system that watches for default account changes.

**Returns:** `void`

___
<a id="endNetworkWatch"></a>

### `<Static>` endNetworkWatch

▸ **endNetworkWatch**(): `void`

*Defined in accountService.ts:129*

Turn off the system that watches for default account changes.

**Returns:** `void`

___
<a id="initiateAccountWatch"></a>

### `<Static>` initiateAccountWatch

▸ **initiateAccountWatch**(): `Promise`<`void`>

*Defined in accountService.ts:27*

Initializes the system that watches for default account changes.

`initiateAccountWatch` is called automatically by Arc.js when you pass `true` for `watchForAccountChanges` to `InitializeArcJs`. You may also call it manually yourself.

Then you may request to be notified whenever the current account changes by calling [AccountService.subscribeToAccountChanges](/arc.js/api/classes/AccountService#subscribeToAccountChanges)

**Returns:** `Promise`<`void`>

___
<a id="initiateNetworkWatch"></a>

### `<Static>` initiateNetworkWatch

▸ **initiateNetworkWatch**(): `Promise`<`void`>

*Defined in accountService.ts:78*

Initializes the system that watches for blockchain network id changes.

`initiateNetworkWatch` is called automatically by Arc.js when you pass `true` for `watchForNetworkChanges` to `InitializeArcJs`. You may also call it manually yourself.

Then you may request to be notified whenever the current account changes by calling [AccountService.subscribeToNetworkChanges](/arc.js/api/classes/AccountService#subscribeToNetworkChanges)

When the network is found to have changed you should call `InitializeArcJs` so Arc.js will set itself up with the new network and return to you a new `Web3` object.

**Returns:** `Promise`<`void`>

___
<a id="subscribeToAccountChanges"></a>

### `<Static>` subscribeToAccountChanges

▸ **subscribeToAccountChanges**(callback: *`function`*): [IEventSubscription](../interfaces/IEventSubscription.md)

*Defined in accountService.ts:144*

Subscribe to be notified whenever the current account changes, like this:

```
AccountService.subscribeToAccountChanges((account: Address): void => { ... });

```

**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| callback | `function` |  \- |

**Returns:** [IEventSubscription](../interfaces/IEventSubscription.md)
A subscription to the event.  Unsubscribe by calling `[theSubscription].unsubscribe()`.

___
<a id="subscribeToNetworkChanges"></a>

### `<Static>` subscribeToNetworkChanges

▸ **subscribeToNetworkChanges**(callback: *`function`*): [IEventSubscription](../interfaces/IEventSubscription.md)

*Defined in accountService.ts:158*

Subscribe to be notified whenever the current network changes, like this:

```
AccountService.subscribeToAccountChanges((networkId: number): void => { ... });

```

**Parameters:**

| Param | Type | Description |
| ------ | ------ | ------ |
| callback | `function` |  \- |

**Returns:** [IEventSubscription](../interfaces/IEventSubscription.md)
A subscription to the event.  Unsubscribe by calling `[theSubscription].unsubscribe()`.

___

