update m issues + e issues
This commit is contained in:
+47
-3
@@ -45,6 +45,8 @@ import { faDiscord, faTwitter, faTelegram } from "@fortawesome/free-brands-svg-i
|
||||
import Toast from "vue-toastification";
|
||||
// Import the CSS or use your own!
|
||||
import "vue-toastification/dist/index.css";
|
||||
import SwitchNetworkToast from "@/components/toasts/SwitchNetworkToast.vue";
|
||||
import { useToast } from "vue-toastification";
|
||||
|
||||
/* add icons to the library */
|
||||
library.add(
|
||||
@@ -95,6 +97,35 @@ app.use(Toast, {
|
||||
});
|
||||
|
||||
|
||||
|
||||
function showSwitchNetworkToast(network) {
|
||||
const toast = useToast();
|
||||
|
||||
// Define the content object with the component, props and listeners
|
||||
const content = {
|
||||
component: SwitchNetworkToast,
|
||||
// Any prop can be passed, but don't expect them to be reactive
|
||||
props: {
|
||||
network
|
||||
},
|
||||
// Listen and react to events using callbacks. In this case we listen for
|
||||
// the "click" event emitted when clicking the toast button
|
||||
listeners: {},
|
||||
};
|
||||
|
||||
// Render the toast and its contents
|
||||
return toast(content, {
|
||||
position: "top-right",
|
||||
icon: false,
|
||||
closeOnClick: false,
|
||||
// toastClassName: "modal-overlay",
|
||||
hideProgressBar: true,
|
||||
timeout: false,
|
||||
toastClassName: "approve-toast toast-card",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
const walletStore = useWalletStoreV2();
|
||||
const tokenStore = useTokenStore();
|
||||
@@ -107,7 +138,8 @@ try {
|
||||
const projectId = "d8e5ecb0353c02e21d4c0867d4473ac5";
|
||||
console.log("hier chains");
|
||||
const { chains, publicClient, webSocketPublicClient } = configureChains(
|
||||
[goerli, mainnet],
|
||||
// [goerli, mainnet],
|
||||
[goerli],
|
||||
[alchemyProvider({ apiKey: goerliKey }), publicProvider()]
|
||||
);
|
||||
|
||||
@@ -203,11 +235,23 @@ try {
|
||||
}
|
||||
});
|
||||
|
||||
watchNetwork((network) => {
|
||||
watchNetwork((network) => {
|
||||
|
||||
const chainAllowed = network.chains?.find((obj) => {
|
||||
return obj.network === network.chain.network;
|
||||
});
|
||||
if (!chainAllowed) {
|
||||
console.log("chain not allowed", network.chain);
|
||||
showSwitchNetworkToast(network);
|
||||
return
|
||||
} else {
|
||||
console.log("chain allowed", network.chain);
|
||||
}
|
||||
if (network.chain) {
|
||||
walletStore.chain = network.chain;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
await walletStore.init();
|
||||
|
||||
Reference in New Issue
Block a user