Client

public class Client

Steem-flavoured JSON-RPC 2.0 client.

  • All errors Client can throw.

    See more

    Declaration

    Swift

    public enum Error : LocalizedError
  • The RPC Server address.

    Declaration

    Swift

    public let address: URL
  • Create a new client instance.

    Declaration

    Swift

    public init(address: URL, session: URLSession = URLSession.shared)

    Parameters

    address

    The rpc server to connect to.

    session

    The session to use when sending requests to the server.

  • Send a JSON-RPC 2.0 request.

    Declaration

    Swift

    public func send<T: Request>(_ request: T, completionHandler: @escaping (T.Response?, Swift.Error?) -> Void) -> Void

    Parameters

    request

    The request to be sent.

    completionHandler

    Callback function, called with either a response or an error.

  • Blocking .send(..).

    Warning

    This should never be called from the main thread.

    Declaration

    Swift

    public func sendSynchronous<T>(_ request: T) throws -> T.Response! where T : Request
  • Steem-style date formatter (ISO 8601 minus Z at the end).

    Declaration

    Swift

    public static let dateFormatter: DateFormatter
  • Returns a JSONDecoder instance configured for the Steem JSON format.

    Declaration

    Swift

    public static func JSONDecoder() -> Foundation.JSONDecoder
  • Returns a JSONEncoder instance configured for the Steem JSON format.

    Declaration

    Swift

    public static func JSONEncoder() -> Foundation.JSONEncoder