Skip to content

Commit 082a906

Browse files
committed
up 1.40
1 parent db0af53 commit 082a906

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Swift Client for Everscale SDK
22

33
[![SPM](https://img.shields.io/badge/swift-package%20manager-green)](https://swift.org/package-manager/)
4-
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.39.0-orange)](https://github.com/tonlabs/ever-sdk)
4+
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.40.0-orange)](https://github.com/tonlabs/ever-sdk)
55

66
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 Everscale 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.
77

Sources/EverscaleClientSwift/Abi/Abi.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,15 @@ public final class TSDKAbiModule {
204204
}
205205
}
206206

207+
/// Extracts signature from message body and calculates hash to verify the signature
208+
public func get_signature_data(_ payload: TSDKParamsOfGetSignatureData, _ handler: @escaping (TSDKBindingResponse<TSDKResultOfGetSignatureData, TSDKClientError>) throws -> Void
209+
) throws {
210+
let method: String = "get_signature_data"
211+
try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in
212+
var response: TSDKBindingResponse<TSDKResultOfGetSignatureData, TSDKClientError> = .init()
213+
response.update(requestId, params, responseType, finished)
214+
try handler(response)
215+
}
216+
}
217+
207218
}

Sources/EverscaleClientSwift/Abi/AbiTypes.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,3 +748,27 @@ public struct TSDKResultOfCalcFunctionId: Codable {
748748
}
749749
}
750750

751+
public struct TSDKParamsOfGetSignatureData: Codable {
752+
/// Contract ABI used to decode.
753+
public var abi: TSDKAbi
754+
/// Message BOC encoded in `base64`.
755+
public var message: String
756+
757+
public init(abi: TSDKAbi, message: String) {
758+
self.abi = abi
759+
self.message = message
760+
}
761+
}
762+
763+
public struct TSDKResultOfGetSignatureData: Codable {
764+
/// Signature from the message in `hex`.
765+
public var signature: String
766+
/// Hash to verify the signature in `base64`.
767+
public var hash: String
768+
769+
public init(signature: String, hash: String) {
770+
self.signature = signature
771+
self.hash = hash
772+
}
773+
}
774+

Sources/EverscaleClientSwift/Binding/BindingTypes.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ public struct TSDKBindingResponse<TSDKResult: Codable, TSDKError: Codable> {
4949
public var finished: Bool = false
5050
public var requestId: UInt32 = 0
5151
public var rawResponse: String = .init()
52+
53+
public init(result: TSDKResult? = nil,
54+
error: TSDKError? = nil,
55+
dappError: TSDKError? = nil,
56+
finished: Bool = false,
57+
requestId: UInt32 = 0,
58+
rawResponse: String = .init()
59+
) {
60+
self.result = result
61+
self.error = error
62+
self.dappError = dappError
63+
self.finished = finished
64+
self.requestId = requestId
65+
self.rawResponse = rawResponse
66+
}
5267

5368
public mutating func update(_ requestId: UInt32,
5469
_ rawResponse: String,

Sources/EverscaleClientSwift/Client/ClientTypes.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public enum TSDKClientErrorCode: Int, Codable {
3838
case InternalError = 33
3939
case InvalidHandle = 34
4040
case LocalStorageError = 35
41+
case InvalidData = 36
4142
}
4243

4344
public enum TSDKNetworkQueriesProtocol: String, Codable {

0 commit comments

Comments
 (0)