From bdaa217f9f21d47b1bc0586e067fd8a1635759a5 Mon Sep 17 00:00:00 2001 From: lukaw3d Date: Tue, 15 Aug 2023 16:49:45 +0200 Subject: [PATCH 1/2] Manually patch charged_fee as required --- src/oasis-nexus/generated/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oasis-nexus/generated/api.ts b/src/oasis-nexus/generated/api.ts index 9620bb790..194a90d80 100644 --- a/src/oasis-nexus/generated/api.ts +++ b/src/oasis-nexus/generated/api.ts @@ -751,7 +751,7 @@ execute it. ParaTime base units, as a string). Calculated as `gas_price * gas_used`, where `gas_price = fee / gas_limit`. */ - charged_fee?: string; + charged_fee: string; /** The total byte size of the transaction. */ size: number; /** The method that was called. Defined by the runtime. In theory, this could be any string as the runtimes evolve. From 7dd54003d368779f36ee47b442b9bf0765b30479 Mon Sep 17 00:00:00 2001 From: lukaw3d Date: Tue, 15 Aug 2023 16:50:26 +0200 Subject: [PATCH 2/2] Show used gas and fee instead of limit --- .changelog/800.bugfix.md | 1 + src/app/components/Transactions/index.tsx | 2 +- src/app/pages/TransactionDetailPage/index.tsx | 8 +++++++- src/oasis-nexus/api.ts | 6 ++++-- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .changelog/800.bugfix.md diff --git a/.changelog/800.bugfix.md b/.changelog/800.bugfix.md new file mode 100644 index 000000000..ab77bca27 --- /dev/null +++ b/.changelog/800.bugfix.md @@ -0,0 +1 @@ +Show used gas and fee instead of limit diff --git a/src/app/components/Transactions/index.tsx b/src/app/components/Transactions/index.tsx index 0e9239a37..ab755cb9f 100644 --- a/src/app/components/Transactions/index.tsx +++ b/src/app/components/Transactions/index.tsx @@ -188,7 +188,7 @@ export const Transactions: FC = ({ }, { align: TableCellAlign.Right, - content: , + content: , key: 'fee_amount', }, { diff --git a/src/app/pages/TransactionDetailPage/index.tsx b/src/app/pages/TransactionDetailPage/index.tsx index a139f74ac..68c90ad91 100644 --- a/src/app/pages/TransactionDetailPage/index.tsx +++ b/src/app/pages/TransactionDetailPage/index.tsx @@ -323,9 +323,15 @@ export const TransactionDetailView: FC<{
{t('common.txnFee')}
- {t('common.valueInToken', { ...getPreciseNumberFormat(transaction.fee), ticker: tickerName })} + {t('common.valueInToken', { + ...getPreciseNumberFormat(transaction.charged_fee), + ticker: tickerName, + })}
+
{t('common.gasUsed')}
+
{transaction.gas_used.toLocaleString()}
+
{t('common.gasLimit')}
{transaction.gas_limit.toLocaleString()}
diff --git a/src/oasis-nexus/api.ts b/src/oasis-nexus/api.ts index d43f444bb..a704b01c1 100644 --- a/src/oasis-nexus/api.ts +++ b/src/oasis-nexus/api.ts @@ -151,7 +151,8 @@ export const useGetRuntimeTransactions: typeof generated.useGetRuntimeTransactio return { ...tx, eth_hash: tx.eth_hash ? `0x${tx.eth_hash}` : undefined, - fee: tx.fee ? fromBaseUnits(tx.fee, paraTimesConfig[runtime].decimals) : undefined, + fee: fromBaseUnits(tx.fee, paraTimesConfig[runtime].decimals), + charged_fee: fromBaseUnits(tx.charged_fee, paraTimesConfig[runtime].decimals), amount: tx.amount ? fromBaseUnits(tx.amount, paraTimesConfig[runtime].decimals) : undefined, layer: runtime, network, @@ -222,7 +223,8 @@ export const useGetRuntimeTransactionsTxHash: typeof generated.useGetRuntimeTran return { ...tx, eth_hash: tx.eth_hash ? `0x${tx.eth_hash}` : undefined, - fee: tx.fee ? fromBaseUnits(tx.fee, paraTimesConfig[runtime].decimals) : undefined, + fee: fromBaseUnits(tx.fee, paraTimesConfig[runtime].decimals), + charged_fee: fromBaseUnits(tx.charged_fee, paraTimesConfig[runtime].decimals), amount: tx.amount ? fromBaseUnits(tx.amount, paraTimesConfig[runtime].decimals) : undefined, layer: runtime, network,