Getting started

Once installed, you can import the SDK and initialize the orbis object which will give you access to all of the SDK’s features:

/** Import Orbis SDK */
import { Orbis } from "@orbisclub/orbis-sdk";

/** Initialize the Orbis class object */
let orbis = new Orbis();

🚨 The same orbis object needs the be used in all your application so make sure to pass it as a props to other components or use in React's context or something similar.

Connecting to Ceramic

The first step is to get users to connect to their Ceramic did which is created / retrieved using the wallet as a provider. This provider can in theory be any wallet from any chain, we are supporting only Ethereum based wallet for now but will soon support additional chains such as Cosmos or Solana.

To get users to connect to Ceramic with Orbis you need to call the orbis.connect() function, here is how to use it:

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.
 */
let orbis = new Orbis();

export default function App() {

	/** The user object returned by the connect function can be stored in state */
	const [user, setUser] = useState();

	/** Calls the Orbis SDK and handle the results */
	async function connect() {
    let res = await orbis.connect();

		/** Check if 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() function returns the full user details of the did getting connected, here are the full details of the results returned.

Next steps

Your user is now connected to the Ceramic network using the Orbis SDK, let’s see how we can use this to build social apps now. Here are two examples to get started building one of those examples:

  • Option 1: Social feed
  • Option 2: Decentralized messages

👈 Installation

Option 1: Social feed

Option 2: Decentralized messages