2020-04-06 08:54:31 -07:00
|
|
|
//
|
|
|
|
// DO NOT EDIT.
|
|
|
|
//
|
|
|
|
// Generated by the protocol buffer compiler.
|
|
|
|
// Source: darkside.proto
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// Copyright 2018, gRPC Authors All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
import Foundation
|
2020-04-09 15:25:43 -07:00
|
|
|
import GRPC
|
|
|
|
import NIO
|
|
|
|
import NIOHTTP1
|
2020-04-06 08:54:31 -07:00
|
|
|
import SwiftProtobuf
|
2020-04-23 10:11:03 -07:00
|
|
|
@testable import ZcashLightClientKit
|
2020-04-06 08:54:31 -07:00
|
|
|
|
2020-04-09 15:25:43 -07:00
|
|
|
/// Usage: instantiate DarksideStreamerClient, then call methods of this protocol to make API calls.
|
|
|
|
internal protocol DarksideStreamerClientProtocol {
|
|
|
|
func darksideGetIncomingTransactions(_ request: Empty, callOptions: CallOptions?, handler: @escaping (RawTransaction) -> Void) -> ServerStreamingCall<Empty, RawTransaction>
|
|
|
|
func darksideSetState(_ request: DarksideState, callOptions: CallOptions?) -> UnaryCall<DarksideState, Empty>
|
2020-04-06 08:54:31 -07:00
|
|
|
}
|
|
|
|
|
2020-04-09 15:25:43 -07:00
|
|
|
internal final class DarksideStreamerClient: GRPCClient, DarksideStreamerClientProtocol {
|
|
|
|
internal let channel: GRPCChannel
|
|
|
|
internal var defaultCallOptions: CallOptions
|
|
|
|
|
|
|
|
/// Creates a client for the cash.z.wallet.sdk.rpc.DarksideStreamer service.
|
|
|
|
///
|
|
|
|
/// - Parameters:
|
|
|
|
/// - channel: `GRPCChannel` to the service host.
|
|
|
|
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
|
|
|
internal init(channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions()) {
|
|
|
|
self.channel = channel
|
|
|
|
self.defaultCallOptions = defaultCallOptions
|
2020-04-06 08:54:31 -07:00
|
|
|
}
|
|
|
|
|
2020-04-09 15:25:43 -07:00
|
|
|
/// Return the list of transactions that have been submitted (via SendTransaction).
|
|
|
|
///
|
|
|
|
/// - Parameters:
|
|
|
|
/// - request: Request to send to DarksideGetIncomingTransactions.
|
|
|
|
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
|
|
|
|
/// - handler: A closure called when each response is received from the server.
|
|
|
|
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
|
|
|
|
internal func darksideGetIncomingTransactions(_ request: Empty, callOptions: CallOptions? = nil, handler: @escaping (RawTransaction) -> Void) -> ServerStreamingCall<Empty, RawTransaction> {
|
|
|
|
return self.makeServerStreamingCall(path: "/cash.z.wallet.sdk.rpc.DarksideStreamer/DarksideGetIncomingTransactions",
|
|
|
|
request: request,
|
|
|
|
callOptions: callOptions ?? self.defaultCallOptions,
|
|
|
|
handler: handler)
|
2020-04-06 08:54:31 -07:00
|
|
|
}
|
2020-04-09 15:25:43 -07:00
|
|
|
|
|
|
|
/// Set the information that GetLightdInfo returns, except that chainName specifies
|
|
|
|
/// a file of blocks within testdata/darkside that GetBlock will return.
|
|
|
|
///
|
|
|
|
/// - Parameters:
|
|
|
|
/// - request: Request to send to DarksideSetState.
|
|
|
|
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
|
|
|
|
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
|
|
|
internal func darksideSetState(_ request: DarksideState, callOptions: CallOptions? = nil) -> UnaryCall<DarksideState, Empty> {
|
|
|
|
return self.makeUnaryCall(path: "/cash.z.wallet.sdk.rpc.DarksideStreamer/DarksideSetState",
|
|
|
|
request: request,
|
|
|
|
callOptions: callOptions ?? self.defaultCallOptions)
|
2020-04-06 08:54:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-09 15:25:43 -07:00
|
|
|
// Provides conformance to `GRPCPayload` for request and response messages
|
|
|
|
extension Empty: GRPCProtobufPayload {}
|
|
|
|
extension RawTransaction: GRPCProtobufPayload {}
|
|
|
|
extension DarksideState: GRPCProtobufPayload {}
|
2020-04-06 08:54:31 -07:00
|
|
|
|