update profilepage

This commit is contained in:
EmberSpirit
2023-09-08 23:05:34 +02:00
parent cd773e16c9
commit dfd208e075
26 changed files with 2155 additions and 600 deletions
+22 -13
View File
@@ -16,6 +16,7 @@ import {
getWalletClient,
fetchBalance,
multicall,
getNetwork,
} from "@wagmi/core";
import { WalletConnectConnector } from "@wagmi/core/connectors/walletConnect";
@@ -40,7 +41,7 @@ export const useWalletStoreV2 = defineStore("walletV2", {
config: null,
chain: null,
token: [],
initialized: false
initialized1: false,
}),
getters: {
sacrificeToken: (state) => state.token.filter((obj) => obj.contractAddress !== MemeToken.contractAddress),
@@ -57,8 +58,9 @@ export const useWalletStoreV2 = defineStore("walletV2", {
console.log("account123abc", account);
if (account.address) {
this.address = account.address;
this.connected = true;
this.connected = true;
}
// await this.isConnected();
// const goerliKey = import.meta.env.VITE_GOERLI_KEY;
// if (this.connected) {
@@ -77,19 +79,23 @@ export const useWalletStoreV2 = defineStore("walletV2", {
// }
// });
console.log("this.config", this.config);
const walletClient = await getWalletClient();
console.log("walletClient", walletClient);
},
async connectWallet(connector) {
console.log("connector.name", connector.name);
// if (!account.isConnected) {
const connection = await connect({
chainId: goerli.id,
connector: connector,
});
try {
console.log("connector.name", connector.name);
// if (!account.isConnected) {
const connection = await connect({
chainId: goerli.id,
connector: connector,
});
console.log("connection", connection);
console.log("connection", connection);
} catch (error) {
if (error.message.includes("Connector not found")) {
console.warn("Connector not found");
}
console.error(error);
}
// this.address = connection.account;
},
async getTokenBalance(token) {
@@ -100,7 +106,8 @@ export const useWalletStoreV2 = defineStore("walletV2", {
},
async getTokenBalances() {
console.log("getTokenBalances");
console.log("getTokenBalances");
this.token = []
const tokenStore = useTokenStore();
console.log("tokenStore.token.length", tokenStore.token.length);
var contracts = [];
@@ -138,6 +145,8 @@ export const useWalletStoreV2 = defineStore("walletV2", {
const staked = await rewardlockerStore.getStaked(this.address);
console.log("staked", staked);
this.memeToken.staked = Number(staked / BigInt(Math.pow(10, tokenStore.memeToken.decimals)));
const unclaimedRewards = await rewardlockerStore.getTotalRewards(this.address);
this.memeToken.unclaimedRewards = Number(unclaimedRewards/ BigInt(Math.pow(10, tokenStore.memeToken.decimals)))
}
},