Skip to content

Commit

Permalink
up 1.40
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Jan 23, 2023
1 parent db0af53 commit 082a906
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Swift Client for Everscale SDK

[![SPM](https://img.shields.io/badge/swift-package%20manager-green)](https://swift.org/package-manager/)
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.39.0-orange)](https://github.com/tonlabs/ever-sdk)
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.40.0-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 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.

Expand Down
11 changes: 11 additions & 0 deletions Sources/EverscaleClientSwift/Abi/Abi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,15 @@ 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<TSDKResultOfGetSignatureData, TSDKClientError>) throws -> Void
) throws {
let method: String = "get_signature_data"
try binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in
var response: TSDKBindingResponse<TSDKResultOfGetSignatureData, TSDKClientError> = .init()
response.update(requestId, params, responseType, finished)
try handler(response)
}
}

}
24 changes: 24 additions & 0 deletions Sources/EverscaleClientSwift/Abi/AbiTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -748,3 +748,27 @@ public struct TSDKResultOfCalcFunctionId: Codable {
}
}

public struct TSDKParamsOfGetSignatureData: Codable {
/// Contract ABI used to decode.
public var abi: TSDKAbi
/// Message BOC encoded in `base64`.
public var message: String

public init(abi: TSDKAbi, message: String) {
self.abi = abi
self.message = message
}
}

public struct TSDKResultOfGetSignatureData: Codable {
/// Signature from the message in `hex`.
public var signature: String
/// Hash to verify the signature in `base64`.
public var hash: String

public init(signature: String, hash: String) {
self.signature = signature
self.hash = hash
}
}

15 changes: 15 additions & 0 deletions Sources/EverscaleClientSwift/Binding/BindingTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ public struct TSDKBindingResponse<TSDKResult: Codable, TSDKError: Codable> {
public var finished: Bool = false
public var requestId: UInt32 = 0
public var rawResponse: String = .init()

public init(result: TSDKResult? = nil,
error: TSDKError? = nil,
dappError: TSDKError? = nil,
finished: Bool = false,
requestId: UInt32 = 0,
rawResponse: String = .init()
) {
self.result = result
self.error = error
self.dappError = dappError
self.finished = finished
self.requestId = requestId
self.rawResponse = rawResponse
}

public mutating func update(_ requestId: UInt32,
_ rawResponse: String,
Expand Down
1 change: 1 addition & 0 deletions Sources/EverscaleClientSwift/Client/ClientTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public enum TSDKClientErrorCode: Int, Codable {
case InternalError = 33
case InvalidHandle = 34
case LocalStorageError = 35
case InvalidData = 36
}

public enum TSDKNetworkQueriesProtocol: String, Codable {
Expand Down

0 comments on commit 082a906

Please sign in to comment.