contracts update

This commit is contained in:
Michel Fromme
2023-07-27 15:34:07 +02:00
parent 5157308745
commit 650df134d2
12 changed files with 14369 additions and 16715 deletions
+1 -18
View File
@@ -1,7 +1,7 @@
<template>
<h3>Connect Wallet</h3>
<div class="connectors-wrapper">
<div class="connectors-element" v-for="connector in walletStore.connectors" @click="connectWallet(connector)">
<div class="connectors-element" v-for="connector in walletStore.config?.connectors" @click="connectWallet(connector)">
<div class="connector-icon">
<img :src="`/assets/img/connectors/${connector.id}.svg`" :alt="`${connector.name} Logo`">
</div>
@@ -9,7 +9,6 @@
</div>
</div>
<div @click="disconnectWallet">disconnect</div>
<div @click="getWalletClientTest">getwalletclient</div>
<div>Connected: {{ walletStore.connected }}</div>
</template>
@@ -28,7 +27,6 @@ import {
disconnect,
InjectedConnector,
watchAccount,
getWalletClient,
} from "@wagmi/core";
const walletStore = useWalletStoreV2();
@@ -81,21 +79,6 @@ async function disconnectWallet() {
}
}
async function getWalletClientTest() {
const walletClient = await getWalletClient();
console.log("walletClient", walletClient);
const contract = getContract({
address: Meme1Json.contractAddress,
abi: Meme1Json.abi,
walletClient,
});
const result = await contract.read.totalSupply();
console.log("result", result);
// console.log("obj", obj);
// });
}
async function connectWallet(connector) {
instance.parent.emit("update:modelValue", false);
await walletStore.connectWallet(toRaw(connector));
+9 -4
View File
@@ -1,11 +1,15 @@
<script setup>
import { storeToRefs } from "pinia";
import { ref, onMounted, onBeforeUnmount, inject } from "vue";
import { useWalletStore } from "@/stores/wallet";
const walletStore = useWalletStore();
import { useWalletStoreV2 } from "@/stores/walletV2";
const emit = defineEmits(["showPanel"]);
const walletStore = useWalletStoreV2();
const { connected, address } = storeToRefs(walletStore);
const isMobile = inject("isMobile");
const showPanel = ref(false);
const showNavbar = ref(true);
const lastScrollPosition = ref(0);
@@ -62,8 +66,9 @@ onBeforeUnmount(() => {
</div>
<div class="navbar-end">
<div v-if="!isMobile">
<div v-if="!connected" class="btn btn-immortal" @click="walletStore.connectWallet">connect</div>
<span v-else> {{ address }}</span>
<!-- <div v-if="!connected" class="btn btn-immortal" @click="walletStore.connectWallet">connect</div> -->
<div v-if="!address" class="btn btn-immortal" @click="$emit('showPanel', true)">connect</div>
<span v-else @click="$emit('showPanel', true)"> {{ address }}</span>
</div>
<div v-else class="hamburger-menu">
<font-awesome-icon :icon="['fas', 'bars']" />