contracts update
This commit is contained in:
+35
-12
@@ -4,7 +4,6 @@ import { storeToRefs } from "pinia";
|
||||
|
||||
import Navbar from "./components/Navbar.vue";
|
||||
import { useWalletStoreV2 } from "@/stores/walletV2";
|
||||
const walletStore = useWalletStoreV2();
|
||||
import { useTokenStore } from "@/stores/tokens";
|
||||
import { useContractStore } from "@/stores/contracts";
|
||||
import { useMemeburnerStore } from "@/stores/memeburner";
|
||||
@@ -15,7 +14,12 @@ import { useRoundsStore } from "@/stores/rounds";
|
||||
import SlideoutPanel from "./components/SlideoutPanel.vue";
|
||||
import ConnectWallet from "./components/ConnectWallet.vue";
|
||||
|
||||
import { watchAccount, getPublicClient, getWalletClient } from "@wagmi/core";
|
||||
import {
|
||||
watchAccount,
|
||||
watchNetwork,
|
||||
getPublicClient,
|
||||
getWalletClient,
|
||||
} from "@wagmi/core";
|
||||
|
||||
const tokenStore = useTokenStore();
|
||||
const contractStore = useContractStore();
|
||||
@@ -23,17 +27,20 @@ const memeBurnerStore = useMemeburnerStore();
|
||||
const rewardLockerStore = useRewardLockerStore();
|
||||
const multiCallStore = useMultiCallStore();
|
||||
const roundsStore = useRoundsStore();
|
||||
const walletStore = useWalletStoreV2();
|
||||
const { memeBurner, token } = storeToRefs(tokenStore);
|
||||
const { list } = storeToRefs(contractStore);
|
||||
const isMobile = ref(false);
|
||||
const showPanel = ref(false);
|
||||
const eventWatch = ref(null);
|
||||
const netWorkEvent = ref(null);
|
||||
|
||||
isMobile.value = isMobileFunc();
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener("resize", handleWindowSizeChange);
|
||||
|
||||
eventWatch.value();
|
||||
netWorkEvent.value();
|
||||
console.log("unsubscribe");
|
||||
});
|
||||
const handleWindowSizeChange = () => {
|
||||
@@ -62,32 +69,48 @@ onMounted(async () => {
|
||||
await walletStore.init();
|
||||
await tokenStore.initV2();
|
||||
await memeBurnerStore.init();
|
||||
// await rewardLockerStore.init();
|
||||
// await memeBurnerStore.init();
|
||||
await rewardLockerStore.init();
|
||||
await memeBurnerStore.init();
|
||||
// await multiCallStore.init();
|
||||
//Memeburner Contract
|
||||
|
||||
//init
|
||||
// roundsStore.currentRound = parseInt(
|
||||
// await memeBurnerStore.getCurrentRound()
|
||||
// );
|
||||
// console.log("roundsStore.currentRound", roundsStore.currentRound);
|
||||
// roundsStore.activeRound = roundsStore.currentRound;
|
||||
// await roundsStore.fillRound(roundsStore.activeRound);
|
||||
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);
|
||||
const publicClient = getPublicClient();
|
||||
const publicClient = await getPublicClient();
|
||||
console.log("publicClient", publicClient);
|
||||
var walletClient = await getWalletClient();
|
||||
|
||||
// {chainId: }
|
||||
console.log("walletClient", walletClient);
|
||||
if (account.address) {
|
||||
walletStore.address = account.address;
|
||||
walletStore.connected = true;
|
||||
var walletClient = await getWalletClient({
|
||||
chainId: walletStore.chain.id,
|
||||
});
|
||||
walletStore.walletClient = walletClient;
|
||||
await memeBurnerStore.init();
|
||||
} else {
|
||||
walletStore.address = null;
|
||||
walletStore.connected = false;
|
||||
walletStore.walletClient = null;
|
||||
}
|
||||
});
|
||||
|
||||
netWorkEvent.value = watchNetwork((network) => {
|
||||
console.log("network123", network);
|
||||
if (network.chain) {
|
||||
walletStore.chain = network.chain;
|
||||
} else {
|
||||
walletStore.chain = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user