From 1318670d6dee09a94e02ead0ac7c96a80cad3edf Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 1 Nov 2023 09:00:54 +0800 Subject: [PATCH] only use address for account track --- src/modules/wallet/accounts.vue | 66 +++------------------------------ 1 file changed, 6 insertions(+), 60 deletions(-) diff --git a/src/modules/wallet/accounts.vue b/src/modules/wallet/accounts.vue index 91a151a3..a702c4bb 100644 --- a/src/modules/wallet/accounts.vue +++ b/src/modules/wallet/accounts.vue @@ -17,6 +17,7 @@ const dashboard = useDashboard(); const chainStore = useBlockchain() const format = useFormatter(); const sourceAddress = ref(''); // +const sourceHdPath = ref("m/44/118/0'/0/0"); // const selectedSource = ref({} as LocalKey); // const importStep = ref('step1') @@ -123,49 +124,9 @@ const totalChange = computed(() => { }) // Adding Model Boxes -const sourceOptions = computed(() => { - // scan all connected wallet - const keys = scanLocalKeys(); - // parser options from all existed keys - Object.values(conf.value).forEach((x) => { - const [first] = x; - if (first) { - const { data } = fromBech32(first.address); - const hex = toHex(data); - if ( - keys.findIndex( - (k) => toHex(fromBech32(k.cosmosAddress).data) === hex - ) === -1 - ) { - keys.push({ - cosmosAddress: first.address, - hdPath: `m/44/${first.coinType}/0'/0/0`, - }); - } - } - }); - // parse options from an given address - if (sourceAddress.value) { - const { prefix, data } = fromBech32(sourceAddress.value); - const chain = Object.values(dashboard.chains).find( - (x) => x.bech32Prefix === prefix - ); - if (chain) { - keys.push({ - cosmosAddress: sourceAddress.value, - hdPath: `m/44/${chain.coinType}/0'/0/0`, - }); - } - } - if (!selectedSource.value.cosmosAddress && keys.length > 0) { - selectedSource.value = keys[0]; - } - return keys; -}); - const availableAccount = computed(() => { - if (selectedSource.value.cosmosAddress) { - return scanCompatibleAccounts([selectedSource.value]).filter( + if (sourceAddress.value) { + return scanCompatibleAccounts([{cosmosAddress: sourceAddress.value, hdPath: sourceHdPath.value }]).filter( (x) => !addresses.value.includes(x.address) ); } @@ -351,9 +312,6 @@ async function loadBalances(endpoint: string, address: string) { Import Address - - Add chain to Keplr - @@ -361,22 +319,10 @@ async function loadBalances(endpoint: string, address: string) {