UNPKG

@web3auth/modal

Version:

Multi chain wallet aggregator for web3Auth

35 lines (31 loc) 872 B
'use strict'; var noModal = require('@web3auth/no-modal'); var vue = require('vue'); var useWalletServicesPlugin = require('./useWalletServicesPlugin.js'); const useWalletUI = () => { const { plugin, ready } = useWalletServicesPlugin.useWalletServicesPlugin(); const loading = vue.ref(false); const error = vue.ref(null); const showWalletUI = async showWalletUiParams => { loading.value = true; error.value = null; try { if (!plugin) throw noModal.WalletServicesPluginError.notInitialized(); if (!ready) throw noModal.WalletServicesPluginError.walletPluginNotConnected(); await plugin.value.showWalletUi(showWalletUiParams); } catch (err) { error.value = err; } finally { loading.value = false; } }; return { loading, error, showWalletUI }; }; exports.useWalletUI = useWalletUI;