# getNetworks

Returns the networks the wallet provider has available to connect to, along with the default network the wallet is currently set to.

## **Input Arguments**

None

## **Success Response**

<table><thead><tr><th width="302">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>networks: string[]</code></td><td>Array of network names the wallet provider has available for the dapp developer to connect to</td></tr><tr><td><code>defaultNetwork: string</code></td><td>Network the wallet is currently set to</td></tr></tbody></table>

## **Error Response**

<table><thead><tr><th width="304">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: string</code></td><td>The type of error which has occured</td></tr><tr><td><code>description: string</code></td><td>A description of the error which has occured</td></tr><tr><td><code>data: string</code></td><td>Any raw data associated with the error</td></tr></tbody></table>

## Example

### Request

```js
neoline.getNetworks()
.then(result => {
  const {
    networks,
    defaultNetwork
  } = result;

  console.log('Networks: ' + networks);
  // eg. ["MainNet", "TestNet", "PrivateNet"]

  console.log('Default network: ' + defaultNetwork);
  // eg. "MainNet"
})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case 'NO_PROVIDER':
        console.log('No provider available.');
        break;
    case 'CONNECTION_DENIED':
        console.log('The user rejected the request to connect with your dApp');
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});
```

### Response

```
{
  networks: ["MainNet", "TestNet"],
  defaultNetwork: "TestNet"
}
```
