Skip to content

Commit

Permalink
up 1.33.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed May 3, 2022
1 parent 07c7308 commit 4114ca1
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 12 deletions.
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.32.0-orange)](https://github.com/tonlabs/TON-SDK)
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.33.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
20 changes: 16 additions & 4 deletions Sources/EverscaleClientSwift/Abi/AbiTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,13 @@ public struct TSDKParamsOfDecodeMessage: Codable {
public var abi: TSDKAbi
/// Message BOC
public var message: String
/// Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)
public var allow_partial: Bool?

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

Expand Down Expand Up @@ -492,11 +495,14 @@ public struct TSDKParamsOfDecodeMessageBody: Codable {
public var body: String
/// True if the body belongs to the internal message.
public var is_internal: Bool
/// Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)
public var allow_partial: Bool?

public init(abi: TSDKAbi, body: String, is_internal: Bool) {
public init(abi: TSDKAbi, body: String, is_internal: Bool, allow_partial: Bool? = nil) {
self.abi = abi
self.body = body
self.is_internal = is_internal
self.allow_partial = allow_partial
}
}

Expand Down Expand Up @@ -539,10 +545,13 @@ public struct TSDKParamsOfDecodeAccountData: Codable {
public var abi: TSDKAbi
/// Data BOC or BOC handle
public var data: String
/// Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)
public var allow_partial: Bool?

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

Expand Down Expand Up @@ -620,10 +629,13 @@ public struct TSDKParamsOfDecodeInitialData: Codable {
public var abi: TSDKAbi?
/// Data BOC or BOC handle
public var data: String
/// Flag allowing partial BOC decoding when ABI doesn't describe the full body BOC. Controls decoder behaviour when after decoding all described in ABI params there are some data left in BOC: `true` - return decoded values `false` - return error of incomplete BOC deserialization (default)
public var allow_partial: Bool?

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

Expand Down
19 changes: 15 additions & 4 deletions Sources/EverscaleClientSwift/Client/ClientTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ public struct TSDKClientConfig: Codable {
}

public struct TSDKNetworkConfig: Codable {
/// DApp Server public address. For instance, for `net.ton.dev/graphql` GraphQL endpoint the server address will be net.ton.dev
/// **This field is deprecated, but left for backward-compatibility.** DApp Server public address.
public var server_address: String?
/// List of DApp Server addresses.
/// Any correct URL format can be specified, including IP addresses This parameter is prevailing over `server_address`.
/// Any correct URL format can be specified, including IP addresses. This parameter is prevailing over `server_address`.
/// Check the full list of [supported network endpoints](../ton-os-api/networks.md).
public var endpoints: [String]?
/// Deprecated.
/// You must use `network.max_reconnect_timeout` that allows to specify maximum network resolving timeout.
Expand All @@ -107,7 +108,7 @@ public struct TSDKNetworkConfig: Codable {
/// Must be specified in milliseconds. Default is 15000 (15 sec).
public var out_of_sync_threshold: UInt32?
/// Maximum number of randomly chosen endpoints the library uses to broadcast a message.
/// Default is 2.
/// Default is 1.
public var sending_endpoint_count: UInt8?
/// Frequency of sync latency detection.
/// Library periodically checks the current endpoint for blockchain data syncronization latency.
Expand All @@ -125,11 +126,19 @@ public struct TSDKNetworkConfig: Codable {
/// `HTTP` or `WS`.
/// /// Default is `HTTP`.
public var queries_protocol: TSDKNetworkQueriesProtocol?
/// UNSTABLE.
/// First REMP status awaiting timeout. If no status recieved during the timeout than fallback transaction scenario is activated.
/// Must be specified in milliseconds. Default is 1000 (1 sec).
public var first_remp_status_timeout: UInt32?
/// UNSTABLE.
/// Subsequent REMP status awaiting timeout. If no status recieved during the timeout than fallback transaction scenario is activated.
/// Must be specified in milliseconds. Default is 5000 (5 sec).
public var next_remp_status_timeout: UInt32?
/// Access key to GraphQL API.
/// At the moment is not used in production.
public var access_key: String?

public init(server_address: String? = nil, endpoints: [String]? = nil, network_retries_count: Int8? = nil, max_reconnect_timeout: UInt32? = nil, reconnect_timeout: UInt32? = nil, message_retries_count: Int8? = nil, message_processing_timeout: UInt32? = nil, wait_for_timeout: UInt32? = nil, out_of_sync_threshold: UInt32? = nil, sending_endpoint_count: UInt8? = nil, latency_detection_interval: UInt32? = nil, max_latency: UInt32? = nil, query_timeout: UInt32? = nil, queries_protocol: TSDKNetworkQueriesProtocol? = nil, access_key: String? = nil) {
public init(server_address: String? = nil, endpoints: [String]? = nil, network_retries_count: Int8? = nil, max_reconnect_timeout: UInt32? = nil, reconnect_timeout: UInt32? = nil, message_retries_count: Int8? = nil, message_processing_timeout: UInt32? = nil, wait_for_timeout: UInt32? = nil, out_of_sync_threshold: UInt32? = nil, sending_endpoint_count: UInt8? = nil, latency_detection_interval: UInt32? = nil, max_latency: UInt32? = nil, query_timeout: UInt32? = nil, queries_protocol: TSDKNetworkQueriesProtocol? = nil, first_remp_status_timeout: UInt32? = nil, next_remp_status_timeout: UInt32? = nil, access_key: String? = nil) {
self.server_address = server_address
self.endpoints = endpoints
self.network_retries_count = network_retries_count
Expand All @@ -144,6 +153,8 @@ public struct TSDKNetworkConfig: Codable {
self.max_latency = max_latency
self.query_timeout = query_timeout
self.queries_protocol = queries_protocol
self.first_remp_status_timeout = first_remp_status_timeout
self.next_remp_status_timeout = next_remp_status_timeout
self.access_key = access_key
}
}
Expand Down
1 change: 1 addition & 0 deletions Sources/EverscaleClientSwift/Crypto/CryptoTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public enum TSDKCryptoErrorCode: Int, Codable {
case InvalidCryptoBoxType = 131
case CryptoBoxSecretSerializationError = 132
case CryptoBoxSecretDeserializationError = 133
case InvalidNonceSize = 134
}

public enum TSDKEncryptionAlgorithmEnumTypes: String, Codable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/EverscaleClientSwift/Net/Net.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public final class TSDKNetModule {
}

/// Allows to query and paginate through the list of accounts that the specified account has interacted with, sorted by the time of the last internal message between accounts
/// *Attention* this query retrieves data from 'Counterparties' service which is not supported inthe opensource version of DApp Server (and will not be supported) as well as in TON OS SE (will be supported in SE in future),but is always accessible via [TON OS Devnet/Mainnet Clouds](https://docs.ton.dev/86757ecb2/p/85c869-networks)
/// *Attention* this query retrieves data from 'Counterparties' service which is not supported inthe opensource version of DApp Server (and will not be supported) as well as in Evernode SE (will be supported in SE in future),but is always accessible via [EVER OS Clouds](../ton-os-api/networks.md)
public func query_counterparties(_ payload: TSDKParamsOfQueryCounterparties, _ handler: @escaping (TSDKBindingResponse<TSDKResultOfQueryCollection, TSDKClientError>) throws -> Void
) {
let method: String = "query_counterparties"
Expand Down
14 changes: 13 additions & 1 deletion Sources/EverscaleClientSwift/Processing/ProcessingTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public enum TSDKProcessingErrorCode: Int, Codable {
case BlockNotFound = 511
case InvalidData = 512
case ExternalSignerMustNotBeUsed = 513
case MessageRejected = 514
case InvalidRempStatus = 515
case NextRempStatusTimeout = 516
}

public enum TSDKProcessingEventEnumTypes: String, Codable {
Expand All @@ -23,6 +26,11 @@ public enum TSDKProcessingEventEnumTypes: String, Codable {
case WillFetchNextBlock = "WillFetchNextBlock"
case FetchNextBlockFailed = "FetchNextBlockFailed"
case MessageExpired = "MessageExpired"
case RempSentToValidators = "RempSentToValidators"
case RempIncludedIntoBlock = "RempIncludedIntoBlock"
case RempIncludedIntoAcceptedBlock = "RempIncludedIntoAcceptedBlock"
case RempOther = "RempOther"
case RempError = "RempError"
}

public struct TSDKProcessingEvent: Codable {
Expand All @@ -31,13 +39,17 @@ public struct TSDKProcessingEvent: Codable {
public var shard_block_id: String?
public var message_id: String?
public var message: String?
public var timestamp: Int?
public var json: AnyValue?

public init(type: TSDKProcessingEventEnumTypes, error: TSDKClientError? = nil, shard_block_id: String? = nil, message_id: String? = nil, message: String? = nil) {
public init(type: TSDKProcessingEventEnumTypes, error: TSDKClientError? = nil, shard_block_id: String? = nil, message_id: String? = nil, message: String? = nil, timestamp: Int? = nil, json: AnyValue? = nil) {
self.type = type
self.error = error
self.shard_block_id = shard_block_id
self.message_id = message_id
self.message = message
self.timestamp = timestamp
self.json = json
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/EverscaleClientSwift/Proofs/Proofs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class TSDKProofsModule {
/// **What Proofs are**Simply, proof is a list of signatures of validators', which have signed this particular master-block.
/// The very first validator set's public keys are included in the zero-state. Whe know a root hashof the zero-state, because it is stored in the network configuration file, it is our authorityroot. For proving zero-state it is enough to calculate and compare its root hash.
/// In each new validator cycle the validator set is changed. The new one is stored in a key-block,which is signed by the validator set, which we already trust, the next validator set will bestored to the new key-block and signed by the current validator set, and so on.
/// In order to prove any block in the master-chain we need to check, that it has been signed bya trusted validator set. So we need to check all key-blocks' proofs, started from the zero-stateand until the block, which we want to prove. But it can take a lot of time and traffic todownload and prove all key-blocks on a client. For solving this, special trusted blocks are usedin TON-SDK.
/// In order to prove any block in the master-chain we need to check, that it has been signed bya trusted validator set. So we need to check all key-blocks' proofs, started from the zero-stateand until the block, which we want to prove. But it can take a lot of time and traffic todownload and prove all key-blocks on a client. For solving this, special trusted blocks are usedin Ever-SDK.
/// The trusted block is the authority root, as well, as the zero-state. Each trusted block is the`id` (e.g. `root_hash`) of the already proven key-block. There can be plenty of trustedblocks, so there can be a lot of authority roots. The hashes of trusted blocks for MainNetand DevNet are hardcoded in SDK in a separated binary file (trusted_key_blocks.bin) and isbeing updated for each release by using `update_trusted_blocks` utility.
/// See [update_trusted_blocks](../../../tools/update_trusted_blocks) directory for more info.
/// In future SDK releases, one will also be able to provide their hashes of trusted blocks forother networks, besides for MainNet and DevNet.
Expand Down

0 comments on commit 4114ca1

Please sign in to comment.