Bläddra i källkod

feat: web3 初始化

liming 4 veckor sedan
förälder
incheckning
c502163f4f

+ 1 - 0
package.json

@@ -40,6 +40,7 @@
     "less-loader": "^12.3.0",
     "lodash": "^4.17.21",
     "pinia": "^3.0.1",
+    "pinia-plugin-persistedstate": "^4.4.1",
     "qrcode.vue": "^3.6.0",
     "sharp": "^0.34.2",
     "typescript": "^5.8.3",

+ 0 - 144
src/composables/useWalletAuth.js

@@ -1,144 +0,0 @@
-import Web3 from 'web3'
-import CryptoJS from 'crypto-js'
-
-export function useWalletAuth() {
-  // 登录状态
-  const authState = reactive({
-    isAuthenticated: false, // 登录状态
-    account: null, // 账户
-    privateKey: null, // 私钥
-    encryptedKey: null, // 加密后的密钥
-    loading: false, // 加载状态
-    error: null, // 错误信息
-    chainId: null, // 链ID
-    balance: '0', // 账户余额(ETH)
-    rpcUrl: 'https://api.angeltokens.io' // 您的私有链RPC
-  })
-
-  // Web3实例
-  const web3 = ref(null)
-
-  // 初始化Web3
-  const initWeb3 = () => {
-    try {
-      web3.value = new Web3(authState.rpcUrl)
-      return web3.value
-    } catch (err) {
-      authState.error = '初始化区块链连接失败'
-      return null
-    }
-  }
-
-  // 获取账户余额
-  const getBalance = async () => {
-    if (!authState.account || !web3.value) return '0'
-    
-    try {
-      const weiBalance = await web3.value.eth.getBalance(authState.account)
-      const ethBalance = web3.value.utils.fromWei(weiBalance, 'ether')
-      authState.balance = ethBalance
-      return ethBalance
-    } catch (err) {
-      authState.error = '获取余额失败: ' + err.message
-      return '0'
-    }
-  }
-
-  // 通过私钥登录
-  const loginWithPrivateKey = async (privateKey, password = '') => {
-    authState.loading = true
-    authState.error = null
-
-    try {
-      const web3Instance = initWeb3()
-      if (!web3Instance) throw new Error('区块链连接失败')
-
-      // 验证私钥格式
-      if (!/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
-        throw new Error('私钥格式不正确')
-      }
-
-      // 加密存储私钥(如果提供了密码)
-      if (password) {
-        authState.encryptedKey = CryptoJS.AES.encrypt(
-          privateKey, 
-          password
-        ).toString()
-      }
-
-      // 从私钥获取账户
-      const account = web3Instance.eth.accounts.privateKeyToAccount(privateKey)
-      
-      // 验证账户有效性
-      const code = await web3Instance.eth.getCode(account.address)
-      if (code !== '0x') {
-        throw new Error('该地址是合约地址,不支持登录')
-      }
-
-      // 更新状态
-      authState.account = account.address
-      authState.privateKey = privateKey
-      authState.isAuthenticated = true
-      authState.chainId = await web3Instance.eth.getChainId()
-      
-      // 登录后自动获取余额
-      await getBalance()
-
-      return {
-        address: account.address,
-        chainId: authState.chainId,
-        balance: authState.balance
-      }
-    } catch (err) {
-      authState.error = err.message || '登录失败'
-      throw err
-    } finally {
-      authState.loading = false
-    }
-  }
-
-  // 通过加密存储登录(需密码)
-  const loginWithStorage = async (password) => {
-    if (!authState.encryptedKey) {
-      throw new Error('没有可用的加密钱包数据')
-    }
-
-    try {
-      // 解密私钥
-      const bytes = CryptoJS.AES.decrypt(authState.encryptedKey, password)
-      const privateKey = bytes.toString(CryptoJS.enc.Utf8)
-      
-      if (!privateKey) throw new Error('密码错误或数据损坏')
-      
-      return await loginWithPrivateKey(privateKey)
-    } catch (err) {
-      authState.error = err.message || '解密失败'
-      throw err
-    }
-  }
-
-  // 登出
-  const logout = () => {
-    authState.isAuthenticated = false
-    authState.account = null
-    authState.privateKey = null
-    authState.chainId = null
-    authState.balance = '0'
-    web3.value = null
-  }
-
-  // 检查本地是否有加密钱包数据
-  const hasStoredWallet = () => {
-    return !!authState.encryptedKey
-  }
-
-  return {
-    authState,
-    web3,
-    loginWithPrivateKey,
-    loginWithStorage,
-    logout,
-    hasStoredWallet,
-    getBalance
-  }
-}

+ 1 - 0
src/plugins/storage.js

@@ -8,4 +8,5 @@ export function setup() {
   } 
 
   window["$t"] = i18n.global.t;
+  window["$web3"] = undefined
 }

+ 2 - 0
src/stores/index.js

@@ -1,8 +1,10 @@
 import { createPinia } from 'pinia';
+import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
 
 const pinia = createPinia();
 
 export function setupStore(app) {
+  pinia.use(piniaPluginPersistedstate)
   app.use(pinia);
 }
 

+ 4 - 3
src/stores/modules/designStore.js

@@ -1,7 +1,7 @@
 import { defineStore } from 'pinia'
 import { theme } from '@/settings/designSetting'
 import { setLocalStorage, getLocalStorage } from '@/utils'
-import { useDarkThemeHook } from '@/hooks'
+// import { useDarkThemeHook } from '@/hooks'
 
 const DESIGN_THEME = "DESIGN_THEME" 
 const storageDesign = getLocalStorage(DESIGN_THEME)
@@ -14,6 +14,7 @@ export const useDesignStore = defineStore("useDesignStore", {
       // 是否暗黑
       ...theme,
     },
+      persist: true,
   getters: {
     getDarkTheme() {
       return this.darkTheme
@@ -27,13 +28,13 @@ export const useDesignStore = defineStore("useDesignStore", {
     changeTheme(e) {
       this.darkTheme = e
       setLocalStorage(DESIGN_THEME, this.$state)
-      useDarkThemeHook()
+      // useDarkThemeHook()
     },
     // 设置主题色
     setStateValue(e) {
       this.appThemeDetail = e
       setLocalStorage(DESIGN_THEME, this.$state)
-      useDarkThemeHook()
+      // useDarkThemeHook()
     },
   }
 })

+ 1 - 0
src/stores/modules/langStore.js

@@ -15,6 +15,7 @@ export const useLangStore = defineStore("useLangStore",{
       lang
     }
   ),
+  persist: true,
   getters: {
     getLang() {
       return this.lang

+ 7 - 29
src/stores/modules/systemStore.js

@@ -2,31 +2,14 @@ import { defineStore } from "pinia";
 import { getSTSInfo } from "@/api/path/system.api";
 import { setLocalStorage, getLocalStorage } from "@/utils";
 
-const INITIALIZE = {
-  local_loading: false,
-  routeSate: "",
-  user_login_information: "",
-  stsClientInfo: {},
-  wallet: {
-    address: "",
-    privateKey: "",
-  },
-  ISCREATE: true
-};
-try {
-  const SYSTEM_STORE = getLocalStorage("SYSTEM_STORE");
-  for (const key in SYSTEM_STORE) {
-    const value = getLocalStorage(key);
-    if (value) INITIALIZE[key] = value;
-  }
-} catch (err) {
-  window.console.log("无存储数据", err);
-}
-
 export const useSystemStore = defineStore("useSystemStore", {
   state: () => ({
-    ...INITIALIZE,
+    local_loading: false,
+    routeSate: "",
+    user_login_information: "",
+    stsClientInfo: {},
   }),
+  persist: true,
   getters: {
     getLocalLoading() {
       return this.local_loading;
@@ -36,11 +19,6 @@ export const useSystemStore = defineStore("useSystemStore", {
       this.token = window.localStorage?.token || "";
       return this.token;
     },
-    getWallet() {
-      if (this.wallet.address) return this.wallet;
-      this.wallet = window.localStorage?.wallet || "";
-      return this.wallet;
-    },
     getRouteSate() {
       return this.routeSate || getLocalStorage("routeSate");
     },
@@ -106,9 +84,9 @@ export const useSystemStore = defineStore("useSystemStore", {
       };
       return stsFn;
     },
-    getISCREATE(){
+    getISCREATE() {
       return this.ISCREATE || getLocalStorage("ISCREATE");
-    }
+    },
   },
   actions: {
     localLoading(value = false) {

+ 103 - 0
src/stores/modules/walletStore.js

@@ -0,0 +1,103 @@
+import { defineStore } from "pinia";
+import Web3 from "web3";
+import CryptoJS from "crypto-js";
+
+
+
+export const useWalletStore = defineStore("useWalletStore", {
+  state: () => ({
+    id: "", // name + @ + account
+    isAuthenticated: false, // 登录状态
+    account: null, // 钱包地址
+    privateKey: null, // 私钥
+    encryptedKey: localStorage.getItem("encryptedKey") || null, // 加密后的密钥
+    loading: false, // 加载状态
+    error: null, // 错误信息
+    chainId: null, // 链ID
+    balance: "0", // 账户余额(ETH)
+    rpcUrl: "", // 您的私有链RPC
+
+    username: "", // 用户名
+    accountName: "", //网络昵称
+    accountIcon: "", // 网络头像
+    accountPassword: null, // 密码
+    accountHint: "", //  提示词
+    words: "", // 助记词
+
+    walletList: [], // 钱包列表
+  }),
+  persist: true,
+  getters: {
+    getWalletList() {
+      return this.walletList;
+    },
+  },
+  actions: { 
+    async initWeb3() {
+      try {
+        window.$web3 = new Web3(this.rpcUrl);
+        return window.$web3
+      } catch (err) {
+        console.log(err);
+        this.error = "初始化区块链连接失败";
+        return null;
+      }
+    },
+ 
+    async getBalance() {
+      if (!this.account || !window.$web3) {
+        await this.initWeb3()
+      }
+      try {
+        const weiBalance = await window.$web3.eth.getBalance(this.account);
+        this.balance  = await window.$web3.utils.fromWei(weiBalance, "ether");
+        return  this.balance;
+      } catch (err) {
+        this.error = "获取余额失败";
+        return "0";
+      }
+    },
+    async loginWithPrivateKey(password = "") {
+      this.loading = true;
+      this.error = null;
+      try {
+        const web3 = window.$web3 || (await this.initWeb3());
+        if (!web3) throw new Error("区块链连接失败");
+
+        if (!/^0x[0-9a-fA-F]{64}$/.test(this.privateKey)) {
+          throw new Error("私钥格式不正确");
+        }
+ 
+
+        // if (password) {
+        //   this.encryptedKey = CryptoJS.AES.encrypt(
+        //     privateKey,
+        //     password
+        //   ).toString();
+        //   localStorage.setItem("encryptedKey", this.encryptedKey);
+        // }
+
+        const account = await web3.eth.accounts.privateKeyToAccount(this.privateKey);
+        const code = await web3.eth.getCode(account.address);
+              
+        if (code !== "0x") throw new Error("该地址是合约地址,不支持登录");
+        this.account = account.address;
+        this.isAuthenticated = true;
+        this.chainId =  `${await web3.eth.getChainId()}n`;
+        await this.getBalance();
+        return {
+          address: account.address,
+          chainId: this.chainId,
+          balance: this.balance,
+        };
+      } catch (err) {
+        console.log("登录失败");
+        this.error = err.message || "登录失败";
+        throw err;
+      }finally {
+        this.$persist();
+        this.loading = false;
+      }
+    },
+  },
+});

+ 35 - 45
src/views/login/backupMnemonic/index.vue

@@ -12,67 +12,55 @@
     </div>
 
     <div class="button-group">
-      <a class="button-group-mnemonic a-link im-copy-btn" :data-clipboard-text="walletData.words">
+      <a
+        class="button-group-mnemonic a-link im-copy-btn"
+        :data-clipboard-text="walletData.words"
+      >
         {{ $t("login.CopyMnemonic") }}</a
       >
-      <van-button class="btn" round block type="primary" native-type="submit" @click="next">
+      <van-button
+        class="btn"
+        round
+        block
+        type="primary"
+        native-type="submit"
+        @click="next"
+      >
         {{ $t("login.BackupComplete") }}
       </van-button>
     </div>
   </div>
 </template>
 
-<script setup>  
+<script setup>
 import { createAccent } from "@/api/path/login.api";
 import { useSystemStore } from "@/stores/modules/systemStore";
-import { useWalletAuth } from "@/composables/useWalletAuth";
+import { useWalletStore } from "@/stores/modules/walletStore";
 
 // 一键复制文本
-import { useCopy } from '@/hooks/use-copy.js';
+import { useCopy } from "@/hooks/use-copy.js";
 useCopy();
 
-
 const router = useRouter();
-const route = useRoute();
-const walletInfo = route.query.walletInfo;
-const systemStore = useSystemStore();
-const {
-  authState,
-  loginWithPrivateKey,
-  loginWithStorage,
-  logout,
-  hasStoredWallet,
-  getBalance,
-} = useWalletAuth();
+const walletStore = useWalletStore();
 
 const walletData = ref({});
 
 const next = async () => {
   // 登录
-  const data = await loginWithPrivateKey(
-    systemStore.getWallet.privateKey.trim()
-  );  
+  await walletStore.loginWithPrivateKey()
+  walletStore.$persist(); 
   router.push({
-    path:"/wallet"
-  })
+    path: "/wallet",
+  });
 };
- 
- 
 
 onMounted(async () => {
   const { data } = await createAccent({});
   walletData.value = JSON.parse(atob(data.content));
-  // 将钱包信息,网络信息一起保存
-  systemStore.setStateValue({
-    key: "wallet",
-    value: {
-      address: walletData.value.address1,
-      privateKey: walletData.value.privateKey,
-      words:walletData.value.words,
-      walletInfo:walletInfo
-    },
-    localStorage: true,
-  });
+  walletStore.account = walletData.value.address;
+  walletStore.privateKey = walletData.value.privateKey;
+  walletStore.words = walletData.value.words;
 });
 </script>
 
@@ -106,14 +94,16 @@ onMounted(async () => {
     margin-bottom: 21px;
   }
 }
-.btn{
-    background: @theme-color1;
-    border-radius: 70px;
-    font-family: PingFang SC, PingFang SC;
-    font-weight: 600;
-    font-size: 19px;
-    color: #FFFFFF;
-    height: 54px !important;
-    border:none !important;
-  }
+.btn {
+  background: @theme-color1;
+  border-radius: 70px;
+  font-family:
+    PingFang SC,
+    PingFang SC;
+  font-weight: 600;
+  font-size: 19px;
+  color: #ffffff;
+  height: 54px !important;
+  border: none !important;
+}
 </style>

+ 7 - 11
src/views/login/createWallet/index.vue

@@ -68,11 +68,12 @@
 <script setup>
 import _ from "lodash";
 import { cryptoEncode } from "@/utils/crypto.js"
-import { useRoute } from 'vue-router'
+import { useWalletStore } from "@/stores/modules/walletStore";
 
 const router = useRouter();
 const route = useRoute();
-const network = JSON.parse(route.query.network);
+const walletStore = useWalletStore();
+// const network = JSON.parse(route.query.network);
 
 const form = ref({});
 const show = ref(false);
@@ -86,18 +87,13 @@ const onSubmit = ()=>{
 }
 const goTo = () => {
   let data = _.cloneDeep(form.value)
-  data.password = cryptoEncode(data.password)
-  data.confirmPassword = cryptoEncode(data.confirmPassword)
+  data.password = cryptoEncode(data.password) 
   // 将网络和钱包信息保存
-  data.networkName = network.name;
-  data.networkUrl = network.url;
-  data.networkImg = network.icon;
-  
+  walletStore.username = data.username
+  walletStore.accountPassword = data.password
+  walletStore.accountHint = data.promptMessage
   router.push({
     path: "/backupMnemonic",
-    query: {
-      walletInfo: JSON.stringify(data)
-    }
   });
   show.value = false;
 }

+ 126 - 140
src/views/login/importWallet/index.vue

@@ -1,144 +1,130 @@
 <template>
-    <van-form @submit="onSubmit"  >
-      <van-cell-group inset>
-        <van-field
-            v-model="form.userKey"
-            :label="type == 0?$t('form.PrivateKey'):$t('form.MemoryAidWord')"
-            rows="2"
-            autosize
-            type="textarea"
-            :placeholder="type == 0?$t('form.PleaseEnterThePrivateKey'):$t('form.PleaseEnterTheMnemonicPhrase')"
-            show-word-limit
-        />
-        <van-field
-          v-model="form.username"
-          name="username"
-          :label="$t('form.WalletName')"
-          :placeholder="$t('form.PleaseFillIn') + $t('form.WalletName')"
-          :rules="[
-            {
-              required: true,
-              message: $t('form.PleaseFillIn') + $t('form.WalletName'),
-            },
-          ]"
-        />
-        <van-field
-          v-model="form.password"
-          type="password"
-          name="password"
-          :label="$t('form.WalletPassword')"
-          :placeholder="$t('form.PleaseFillIn') + $t('form.WalletPassword')"
-          :rules="[
-            {
-              required: true,
-              message: $t('form.PleaseFillIn') + $t('form.WalletPassword'),
-            },
-          ]"
-        />
-  
-        <van-field
-          v-model="form.confirmPassword"
-          type="password"
-          name="confirmPassword"
-          :label="$t('form.ConfirmPassword')"
-          :placeholder="$t('form.PleaseFillIn') + $t('form.ConfirmPassword')"
-          :rules="[
-            {
-              required: true,
-              message: $t('form.PleaseFillIn') + $t('form.ConfirmPassword'),
-            },
-          ]"
-        />
-  
-        <van-field
-          v-model="form.promptMessage"
-          name="promptMessage"
-          :label="$t('form.PromptMessage')"
-          :placeholder="$t('form.PleaseFillIn') + $t('form.PromptMessage')"
-        />
-      </van-cell-group>
-      <div class="button-group"  >
-        <van-button class="btn" round block type="primary" native-type="submit">
-          {{ $t("router.ImportWallet") }}
-        </van-button>
-      </div>
-    </van-form>
-  </template>
-  
-  <script setup>
-  import _ from "lodash";
-  import { cryptoEncode } from "@/utils/crypto.js"
-  import { useRoute } from 'vue-router'
-  import { useSystemStore } from "@/stores/modules/systemStore";
-  import { useWalletAuth } from "@/composables/useWalletAuth";
-  const {
-  authState,
-  loginWithPrivateKey,
-  loginWithStorage,
-  logout,
-  hasStoredWallet,
-  getBalance,
-} = useWalletAuth();
-  const router = useRouter();
-  const route = useRoute();
-  const systemStore = useSystemStore();
-  const network = JSON.parse(route.query.network);
-  const type = route.query.type;
-  
-  const form = ref({});
-  
-  const onSubmit = async ()=>{
-    if(form.value.password !== form.value.confirmPassword){ 
-      $msg($t("form.InconsistentPasswords"));
-      return 
-    }
-    let data = _.cloneDeep(form.value)
-    data.password = cryptoEncode(data.password)
-    data.confirmPassword = cryptoEncode(data.confirmPassword)
-    // 将网络和钱包信息保存
-    data.networkName = network.name;
-    data.networkUrl = network.url;
-    data.networkImg = network.icon;
+  <van-form @submit="onSubmit">
+    <van-cell-group inset>
+      <van-field
+        v-model="form.userKey"
+        :label="type == 0 ? $t('form.PrivateKey') : $t('form.MemoryAidWord')"
+        rows="3"
+        autosize
+        type="textarea"
+        :placeholder="
+          type == 0
+            ? $t('form.PleaseEnterThePrivateKey')
+            : $t('form.PleaseEnterTheMnemonicPhrase')
+        "
+        show-word-limit
+      />
+      <van-field
+        v-model="form.username"
+        name="username"
+        :label="$t('form.WalletName')"
+        :placeholder="$t('form.PleaseFillIn') + $t('form.WalletName')"
+        :rules="[
+          {
+            required: true,
+            message: $t('form.PleaseFillIn') + $t('form.WalletName'),
+          },
+        ]"
+      />
+      <van-field
+        v-model="form.password"
+        type="password"
+        name="password"
+        :label="$t('form.WalletPassword')"
+        :placeholder="$t('form.PleaseFillIn') + $t('form.WalletPassword')"
+        :rules="[
+          {
+            required: true,
+            message: $t('form.PleaseFillIn') + $t('form.WalletPassword'),
+          },
+        ]"
+      />
 
-    systemStore.setStateValue({
-        key: "wallet",
-        value: {
-            address: '',
-            privateKey: type == 0? data.userKey :"",
-            words: type == 1? data.userKey :"",
-            walletInfo:data
-        },
-        localStorage: true,
-    });
-    await loginWithPrivateKey(
-      systemStore.getWallet.privateKey.trim()
-    ); 
-    router.push({
-        path:"/wallet"
-    })
-  }
-  
-  </script>
-  
-  <style scoped lang="less">
-  .van-cell-group{
-    margin-top: 16px;
+      <van-field
+        v-model="form.confirmPassword"
+        type="password"
+        name="confirmPassword"
+        :label="$t('form.ConfirmPassword')"
+        :placeholder="$t('form.PleaseFillIn') + $t('form.ConfirmPassword')"
+        :rules="[
+          {
+            required: true,
+            message: $t('form.PleaseFillIn') + $t('form.ConfirmPassword'),
+          },
+        ]"
+      />
+
+      <van-field
+        v-model="form.promptMessage"
+        name="promptMessage"
+        :label="$t('form.PromptMessage')"
+        :placeholder="$t('form.PleaseFillIn') + $t('form.PromptMessage')"
+      />
+    </van-cell-group>
+    <div class="button-group">
+      <van-button class="btn" round block type="primary" native-type="submit">
+        {{ $t("router.ImportWallet") }}
+      </van-button>
+    </div>
+  </van-form>
+</template>
+
+<script setup>
+import _ from "lodash";
+import { useRoute } from "vue-router";
+import { useWalletStore } from "@/stores/modules/walletStore";
+ 
+
+const router = useRouter();
+const route = useRoute();
+const walletStore = useWalletStore();
+const type = route.query.type;
+
+const form = ref({
+  userKey: "",
+});
+
+const ddd = ref("0");
+ 
+const onSubmit = async () => {
+  if (form.value.password !== form.value.confirmPassword) {
+    $msg($t("form.InconsistentPasswords"));
+    return;
   }
-  .button-group{
-    width: calc(100% - 32px);
-    position: absolute;
-    left: 16px;
-    bottom: 70px;
-    .btn{
-      background: @theme-color1;
-      border-radius: 70px;
-      font-family: PingFang SC, PingFang SC;
-      font-weight: 600;
-      font-size: 19px;
-      color: #FFFFFF;
-      height: 54px !important;
-      border:none !important;
-    }
+  let data = _.cloneDeep(form.value);
+  console.log("data= ", data);
+
+  walletStore.username = form.value.username;
+  walletStore.privateKey = form.value.userKey;
+  walletStore.accountPassword = form.value.password;
+  walletStore.accountHint = form.value.promptMessage;
+  await walletStore.loginWithPrivateKey();
+  router.push({
+    path: "/wallet",
+  });
+};
+</script>
+
+<style scoped lang="less">
+.van-cell-group {
+  margin-top: 16px;
+}
+.button-group {
+  width: calc(100% - 32px);
+  position: absolute;
+  left: 16px;
+  bottom: 70px;
+  .btn {
+    background: @theme-color1;
+    border-radius: 70px;
+    font-family:
+      PingFang SC,
+      PingFang SC;
+    font-weight: 600;
+    font-size: 19px;
+    color: #ffffff;
+    height: 54px !important;
+    border: none !important;
   }
-  </style>
-  
+}
+</style>

+ 6 - 3
src/views/login/selectNetwork/index.vue

@@ -21,9 +21,12 @@
 <script setup> 
 import { getNetwork } from '@/api/path/login.api'
 import { useSystemStore } from "@/stores/modules/systemStore";
+import { useWalletStore } from "@/stores/modules/walletStore";
+import { useRouter } from 'vue-router'
 
 const router = useRouter()
 const systemStore = useSystemStore();
+const walletStore = useWalletStore();
 
 
 const value = ref('')
@@ -46,11 +49,11 @@ const networkComputed = computed(() => {
 })
 
 const selectNetwork = (item) => {
+  walletStore.accountName = item.name
+  walletStore.accountIcon = item.icon
+  walletStore.rpcUrl = item.url
   router.push({
     path: systemStore.getISCREATE?'/createWallet':'/importMethod',
-    query: {
-      network: JSON.stringify(item)
-    }
   })
 }
 

+ 7 - 12
src/views/wallet/index.vue

@@ -178,18 +178,13 @@
   <script setup>
   import { useRouter } from 'vue-router'
   import { useSystemStore } from "@/stores/modules/systemStore";
-  import { useWalletAuth } from "@/composables/useWalletAuth";
+  import {  useWalletStore } from "@/stores/modules/walletStore";
   const systemStore = useSystemStore();
   const router = useRouter();
-  const walletInfo = systemStore.getWallet;
-  const {
-  authState,
-  loginWithPrivateKey,
-  loginWithStorage,
-  logout,
-  hasStoredWallet,
-  getBalance,
-} = useWalletAuth();
+
+
+
+  const walletStore = useWalletStore();
   const isShow = ref(true);
   const showWallet = ref(false);
   const showHistory = ref(false);
@@ -206,8 +201,8 @@
     
   }
   onMounted(async ()=>{
-    const aa = await getBalance();
-    console.log(aa)
+    // const aa = await walletStore.getBalance();
+    // console.log("---",aa)
   })
   </script>