Skip to content

Commit d06d1d1

Browse files
committed
update 1.42.1
1 parent 87cf6e9 commit d06d1d1

File tree

7 files changed

+409
-6
lines changed

7 files changed

+409
-6
lines changed

ApiParser/Sources/ApiParser/CodeGenerator.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,13 @@ extension CodeGenerator {
317317
\n public init(_ error: Error) {
318318
self.code = 0
319319
self.message = error.localizedDescription
320-
self.data = ([:] as! [String: Any]).toAnyValue()
320+
self.data = [String: Any]().toAnyValue()
321321
}
322322
323323
public init(_ message: String) {
324324
self.code = 0
325325
self.message = message
326-
self.data = ([:] as! [String: Any]).toAnyValue()
326+
self.data = [String: Any]().toAnyValue()
327327
}\n
328328
"""
329329
result.append(customInit)
@@ -334,7 +334,7 @@ extension CodeGenerator {
334334
result.append("\(property.name): \(property.type) = nil")
335335
} else {
336336
if property.name == "data" {
337-
result.append("\(property.name): \(property.type) = ([:] as! [String: Any]).toAnyValue()")
337+
result.append("\(property.name): \(property.type) = [String: Any]().toAnyValue()")
338338
} else {
339339
result.append("\(property.name): \(property.type)")
340340
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</p>
88

99
[![SPM](https://img.shields.io/badge/swift-package%20manager-green)](https://swift.org/package-manager/)
10-
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.41.1-orange)](https://github.com/tonlabs/ever-sdk)
10+
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.42.1-orange)](https://github.com/tonlabs/ever-sdk)
1111

1212
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.
1313

Sources/EverscaleClientSwift/Client/Client.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,8 @@ public final class TSDKClientModule {
201201
}
202202
}
203203
}
204+
205+
deinit {
206+
print("Client DEINIT !")
207+
}
204208
}

Sources/EverscaleClientSwift/Client/ClientTypes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public struct TSDKClientError: Codable, LocalizedError {
6060
public var failureReason: String? { self.message }
6161
public var recoverySuggestion: String? { self.message }
6262
public var helpAnchor: String? { self.message }
63-
public var data: AnyValue = [String: Any]().toAnyValue()
63+
public var data: AnyValue = ([:] as! [String: Any]).toAnyValue()
6464

6565
public init(_ error: Error) {
6666
self.code = 0
@@ -151,7 +151,7 @@ public struct TSDKNetworkConfig: Codable {
151151
public var queries_protocol: TSDKNetworkQueriesProtocol?
152152
/// UNSTABLE.
153153
/// First REMP status awaiting timeout. If no status received during the timeout than fallback transaction scenario is activated.
154-
/// Must be specified in milliseconds. Default is 1000 (1 sec).
154+
/// Must be specified in milliseconds. Default is 1 (1 ms) in order to start fallback scenariotogether with REMP statuses processing while REMP is not properly tuned yet.
155155
public var first_remp_status_timeout: UInt32?
156156
/// UNSTABLE.
157157
/// Subsequent REMP status awaiting timeout. If no status received during the timeout than fallback transaction scenario is activated.

Sources/EverscaleClientSwift/Net/NetTypes.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public enum TSDKNetErrorCode: Int, Codable {
2020
case Unauthorized = 615
2121
case QueryTransactionTreeTimeout = 616
2222
case GraphqlConnectionError = 617
23+
case WrongWebscoketProtocolSequence = 618
2324
}
2425

2526
public enum TSDKSortDirection: String, Codable {

Sources/EverscaleClientSwift/Processing/Processing.swift

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,211 @@ public final class TSDKProcessingModule {
77
self.binding = binding
88
}
99

10+
/// Starts monitoring for the processing results of the specified messages.
11+
/// Message monitor performs background monitoring for a message processing resultsfor the specified set of messages.
12+
/// Message monitor can serve several isolated monitoring queues.
13+
/// Each monitor queue has a unique application defined identifier (or name) usedto separate several queue's.
14+
/// There are two important lists inside of the monitoring queue:
15+
/// - unresolved messages: contains messages requested by the application for monitoring and not yet resolved;
16+
/// - resolved results: contains resolved processing results for monitored messages.
17+
/// Each monitoring queue tracks own unresolved and resolved lists.
18+
/// Application can add more messages to the monitoring queue at any time.
19+
/// Message monitor accumulates resolved results.
20+
/// Application should fetch this results with `fetchNextMonitorResults` function.
21+
/// When both unresolved and resolved lists becomes empty, monitor stops any background activityand frees all allocated internal memory.
22+
/// If monitoring queue with specified name already exists then messages will be addedto the unresolved list.
23+
/// If monitoring queue with specified name does not exist then monitoring queue will be createdwith specified unresolved messages.
24+
public func monitor_messages(_ payload: TSDKParamsOfMonitorMessages, _ handler: @escaping (TSDKBindingResponse<TSDKNoneResult, TSDKClientError>) throws -> Void
25+
) throws {
26+
let method: String = "monitor_messages"
27+
try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in
28+
var response: TSDKBindingResponse<TSDKNoneResult, TSDKClientError> = .init()
29+
response.update(requestId, params, responseType, finished)
30+
try handler(response)
31+
}
32+
}
33+
34+
/// Starts monitoring for the processing results of the specified messages.
35+
/// Message monitor performs background monitoring for a message processing resultsfor the specified set of messages.
36+
/// Message monitor can serve several isolated monitoring queues.
37+
/// Each monitor queue has a unique application defined identifier (or name) usedto separate several queue's.
38+
/// There are two important lists inside of the monitoring queue:
39+
/// - unresolved messages: contains messages requested by the application for monitoring and not yet resolved;
40+
/// - resolved results: contains resolved processing results for monitored messages.
41+
/// Each monitoring queue tracks own unresolved and resolved lists.
42+
/// Application can add more messages to the monitoring queue at any time.
43+
/// Message monitor accumulates resolved results.
44+
/// Application should fetch this results with `fetchNextMonitorResults` function.
45+
/// When both unresolved and resolved lists becomes empty, monitor stops any background activityand frees all allocated internal memory.
46+
/// If monitoring queue with specified name already exists then messages will be addedto the unresolved list.
47+
/// If monitoring queue with specified name does not exist then monitoring queue will be createdwith specified unresolved messages.
48+
@available(iOS 13, *)
49+
@available(macOS 12, *)
50+
public func monitor_messages(_ payload: TSDKParamsOfMonitorMessages) async throws -> TSDKNoneResult {
51+
try await withCheckedThrowingContinuation { continuation in
52+
do {
53+
let method: String = "monitor_messages"
54+
try binding.requestLibraryAsyncAwait(methodName(module, method), payload) { (requestId, params, responseType, finished) in
55+
var response: TSDKBindingResponse<TSDKNoneResult, TSDKClientError> = .init()
56+
response.update(requestId, params, responseType, finished)
57+
if let error = response.error {
58+
continuation.resume(throwing: error)
59+
} else if let result = response.result {
60+
continuation.resume(returning: result)
61+
} else {
62+
continuation.resume(throwing: TSDKClientError("Nothing for return"))
63+
}
64+
}
65+
} catch {
66+
continuation.resume(throwing: error)
67+
}
68+
}
69+
}
70+
71+
/// Returns summary information about current state of the specified monitoring queue.
72+
public func get_monitor_info(_ payload: TSDKParamsOfGetMonitorInfo, _ handler: @escaping (TSDKBindingResponse<TSDKMonitoringQueueInfo, TSDKClientError>) throws -> Void
73+
) throws {
74+
let method: String = "get_monitor_info"
75+
try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in
76+
var response: TSDKBindingResponse<TSDKMonitoringQueueInfo, TSDKClientError> = .init()
77+
response.update(requestId, params, responseType, finished)
78+
try handler(response)
79+
}
80+
}
81+
82+
/// Returns summary information about current state of the specified monitoring queue.
83+
@available(iOS 13, *)
84+
@available(macOS 12, *)
85+
public func get_monitor_info(_ payload: TSDKParamsOfGetMonitorInfo) async throws -> TSDKMonitoringQueueInfo {
86+
try await withCheckedThrowingContinuation { continuation in
87+
do {
88+
let method: String = "get_monitor_info"
89+
try binding.requestLibraryAsyncAwait(methodName(module, method), payload) { (requestId, params, responseType, finished) in
90+
var response: TSDKBindingResponse<TSDKMonitoringQueueInfo, TSDKClientError> = .init()
91+
response.update(requestId, params, responseType, finished)
92+
if let error = response.error {
93+
continuation.resume(throwing: error)
94+
} else if let result = response.result {
95+
continuation.resume(returning: result)
96+
} else {
97+
continuation.resume(throwing: TSDKClientError("Nothing for return"))
98+
}
99+
}
100+
} catch {
101+
continuation.resume(throwing: error)
102+
}
103+
}
104+
}
105+
106+
/// Fetches next resolved results from the specified monitoring queue.
107+
/// Results and waiting options are depends on the `wait` parameter.
108+
/// All returned results will be removed from the queue's resolved list.
109+
public func fetch_next_monitor_results(_ payload: TSDKParamsOfFetchNextMonitorResults, _ handler: @escaping (TSDKBindingResponse<TSDKResultOfFetchNextMonitorResults, TSDKClientError>) throws -> Void
110+
) throws {
111+
let method: String = "fetch_next_monitor_results"
112+
try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in
113+
var response: TSDKBindingResponse<TSDKResultOfFetchNextMonitorResults, TSDKClientError> = .init()
114+
response.update(requestId, params, responseType, finished)
115+
try handler(response)
116+
}
117+
}
118+
119+
/// Fetches next resolved results from the specified monitoring queue.
120+
/// Results and waiting options are depends on the `wait` parameter.
121+
/// All returned results will be removed from the queue's resolved list.
122+
@available(iOS 13, *)
123+
@available(macOS 12, *)
124+
public func fetch_next_monitor_results(_ payload: TSDKParamsOfFetchNextMonitorResults) async throws -> TSDKResultOfFetchNextMonitorResults {
125+
try await withCheckedThrowingContinuation { continuation in
126+
do {
127+
let method: String = "fetch_next_monitor_results"
128+
try binding.requestLibraryAsyncAwait(methodName(module, method), payload) { (requestId, params, responseType, finished) in
129+
var response: TSDKBindingResponse<TSDKResultOfFetchNextMonitorResults, TSDKClientError> = .init()
130+
response.update(requestId, params, responseType, finished)
131+
if let error = response.error {
132+
continuation.resume(throwing: error)
133+
} else if let result = response.result {
134+
continuation.resume(returning: result)
135+
} else {
136+
continuation.resume(throwing: TSDKClientError("Nothing for return"))
137+
}
138+
}
139+
} catch {
140+
continuation.resume(throwing: error)
141+
}
142+
}
143+
}
144+
145+
/// Cancels all background activity and releases all allocated system resources for the specified monitoring queue.
146+
public func cancel_monitor(_ payload: TSDKParamsOfCancelMonitor, _ handler: @escaping (TSDKBindingResponse<TSDKNoneResult, TSDKClientError>) throws -> Void
147+
) throws {
148+
let method: String = "cancel_monitor"
149+
try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in
150+
var response: TSDKBindingResponse<TSDKNoneResult, TSDKClientError> = .init()
151+
response.update(requestId, params, responseType, finished)
152+
try handler(response)
153+
}
154+
}
155+
156+
/// Cancels all background activity and releases all allocated system resources for the specified monitoring queue.
157+
@available(iOS 13, *)
158+
@available(macOS 12, *)
159+
public func cancel_monitor(_ payload: TSDKParamsOfCancelMonitor) async throws -> TSDKNoneResult {
160+
try await withCheckedThrowingContinuation { continuation in
161+
do {
162+
let method: String = "cancel_monitor"
163+
try binding.requestLibraryAsyncAwait(methodName(module, method), payload) { (requestId, params, responseType, finished) in
164+
var response: TSDKBindingResponse<TSDKNoneResult, TSDKClientError> = .init()
165+
response.update(requestId, params, responseType, finished)
166+
if let error = response.error {
167+
continuation.resume(throwing: error)
168+
} else if let result = response.result {
169+
continuation.resume(returning: result)
170+
} else {
171+
continuation.resume(throwing: TSDKClientError("Nothing for return"))
172+
}
173+
}
174+
} catch {
175+
continuation.resume(throwing: error)
176+
}
177+
}
178+
}
179+
180+
/// Sends specified messages to the blockchain.
181+
public func send_messages(_ payload: TSDKParamsOfSendMessages, _ handler: @escaping (TSDKBindingResponse<TSDKResultOfSendMessages, TSDKClientError>) throws -> Void
182+
) throws {
183+
let method: String = "send_messages"
184+
try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in
185+
var response: TSDKBindingResponse<TSDKResultOfSendMessages, TSDKClientError> = .init()
186+
response.update(requestId, params, responseType, finished)
187+
try handler(response)
188+
}
189+
}
190+
191+
/// Sends specified messages to the blockchain.
192+
@available(iOS 13, *)
193+
@available(macOS 12, *)
194+
public func send_messages(_ payload: TSDKParamsOfSendMessages) async throws -> TSDKResultOfSendMessages {
195+
try await withCheckedThrowingContinuation { continuation in
196+
do {
197+
let method: String = "send_messages"
198+
try binding.requestLibraryAsyncAwait(methodName(module, method), payload) { (requestId, params, responseType, finished) in
199+
var response: TSDKBindingResponse<TSDKResultOfSendMessages, TSDKClientError> = .init()
200+
response.update(requestId, params, responseType, finished)
201+
if let error = response.error {
202+
continuation.resume(throwing: error)
203+
} else if let result = response.result {
204+
continuation.resume(returning: result)
205+
} else {
206+
continuation.resume(throwing: TSDKClientError("Nothing for return"))
207+
}
208+
}
209+
} catch {
210+
continuation.resume(throwing: error)
211+
}
212+
}
213+
}
214+
10215
/// Sends message to the network
11216
/// 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.
12217
public func send_message(_ payload: TSDKParamsOfSendMessage, _ handler: @escaping (TSDKBindingResponse<TSDKResultOfSendMessage, TSDKClientError>) throws -> Void

0 commit comments

Comments
 (0)