mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 15:04:50 +01:00
27 lines
796 B
Swift
27 lines
796 B
Swift
//
|
|
// WalletData.swift
|
|
// BlueWallet
|
|
//
|
|
// Created by Marcos Rodriguez on 4/14/24.
|
|
// Copyright © 2024 BlueWallet. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
struct WalletData {
|
|
var balance: Double
|
|
var latestTransactionTime: LatestTransaction = LatestTransaction(isUnconfirmed: false, epochValue: 0)
|
|
var formattedBalanceBTC: String {
|
|
let formatter = NumberFormatter()
|
|
formatter.numberStyle = .none
|
|
formatter.usesSignificantDigits = true
|
|
formatter.maximumSignificantDigits = 9
|
|
formatter.roundingMode = .up
|
|
let value = NSNumber(value: balance / 100000000);
|
|
if let valueString = formatter.string(from: value) {
|
|
return "\(String(describing: valueString)) \(BitcoinUnit.BTC.rawValue)"
|
|
} else {
|
|
return "0 \(BitcoinUnit.BTC.rawValue)"
|
|
}
|
|
}
|
|
}
|