Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove requirement for chainConfig when not used #2069

Open
Jackman3005 opened this issue Feb 13, 2025 · 0 comments
Open

Remove requirement for chainConfig when not used #2069

Jackman3005 opened this issue Feb 13, 2025 · 0 comments

Comments

@Jackman3005
Copy link

We are using Web3Auth to log users in and create a unique principal for interacting with an IC (Internet Computer) canister. We haven't found use for the chainConfig and being required to provide it is a bit confusing. See the following code we have:

import { CustomChainConfig, WEB3AUTH_NETWORK } from "@web3auth/base";
import { Web3AuthOptions } from "@web3auth/modal";
import { CommonPrivateKeyProvider } from "@web3auth/base-provider";
import type { Web3AuthContextConfig } from "@web3auth/modal-react-hooks/dist/types/interfaces";
import { ENV } from "@/Env";

const chainConfig: CustomChainConfig = {
  chainNamespace: "other",
  chainId: "not-used",
  rpcTarget: "not-used",
};

const privateKeyProvider = new CommonPrivateKeyProvider({
  config: { chainConfig: chainConfig },
});

const web3AuthOptions: Web3AuthOptions = {
  clientId: ENV.WEB3AUTH_CLIENT_ID,
  web3AuthNetwork: WEB3AUTH_NETWORK[ENV.WEB3AUTH_NETWORK],
  privateKeyProvider,
  chainConfig,
};

const web3AuthContextConfig: Web3AuthContextConfig = {
  web3AuthOptions,
};

export default web3AuthContextConfig;

We can actually set chainId and rpcTarget to bogus data and it does not appear to cause issues during login.

Maybe we are using web3auth wrong or there is a better way to configure we don't know about? Happy to receive guidance here if we are off base.

Thanks in advance 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant