SDK Reference
Introduction
Connect To Orbis

Connect to Orbis

First steps

The first step is to get users to connect to their DID which is derived using the wallet as a provider.

This provider can in theory be any wallet from any chain, we support all EVM-based chains as well as Solana, Tezos and more coming soon.

To get users to connect to Ceramic with Orbis you need to call the orbis.connect_v2() function.

Orbis connect_v2 example in React

index.jsx
import React, { useState, useEffect } from 'react';
 
/** Import Orbis SDK */
import { Orbis } from "@orbisclub/orbis-sdk";
 
/**
 * Initialize the Orbis class object:
 * You can make this object available on other components
 * by passing it as a prop or by using a context.
 */
const orbis = new Orbis({});
 
export default function App() {
 
	/** The user object */
	const [user, setUser] = useState();
 
	/** Calls the Orbis SDK and handles the results */
	async function connect() {
    	const res = await orbis.connect_v2({ chain: "ethereum", lit: false });
 
		/** Check if the connection is successful or not */
		if(res.status == 200) {
			setUser(res.did);
		} else {
			console.log("Error connecting to Ceramic: ", res);
			alert("Error connecting to Ceramic.");
		}
	}
 
	return(
		<div>
			{user ?
				<p>Connected with: {user}</p>
			:
				<button onClick={() => connect()}>Connect</button>
			}
		</div>
	)
}

The orbis.connect_v2() function returns the user details of the DID getting connected.

Next steps