From adc5c13e68fadedf01d4fbfad48c562f942b02bf Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 29 May 2024 02:39:26 +0200 Subject: [PATCH 1/2] Follow Nexus API: add consensus account num_txns Update to version: "add consensus account num_txns" (from 2024.05.22) - New data: - Account.stats - Changed: - AccountStats.total_received and total_sent is now optional --- .changelog/1433.internal.md | 1 + src/oasis-nexus/generated/api.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .changelog/1433.internal.md diff --git a/.changelog/1433.internal.md b/.changelog/1433.internal.md new file mode 100644 index 000000000..9847ca569 --- /dev/null +++ b/.changelog/1433.internal.md @@ -0,0 +1 @@ +Follow nexus: add consensus account num_txns diff --git a/src/oasis-nexus/generated/api.ts b/src/oasis-nexus/generated/api.ts index 8a8bd8446..9d55ff7fd 100644 --- a/src/oasis-nexus/generated/api.ts +++ b/src/oasis-nexus/generated/api.ts @@ -673,9 +673,9 @@ export interface AccountStats { /** The total number of transactions this account was involved with. */ num_txns: number; /** The total amount of native tokens received, in base units. */ - total_received: TextBigInt; + total_received?: TextBigInt; /** The total amount of native tokens sent, in base units. */ - total_sent: TextBigInt; + total_sent?: TextBigInt; } export interface EvmNft { @@ -1306,6 +1306,7 @@ For efficiency, this field is omitted when listing multiple-accounts. escrow: TextBigInt; /** The expected nonce for the next transaction (= last used nonce + 1) */ nonce: number; + stats: AccountStats; } /** From e3a5b1063a2d55d96e74862196344396b3d992ff Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 29 May 2024 02:40:05 +0200 Subject: [PATCH 2/2] Adapt our code for Nexus changes Adapt to account stats having optional fiels --- .../Account/RuntimeAccountDetailsView.tsx | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/app/components/Account/RuntimeAccountDetailsView.tsx b/src/app/components/Account/RuntimeAccountDetailsView.tsx index f4dd79a40..201b41ff8 100644 --- a/src/app/components/Account/RuntimeAccountDetailsView.tsx +++ b/src/app/components/Account/RuntimeAccountDetailsView.tsx @@ -148,21 +148,29 @@ export const RuntimeAccountDetailsView: FC = ({ {nativeTokens.length === 1 && ( <> -
{t('account.totalReceived')}
-
- {t('common.valueInToken', { - ...getPreciseNumberFormat(account.stats.total_received), - ticker: nativeTickerNames[0], - })} -
- -
{t('account.totalSent')}
-
- {t('common.valueInToken', { - ...getPreciseNumberFormat(account.stats.total_sent), - ticker: nativeTickerNames[0], - })} -
+ {account.stats.total_received !== undefined && ( + <> +
{t('account.totalReceived')}
+
+ {t('common.valueInToken', { + ...getPreciseNumberFormat(account.stats.total_received), + ticker: nativeTickerNames[0], + })} +
+ + )} + + {account.stats.total_sent !== undefined && ( + <> +
{t('account.totalSent')}
+
+ {t('common.valueInToken', { + ...getPreciseNumberFormat(account.stats.total_sent), + ticker: nativeTickerNames[0], + })} +
+ + )} )}