SDK Reference
Methods
Connect_v2

connect_v2

The connect_v2 function supports multi-chain (EVM & Solana) login. It also makes it easier to scale to additional blockchains and parameters in the future.

How to use?

const res = await orbis.connect_v2(options);

Parameters

  • options - A JSON object that contains the parameters to use to connect the end-user
    • provider - By default it will be using window.ethereum if available. Can be used to pass any provider.
    • chain - Must be ethereum or solana.
    • lit - Must be true or false. Using true will generate an additional signature for the end user to allow the usage of encrypted features (token gated posts or direct messages).

Returns

{
  status: 200,
  did: "did:pkh:..",
  details: {
    did: "did:pkh:..",
    profile: {
      pfp: "https://...",
      username: "Baptiste",
      description: "..."
    }
  },
  result: "Success connecting to the DiD."
}

Examples

Metamask connection without Lit Protocol

const res = await orbis.connect_v2({
  provider: window.ethereum,
  lit: false
});

WalletConnect connection

/* Import the WalletConnect library */
import { EthereumProvider } from "@walletconnect/ethereum-provider";
 
/* Initiate the WC provider */
const wc_provider = await EthereumProvider.init({
  projectId: PROJECT_ID,
  chains: ["1"]
});
 
/** Enable session (triggers QR Code modal) */
await wc_provider.enable();
 
/** Connect to Orbis using WalletConnect as a provider */
const res = await orbis.connect_v2({
  provider: wc_provider
});

Example using Solana Phantom

const res = await orbis.connect_v2({
  provider: window.phantom?.solana,
  chain: "solana",
  lit: true
});