[Archive] How to remove the connect with wallet section

:classical_building: Archived Content from Web3Auth Community

This topic was originally posted by community2 on 8/31/2023.
This content has been migrated from our previous community forum to preserve valuable discussions.


I want to hide the connect wallet section altogether, but the below given code is not working

image
image407Ă—625 24.2 KB

const web3auth = new Web3Auth({
      clientId:"BCNEb4vQCl8rrcqFpZDr3WcS5Hz2EMtRIMw8pEax3GzC1OAYqWSzqpq8-UaTGbZczgBQJ2z4WNWSMuwR5pBz4uY",
      chainConfig: {
        chainNamespace: "eip155",
        chainId: "0x5",
      },
      web3AuthNetwork: "mainnet",
    });
const torusPlugin = new TorusWalletConnectorPlugin({
  torusWalletOpts: {},
   walletInitOptions: { buttonPosition: "bottom-left",
    whiteLabel: {
      theme: { isDark: true, colors: { primary: "#00a8ff" } },
      logoDark: "https://web3auth.io/images/w3a-L-Favicon-1.svg",
      logoLight: "https://web3auth.io/images/w3a-D-Favicon-1.svg",
    },
    useWalletConnect: false,
    enableLogging: false,
    showTorusButton:false
  },
});
await web3auth.addPlugin(torusPlugin);

await web3auth.initModal(
  {
  modalConfig: {
    openlogin: {
      label: "openlogin",
      loginMethods: {
        facebook: {
          name: "facebook",
          showOnModal: false,
        },
        reddit: {
          name: "reddit",
          showOnModal: false,
        },
        discord: {
          name: "discord",
          showOnModal: false,
        },
        email_passwordless: {
          name: "email_passwordless",
          showOnModal: false,
        },
        wechat: {
          name: "wechat",
          showOnModal: false,
        },
        weibo: {
          name: "weibo",
          showOnModal: false,
        },
        twitter: {
          name: "twitter",
          showOnModal: false,
        },
        kakao: {
          name: "kakao",
          showOnModal: false,
        },
        line: {
          name: "line",
          showOnModal: false,
        },
        twitch: {
          name: "twitch",
          showOnModal: false,
        },
        apple: {
          name: "apple",
          showOnModal: false,
        },
        github: {
          name: "github",
          showOnModal: false,
        },
        linkedin: {
          name: "linkedin",
          showOnModal: false,
        },
        external_wallets: {
          name: "external_wallets",
          showOnModal: false,
        },
        sms_passwordless: {
          name: "sms_passwordless",
          showOnModal: true,
        },
        wallet_logins:{
           name: "wallet_logins",
          showOnModal: false,
        }
        

      },
    },
  },
});



console.log(web3auth, " auto lets see 2 connected");
if (!web3auth.connected) await web3auth.connect();```</code></pre>

@community2 Thanks for your patience.

You can refer to the below code snippet:

import { Web3Auth } from "@web3auth/modal";
import { CHAIN_NAMESPACES, WALLET_ADAPTERS } from "@web3auth/base";

const web3auth = new Web3Auth({
chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155 },
clientId: “YOUR_WEB3AUTH_CLIENT_ID”,
web3AuthNetwork: “mainnet”,
});

await web3auth.initModal({
modalConfig: {
// Disable Wallet Connect V2
[WALLET_ADAPTERS.WALLET_CONNECT_V2]: {
label: “wallet_connect”,
showOnModal: false,
},
// Disable Metamask
[WALLET_ADAPTERS.METAMASK]: {
label: “metamask”,
showOnModal: false,
},
},
});

Thanks a lot, it worked.