Skip to content

Commit

Permalink
fix: display "Unknown fee" if tx published before got response from E…
Browse files Browse the repository at this point in the history
…stimateGas API
  • Loading branch information
brusherru committed Jul 11, 2024
1 parent 0914cfe commit 35e5117
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/TxListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ function TxListItem({
layersPerEpoch,
}: TxListItemProps): JSX.Element {
const txBalance = getTxBalance(tx, host);
const fee =
tx.gas.maxGas && tx.gas.price
? formatSmidge(-1n * BigInt(tx.gas.maxGas) * BigInt(tx.gas.price))
: 'Unknown fee';
return (
<Card
mb={2}
Expand Down Expand Up @@ -73,7 +77,7 @@ function TxListItem({
{txBalance !== null && formatSmidge(txBalance)}
</Text>
<Text color="gray" fontSize="xx-small" title="Fee" mb="2px">
{formatSmidge(-1n * BigInt(tx.gas.maxGas) * BigInt(tx.gas.price))}
{fee}
</Text>
</Flex>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion src/components/sendTx/SendTxModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ function SendTxModal({ isOpen, onClose }: SendTxModalProps): JSX.Element {
bitfield: 0,
},
gas: {
maxGas: String(estimatedGas),
maxGas: estimatedGas ? String(estimatedGas) : '',
price: String(txData.form.gasPrice),
},
template: {
Expand Down

0 comments on commit 35e5117

Please sign in to comment.