Skip to content

Commit 31415ec

Browse files
author
Nguyen Anh Tu
committed
no message
1 parent 77eca15 commit 31415ec

File tree

5 files changed

+82
-6
lines changed

5 files changed

+82
-6
lines changed

demo/vue-app-new/package-lock.json

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/vue-app-new/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@toruslabs/vue-icons": "^7.6.2",
2020
"@web3auth/auth": "^9.6.4",
2121
"@web3auth/modal": "file:../../packages/modal",
22+
"@web3auth/no-modal": "file:../../packages/no-modal",
2223
"@web3auth/sign-in-with-ethereum": "^4.2.2",
2324
"@web3auth/ws-embed": "^4.0.4",
2425
"bs58": "^6.0.0",

demo/vue-app-new/src/MainView.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
import { CHAIN_NAMESPACES, WalletConnectV2Adapter, WalletServicesPlugin, type Web3AuthOptions,EthereumPrivateKeyProvider,NFTCheckoutPlugin,SolanaPrivateKeyProvider,CommonPrivateKeyProvider,CoinbaseAdapter, ChainNamespaceType, IAdapter, IBaseProvider, IProvider, storageAvailable, WALLET_ADAPTERS, AccountAbstractionProvider, ISmartAccount, KernelSmartAccount, NexusSmartAccount, SafeSmartAccount, TrustSmartAccount, getEvmInjectedAdapters, getSolanaInjectedAdapters, } from "@web3auth/modal";
44
import { Web3AuthProvider } from "@web3auth/modal/vue";
5+
import { WalletServicesProvider } from "@web3auth/no-modal/vue";
56
import { computed, onBeforeMount, ref, watch } from "vue";
67
78
import AppDashboard from "./components/AppDashboard.vue";

demo/vue-app-new/src/components/AppDashboard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const formData = formDataStore;
3333
3434
const { userInfo, isConnected, provider, switchChain, web3Auth } = useWeb3Auth();
3535
const { isPluginConnected, plugin } = useWalletServicesPlugin();
36-
const currentChainId = ref<string | undefined>(web3Auth.value?.coreOptions.chainConfig?.chainId);
36+
const currentChainId = ref<string | undefined>(web3Auth.value?.currentChainConfig.chainId);
3737
const currentChainConfig = computed(() => supportedNetworks[currentChainId.value as keyof typeof supportedNetworks]);
3838
const currentChainNamespace = computed(() => currentChainConfig.value?.chainNamespace);
3939
const connection = computed(() => {

packages/no-modal/src/noModal.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ export class Web3AuthNoModal extends SafeEventEmitter<Web3AuthNoModalEvents> imp
7171
if (!options.privateKeyProvider && !options.chainConfig) {
7272
throw WalletInitializationError.invalidParams("Please provide chainConfig or privateKeyProvider");
7373
}
74+
75+
const singleChainConfig =
76+
options.chainConfig || // use deprecated chainConfig as single chain config list if present
77+
options.privateKeyProvider?.currentChainConfig; // use privateKeyProvider's currentChainConfig as single chain config list if present
7478
const chainConfigs: CustomChainConfig[] =
75-
options.chainConfigs || options.chainConfig
76-
? [options.chainConfig] // use deprecated chainConfig as single chain config list if present
77-
: options.privateKeyProvider?.currentChainConfig
78-
? [options.privateKeyProvider.currentChainConfig] // use privateKeyProvider's currentChainConfig as single chain config list if present
79-
: undefined;
79+
options.chainConfigs || singleChainConfig
80+
? [singleChainConfig] // use privateKeyProvider's currentChainConfig as single chain config list if present
81+
: undefined;
8082
if (!chainConfigs || chainConfigs.length === 0) {
8183
throw WalletInitializationError.invalidParams("Please provide chainConfig or privateKeyProvider");
8284
}

0 commit comments

Comments
 (0)