@@ -7,6 +7,211 @@ public final class TSDKProcessingModule {
7
7
self . binding = binding
8
8
}
9
9
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
+
10
215
/// Sends message to the network
11
216
/// 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.
12
217
public func send_message( _ payload: TSDKParamsOfSendMessage , _ handler: @escaping ( TSDKBindingResponse < TSDKResultOfSendMessage , TSDKClientError > ) throws -> Void
0 commit comments