From a56271f370edc81298203063af2236e6e84ac211 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sun, 24 Mar 2024 10:13:12 +0800 Subject: [PATCH] improve wasm contract --- .../[chain]/cosmwasm/[code_id]/contracts.vue | 2 +- .../cosmwasm/[code_id]/transactions.vue | 20 ++++++++-- src/modules/[chain]/cosmwasm/index.vue | 39 +++++++++++++++---- 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/src/modules/[chain]/cosmwasm/[code_id]/contracts.vue b/src/modules/[chain]/cosmwasm/[code_id]/contracts.vue index 81ad8529..5e6acd88 100644 --- a/src/modules/[chain]/cosmwasm/[code_id]/contracts.vue +++ b/src/modules/[chain]/cosmwasm/[code_id]/contracts.vue @@ -56,7 +56,7 @@ function showInfo(address: string) {
- + diff --git a/src/modules/[chain]/cosmwasm/[code_id]/transactions.vue b/src/modules/[chain]/cosmwasm/[code_id]/transactions.vue index 3428a1ac..ddf9aac4 100644 --- a/src/modules/[chain]/cosmwasm/[code_id]/transactions.vue +++ b/src/modules/[chain]/cosmwasm/[code_id]/transactions.vue @@ -36,6 +36,20 @@ const balances = ref({} as PaginatedBalances) const contractAddress = String(route.query.contract) +const history = JSON.parse(localStorage.getItem("contract_history") || "{}") + +if(history[chainStore.chainName]) { + if(!history[chainStore.chainName].includes(contractAddress)) { + history[chainStore.chainName].push(contractAddress) + if(history[chainStore.chainName].length > 10) { + history[chainStore.chainName].shift() + } + } +} else { + history[chainStore.chainName] = [contractAddress] +} +localStorage.setItem("contract_history", JSON.stringify(history)) + onMounted(() => { const address = contractAddress wasmStore.wasmClient.getWasmContracts(address).then((x) => { @@ -137,7 +151,7 @@ const result = ref({});
- Back + Back
-

Transactions

+

Transactions

{{ $t('cosmwasm.contract_list') }} {{ $t('account.action') }}
- + diff --git a/src/modules/[chain]/cosmwasm/index.vue b/src/modules/[chain]/cosmwasm/index.vue index 8644408b..ddb4b6a0 100644 --- a/src/modules/[chain]/cosmwasm/index.vue +++ b/src/modules/[chain]/cosmwasm/index.vue @@ -1,7 +1,7 @@
{{ $t('ibc.height') }} {{ $t('ibc.txhash') }}