# connect()

### How to use?

```javascript
import { ExternalProvider } from "@ethersproject/providers";
import { getVESS } from "vess-sdk"

const isDev:boolean = true // set environment
const provider:any // any ethereum provider that is already connected
const address = "0x....."

const vessKit = getVESSKit(isDev) // initialize vess kit
const { session } = await vessKit.connect(address, provider, isDev ? 'testnet-clay': 'mainnet')const { session } = await vess.connect(provider)
```

### Parameters

address: wallet address

***provider:*** ExternalProvider : web3Provider

**env**: "mainnet" | "testnet-clay" `Optional` Specifies the Ceramic connection point. Default is mainnet.

### Examples

```javascript
import { Connector, useConnect, useDisconnect } from 'wagmi'
import { getVESSKit } from 'vess-kit-web'

const { connectAsync } = useConnect()

const loginWithWallet = async (connector?: Connector<any, any>) => {
    try {
      // connect wallt and get provider with wagmi (or any other services)
      const res = await connectAsync({ connector })
      const provider = await connector?.getProvider()
      
      const isDev:boolean = true // set environment
      const vessKit = getVESSKit(isDev) // initialize vess kit
      const { session } = await vessKit.connect(res.account, provider, isDev ? 'testnet-clay': 'mainnet')
      console.log({ session })
    } catch (error) {
      console.error(error)
    }
  }
```

### Returns

**session**: Promise\<DIDSession>: for more info about DIDSession, please check [here](https://github.com/ceramicnetwork/js-did/blob/5413ba1da9f6717d4a54d2bc30634a06a9435da5/docs/classes/did_session.DIDSession.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.vess.id/vess-sdk/api-documentation/v2/auth/connect.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
