Moving to Mainnet

The default configuration of our SDK, as well as the API endpoint examples are both setup to get developers running in a testnet environment, once you are comfortable with your setup, and would like to move to production, there are some very minor changes to make to SDK configurations.

If using the API endpoints directly, to access a Mainnet Passport Node, you can simply use https://mochi.0xpass.io .

For SDK configuration you can instantiate your Passport instance as follows simply passing Network.MAINNET as your chosen network.

import { Passport, Network } from "@0xpass/passport"
import { WebAuthnSigner } from "@0xpass/webauthn-signer"

const signer = new WebauthnSigner({
      rpId: window.location.hostname,
      rpName: "rpName",
});

const passport  = new Passport({
      scopeId: scopeId,
      signer: signer
      network: Network.MAINNET,
});

When using the viem client you equally instantiate it choosing the Mainnet network as follows.

import { http, mainnet, WalletClient } from "viem/chains";
import { createPassportClient } from "@0xpass/passport-viem";
import { Passport, Network } from "@0xpass/passport";

const signer: new WebauthnSigner({
  rpId: "rpId",
  rpName: "rpName",
})

const passport = new Passport({
    scopeId: "insert_your_scope_id",
    signer: signer
});

const userInput {
   username: "insert_registered_username_here"
   userDisplayName: "insert_registered_user_display_name_here"
}

await passport.setupEncryption();
const [authenticatedHeader] = await passport.authenticate(userInput);

const chain = mainnet;
const transport = http("any eth node endpoint");

// Create viem WalletClient using Passport
const client: WalletClient = await createPassportClient(
  authenticatedHeader,
  transport,
  chain,
  Network.MAINNET // define mainnet network here
);

Last updated