Skip to content

Commit 141160e

Browse files
authored
Merge pull request #761 from Adamant-im/fix/tx-fee-pending
fix: pending tx fee
2 parents af965b4 + 61bfc56 commit 141160e

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

src/components/transactions/TransactionTemplate.vue

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -283,43 +283,41 @@ export default defineComponent({
283283
)
284284
})
285285
const rate = computed(() => {
286-
if (!transaction.value) return
286+
if (!transaction.value) return Symbols.HOURGLASS
287287
288288
return store.getters['rate/rate'](transaction.value.amount, props.crypto)
289289
})
290290
291291
const calculatedTimestampInSec = computed(() => {
292292
if (!transaction.value) {
293-
return null;
293+
return null
294294
}
295295
296296
return timestampInSec(props.crypto, transaction.value.timestamp!)
297297
})
298298
299299
const calculatedFee = computed(() => {
300-
const commissionTokenLabel = (props.feeCrypto ?? props.crypto) as CryptoSymbol;
300+
const commissionTokenLabel = (props.feeCrypto ?? props.crypto) as CryptoSymbol
301301
302302
const { cryptoTransferDecimals, decimals } = CryptosInfo[commissionTokenLabel]
303303
304-
const tokenFee = typeof props.fee === 'number'
305-
? `${formatAmount(props.fee, cryptoTransferDecimals ?? decimals)} ${commissionTokenLabel}`
306-
: placeholder.value;
307-
308-
if (!props.fee || !calculatedTimestampInSec.value) return tokenFee;
304+
const tokenFee =
305+
props.queryStatus === 'success' && typeof props.fee === 'number'
306+
? `${formatAmount(props.fee, cryptoTransferDecimals ?? decimals)} ${commissionTokenLabel}`
307+
: placeholder.value
309308
309+
if (!props.fee || !calculatedTimestampInSec.value) return tokenFee
310310
311311
const commissionUsdAmount = store.getters['rate/historyRate'](
312312
calculatedTimestampInSec.value,
313313
props.fee,
314-
commissionTokenLabel,
315-
);
316-
317-
318-
if (!commissionUsdAmount) return tokenFee;
314+
commissionTokenLabel
315+
)
319316
320-
return tokenFee + ` ~${commissionUsdAmount}`;
321-
});
317+
if (!commissionUsdAmount) return tokenFee
322318
319+
return tokenFee + ` ~${commissionUsdAmount}`
320+
})
323321
324322
const handleCopyToClipboard = (text?: string) => {
325323
if (!text) return
@@ -365,9 +363,7 @@ export default defineComponent({
365363
)
366364
367365
const formatAmount = (amount: number, decimals = CryptosInfo[props.crypto].decimals) => {
368-
return BigNumber(amount)
369-
.decimalPlaces(decimals, BigNumber.ROUND_DOWN)
370-
.toFixed()
366+
return BigNumber(amount).decimalPlaces(decimals, BigNumber.ROUND_DOWN).toFixed()
371367
}
372368
373369
return {

0 commit comments

Comments
 (0)