diff --git a/Package.swift b/Package.swift index 4b517e3..1688621 100644 --- a/Package.swift +++ b/Package.swift @@ -19,7 +19,7 @@ let package = Package( .target( name: "Flow", dependencies: ["BigInt"], - path: "Sources/Flow" + path: "Sources" ), .testTarget( name: "FlowTests", diff --git a/Sources/Flow/Build/TransactionBuild.swift b/Sources/Build/TransactionBuild.swift similarity index 100% rename from Sources/Flow/Build/TransactionBuild.swift rename to Sources/Build/TransactionBuild.swift diff --git a/Sources/Flow/Cadence/CommonCadence.swift b/Sources/Cadence/CommonCadence.swift similarity index 100% rename from Sources/Flow/Cadence/CommonCadence.swift rename to Sources/Cadence/CommonCadence.swift diff --git a/Sources/Flow/Decode/FlowArgument+Decode.swift b/Sources/Decode/FlowArgument+Decode.swift similarity index 100% rename from Sources/Flow/Decode/FlowArgument+Decode.swift rename to Sources/Decode/FlowArgument+Decode.swift diff --git a/Sources/Flow/Error/FlowError.swift b/Sources/Error/FlowError.swift similarity index 100% rename from Sources/Flow/Error/FlowError.swift rename to Sources/Error/FlowError.swift diff --git a/Sources/Flow/Extension/Array.swift b/Sources/Extension/Array.swift similarity index 100% rename from Sources/Flow/Extension/Array.swift rename to Sources/Extension/Array.swift diff --git a/Sources/Flow/Extension/Data.swift b/Sources/Extension/Data.swift similarity index 100% rename from Sources/Flow/Extension/Data.swift rename to Sources/Extension/Data.swift diff --git a/Sources/Flow/Extension/Double.swift b/Sources/Extension/Double.swift similarity index 68% rename from Sources/Flow/Extension/Double.swift rename to Sources/Extension/Double.swift index f49580e..5273526 100644 --- a/Sources/Flow/Extension/Double.swift +++ b/Sources/Extension/Double.swift @@ -24,3 +24,13 @@ extension Double { return (self * multiplier).rounded() / multiplier } } + +extension Decimal { + func tokenFormat(maximumFractionDigits: Int = 8) -> String { + let formatter = NumberFormatter() + formatter.maximumFractionDigits = maximumFractionDigits + formatter.minimumFractionDigits = 0 + formatter.numberStyle = .decimal + return formatter.string(for: self) ?? String(NSDecimalNumber(decimal: self).doubleValue) + } +} diff --git a/Sources/Flow/Extension/Publisher+Async.swift b/Sources/Extension/Publisher+Async.swift similarity index 100% rename from Sources/Flow/Extension/Publisher+Async.swift rename to Sources/Extension/Publisher+Async.swift diff --git a/Sources/Flow/Extension/String.swift b/Sources/Extension/String.swift similarity index 100% rename from Sources/Flow/Extension/String.swift rename to Sources/Extension/String.swift diff --git a/Sources/Flow/Extension/URLSession+Async.swift b/Sources/Extension/URLSession+Async.swift similarity index 100% rename from Sources/Flow/Extension/URLSession+Async.swift rename to Sources/Extension/URLSession+Async.swift diff --git a/Sources/Flow/Flow.swift b/Sources/Flow.swift similarity index 100% rename from Sources/Flow/Flow.swift rename to Sources/Flow.swift diff --git a/Sources/Flow/Models/FlowAccount.swift b/Sources/Models/FlowAccount.swift similarity index 100% rename from Sources/Flow/Models/FlowAccount.swift rename to Sources/Models/FlowAccount.swift diff --git a/Sources/Flow/Models/FlowAddress.swift b/Sources/Models/FlowAddress.swift similarity index 100% rename from Sources/Flow/Models/FlowAddress.swift rename to Sources/Models/FlowAddress.swift diff --git a/Sources/Flow/Models/FlowAlgorithm.swift b/Sources/Models/FlowAlgorithm.swift similarity index 100% rename from Sources/Flow/Models/FlowAlgorithm.swift rename to Sources/Models/FlowAlgorithm.swift diff --git a/Sources/Flow/Models/FlowArgument.swift b/Sources/Models/FlowArgument.swift similarity index 100% rename from Sources/Flow/Models/FlowArgument.swift rename to Sources/Models/FlowArgument.swift diff --git a/Sources/Flow/Models/FlowBlock.swift b/Sources/Models/FlowBlock.swift similarity index 100% rename from Sources/Flow/Models/FlowBlock.swift rename to Sources/Models/FlowBlock.swift diff --git a/Sources/Flow/Models/FlowCadence.swift b/Sources/Models/FlowCadence.swift similarity index 100% rename from Sources/Flow/Models/FlowCadence.swift rename to Sources/Models/FlowCadence.swift diff --git a/Sources/Flow/Models/FlowChainId.swift b/Sources/Models/FlowChainId.swift similarity index 100% rename from Sources/Flow/Models/FlowChainId.swift rename to Sources/Models/FlowChainId.swift diff --git a/Sources/Flow/Models/FlowCollection.swift b/Sources/Models/FlowCollection.swift similarity index 100% rename from Sources/Flow/Models/FlowCollection.swift rename to Sources/Models/FlowCollection.swift diff --git a/Sources/Flow/Models/FlowDomainTag.swift b/Sources/Models/FlowDomainTag.swift similarity index 100% rename from Sources/Flow/Models/FlowDomainTag.swift rename to Sources/Models/FlowDomainTag.swift diff --git a/Sources/Flow/Models/FlowEntity.swift b/Sources/Models/FlowEntity.swift similarity index 100% rename from Sources/Flow/Models/FlowEntity.swift rename to Sources/Models/FlowEntity.swift diff --git a/Sources/Flow/Models/FlowEvent.swift b/Sources/Models/FlowEvent.swift similarity index 100% rename from Sources/Flow/Models/FlowEvent.swift rename to Sources/Models/FlowEvent.swift diff --git a/Sources/Flow/Models/FlowId.swift b/Sources/Models/FlowId.swift similarity index 100% rename from Sources/Flow/Models/FlowId.swift rename to Sources/Models/FlowId.swift diff --git a/Sources/Flow/Models/FlowKind.swift b/Sources/Models/FlowKind.swift similarity index 100% rename from Sources/Flow/Models/FlowKind.swift rename to Sources/Models/FlowKind.swift diff --git a/Sources/Flow/Models/FlowScript.swift b/Sources/Models/FlowScript.swift similarity index 100% rename from Sources/Flow/Models/FlowScript.swift rename to Sources/Models/FlowScript.swift diff --git a/Sources/Flow/Models/FlowSignature.swift b/Sources/Models/FlowSignature.swift similarity index 100% rename from Sources/Flow/Models/FlowSignature.swift rename to Sources/Models/FlowSignature.swift diff --git a/Sources/Flow/Models/FlowSigner.swift b/Sources/Models/FlowSigner.swift similarity index 100% rename from Sources/Flow/Models/FlowSigner.swift rename to Sources/Models/FlowSigner.swift diff --git a/Sources/Flow/Models/FlowTransaction+Codable.swift b/Sources/Models/FlowTransaction+Codable.swift similarity index 100% rename from Sources/Flow/Models/FlowTransaction+Codable.swift rename to Sources/Models/FlowTransaction+Codable.swift diff --git a/Sources/Flow/Models/FlowTransaction+Signer.swift b/Sources/Models/FlowTransaction+Signer.swift similarity index 100% rename from Sources/Flow/Models/FlowTransaction+Signer.swift rename to Sources/Models/FlowTransaction+Signer.swift diff --git a/Sources/Flow/Models/FlowTransaction.swift b/Sources/Models/FlowTransaction.swift similarity index 100% rename from Sources/Flow/Models/FlowTransaction.swift rename to Sources/Models/FlowTransaction.swift diff --git a/Sources/Flow/Models/Signer.swift b/Sources/Models/Signer.swift similarity index 100% rename from Sources/Flow/Models/Signer.swift rename to Sources/Models/Signer.swift diff --git a/Sources/Flow/Network/FlowAccess.swift b/Sources/Network/FlowAccess.swift similarity index 100% rename from Sources/Flow/Network/FlowAccess.swift rename to Sources/Network/FlowAccess.swift diff --git a/Sources/Flow/Network/FlowAccessProtocol.swift b/Sources/Network/FlowAccessProtocol.swift similarity index 100% rename from Sources/Flow/Network/FlowAccessProtocol.swift rename to Sources/Network/FlowAccessProtocol.swift diff --git a/Sources/Flow/Network/FlowTransport.swift b/Sources/Network/FlowTransport.swift similarity index 100% rename from Sources/Flow/Network/FlowTransport.swift rename to Sources/Network/FlowTransport.swift diff --git a/Sources/Flow/Network/HTTP/AccessEndpoint.swift b/Sources/Network/HTTP/AccessEndpoint.swift similarity index 100% rename from Sources/Flow/Network/HTTP/AccessEndpoint.swift rename to Sources/Network/HTTP/AccessEndpoint.swift diff --git a/Sources/Flow/Network/HTTP/FlowHTTPClient.swift b/Sources/Network/HTTP/FlowHTTPClient.swift similarity index 100% rename from Sources/Flow/Network/HTTP/FlowHTTPClient.swift rename to Sources/Network/HTTP/FlowHTTPClient.swift diff --git a/Sources/Flow/Network/HTTP/FlowHTTPModel.swift b/Sources/Network/HTTP/FlowHTTPModel.swift similarity index 100% rename from Sources/Flow/Network/HTTP/FlowHTTPModel.swift rename to Sources/Network/HTTP/FlowHTTPModel.swift diff --git a/Sources/Flow/Network/HTTP/Target.swift b/Sources/Network/HTTP/Target.swift similarity index 100% rename from Sources/Flow/Network/HTTP/Target.swift rename to Sources/Network/HTTP/Target.swift diff --git a/Sources/Flow/RLP/RLP.swift b/Sources/RLP/RLP.swift similarity index 100% rename from Sources/Flow/RLP/RLP.swift rename to Sources/RLP/RLP.swift