Skip to content

Commit

Permalink
MOB-333 Withdrawal error message "insufficient balance" but it seems …
Browse files Browse the repository at this point in the history
…like there is sufficient balance based on values displayed (#115)
  • Loading branch information
ruixhuang authored Mar 14, 2024
1 parent a41c334 commit a905e1b
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,30 +230,30 @@ class dydxTransferInputCtaButtonViewPresenter: HostedViewPresenter<dydxTradeInpu
let amount = transferInput.size?.usdcSize, (self.parser.asDecimal(amount)?.doubleValue ?? 0) > 0.0 else {
return
}
let gasFee = transferInput.summary?.gasFee?.doubleValue ?? 0
let usdcBalanceInWallet = usdcBalanceInWallet ?? 0
if usdcBalanceInWallet >= gasFee {
if transferInput.isCctp {
AbacusStateManager.shared.commitCCTPWithdraw { [weak self] success, error, result in
if success {
self?.postTransaction(result: result, transferInput: transferInput)
} else {
ErrorInfo.shared?.info(title: DataLocalizer.localize(path: "APP.GENERAL.ERROR"),
message: error?.localizedDescription,
type: .error,
error: nil, time: nil)
}
self?.viewModel?.ctaButtonState = .enabled(DataLocalizer.localize(path: "APP.GENERAL.CONFIRM_WITHDRAW"))
if transferInput.isCctp {
AbacusStateManager.shared.commitCCTPWithdraw { [weak self] success, error, result in
if success {
self?.postTransaction(result: result, transferInput: transferInput)
} else {
ErrorInfo.shared?.info(title: DataLocalizer.localize(path: "APP.GENERAL.ERROR"),
message: error?.localizedDescription,
type: .error,
error: nil, time: nil)
}
} else {
self?.viewModel?.ctaButtonState = .enabled(DataLocalizer.localize(path: "APP.GENERAL.CONFIRM_WITHDRAW"))
}
} else {
let gasFee = transferInput.summary?.gasFee?.doubleValue ?? 0
let usdcBalanceInWallet = usdcBalanceInWallet ?? 0
if usdcBalanceInWallet >= gasFee {
CosmoJavascript.shared.withdrawToIBC(subaccount: Int(selectedSubaccount.subaccountNumber), amount: amount, payload: data) { [weak self] result in
self?.postTransaction(result: result, transferInput: transferInput)
self?.viewModel?.ctaButtonState = .enabled(DataLocalizer.localize(path: "APP.GENERAL.CONFIRM_WITHDRAW"))
}
} else {
self.showNoGas()
self.viewModel?.ctaButtonState = .enabled(DataLocalizer.localize(path: "APP.GENERAL.CONFIRM_WITHDRAW"))
}
} else {
self.showNoGas()
self.viewModel?.ctaButtonState = .enabled(DataLocalizer.localize(path: "APP.GENERAL.CONFIRM_WITHDRAW"))
}
}
}
Expand Down

0 comments on commit a905e1b

Please sign in to comment.