From 295076ad5e3acadb8de8b5b61819522df6912e33 Mon Sep 17 00:00:00 2001 From: nerzh Date: Sun, 2 Mar 2025 16:33:19 +0100 Subject: [PATCH] up to 6.0 --- ApiParser/Package.swift | 17 +- .../Sources/ApiParser/CodeGenerator.swift | 37 +--- ApiParser/Sources/ApiParser/Settings.swift | 8 +- Package.swift | 2 +- README.md | 2 +- Sources/EverscaleClientSwift/Abi/Abi.swift | 44 ++--- .../EverscaleClientSwift/Abi/AbiTypes.swift | 173 ++++++----------- .../Binding/BindingStore.swift | 10 +- .../Binding/BindingTypes.swift | 4 +- Sources/EverscaleClientSwift/Boc/Boc.swift | 44 ++--- .../EverscaleClientSwift/Boc/BocTypes.swift | 72 +++---- .../EverscaleClientSwift/Client/Client.swift | 10 +- .../Client/ClientTypes.swift | 30 +-- .../EverscaleClientSwift/Crypto/Crypto.swift | 102 +++++----- .../Crypto/CryptoTypes.swift | 182 +++++++++--------- .../EverscaleClientSwift/Debot/Debot.swift | 12 +- .../Debot/DebotTypes.swift | 28 +-- .../Extensions/SimpleEnv.swift | 5 +- Sources/EverscaleClientSwift/Net/Net.swift | 46 ++--- .../EverscaleClientSwift/Net/NetTypes.swift | 66 +++---- .../Processing/Processing.swift | 16 +- .../Processing/ProcessingTypes.swift | 42 ++-- .../EverscaleClientSwift/Proofs/Proofs.swift | 6 +- .../Proofs/ProofsTypes.swift | 6 +- Sources/EverscaleClientSwift/Tvm/Tvm.swift | 6 +- .../EverscaleClientSwift/Tvm/TvmTypes.swift | 18 +- .../EverscaleClientSwift/Utils/Utils.swift | 10 +- .../Utils/UtilsTypes.swift | 22 +-- api_generate.sh | 2 +- 29 files changed, 466 insertions(+), 556 deletions(-) diff --git a/ApiParser/Package.swift b/ApiParser/Package.swift index 0e50c49..4b6c849 100644 --- a/ApiParser/Package.swift +++ b/ApiParser/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.4 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -6,26 +6,23 @@ import PackageDescription let package = Package( name: "ApiParser", platforms: [ - .macOS(SupportedPlatform.MacOSVersion.v10_12) + .macOS(SupportedPlatform.MacOSVersion.v10_13) ], products: [ .executable(name: "ApiParser", targets: ["ApiParser"]) ], dependencies: [ - .package(name: "SwiftRegularExpression", url: "https://github.com/nerzh/swift-regular-expression.git", .upToNextMajor(from: "0.2.4")), - .package(name: "swift-argument-parser", url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.4.3")), - .package(name: "FileUtils", url: "https://github.com/nerzh/SwiftFileUtils", .upToNextMinor(from: "1.3.0")), + .package(url: "https://github.com/nerzh/swift-regular-expression.git", .upToNextMajor(from: "0.2.4")), + .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.4.3")), + .package(url: "https://github.com/nerzh/SwiftFileUtils", .upToNextMinor(from: "1.3.0")), ], targets: [ .executableTarget( name: "ApiParser", dependencies: [ - .product(name: "SwiftRegularExpression", package: "SwiftRegularExpression"), + .product(name: "SwiftRegularExpression", package: "swift-regular-expression"), .product(name: "ArgumentParser", package: "swift-argument-parser"), - .product(name: "FileUtils", package: "FileUtils"), + .product(name: "FileUtils", package: "SwiftFileUtils"), ]), - ], - swiftLanguageVersions: [ - SwiftVersion.v5 ] ) diff --git a/ApiParser/Sources/ApiParser/CodeGenerator.swift b/ApiParser/Sources/ApiParser/CodeGenerator.swift index ac44feb..cb8acd4 100644 --- a/ApiParser/Sources/ApiParser/CodeGenerator.swift +++ b/ApiParser/Sources/ApiParser/CodeGenerator.swift @@ -92,7 +92,7 @@ class CodeGenerator { } - var result: String = "\(swiftStruct.accessType) struct \(swiftStruct.name): \(swiftStruct.parents.joined(separator: ", ")) {\n" + var result: String = "\(swiftStruct.accessType) struct \(swiftStruct.name): \(swiftStruct.parents.joined(separator: ", ")), @unchecked Sendable {\n" for property in swiftStruct.properties { if let summary: String = property.summary { result.append("\(tab)/// \(checkComment(summary))\n") } if let descr: String = property.description { result.append("\(tab)/// \(checkComment(descr))\n") } @@ -119,16 +119,6 @@ class CodeGenerator { return result } -// public func decode_message_body(_ payload: TSDKParamsOfDecodeMessageBody, -// _ handler: @escaping (TSDKBindingResponse) throws -> Void -// ) throws { -// let method: String = "decode_message_body" -// try binding.requestLibraryAsync(methodName(module, method), payload, { (requestId, params, responseType, finished) in -// var response: TSDKBindingResponse = .init() -// response.update(requestId, params, responseType, finished) -// try handler(response) -// }) -// } private func generateFunction(_ swiftFunction: SDKSwiftFunction) -> String { var result: String = .init() if let summary = swiftFunction.summary { result.append("\(tab)/// \(checkComment(summary))\n") } @@ -138,7 +128,7 @@ class CodeGenerator { result.append("_ \(parameter.name): \(parameter.type), ") } let resultType: String = swiftFunction.willReturn.type == "Void" ? "\(libPrefix)NoneResult" : swiftFunction.willReturn.type - result.append("_ handler: @escaping (TSDKBindingResponse<\(resultType), \(libPrefix)ClientError>) throws -> Void\n\(tab)) throws {\n") + result.append("_ handler: @escaping @Sendable (TSDKBindingResponse<\(resultType), \(libPrefix)ClientError>) throws -> Void\n\(tab)) throws {\n") let methodName: String = swiftFunction.name == "initialize" ? "init" : swiftFunction.name result.append("\(tab)\(tab)let method: String = \"\(methodName)\"\n") if swiftFunction.params.isEmpty { @@ -155,27 +145,6 @@ class CodeGenerator { return result } -// public func get_endpoints() async throws -> TSDKResultOfGetEndpoints { -// try await withCheckedThrowingContinuation { continuation in -// do { -// let method: String = "get_endpoints" -// try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in -// var response: TSDKBindingResponse = .init() -// response.update(requestId, params, responseType, finished) -// if let error = response.error { -// continuation.resume(throwing: error) -// } else if let result = response.result { -// continuation.resume(returning: result) -// } else { -// continuation.resume(throwing: TSDKClientError("Nothing for return")) -// } -// } -// } catch { -// continuation.resume(throwing: error) -// } -// } -// } - private func generateAsyncAwaitFunction(_ swiftFunction: SDKSwiftFunction) -> String { var result: String = .init() if let summary = swiftFunction.summary { result.append("\(tab)/// \(checkComment(summary))\n") } @@ -296,7 +265,7 @@ extension CodeGenerator { var swiftStruct = swiftStruct swiftStruct.parents.append("LocalizedError") - var result: String = "\(swiftStruct.accessType) struct \(swiftStruct.name): \(swiftStruct.parents.joined(separator: ", ")) {\n" + var result: String = "\(swiftStruct.accessType) struct \(swiftStruct.name): \(swiftStruct.parents.joined(separator: ", ")), @unchecked Sendable {\n" for property in swiftStruct.properties { if let summary: String = property.summary { result.append("\(tab)/// \(checkComment(summary))\n") } if let descr: String = property.description { result.append("\(tab)/// \(checkComment(descr))\n") } diff --git a/ApiParser/Sources/ApiParser/Settings.swift b/ApiParser/Sources/ApiParser/Settings.swift index 8bdc59f..c06de10 100644 --- a/ApiParser/Sources/ApiParser/Settings.swift +++ b/ApiParser/Sources/ApiParser/Settings.swift @@ -7,7 +7,7 @@ import Foundation -var libPrefix: String = "TSDK" -var libEnumPostfix: String = "EnumTypes" -var defaultEnumParents: [String] = ["String", "Codable"] -var defaultStructTypeParents: [String] = ["Codable"] +let libPrefix: String = "TSDK" +let libEnumPostfix: String = "EnumTypes" +let defaultEnumParents: [String] = ["String", "Codable"] +let defaultStructTypeParents: [String] = ["Codable"] diff --git a/Package.swift b/Package.swift index 4809651..f04c1da 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.8 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/README.md b/README.md index 1e2ead6..b92cbd7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ---> [![SPM](https://img.shields.io/badge/swift-package%20manager-green)](https://swift.org/package-manager/) -[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.44.2-orange)](https://github.com/tonlabs/ever-sdk) +[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.49.2-orange)](https://github.com/tonlabs/ever-sdk) Swift is a strongly typed language that has long been used not only for iOS development. Apple is actively promoting it to new platforms and today it can be used for almost any task. Thanks to this, this implementation provides the work of TVM (toncoin, everscale, venom, gosh) SDK on many platforms at once, including the native one for mobile phones. Let me remind you that swift can also be built for android. diff --git a/Sources/EverscaleClientSwift/Abi/Abi.swift b/Sources/EverscaleClientSwift/Abi/Abi.swift index d8d3f6c..795df59 100644 --- a/Sources/EverscaleClientSwift/Abi/Abi.swift +++ b/Sources/EverscaleClientSwift/Abi/Abi.swift @@ -8,7 +8,7 @@ public final class TSDKAbiModule { } /// Encodes message body according to ABI function call. - public func encode_message_body(_ payload: TSDKParamsOfEncodeMessageBody, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_message_body(_ payload: TSDKParamsOfEncodeMessageBody, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_message_body" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -42,7 +42,7 @@ public final class TSDKAbiModule { } } - public func attach_signature_to_message_body(_ payload: TSDKParamsOfAttachSignatureToMessageBody, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func attach_signature_to_message_body(_ payload: TSDKParamsOfAttachSignatureToMessageBody, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "attach_signature_to_message_body" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -92,7 +92,7 @@ public final class TSDKAbiModule { /// 1. Public key from deploy set. /// 2. Public key, specified in TVM file. /// 3. Public key, provided by signer. - public func encode_message(_ payload: TSDKParamsOfEncodeMessage, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_message(_ payload: TSDKParamsOfEncodeMessage, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_message" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -151,7 +151,7 @@ public final class TSDKAbiModule { /// Public key resolving priority: /// 1. Public key from deploy set. /// 2. Public key, specified in TVM file. - public func encode_internal_message(_ payload: TSDKParamsOfEncodeInternalMessage, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_internal_message(_ payload: TSDKParamsOfEncodeInternalMessage, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_internal_message" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -194,7 +194,7 @@ public final class TSDKAbiModule { } /// Combines `hex`-encoded `signature` with `base64`-encoded `unsigned_message`. Returns signed message encoded in `base64`. - public func attach_signature(_ payload: TSDKParamsOfAttachSignature, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func attach_signature(_ payload: TSDKParamsOfAttachSignature, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "attach_signature" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -229,7 +229,7 @@ public final class TSDKAbiModule { } /// Decodes message body using provided message BOC and ABI. - public func decode_message(_ payload: TSDKParamsOfDecodeMessage, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func decode_message(_ payload: TSDKParamsOfDecodeMessage, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "decode_message" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -264,7 +264,7 @@ public final class TSDKAbiModule { } /// Decodes message body using provided body BOC and ABI. - public func decode_message_body(_ payload: TSDKParamsOfDecodeMessageBody, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func decode_message_body(_ payload: TSDKParamsOfDecodeMessageBody, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "decode_message_body" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -299,9 +299,7 @@ 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 - public func encode_account(_ payload: TSDKParamsOfEncodeAccount, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_account(_ payload: TSDKParamsOfEncodeAccount, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_account" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -312,8 +310,6 @@ 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 { @@ -339,7 +335,7 @@ public final class TSDKAbiModule { /// Decodes account data using provided data BOC and ABI. /// Note: this feature requires ABI 2.1 or higher. - public func decode_account_data(_ payload: TSDKParamsOfDecodeAccountData, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func decode_account_data(_ payload: TSDKParamsOfDecodeAccountData, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "decode_account_data" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -375,7 +371,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. - public func update_initial_data(_ payload: TSDKParamsOfUpdateInitialData, _ handler: @escaping (TSDKBindingResponse) throws -> Void + /// Doesn't support ABI version >= 2.4. Use `encode_initial_data` instead + public func update_initial_data(_ payload: TSDKParamsOfUpdateInitialData, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "update_initial_data" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -386,6 +383,7 @@ 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. + /// Doesn't support ABI version >= 2.4. Use `encode_initial_data` instead @available(iOS 13, *) @available(macOS 12, *) public func update_initial_data(_ payload: TSDKParamsOfUpdateInitialData) async throws -> TSDKResultOfUpdateInitialData { @@ -411,7 +409,7 @@ 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. - public func encode_initial_data(_ payload: TSDKParamsOfEncodeInitialData, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_initial_data(_ payload: TSDKParamsOfEncodeInitialData, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_initial_data" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -447,7 +445,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. - public func decode_initial_data(_ payload: TSDKParamsOfDecodeInitialData, _ handler: @escaping (TSDKBindingResponse) throws -> Void + /// Doesn't support ABI version >= 2.4. Use `decode_account_data` instead + public func decode_initial_data(_ payload: TSDKParamsOfDecodeInitialData, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "decode_initial_data" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -458,6 +457,7 @@ 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. + /// Doesn't support ABI version >= 2.4. Use `decode_account_data` instead @available(iOS 13, *) @available(macOS 12, *) public func decode_initial_data(_ payload: TSDKParamsOfDecodeInitialData) async throws -> TSDKResultOfDecodeInitialData { @@ -482,12 +482,12 @@ public final class TSDKAbiModule { } /// Decodes BOC into JSON as a set of provided parameters. - /// Solidity functions use ABI types for [builder encoding](https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmbuilderstore). + /// Solidity functions use ABI types for [builder encoding](https://github.com/everx-labs/TVM-Solidity-Compiler/blob/master/API.md#tvmbuilderstore). /// The simplest way to decode such a BOC is to use ABI decoding. /// 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()`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. - public func decode_boc(_ payload: TSDKParamsOfDecodeBoc, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func decode_boc(_ payload: TSDKParamsOfDecodeBoc, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "decode_boc" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -498,7 +498,7 @@ public final class TSDKAbiModule { } /// Decodes BOC into JSON as a set of provided parameters. - /// Solidity functions use ABI types for [builder encoding](https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/API.md#tvmbuilderstore). + /// Solidity functions use ABI types for [builder encoding](https://github.com/everx-labs/TVM-Solidity-Compiler/blob/master/API.md#tvmbuilderstore). /// The simplest way to decode such a BOC is to use ABI decoding. /// 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()`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. @@ -527,7 +527,7 @@ public final class TSDKAbiModule { } /// Encodes given parameters in JSON into a BOC using param types from ABI. - public func encode_boc(_ payload: TSDKParamsOfAbiEncodeBoc, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_boc(_ payload: TSDKParamsOfAbiEncodeBoc, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_boc" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -562,7 +562,7 @@ public final class TSDKAbiModule { } /// Calculates contract function ID by contract ABI - public func calc_function_id(_ payload: TSDKParamsOfCalcFunctionId, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func calc_function_id(_ payload: TSDKParamsOfCalcFunctionId, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "calc_function_id" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -597,7 +597,7 @@ public final class TSDKAbiModule { } /// Extracts signature from message body and calculates hash to verify the signature - public func get_signature_data(_ payload: TSDKParamsOfGetSignatureData, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_signature_data(_ payload: TSDKParamsOfGetSignatureData, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_signature_data" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Abi/AbiTypes.swift b/Sources/EverscaleClientSwift/Abi/AbiTypes.swift index 5f1ab6b..8412076 100644 --- a/Sources/EverscaleClientSwift/Abi/AbiTypes.swift +++ b/Sources/EverscaleClientSwift/Abi/AbiTypes.swift @@ -20,6 +20,7 @@ public enum TSDKAbiErrorCode: Int, Codable { case InvalidData = 313 case EncodeInitialDataFailed = 314 case InvalidFunctionName = 315 + case PubKeyNotSupported = 316 } public enum TSDKAbiEnumTypes: String, Codable { @@ -43,23 +44,12 @@ public enum TSDKMessageBodyType: String, Codable { case Event = "Event" } -public enum TSDKStateInitSourceEnumTypes: String, Codable { - case Message = "Message" - case StateInit = "StateInit" - case Tvc = "Tvc" -} - -public enum TSDKMessageSourceEnumTypes: String, Codable { - case Encoded = "Encoded" - case EncodingParams = "EncodingParams" -} - public enum TSDKDataLayout: String, Codable { case Input = "Input" case Output = "Output" } -public struct TSDKAbi: Codable { +public struct TSDKAbi: Codable, @unchecked Sendable { public var type: TSDKAbiEnumTypes public var value: AnyValue? @@ -69,7 +59,7 @@ public struct TSDKAbi: Codable { } } -public struct TSDKFunctionHeader: Codable { +public struct TSDKFunctionHeader: Codable, @unchecked Sendable { /// Message expiration timestamp (UNIX time) in seconds. /// If not specified - calculated automatically from message_expiration_timeout(),try_index and message_expiration_timeout_grow_factor() (if ABI includes `expire` header). public var expire: UInt32? @@ -77,7 +67,7 @@ public struct TSDKFunctionHeader: Codable { /// If not specified, `now` is used (if ABI includes `time` header). public var time: Int? /// Public key is used by the contract to check the signature. - /// Encoded in `hex`. If not specified, method fails with exception (if ABI includes `pubkey` header).. + /// Encoded in `hex`. If not specified, method fails with exception (if ABI includes `pubkey` header). public var pubkey: String? public init(expire: UInt32? = nil, time: Int? = nil, pubkey: String? = nil) { @@ -87,7 +77,7 @@ public struct TSDKFunctionHeader: Codable { } } -public struct TSDKCallSet: Codable { +public struct TSDKCallSet: Codable, @unchecked Sendable { /// Function name that is being called. Or function id encoded as string in hex (starting with 0x). public var function_name: String /// Function header. @@ -103,7 +93,7 @@ public struct TSDKCallSet: Codable { } } -public struct TSDKDeploySet: Codable { +public struct TSDKDeploySet: Codable, @unchecked Sendable { /// Content of TVC file encoded in `base64`. For compatibility reason this field can contain an encoded `StateInit`. public var tvc: String? /// Contract code BOC encoded with base64. @@ -120,6 +110,7 @@ public struct TSDKDeploySet: Codable { /// 1. Public key from deploy set. /// 2. Public key, specified in TVM file. /// 3. Public key, provided by Signer. + /// Applicable only for contracts with ABI version < 2.4. Contract initial public key should beexplicitly provided inside `initial_data` since ABI 2.4 public var initial_pubkey: String? public init(tvc: String? = nil, code: String? = nil, state_init: String? = nil, workchain_id: Int32? = nil, initial_data: AnyValue? = nil, initial_pubkey: String? = nil) { @@ -132,7 +123,7 @@ public struct TSDKDeploySet: Codable { } } -public struct TSDKSigner: Codable { +public struct TSDKSigner: Codable, @unchecked Sendable { public var type: TSDKSignerEnumTypes public var public_key: String? public var keys: TSDKKeyPair? @@ -146,69 +137,21 @@ public struct TSDKSigner: Codable { } } -public struct TSDKStateInitSource: Codable { - public var type: TSDKStateInitSourceEnumTypes - public var source: TSDKMessageSource? - /// Code BOC. - /// Encoded in `base64`. - public var code: String? - /// Data BOC. - /// Encoded in `base64`. - public var data: String? - /// Library BOC. - /// Encoded in `base64`. - public var library: String? - public var tvc: String? - public var public_key: String? - public var init_params: TSDKStateInitParams? - - public init(type: TSDKStateInitSourceEnumTypes, source: TSDKMessageSource? = nil, code: String? = nil, data: String? = nil, library: String? = nil, tvc: String? = nil, public_key: String? = nil, init_params: TSDKStateInitParams? = nil) { - self.type = type - self.source = source - self.code = code - self.data = data - self.library = library - self.tvc = tvc - self.public_key = public_key - self.init_params = init_params - } -} - -public struct TSDKStateInitParams: Codable { - public var abi: TSDKAbi - public var value: AnyValue - - public init(abi: TSDKAbi, value: AnyValue) { - self.abi = abi - self.value = value - } -} - -public struct TSDKMessageSource: Codable { - public var type: TSDKMessageSourceEnumTypes - public var message: String? - public var abi: TSDKAbi? - - public init(type: TSDKMessageSourceEnumTypes, message: String? = nil, abi: TSDKAbi? = nil) { - self.type = type - self.message = message - self.abi = abi - } -} - -public struct TSDKAbiParam: Codable { +public struct TSDKAbiParam: Codable, @unchecked Sendable { public var name: String public var type: String public var components: [TSDKAbiParam]? + public var `init`: Bool? - public init(name: String, type: String, components: [TSDKAbiParam]? = nil) { + public init(name: String, type: String, components: [TSDKAbiParam]? = nil, `init`: Bool? = nil) { self.name = name self.type = type self.components = components + self.`init` = `init` } } -public struct TSDKAbiEvent: Codable { +public struct TSDKAbiEvent: Codable, @unchecked Sendable { public var name: String public var inputs: [TSDKAbiParam] public var id: String? @@ -220,7 +163,7 @@ public struct TSDKAbiEvent: Codable { } } -public struct TSDKAbiData: Codable { +public struct TSDKAbiData: Codable, @unchecked Sendable { public var key: UInt32 public var name: String public var type: String @@ -234,7 +177,7 @@ public struct TSDKAbiData: Codable { } } -public struct TSDKAbiFunction: Codable { +public struct TSDKAbiFunction: Codable, @unchecked Sendable { public var name: String public var inputs: [TSDKAbiParam] public var outputs: [TSDKAbiParam] @@ -248,7 +191,7 @@ public struct TSDKAbiFunction: Codable { } } -public struct TSDKAbiContract: Codable { +public struct TSDKAbiContract: Codable, @unchecked Sendable { public var abi_version: UInt32? public var version: String? public var header: [String]? @@ -268,7 +211,7 @@ public struct TSDKAbiContract: Codable { } } -public struct TSDKParamsOfEncodeMessageBody: Codable { +public struct TSDKParamsOfEncodeMessageBody: Codable, @unchecked Sendable { /// Contract ABI. public var abi: TSDKAbi /// Function call parameters. @@ -302,7 +245,7 @@ public struct TSDKParamsOfEncodeMessageBody: Codable { } } -public struct TSDKResultOfEncodeMessageBody: Codable { +public struct TSDKResultOfEncodeMessageBody: Codable, @unchecked Sendable { /// Message body BOC encoded with `base64`. public var body: String /// Optional data to sign. @@ -316,7 +259,7 @@ public struct TSDKResultOfEncodeMessageBody: Codable { } } -public struct TSDKParamsOfAttachSignatureToMessageBody: Codable { +public struct TSDKParamsOfAttachSignatureToMessageBody: Codable, @unchecked Sendable { /// Contract ABI public var abi: TSDKAbi /// Public key. @@ -337,7 +280,7 @@ public struct TSDKParamsOfAttachSignatureToMessageBody: Codable { } } -public struct TSDKResultOfAttachSignatureToMessageBody: Codable { +public struct TSDKResultOfAttachSignatureToMessageBody: Codable, @unchecked Sendable { public var body: String public init(body: String) { @@ -345,7 +288,7 @@ public struct TSDKResultOfAttachSignatureToMessageBody: Codable { } } -public struct TSDKParamsOfEncodeMessage: Codable { +public struct TSDKParamsOfEncodeMessage: Codable, @unchecked Sendable { /// Contract ABI. public var abi: TSDKAbi /// Target address the message will be sent to. @@ -381,7 +324,7 @@ public struct TSDKParamsOfEncodeMessage: Codable { } } -public struct TSDKResultOfEncodeMessage: Codable { +public struct TSDKResultOfEncodeMessage: Codable, @unchecked Sendable { /// Message BOC encoded with `base64`. public var message: String /// Optional data to be signed encoded in `base64`. @@ -400,7 +343,7 @@ public struct TSDKResultOfEncodeMessage: Codable { } } -public struct TSDKParamsOfEncodeInternalMessage: Codable { +public struct TSDKParamsOfEncodeInternalMessage: Codable, @unchecked Sendable { /// Contract ABI. /// Can be None if both deploy_set and call_set are None. public var abi: TSDKAbi? @@ -437,7 +380,7 @@ public struct TSDKParamsOfEncodeInternalMessage: Codable { } } -public struct TSDKResultOfEncodeInternalMessage: Codable { +public struct TSDKResultOfEncodeInternalMessage: Codable, @unchecked Sendable { /// Message BOC encoded with `base64`. public var message: String /// Destination address. @@ -452,7 +395,7 @@ public struct TSDKResultOfEncodeInternalMessage: Codable { } } -public struct TSDKParamsOfAttachSignature: Codable { +public struct TSDKParamsOfAttachSignature: Codable, @unchecked Sendable { /// Contract ABI public var abi: TSDKAbi /// Public key encoded in `hex`. @@ -470,7 +413,7 @@ public struct TSDKParamsOfAttachSignature: Codable { } } -public struct TSDKResultOfAttachSignature: Codable { +public struct TSDKResultOfAttachSignature: Codable, @unchecked Sendable { /// Signed message BOC public var message: String /// Message ID @@ -482,7 +425,7 @@ public struct TSDKResultOfAttachSignature: Codable { } } -public struct TSDKParamsOfDecodeMessage: Codable { +public struct TSDKParamsOfDecodeMessage: Codable, @unchecked Sendable { /// contract ABI public var abi: TSDKAbi /// Message BOC @@ -502,7 +445,7 @@ public struct TSDKParamsOfDecodeMessage: Codable { } } -public struct TSDKDecodedMessageBody: Codable { +public struct TSDKDecodedMessageBody: Codable, @unchecked Sendable { /// Type of the message body content. public var body_type: TSDKMessageBodyType /// Function or event name. @@ -520,7 +463,7 @@ public struct TSDKDecodedMessageBody: Codable { } } -public struct TSDKParamsOfDecodeMessageBody: Codable { +public struct TSDKParamsOfDecodeMessageBody: Codable, @unchecked Sendable { /// Contract ABI used to decode. public var abi: TSDKAbi /// Message body BOC encoded in `base64`. @@ -543,9 +486,9 @@ public struct TSDKParamsOfDecodeMessageBody: Codable { } } -public struct TSDKParamsOfEncodeAccount: Codable { - /// Source of the account state init. - public var state_init: TSDKStateInitSource +public struct TSDKParamsOfEncodeAccount: Codable, @unchecked Sendable { + /// Account state init. + public var state_init: String /// Initial balance. public var balance: Int? /// Initial value for the `last_trans_lt`. @@ -556,7 +499,7 @@ public struct TSDKParamsOfEncodeAccount: Codable { /// The BOC itself returned if no cache type provided public var boc_cache: TSDKBocCacheType? - public init(state_init: TSDKStateInitSource, balance: Int? = nil, last_trans_lt: Int? = nil, last_paid: UInt32? = nil, boc_cache: TSDKBocCacheType? = nil) { + public init(state_init: String, balance: Int? = nil, last_trans_lt: Int? = nil, last_paid: UInt32? = nil, boc_cache: TSDKBocCacheType? = nil) { self.state_init = state_init self.balance = balance self.last_trans_lt = last_trans_lt @@ -565,7 +508,7 @@ public struct TSDKParamsOfEncodeAccount: Codable { } } -public struct TSDKResultOfEncodeAccount: Codable { +public struct TSDKResultOfEncodeAccount: Codable, @unchecked Sendable { /// Account BOC encoded in `base64`. public var account: String /// Account ID encoded in `hex`. @@ -577,7 +520,7 @@ public struct TSDKResultOfEncodeAccount: Codable { } } -public struct TSDKParamsOfDecodeAccountData: Codable { +public struct TSDKParamsOfDecodeAccountData: Codable, @unchecked Sendable { /// Contract ABI public var abi: TSDKAbi /// Data BOC or BOC handle @@ -592,7 +535,7 @@ public struct TSDKParamsOfDecodeAccountData: Codable { } } -public struct TSDKResultOfDecodeAccountData: Codable { +public struct TSDKResultOfDecodeAccountData: Codable, @unchecked Sendable { /// Decoded data as a JSON structure. public var data: AnyValue @@ -601,9 +544,9 @@ public struct TSDKResultOfDecodeAccountData: Codable { } } -public struct TSDKParamsOfUpdateInitialData: Codable { +public struct TSDKParamsOfUpdateInitialData: Codable, @unchecked Sendable { /// Contract ABI - public var abi: TSDKAbi? + public var abi: TSDKAbi /// Data BOC or BOC handle public var data: String /// List of initial values for contract's static variables. @@ -614,7 +557,7 @@ public struct TSDKParamsOfUpdateInitialData: Codable { /// Cache type to put the result. The BOC itself returned if no cache type provided. public var boc_cache: TSDKBocCacheType? - public init(abi: TSDKAbi? = nil, data: String, initial_data: AnyValue? = nil, initial_pubkey: String? = nil, boc_cache: TSDKBocCacheType? = nil) { + public init(abi: TSDKAbi, data: String, initial_data: AnyValue? = nil, initial_pubkey: String? = nil, boc_cache: TSDKBocCacheType? = nil) { self.abi = abi self.data = data self.initial_data = initial_data @@ -623,7 +566,7 @@ public struct TSDKParamsOfUpdateInitialData: Codable { } } -public struct TSDKResultOfUpdateInitialData: Codable { +public struct TSDKResultOfUpdateInitialData: Codable, @unchecked Sendable { /// Updated data BOC or BOC handle public var data: String @@ -632,9 +575,9 @@ public struct TSDKResultOfUpdateInitialData: Codable { } } -public struct TSDKParamsOfEncodeInitialData: Codable { +public struct TSDKParamsOfEncodeInitialData: Codable, @unchecked Sendable { /// Contract ABI - public var abi: TSDKAbi? + public var abi: TSDKAbi /// List of initial values for contract's static variables. /// `abi` parameter should be provided to set initial data public var initial_data: AnyValue? @@ -643,7 +586,7 @@ public struct TSDKParamsOfEncodeInitialData: Codable { /// Cache type to put the result. The BOC itself returned if no cache type provided. public var boc_cache: TSDKBocCacheType? - public init(abi: TSDKAbi? = nil, initial_data: AnyValue? = nil, initial_pubkey: String? = nil, boc_cache: TSDKBocCacheType? = nil) { + public init(abi: TSDKAbi, initial_data: AnyValue? = nil, initial_pubkey: String? = nil, boc_cache: TSDKBocCacheType? = nil) { self.abi = abi self.initial_data = initial_data self.initial_pubkey = initial_pubkey @@ -651,7 +594,7 @@ public struct TSDKParamsOfEncodeInitialData: Codable { } } -public struct TSDKResultOfEncodeInitialData: Codable { +public struct TSDKResultOfEncodeInitialData: Codable, @unchecked Sendable { /// Updated data BOC or BOC handle public var data: String @@ -660,36 +603,36 @@ public struct TSDKResultOfEncodeInitialData: Codable { } } -public struct TSDKParamsOfDecodeInitialData: Codable { +public struct TSDKParamsOfDecodeInitialData: Codable, @unchecked Sendable { /// Contract ABI. /// Initial data is decoded if this parameter is provided - public var abi: TSDKAbi? + public var abi: TSDKAbi /// Data BOC or BOC handle public var data: String /// Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default) public var allow_partial: Bool? - public init(abi: TSDKAbi? = nil, data: String, allow_partial: Bool? = nil) { + public init(abi: TSDKAbi, data: String, allow_partial: Bool? = nil) { self.abi = abi self.data = data self.allow_partial = allow_partial } } -public struct TSDKResultOfDecodeInitialData: Codable { +public struct TSDKResultOfDecodeInitialData: Codable, @unchecked Sendable { /// List of initial values of contract's public variables. /// Initial data is decoded if `abi` input parameter is provided - public var initial_data: AnyValue? + public var initial_data: AnyValue /// Initial account owner's public key public var initial_pubkey: String - public init(initial_data: AnyValue? = nil, initial_pubkey: String) { + public init(initial_data: AnyValue, initial_pubkey: String) { self.initial_data = initial_data self.initial_pubkey = initial_pubkey } } -public struct TSDKParamsOfDecodeBoc: Codable { +public struct TSDKParamsOfDecodeBoc: Codable, @unchecked Sendable { /// Parameters to decode from BOC public var params: [TSDKAbiParam] /// Data BOC or BOC handle @@ -703,7 +646,7 @@ public struct TSDKParamsOfDecodeBoc: Codable { } } -public struct TSDKResultOfDecodeBoc: Codable { +public struct TSDKResultOfDecodeBoc: Codable, @unchecked Sendable { /// Decoded data as a JSON structure. public var data: AnyValue @@ -712,7 +655,7 @@ public struct TSDKResultOfDecodeBoc: Codable { } } -public struct TSDKParamsOfAbiEncodeBoc: Codable { +public struct TSDKParamsOfAbiEncodeBoc: Codable, @unchecked Sendable { /// Parameters to encode into BOC public var params: [TSDKAbiParam] /// Parameters and values as a JSON structure @@ -728,7 +671,7 @@ public struct TSDKParamsOfAbiEncodeBoc: Codable { } } -public struct TSDKResultOfAbiEncodeBoc: Codable { +public struct TSDKResultOfAbiEncodeBoc: Codable, @unchecked Sendable { /// BOC encoded as base64 public var boc: String @@ -737,7 +680,7 @@ public struct TSDKResultOfAbiEncodeBoc: Codable { } } -public struct TSDKParamsOfCalcFunctionId: Codable { +public struct TSDKParamsOfCalcFunctionId: Codable, @unchecked Sendable { /// Contract ABI. public var abi: TSDKAbi /// Contract function name @@ -752,7 +695,7 @@ public struct TSDKParamsOfCalcFunctionId: Codable { } } -public struct TSDKResultOfCalcFunctionId: Codable { +public struct TSDKResultOfCalcFunctionId: Codable, @unchecked Sendable { /// Contract function ID public var function_id: UInt32 @@ -761,7 +704,7 @@ public struct TSDKResultOfCalcFunctionId: Codable { } } -public struct TSDKParamsOfGetSignatureData: Codable { +public struct TSDKParamsOfGetSignatureData: Codable, @unchecked Sendable { /// Contract ABI used to decode. public var abi: TSDKAbi /// Message BOC encoded in `base64`. @@ -776,7 +719,7 @@ public struct TSDKParamsOfGetSignatureData: Codable { } } -public struct TSDKResultOfGetSignatureData: Codable { +public struct TSDKResultOfGetSignatureData: Codable, @unchecked Sendable { /// Signature from the message in `hex`. public var signature: String /// Data to verify the signature in `base64`. diff --git a/Sources/EverscaleClientSwift/Binding/BindingStore.swift b/Sources/EverscaleClientSwift/Binding/BindingStore.swift index 32de4e8..03df66d 100644 --- a/Sources/EverscaleClientSwift/Binding/BindingStore.swift +++ b/Sources/EverscaleClientSwift/Binding/BindingStore.swift @@ -7,12 +7,12 @@ import Foundation -public final class BindingStore { +public final class BindingStore: @unchecked Sendable { - private static var requsetId: UInt32 = .init() + nonisolated(unsafe) private static var requsetId: UInt32 = .init() private static let requestLock: NSLock = .init() private static let asyncResponseLock: NSLock = .init() - public static var responses: [UInt32: (_ requestId: UInt32, + nonisolated(unsafe) public static var responses: [UInt32: (_ requestId: UInt32, _ stringResponse: String, _ responseType: TSDKBindingResponseType, _ finished: Bool) throws -> Void] = .init() @@ -23,8 +23,8 @@ public final class BindingStore { stringResponse: String, responseType: TSDKBindingResponseType, finished: Bool) - public static var completeResponses: [UInt32: RawResponse] = [:] - public static var completeResponsesLock: NSLock = .init() + nonisolated(unsafe) public static var completeResponses: [UInt32: RawResponse] = [:] + nonisolated(unsafe) public static var completeResponsesLock: NSLock = .init() public class func setCompleteResponse(_ id: UInt32, _ response: RawResponse) { completeResponsesLock.lock() diff --git a/Sources/EverscaleClientSwift/Binding/BindingTypes.swift b/Sources/EverscaleClientSwift/Binding/BindingTypes.swift index 59c47ee..772c54e 100644 --- a/Sources/EverscaleClientSwift/Binding/BindingTypes.swift +++ b/Sources/EverscaleClientSwift/Binding/BindingTypes.swift @@ -24,7 +24,7 @@ public enum TSDKBindingResponseType: UInt32 { case unknown } -public struct TSDKNoneResult: Codable {} +public struct TSDKNoneResult: Codable, Sendable {} public struct TSDKDefault: Codable { public var result: AnyValue? @@ -42,7 +42,7 @@ public struct TSDKDefault: Codable { } } -public struct TSDKBindingResponse { +public struct TSDKBindingResponse { public var result: TSDKResult? public var error: TSDKError? public var dappError: TSDKError? diff --git a/Sources/EverscaleClientSwift/Boc/Boc.swift b/Sources/EverscaleClientSwift/Boc/Boc.swift index 32f9bc7..5e44834 100644 --- a/Sources/EverscaleClientSwift/Boc/Boc.swift +++ b/Sources/EverscaleClientSwift/Boc/Boc.swift @@ -7,8 +7,8 @@ public final class TSDKBocModule { self.binding = binding } - /// Decodes tvc according to the tvc spec. Read more about tvc structure here https://github.com/tonlabs/ever-struct/blob/main/src/scheme/mod.rs#L30 - public func decode_tvc(_ payload: TSDKParamsOfDecodeTvc, _ handler: @escaping (TSDKBindingResponse) throws -> Void + /// Decodes tvc according to the tvc spec. Read more about tvc structure here https://github.com/everx-labs/ever-struct/blob/main/src/scheme/mod.rs#L30 + public func decode_tvc(_ payload: TSDKParamsOfDecodeTvc, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "decode_tvc" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -18,7 +18,7 @@ public final class TSDKBocModule { } } - /// Decodes tvc according to the tvc spec. Read more about tvc structure here https://github.com/tonlabs/ever-struct/blob/main/src/scheme/mod.rs#L30 + /// Decodes tvc according to the tvc spec. Read more about tvc structure here https://github.com/everx-labs/ever-struct/blob/main/src/scheme/mod.rs#L30 @available(iOS 13, *) @available(macOS 12, *) public func decode_tvc(_ payload: TSDKParamsOfDecodeTvc) async throws -> TSDKResultOfDecodeTvc { @@ -44,7 +44,7 @@ public final class TSDKBocModule { /// Parses message boc into a JSON /// JSON structure is compatible with GraphQL API message object - public func parse_message(_ payload: TSDKParamsOfParse, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func parse_message(_ payload: TSDKParamsOfParse, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "parse_message" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -81,7 +81,7 @@ public final class TSDKBocModule { /// Parses transaction boc into a JSON /// JSON structure is compatible with GraphQL API transaction object - public func parse_transaction(_ payload: TSDKParamsOfParse, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func parse_transaction(_ payload: TSDKParamsOfParse, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "parse_transaction" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -118,7 +118,7 @@ public final class TSDKBocModule { /// Parses account boc into a JSON /// JSON structure is compatible with GraphQL API account object - public func parse_account(_ payload: TSDKParamsOfParse, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func parse_account(_ payload: TSDKParamsOfParse, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "parse_account" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -155,7 +155,7 @@ public final class TSDKBocModule { /// Parses block boc into a JSON /// JSON structure is compatible with GraphQL API block object - public func parse_block(_ payload: TSDKParamsOfParse, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func parse_block(_ payload: TSDKParamsOfParse, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "parse_block" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -192,7 +192,7 @@ public final class TSDKBocModule { /// Parses shardstate boc into a JSON /// JSON structure is compatible with GraphQL API shardstate object - public func parse_shardstate(_ payload: TSDKParamsOfParseShardstate, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func parse_shardstate(_ payload: TSDKParamsOfParseShardstate, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "parse_shardstate" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -228,7 +228,7 @@ public final class TSDKBocModule { } /// Extract blockchain configuration from key block and also from zerostate. - public func get_blockchain_config(_ payload: TSDKParamsOfGetBlockchainConfig, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_blockchain_config(_ payload: TSDKParamsOfGetBlockchainConfig, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_blockchain_config" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -263,7 +263,7 @@ public final class TSDKBocModule { } /// Calculates BOC root hash - public func get_boc_hash(_ payload: TSDKParamsOfGetBocHash, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_boc_hash(_ payload: TSDKParamsOfGetBocHash, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_boc_hash" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -298,7 +298,7 @@ public final class TSDKBocModule { } /// Calculates BOC depth - public func get_boc_depth(_ payload: TSDKParamsOfGetBocDepth, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_boc_depth(_ payload: TSDKParamsOfGetBocDepth, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_boc_depth" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -333,7 +333,7 @@ public final class TSDKBocModule { } /// Extracts code from TVC contract image - public func get_code_from_tvc(_ payload: TSDKParamsOfGetCodeFromTvc, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_code_from_tvc(_ payload: TSDKParamsOfGetCodeFromTvc, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_code_from_tvc" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -368,7 +368,7 @@ public final class TSDKBocModule { } /// Get BOC from cache - public func cache_get(_ payload: TSDKParamsOfBocCacheGet, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func cache_get(_ payload: TSDKParamsOfBocCacheGet, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "cache_get" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -403,7 +403,7 @@ public final class TSDKBocModule { } /// Save BOC into cache or increase pin counter for existing pinned BOC - public func cache_set(_ payload: TSDKParamsOfBocCacheSet, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func cache_set(_ payload: TSDKParamsOfBocCacheSet, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "cache_set" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -438,7 +438,7 @@ 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 - public func cache_unpin(_ payload: TSDKParamsOfBocCacheUnpin, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func cache_unpin(_ payload: TSDKParamsOfBocCacheUnpin, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "cache_unpin" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -473,7 +473,7 @@ 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. - public func encode_boc(_ payload: TSDKParamsOfEncodeBoc, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_boc(_ payload: TSDKParamsOfEncodeBoc, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_boc" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -508,7 +508,7 @@ public final class TSDKBocModule { } /// Returns the contract code's salt if it is present. - public func get_code_salt(_ payload: TSDKParamsOfGetCodeSalt, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_code_salt(_ payload: TSDKParamsOfGetCodeSalt, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_code_salt" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -544,7 +544,7 @@ public final class TSDKBocModule { /// Sets new salt to contract code. /// Returns the new contract code with salt. - public func set_code_salt(_ payload: TSDKParamsOfSetCodeSalt, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func set_code_salt(_ payload: TSDKParamsOfSetCodeSalt, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "set_code_salt" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -580,7 +580,7 @@ public final class TSDKBocModule { } /// Decodes contract's initial state into code, data, libraries and special options. - public func decode_state_init(_ payload: TSDKParamsOfDecodeStateInit, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func decode_state_init(_ payload: TSDKParamsOfDecodeStateInit, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "decode_state_init" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -615,7 +615,7 @@ public final class TSDKBocModule { } /// Encodes initial contract state from code, data, libraries ans special options (see input params) - public func encode_state_init(_ payload: TSDKParamsOfEncodeStateInit, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_state_init(_ payload: TSDKParamsOfEncodeStateInit, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_state_init" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -651,7 +651,7 @@ public final class TSDKBocModule { /// Encodes a message /// Allows to encode any external inbound message. - public func encode_external_in_message(_ payload: TSDKParamsOfEncodeExternalInMessage, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encode_external_in_message(_ payload: TSDKParamsOfEncodeExternalInMessage, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encode_external_in_message" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -687,7 +687,7 @@ public final class TSDKBocModule { } /// Returns the compiler version used to compile the code. - public func get_compiler_version(_ payload: TSDKParamsOfGetCompilerVersion, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_compiler_version(_ payload: TSDKParamsOfGetCompilerVersion, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_compiler_version" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Boc/BocTypes.swift b/Sources/EverscaleClientSwift/Boc/BocTypes.swift index 0253389..3343c4a 100644 --- a/Sources/EverscaleClientSwift/Boc/BocTypes.swift +++ b/Sources/EverscaleClientSwift/Boc/BocTypes.swift @@ -29,7 +29,7 @@ public enum TSDKBocErrorCode: Int, Codable { case InvalidBocRef = 207 } -public struct TSDKBocCacheType: Codable { +public struct TSDKBocCacheType: Codable, @unchecked Sendable { public var type: TSDKBocCacheTypeEnumTypes public var pin: String? @@ -39,7 +39,7 @@ public struct TSDKBocCacheType: Codable { } } -public struct TSDKBuilderOp: Codable { +public struct TSDKBuilderOp: Codable, @unchecked Sendable { public var type: TSDKBuilderOpEnumTypes /// Bit size of the value. public var size: UInt32? @@ -66,7 +66,7 @@ public struct TSDKBuilderOp: Codable { } /// Cell builder operation. -public struct TSDKTvc: Codable { +public struct TSDKTvc: Codable, @unchecked Sendable { public var type: TSDKTvcEnumTypes public var value: TSDKTvcV1? @@ -76,7 +76,7 @@ public struct TSDKTvc: Codable { } } -public struct TSDKTvcV1: Codable { +public struct TSDKTvcV1: Codable, @unchecked Sendable { public var code: String? public var description: String? @@ -86,7 +86,7 @@ public struct TSDKTvcV1: Codable { } } -public struct TSDKParamsOfDecodeTvc: Codable { +public struct TSDKParamsOfDecodeTvc: Codable, @unchecked Sendable { /// Contract TVC BOC encoded as base64 or BOC handle public var tvc: String @@ -95,7 +95,7 @@ public struct TSDKParamsOfDecodeTvc: Codable { } } -public struct TSDKResultOfDecodeTvc: Codable { +public struct TSDKResultOfDecodeTvc: Codable, @unchecked Sendable { /// Decoded TVC public var tvc: TSDKTvc @@ -104,7 +104,7 @@ public struct TSDKResultOfDecodeTvc: Codable { } } -public struct TSDKParamsOfParse: Codable { +public struct TSDKParamsOfParse: Codable, @unchecked Sendable { /// BOC encoded as base64 public var boc: String @@ -113,7 +113,7 @@ public struct TSDKParamsOfParse: Codable { } } -public struct TSDKResultOfParse: Codable { +public struct TSDKResultOfParse: Codable, @unchecked Sendable { /// JSON containing parsed BOC public var parsed: AnyValue @@ -122,7 +122,7 @@ public struct TSDKResultOfParse: Codable { } } -public struct TSDKParamsOfParseShardstate: Codable { +public struct TSDKParamsOfParseShardstate: Codable, @unchecked Sendable { /// BOC encoded as base64 public var boc: String /// Shardstate identifier @@ -137,7 +137,7 @@ public struct TSDKParamsOfParseShardstate: Codable { } } -public struct TSDKParamsOfGetBlockchainConfig: Codable { +public struct TSDKParamsOfGetBlockchainConfig: Codable, @unchecked Sendable { /// Key block BOC or zerostate BOC encoded as base64 public var block_boc: String @@ -146,7 +146,7 @@ public struct TSDKParamsOfGetBlockchainConfig: Codable { } } -public struct TSDKResultOfGetBlockchainConfig: Codable { +public struct TSDKResultOfGetBlockchainConfig: Codable, @unchecked Sendable { /// Blockchain config BOC encoded as base64 public var config_boc: String @@ -155,7 +155,7 @@ public struct TSDKResultOfGetBlockchainConfig: Codable { } } -public struct TSDKParamsOfGetBocHash: Codable { +public struct TSDKParamsOfGetBocHash: Codable, @unchecked Sendable { /// BOC encoded as base64 or BOC handle public var boc: String @@ -164,7 +164,7 @@ public struct TSDKParamsOfGetBocHash: Codable { } } -public struct TSDKResultOfGetBocHash: Codable { +public struct TSDKResultOfGetBocHash: Codable, @unchecked Sendable { /// BOC root hash encoded with hex public var hash: String @@ -173,7 +173,7 @@ public struct TSDKResultOfGetBocHash: Codable { } } -public struct TSDKParamsOfGetBocDepth: Codable { +public struct TSDKParamsOfGetBocDepth: Codable, @unchecked Sendable { /// BOC encoded as base64 or BOC handle public var boc: String @@ -182,7 +182,7 @@ public struct TSDKParamsOfGetBocDepth: Codable { } } -public struct TSDKResultOfGetBocDepth: Codable { +public struct TSDKResultOfGetBocDepth: Codable, @unchecked Sendable { /// BOC root cell depth public var depth: UInt32 @@ -191,7 +191,7 @@ public struct TSDKResultOfGetBocDepth: Codable { } } -public struct TSDKParamsOfGetCodeFromTvc: Codable { +public struct TSDKParamsOfGetCodeFromTvc: Codable, @unchecked Sendable { /// Contract TVC image or image BOC handle public var tvc: String @@ -200,7 +200,7 @@ public struct TSDKParamsOfGetCodeFromTvc: Codable { } } -public struct TSDKResultOfGetCodeFromTvc: Codable { +public struct TSDKResultOfGetCodeFromTvc: Codable, @unchecked Sendable { /// Contract code encoded as base64 public var code: String @@ -209,7 +209,7 @@ public struct TSDKResultOfGetCodeFromTvc: Codable { } } -public struct TSDKParamsOfBocCacheGet: Codable { +public struct TSDKParamsOfBocCacheGet: Codable, @unchecked Sendable { /// Reference to the cached BOC public var boc_ref: String @@ -218,7 +218,7 @@ public struct TSDKParamsOfBocCacheGet: Codable { } } -public struct TSDKResultOfBocCacheGet: Codable { +public struct TSDKResultOfBocCacheGet: Codable, @unchecked Sendable { /// BOC encoded as base64. public var boc: String? @@ -227,7 +227,7 @@ public struct TSDKResultOfBocCacheGet: Codable { } } -public struct TSDKParamsOfBocCacheSet: Codable { +public struct TSDKParamsOfBocCacheSet: Codable, @unchecked Sendable { /// BOC encoded as base64 or BOC reference public var boc: String /// Cache type @@ -239,7 +239,7 @@ public struct TSDKParamsOfBocCacheSet: Codable { } } -public struct TSDKResultOfBocCacheSet: Codable { +public struct TSDKResultOfBocCacheSet: Codable, @unchecked Sendable { /// Reference to the cached BOC public var boc_ref: String @@ -248,7 +248,7 @@ public struct TSDKResultOfBocCacheSet: Codable { } } -public struct TSDKParamsOfBocCacheUnpin: Codable { +public struct TSDKParamsOfBocCacheUnpin: Codable, @unchecked Sendable { /// Pinned name public var pin: String /// Reference to the cached BOC. @@ -261,7 +261,7 @@ public struct TSDKParamsOfBocCacheUnpin: Codable { } } -public struct TSDKParamsOfEncodeBoc: Codable { +public struct TSDKParamsOfEncodeBoc: Codable, @unchecked Sendable { /// Cell builder operations. public var builder: [TSDKBuilderOp] /// Cache type to put the result. The BOC itself returned if no cache type provided. @@ -273,7 +273,7 @@ public struct TSDKParamsOfEncodeBoc: Codable { } } -public struct TSDKResultOfEncodeBoc: Codable { +public struct TSDKResultOfEncodeBoc: Codable, @unchecked Sendable { /// Encoded cell BOC or BOC cache key. public var boc: String @@ -282,7 +282,7 @@ public struct TSDKResultOfEncodeBoc: Codable { } } -public struct TSDKParamsOfGetCodeSalt: Codable { +public struct TSDKParamsOfGetCodeSalt: Codable, @unchecked Sendable { /// Contract code BOC encoded as base64 or code BOC handle public var code: String /// Cache type to put the result. The BOC itself returned if no cache type provided. @@ -294,7 +294,7 @@ public struct TSDKParamsOfGetCodeSalt: Codable { } } -public struct TSDKResultOfGetCodeSalt: Codable { +public struct TSDKResultOfGetCodeSalt: Codable, @unchecked Sendable { /// Contract code salt if present. /// BOC encoded as base64 or BOC handle public var salt: String? @@ -304,7 +304,7 @@ public struct TSDKResultOfGetCodeSalt: Codable { } } -public struct TSDKParamsOfSetCodeSalt: Codable { +public struct TSDKParamsOfSetCodeSalt: Codable, @unchecked Sendable { /// Contract code BOC encoded as base64 or code BOC handle public var code: String /// Code salt to set. @@ -320,7 +320,7 @@ public struct TSDKParamsOfSetCodeSalt: Codable { } } -public struct TSDKResultOfSetCodeSalt: Codable { +public struct TSDKResultOfSetCodeSalt: Codable, @unchecked Sendable { /// Contract code with salt set. /// BOC encoded as base64 or BOC handle public var code: String @@ -330,7 +330,7 @@ public struct TSDKResultOfSetCodeSalt: Codable { } } -public struct TSDKParamsOfDecodeStateInit: Codable { +public struct TSDKParamsOfDecodeStateInit: Codable, @unchecked Sendable { /// Contract StateInit image BOC encoded as base64 or BOC handle public var state_init: String /// Cache type to put the result. The BOC itself returned if no cache type provided. @@ -342,7 +342,7 @@ public struct TSDKParamsOfDecodeStateInit: Codable { } } -public struct TSDKResultOfDecodeStateInit: Codable { +public struct TSDKResultOfDecodeStateInit: Codable, @unchecked Sendable { /// Contract code BOC encoded as base64 or BOC handle public var code: String? /// Contract code hash @@ -383,7 +383,7 @@ public struct TSDKResultOfDecodeStateInit: Codable { } } -public struct TSDKParamsOfEncodeStateInit: Codable { +public struct TSDKParamsOfEncodeStateInit: Codable, @unchecked Sendable { /// Contract code BOC encoded as base64 or BOC handle public var code: String? /// Contract data BOC encoded as base64 or BOC handle @@ -412,7 +412,7 @@ public struct TSDKParamsOfEncodeStateInit: Codable { } } -public struct TSDKResultOfEncodeStateInit: Codable { +public struct TSDKResultOfEncodeStateInit: Codable, @unchecked Sendable { /// Contract StateInit image BOC encoded as base64 or BOC handle of boc_cache parameter was specified public var state_init: String @@ -421,7 +421,7 @@ public struct TSDKResultOfEncodeStateInit: Codable { } } -public struct TSDKParamsOfEncodeExternalInMessage: Codable { +public struct TSDKParamsOfEncodeExternalInMessage: Codable, @unchecked Sendable { /// Source address. public var src: String? /// Destination address. @@ -443,7 +443,7 @@ public struct TSDKParamsOfEncodeExternalInMessage: Codable { } } -public struct TSDKResultOfEncodeExternalInMessage: Codable { +public struct TSDKResultOfEncodeExternalInMessage: Codable, @unchecked Sendable { /// Message BOC encoded with `base64`. public var message: String /// Message id. @@ -455,7 +455,7 @@ public struct TSDKResultOfEncodeExternalInMessage: Codable { } } -public struct TSDKParamsOfGetCompilerVersion: Codable { +public struct TSDKParamsOfGetCompilerVersion: Codable, @unchecked Sendable { /// Contract code BOC encoded as base64 or code BOC handle public var code: String @@ -464,7 +464,7 @@ public struct TSDKParamsOfGetCompilerVersion: Codable { } } -public struct TSDKResultOfGetCompilerVersion: Codable { +public struct TSDKResultOfGetCompilerVersion: Codable, @unchecked Sendable { /// Compiler version, for example 'sol 0.49.0' public var version: String? diff --git a/Sources/EverscaleClientSwift/Client/Client.swift b/Sources/EverscaleClientSwift/Client/Client.swift index 2142480..b373d63 100644 --- a/Sources/EverscaleClientSwift/Client/Client.swift +++ b/Sources/EverscaleClientSwift/Client/Client.swift @@ -28,7 +28,7 @@ public final class TSDKClientModule { } /// Returns Core Library API reference - public func get_api_reference(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_api_reference(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_api_reference" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -63,7 +63,7 @@ public final class TSDKClientModule { } /// Returns Core Library version - public func version(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func version(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "version" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -98,7 +98,7 @@ public final class TSDKClientModule { } /// Returns Core Library API reference - public func config(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func config(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "config" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -133,7 +133,7 @@ public final class TSDKClientModule { } /// Returns detailed information about this build. - public func build_info(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func build_info(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "build_info" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -168,7 +168,7 @@ public final class TSDKClientModule { } /// Resolves application request processing result - public func resolve_app_request(_ payload: TSDKParamsOfResolveAppRequest, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func resolve_app_request(_ payload: TSDKParamsOfResolveAppRequest, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "resolve_app_request" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Client/ClientTypes.swift b/Sources/EverscaleClientSwift/Client/ClientTypes.swift index 9194128..cb92320 100644 --- a/Sources/EverscaleClientSwift/Client/ClientTypes.swift +++ b/Sources/EverscaleClientSwift/Client/ClientTypes.swift @@ -53,7 +53,7 @@ public enum TSDKAppRequestResultEnumTypes: String, Codable { case Ok = "Ok" } -public struct TSDKClientError: Codable, LocalizedError { +public struct TSDKClientError: Codable, LocalizedError, @unchecked Sendable { public var code: UInt32 public var message: String public var errorDescription: String? { self.message } @@ -81,7 +81,7 @@ public struct TSDKClientError: Codable, LocalizedError { } } -public struct TSDKClientConfig: Codable { +public struct TSDKClientConfig: Codable, @unchecked Sendable { public var binding: TSDKBindingConfig? public var network: TSDKNetworkConfig? public var crypto: TSDKCryptoConfig? @@ -102,7 +102,7 @@ public struct TSDKClientConfig: Codable { } } -public struct TSDKNetworkConfig: Codable { +public struct TSDKNetworkConfig: Codable, @unchecked Sendable { /// **This field is deprecated, but left for backward-compatibility.** Evernode endpoint. public var server_address: String? /// List of Evernode endpoints. @@ -183,7 +183,7 @@ public struct TSDKNetworkConfig: Codable { } } -public struct TSDKBindingConfig: Codable { +public struct TSDKBindingConfig: Codable, @unchecked Sendable { public var library: String? public var version: String? @@ -193,7 +193,7 @@ public struct TSDKBindingConfig: Codable { } } -public struct TSDKCryptoConfig: Codable { +public struct TSDKCryptoConfig: Codable, @unchecked Sendable { /// Mnemonic dictionary that will be used by default in crypto functions. If not specified, `English` dictionary will be used. public var mnemonic_dictionary: TSDKMnemonicDictionary? /// Mnemonic word count that will be used by default in crypto functions. If not specified the default value will be 12. @@ -208,7 +208,7 @@ public struct TSDKCryptoConfig: Codable { } } -public struct TSDKAbiConfig: Codable { +public struct TSDKAbiConfig: Codable, @unchecked Sendable { /// Workchain id that is used by default in DeploySet public var workchain: Int32? /// Message lifetime for contracts which ABI includes "expire" header. @@ -225,7 +225,7 @@ public struct TSDKAbiConfig: Codable { } } -public struct TSDKBocConfig: Codable { +public struct TSDKBocConfig: Codable, @unchecked Sendable { /// Maximum BOC cache size in kilobytes. /// Default is 10 MB public var cache_max_size: UInt32? @@ -235,7 +235,7 @@ public struct TSDKBocConfig: Codable { } } -public struct TSDKProofsConfig: Codable { +public struct TSDKProofsConfig: Codable, @unchecked Sendable { /// Cache proofs in the local storage. /// Default is `true`. If this value is set to `true`, downloaded proofs and master-chain BOCs are saved into thepersistent local storage (e.g. file system for native environments or browser's IndexedDBfor the web); otherwise all the data is cached only in memory in current client's contextand will be lost after destruction of the client. public var cache_in_local_storage: Bool? @@ -245,7 +245,7 @@ public struct TSDKProofsConfig: Codable { } } -public struct TSDKBuildInfoDependency: Codable { +public struct TSDKBuildInfoDependency: Codable, @unchecked Sendable { /// Dependency name. /// Usually it is a crate name. public var name: String @@ -258,7 +258,7 @@ public struct TSDKBuildInfoDependency: Codable { } } -public struct TSDKParamsOfAppRequest: Codable { +public struct TSDKParamsOfAppRequest: Codable, @unchecked Sendable { /// Request ID. /// Should be used in `resolve_app_request` call public var app_request_id: UInt32 @@ -271,7 +271,7 @@ public struct TSDKParamsOfAppRequest: Codable { } } -public struct TSDKAppRequestResult: Codable { +public struct TSDKAppRequestResult: Codable, @unchecked Sendable { public var type: TSDKAppRequestResultEnumTypes /// Error description public var text: String? @@ -285,7 +285,7 @@ public struct TSDKAppRequestResult: Codable { } } -public struct TSDKResultOfGetApiReference: Codable { +public struct TSDKResultOfGetApiReference: Codable, @unchecked Sendable { public var api: AnyValue public init(api: AnyValue) { @@ -293,7 +293,7 @@ public struct TSDKResultOfGetApiReference: Codable { } } -public struct TSDKResultOfVersion: Codable { +public struct TSDKResultOfVersion: Codable, @unchecked Sendable { /// Core Library version public var version: String @@ -302,7 +302,7 @@ public struct TSDKResultOfVersion: Codable { } } -public struct TSDKResultOfBuildInfo: Codable { +public struct TSDKResultOfBuildInfo: Codable, @unchecked Sendable { /// Build number assigned to this build by the CI. public var build_number: UInt32 /// Fingerprint of the most important dependencies. @@ -314,7 +314,7 @@ public struct TSDKResultOfBuildInfo: Codable { } } -public struct TSDKParamsOfResolveAppRequest: Codable { +public struct TSDKParamsOfResolveAppRequest: Codable, @unchecked Sendable { /// Request ID received from SDK public var app_request_id: UInt32 /// Result of request processing diff --git a/Sources/EverscaleClientSwift/Crypto/Crypto.swift b/Sources/EverscaleClientSwift/Crypto/Crypto.swift index d02e53c..18b4779 100644 --- a/Sources/EverscaleClientSwift/Crypto/Crypto.swift +++ b/Sources/EverscaleClientSwift/Crypto/Crypto.swift @@ -10,7 +10,7 @@ public final class TSDKCryptoModule { /// Integer factorization /// Performs prime factorization – decomposition of a composite numberinto a product of smaller prime integers (factors). /// See [https://en.wikipedia.org/wiki/Integer_factorization] - public func factorize(_ payload: TSDKParamsOfFactorize, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func factorize(_ payload: TSDKParamsOfFactorize, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "factorize" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -49,7 +49,7 @@ public final class TSDKCryptoModule { /// Modular exponentiation /// Performs modular exponentiation for big integers (`base`^`exponent` mod `modulus`). /// See [https://en.wikipedia.org/wiki/Modular_exponentiation] - public func modular_power(_ payload: TSDKParamsOfModularPower, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func modular_power(_ payload: TSDKParamsOfModularPower, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "modular_power" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -86,7 +86,7 @@ public final class TSDKCryptoModule { } /// Calculates CRC16 using TON algorithm. - public func ton_crc16(_ payload: TSDKParamsOfTonCrc16, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func ton_crc16(_ payload: TSDKParamsOfTonCrc16, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "ton_crc16" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -121,7 +121,7 @@ public final class TSDKCryptoModule { } /// Generates random byte array of the specified length and returns it in `base64` format - public func generate_random_bytes(_ payload: TSDKParamsOfGenerateRandomBytes, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func generate_random_bytes(_ payload: TSDKParamsOfGenerateRandomBytes, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "generate_random_bytes" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -156,7 +156,7 @@ public final class TSDKCryptoModule { } /// Converts public key to ton safe_format - public func convert_public_key_to_ton_safe_format(_ payload: TSDKParamsOfConvertPublicKeyToTonSafeFormat, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func convert_public_key_to_ton_safe_format(_ payload: TSDKParamsOfConvertPublicKeyToTonSafeFormat, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "convert_public_key_to_ton_safe_format" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -191,7 +191,7 @@ public final class TSDKCryptoModule { } /// Generates random ed25519 key pair. - public func generate_random_sign_keys(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func generate_random_sign_keys(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "generate_random_sign_keys" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -226,7 +226,7 @@ public final class TSDKCryptoModule { } /// Signs a data using the provided keys. - public func sign(_ payload: TSDKParamsOfSign, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func sign(_ payload: TSDKParamsOfSign, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "sign" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -261,7 +261,7 @@ public final class TSDKCryptoModule { } /// Verifies signed data using the provided public key. Raises error if verification is failed. - public func verify_signature(_ payload: TSDKParamsOfVerifySignature, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func verify_signature(_ payload: TSDKParamsOfVerifySignature, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "verify_signature" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -296,7 +296,7 @@ public final class TSDKCryptoModule { } /// Calculates SHA256 hash of the specified data. - public func sha256(_ payload: TSDKParamsOfHash, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func sha256(_ payload: TSDKParamsOfHash, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "sha256" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -331,7 +331,7 @@ public final class TSDKCryptoModule { } /// Calculates SHA512 hash of the specified data. - public func sha512(_ payload: TSDKParamsOfHash, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func sha512(_ payload: TSDKParamsOfHash, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "sha512" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -369,7 +369,7 @@ public final class TSDKCryptoModule { /// Derives key from `password` and `key` using `scrypt` algorithm. /// See [https://en.wikipedia.org/wiki/Scrypt]. /// # Arguments- `log_n` - The log2 of the Scrypt parameter `N`- `r` - The Scrypt parameter `r`- `p` - The Scrypt parameter `p`# Conditions- `log_n` must be less than `64`- `r` must be greater than `0` and less than or equal to `4294967295`- `p` must be greater than `0` and less than `4294967295`# Recommended values sufficient for most use-cases- `log_n = 15` (`n = 32768`)- `r = 8`- `p = 1` - public func scrypt(_ payload: TSDKParamsOfScrypt, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func scrypt(_ payload: TSDKParamsOfScrypt, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "scrypt" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -409,7 +409,7 @@ public final class TSDKCryptoModule { /// Generates a key pair for signing from the secret key /// **NOTE:** In the result the secret key is actually the concatenationof secret and public keys (128 symbols hex string) by design of [NaCL](http://nacl.cr.yp.to/sign.html). /// See also [the stackexchange question](https://crypto.stackexchange.com/questions/54353/). - public func nacl_sign_keypair_from_secret_key(_ payload: TSDKParamsOfNaclSignKeyPairFromSecret, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_sign_keypair_from_secret_key(_ payload: TSDKParamsOfNaclSignKeyPairFromSecret, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_sign_keypair_from_secret_key" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -446,7 +446,7 @@ public final class TSDKCryptoModule { } /// Signs data using the signer's secret key. - public func nacl_sign(_ payload: TSDKParamsOfNaclSign, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_sign(_ payload: TSDKParamsOfNaclSign, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_sign" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -483,7 +483,7 @@ public final class TSDKCryptoModule { /// Verifies the signature and returns the unsigned message /// Verifies the signature in `signed` using the signer's public key `public`and returns the message `unsigned`. /// If the signature fails verification, crypto_sign_open raises an exception. - public func nacl_sign_open(_ payload: TSDKParamsOfNaclSignOpen, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_sign_open(_ payload: TSDKParamsOfNaclSignOpen, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_sign_open" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -521,7 +521,7 @@ public final class TSDKCryptoModule { /// Signs the message using the secret key and returns a signature. /// Signs the message `unsigned` using the secret key `secret`and returns a signature `signature`. - public func nacl_sign_detached(_ payload: TSDKParamsOfNaclSign, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_sign_detached(_ payload: TSDKParamsOfNaclSign, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_sign_detached" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -557,7 +557,7 @@ public final class TSDKCryptoModule { } /// Verifies the signature with public key and `unsigned` data. - public func nacl_sign_detached_verify(_ payload: TSDKParamsOfNaclSignDetachedVerify, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_sign_detached_verify(_ payload: TSDKParamsOfNaclSignDetachedVerify, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_sign_detached_verify" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -592,7 +592,7 @@ public final class TSDKCryptoModule { } /// Generates a random NaCl key pair - public func nacl_box_keypair(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_box_keypair(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_box_keypair" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -627,7 +627,7 @@ public final class TSDKCryptoModule { } /// Generates key pair from a secret key - public func nacl_box_keypair_from_secret_key(_ payload: TSDKParamsOfNaclBoxKeyPairFromSecret, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_box_keypair_from_secret_key(_ payload: TSDKParamsOfNaclBoxKeyPairFromSecret, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_box_keypair_from_secret_key" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -663,7 +663,7 @@ public final class TSDKCryptoModule { /// Public key authenticated encryption /// Encrypt and authenticate a message using the senders secret key, the receivers publickey, and a nonce. - public func nacl_box(_ payload: TSDKParamsOfNaclBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_box(_ payload: TSDKParamsOfNaclBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -699,7 +699,7 @@ public final class TSDKCryptoModule { } /// Decrypt and verify the cipher text using the receivers secret key, the senders public key, and the nonce. - public func nacl_box_open(_ payload: TSDKParamsOfNaclBoxOpen, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_box_open(_ payload: TSDKParamsOfNaclBoxOpen, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_box_open" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -734,7 +734,7 @@ public final class TSDKCryptoModule { } /// Encrypt and authenticate message using nonce and secret key. - public func nacl_secret_box(_ payload: TSDKParamsOfNaclSecretBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_secret_box(_ payload: TSDKParamsOfNaclSecretBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_secret_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -769,7 +769,7 @@ public final class TSDKCryptoModule { } /// Decrypts and verifies cipher text using `nonce` and secret `key`. - public func nacl_secret_box_open(_ payload: TSDKParamsOfNaclSecretBoxOpen, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func nacl_secret_box_open(_ payload: TSDKParamsOfNaclSecretBoxOpen, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "nacl_secret_box_open" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -804,7 +804,7 @@ public final class TSDKCryptoModule { } /// Prints the list of words from the specified dictionary - public func mnemonic_words(_ payload: TSDKParamsOfMnemonicWords, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func mnemonic_words(_ payload: TSDKParamsOfMnemonicWords, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "mnemonic_words" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -840,7 +840,7 @@ public final class TSDKCryptoModule { /// Generates a random mnemonic /// Generates a random mnemonic from the specified dictionary and word count - public func mnemonic_from_random(_ payload: TSDKParamsOfMnemonicFromRandom, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func mnemonic_from_random(_ payload: TSDKParamsOfMnemonicFromRandom, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "mnemonic_from_random" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -876,7 +876,7 @@ public final class TSDKCryptoModule { } /// Generates mnemonic from pre-generated entropy - public func mnemonic_from_entropy(_ payload: TSDKParamsOfMnemonicFromEntropy, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func mnemonic_from_entropy(_ payload: TSDKParamsOfMnemonicFromEntropy, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "mnemonic_from_entropy" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -912,7 +912,7 @@ public final class TSDKCryptoModule { /// Validates a mnemonic phrase /// The phrase supplied will be checked for word length and validated according to the checksumspecified in BIP0039. - public func mnemonic_verify(_ payload: TSDKParamsOfMnemonicVerify, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func mnemonic_verify(_ payload: TSDKParamsOfMnemonicVerify, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "mnemonic_verify" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -949,7 +949,7 @@ public final class TSDKCryptoModule { /// Derives a key pair for signing from the seed phrase /// Validates the seed phrase, generates master key and then derivesthe key pair from the master key and the specified path - public func mnemonic_derive_sign_keys(_ payload: TSDKParamsOfMnemonicDeriveSignKeys, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func mnemonic_derive_sign_keys(_ payload: TSDKParamsOfMnemonicDeriveSignKeys, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "mnemonic_derive_sign_keys" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -985,7 +985,7 @@ public final class TSDKCryptoModule { } /// Generates an extended master private key that will be the root for all the derived keys - public func hdkey_xprv_from_mnemonic(_ payload: TSDKParamsOfHDKeyXPrvFromMnemonic, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func hdkey_xprv_from_mnemonic(_ payload: TSDKParamsOfHDKeyXPrvFromMnemonic, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "hdkey_xprv_from_mnemonic" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1020,7 +1020,7 @@ public final class TSDKCryptoModule { } /// Returns extended private key derived from the specified extended private key and child index - public func hdkey_derive_from_xprv(_ payload: TSDKParamsOfHDKeyDeriveFromXPrv, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func hdkey_derive_from_xprv(_ payload: TSDKParamsOfHDKeyDeriveFromXPrv, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "hdkey_derive_from_xprv" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1055,7 +1055,7 @@ public final class TSDKCryptoModule { } /// Derives the extended private key from the specified key and path - public func hdkey_derive_from_xprv_path(_ payload: TSDKParamsOfHDKeyDeriveFromXPrvPath, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func hdkey_derive_from_xprv_path(_ payload: TSDKParamsOfHDKeyDeriveFromXPrvPath, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "hdkey_derive_from_xprv_path" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1090,7 +1090,7 @@ public final class TSDKCryptoModule { } /// Extracts the private key from the serialized extended private key - public func hdkey_secret_from_xprv(_ payload: TSDKParamsOfHDKeySecretFromXPrv, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func hdkey_secret_from_xprv(_ payload: TSDKParamsOfHDKeySecretFromXPrv, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "hdkey_secret_from_xprv" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1125,7 +1125,7 @@ public final class TSDKCryptoModule { } /// Extracts the public key from the serialized extended private key - public func hdkey_public_from_xprv(_ payload: TSDKParamsOfHDKeyPublicFromXPrv, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func hdkey_public_from_xprv(_ payload: TSDKParamsOfHDKeyPublicFromXPrv, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "hdkey_public_from_xprv" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1160,7 +1160,7 @@ public final class TSDKCryptoModule { } /// Performs symmetric `chacha20` encryption. - public func chacha20(_ payload: TSDKParamsOfChaCha20, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func chacha20(_ payload: TSDKParamsOfChaCha20, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "chacha20" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1199,7 +1199,7 @@ public final class TSDKCryptoModule { /// keys for signing and encryption, derived from this secret. /// Crypto Box encrypts original Seed Phrase with salt and password that is retrievedfrom `password_provider` callback, implemented on Application side. /// When used, decrypted secret shows up in core library's memory for a very short periodof time and then is immediately overwritten with zeroes. - public func create_crypto_box(_ payload: TSDKParamsOfCreateCryptoBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func create_crypto_box(_ payload: TSDKParamsOfCreateCryptoBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "create_crypto_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1238,7 +1238,7 @@ public final class TSDKCryptoModule { } /// Removes Crypto Box. Clears all secret data. - public func remove_crypto_box(_ payload: TSDKRegisteredCryptoBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func remove_crypto_box(_ payload: TSDKRegisteredCryptoBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "remove_crypto_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1273,7 +1273,7 @@ public final class TSDKCryptoModule { } /// Get Crypto Box Info. Used to get `encrypted_secret` that should be used for all the cryptobox initializations except the first one. - public func get_crypto_box_info(_ payload: TSDKRegisteredCryptoBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_crypto_box_info(_ payload: TSDKRegisteredCryptoBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_crypto_box_info" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1309,7 +1309,7 @@ public final class TSDKCryptoModule { /// Get Crypto Box Seed Phrase. /// Attention! Store this data in your application for a very short period of time and overwrite it with zeroes ASAP. - public func get_crypto_box_seed_phrase(_ payload: TSDKRegisteredCryptoBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_crypto_box_seed_phrase(_ payload: TSDKRegisteredCryptoBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_crypto_box_seed_phrase" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1345,7 +1345,7 @@ public final class TSDKCryptoModule { } /// Get handle of Signing Box derived from Crypto Box. - public func get_signing_box_from_crypto_box(_ payload: TSDKParamsOfGetSigningBoxFromCryptoBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_signing_box_from_crypto_box(_ payload: TSDKParamsOfGetSigningBoxFromCryptoBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_signing_box_from_crypto_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1382,7 +1382,7 @@ public final class TSDKCryptoModule { /// Gets Encryption Box from Crypto Box. /// Derives encryption keypair from cryptobox secret and hdpath andstores it in cache for `secret_lifetime`or until explicitly cleared by `clear_crypto_box_secret_cache` method. /// If `secret_lifetime` is not specified - overwrites encryption secret with zeroes immediately afterencryption operation. - public func get_encryption_box_from_crypto_box(_ payload: TSDKParamsOfGetEncryptionBoxFromCryptoBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_encryption_box_from_crypto_box(_ payload: TSDKParamsOfGetEncryptionBoxFromCryptoBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_encryption_box_from_crypto_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1419,7 +1419,7 @@ public final class TSDKCryptoModule { } /// Removes cached secrets (overwrites with zeroes) from all signing and encryption boxes, derived from crypto box. - public func clear_crypto_box_secret_cache(_ payload: TSDKRegisteredCryptoBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func clear_crypto_box_secret_cache(_ payload: TSDKRegisteredCryptoBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "clear_crypto_box_secret_cache" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1454,7 +1454,7 @@ public final class TSDKCryptoModule { } /// Register an application implemented signing box. - public func register_signing_box(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func register_signing_box(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "register_signing_box" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -1489,7 +1489,7 @@ public final class TSDKCryptoModule { } /// Creates a default signing box implementation. - public func get_signing_box(_ payload: TSDKKeyPair, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_signing_box(_ payload: TSDKKeyPair, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_signing_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1524,7 +1524,7 @@ public final class TSDKCryptoModule { } /// Returns public key of signing key pair. - public func signing_box_get_public_key(_ payload: TSDKRegisteredSigningBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func signing_box_get_public_key(_ payload: TSDKRegisteredSigningBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "signing_box_get_public_key" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1559,7 +1559,7 @@ public final class TSDKCryptoModule { } /// Returns signed user data. - public func signing_box_sign(_ payload: TSDKParamsOfSigningBoxSign, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func signing_box_sign(_ payload: TSDKParamsOfSigningBoxSign, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "signing_box_sign" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1594,7 +1594,7 @@ public final class TSDKCryptoModule { } /// Removes signing box from SDK. - public func remove_signing_box(_ payload: TSDKRegisteredSigningBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func remove_signing_box(_ payload: TSDKRegisteredSigningBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "remove_signing_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1629,7 +1629,7 @@ public final class TSDKCryptoModule { } /// Register an application implemented encryption box. - public func register_encryption_box(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func register_encryption_box(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "register_encryption_box" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -1664,7 +1664,7 @@ public final class TSDKCryptoModule { } /// Removes encryption box from SDK - public func remove_encryption_box(_ payload: TSDKRegisteredEncryptionBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func remove_encryption_box(_ payload: TSDKRegisteredEncryptionBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "remove_encryption_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1699,7 +1699,7 @@ public final class TSDKCryptoModule { } /// Queries info from the given encryption box - public func encryption_box_get_info(_ payload: TSDKParamsOfEncryptionBoxGetInfo, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encryption_box_get_info(_ payload: TSDKParamsOfEncryptionBoxGetInfo, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encryption_box_get_info" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1735,7 +1735,7 @@ public final class TSDKCryptoModule { /// Encrypts data using given encryption box Note. /// Block cipher algorithms pad data to cipher block size so encrypted data can be longer then original data. Client should store the original data size after encryption and use it afterdecryption to retrieve the original data from decrypted data. - public func encryption_box_encrypt(_ payload: TSDKParamsOfEncryptionBoxEncrypt, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encryption_box_encrypt(_ payload: TSDKParamsOfEncryptionBoxEncrypt, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encryption_box_encrypt" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1772,7 +1772,7 @@ public final class TSDKCryptoModule { /// Decrypts data using given encryption box Note. /// Block cipher algorithms pad data to cipher block size so encrypted data can be longer then original data. Client should store the original data size after encryption and use it afterdecryption to retrieve the original data from decrypted data. - public func encryption_box_decrypt(_ payload: TSDKParamsOfEncryptionBoxDecrypt, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func encryption_box_decrypt(_ payload: TSDKParamsOfEncryptionBoxDecrypt, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "encryption_box_decrypt" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -1808,7 +1808,7 @@ public final class TSDKCryptoModule { } /// Creates encryption box with specified algorithm - public func create_encryption_box(_ payload: TSDKParamsOfCreateEncryptionBox, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func create_encryption_box(_ payload: TSDKParamsOfCreateEncryptionBox, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "create_encryption_box" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Crypto/CryptoTypes.swift b/Sources/EverscaleClientSwift/Crypto/CryptoTypes.swift index f47536c..984e7fc 100644 --- a/Sources/EverscaleClientSwift/Crypto/CryptoTypes.swift +++ b/Sources/EverscaleClientSwift/Crypto/CryptoTypes.swift @@ -112,7 +112,7 @@ public enum TSDKResultOfAppEncryptionBoxEnumTypes: String, Codable { case Decrypt = "Decrypt" } -public struct TSDKEncryptionBoxInfo: Codable { +public struct TSDKEncryptionBoxInfo: Codable, @unchecked Sendable { /// Derivation path, for instance "m/44'/396'/0'/0/0" public var hdpath: String? /// Cryptographic algorithm, used by this encryption box @@ -130,7 +130,7 @@ public struct TSDKEncryptionBoxInfo: Codable { } } -public struct TSDKEncryptionAlgorithm: Codable { +public struct TSDKEncryptionAlgorithm: Codable, @unchecked Sendable { public var type: TSDKEncryptionAlgorithmEnumTypes public var value: TSDKAesParamsEB? @@ -140,7 +140,7 @@ public struct TSDKEncryptionAlgorithm: Codable { } } -public struct TSDKAesParamsEB: Codable { +public struct TSDKAesParamsEB: Codable, @unchecked Sendable { public var mode: TSDKCipherMode public var key: String public var iv: String? @@ -152,7 +152,7 @@ public struct TSDKAesParamsEB: Codable { } } -public struct TSDKAesInfo: Codable { +public struct TSDKAesInfo: Codable, @unchecked Sendable { public var mode: TSDKCipherMode public var iv: String? @@ -162,7 +162,7 @@ public struct TSDKAesInfo: Codable { } } -public struct TSDKChaCha20ParamsEB: Codable { +public struct TSDKChaCha20ParamsEB: Codable, @unchecked Sendable { /// 256-bit key. /// Must be encoded with `hex`. public var key: String @@ -176,7 +176,7 @@ public struct TSDKChaCha20ParamsEB: Codable { } } -public struct TSDKNaclBoxParamsEB: Codable { +public struct TSDKNaclBoxParamsEB: Codable, @unchecked Sendable { /// 256-bit key. /// Must be encoded with `hex`. public var their_public: String @@ -194,7 +194,7 @@ public struct TSDKNaclBoxParamsEB: Codable { } } -public struct TSDKNaclSecretBoxParamsEB: Codable { +public struct TSDKNaclSecretBoxParamsEB: Codable, @unchecked Sendable { /// Secret key - unprefixed 0-padded to 64 symbols hex string public var key: String /// Nonce in `hex` @@ -206,7 +206,7 @@ public struct TSDKNaclSecretBoxParamsEB: Codable { } } -public struct TSDKCryptoBoxSecret: Codable { +public struct TSDKCryptoBoxSecret: Codable, @unchecked Sendable { public var type: TSDKCryptoBoxSecretEnumTypes public var dictionary: TSDKMnemonicDictionary? public var wordcount: UInt8? @@ -224,7 +224,7 @@ public struct TSDKCryptoBoxSecret: Codable { } /// Crypto Box Secret. -public struct TSDKBoxEncryptionAlgorithm: Codable { +public struct TSDKBoxEncryptionAlgorithm: Codable, @unchecked Sendable { public var type: TSDKBoxEncryptionAlgorithmEnumTypes public var value: TSDKChaCha20ParamsCB? @@ -234,7 +234,7 @@ public struct TSDKBoxEncryptionAlgorithm: Codable { } } -public struct TSDKChaCha20ParamsCB: Codable { +public struct TSDKChaCha20ParamsCB: Codable, @unchecked Sendable { /// 96-bit nonce. /// Must be encoded with `hex`. public var nonce: String @@ -244,7 +244,7 @@ public struct TSDKChaCha20ParamsCB: Codable { } } -public struct TSDKNaclBoxParamsCB: Codable { +public struct TSDKNaclBoxParamsCB: Codable, @unchecked Sendable { /// 256-bit key. /// Must be encoded with `hex`. public var their_public: String @@ -258,7 +258,7 @@ public struct TSDKNaclBoxParamsCB: Codable { } } -public struct TSDKNaclSecretBoxParamsCB: Codable { +public struct TSDKNaclSecretBoxParamsCB: Codable, @unchecked Sendable { /// Nonce in `hex` public var nonce: String @@ -267,7 +267,7 @@ public struct TSDKNaclSecretBoxParamsCB: Codable { } } -public struct TSDKParamsOfFactorize: Codable { +public struct TSDKParamsOfFactorize: Codable, @unchecked Sendable { /// Hexadecimal representation of u64 composite number. public var composite: String @@ -276,7 +276,7 @@ public struct TSDKParamsOfFactorize: Codable { } } -public struct TSDKResultOfFactorize: Codable { +public struct TSDKResultOfFactorize: Codable, @unchecked Sendable { /// Two factors of composite or empty if composite can't be factorized. public var factors: [String] @@ -285,7 +285,7 @@ public struct TSDKResultOfFactorize: Codable { } } -public struct TSDKParamsOfModularPower: Codable { +public struct TSDKParamsOfModularPower: Codable, @unchecked Sendable { /// `base` argument of calculation. public var base: String /// `exponent` argument of calculation. @@ -300,7 +300,7 @@ public struct TSDKParamsOfModularPower: Codable { } } -public struct TSDKResultOfModularPower: Codable { +public struct TSDKResultOfModularPower: Codable, @unchecked Sendable { /// Result of modular exponentiation public var modular_power: String @@ -309,7 +309,7 @@ public struct TSDKResultOfModularPower: Codable { } } -public struct TSDKParamsOfTonCrc16: Codable { +public struct TSDKParamsOfTonCrc16: Codable, @unchecked Sendable { /// Input data for CRC calculation. /// Encoded with `base64`. public var data: String @@ -319,7 +319,7 @@ public struct TSDKParamsOfTonCrc16: Codable { } } -public struct TSDKResultOfTonCrc16: Codable { +public struct TSDKResultOfTonCrc16: Codable, @unchecked Sendable { /// Calculated CRC for input data. public var crc: UInt16 @@ -328,7 +328,7 @@ public struct TSDKResultOfTonCrc16: Codable { } } -public struct TSDKParamsOfGenerateRandomBytes: Codable { +public struct TSDKParamsOfGenerateRandomBytes: Codable, @unchecked Sendable { /// Size of random byte array. public var length: UInt32 @@ -337,7 +337,7 @@ public struct TSDKParamsOfGenerateRandomBytes: Codable { } } -public struct TSDKResultOfGenerateRandomBytes: Codable { +public struct TSDKResultOfGenerateRandomBytes: Codable, @unchecked Sendable { /// Generated bytes encoded in `base64`. public var bytes: String @@ -346,7 +346,7 @@ public struct TSDKResultOfGenerateRandomBytes: Codable { } } -public struct TSDKParamsOfConvertPublicKeyToTonSafeFormat: Codable { +public struct TSDKParamsOfConvertPublicKeyToTonSafeFormat: Codable, @unchecked Sendable { /// Public key - 64 symbols hex string public var public_key: String @@ -355,7 +355,7 @@ public struct TSDKParamsOfConvertPublicKeyToTonSafeFormat: Codable { } } -public struct TSDKResultOfConvertPublicKeyToTonSafeFormat: Codable { +public struct TSDKResultOfConvertPublicKeyToTonSafeFormat: Codable, @unchecked Sendable { /// Public key represented in TON safe format. public var ton_public_key: String @@ -364,7 +364,7 @@ public struct TSDKResultOfConvertPublicKeyToTonSafeFormat: Codable { } } -public struct TSDKKeyPair: Codable { +public struct TSDKKeyPair: Codable, @unchecked Sendable { /// Public key - 64 symbols hex string public var `public`: String /// Private key - u64 symbols hex string @@ -376,7 +376,7 @@ public struct TSDKKeyPair: Codable { } } -public struct TSDKParamsOfSign: Codable { +public struct TSDKParamsOfSign: Codable, @unchecked Sendable { /// Data that must be signed encoded in `base64`. public var unsigned: String /// Sign keys. @@ -388,7 +388,7 @@ public struct TSDKParamsOfSign: Codable { } } -public struct TSDKResultOfSign: Codable { +public struct TSDKResultOfSign: Codable, @unchecked Sendable { /// Signed data combined with signature encoded in `base64`. public var signed: String /// Signature encoded in `hex`. @@ -400,7 +400,7 @@ public struct TSDKResultOfSign: Codable { } } -public struct TSDKParamsOfVerifySignature: Codable { +public struct TSDKParamsOfVerifySignature: Codable, @unchecked Sendable { /// Signed data that must be verified encoded in `base64`. public var signed: String /// Signer's public key - 64 symbols hex string @@ -412,7 +412,7 @@ public struct TSDKParamsOfVerifySignature: Codable { } } -public struct TSDKResultOfVerifySignature: Codable { +public struct TSDKResultOfVerifySignature: Codable, @unchecked Sendable { /// Unsigned data encoded in `base64`. public var unsigned: String @@ -421,7 +421,7 @@ public struct TSDKResultOfVerifySignature: Codable { } } -public struct TSDKParamsOfHash: Codable { +public struct TSDKParamsOfHash: Codable, @unchecked Sendable { /// Input data for hash calculation. /// Encoded with `base64`. public var data: String @@ -431,7 +431,7 @@ public struct TSDKParamsOfHash: Codable { } } -public struct TSDKResultOfHash: Codable { +public struct TSDKResultOfHash: Codable, @unchecked Sendable { /// Hash of input `data`. /// Encoded with 'hex'. public var hash: String @@ -441,7 +441,7 @@ public struct TSDKResultOfHash: Codable { } } -public struct TSDKParamsOfScrypt: Codable { +public struct TSDKParamsOfScrypt: Codable, @unchecked Sendable { /// The password bytes to be hashed. Must be encoded with `base64`. public var password: String /// Salt bytes that modify the hash to protect against Rainbow table attacks. Must be encoded with `base64`. @@ -465,7 +465,7 @@ public struct TSDKParamsOfScrypt: Codable { } } -public struct TSDKResultOfScrypt: Codable { +public struct TSDKResultOfScrypt: Codable, @unchecked Sendable { /// Derived key. /// Encoded with `hex`. public var key: String @@ -475,7 +475,7 @@ public struct TSDKResultOfScrypt: Codable { } } -public struct TSDKParamsOfNaclSignKeyPairFromSecret: Codable { +public struct TSDKParamsOfNaclSignKeyPairFromSecret: Codable, @unchecked Sendable { /// Secret key - unprefixed 0-padded to 64 symbols hex string public var secret: String @@ -484,7 +484,7 @@ public struct TSDKParamsOfNaclSignKeyPairFromSecret: Codable { } } -public struct TSDKParamsOfNaclSign: Codable { +public struct TSDKParamsOfNaclSign: Codable, @unchecked Sendable { /// Data that must be signed encoded in `base64`. public var unsigned: String /// Signer's secret key - unprefixed 0-padded to 128 symbols hex string (concatenation of 64 symbols secret and 64 symbols public keys). See `nacl_sign_keypair_from_secret_key`. @@ -496,7 +496,7 @@ public struct TSDKParamsOfNaclSign: Codable { } } -public struct TSDKResultOfNaclSign: Codable { +public struct TSDKResultOfNaclSign: Codable, @unchecked Sendable { /// Signed data, encoded in `base64`. public var signed: String @@ -505,7 +505,7 @@ public struct TSDKResultOfNaclSign: Codable { } } -public struct TSDKParamsOfNaclSignOpen: Codable { +public struct TSDKParamsOfNaclSignOpen: Codable, @unchecked Sendable { /// Signed data that must be unsigned. /// Encoded with `base64`. public var signed: String @@ -518,7 +518,7 @@ public struct TSDKParamsOfNaclSignOpen: Codable { } } -public struct TSDKResultOfNaclSignOpen: Codable { +public struct TSDKResultOfNaclSignOpen: Codable, @unchecked Sendable { /// Unsigned data, encoded in `base64`. public var unsigned: String @@ -527,7 +527,7 @@ public struct TSDKResultOfNaclSignOpen: Codable { } } -public struct TSDKResultOfNaclSignDetached: Codable { +public struct TSDKResultOfNaclSignDetached: Codable, @unchecked Sendable { /// Signature encoded in `hex`. public var signature: String @@ -536,7 +536,7 @@ public struct TSDKResultOfNaclSignDetached: Codable { } } -public struct TSDKParamsOfNaclSignDetachedVerify: Codable { +public struct TSDKParamsOfNaclSignDetachedVerify: Codable, @unchecked Sendable { /// Unsigned data that must be verified. /// Encoded with `base64`. public var unsigned: String @@ -553,7 +553,7 @@ public struct TSDKParamsOfNaclSignDetachedVerify: Codable { } } -public struct TSDKResultOfNaclSignDetachedVerify: Codable { +public struct TSDKResultOfNaclSignDetachedVerify: Codable, @unchecked Sendable { /// `true` if verification succeeded or `false` if it failed public var succeeded: Bool @@ -562,7 +562,7 @@ public struct TSDKResultOfNaclSignDetachedVerify: Codable { } } -public struct TSDKParamsOfNaclBoxKeyPairFromSecret: Codable { +public struct TSDKParamsOfNaclBoxKeyPairFromSecret: Codable, @unchecked Sendable { /// Secret key - unprefixed 0-padded to 64 symbols hex string public var secret: String @@ -571,7 +571,7 @@ public struct TSDKParamsOfNaclBoxKeyPairFromSecret: Codable { } } -public struct TSDKParamsOfNaclBox: Codable { +public struct TSDKParamsOfNaclBox: Codable, @unchecked Sendable { /// Data that must be encrypted encoded in `base64`. public var decrypted: String /// Nonce, encoded in `hex` @@ -589,7 +589,7 @@ public struct TSDKParamsOfNaclBox: Codable { } } -public struct TSDKResultOfNaclBox: Codable { +public struct TSDKResultOfNaclBox: Codable, @unchecked Sendable { /// Encrypted data encoded in `base64`. public var encrypted: String @@ -598,7 +598,7 @@ public struct TSDKResultOfNaclBox: Codable { } } -public struct TSDKParamsOfNaclBoxOpen: Codable { +public struct TSDKParamsOfNaclBoxOpen: Codable, @unchecked Sendable { /// Data that must be decrypted. /// Encoded with `base64`. public var encrypted: String @@ -617,7 +617,7 @@ public struct TSDKParamsOfNaclBoxOpen: Codable { } } -public struct TSDKResultOfNaclBoxOpen: Codable { +public struct TSDKResultOfNaclBoxOpen: Codable, @unchecked Sendable { /// Decrypted data encoded in `base64`. public var decrypted: String @@ -626,7 +626,7 @@ public struct TSDKResultOfNaclBoxOpen: Codable { } } -public struct TSDKParamsOfNaclSecretBox: Codable { +public struct TSDKParamsOfNaclSecretBox: Codable, @unchecked Sendable { /// Data that must be encrypted. /// Encoded with `base64`. public var decrypted: String @@ -642,7 +642,7 @@ public struct TSDKParamsOfNaclSecretBox: Codable { } } -public struct TSDKParamsOfNaclSecretBoxOpen: Codable { +public struct TSDKParamsOfNaclSecretBoxOpen: Codable, @unchecked Sendable { /// Data that must be decrypted. /// Encoded with `base64`. public var encrypted: String @@ -658,7 +658,7 @@ public struct TSDKParamsOfNaclSecretBoxOpen: Codable { } } -public struct TSDKParamsOfMnemonicWords: Codable { +public struct TSDKParamsOfMnemonicWords: Codable, @unchecked Sendable { /// Dictionary identifier public var dictionary: TSDKMnemonicDictionary? @@ -667,7 +667,7 @@ public struct TSDKParamsOfMnemonicWords: Codable { } } -public struct TSDKResultOfMnemonicWords: Codable { +public struct TSDKResultOfMnemonicWords: Codable, @unchecked Sendable { /// The list of mnemonic words public var words: String @@ -676,7 +676,7 @@ public struct TSDKResultOfMnemonicWords: Codable { } } -public struct TSDKParamsOfMnemonicFromRandom: Codable { +public struct TSDKParamsOfMnemonicFromRandom: Codable, @unchecked Sendable { /// Dictionary identifier public var dictionary: TSDKMnemonicDictionary? /// Mnemonic word count @@ -688,7 +688,7 @@ public struct TSDKParamsOfMnemonicFromRandom: Codable { } } -public struct TSDKResultOfMnemonicFromRandom: Codable { +public struct TSDKResultOfMnemonicFromRandom: Codable, @unchecked Sendable { /// String of mnemonic words public var phrase: String @@ -697,7 +697,7 @@ public struct TSDKResultOfMnemonicFromRandom: Codable { } } -public struct TSDKParamsOfMnemonicFromEntropy: Codable { +public struct TSDKParamsOfMnemonicFromEntropy: Codable, @unchecked Sendable { /// Entropy bytes. /// Hex encoded. public var entropy: String @@ -713,7 +713,7 @@ public struct TSDKParamsOfMnemonicFromEntropy: Codable { } } -public struct TSDKResultOfMnemonicFromEntropy: Codable { +public struct TSDKResultOfMnemonicFromEntropy: Codable, @unchecked Sendable { /// Phrase public var phrase: String @@ -722,7 +722,7 @@ public struct TSDKResultOfMnemonicFromEntropy: Codable { } } -public struct TSDKParamsOfMnemonicVerify: Codable { +public struct TSDKParamsOfMnemonicVerify: Codable, @unchecked Sendable { /// Phrase public var phrase: String /// Dictionary identifier @@ -737,7 +737,7 @@ public struct TSDKParamsOfMnemonicVerify: Codable { } } -public struct TSDKResultOfMnemonicVerify: Codable { +public struct TSDKResultOfMnemonicVerify: Codable, @unchecked Sendable { /// Flag indicating if the mnemonic is valid or not public var valid: Bool @@ -746,7 +746,7 @@ public struct TSDKResultOfMnemonicVerify: Codable { } } -public struct TSDKParamsOfMnemonicDeriveSignKeys: Codable { +public struct TSDKParamsOfMnemonicDeriveSignKeys: Codable, @unchecked Sendable { /// Phrase public var phrase: String /// Derivation path, for instance "m/44'/396'/0'/0/0" @@ -764,7 +764,7 @@ public struct TSDKParamsOfMnemonicDeriveSignKeys: Codable { } } -public struct TSDKParamsOfHDKeyXPrvFromMnemonic: Codable { +public struct TSDKParamsOfHDKeyXPrvFromMnemonic: Codable, @unchecked Sendable { /// String with seed phrase public var phrase: String /// Dictionary identifier @@ -779,7 +779,7 @@ public struct TSDKParamsOfHDKeyXPrvFromMnemonic: Codable { } } -public struct TSDKResultOfHDKeyXPrvFromMnemonic: Codable { +public struct TSDKResultOfHDKeyXPrvFromMnemonic: Codable, @unchecked Sendable { /// Serialized extended master private key public var xprv: String @@ -788,7 +788,7 @@ public struct TSDKResultOfHDKeyXPrvFromMnemonic: Codable { } } -public struct TSDKParamsOfHDKeyDeriveFromXPrv: Codable { +public struct TSDKParamsOfHDKeyDeriveFromXPrv: Codable, @unchecked Sendable { /// Serialized extended private key public var xprv: String /// Child index (see BIP-0032) @@ -803,7 +803,7 @@ public struct TSDKParamsOfHDKeyDeriveFromXPrv: Codable { } } -public struct TSDKResultOfHDKeyDeriveFromXPrv: Codable { +public struct TSDKResultOfHDKeyDeriveFromXPrv: Codable, @unchecked Sendable { /// Serialized extended private key public var xprv: String @@ -812,7 +812,7 @@ public struct TSDKResultOfHDKeyDeriveFromXPrv: Codable { } } -public struct TSDKParamsOfHDKeyDeriveFromXPrvPath: Codable { +public struct TSDKParamsOfHDKeyDeriveFromXPrvPath: Codable, @unchecked Sendable { /// Serialized extended private key public var xprv: String /// Derivation path, for instance "m/44'/396'/0'/0/0" @@ -824,7 +824,7 @@ public struct TSDKParamsOfHDKeyDeriveFromXPrvPath: Codable { } } -public struct TSDKResultOfHDKeyDeriveFromXPrvPath: Codable { +public struct TSDKResultOfHDKeyDeriveFromXPrvPath: Codable, @unchecked Sendable { /// Derived serialized extended private key public var xprv: String @@ -833,7 +833,7 @@ public struct TSDKResultOfHDKeyDeriveFromXPrvPath: Codable { } } -public struct TSDKParamsOfHDKeySecretFromXPrv: Codable { +public struct TSDKParamsOfHDKeySecretFromXPrv: Codable, @unchecked Sendable { /// Serialized extended private key public var xprv: String @@ -842,7 +842,7 @@ public struct TSDKParamsOfHDKeySecretFromXPrv: Codable { } } -public struct TSDKResultOfHDKeySecretFromXPrv: Codable { +public struct TSDKResultOfHDKeySecretFromXPrv: Codable, @unchecked Sendable { /// Private key - 64 symbols hex string public var secret: String @@ -851,7 +851,7 @@ public struct TSDKResultOfHDKeySecretFromXPrv: Codable { } } -public struct TSDKParamsOfHDKeyPublicFromXPrv: Codable { +public struct TSDKParamsOfHDKeyPublicFromXPrv: Codable, @unchecked Sendable { /// Serialized extended private key public var xprv: String @@ -860,7 +860,7 @@ public struct TSDKParamsOfHDKeyPublicFromXPrv: Codable { } } -public struct TSDKResultOfHDKeyPublicFromXPrv: Codable { +public struct TSDKResultOfHDKeyPublicFromXPrv: Codable, @unchecked Sendable { /// Public key - 64 symbols hex string public var `public`: String @@ -869,7 +869,7 @@ public struct TSDKResultOfHDKeyPublicFromXPrv: Codable { } } -public struct TSDKParamsOfChaCha20: Codable { +public struct TSDKParamsOfChaCha20: Codable, @unchecked Sendable { /// Source data to be encrypted or decrypted. /// Must be encoded with `base64`. public var data: String @@ -887,7 +887,7 @@ public struct TSDKParamsOfChaCha20: Codable { } } -public struct TSDKResultOfChaCha20: Codable { +public struct TSDKResultOfChaCha20: Codable, @unchecked Sendable { /// Encrypted/decrypted data. /// Encoded with `base64`. public var data: String @@ -897,7 +897,7 @@ public struct TSDKResultOfChaCha20: Codable { } } -public struct TSDKParamsOfCreateCryptoBox: Codable { +public struct TSDKParamsOfCreateCryptoBox: Codable, @unchecked Sendable { /// Salt used for secret encryption. For example, a mobile device can use device ID as salt. public var secret_encryption_salt: String /// Cryptobox secret @@ -909,7 +909,7 @@ public struct TSDKParamsOfCreateCryptoBox: Codable { } } -public struct TSDKRegisteredCryptoBox: Codable { +public struct TSDKRegisteredCryptoBox: Codable, @unchecked Sendable { public var handle: TSDKCryptoBoxHandle public init(handle: TSDKCryptoBoxHandle) { @@ -917,7 +917,7 @@ public struct TSDKRegisteredCryptoBox: Codable { } } -public struct TSDKParamsOfAppPasswordProvider: Codable { +public struct TSDKParamsOfAppPasswordProvider: Codable, @unchecked Sendable { public var type: TSDKParamsOfAppPasswordProviderEnumTypes /// Temporary library pubkey, that is used on application side for password encryption, along with application temporary private key and nonce. Used for password decryption on library side. public var encryption_public_key: String? @@ -931,7 +931,7 @@ public struct TSDKParamsOfAppPasswordProvider: Codable { /// Interface that provides a callback that returns an encrypted password, used for cryptobox secret encryption /// To secure the password while passing it from application to the library,the library generates a temporary key pair, passes the pubkeyto the passwordProvider, decrypts the received password with private key,and deletes the key pair right away. /// Application should generate a temporary nacl_box_keypairand encrypt the password with naclbox function using nacl_box_keypair.secretand encryption_public_key keys + nonce = 24-byte prefix of encryption_public_key. -public struct TSDKResultOfAppPasswordProvider: Codable { +public struct TSDKResultOfAppPasswordProvider: Codable, @unchecked Sendable { public var type: TSDKResultOfAppPasswordProviderEnumTypes /// Password, encrypted and encoded to base64. Crypto box uses this password to decrypt its secret (seed phrase). public var encrypted_password: String? @@ -946,7 +946,7 @@ public struct TSDKResultOfAppPasswordProvider: Codable { } } -public struct TSDKResultOfGetCryptoBoxInfo: Codable { +public struct TSDKResultOfGetCryptoBoxInfo: Codable, @unchecked Sendable { /// Secret (seed phrase) encrypted with salt and password. public var encrypted_secret: String @@ -955,7 +955,7 @@ public struct TSDKResultOfGetCryptoBoxInfo: Codable { } } -public struct TSDKResultOfGetCryptoBoxSeedPhrase: Codable { +public struct TSDKResultOfGetCryptoBoxSeedPhrase: Codable, @unchecked Sendable { public var phrase: String public var dictionary: TSDKMnemonicDictionary public var wordcount: UInt8 @@ -967,7 +967,7 @@ public struct TSDKResultOfGetCryptoBoxSeedPhrase: Codable { } } -public struct TSDKParamsOfGetSigningBoxFromCryptoBox: Codable { +public struct TSDKParamsOfGetSigningBoxFromCryptoBox: Codable, @unchecked Sendable { /// Crypto Box Handle. public var handle: UInt32 /// HD key derivation path. @@ -983,7 +983,7 @@ public struct TSDKParamsOfGetSigningBoxFromCryptoBox: Codable { } } -public struct TSDKRegisteredSigningBox: Codable { +public struct TSDKRegisteredSigningBox: Codable, @unchecked Sendable { /// Handle of the signing box. public var handle: TSDKSigningBoxHandle @@ -992,7 +992,7 @@ public struct TSDKRegisteredSigningBox: Codable { } } -public struct TSDKParamsOfGetEncryptionBoxFromCryptoBox: Codable { +public struct TSDKParamsOfGetEncryptionBoxFromCryptoBox: Codable, @unchecked Sendable { /// Crypto Box Handle. public var handle: UInt32 /// HD key derivation path. @@ -1011,7 +1011,7 @@ public struct TSDKParamsOfGetEncryptionBoxFromCryptoBox: Codable { } } -public struct TSDKRegisteredEncryptionBox: Codable { +public struct TSDKRegisteredEncryptionBox: Codable, @unchecked Sendable { /// Handle of the encryption box. public var handle: TSDKEncryptionBoxHandle @@ -1020,7 +1020,7 @@ public struct TSDKRegisteredEncryptionBox: Codable { } } -public struct TSDKParamsOfAppSigningBox: Codable { +public struct TSDKParamsOfAppSigningBox: Codable, @unchecked Sendable { public var type: TSDKParamsOfAppSigningBoxEnumTypes /// Data to sign encoded as base64 public var unsigned: String? @@ -1032,7 +1032,7 @@ public struct TSDKParamsOfAppSigningBox: Codable { } /// Signing box callbacks. -public struct TSDKResultOfAppSigningBox: Codable { +public struct TSDKResultOfAppSigningBox: Codable, @unchecked Sendable { public var type: TSDKResultOfAppSigningBoxEnumTypes /// Signing box public key public var public_key: String? @@ -1047,7 +1047,7 @@ public struct TSDKResultOfAppSigningBox: Codable { } /// Returning values from signing box callbacks. -public struct TSDKResultOfSigningBoxGetPublicKey: Codable { +public struct TSDKResultOfSigningBoxGetPublicKey: Codable, @unchecked Sendable { /// Public key of signing box. /// Encoded with hex public var pubkey: String @@ -1057,7 +1057,7 @@ public struct TSDKResultOfSigningBoxGetPublicKey: Codable { } } -public struct TSDKParamsOfSigningBoxSign: Codable { +public struct TSDKParamsOfSigningBoxSign: Codable, @unchecked Sendable { /// Signing Box handle. public var signing_box: TSDKSigningBoxHandle /// Unsigned user data. @@ -1070,7 +1070,7 @@ public struct TSDKParamsOfSigningBoxSign: Codable { } } -public struct TSDKResultOfSigningBoxSign: Codable { +public struct TSDKResultOfSigningBoxSign: Codable, @unchecked Sendable { /// Data signature. /// Encoded with `hex`. public var signature: String @@ -1080,7 +1080,7 @@ public struct TSDKResultOfSigningBoxSign: Codable { } } -public struct TSDKParamsOfAppEncryptionBox: Codable { +public struct TSDKParamsOfAppEncryptionBox: Codable, @unchecked Sendable { public var type: TSDKParamsOfAppEncryptionBoxEnumTypes /// Data, encoded in Base64 public var data: String? @@ -1092,7 +1092,7 @@ public struct TSDKParamsOfAppEncryptionBox: Codable { } /// Interface for data encryption/decryption -public struct TSDKResultOfAppEncryptionBox: Codable { +public struct TSDKResultOfAppEncryptionBox: Codable, @unchecked Sendable { public var type: TSDKResultOfAppEncryptionBoxEnumTypes public var info: TSDKEncryptionBoxInfo? /// Encrypted data, encoded in Base64 @@ -1106,7 +1106,7 @@ public struct TSDKResultOfAppEncryptionBox: Codable { } /// Returning values from signing box callbacks. -public struct TSDKParamsOfEncryptionBoxGetInfo: Codable { +public struct TSDKParamsOfEncryptionBoxGetInfo: Codable, @unchecked Sendable { /// Encryption box handle public var encryption_box: TSDKEncryptionBoxHandle @@ -1115,7 +1115,7 @@ public struct TSDKParamsOfEncryptionBoxGetInfo: Codable { } } -public struct TSDKResultOfEncryptionBoxGetInfo: Codable { +public struct TSDKResultOfEncryptionBoxGetInfo: Codable, @unchecked Sendable { /// Encryption box information public var info: TSDKEncryptionBoxInfo @@ -1124,7 +1124,7 @@ public struct TSDKResultOfEncryptionBoxGetInfo: Codable { } } -public struct TSDKParamsOfEncryptionBoxEncrypt: Codable { +public struct TSDKParamsOfEncryptionBoxEncrypt: Codable, @unchecked Sendable { /// Encryption box handle public var encryption_box: TSDKEncryptionBoxHandle /// Data to be encrypted, encoded in Base64 @@ -1136,7 +1136,7 @@ public struct TSDKParamsOfEncryptionBoxEncrypt: Codable { } } -public struct TSDKResultOfEncryptionBoxEncrypt: Codable { +public struct TSDKResultOfEncryptionBoxEncrypt: Codable, @unchecked Sendable { /// Encrypted data, encoded in Base64. /// Padded to cipher block size public var data: String @@ -1146,7 +1146,7 @@ public struct TSDKResultOfEncryptionBoxEncrypt: Codable { } } -public struct TSDKParamsOfEncryptionBoxDecrypt: Codable { +public struct TSDKParamsOfEncryptionBoxDecrypt: Codable, @unchecked Sendable { /// Encryption box handle public var encryption_box: TSDKEncryptionBoxHandle /// Data to be decrypted, encoded in Base64 @@ -1158,7 +1158,7 @@ public struct TSDKParamsOfEncryptionBoxDecrypt: Codable { } } -public struct TSDKResultOfEncryptionBoxDecrypt: Codable { +public struct TSDKResultOfEncryptionBoxDecrypt: Codable, @unchecked Sendable { /// Decrypted data, encoded in Base64. public var data: String @@ -1167,7 +1167,7 @@ public struct TSDKResultOfEncryptionBoxDecrypt: Codable { } } -public struct TSDKParamsOfCreateEncryptionBox: Codable { +public struct TSDKParamsOfCreateEncryptionBox: Codable, @unchecked Sendable { /// Encryption algorithm specifier including cipher parameters (key, IV, etc) public var algorithm: TSDKEncryptionAlgorithm diff --git a/Sources/EverscaleClientSwift/Debot/Debot.swift b/Sources/EverscaleClientSwift/Debot/Debot.swift index c735775..f9b484f 100644 --- a/Sources/EverscaleClientSwift/Debot/Debot.swift +++ b/Sources/EverscaleClientSwift/Debot/Debot.swift @@ -10,7 +10,7 @@ public final class TSDKDebotModule { /// [UNSTABLE](UNSTABLE.md) [DEPRECATED](DEPRECATED.md) Creates and instance of DeBot. /// Downloads debot smart contract (code and data) from blockchain and createsan instance of Debot Engine for it. /// # RemarksIt does not switch debot to context 0. Browser Callbacks are not called. - public func initialize(_ payload: TSDKParamsOfInit, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func initialize(_ payload: TSDKParamsOfInit, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "init" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -52,7 +52,7 @@ public final class TSDKDebotModule { /// While the function is executing, several Browser Callbacks can be called,since the debot tries to display all actions from the context 0 to the user. /// When the debot starts SDK registers `BrowserCallbacks` AppObject. /// Therefore when `debote.remove` is called the debot is being deleted and the callback is calledwith `finish`=`true` which indicates that it will never be used again. - public func start(_ payload: TSDKParamsOfStart, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func start(_ payload: TSDKParamsOfStart, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "start" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -93,7 +93,7 @@ public final class TSDKDebotModule { /// [UNSTABLE](UNSTABLE.md) [DEPRECATED](DEPRECATED.md) Fetches DeBot metadata from blockchain. /// Downloads DeBot from blockchain and creates and fetches its metadata. - public func fetch(_ payload: TSDKParamsOfFetch, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func fetch(_ payload: TSDKParamsOfFetch, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "fetch" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -132,7 +132,7 @@ public final class TSDKDebotModule { /// Calls debot engine referenced by debot handle to execute input action. /// Calls Debot Browser Callbacks if needed. /// # RemarksChain of actions can be executed if input action generates a list of subactions. - public func execute(_ payload: TSDKParamsOfExecute, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func execute(_ payload: TSDKParamsOfExecute, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "execute" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -171,7 +171,7 @@ public final class TSDKDebotModule { /// [UNSTABLE](UNSTABLE.md) [DEPRECATED](DEPRECATED.md) Sends message to Debot. /// Used by Debot Browser to send response on Dinterface call or from other Debots. - public func send(_ payload: TSDKParamsOfSend, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func send(_ payload: TSDKParamsOfSend, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "send" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -208,7 +208,7 @@ public final class TSDKDebotModule { /// [UNSTABLE](UNSTABLE.md) [DEPRECATED](DEPRECATED.md) Destroys debot handle. /// Removes handle from Client Context and drops debot engine referenced by that handle. - public func remove(_ payload: TSDKParamsOfRemove, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func remove(_ payload: TSDKParamsOfRemove, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "remove" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Debot/DebotTypes.swift b/Sources/EverscaleClientSwift/Debot/DebotTypes.swift index bc265be..5b94a5d 100644 --- a/Sources/EverscaleClientSwift/Debot/DebotTypes.swift +++ b/Sources/EverscaleClientSwift/Debot/DebotTypes.swift @@ -43,7 +43,7 @@ public enum TSDKResultOfAppDebotBrowserEnumTypes: String, Codable { case Approve = "Approve" } -public struct TSDKDebotAction: Codable { +public struct TSDKDebotAction: Codable, @unchecked Sendable { /// A short action description. /// Should be used by Debot Browser as name of menu item. public var description: String @@ -71,7 +71,7 @@ public struct TSDKDebotAction: Codable { } } -public struct TSDKDebotInfo: Codable { +public struct TSDKDebotInfo: Codable, @unchecked Sendable { /// DeBot short name. public var name: String? /// DeBot semantic version. @@ -113,7 +113,7 @@ public struct TSDKDebotInfo: Codable { } } -public struct TSDKDebotActivity: Codable { +public struct TSDKDebotActivity: Codable, @unchecked Sendable { public var type: TSDKDebotActivityEnumTypes /// External inbound message BOC. public var msg: String? @@ -143,7 +143,7 @@ public struct TSDKDebotActivity: Codable { } /// [UNSTABLE](UNSTABLE.md) [DEPRECATED](DEPRECATED.md) Describes the operation that the DeBot wants to perform. -public struct TSDKSpending: Codable { +public struct TSDKSpending: Codable, @unchecked Sendable { /// Amount of nanotokens that will be sent to `dst` address. public var amount: Int /// Destination address of recipient of funds. @@ -155,7 +155,7 @@ public struct TSDKSpending: Codable { } } -public struct TSDKParamsOfInit: Codable { +public struct TSDKParamsOfInit: Codable, @unchecked Sendable { /// Debot smart contract address public var address: String @@ -164,7 +164,7 @@ public struct TSDKParamsOfInit: Codable { } } -public struct TSDKRegisteredDebot: Codable { +public struct TSDKRegisteredDebot: Codable, @unchecked Sendable { /// Debot handle which references an instance of debot engine. public var debot_handle: TSDKDebotHandle /// Debot abi as json string. @@ -179,7 +179,7 @@ public struct TSDKRegisteredDebot: Codable { } } -public struct TSDKParamsOfAppDebotBrowser: Codable { +public struct TSDKParamsOfAppDebotBrowser: Codable, @unchecked Sendable { public var type: TSDKParamsOfAppDebotBrowserEnumTypes /// A string that must be printed to user. public var msg: String? @@ -211,7 +211,7 @@ public struct TSDKParamsOfAppDebotBrowser: Codable { /// [UNSTABLE](UNSTABLE.md) [DEPRECATED](DEPRECATED.md) Debot Browser callbacks /// Called by debot engine to communicate with debot browser. -public struct TSDKResultOfAppDebotBrowser: Codable { +public struct TSDKResultOfAppDebotBrowser: Codable, @unchecked Sendable { public var type: TSDKResultOfAppDebotBrowserEnumTypes /// String entered by user. public var value: String? @@ -230,7 +230,7 @@ public struct TSDKResultOfAppDebotBrowser: Codable { } /// [UNSTABLE](UNSTABLE.md) [DEPRECATED](DEPRECATED.md) Returning values from Debot Browser callbacks. -public struct TSDKParamsOfStart: Codable { +public struct TSDKParamsOfStart: Codable, @unchecked Sendable { /// Debot handle which references an instance of debot engine. public var debot_handle: TSDKDebotHandle @@ -239,7 +239,7 @@ public struct TSDKParamsOfStart: Codable { } } -public struct TSDKParamsOfFetch: Codable { +public struct TSDKParamsOfFetch: Codable, @unchecked Sendable { /// Debot smart contract address. public var address: String @@ -248,7 +248,7 @@ public struct TSDKParamsOfFetch: Codable { } } -public struct TSDKResultOfFetch: Codable { +public struct TSDKResultOfFetch: Codable, @unchecked Sendable { /// Debot metadata. public var info: TSDKDebotInfo @@ -257,7 +257,7 @@ public struct TSDKResultOfFetch: Codable { } } -public struct TSDKParamsOfExecute: Codable { +public struct TSDKParamsOfExecute: Codable, @unchecked Sendable { /// Debot handle which references an instance of debot engine. public var debot_handle: TSDKDebotHandle /// Debot Action that must be executed. @@ -269,7 +269,7 @@ public struct TSDKParamsOfExecute: Codable { } } -public struct TSDKParamsOfSend: Codable { +public struct TSDKParamsOfSend: Codable, @unchecked Sendable { /// Debot handle which references an instance of debot engine. public var debot_handle: TSDKDebotHandle /// BOC of internal message to debot encoded in base64 format. @@ -281,7 +281,7 @@ public struct TSDKParamsOfSend: Codable { } } -public struct TSDKParamsOfRemove: Codable { +public struct TSDKParamsOfRemove: Codable, @unchecked Sendable { /// Debot handle which references an instance of debot engine. public var debot_handle: TSDKDebotHandle diff --git a/Sources/EverscaleClientSwift/Extensions/SimpleEnv.swift b/Sources/EverscaleClientSwift/Extensions/SimpleEnv.swift index 10a534d..818b6fc 100644 --- a/Sources/EverscaleClientSwift/Extensions/SimpleEnv.swift +++ b/Sources/EverscaleClientSwift/Extensions/SimpleEnv.swift @@ -5,14 +5,15 @@ import Foundation import SwiftRegularExpression + public final class SimpleEnv { - private static var env: [String: String] = .init() + nonisolated(unsafe) private static var env: [String: String] = .init() private static let debugEnvName: String = "debug" private static let adhocEnvName: String = "production" private static let productionEnvName: String = "production" - public static var path: String = "./" + nonisolated(unsafe) public static var path: String = "./" public class subscript(_ key: String) -> String? { if env.count == 0 { diff --git a/Sources/EverscaleClientSwift/Net/Net.swift b/Sources/EverscaleClientSwift/Net/Net.swift index f9ae25a..7399f1b 100644 --- a/Sources/EverscaleClientSwift/Net/Net.swift +++ b/Sources/EverscaleClientSwift/Net/Net.swift @@ -8,7 +8,7 @@ public final class TSDKNetModule { } /// Performs DAppServer GraphQL query. - public func query(_ payload: TSDKParamsOfQuery, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func query(_ payload: TSDKParamsOfQuery, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "query" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -43,7 +43,7 @@ public final class TSDKNetModule { } /// Performs multiple queries per single fetch. - public func batch_query(_ payload: TSDKParamsOfBatchQuery, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func batch_query(_ payload: TSDKParamsOfBatchQuery, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "batch_query" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -80,7 +80,7 @@ public final class TSDKNetModule { /// Queries collection data /// Queries data that satisfies the `filter` conditions,limits the number of returned records and orders them. /// The projection fields are limited to `result` fields - public func query_collection(_ payload: TSDKParamsOfQueryCollection, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func query_collection(_ payload: TSDKParamsOfQueryCollection, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "query_collection" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -118,7 +118,7 @@ public final class TSDKNetModule { /// Aggregates collection data. /// Aggregates values from the specified `fields` for recordsthat satisfies the `filter` conditions, - public func aggregate_collection(_ payload: TSDKParamsOfAggregateCollection, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func aggregate_collection(_ payload: TSDKParamsOfAggregateCollection, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "aggregate_collection" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -158,7 +158,7 @@ public final class TSDKNetModule { /// If object that satisfies the `filter` conditionsalready exists - returns it immediately. /// If not - waits for insert/update of data within the specified `timeout`,and returns it. /// The projection fields are limited to `result` fields - public func wait_for_collection(_ payload: TSDKParamsOfWaitForCollection, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func wait_for_collection(_ payload: TSDKParamsOfWaitForCollection, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "wait_for_collection" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -198,7 +198,7 @@ public final class TSDKNetModule { /// Cancels a subscription /// Cancels a subscription specified by its handle. - public func unsubscribe(_ payload: TSDKResultOfSubscribeCollection, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func unsubscribe(_ payload: TSDKResultOfSubscribeCollection, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "unsubscribe" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -226,7 +226,7 @@ public final class TSDKNetModule { /// Application can use several ways to handle this situation: /// - If application monitors changes for the single blockchainobject (for example specific account): applicationcan perform a query for this object and handle actual data as aregular data from the subscription. /// - If application monitors sequence of some blockchain objects(for example transactions of the specific account): application mustrefresh all cached (or visible to user) lists where this sequences presents. - public func subscribe_collection(_ payload: TSDKParamsOfSubscribeCollection, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func subscribe_collection(_ payload: TSDKParamsOfSubscribeCollection, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "subscribe_collection" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -250,7 +250,7 @@ public final class TSDKNetModule { /// Application can use several ways to handle this situation: /// - If application monitors changes for the singleobject (for example specific account): applicationcan perform a query for this object and handle actual data as aregular data from the subscription. /// - If application monitors sequence of some objects(for example transactions of the specific account): application mustrefresh all cached (or visible to user) lists where this sequences presents. - public func subscribe(_ payload: TSDKParamsOfSubscribe, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func subscribe(_ payload: TSDKParamsOfSubscribe, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "subscribe" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -261,7 +261,7 @@ public final class TSDKNetModule { } /// Suspends network module to stop any network activity - public func suspend(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func suspend(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "suspend" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -296,7 +296,7 @@ public final class TSDKNetModule { } /// Resumes network module to enable network activity - public func resume(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func resume(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "resume" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -331,7 +331,7 @@ public final class TSDKNetModule { } /// Returns ID of the last block in a specified account shard - public func find_last_shard_block(_ payload: TSDKParamsOfFindLastShardBlock, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func find_last_shard_block(_ payload: TSDKParamsOfFindLastShardBlock, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "find_last_shard_block" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -366,7 +366,7 @@ public final class TSDKNetModule { } /// Requests the list of alternative endpoints from server - public func fetch_endpoints(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func fetch_endpoints(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "fetch_endpoints" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -401,7 +401,7 @@ public final class TSDKNetModule { } /// Sets the list of endpoints to use on reinit - public func set_endpoints(_ payload: TSDKEndpointsSet, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func set_endpoints(_ payload: TSDKEndpointsSet, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "set_endpoints" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -436,7 +436,7 @@ public final class TSDKNetModule { } /// Requests the list of alternative endpoints from server - public func get_endpoints(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_endpoints(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_endpoints" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in @@ -472,7 +472,7 @@ public final class TSDKNetModule { /// Allows to query and paginate through the list of accounts that the specified account has interacted with, sorted by the time of the last internal message between accounts /// *Attention* this query retrieves data from 'Counterparties' service which is not supported inthe opensource version of DApp Server (and will not be supported) as well as in Evernode SE (will be supported in SE in future),but is always accessible via [EVER OS Clouds](../ton-os-api/networks.md) - public func query_counterparties(_ payload: TSDKParamsOfQueryCounterparties, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func query_counterparties(_ payload: TSDKParamsOfQueryCounterparties, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "query_counterparties" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -526,7 +526,7 @@ public final class TSDKNetModule { /// To summarize, it is guaranteed that each message in `result.messages` has the corresponding transactionin the `result.transactions`. /// But there is no guarantee that all messages from transactions `out_msgs` arepresented in `result.messages`. /// So the application has to continue retrieval for missing messages if it requires. - public func query_transaction_tree(_ payload: TSDKParamsOfQueryTransactionTree, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func query_transaction_tree(_ payload: TSDKParamsOfQueryTransactionTree, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "query_transaction_tree" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -588,7 +588,7 @@ public final class TSDKNetModule { /// Items iterated is a JSON objects with block data. The minimal set of returnedfields is: /// ```textidgen_utimeworkchain_idshardafter_splitafter_mergeprev_ref { root_hash}prev_alt_ref { root_hash}```Application can request additional fields in the `result` parameter. /// Application should call the `remove_iterator` when iterator is no longer required. - public func create_block_iterator(_ payload: TSDKParamsOfCreateBlockIterator, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func create_block_iterator(_ payload: TSDKParamsOfCreateBlockIterator, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "create_block_iterator" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -634,7 +634,7 @@ public final class TSDKNetModule { /// Resumes block iterator. /// The iterator stays exactly at the same position where the `resume_state` was caught. /// Application should call the `remove_iterator` when iterator is no longer required. - public func resume_block_iterator(_ payload: TSDKParamsOfResumeBlockIterator, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func resume_block_iterator(_ payload: TSDKParamsOfResumeBlockIterator, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "resume_block_iterator" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -689,7 +689,7 @@ public final class TSDKNetModule { /// - counterparty – account address of the transfer source or destination depending on `isDeposit`. /// - value – amount of nano tokens transferred. The value is represented as a decimal stringbecause the actual value can be more precise than the JSON number can represent. Applicationmust use this string carefully – conversion to number can follow to loose of precision. /// Application should call the `remove_iterator` when iterator is no longer required. - public func create_transaction_iterator(_ payload: TSDKParamsOfCreateTransactionIterator, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func create_transaction_iterator(_ payload: TSDKParamsOfCreateTransactionIterator, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "create_transaction_iterator" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -745,7 +745,7 @@ public final class TSDKNetModule { /// The iterator stays exactly at the same position where the `resume_state` was caught. /// Note that `resume_state` doesn't store the account filter. If the application requiresto use the same account filter as it was when the iterator was created then the applicationmust pass the account filter again in `accounts_filter` parameter. /// Application should call the `remove_iterator` when iterator is no longer required. - public func resume_transaction_iterator(_ payload: TSDKParamsOfResumeTransactionIterator, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func resume_transaction_iterator(_ payload: TSDKParamsOfResumeTransactionIterator, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "resume_transaction_iterator" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -789,7 +789,7 @@ public final class TSDKNetModule { /// If application requests resume state in `return_resume_state` parameterthen this function returns `resume_state` that can be used later toresume the iteration from the position after returned items. /// The structure of the items returned depends on the iterator used. /// See the description to the appropriated iterator creation function. - public func iterator_next(_ payload: TSDKParamsOfIteratorNext, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func iterator_next(_ payload: TSDKParamsOfIteratorNext, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "iterator_next" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -832,7 +832,7 @@ public final class TSDKNetModule { /// Removes an iterator /// Frees all resources allocated in library to serve iterator. /// Application always should call the `remove_iterator` when iteratoris no longer required. - public func remove_iterator(_ payload: TSDKRegisteredIterator, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func remove_iterator(_ payload: TSDKRegisteredIterator, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "remove_iterator" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -869,7 +869,7 @@ public final class TSDKNetModule { } /// Returns signature ID for configured network if it should be used in messages signature - public func get_signature_id(_ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_signature_id(_ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_signature_id" try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Net/NetTypes.swift b/Sources/EverscaleClientSwift/Net/NetTypes.swift index 77e532a..bbb18f6 100644 --- a/Sources/EverscaleClientSwift/Net/NetTypes.swift +++ b/Sources/EverscaleClientSwift/Net/NetTypes.swift @@ -43,7 +43,7 @@ public enum TSDKAggregationFn: String, Codable { case AVERAGE = "AVERAGE" } -public struct TSDKOrderBy: Codable { +public struct TSDKOrderBy: Codable, @unchecked Sendable { public var path: String public var direction: TSDKSortDirection @@ -53,7 +53,7 @@ public struct TSDKOrderBy: Codable { } } -public struct TSDKParamsOfQueryOperation: Codable { +public struct TSDKParamsOfQueryOperation: Codable, @unchecked Sendable { public var type: TSDKParamsOfQueryOperationEnumTypes public init(type: TSDKParamsOfQueryOperationEnumTypes) { @@ -61,7 +61,7 @@ public struct TSDKParamsOfQueryOperation: Codable { } } -public struct TSDKFieldAggregation: Codable { +public struct TSDKFieldAggregation: Codable, @unchecked Sendable { /// Dot separated path to the field public var field: String /// Aggregation function that must be applied to field values @@ -73,7 +73,7 @@ public struct TSDKFieldAggregation: Codable { } } -public struct TSDKTransactionNode: Codable { +public struct TSDKTransactionNode: Codable, @unchecked Sendable { /// Transaction id. public var id: String /// In message id. @@ -100,7 +100,7 @@ public struct TSDKTransactionNode: Codable { } } -public struct TSDKMessageNode: Codable { +public struct TSDKMessageNode: Codable, @unchecked Sendable { /// Message id. public var id: String /// Source transaction id. @@ -134,7 +134,7 @@ public struct TSDKMessageNode: Codable { } } -public struct TSDKParamsOfQuery: Codable { +public struct TSDKParamsOfQuery: Codable, @unchecked Sendable { /// GraphQL query text. public var query: String /// Variables used in query. @@ -147,7 +147,7 @@ public struct TSDKParamsOfQuery: Codable { } } -public struct TSDKResultOfQuery: Codable { +public struct TSDKResultOfQuery: Codable, @unchecked Sendable { /// Result provided by DAppServer. public var result: AnyValue @@ -156,7 +156,7 @@ public struct TSDKResultOfQuery: Codable { } } -public struct TSDKParamsOfBatchQuery: Codable { +public struct TSDKParamsOfBatchQuery: Codable, @unchecked Sendable { /// List of query operations that must be performed per single fetch. public var operations: [TSDKParamsOfQueryOperation] @@ -165,7 +165,7 @@ public struct TSDKParamsOfBatchQuery: Codable { } } -public struct TSDKResultOfBatchQuery: Codable { +public struct TSDKResultOfBatchQuery: Codable, @unchecked Sendable { /// Result values for batched queries. /// Returns an array of values. Each value corresponds to `queries` item. public var results: [AnyValue] @@ -175,7 +175,7 @@ public struct TSDKResultOfBatchQuery: Codable { } } -public struct TSDKParamsOfQueryCollection: Codable { +public struct TSDKParamsOfQueryCollection: Codable, @unchecked Sendable { /// Collection name (accounts, blocks, transactions, messages, block_signatures) public var collection: String /// Collection filter @@ -196,7 +196,7 @@ public struct TSDKParamsOfQueryCollection: Codable { } } -public struct TSDKResultOfQueryCollection: Codable { +public struct TSDKResultOfQueryCollection: Codable, @unchecked Sendable { /// Objects that match the provided criteria public var result: [AnyValue] @@ -205,7 +205,7 @@ public struct TSDKResultOfQueryCollection: Codable { } } -public struct TSDKParamsOfAggregateCollection: Codable { +public struct TSDKParamsOfAggregateCollection: Codable, @unchecked Sendable { /// Collection name (accounts, blocks, transactions, messages, block_signatures) public var collection: String /// Collection filter @@ -220,7 +220,7 @@ public struct TSDKParamsOfAggregateCollection: Codable { } } -public struct TSDKResultOfAggregateCollection: Codable { +public struct TSDKResultOfAggregateCollection: Codable, @unchecked Sendable { /// Values for requested fields. /// Returns an array of strings. Each string refers to the corresponding `fields` item. /// Numeric value is returned as a decimal string representations. @@ -231,7 +231,7 @@ public struct TSDKResultOfAggregateCollection: Codable { } } -public struct TSDKParamsOfWaitForCollection: Codable { +public struct TSDKParamsOfWaitForCollection: Codable, @unchecked Sendable { /// Collection name (accounts, blocks, transactions, messages, block_signatures) public var collection: String /// Collection filter @@ -249,7 +249,7 @@ public struct TSDKParamsOfWaitForCollection: Codable { } } -public struct TSDKResultOfWaitForCollection: Codable { +public struct TSDKResultOfWaitForCollection: Codable, @unchecked Sendable { /// First found object that matches the provided criteria public var result: AnyValue @@ -258,7 +258,7 @@ public struct TSDKResultOfWaitForCollection: Codable { } } -public struct TSDKResultOfSubscribeCollection: Codable { +public struct TSDKResultOfSubscribeCollection: Codable, @unchecked Sendable { /// Subscription handle. /// Must be closed with `unsubscribe` public var handle: UInt32 @@ -268,7 +268,7 @@ public struct TSDKResultOfSubscribeCollection: Codable { } } -public struct TSDKParamsOfSubscribeCollection: Codable { +public struct TSDKParamsOfSubscribeCollection: Codable, @unchecked Sendable { /// Collection name (accounts, blocks, transactions, messages, block_signatures) public var collection: String /// Collection filter @@ -283,7 +283,7 @@ public struct TSDKParamsOfSubscribeCollection: Codable { } } -public struct TSDKParamsOfSubscribe: Codable { +public struct TSDKParamsOfSubscribe: Codable, @unchecked Sendable { /// GraphQL subscription text. public var subscription: String /// Variables used in subscription. @@ -296,7 +296,7 @@ public struct TSDKParamsOfSubscribe: Codable { } } -public struct TSDKParamsOfFindLastShardBlock: Codable { +public struct TSDKParamsOfFindLastShardBlock: Codable, @unchecked Sendable { /// Account address public var address: String @@ -305,7 +305,7 @@ public struct TSDKParamsOfFindLastShardBlock: Codable { } } -public struct TSDKResultOfFindLastShardBlock: Codable { +public struct TSDKResultOfFindLastShardBlock: Codable, @unchecked Sendable { /// Account shard last block ID public var block_id: String @@ -314,7 +314,7 @@ public struct TSDKResultOfFindLastShardBlock: Codable { } } -public struct TSDKEndpointsSet: Codable { +public struct TSDKEndpointsSet: Codable, @unchecked Sendable { /// List of endpoints provided by server public var endpoints: [String] @@ -323,7 +323,7 @@ public struct TSDKEndpointsSet: Codable { } } -public struct TSDKResultOfGetEndpoints: Codable { +public struct TSDKResultOfGetEndpoints: Codable, @unchecked Sendable { /// Current query endpoint public var query: String /// List of all endpoints used by client @@ -335,7 +335,7 @@ public struct TSDKResultOfGetEndpoints: Codable { } } -public struct TSDKParamsOfQueryCounterparties: Codable { +public struct TSDKParamsOfQueryCounterparties: Codable, @unchecked Sendable { /// Account address public var account: String /// Projection (result) string @@ -353,7 +353,7 @@ public struct TSDKParamsOfQueryCounterparties: Codable { } } -public struct TSDKParamsOfQueryTransactionTree: Codable { +public struct TSDKParamsOfQueryTransactionTree: Codable, @unchecked Sendable { /// Input message id. public var in_msg: String /// List of contract ABIs that will be used to decode message bodies. Library will try to decode each returned message body using any ABI from the registry. @@ -375,7 +375,7 @@ public struct TSDKParamsOfQueryTransactionTree: Codable { } } -public struct TSDKResultOfQueryTransactionTree: Codable { +public struct TSDKResultOfQueryTransactionTree: Codable, @unchecked Sendable { /// Messages. public var messages: [TSDKMessageNode] /// Transactions. @@ -387,7 +387,7 @@ public struct TSDKResultOfQueryTransactionTree: Codable { } } -public struct TSDKParamsOfCreateBlockIterator: Codable { +public struct TSDKParamsOfCreateBlockIterator: Codable, @unchecked Sendable { /// Starting time to iterate from. /// If the application specifies this parameter then the iterationincludes blocks with `gen_utime` >= `start_time`. /// Otherwise the iteration starts from zero state. @@ -418,7 +418,7 @@ public struct TSDKParamsOfCreateBlockIterator: Codable { } } -public struct TSDKRegisteredIterator: Codable { +public struct TSDKRegisteredIterator: Codable, @unchecked Sendable { /// Iterator handle. /// Must be removed using `remove_iterator`when it is no more needed for the application. public var handle: UInt32 @@ -428,7 +428,7 @@ public struct TSDKRegisteredIterator: Codable { } } -public struct TSDKParamsOfResumeBlockIterator: Codable { +public struct TSDKParamsOfResumeBlockIterator: Codable, @unchecked Sendable { /// Iterator state from which to resume. /// Same as value returned from `iterator_next`. public var resume_state: AnyValue @@ -438,7 +438,7 @@ public struct TSDKParamsOfResumeBlockIterator: Codable { } } -public struct TSDKParamsOfCreateTransactionIterator: Codable { +public struct TSDKParamsOfCreateTransactionIterator: Codable, @unchecked Sendable { /// Starting time to iterate from. /// If the application specifies this parameter then the iterationincludes blocks with `gen_utime` >= `start_time`. /// Otherwise the iteration starts from zero state. @@ -481,7 +481,7 @@ public struct TSDKParamsOfCreateTransactionIterator: Codable { } } -public struct TSDKParamsOfResumeTransactionIterator: Codable { +public struct TSDKParamsOfResumeTransactionIterator: Codable, @unchecked Sendable { /// Iterator state from which to resume. /// Same as value returned from `iterator_next`. public var resume_state: AnyValue @@ -498,7 +498,7 @@ public struct TSDKParamsOfResumeTransactionIterator: Codable { } } -public struct TSDKParamsOfIteratorNext: Codable { +public struct TSDKParamsOfIteratorNext: Codable, @unchecked Sendable { /// Iterator handle public var iterator: UInt32 /// Maximum count of the returned items. @@ -514,7 +514,7 @@ public struct TSDKParamsOfIteratorNext: Codable { } } -public struct TSDKResultOfIteratorNext: Codable { +public struct TSDKResultOfIteratorNext: Codable, @unchecked Sendable { /// Next available items. /// Note that `iterator_next` can return an empty items and `has_more` equals to `true`. /// In this case the application have to continue iteration. @@ -534,7 +534,7 @@ public struct TSDKResultOfIteratorNext: Codable { } } -public struct TSDKResultOfGetSignatureId: Codable { +public struct TSDKResultOfGetSignatureId: Codable, @unchecked Sendable { /// Signature ID for configured network if it should be used in messages signature public var signature_id: Int32? diff --git a/Sources/EverscaleClientSwift/Processing/Processing.swift b/Sources/EverscaleClientSwift/Processing/Processing.swift index 5a0eead..e3ce8fe 100644 --- a/Sources/EverscaleClientSwift/Processing/Processing.swift +++ b/Sources/EverscaleClientSwift/Processing/Processing.swift @@ -21,7 +21,7 @@ public final class TSDKProcessingModule { /// When both unresolved and resolved lists becomes empty, monitor stops any background activityand frees all allocated internal memory. /// If monitoring queue with specified name already exists then messages will be addedto the unresolved list. /// If monitoring queue with specified name does not exist then monitoring queue will be createdwith specified unresolved messages. - public func monitor_messages(_ payload: TSDKParamsOfMonitorMessages, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func monitor_messages(_ payload: TSDKParamsOfMonitorMessages, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "monitor_messages" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -69,7 +69,7 @@ public final class TSDKProcessingModule { } /// Returns summary information about current state of the specified monitoring queue. - public func get_monitor_info(_ payload: TSDKParamsOfGetMonitorInfo, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_monitor_info(_ payload: TSDKParamsOfGetMonitorInfo, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_monitor_info" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -106,7 +106,7 @@ public final class TSDKProcessingModule { /// Fetches next resolved results from the specified monitoring queue. /// Results and waiting options are depends on the `wait` parameter. /// All returned results will be removed from the queue's resolved list. - public func fetch_next_monitor_results(_ payload: TSDKParamsOfFetchNextMonitorResults, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func fetch_next_monitor_results(_ payload: TSDKParamsOfFetchNextMonitorResults, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "fetch_next_monitor_results" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -143,7 +143,7 @@ public final class TSDKProcessingModule { } /// Cancels all background activity and releases all allocated system resources for the specified monitoring queue. - public func cancel_monitor(_ payload: TSDKParamsOfCancelMonitor, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func cancel_monitor(_ payload: TSDKParamsOfCancelMonitor, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "cancel_monitor" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -178,7 +178,7 @@ public final class TSDKProcessingModule { } /// Sends specified messages to the blockchain. - public func send_messages(_ payload: TSDKParamsOfSendMessages, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func send_messages(_ payload: TSDKParamsOfSendMessages, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "send_messages" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -214,7 +214,7 @@ public final class TSDKProcessingModule { /// Sends message to the network /// Sends message to the network and returns the last generated shard block of the destination accountbefore the message was sent. It will be required later for message processing. - public func send_message(_ payload: TSDKParamsOfSendMessage, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func send_message(_ payload: TSDKParamsOfSendMessage, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "send_message" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -258,7 +258,7 @@ public final class TSDKProcessingModule { /// When the ABI header `expire` isn't present or `abi` parameterisn't specified, the processing uses `transaction waiting`strategy: /// - The maximum block gen time is set to `now() + transaction_wait_timeout`. /// - If maximum block gen time is reached and no result transaction is found,the processing will exit with an error. - public func wait_for_transaction(_ payload: TSDKParamsOfWaitForTransaction, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func wait_for_transaction(_ payload: TSDKParamsOfWaitForTransaction, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "wait_for_transaction" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -307,7 +307,7 @@ public final class TSDKProcessingModule { /// The intermediate events, such as `WillFetchFirstBlock`, `WillSend`, `DidSend`,`WillFetchNextBlock`, etc - are switched on/off by `send_events` flagand logged into the supplied callback function. /// The retry configuration parameters are defined in the client's `NetworkConfig` and `AbiConfig`. /// If contract's ABI does not include "expire" headerthen, if no transaction is found within the network timeout (see config parameter ), exits with error. - public func process_message(_ payload: TSDKParamsOfProcessMessage, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func process_message(_ payload: TSDKParamsOfProcessMessage, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "process_message" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Processing/ProcessingTypes.swift b/Sources/EverscaleClientSwift/Processing/ProcessingTypes.swift index 387e357..3f25f86 100644 --- a/Sources/EverscaleClientSwift/Processing/ProcessingTypes.swift +++ b/Sources/EverscaleClientSwift/Processing/ProcessingTypes.swift @@ -54,7 +54,7 @@ public enum TSDKMessageMonitoringStatus: String, Codable { case Reserved = "Reserved" } -public struct TSDKProcessingEvent: Codable { +public struct TSDKProcessingEvent: Codable, @unchecked Sendable { public var type: TSDKProcessingEventEnumTypes public var message_id: String? public var message_dst: String? @@ -76,7 +76,7 @@ public struct TSDKProcessingEvent: Codable { } } -public struct TSDKResultOfProcessMessage: Codable { +public struct TSDKResultOfProcessMessage: Codable, @unchecked Sendable { /// Parsed transaction. /// In addition to the regular transaction fields there is a`boc` field encoded with `base64` which contains sourcetransaction BOC. public var transaction: AnyValue @@ -96,7 +96,7 @@ public struct TSDKResultOfProcessMessage: Codable { } } -public struct TSDKDecodedOutput: Codable { +public struct TSDKDecodedOutput: Codable, @unchecked Sendable { /// Decoded bodies of the out messages. /// If the message can't be decoded, then `None` will be stored inthe appropriate position. public var out_messages: [TSDKDecodedMessageBody?] @@ -109,7 +109,7 @@ public struct TSDKDecodedOutput: Codable { } } -public struct TSDKMessageMonitoringTransactionCompute: Codable { +public struct TSDKMessageMonitoringTransactionCompute: Codable, @unchecked Sendable { /// Compute phase exit code. public var exit_code: Int32 @@ -118,7 +118,7 @@ public struct TSDKMessageMonitoringTransactionCompute: Codable { } } -public struct TSDKMessageMonitoringTransaction: Codable { +public struct TSDKMessageMonitoringTransaction: Codable, @unchecked Sendable { /// Hash of the transaction. Present if transaction was included into the blocks. When then transaction was emulated this field will be missing. public var hash: String? /// Aborted field of the transaction. @@ -133,7 +133,7 @@ public struct TSDKMessageMonitoringTransaction: Codable { } } -public struct TSDKMessageMonitoringParams: Codable { +public struct TSDKMessageMonitoringParams: Codable, @unchecked Sendable { /// Monitored message identification. Can be provided as a message's BOC or (hash, address) pair. BOC is a preferable way because it helps to determine possible error reason (using TVM execution of the message). public var message: TSDKMonitoredMessage /// Block time Must be specified as a UNIX timestamp in seconds @@ -148,7 +148,7 @@ public struct TSDKMessageMonitoringParams: Codable { } } -public struct TSDKMessageMonitoringResult: Codable { +public struct TSDKMessageMonitoringResult: Codable, @unchecked Sendable { /// Hash of the message. public var hash: String /// Processing status. @@ -169,7 +169,7 @@ public struct TSDKMessageMonitoringResult: Codable { } } -public struct TSDKMonitoredMessage: Codable { +public struct TSDKMonitoredMessage: Codable, @unchecked Sendable { public var type: TSDKMonitoredMessageEnumTypes public var boc: String? /// Hash of the message. @@ -185,7 +185,7 @@ public struct TSDKMonitoredMessage: Codable { } } -public struct TSDKMessageSendingParams: Codable { +public struct TSDKMessageSendingParams: Codable, @unchecked Sendable { /// BOC of the message, that must be sent to the blockchain. public var boc: String /// Expiration time of the message. Must be specified as a UNIX timestamp in seconds. @@ -200,7 +200,7 @@ public struct TSDKMessageSendingParams: Codable { } } -public struct TSDKParamsOfMonitorMessages: Codable { +public struct TSDKParamsOfMonitorMessages: Codable, @unchecked Sendable { /// Name of the monitoring queue. public var queue: String /// Messages to start monitoring for. @@ -212,7 +212,7 @@ public struct TSDKParamsOfMonitorMessages: Codable { } } -public struct TSDKParamsOfGetMonitorInfo: Codable { +public struct TSDKParamsOfGetMonitorInfo: Codable, @unchecked Sendable { /// Name of the monitoring queue. public var queue: String @@ -221,7 +221,7 @@ public struct TSDKParamsOfGetMonitorInfo: Codable { } } -public struct TSDKMonitoringQueueInfo: Codable { +public struct TSDKMonitoringQueueInfo: Codable, @unchecked Sendable { /// Count of the unresolved messages. public var unresolved: UInt32 /// Count of resolved results. @@ -233,7 +233,7 @@ public struct TSDKMonitoringQueueInfo: Codable { } } -public struct TSDKParamsOfFetchNextMonitorResults: Codable { +public struct TSDKParamsOfFetchNextMonitorResults: Codable, @unchecked Sendable { /// Name of the monitoring queue. public var queue: String /// Wait mode. @@ -246,7 +246,7 @@ public struct TSDKParamsOfFetchNextMonitorResults: Codable { } } -public struct TSDKResultOfFetchNextMonitorResults: Codable { +public struct TSDKResultOfFetchNextMonitorResults: Codable, @unchecked Sendable { /// List of the resolved results. public var results: [TSDKMessageMonitoringResult] @@ -255,7 +255,7 @@ public struct TSDKResultOfFetchNextMonitorResults: Codable { } } -public struct TSDKParamsOfCancelMonitor: Codable { +public struct TSDKParamsOfCancelMonitor: Codable, @unchecked Sendable { /// Name of the monitoring queue. public var queue: String @@ -264,7 +264,7 @@ public struct TSDKParamsOfCancelMonitor: Codable { } } -public struct TSDKParamsOfSendMessages: Codable { +public struct TSDKParamsOfSendMessages: Codable, @unchecked Sendable { /// Messages that must be sent to the blockchain. public var messages: [TSDKMessageSendingParams] /// Optional message monitor queue that starts monitoring for the processing results for sent messages. @@ -276,7 +276,7 @@ public struct TSDKParamsOfSendMessages: Codable { } } -public struct TSDKResultOfSendMessages: Codable { +public struct TSDKResultOfSendMessages: Codable, @unchecked Sendable { /// Messages that was sent to the blockchain for execution. public var messages: [TSDKMessageMonitoringParams] @@ -285,7 +285,7 @@ public struct TSDKResultOfSendMessages: Codable { } } -public struct TSDKParamsOfSendMessage: Codable { +public struct TSDKParamsOfSendMessage: Codable, @unchecked Sendable { /// Message BOC. public var message: String /// Optional message ABI. @@ -303,7 +303,7 @@ public struct TSDKParamsOfSendMessage: Codable { } } -public struct TSDKResultOfSendMessage: Codable { +public struct TSDKResultOfSendMessage: Codable, @unchecked Sendable { /// The last generated shard block of the message destination account before the message was sent. /// This block id must be used as a parameter of the`wait_for_transaction`. public var shard_block_id: String @@ -317,7 +317,7 @@ public struct TSDKResultOfSendMessage: Codable { } } -public struct TSDKParamsOfWaitForTransaction: Codable { +public struct TSDKParamsOfWaitForTransaction: Codable, @unchecked Sendable { /// Optional ABI for decoding the transaction result. /// If it is specified, then the output messages' bodies will bedecoded according to this ABI. /// The `abi_decoded` result field will be filled out. @@ -345,7 +345,7 @@ public struct TSDKParamsOfWaitForTransaction: Codable { } } -public struct TSDKParamsOfProcessMessage: Codable { +public struct TSDKParamsOfProcessMessage: Codable, @unchecked Sendable { /// Message encode parameters. public var message_encode_params: TSDKParamsOfEncodeMessage /// Flag for requesting events sending. Default is `false`. diff --git a/Sources/EverscaleClientSwift/Proofs/Proofs.swift b/Sources/EverscaleClientSwift/Proofs/Proofs.swift index 1494311..43a3bbf 100644 --- a/Sources/EverscaleClientSwift/Proofs/Proofs.swift +++ b/Sources/EverscaleClientSwift/Proofs/Proofs.swift @@ -24,7 +24,7 @@ public final class TSDKProofsModule { /// In future SDK releases, one will also be able to provide their hashes of trusted blocks forother networks, besides for MainNet and DevNet. /// By using trusted key-blocks, in order to prove any block, we can prove chain of key-blocks tothe closest previous trusted key-block, not only to the zero-state. /// But shard-blocks don't have proofs on DApp server. In this case, in order to prove any shard-block data, we search for a corresponding master-block, which contains the root hash of thisshard-block, or some shard block which is linked to that block in shard-chain. After provingthis master-block, we traverse through each link and calculate and compare hashes with links,one-by-one. After that we can ensure that this shard-block has also been proven. - public func proof_block_data(_ payload: TSDKParamsOfProofBlockData, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func proof_block_data(_ payload: TSDKParamsOfProofBlockData, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "proof_block_data" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -81,7 +81,7 @@ public final class TSDKProofsModule { /// If transaction's BOC and/or `block_id` are not provided in the JSON, they will be queried fromTONOS API. /// Please note, that joins (like `account`, `in_message`, `out_messages`, etc. in `Transaction`entity) are separated entities and not supported, so function will throw an exception in a caseif JSON being checked has such entities in it. /// For more information about proofs checking, see description of `proof_block_data` function. - public func proof_transaction_data(_ payload: TSDKParamsOfProofTransactionData, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func proof_transaction_data(_ payload: TSDKParamsOfProofTransactionData, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "proof_transaction_data" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -128,7 +128,7 @@ public final class TSDKProofsModule { /// If message's BOC and/or non-null `src_transaction.id` or `dst_transaction.id` are not providedin the JSON, they will be queried from TONOS API. /// Please note, that joins (like `block`, `dst_account`, `dst_transaction`, `src_account`,`src_transaction`, etc. in `Message` entity) are separated entities and not supported,so function will throw an exception in a case if JSON being checked has such entities in it. /// For more information about proofs checking, see description of `proof_block_data` function. - public func proof_message_data(_ payload: TSDKParamsOfProofMessageData, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func proof_message_data(_ payload: TSDKParamsOfProofMessageData, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "proof_message_data" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Proofs/ProofsTypes.swift b/Sources/EverscaleClientSwift/Proofs/ProofsTypes.swift index 438a7ba..b5e9275 100644 --- a/Sources/EverscaleClientSwift/Proofs/ProofsTypes.swift +++ b/Sources/EverscaleClientSwift/Proofs/ProofsTypes.swift @@ -9,7 +9,7 @@ public enum TSDKProofsErrorCode: Int, Codable { case DataDiffersFromProven = 904 } -public struct TSDKParamsOfProofBlockData: Codable { +public struct TSDKParamsOfProofBlockData: Codable, @unchecked Sendable { /// Single block's data, retrieved from TONOS API, that needs proof. Required fields are `id` and/or top-level `boc` (for block identification), others are optional. public var block: AnyValue @@ -18,7 +18,7 @@ public struct TSDKParamsOfProofBlockData: Codable { } } -public struct TSDKParamsOfProofTransactionData: Codable { +public struct TSDKParamsOfProofTransactionData: Codable, @unchecked Sendable { /// Single transaction's data as queried from DApp server, without modifications. The required fields are `id` and/or top-level `boc`, others are optional. In order to reduce network requests count, it is recommended to provide `block_id` and `boc` of transaction. public var transaction: AnyValue @@ -27,7 +27,7 @@ public struct TSDKParamsOfProofTransactionData: Codable { } } -public struct TSDKParamsOfProofMessageData: Codable { +public struct TSDKParamsOfProofMessageData: Codable, @unchecked Sendable { /// Single message's data as queried from DApp server, without modifications. The required fields are `id` and/or top-level `boc`, others are optional. In order to reduce network requests count, it is recommended to provide at least `boc` of message and non-null `src_transaction.id` or `dst_transaction.id`. public var message: AnyValue diff --git a/Sources/EverscaleClientSwift/Tvm/Tvm.swift b/Sources/EverscaleClientSwift/Tvm/Tvm.swift index df1a280..86e475c 100644 --- a/Sources/EverscaleClientSwift/Tvm/Tvm.swift +++ b/Sources/EverscaleClientSwift/Tvm/Tvm.swift @@ -24,7 +24,7 @@ public final class TSDKTvmModule { /// Also it requires message BOC. To get the message BOC - use `abi.encode_message` or `abi.encode_internal_message`. /// If you need this emulation to be as precise as possible (for instance - emulate transactionwith particular lt in particular block or use particular blockchain config,downloaded from a particular key block - then specify `execution_options` parameter. /// If you need to see the aborted transaction as a result, not as an error, set `skip_transaction_check` to `true`. - public func run_executor(_ payload: TSDKParamsOfRunExecutor, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func run_executor(_ payload: TSDKParamsOfRunExecutor, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "run_executor" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -80,7 +80,7 @@ public final class TSDKTvmModule { /// To get the account BOC (bag of cells) - use `net.query` method to download it from GraphQL API(field `boc` of `account`) or generate it with `abi.encode_account method`. /// To get the message BOC - use `abi.encode_message` or prepare it any other way, for instance, with FIFT script. /// Attention! Updated account state is produces as well, but only`account_state.storage.state.data` part of the BOC is updated. - public func run_tvm(_ payload: TSDKParamsOfRunTvm, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func run_tvm(_ payload: TSDKParamsOfRunTvm, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "run_tvm" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -121,7 +121,7 @@ public final class TSDKTvmModule { /// Executes a get-method of FIFT contract /// Executes a get-method of FIFT contract that fulfills the smc-guidelines https://test.ton.org/smc-guidelines.txtand returns the result data from TVM's stack - public func run_get(_ payload: TSDKParamsOfRunGet, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func run_get(_ payload: TSDKParamsOfRunGet, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "run_get" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Tvm/TvmTypes.swift b/Sources/EverscaleClientSwift/Tvm/TvmTypes.swift index c950f7e..4abdba4 100644 --- a/Sources/EverscaleClientSwift/Tvm/TvmTypes.swift +++ b/Sources/EverscaleClientSwift/Tvm/TvmTypes.swift @@ -26,7 +26,7 @@ public enum TSDKAccountForExecutorEnumTypes: String, Codable { case Account = "Account" } -public struct TSDKExecutionOptions: Codable { +public struct TSDKExecutionOptions: Codable, @unchecked Sendable { /// boc with config public var blockchain_config: String? /// time that is used as transaction time @@ -50,7 +50,7 @@ public struct TSDKExecutionOptions: Codable { } } -public struct TSDKAccountForExecutor: Codable { +public struct TSDKAccountForExecutor: Codable, @unchecked Sendable { public var type: TSDKAccountForExecutorEnumTypes /// Account BOC. /// Encoded as base64. @@ -66,7 +66,7 @@ public struct TSDKAccountForExecutor: Codable { } } -public struct TSDKTransactionFees: Codable { +public struct TSDKTransactionFees: Codable, @unchecked Sendable { /// Deprecated. /// Contains the same data as ext_in_msg_fee field public var in_msg_fwd_fee: Int @@ -102,7 +102,7 @@ public struct TSDKTransactionFees: Codable { } } -public struct TSDKParamsOfRunExecutor: Codable { +public struct TSDKParamsOfRunExecutor: Codable, @unchecked Sendable { /// Input message BOC. /// Must be encoded as base64. public var message: String @@ -132,7 +132,7 @@ public struct TSDKParamsOfRunExecutor: Codable { } } -public struct TSDKResultOfRunExecutor: Codable { +public struct TSDKResultOfRunExecutor: Codable, @unchecked Sendable { /// Parsed transaction. /// In addition to the regular transaction fields there is a`boc` field encoded with `base64` which contains sourcetransaction BOC. public var transaction: AnyValue @@ -156,7 +156,7 @@ public struct TSDKResultOfRunExecutor: Codable { } } -public struct TSDKParamsOfRunTvm: Codable { +public struct TSDKParamsOfRunTvm: Codable, @unchecked Sendable { /// Input message BOC. /// Must be encoded as base64. public var message: String @@ -184,7 +184,7 @@ public struct TSDKParamsOfRunTvm: Codable { } } -public struct TSDKResultOfRunTvm: Codable { +public struct TSDKResultOfRunTvm: Codable, @unchecked Sendable { /// List of output messages' BOCs. /// Encoded as `base64` public var out_messages: [String] @@ -201,7 +201,7 @@ public struct TSDKResultOfRunTvm: Codable { } } -public struct TSDKParamsOfRunGet: Codable { +public struct TSDKParamsOfRunGet: Codable, @unchecked Sendable { /// Account BOC in `base64` public var account: String /// Function name @@ -224,7 +224,7 @@ public struct TSDKParamsOfRunGet: Codable { } } -public struct TSDKResultOfRunGet: Codable { +public struct TSDKResultOfRunGet: Codable, @unchecked Sendable { /// Values returned by get-method on stack public var output: AnyValue diff --git a/Sources/EverscaleClientSwift/Utils/Utils.swift b/Sources/EverscaleClientSwift/Utils/Utils.swift index c0fbb0f..e87286e 100644 --- a/Sources/EverscaleClientSwift/Utils/Utils.swift +++ b/Sources/EverscaleClientSwift/Utils/Utils.swift @@ -8,7 +8,7 @@ public final class TSDKUtilsModule { } /// Converts address from any TON format to any TON format - public func convert_address(_ payload: TSDKParamsOfConvertAddress, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func convert_address(_ payload: TSDKParamsOfConvertAddress, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "convert_address" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -45,7 +45,7 @@ public final class TSDKUtilsModule { /// Validates and returns the type of any TON address. /// Address types are the following`0:919db8e740d50bf349df2eea03fa30c385d846b991ff5542e67098ee833fc7f7` - standard TON address mostcommonly used in all cases. Also called as hex address`919db8e740d50bf349df2eea03fa30c385d846b991ff5542e67098ee833fc7f7` - account ID. A part of fulladdress. Identifies account inside particular workchain`EQCRnbjnQNUL80nfLuoD+jDDhdhGuZH/VULmcJjugz/H9wam` - base64 address. Also called "user-friendly". /// Was used at the beginning of TON. Now it is supported for compatibility - public func get_address_type(_ payload: TSDKParamsOfGetAddressType, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func get_address_type(_ payload: TSDKParamsOfGetAddressType, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "get_address_type" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -82,7 +82,7 @@ public final class TSDKUtilsModule { } /// Calculates storage fee for an account over a specified time period - public func calc_storage_fee(_ payload: TSDKParamsOfCalcStorageFee, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func calc_storage_fee(_ payload: TSDKParamsOfCalcStorageFee, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "calc_storage_fee" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -117,7 +117,7 @@ public final class TSDKUtilsModule { } /// Compresses data using Zstandard algorithm - public func compress_zstd(_ payload: TSDKParamsOfCompressZstd, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func compress_zstd(_ payload: TSDKParamsOfCompressZstd, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "compress_zstd" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in @@ -152,7 +152,7 @@ public final class TSDKUtilsModule { } /// Decompresses data using Zstandard algorithm - public func decompress_zstd(_ payload: TSDKParamsOfDecompressZstd, _ handler: @escaping (TSDKBindingResponse) throws -> Void + public func decompress_zstd(_ payload: TSDKParamsOfDecompressZstd, _ handler: @escaping @Sendable (TSDKBindingResponse) throws -> Void ) throws { let method: String = "decompress_zstd" try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in diff --git a/Sources/EverscaleClientSwift/Utils/UtilsTypes.swift b/Sources/EverscaleClientSwift/Utils/UtilsTypes.swift index dc0bef4..df29309 100644 --- a/Sources/EverscaleClientSwift/Utils/UtilsTypes.swift +++ b/Sources/EverscaleClientSwift/Utils/UtilsTypes.swift @@ -14,7 +14,7 @@ public enum TSDKAccountAddressType: String, Codable { case Base64 = "Base64" } -public struct TSDKAddressStringFormat: Codable { +public struct TSDKAddressStringFormat: Codable, @unchecked Sendable { public var type: TSDKAddressStringFormatEnumTypes public var url: Bool? public var test: Bool? @@ -28,7 +28,7 @@ public struct TSDKAddressStringFormat: Codable { } } -public struct TSDKParamsOfConvertAddress: Codable { +public struct TSDKParamsOfConvertAddress: Codable, @unchecked Sendable { /// Account address in any TON format. public var address: String /// Specify the format to convert to. @@ -40,7 +40,7 @@ public struct TSDKParamsOfConvertAddress: Codable { } } -public struct TSDKResultOfConvertAddress: Codable { +public struct TSDKResultOfConvertAddress: Codable, @unchecked Sendable { /// Address in the specified format public var address: String @@ -49,7 +49,7 @@ public struct TSDKResultOfConvertAddress: Codable { } } -public struct TSDKParamsOfGetAddressType: Codable { +public struct TSDKParamsOfGetAddressType: Codable, @unchecked Sendable { /// Account address in any TON format. public var address: String @@ -58,7 +58,7 @@ public struct TSDKParamsOfGetAddressType: Codable { } } -public struct TSDKResultOfGetAddressType: Codable { +public struct TSDKResultOfGetAddressType: Codable, @unchecked Sendable { /// Account address type. public var address_type: TSDKAccountAddressType @@ -67,7 +67,7 @@ public struct TSDKResultOfGetAddressType: Codable { } } -public struct TSDKParamsOfCalcStorageFee: Codable { +public struct TSDKParamsOfCalcStorageFee: Codable, @unchecked Sendable { public var account: String public var period: UInt32 @@ -77,7 +77,7 @@ public struct TSDKParamsOfCalcStorageFee: Codable { } } -public struct TSDKResultOfCalcStorageFee: Codable { +public struct TSDKResultOfCalcStorageFee: Codable, @unchecked Sendable { public var fee: String public init(fee: String) { @@ -85,7 +85,7 @@ public struct TSDKResultOfCalcStorageFee: Codable { } } -public struct TSDKParamsOfCompressZstd: Codable { +public struct TSDKParamsOfCompressZstd: Codable, @unchecked Sendable { /// Uncompressed data. /// Must be encoded as base64. public var uncompressed: String @@ -98,7 +98,7 @@ public struct TSDKParamsOfCompressZstd: Codable { } } -public struct TSDKResultOfCompressZstd: Codable { +public struct TSDKResultOfCompressZstd: Codable, @unchecked Sendable { /// Compressed data. /// Must be encoded as base64. public var compressed: String @@ -108,7 +108,7 @@ public struct TSDKResultOfCompressZstd: Codable { } } -public struct TSDKParamsOfDecompressZstd: Codable { +public struct TSDKParamsOfDecompressZstd: Codable, @unchecked Sendable { /// Compressed data. /// Must be encoded as base64. public var compressed: String @@ -118,7 +118,7 @@ public struct TSDKParamsOfDecompressZstd: Codable { } } -public struct TSDKResultOfDecompressZstd: Codable { +public struct TSDKResultOfDecompressZstd: Codable, @unchecked Sendable { /// Decompressed data. /// Must be encoded as base64. public var decompressed: String diff --git a/api_generate.sh b/api_generate.sh index 8e378be..53bd623 100755 --- a/api_generate.sh +++ b/api_generate.sh @@ -3,7 +3,7 @@ git pull --ff-only cd ApiParser swift build -c release -curl https://raw.githubusercontent.com/tonlabs/TON-SDK/master/tools/api.json > api.json +curl https://raw.githubusercontent.com/everx-labs/ever-sdk/refs/heads/master/tools/api.json > api.json if [ `uname -m` = arm64 ]; then ./.build/arm64-apple-macosx/release/ApiParser ./api.json else