Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: show "Unknown fee" if tx published before got response from API #32

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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