spb/os-vault Public
Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.
Swift 96%
Shell 3.4%
Makefile 0.6%
1import Foundation23public struct FeeAmount: Equatable, Hashable {4 public struct OtherFee: Equatable, Hashable {5 public init(amount: Double, unit: String) {6 self.amount = amount7 self.unit = unit8 }910 public var amount: Double11 public var unit: String12 }1314 public init(transaction: UInt64, accountBalances: UInt64, deposit: UInt64 = 0, others: [OtherFee]? = nil) {15 self.transaction = transaction16 self.accountBalances = accountBalances17 self.others = others18 self.deposit = deposit19 }2021 public var transaction: UInt6422 public var accountBalances: UInt6423 public var deposit: UInt6424 public var others: [OtherFee]?25 public var total: UInt64 {26 transaction + accountBalances + deposit27 }2829 public static var zero: Self {30 .init(transaction: 0, accountBalances: 0)31 }32}3334public extension FeeAmount {35 static func + (lhs: FeeAmount, rhs: FeeAmount) -> FeeAmount {36 return .init(37 transaction: lhs.transaction + rhs.transaction,38 accountBalances: lhs.accountBalances + rhs.accountBalances,39 deposit: lhs.deposit + rhs.deposit,40 others: lhs.others == nil && rhs.others == nil ? nil : ((lhs.others ?? []) + (rhs.others ?? []))41 )42 }43}44