Skip to content

Commit

Permalink
Merge pull request #698 from threshold-network/fix-transaction-modal-…
Browse files Browse the repository at this point in the history
…not-disappearing-bug

Fix transaction modal not disappearing bug
  • Loading branch information
kpyszkowski authored Dec 13, 2023
2 parents 60aefaf + 16451b8 commit 7ea372b
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/pages/tBTC/Bridge/Minting/InitiateMinting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,33 @@ import { BigNumber } from "ethers"
import { useThreshold } from "../../../../contexts/ThresholdContext"
import { useRevealDepositTransaction } from "../../../../hooks/tbtc"
import { Toast } from "../../../../components/Toast"
import { useModal } from "../../../../hooks/useModal"

const InitiateMintingComponent: FC<{
utxo: BitcoinUtxo
onPreviousStepClick: (previosuStep: MintingStep) => void
}> = ({ utxo, onPreviousStepClick }) => {
const { tBTCMintAmount, updateState } = useTbtcState()
const threshold = useThreshold()
const { closeModal } = useModal()

const onSuccessfulDepositReveal = () => {
updateState("mintingStep", MintingStep.MintingSuccess)
// We don't have success modal for deposit reveal so we just closing the
// current TransactionIsPending modal.
closeModal()
}

const { sendTransaction: revealDeposit } = useRevealDepositTransaction(
onSuccessfulDepositReveal
)
const { value: depositedAmount } = utxo

const depositedAmount = BigNumber.from(utxo.value).toString()

useEffect(() => {
const getEstimatedDepositFees = async () => {
const amount = BigNumber.from(depositedAmount).toString()
const { treasuryFee, optimisticMintFee, amountToMint } =
await threshold.tbtc.getEstimatedDepositFees(amount)
await threshold.tbtc.getEstimatedDepositFees(depositedAmount)

updateState("mintingFee", optimisticMintFee)
updateState("thresholdNetworkFee", treasuryFee)
Expand Down Expand Up @@ -62,17 +67,15 @@ const InitiateMintingComponent: FC<{
<InfoBox variant="modal" mb="6">
<H5 mb={4}>
You deposited{" "}
<Skeleton isLoaded={!!depositedAmount} maxW="105px" as="span">
<InlineTokenBalance
tokenSymbol="BTC"
tokenDecimals={8}
precision={6}
higherPrecision={8}
tokenAmount={depositedAmount.toString()}
displayTildeBelow={0}
withSymbol
/>{" "}
</Skeleton>{" "}
<InlineTokenBalance
tokenSymbol="BTC"
tokenDecimals={8}
precision={6}
higherPrecision={8}
tokenAmount={depositedAmount}
displayTildeBelow={0}
withSymbol
/>{" "}
and will receive{" "}
<Skeleton isLoaded={!!tBTCMintAmount} maxW="105px" as="span">
<InlineTokenBalance
Expand Down

0 comments on commit 7ea372b

Please sign in to comment.