connect()

connects to Ceramic

How to use?

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

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

Last updated