Skip to content

Commit

Permalink
downgrade ios version to 12
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Mar 19, 2023
1 parent f311ada commit 78a4b42
Show file tree
Hide file tree
Showing 12 changed files with 265 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ApiParser/Sources/ApiParser/CodeGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ class CodeGenerator {
var result: String = .init()
if let summary = swiftFunction.summary { result.append("\(tab)/// \(checkComment(summary))\n") }
if let description = swiftFunction.description { result.append("\(tab)/// \(checkComment(description))\n") }
result.append("\(tab)@available(iOS 13, *)\n")
result.append("\(tab)@available(macOS 12, *)\n")
result.append("\(tab)\(swiftFunction.accessType) func \(swiftFunction.name)(")
for parameter in swiftFunction.params {
result.append("_ \(parameter.name): \(parameter.type)")
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let package = Package(
name: "EverscaleClientSwift",
platforms: [
.macOS(SupportedPlatform.MacOSVersion.v12),
.iOS(SupportedPlatform.IOSVersion.v13)
.iOS(SupportedPlatform.IOSVersion.v12)
],
products: [
.library(name: "EverscaleClientSwift", targets: ["EverscaleClientSwift"]),
Expand Down
32 changes: 32 additions & 0 deletions Sources/EverscaleClientSwift/Abi/Abi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public final class TSDKAbiModule {
}

/// Encodes message body according to ABI function call.
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_message_body(_ payload: TSDKParamsOfEncodeMessageBody) async throws -> TSDKResultOfEncodeMessageBody {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -50,6 +52,8 @@ public final class TSDKAbiModule {
}
}

@available(iOS 13, *)
@available(macOS 12, *)
public func attach_signature_to_message_body(_ payload: TSDKParamsOfAttachSignatureToMessageBody) async throws -> TSDKResultOfAttachSignatureToMessageBody {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -115,6 +119,8 @@ public final class TSDKAbiModule {
/// 1. Public key from deploy set.
/// 2. Public key, specified in TVM file.
/// 3. Public key, provided by signer.
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_message(_ payload: TSDKParamsOfEncodeMessage) async throws -> TSDKResultOfEncodeMessage {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -164,6 +170,8 @@ public final class TSDKAbiModule {
/// Public key resolving priority:
/// 1. Public key from deploy set.
/// 2. Public key, specified in TVM file.
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_internal_message(_ payload: TSDKParamsOfEncodeInternalMessage) async throws -> TSDKResultOfEncodeInternalMessage {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -197,6 +205,8 @@ public final class TSDKAbiModule {
}

/// Combines `hex`-encoded `signature` with `base64`-encoded `unsigned_message`. Returns signed message encoded in `base64`.
@available(iOS 13, *)
@available(macOS 12, *)
public func attach_signature(_ payload: TSDKParamsOfAttachSignature) async throws -> TSDKResultOfAttachSignature {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -230,6 +240,8 @@ public final class TSDKAbiModule {
}

/// Decodes message body using provided message BOC and ABI.
@available(iOS 13, *)
@available(macOS 12, *)
public func decode_message(_ payload: TSDKParamsOfDecodeMessage) async throws -> TSDKDecodedMessageBody {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -263,6 +275,8 @@ public final class TSDKAbiModule {
}

/// Decodes message body using provided body BOC and ABI.
@available(iOS 13, *)
@available(macOS 12, *)
public func decode_message_body(_ payload: TSDKParamsOfDecodeMessageBody) async throws -> TSDKDecodedMessageBody {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -300,6 +314,8 @@ public final class TSDKAbiModule {
/// Creates account state BOC
/// Creates account state provided with one of these sets of data :
/// 1. BOC of code, BOC of data, BOC of library2. TVC (string in `base64`), keys, init params
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_account(_ payload: TSDKParamsOfEncodeAccount) async throws -> TSDKResultOfEncodeAccount {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -335,6 +351,8 @@ public final class TSDKAbiModule {

/// Decodes account data using provided data BOC and ABI.
/// Note: this feature requires ABI 2.1 or higher.
@available(iOS 13, *)
@available(macOS 12, *)
public func decode_account_data(_ payload: TSDKParamsOfDecodeAccountData) async throws -> TSDKResultOfDecodeAccountData {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -368,6 +386,8 @@ public final class TSDKAbiModule {
}

/// Updates initial account data with initial values for the contract's static variables and owner's public key. This operation is applicable only for initial account data (before deploy). If the contract is already deployed, its data doesn't contain this data section any more.
@available(iOS 13, *)
@available(macOS 12, *)
public func update_initial_data(_ payload: TSDKParamsOfUpdateInitialData) async throws -> TSDKResultOfUpdateInitialData {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -403,6 +423,8 @@ public final class TSDKAbiModule {

/// Encodes initial account data with initial values for the contract's static variables and owner's public key into a data BOC that can be passed to `encode_tvc` function afterwards.
/// This function is analogue of `tvm.buildDataInit` function in Solidity.
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_initial_data(_ payload: TSDKParamsOfEncodeInitialData) async throws -> TSDKResultOfEncodeInitialData {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -436,6 +458,8 @@ public final class TSDKAbiModule {
}

/// Decodes initial values of a contract's static variables and owner's public key from account initial data This operation is applicable only for initial account data (before deploy). If the contract is already deployed, its data doesn't contain this data section any more.
@available(iOS 13, *)
@available(macOS 12, *)
public func decode_initial_data(_ payload: TSDKParamsOfDecodeInitialData) async throws -> TSDKResultOfDecodeInitialData {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -479,6 +503,8 @@ public final class TSDKAbiModule {
/// ABI has it own rules for fields layout in cells so manually encodedBOC can not be described in terms of ABI rules.
/// To solve this problem we introduce a new ABI type `Ref(<ParamType>)`which allows to store `ParamType` ABI parameter in cell reference and, thus,decode manually encoded BOCs. This type is available only in `decode_boc` functionand will not be available in ABI messages encoding until it is included into some ABI revision.
/// Such BOC descriptions covers most users needs. If someone wants to decode some BOC whichcan not be described by these rules (i.e. BOC with TLB containing constructors of flagsdefining some parsing conditions) then they can decode the fields up to fork condition,check the parsed data manually, expand the parsing schema and then decode the whole BOCwith the full schema.
@available(iOS 13, *)
@available(macOS 12, *)
public func decode_boc(_ payload: TSDKParamsOfDecodeBoc) async throws -> TSDKResultOfDecodeBoc {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -512,6 +538,8 @@ public final class TSDKAbiModule {
}

/// Encodes given parameters in JSON into a BOC using param types from ABI.
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_boc(_ payload: TSDKParamsOfAbiEncodeBoc) async throws -> TSDKResultOfAbiEncodeBoc {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -545,6 +573,8 @@ public final class TSDKAbiModule {
}

/// Calculates contract function ID by contract ABI
@available(iOS 13, *)
@available(macOS 12, *)
public func calc_function_id(_ payload: TSDKParamsOfCalcFunctionId) async throws -> TSDKResultOfCalcFunctionId {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -578,6 +608,8 @@ public final class TSDKAbiModule {
}

/// Extracts signature from message body and calculates hash to verify the signature
@available(iOS 13, *)
@available(macOS 12, *)
public func get_signature_data(_ payload: TSDKParamsOfGetSignatureData) async throws -> TSDKResultOfGetSignatureData {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down
38 changes: 38 additions & 0 deletions Sources/EverscaleClientSwift/Boc/Boc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public final class TSDKBocModule {

/// Parses message boc into a JSON
/// JSON structure is compatible with GraphQL API message object
@available(iOS 13, *)
@available(macOS 12, *)
public func parse_message(_ payload: TSDKParamsOfParse) async throws -> TSDKResultOfParse {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -56,6 +58,8 @@ public final class TSDKBocModule {

/// Parses transaction boc into a JSON
/// JSON structure is compatible with GraphQL API transaction object
@available(iOS 13, *)
@available(macOS 12, *)
public func parse_transaction(_ payload: TSDKParamsOfParse) async throws -> TSDKResultOfParse {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -91,6 +95,8 @@ public final class TSDKBocModule {

/// Parses account boc into a JSON
/// JSON structure is compatible with GraphQL API account object
@available(iOS 13, *)
@available(macOS 12, *)
public func parse_account(_ payload: TSDKParamsOfParse) async throws -> TSDKResultOfParse {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -126,6 +132,8 @@ public final class TSDKBocModule {

/// Parses block boc into a JSON
/// JSON structure is compatible with GraphQL API block object
@available(iOS 13, *)
@available(macOS 12, *)
public func parse_block(_ payload: TSDKParamsOfParse) async throws -> TSDKResultOfParse {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -161,6 +169,8 @@ public final class TSDKBocModule {

/// Parses shardstate boc into a JSON
/// JSON structure is compatible with GraphQL API shardstate object
@available(iOS 13, *)
@available(macOS 12, *)
public func parse_shardstate(_ payload: TSDKParamsOfParseShardstate) async throws -> TSDKResultOfParse {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -194,6 +204,8 @@ public final class TSDKBocModule {
}

/// Extract blockchain configuration from key block and also from zerostate.
@available(iOS 13, *)
@available(macOS 12, *)
public func get_blockchain_config(_ payload: TSDKParamsOfGetBlockchainConfig) async throws -> TSDKResultOfGetBlockchainConfig {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -227,6 +239,8 @@ public final class TSDKBocModule {
}

/// Calculates BOC root hash
@available(iOS 13, *)
@available(macOS 12, *)
public func get_boc_hash(_ payload: TSDKParamsOfGetBocHash) async throws -> TSDKResultOfGetBocHash {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -260,6 +274,8 @@ public final class TSDKBocModule {
}

/// Calculates BOC depth
@available(iOS 13, *)
@available(macOS 12, *)
public func get_boc_depth(_ payload: TSDKParamsOfGetBocDepth) async throws -> TSDKResultOfGetBocDepth {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -293,6 +309,8 @@ public final class TSDKBocModule {
}

/// Extracts code from TVC contract image
@available(iOS 13, *)
@available(macOS 12, *)
public func get_code_from_tvc(_ payload: TSDKParamsOfGetCodeFromTvc) async throws -> TSDKResultOfGetCodeFromTvc {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -326,6 +344,8 @@ public final class TSDKBocModule {
}

/// Get BOC from cache
@available(iOS 13, *)
@available(macOS 12, *)
public func cache_get(_ payload: TSDKParamsOfBocCacheGet) async throws -> TSDKResultOfBocCacheGet {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -359,6 +379,8 @@ public final class TSDKBocModule {
}

/// Save BOC into cache or increase pin counter for existing pinned BOC
@available(iOS 13, *)
@available(macOS 12, *)
public func cache_set(_ payload: TSDKParamsOfBocCacheSet) async throws -> TSDKResultOfBocCacheSet {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -392,6 +414,8 @@ public final class TSDKBocModule {
}

/// Unpin BOCs with specified pin defined in the `cache_set`. Decrease pin reference counter for BOCs with specified pin defined in the `cache_set`. BOCs which have only 1 pin and its reference counter become 0 will be removed from cache
@available(iOS 13, *)
@available(macOS 12, *)
public func cache_unpin(_ payload: TSDKParamsOfBocCacheUnpin) async throws -> TSDKNoneResult {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -425,6 +449,8 @@ public final class TSDKBocModule {
}

/// Encodes bag of cells (BOC) with builder operations. This method provides the same functionality as Solidity TvmBuilder. Resulting BOC of this method can be passed into Solidity and C++ contracts as TvmCell type.
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_boc(_ payload: TSDKParamsOfEncodeBoc) async throws -> TSDKResultOfEncodeBoc {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -458,6 +484,8 @@ public final class TSDKBocModule {
}

/// Returns the contract code's salt if it is present.
@available(iOS 13, *)
@available(macOS 12, *)
public func get_code_salt(_ payload: TSDKParamsOfGetCodeSalt) async throws -> TSDKResultOfGetCodeSalt {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -493,6 +521,8 @@ public final class TSDKBocModule {

/// Sets new salt to contract code.
/// Returns the new contract code with salt.
@available(iOS 13, *)
@available(macOS 12, *)
public func set_code_salt(_ payload: TSDKParamsOfSetCodeSalt) async throws -> TSDKResultOfSetCodeSalt {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -526,6 +556,8 @@ public final class TSDKBocModule {
}

/// Decodes tvc into code, data, libraries and special options.
@available(iOS 13, *)
@available(macOS 12, *)
public func decode_tvc(_ payload: TSDKParamsOfDecodeTvc) async throws -> TSDKResultOfDecodeTvc {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -559,6 +591,8 @@ public final class TSDKBocModule {
}

/// Encodes tvc from code, data, libraries ans special options (see input params)
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_tvc(_ payload: TSDKParamsOfEncodeTvc) async throws -> TSDKResultOfEncodeTvc {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -594,6 +628,8 @@ public final class TSDKBocModule {

/// Encodes a message
/// Allows to encode any external inbound message.
@available(iOS 13, *)
@available(macOS 12, *)
public func encode_external_in_message(_ payload: TSDKParamsOfEncodeExternalInMessage) async throws -> TSDKResultOfEncodeExternalInMessage {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -627,6 +663,8 @@ public final class TSDKBocModule {
}

/// Returns the compiler version used to compile the code.
@available(iOS 13, *)
@available(macOS 12, *)
public func get_compiler_version(_ payload: TSDKParamsOfGetCompilerVersion) async throws -> TSDKResultOfGetCompilerVersion {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down
10 changes: 10 additions & 0 deletions Sources/EverscaleClientSwift/Client/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public final class TSDKClientModule {
}

/// Returns Core Library API reference
@available(iOS 13, *)
@available(macOS 12, *)
public func get_api_reference() async throws -> TSDKResultOfGetApiReference {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -72,6 +74,8 @@ public final class TSDKClientModule {
}

/// Returns Core Library version
@available(iOS 13, *)
@available(macOS 12, *)
public func version() async throws -> TSDKResultOfVersion {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -105,6 +109,8 @@ public final class TSDKClientModule {
}

/// Returns Core Library API reference
@available(iOS 13, *)
@available(macOS 12, *)
public func config() async throws -> TSDKClientConfig {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -138,6 +144,8 @@ public final class TSDKClientModule {
}

/// Returns detailed information about this build.
@available(iOS 13, *)
@available(macOS 12, *)
public func build_info() async throws -> TSDKResultOfBuildInfo {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down Expand Up @@ -171,6 +179,8 @@ public final class TSDKClientModule {
}

/// Resolves application request processing result
@available(iOS 13, *)
@available(macOS 12, *)
public func resolve_app_request(_ payload: TSDKParamsOfResolveAppRequest) async throws -> TSDKNoneResult {
try await withCheckedThrowingContinuation { continuation in
do {
Expand Down
Loading

0 comments on commit 78a4b42

Please sign in to comment.