Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 0 additions & 60 deletions demo/vue-app-new/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/modal/src/modalManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthConnectionConfigItem, serializeError } from "@web3auth/auth";
import { AuthConnectionConfigItem, BUILD_ENV, serializeError } from "@web3auth/auth";
import {
ANALYTICS_EVENTS,
ANALYTICS_SDK_TYPE,
Expand Down Expand Up @@ -95,7 +95,7 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {

constructor(options: Web3AuthOptions, initialState?: Partial<IWeb3AuthState>) {
super(options, initialState);
this.options = { ...options };
this.options = { ...options, authBuildEnv: options.authBuildEnv || BUILD_ENV.PRODUCTION };
if (!this.options.initialAuthenticationMode) {
this.options.initialAuthenticationMode = CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainNamespaceType, type ProviderConfig } from "@toruslabs/base-controllers";
import { ChainNamespaceType, getCaipChainId, type ProviderConfig } from "@toruslabs/base-controllers";
import { CITADEL_SERVER_MAP } from "@toruslabs/constants";
import { get, put } from "@toruslabs/http-helpers";
import { SecurePubSub } from "@toruslabs/secure-pub-sub";
Expand All @@ -23,7 +23,6 @@ import {
} from "@web3auth/auth";
import { type default as WsEmbed, WS_EMBED_LOGIN_MODE } from "@web3auth/ws-embed";
import deepmerge from "deepmerge";
import { numberToHex } from "viem";

import {
AccountLinkingError,
Expand Down Expand Up @@ -408,13 +407,10 @@ class AuthConnector extends BaseConnector<AuthLoginParams> implements IAuthConne

const newChainConfig = this.coreOptions.chains.find((c) => c.chainId === newChainId);
if (!newChainConfig) throw WalletInitializationError.invalidParams("Chain config is not available");

if (newChainConfig.chainNamespace === CHAIN_NAMESPACES.SOLANA || newChainConfig.chainNamespace === CHAIN_NAMESPACES.EIP155) {
if (!this.wsEmbedInstance?.provider) throw WalletInitializationError.notReady("Wallet embed is not ready");
const chainIdNum = parseInt(newChainConfig.chainId, 16);
// WsEmbed expects the chainId in hex format
const chainIdHex = numberToHex(chainIdNum);
await this.wsEmbedInstance.provider.request({ method: "wallet_switchChain", params: { chainId: chainIdHex } });
const caipChainId = getCaipChainId(newChainConfig);
await this.wsEmbedInstance.provider.request({ method: "wallet_switchChain", params: { chainId: caipChainId } });
} else {
await this.privateKeyProvider?.switchChain(params);
}
Expand Down
6 changes: 5 additions & 1 deletion packages/no-modal/src/noModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
SMART_ACCOUNT_EIP_STANDARD,
} from "@toruslabs/ethereum-controllers";
import {
BUILD_ENV,
cloneDeep,
CookieStorage,
type IStorageAdapter,
Expand Down Expand Up @@ -147,7 +148,10 @@ export class Web3AuthNoModal extends SafeEventEmitter<Web3AuthNoModalEvents> imp
else log.setLevel("error");
if (!options.initialAuthenticationMode) options.initialAuthenticationMode = CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN;

this.coreOptions = options;
this.coreOptions = {
...options,
authBuildEnv: options.authBuildEnv || BUILD_ENV.PRODUCTION,
};
this.storage = this.getStorageMethod();
this.analytics = new Analytics();
if (options.disableAnalytics) {
Expand Down