Skip to content

Commit

Permalink
Fix brave/brave-ios#8232: Display 0 for send amount for all percentag…
Browse files Browse the repository at this point in the history
…e if selected token balanc… (brave/brave-ios#8234)
  • Loading branch information
nuo-xu authored Oct 12, 2023
1 parent 1ba788c commit d43f1e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/BraveWallet/Crypto/Stores/SendTokenStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public class SendTokenStore: ObservableObject, WalletObserverStore {
decimalPoint = Int(selectedSendToken?.decimals ?? 18)
rounded = false
}
sendAmount = ((selectedSendTokenBalance ?? 0) * amount.rawValue).decimalExpansion(precisionAfterDecimalPoint: decimalPoint, rounded: rounded)
sendAmount = ((selectedSendTokenBalance ?? 0) * amount.rawValue).decimalExpansion(precisionAfterDecimalPoint: decimalPoint, rounded: rounded).trimmingTrailingZeros
}

func didSelect(account: BraveWallet.AccountInfo, token: BraveWallet.BlockchainToken) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/BraveWallet/Crypto/Stores/SwapTokenStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ public class SwapTokenStore: ObservableObject, WalletObserverStore {
rounded = false
}
sellAmount = ((selectedFromTokenBalance ?? 0) * amount.rawValue)
.decimalExpansion(precisionAfterDecimalPoint: decimalPoint, rounded: rounded)
.decimalExpansion(precisionAfterDecimalPoint: decimalPoint, rounded: rounded).trimmingTrailingZeros
}

#if DEBUG
Expand Down

0 comments on commit d43f1e5

Please sign in to comment.