Skip to content

Commit

Permalink
move AnyValue
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Jun 30, 2022
1 parent f61dc9d commit e6284cc
Show file tree
Hide file tree
Showing 25 changed files with 83 additions and 305 deletions.
2 changes: 1 addition & 1 deletion ApiParser/Sources/ApiParser/CodeGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CodeGenerator {
FileUtils.writeFile(to: moduleClassFilePath, newModuleClass)


var newTypes: String = ""
var newTypes: String = "import SwiftExtensionsPack\n\n\n"
for newAlias in module.alias {
newTypes.append(generateAlias(newAlias))
}
Expand Down
3 changes: 3 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let package = Package(
.package(name: "SwiftRegularExpression", url: "https://github.com/nerzh/swift-regular-expression.git", .upToNextMajor(from: "0.2.4")),
.package(name: "FileUtils", url: "https://github.com/nerzh/SwiftFileUtils", .upToNextMinor(from: "1.3.0")),
.package(name: "BigInt", url: "https://github.com/bytehubio/BigInt", .exact("5.3.0")),
.package(name: "SwiftExtensionsPack", url: "https://github.com/nerzh/swift-extensions-pack", .upToNextMinor(from: "0.5.5")),
],
targets: [
.systemLibrary(name: "CTonSDK", pkgConfig: "libton_client"),
Expand All @@ -25,6 +26,7 @@ let package = Package(
.byName(name: "CTonSDK"),
.product(name: "SwiftRegularExpression", package: "SwiftRegularExpression"),
.product(name: "BigInt", package: "BigInt"),
.product(name: "SwiftExtensionsPack", package: "SwiftExtensionsPack"),
]),
.testTarget(
name: "EverscaleClientSwiftTests",
Expand All @@ -33,6 +35,7 @@ let package = Package(
.byName(name: "EverscaleClientSwift"),
.product(name: "FileUtils", package: "FileUtils"),
.product(name: "BigInt", package: "BigInt"),
.product(name: "SwiftExtensionsPack", package: "SwiftExtensionsPack"),
]),
],
swiftLanguageVersions: [
Expand Down
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.34.3-orange)](https://github.com/tonlabs/TON-SDK)
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.35.0-orange)](https://github.com/tonlabs/TON-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 @@ -193,4 +193,15 @@ public final class TSDKAbiModule {
}
}

/// Calculates contract function ID by contract ABI
public func calc_function_id(_ payload: TSDKParamsOfCalcFunctionId, _ handler: @escaping (TSDKBindingResponse<TSDKResultOfCalcFunctionId, TSDKClientError>) throws -> Void
) {
let method: String = "calc_function_id"
binding.requestLibraryAsync(methodName(module, method), payload) { (requestId, params, responseType, finished) in
var response: TSDKBindingResponse<TSDKResultOfCalcFunctionId, TSDKClientError> = .init()
response.update(requestId, params, responseType, finished)
try handler(response)
}
}

}
28 changes: 28 additions & 0 deletions Sources/EverscaleClientSwift/Abi/AbiTypes.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import SwiftExtensionsPack


public typealias TSDKAbiHandle = UInt32

public enum TSDKAbiErrorCode: Int, Codable {
Expand All @@ -15,6 +18,7 @@ public enum TSDKAbiErrorCode: Int, Codable {
case InvalidFunctionId = 312
case InvalidData = 313
case EncodeInitialDataFailed = 314
case InvalidFunctionName = 315
}

public enum TSDKAbiEnumTypes: String, Codable {
Expand Down Expand Up @@ -700,3 +704,27 @@ public struct TSDKResultOfAbiEncodeBoc: Codable {
}
}

public struct TSDKParamsOfCalcFunctionId: Codable {
/// Contract ABI.
public var abi: TSDKAbi
/// Contract function name
public var function_name: String
/// If set to `true` output function ID will be returned which is used in contract response. Default is `false`
public var output: Bool?

public init(abi: TSDKAbi, function_name: String, output: Bool? = nil) {
self.abi = abi
self.function_name = function_name
self.output = output
}
}

public struct TSDKResultOfCalcFunctionId: Codable {
/// Contract function ID
public var function_id: UInt32

public init(function_id: UInt32) {
self.function_id = function_id
}
}

1 change: 1 addition & 0 deletions Sources/EverscaleClientSwift/Binding/Binding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import Foundation
import CTonSDK
import SwiftExtensionsPack

public typealias TSDKString = tc_string_data_t
public typealias TSDKStringPointer = OpaquePointer
Expand Down
1 change: 1 addition & 0 deletions Sources/EverscaleClientSwift/Binding/BindingTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import Foundation
import SwiftExtensionsPack

public struct TSDKContextResponse: Codable {
public var result: UInt32?
Expand Down
3 changes: 3 additions & 0 deletions Sources/EverscaleClientSwift/Boc/BocTypes.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import SwiftExtensionsPack


public enum TSDKBocCacheTypeEnumTypes: String, Codable {
case Pinned = "Pinned"
case Unpinned = "Unpinned"
Expand Down
3 changes: 3 additions & 0 deletions Sources/EverscaleClientSwift/Client/ClientTypes.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import SwiftExtensionsPack


public enum TSDKClientErrorCode: Int, Codable {
case NotImplemented = 1
case InvalidHex = 2
Expand Down
3 changes: 3 additions & 0 deletions Sources/EverscaleClientSwift/Crypto/CryptoTypes.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import SwiftExtensionsPack


public typealias TSDKSigningBoxHandle = UInt32

public typealias TSDKEncryptionBoxHandle = UInt32
Expand Down
3 changes: 3 additions & 0 deletions Sources/EverscaleClientSwift/Debot/DebotTypes.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import SwiftExtensionsPack


public typealias TSDKDebotHandle = UInt32

public enum TSDKDebotErrorCode: Int, Codable {
Expand Down
Loading

0 comments on commit e6284cc

Please sign in to comment.