Skip to content

Commit

Permalink
fix: Fixed transfer screen usd -> btc bug (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
daviroo committed Jul 19, 2022
1 parent 6745a59 commit 2f42f64
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/screens/transfer-screen/transfer-confirmation-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ const TransferConfirmationScreen = ({
nextStep,
}: TransferConfirmationScreenProps) => {
const { usdWalletBalance, btcWalletBalance, btcWalletValueInUsd } = useWalletBalance()
const [intraLedgerPaymentSend] = useMutation.intraLedgerPaymentSend()
const [intraLedgerUsdPaymentSend] = useMutation.intraLedgerUsdPaymentSend()
const [intraLedgerPaymentSend, { loading: intraLedgerPaymentSendLoading }] =
useMutation.intraLedgerPaymentSend()
const [intraLedgerUsdPaymentSend, { loading: intraLedgerUsdPaymentSendLoading }] =
useMutation.intraLedgerUsdPaymentSend()
const [_status, setStatus] = useState<StatusType>(Status.IDLE)
const isLoading = intraLedgerPaymentSendLoading || intraLedgerUsdPaymentSendLoading

useEffect(() => {
if (_status === Status.SUCCESS) {
Expand Down Expand Up @@ -69,7 +72,7 @@ const TransferConfirmationScreen = ({
}
}
if (fromWallet?.walletCurrency === "USD") {
if (dollarAmount && 100 * dollarAmount <= usdWalletBalance) {
if (dollarAmount && Math.floor(100 * dollarAmount) <= usdWalletBalance) {
return true
}
}
Expand Down Expand Up @@ -103,7 +106,7 @@ const TransferConfirmationScreen = ({
input: {
walletId: fromWallet?.id,
recipientWalletId: toWallet?.id,
amount: dollarAmount * 100,
amount: Math.floor(dollarAmount * 100),
},
},
})
Expand Down Expand Up @@ -290,6 +293,7 @@ const TransferConfirmationScreen = ({
disabledTitleStyle={styles.disabledButtonTitleStyle}
disabled={!isButtonEnabled()}
onPress={() => payWallet()}
loading={isLoading}
/>
</View>
</View>
Expand Down

0 comments on commit 2f42f64

Please sign in to comment.