update mobile

This commit is contained in:
Michel Fromme
2023-07-31 14:45:41 +02:00
parent c160b1c836
commit 2555217641
7 changed files with 91 additions and 47 deletions
+35 -16
View File
@@ -18,6 +18,7 @@ import {
watchAccount,
watchNetwork,
watchContractEvent,
watchWalletClient,
getAccount,
getNetwork,
getPublicClient,
@@ -38,6 +39,7 @@ const showPanel = ref(false);
const eventWatch = ref(null);
const netWorkEvent = ref(null);
const memeSacrificedEvent = ref(null);
const clientClientEvent = ref(null);
isMobile.value = isMobileFunc();
onUnmounted(() => {
@@ -45,6 +47,8 @@ onUnmounted(() => {
eventWatch.value();
netWorkEvent.value();
memeSacrificedEvent.value();
clientClientEvent.value();
console.log("unsubscribe");
});
const handleWindowSizeChange = () => {
@@ -64,36 +68,25 @@ function isMobileFunc() {
}
}
provide("isMobile", isMobile);
provide("showPanel", showPanel);
onMounted(async () => {
window.addEventListener("resize", handleWindowSizeChange);
handleWindowSizeChange();
// initContracts
await walletStore.init();
await tokenStore.initV2();
await memeBurnerStore.init();
await rewardLockerStore.init();
await memeBurnerStore.init();
// await multiCallStore.init();
//Memeburner Contract
const account = getAccount();
const network = getNetwork();
console.log("netWork", network);
console.log("account", account);
if (account.address) {
walletStore.address = account.address;
walletStore.connected = true;
var walletClient123 = await getWalletClient();
console.log("walletClient123123123", walletClient123);
}
//init
roundsStore.currentRound = parseInt(
await memeBurnerStore.getCurrentRound()
);
console.log("roundsStore.currentRound", roundsStore.currentRound);
roundsStore.activeRound = roundsStore.currentRound;
await roundsStore.fillRound(roundsStore.activeRound);
//events
eventWatch.value = watchAccount(async (account) => {
console.log("account123", account);
@@ -111,10 +104,13 @@ onMounted(async () => {
chainObject = chain;
}
var walletClient = await getWalletClient({
account: account.address,
chainId: chainObject.id,
});
walletStore.walletClient = walletClient;
await memeBurnerStore.init();
console.log("hierabc");
await tokenStore.initV2();
} else {
walletStore.address = null;
walletStore.connected = false;
@@ -141,6 +137,29 @@ onMounted(async () => {
await roundsStore.updateCurrentRound(token);
}
);
clientClientEvent.value = watchWalletClient(
{
chainId: network.chain.id,
},
(walletClient) => {
walletStore.walletClient = walletClient;
console.log("wc123", walletClient);
}
);
await tokenStore.initV2();
await memeBurnerStore.init();
await rewardLockerStore.init();
await memeBurnerStore.init();
//init
roundsStore.currentRound = parseInt(
await memeBurnerStore.getCurrentRound()
);
console.log("roundsStore.currentRound", roundsStore.currentRound);
roundsStore.activeRound = roundsStore.currentRound;
await roundsStore.fillRound(roundsStore.activeRound);
});
</script>