Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ypopovych committed Jun 27, 2023
1 parent aa7c455 commit dfbd1d0
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 35 deletions.
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ var package = Package(
dependencies: [
.product(name: "Serializable", package: "Serializable.swift"),
.product(name: "JsonRPC", package: "JsonRPC.swift"),
.product(name: "JsonRPCSerializable", package: "JsonRPC.swift"),
.product(name: "ScaleCodec", package: "swift-scale-codec"),
.product(name: "Blake2", package: "Blake2.swift"),
"xxHash-Swift"
Expand Down
6 changes: 0 additions & 6 deletions Sources/Substrate/Extrinsic/ExtrinsicApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
//

import Foundation
import ScaleCodec
import JsonRPC
import Serializable
#if !COCOAPODS
import JsonRPCSerializable
#endif

public protocol ExtrinsicApi<S> {
associatedtype S: SomeSubstrate
Expand Down
1 change: 1 addition & 0 deletions Sources/Substrate/RPC/JsonRPC+Substrate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import JsonRPC
@_exported import func JsonRPC.Params

extension JSONEncoder {
public static var substrate: JSONEncoder = {
Expand Down
9 changes: 3 additions & 6 deletions Sources/Substrate/RPC/JsonRpcClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import Foundation
import JsonRPC
import Serializable
#if !COCOAPODS
import JsonRPCSerializable
#endif

public class JsonRpcCallableClient: RpcCallableClient, RuntimeHolder {
public private (set) var client: JsonRPC.Client & ContentCodersProvider
Expand All @@ -30,7 +27,7 @@ public class JsonRpcCallableClient: RpcCallableClient, RuntimeHolder {
public func call<Params: Encodable, Res: Decodable>(
method: String, params: Params
) async throws -> Res {
try await client.call(method: method, params: params)
try await client.call(method: method, params: params, SerializableValue.self)
}

public var runtime: any Runtime {
Expand Down Expand Up @@ -132,7 +129,7 @@ public class JsonRpcSubscribableClient: JsonRpcCallableClient, NotificationDeleg
public func subscribe<P, E>(
method: String, params: P, unsubsribe umethod: String
) async throws -> AsyncThrowingStream<E, Swift.Error> where P : Encodable, E : Decodable {
let subscriptionId: String = try await client.call(method: method, params: params)
let subscriptionId: String = try await client.call(method: method, params: params, SerializableValue.self)
return AsyncThrowingStream { continuation in
let unsubscribe = { [weak self] in
guard let this = self else { return }
Expand Down Expand Up @@ -208,7 +205,7 @@ public class JsonRpcSubscribableClient: JsonRpcCallableClient, NotificationDeleg

private func unsubscribe(id: String, method: String) async throws {
try await self.subscriptions.remove(id: id)
let result: Bool = try await self.client.call(method: method, params: Params(id))
let result: Bool = try await self.client.call(method: method, params: Params(id), SerializableValue.self)
if !result { throw Error.unsubscribeFailed }
}

Expand Down
6 changes: 0 additions & 6 deletions Sources/Substrate/RPC/RpcApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
//

import Foundation
import ScaleCodec
import JsonRPC
import Serializable
#if !COCOAPODS
import JsonRPCSerializable
#endif

public protocol RpcApi<S> {
associatedtype S: SomeSubstrate
Expand Down
1 change: 0 additions & 1 deletion Sources/Substrate/Runtime/Types+RuntimeCodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import Foundation
import ScaleCodec
import Serializable

extension Bool: RuntimeCodable {}
extension Data: RuntimeCodable {}
Expand Down
6 changes: 0 additions & 6 deletions Sources/Substrate/RuntimeCall/RuntimeCallApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
//

import Foundation
import ScaleCodec
import JsonRPC
import Serializable
#if !COCOAPODS
import JsonRPCSerializable
#endif

public protocol RuntimeCallApi<S> {
associatedtype S: SomeSubstrate
Expand Down
6 changes: 0 additions & 6 deletions Sources/Substrate/Storage/StorageApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
//

import Foundation
import ScaleCodec
import JsonRPC
import Serializable
#if !COCOAPODS
import JsonRPCSerializable
#endif

public protocol StorageApi<S> {
associatedtype S: SomeSubstrate
Expand Down
1 change: 0 additions & 1 deletion Sources/Substrate/Substrate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//

import Foundation
import JsonRPC

public protocol SomeSubstrate<RC>: AnyObject {
associatedtype RC: Config
Expand Down
1 change: 0 additions & 1 deletion Sources/Substrate/Utils/LazyProperty.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//

import Foundation
import JsonRPC

public struct LazyProperty<Value> {
private let _value: Synced<Either<() -> Value, Value>>
Expand Down
1 change: 0 additions & 1 deletion Tests/SubstrateTests/SubstrateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import XCTest
import ScaleCodec
import JsonRPC
@testable import Substrate

final class SubstrateTests: XCTestCase {
Expand Down

0 comments on commit dfbd1d0

Please sign in to comment.