# PnP Modal SDK - v5 to v6

> PnP Modal SDK - v5 to v6 | Embedded Wallets

## General

### `web3auth.connected` is introduced

#### Manage session using `web3auth.connected` instead of `web3auth.provider`

With v6, users can manage their session using `web3auth.connected` instead of `web3auth.provider`.

```tsx
// With V6
// focus-start
if (web3auth.connected) {
  setLoggedIn(true)
}
// focus-end
```

### `provider` is now always available

In v5, we used to add a check for setting the `provider` only if the `web3auth.provider` was present. But now with V6 we always have a provider available even if the user is not logged in.

```tsx
// With V5
if (web3auth.provider) {
  setProvider(web3auth.provider)
}
// With V6
// focus-next-line
setProvider(web3auth.provider) // before the connect() or connectTo(), provider is available.
```

### `rpcTarget` and `chainId` is now a mandatory parameter

Previously, the Web Modal SDK required `chainConfig` as a parameter which had `rpcTarget` and `chainId` as the optional parameter. But with V6, it's mandatory to add `rpcTarget` and `chainId` in the `chainConfig` object.

```tsx
const web3auth = new Web3Auth({
  clientId,
  chainConfig: {
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    // focus-start
    chainId: '0x1',
    rpcTarget: 'https://rpc.ethereum.org', // This is the public RPC we have added, please pass on your own custom endpoint while creating an app
    // focus-end
  },
  web3AuthNetwork: 'sapphire_mainnet',
})
```
