orbis.connect_v2()

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

How to use?

let 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).

Examples

Example to login with Metamask without requiring Lit

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

Example to login with WalletConnect

/** Import the WalletConnect library */
import WalletConnectProvider from "@walletconnect/web3-provider";

/** Initiate the WC provider */
let wallet_connect_provider = new WalletConnectProvider({
  infuraId: "infura_key",
});

/** Enable session (triggers QR Code modal) */
await wallet_connect_provider.enable();

/** Connect to Orbis using WalletConnect as a provider */
let res = await orbis.connect_v2({
  provider: wallet_connect_provider,
  lit: true
});

Example to login with Phantom and Solana

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

Returns

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