From f8aaa95f95b92c3f42cf289aea41b17372fa10bb Mon Sep 17 00:00:00 2001 From: Fernando Fernandes Date: Thu, 4 Jan 2024 07:38:04 +0100 Subject: [PATCH] [BinanceAuth] Code reorg --- .../Binance/{ => BinanceAuth}/BinanceAuth.swift | 15 +-------------- .../Binance/BinanceAuth/BinanceAuthorizing.swift | 13 +++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) rename Sources/SwiftTrader/Model/Binance/{ => BinanceAuth}/BinanceAuth.swift (63%) create mode 100644 Sources/SwiftTrader/Model/Binance/BinanceAuth/BinanceAuthorizing.swift diff --git a/Sources/SwiftTrader/Model/Binance/BinanceAuth.swift b/Sources/SwiftTrader/Model/Binance/BinanceAuth/BinanceAuth.swift similarity index 63% rename from Sources/SwiftTrader/Model/Binance/BinanceAuth.swift rename to Sources/SwiftTrader/Model/Binance/BinanceAuth/BinanceAuth.swift index 9dde3f0..0805237 100644 --- a/Sources/SwiftTrader/Model/Binance/BinanceAuth.swift +++ b/Sources/SwiftTrader/Model/Binance/BinanceAuth/BinanceAuth.swift @@ -7,11 +7,6 @@ import Foundation -public protocol BinanceAuthorizing { - var apiKey: String { get } - var apiSecret: String { get } -} - /// Holds data required to authenticate requests against Binance APIs. public struct BinanceAuth { @@ -24,7 +19,7 @@ public struct BinanceAuth { public extension BinanceAuth { - struct Spot: BinanceAuthorizing { + struct Spot: BinanceAuthorizing, Codable { public let apiKey: String public let apiSecret: String @@ -34,11 +29,3 @@ public extension BinanceAuth { } } } - -// MARK: - Equatable - -extension BinanceAuth: Equatable { - public static func == (lhs: BinanceAuth, rhs: BinanceAuth) -> Bool { - lhs.spot.apiKey == rhs.spot.apiKey - } -} diff --git a/Sources/SwiftTrader/Model/Binance/BinanceAuth/BinanceAuthorizing.swift b/Sources/SwiftTrader/Model/Binance/BinanceAuth/BinanceAuthorizing.swift new file mode 100644 index 0000000..34b997a --- /dev/null +++ b/Sources/SwiftTrader/Model/Binance/BinanceAuth/BinanceAuthorizing.swift @@ -0,0 +1,13 @@ +// +// BinanceAuthorizing.swift +// +// +// Created by Fernando Fernandes on 03.01.24. +// + +import Foundation + +public protocol BinanceAuthorizing: Codable { + var apiKey: String { get } + var apiSecret: String { get } +}