@web3auth/modal
Version:
Multi chain wallet aggregator for web3Auth
34 lines (31 loc) • 864 B
JavaScript
import { WalletServicesPluginError, log } from '@web3auth/no-modal';
import { ref } from 'vue';
import { useWalletServicesPlugin } from './useWalletServicesPlugin.js';
const useReceive = () => {
const {
plugin,
ready
} = useWalletServicesPlugin();
const loading = ref(false);
const error = ref(null);
const showReceive = async showReceiveParams => {
loading.value = true;
error.value = null;
try {
if (!plugin) throw WalletServicesPluginError.notInitialized();
if (!ready) throw WalletServicesPluginError.walletPluginNotConnected();
await plugin.value.showReceive(showReceiveParams);
} catch (err) {
log.error("Error showing receive", err);
error.value = err;
} finally {
loading.value = false;
}
};
return {
loading,
error,
showReceive
};
};
export { useReceive };