From 7b82ec2b5993b832bd0a19bfe079fd6036322f02 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Mon, 13 Nov 2023 13:38:22 +0800 Subject: [PATCH] add received asset list --- src/modules/[chain]/account/[address].vue | 51 +++++++++++++++++++++++ src/plugins/i18n/locales/en.json | 2 + 2 files changed, 53 insertions(+) diff --git a/src/modules/[chain]/account/[address].vue b/src/modules/[chain]/account/[address].vue index 269d8ca6..f9295ce5 100644 --- a/src/modules/[chain]/account/[address].vue +++ b/src/modules/[chain]/account/[address].vue @@ -32,6 +32,7 @@ const txs = ref({} as TxResponse[]); const delegations = ref([] as Delegation[]); const rewards = ref({} as DelegatorRewards); const balances = ref([] as Coin[]); +const recentReceived = ref([] as TxResponse[]); const unbonding = ref([] as UnbondingResponses[]); const unbondingTotal = ref(0); const chart = {}; @@ -110,6 +111,12 @@ function loadAccount(address: string) { }); }); }); + + const receivedQuery = `?&pagination.reverse=true&events=coin_received.receiver='${address}'&pagination.limit=5`; + blockchain.rpc.getTxs(receivedQuery, {}).then((x) => { + console.log(x); + recentReceived.value = x.tx_responses; + }); } function updateEvent() { @@ -536,6 +543,50 @@ function updateEvent() { + +
+

{{ $t('account.received') }}

+
+ + + + + + + + + + + + + + + + + + +
{{ $t('account.height') }}{{ $t('account.hash') }}{{ $t('account.amount') }}{{ $t('account.time') }}
{{ $t('account.no_transactions') }}
+ {{ + v.height + }} + + + {{ v.txhash }} + + +
+ {{ v.tx.body.messages.map(x => format.formatTokens(x.amount)).join(", ") }} +
+ + +
{{ format.toLocaleDate(v.timestamp) }} ({{ format.toDay(v.timestamp, 'from') }})
+
+
+

{{ $t('account.acc') }}

diff --git a/src/plugins/i18n/locales/en.json b/src/plugins/i18n/locales/en.json index 51b928aa..4bc215b5 100644 --- a/src/plugins/i18n/locales/en.json +++ b/src/plugins/i18n/locales/en.json @@ -33,6 +33,8 @@ "btn_index": "Back to Home" }, "account": { + "amount": "Amount", + "received": "Recent Received", "type": "Type", "address": "Address", "acc": "Account",