mirror of
https://github.com/luxfi/explore.git
synced 2026-07-27 05:54:15 +00:00
fix(tx): guard tx.fee?.value — luxfi indexer returns fee:null; FE must render fee-less txs without crashing (homepage Latest Txs error boundary)
This commit is contained in:
@@ -25,7 +25,7 @@ const TxFee = ({ tx, accuracy, accuracyUsd, loading, noSymbol: noSymbolProp, noU
|
||||
if ('celo' in tx && tx.celo?.gas_token) {
|
||||
return (
|
||||
<TokenValue
|
||||
amount={ tx.fee.value || '0' }
|
||||
amount={ tx.fee?.value || '0' }
|
||||
token={ tx.celo.gas_token }
|
||||
accuracy={ accuracy }
|
||||
accuracyUsd={ accuracyUsd }
|
||||
@@ -54,7 +54,7 @@ const TxFee = ({ tx, accuracy, accuracyUsd, loading, noSymbol: noSymbolProp, noU
|
||||
|
||||
return (
|
||||
<NativeCoinValue
|
||||
amount={ tx.fee.value || '0' }
|
||||
amount={ tx.fee?.value || '0' }
|
||||
noSymbol={ noSymbol }
|
||||
exchangeRate={ noUsd ? null : exchangeRate }
|
||||
historicalExchangeRate={ noUsd ? null : historicalExchangeRate }
|
||||
|
||||
@@ -71,7 +71,7 @@ const TxDetailsWrapped = ({ data }: Props) => {
|
||||
</DetailedInfo.ItemLabel>
|
||||
<DetailedInfoNativeCoinValue amount={ data.value }/>
|
||||
|
||||
{ data.fee.value !== null && (
|
||||
{ data.fee?.value != null && (
|
||||
<>
|
||||
<DetailedInfo.ItemLabel
|
||||
hint="Total transaction fee"
|
||||
|
||||
@@ -39,7 +39,7 @@ const TxDetailsTxFee = ({ isLoading, data }: Props) => {
|
||||
return (
|
||||
<>
|
||||
<NativeCoinValue
|
||||
amount={ data.fee.value }
|
||||
amount={ data.fee?.value }
|
||||
exchangeRate={ exchangeRate }
|
||||
historicalExchangeRate={ historicalExchangeRate }
|
||||
hasExchangeRateToggle
|
||||
|
||||
@@ -677,7 +677,7 @@ const TxInfo = ({ data, tacOperations, isLoading, socketStatus, noTxActions }: P
|
||||
|
||||
<TxDetailsGasPrice gasPrice={ data.gas_price } gasToken={ data.celo?.gas_token } isLoading={ isLoading }/>
|
||||
|
||||
<TxDetailsFeePerGas txFee={ data.fee.value } gasUsed={ data.gas_used } isLoading={ isLoading }/>
|
||||
<TxDetailsFeePerGas txFee={ data.fee?.value } gasUsed={ data.gas_used } isLoading={ isLoading }/>
|
||||
|
||||
{ !config.UI.views.tx.additionalFields?.set_max_gas_limit && <TxDetailsGasUsage isLoading={ isLoading } data={ data }/> }
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ const TxAdditionalInfoContent = ({ tx }: { tx: Transaction }) => {
|
||||
noTooltip
|
||||
/>
|
||||
</div>
|
||||
{ !config.UI.views.tx.hiddenFields?.tx_fee && (tx.stability_fee !== undefined || tx.fee.value !== null) && (
|
||||
{ !config.UI.views.tx.hiddenFields?.tx_fee && (tx.stability_fee !== undefined || tx.fee?.value != null) && (
|
||||
<div { ...sectionProps }>
|
||||
<span { ...sectionTitleProps }>Transaction fee</span>
|
||||
<TxFee tx={ tx } noTooltip/>
|
||||
|
||||
@@ -125,7 +125,7 @@ const TxsListItem = ({
|
||||
) }
|
||||
{ !config.UI.views.tx.hiddenFields?.tx_fee && (
|
||||
<div className="flex">
|
||||
{ (tx.stability_fee !== undefined || tx.fee.value !== null) && (
|
||||
{ (tx.stability_fee !== undefined || tx.fee?.value != null) && (
|
||||
<>
|
||||
<Skeleton loading={ isLoading } className="inline-block whitespace-pre">Fee </Skeleton>
|
||||
<TxFee tx={ tx } loading={ isLoading }/>
|
||||
|
||||
+2
-2
@@ -10,9 +10,9 @@ export default function sortTxs(sorting: TransactionsSortingValue | undefined) {
|
||||
case 'value-asc':
|
||||
return compareBns(tx1.value, tx2.value);
|
||||
case 'fee-desc':
|
||||
return compareBns(tx2.fee.value || 0, tx1.fee.value || 0);
|
||||
return compareBns(tx2.fee?.value || 0, tx1.fee?.value || 0);
|
||||
case 'fee-asc':
|
||||
return compareBns(tx1.fee.value || 0, tx2.fee.value || 0);
|
||||
return compareBns(tx1.fee?.value || 0, tx2.fee?.value || 0);
|
||||
case 'block_number-asc': {
|
||||
if (tx1.block_number && tx2.block_number) {
|
||||
return tx1.block_number - tx2.block_number;
|
||||
|
||||
Reference in New Issue
Block a user