ZcashLightClientKit/Sources/ZcashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.grpc.swift

2177 lines
85 KiB
Swift

//
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the protocol buffer compiler.
// Source: service.proto
//
import GRPC
import NIO
import NIOConcurrencyHelpers
import SwiftProtobuf
/// Usage: instantiate `CompactTxStreamerClient`, then call methods of this protocol to make API calls.
internal protocol CompactTxStreamerClientProtocol: GRPCClient {
var serviceName: String { get }
var interceptors: CompactTxStreamerClientInterceptorFactoryProtocol? { get }
func getLatestBlock(
_ request: ChainSpec,
callOptions: CallOptions?
) -> UnaryCall<ChainSpec, BlockID>
func getBlock(
_ request: BlockID,
callOptions: CallOptions?
) -> UnaryCall<BlockID, CompactBlock>
func getBlockNullifiers(
_ request: BlockID,
callOptions: CallOptions?
) -> UnaryCall<BlockID, CompactBlock>
func getBlockRange(
_ request: BlockRange,
callOptions: CallOptions?,
handler: @escaping (CompactBlock) -> Void
) -> ServerStreamingCall<BlockRange, CompactBlock>
func getBlockRangeNullifiers(
_ request: BlockRange,
callOptions: CallOptions?,
handler: @escaping (CompactBlock) -> Void
) -> ServerStreamingCall<BlockRange, CompactBlock>
func getTransaction(
_ request: TxFilter,
callOptions: CallOptions?
) -> UnaryCall<TxFilter, RawTransaction>
func sendTransaction(
_ request: RawTransaction,
callOptions: CallOptions?
) -> UnaryCall<RawTransaction, SendResponse>
func getTaddressTxids(
_ request: TransparentAddressBlockFilter,
callOptions: CallOptions?,
handler: @escaping (RawTransaction) -> Void
) -> ServerStreamingCall<TransparentAddressBlockFilter, RawTransaction>
func getTaddressBalance(
_ request: AddressList,
callOptions: CallOptions?
) -> UnaryCall<AddressList, Balance>
func getTaddressBalanceStream(
callOptions: CallOptions?
) -> ClientStreamingCall<Address, Balance>
func getMempoolTx(
_ request: Exclude,
callOptions: CallOptions?,
handler: @escaping (CompactTx) -> Void
) -> ServerStreamingCall<Exclude, CompactTx>
func getMempoolStream(
_ request: Empty,
callOptions: CallOptions?,
handler: @escaping (RawTransaction) -> Void
) -> ServerStreamingCall<Empty, RawTransaction>
func getTreeState(
_ request: BlockID,
callOptions: CallOptions?
) -> UnaryCall<BlockID, TreeState>
func getLatestTreeState(
_ request: Empty,
callOptions: CallOptions?
) -> UnaryCall<Empty, TreeState>
func getSubtreeRoots(
_ request: GetSubtreeRootsArg,
callOptions: CallOptions?,
handler: @escaping (SubtreeRoot) -> Void
) -> ServerStreamingCall<GetSubtreeRootsArg, SubtreeRoot>
func getAddressUtxos(
_ request: GetAddressUtxosArg,
callOptions: CallOptions?
) -> UnaryCall<GetAddressUtxosArg, GetAddressUtxosReplyList>
func getAddressUtxosStream(
_ request: GetAddressUtxosArg,
callOptions: CallOptions?,
handler: @escaping (GetAddressUtxosReply) -> Void
) -> ServerStreamingCall<GetAddressUtxosArg, GetAddressUtxosReply>
func getLightdInfo(
_ request: Empty,
callOptions: CallOptions?
) -> UnaryCall<Empty, LightdInfo>
func ping(
_ request: Duration,
callOptions: CallOptions?
) -> UnaryCall<Duration, PingResponse>
}
extension CompactTxStreamerClientProtocol {
internal var serviceName: String {
return "cash.z.wallet.sdk.rpc.CompactTxStreamer"
}
/// Return the height of the tip of the best chain
///
/// - Parameters:
/// - request: Request to send to GetLatestBlock.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getLatestBlock(
_ request: ChainSpec,
callOptions: CallOptions? = nil
) -> UnaryCall<ChainSpec, BlockID> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLatestBlock.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLatestBlockInterceptors() ?? []
)
}
/// Return the compact block corresponding to the given block identifier
///
/// - Parameters:
/// - request: Request to send to GetBlock.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getBlock(
_ request: BlockID,
callOptions: CallOptions? = nil
) -> UnaryCall<BlockID, CompactBlock> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getBlock.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockInterceptors() ?? []
)
}
/// Same as GetBlock except actions contain only nullifiers
///
/// - Parameters:
/// - request: Request to send to GetBlockNullifiers.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getBlockNullifiers(
_ request: BlockID,
callOptions: CallOptions? = nil
) -> UnaryCall<BlockID, CompactBlock> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockNullifiers.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockNullifiersInterceptors() ?? []
)
}
/// Return a list of consecutive compact blocks
///
/// - Parameters:
/// - request: Request to send to GetBlockRange.
/// - callOptions: Call options.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
internal func getBlockRange(
_ request: BlockRange,
callOptions: CallOptions? = nil,
handler: @escaping (CompactBlock) -> Void
) -> ServerStreamingCall<BlockRange, CompactBlock> {
return self.makeServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockRange.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockRangeInterceptors() ?? [],
handler: handler
)
}
/// Same as GetBlockRange except actions contain only nullifiers
///
/// - Parameters:
/// - request: Request to send to GetBlockRangeNullifiers.
/// - callOptions: Call options.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
internal func getBlockRangeNullifiers(
_ request: BlockRange,
callOptions: CallOptions? = nil,
handler: @escaping (CompactBlock) -> Void
) -> ServerStreamingCall<BlockRange, CompactBlock> {
return self.makeServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockRangeNullifiers.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockRangeNullifiersInterceptors() ?? [],
handler: handler
)
}
/// Return the requested full (not compact) transaction (as from zcashd)
///
/// - Parameters:
/// - request: Request to send to GetTransaction.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getTransaction(
_ request: TxFilter,
callOptions: CallOptions? = nil
) -> UnaryCall<TxFilter, RawTransaction> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTransaction.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTransactionInterceptors() ?? []
)
}
/// Submit the given transaction to the Zcash network
///
/// - Parameters:
/// - request: Request to send to SendTransaction.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func sendTransaction(
_ request: RawTransaction,
callOptions: CallOptions? = nil
) -> UnaryCall<RawTransaction, SendResponse> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.sendTransaction.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeSendTransactionInterceptors() ?? []
)
}
/// Return the transactions corresponding to the given t-address within the given block range
/// NB - this method is misnamed, it returns transactions, not transaction IDs.
///
/// - Parameters:
/// - request: Request to send to GetTaddressTxids.
/// - callOptions: Call options.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
internal func getTaddressTxids(
_ request: TransparentAddressBlockFilter,
callOptions: CallOptions? = nil,
handler: @escaping (RawTransaction) -> Void
) -> ServerStreamingCall<TransparentAddressBlockFilter, RawTransaction> {
return self.makeServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressTxids.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressTxidsInterceptors() ?? [],
handler: handler
)
}
/// Unary call to GetTaddressBalance
///
/// - Parameters:
/// - request: Request to send to GetTaddressBalance.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getTaddressBalance(
_ request: AddressList,
callOptions: CallOptions? = nil
) -> UnaryCall<AddressList, Balance> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressBalance.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressBalanceInterceptors() ?? []
)
}
/// Client streaming call to GetTaddressBalanceStream
///
/// Callers should use the `send` method on the returned object to send messages
/// to the server. The caller should send an `.end` after the final message has been sent.
///
/// - Parameters:
/// - callOptions: Call options.
/// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
internal func getTaddressBalanceStream(
callOptions: CallOptions? = nil
) -> ClientStreamingCall<Address, Balance> {
return self.makeClientStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressBalanceStream.path,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressBalanceStreamInterceptors() ?? []
)
}
/// Return the compact transactions currently in the mempool; the results
/// can be a few seconds out of date. If the Exclude list is empty, return
/// all transactions; otherwise return all *except* those in the Exclude list
/// (if any); this allows the client to avoid receiving transactions that it
/// already has (from an earlier call to this rpc). The transaction IDs in the
/// Exclude list can be shortened to any number of bytes to make the request
/// more bandwidth-efficient; if two or more transactions in the mempool
/// match a shortened txid, they are all sent (none is excluded). Transactions
/// in the exclude list that don't exist in the mempool are ignored.
///
/// - Parameters:
/// - request: Request to send to GetMempoolTx.
/// - callOptions: Call options.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
internal func getMempoolTx(
_ request: Exclude,
callOptions: CallOptions? = nil,
handler: @escaping (CompactTx) -> Void
) -> ServerStreamingCall<Exclude, CompactTx> {
return self.makeServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getMempoolTx.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetMempoolTxInterceptors() ?? [],
handler: handler
)
}
/// Return a stream of current Mempool transactions. This will keep the output stream open while
/// there are mempool transactions. It will close the returned stream when a new block is mined.
///
/// - Parameters:
/// - request: Request to send to GetMempoolStream.
/// - callOptions: Call options.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
internal func getMempoolStream(
_ request: Empty,
callOptions: CallOptions? = nil,
handler: @escaping (RawTransaction) -> Void
) -> ServerStreamingCall<Empty, RawTransaction> {
return self.makeServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getMempoolStream.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetMempoolStreamInterceptors() ?? [],
handler: handler
)
}
/// GetTreeState returns the note commitment tree state corresponding to the given block.
/// See section 3.7 of the Zcash protocol specification. It returns several other useful
/// values also (even though they can be obtained using GetBlock).
/// The block can be specified by either height or hash.
///
/// - Parameters:
/// - request: Request to send to GetTreeState.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getTreeState(
_ request: BlockID,
callOptions: CallOptions? = nil
) -> UnaryCall<BlockID, TreeState> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTreeState.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTreeStateInterceptors() ?? []
)
}
/// Unary call to GetLatestTreeState
///
/// - Parameters:
/// - request: Request to send to GetLatestTreeState.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getLatestTreeState(
_ request: Empty,
callOptions: CallOptions? = nil
) -> UnaryCall<Empty, TreeState> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLatestTreeState.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLatestTreeStateInterceptors() ?? []
)
}
/// Returns a stream of information about roots of subtrees of the note commitment tree
/// for the specified shielded protocol (Sapling or Orchard).
///
/// - Parameters:
/// - request: Request to send to GetSubtreeRoots.
/// - callOptions: Call options.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
internal func getSubtreeRoots(
_ request: GetSubtreeRootsArg,
callOptions: CallOptions? = nil,
handler: @escaping (SubtreeRoot) -> Void
) -> ServerStreamingCall<GetSubtreeRootsArg, SubtreeRoot> {
return self.makeServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getSubtreeRoots.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetSubtreeRootsInterceptors() ?? [],
handler: handler
)
}
/// Unary call to GetAddressUtxos
///
/// - Parameters:
/// - request: Request to send to GetAddressUtxos.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getAddressUtxos(
_ request: GetAddressUtxosArg,
callOptions: CallOptions? = nil
) -> UnaryCall<GetAddressUtxosArg, GetAddressUtxosReplyList> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getAddressUtxos.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetAddressUtxosInterceptors() ?? []
)
}
/// Server streaming call to GetAddressUtxosStream
///
/// - Parameters:
/// - request: Request to send to GetAddressUtxosStream.
/// - callOptions: Call options.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
internal func getAddressUtxosStream(
_ request: GetAddressUtxosArg,
callOptions: CallOptions? = nil,
handler: @escaping (GetAddressUtxosReply) -> Void
) -> ServerStreamingCall<GetAddressUtxosArg, GetAddressUtxosReply> {
return self.makeServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getAddressUtxosStream.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetAddressUtxosStreamInterceptors() ?? [],
handler: handler
)
}
/// Return information about this lightwalletd instance and the blockchain
///
/// - Parameters:
/// - request: Request to send to GetLightdInfo.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func getLightdInfo(
_ request: Empty,
callOptions: CallOptions? = nil
) -> UnaryCall<Empty, LightdInfo> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLightdInfo.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLightdInfoInterceptors() ?? []
)
}
/// Testing-only, requires lightwalletd --ping-very-insecure (do not enable in production)
///
/// - Parameters:
/// - request: Request to send to Ping.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
internal func ping(
_ request: Duration,
callOptions: CallOptions? = nil
) -> UnaryCall<Duration, PingResponse> {
return self.makeUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.ping.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makePingInterceptors() ?? []
)
}
}
@available(*, deprecated)
extension CompactTxStreamerClient: @unchecked Sendable {}
@available(*, deprecated, renamed: "CompactTxStreamerNIOClient")
internal final class CompactTxStreamerClient: CompactTxStreamerClientProtocol {
private let lock = Lock()
private var _defaultCallOptions: CallOptions
private var _interceptors: CompactTxStreamerClientInterceptorFactoryProtocol?
internal let channel: GRPCChannel
internal var defaultCallOptions: CallOptions {
get { self.lock.withLock { return self._defaultCallOptions } }
set { self.lock.withLockVoid { self._defaultCallOptions = newValue } }
}
internal var interceptors: CompactTxStreamerClientInterceptorFactoryProtocol? {
get { self.lock.withLock { return self._interceptors } }
set { self.lock.withLockVoid { self._interceptors = newValue } }
}
/// Creates a client for the cash.z.wallet.sdk.rpc.CompactTxStreamer service.
///
/// - Parameters:
/// - channel: `GRPCChannel` to the service host.
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
/// - interceptors: A factory providing interceptors for each RPC.
internal init(
channel: GRPCChannel,
defaultCallOptions: CallOptions = CallOptions(),
interceptors: CompactTxStreamerClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self._defaultCallOptions = defaultCallOptions
self._interceptors = interceptors
}
}
internal struct CompactTxStreamerNIOClient: CompactTxStreamerClientProtocol {
internal var channel: GRPCChannel
internal var defaultCallOptions: CallOptions
internal var interceptors: CompactTxStreamerClientInterceptorFactoryProtocol?
/// Creates a client for the cash.z.wallet.sdk.rpc.CompactTxStreamer service.
///
/// - Parameters:
/// - channel: `GRPCChannel` to the service host.
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
/// - interceptors: A factory providing interceptors for each RPC.
internal init(
channel: GRPCChannel,
defaultCallOptions: CallOptions = CallOptions(),
interceptors: CompactTxStreamerClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self.defaultCallOptions = defaultCallOptions
self.interceptors = interceptors
}
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal protocol CompactTxStreamerAsyncClientProtocol: GRPCClient {
static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: CompactTxStreamerClientInterceptorFactoryProtocol? { get }
func makeGetLatestBlockCall(
_ request: ChainSpec,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<ChainSpec, BlockID>
func makeGetBlockCall(
_ request: BlockID,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<BlockID, CompactBlock>
func makeGetBlockNullifiersCall(
_ request: BlockID,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<BlockID, CompactBlock>
func makeGetBlockRangeCall(
_ request: BlockRange,
callOptions: CallOptions?
) -> GRPCAsyncServerStreamingCall<BlockRange, CompactBlock>
func makeGetBlockRangeNullifiersCall(
_ request: BlockRange,
callOptions: CallOptions?
) -> GRPCAsyncServerStreamingCall<BlockRange, CompactBlock>
func makeGetTransactionCall(
_ request: TxFilter,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<TxFilter, RawTransaction>
func makeSendTransactionCall(
_ request: RawTransaction,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<RawTransaction, SendResponse>
func makeGetTaddressTxidsCall(
_ request: TransparentAddressBlockFilter,
callOptions: CallOptions?
) -> GRPCAsyncServerStreamingCall<TransparentAddressBlockFilter, RawTransaction>
func makeGetTaddressBalanceCall(
_ request: AddressList,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<AddressList, Balance>
func makeGetTaddressBalanceStreamCall(
callOptions: CallOptions?
) -> GRPCAsyncClientStreamingCall<Address, Balance>
func makeGetMempoolTxCall(
_ request: Exclude,
callOptions: CallOptions?
) -> GRPCAsyncServerStreamingCall<Exclude, CompactTx>
func makeGetMempoolStreamCall(
_ request: Empty,
callOptions: CallOptions?
) -> GRPCAsyncServerStreamingCall<Empty, RawTransaction>
func makeGetTreeStateCall(
_ request: BlockID,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<BlockID, TreeState>
func makeGetLatestTreeStateCall(
_ request: Empty,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<Empty, TreeState>
func makeGetSubtreeRootsCall(
_ request: GetSubtreeRootsArg,
callOptions: CallOptions?
) -> GRPCAsyncServerStreamingCall<GetSubtreeRootsArg, SubtreeRoot>
func makeGetAddressUtxosCall(
_ request: GetAddressUtxosArg,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<GetAddressUtxosArg, GetAddressUtxosReplyList>
func makeGetAddressUtxosStreamCall(
_ request: GetAddressUtxosArg,
callOptions: CallOptions?
) -> GRPCAsyncServerStreamingCall<GetAddressUtxosArg, GetAddressUtxosReply>
func makeGetLightdInfoCall(
_ request: Empty,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<Empty, LightdInfo>
func makePingCall(
_ request: Duration,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<Duration, PingResponse>
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension CompactTxStreamerAsyncClientProtocol {
internal static var serviceDescriptor: GRPCServiceDescriptor {
return CompactTxStreamerClientMetadata.serviceDescriptor
}
internal var interceptors: CompactTxStreamerClientInterceptorFactoryProtocol? {
return nil
}
internal func makeGetLatestBlockCall(
_ request: ChainSpec,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<ChainSpec, BlockID> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLatestBlock.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLatestBlockInterceptors() ?? []
)
}
internal func makeGetBlockCall(
_ request: BlockID,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<BlockID, CompactBlock> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getBlock.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockInterceptors() ?? []
)
}
internal func makeGetBlockNullifiersCall(
_ request: BlockID,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<BlockID, CompactBlock> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockNullifiers.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockNullifiersInterceptors() ?? []
)
}
internal func makeGetBlockRangeCall(
_ request: BlockRange,
callOptions: CallOptions? = nil
) -> GRPCAsyncServerStreamingCall<BlockRange, CompactBlock> {
return self.makeAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockRange.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockRangeInterceptors() ?? []
)
}
internal func makeGetBlockRangeNullifiersCall(
_ request: BlockRange,
callOptions: CallOptions? = nil
) -> GRPCAsyncServerStreamingCall<BlockRange, CompactBlock> {
return self.makeAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockRangeNullifiers.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockRangeNullifiersInterceptors() ?? []
)
}
internal func makeGetTransactionCall(
_ request: TxFilter,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<TxFilter, RawTransaction> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTransaction.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTransactionInterceptors() ?? []
)
}
internal func makeSendTransactionCall(
_ request: RawTransaction,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<RawTransaction, SendResponse> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.sendTransaction.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeSendTransactionInterceptors() ?? []
)
}
internal func makeGetTaddressTxidsCall(
_ request: TransparentAddressBlockFilter,
callOptions: CallOptions? = nil
) -> GRPCAsyncServerStreamingCall<TransparentAddressBlockFilter, RawTransaction> {
return self.makeAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressTxids.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressTxidsInterceptors() ?? []
)
}
internal func makeGetTaddressBalanceCall(
_ request: AddressList,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<AddressList, Balance> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressBalance.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressBalanceInterceptors() ?? []
)
}
internal func makeGetTaddressBalanceStreamCall(
callOptions: CallOptions? = nil
) -> GRPCAsyncClientStreamingCall<Address, Balance> {
return self.makeAsyncClientStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressBalanceStream.path,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressBalanceStreamInterceptors() ?? []
)
}
internal func makeGetMempoolTxCall(
_ request: Exclude,
callOptions: CallOptions? = nil
) -> GRPCAsyncServerStreamingCall<Exclude, CompactTx> {
return self.makeAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getMempoolTx.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetMempoolTxInterceptors() ?? []
)
}
internal func makeGetMempoolStreamCall(
_ request: Empty,
callOptions: CallOptions? = nil
) -> GRPCAsyncServerStreamingCall<Empty, RawTransaction> {
return self.makeAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getMempoolStream.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetMempoolStreamInterceptors() ?? []
)
}
internal func makeGetTreeStateCall(
_ request: BlockID,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<BlockID, TreeState> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTreeState.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTreeStateInterceptors() ?? []
)
}
internal func makeGetLatestTreeStateCall(
_ request: Empty,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<Empty, TreeState> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLatestTreeState.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLatestTreeStateInterceptors() ?? []
)
}
internal func makeGetSubtreeRootsCall(
_ request: GetSubtreeRootsArg,
callOptions: CallOptions? = nil
) -> GRPCAsyncServerStreamingCall<GetSubtreeRootsArg, SubtreeRoot> {
return self.makeAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getSubtreeRoots.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetSubtreeRootsInterceptors() ?? []
)
}
internal func makeGetAddressUtxosCall(
_ request: GetAddressUtxosArg,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<GetAddressUtxosArg, GetAddressUtxosReplyList> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getAddressUtxos.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetAddressUtxosInterceptors() ?? []
)
}
internal func makeGetAddressUtxosStreamCall(
_ request: GetAddressUtxosArg,
callOptions: CallOptions? = nil
) -> GRPCAsyncServerStreamingCall<GetAddressUtxosArg, GetAddressUtxosReply> {
return self.makeAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getAddressUtxosStream.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetAddressUtxosStreamInterceptors() ?? []
)
}
internal func makeGetLightdInfoCall(
_ request: Empty,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<Empty, LightdInfo> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLightdInfo.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLightdInfoInterceptors() ?? []
)
}
internal func makePingCall(
_ request: Duration,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<Duration, PingResponse> {
return self.makeAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.ping.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makePingInterceptors() ?? []
)
}
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension CompactTxStreamerAsyncClientProtocol {
internal func getLatestBlock(
_ request: ChainSpec,
callOptions: CallOptions? = nil
) async throws -> BlockID {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLatestBlock.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLatestBlockInterceptors() ?? []
)
}
internal func getBlock(
_ request: BlockID,
callOptions: CallOptions? = nil
) async throws -> CompactBlock {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getBlock.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockInterceptors() ?? []
)
}
internal func getBlockNullifiers(
_ request: BlockID,
callOptions: CallOptions? = nil
) async throws -> CompactBlock {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockNullifiers.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockNullifiersInterceptors() ?? []
)
}
internal func getBlockRange(
_ request: BlockRange,
callOptions: CallOptions? = nil
) -> GRPCAsyncResponseStream<CompactBlock> {
return self.performAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockRange.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockRangeInterceptors() ?? []
)
}
internal func getBlockRangeNullifiers(
_ request: BlockRange,
callOptions: CallOptions? = nil
) -> GRPCAsyncResponseStream<CompactBlock> {
return self.performAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getBlockRangeNullifiers.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetBlockRangeNullifiersInterceptors() ?? []
)
}
internal func getTransaction(
_ request: TxFilter,
callOptions: CallOptions? = nil
) async throws -> RawTransaction {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTransaction.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTransactionInterceptors() ?? []
)
}
internal func sendTransaction(
_ request: RawTransaction,
callOptions: CallOptions? = nil
) async throws -> SendResponse {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.sendTransaction.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeSendTransactionInterceptors() ?? []
)
}
internal func getTaddressTxids(
_ request: TransparentAddressBlockFilter,
callOptions: CallOptions? = nil
) -> GRPCAsyncResponseStream<RawTransaction> {
return self.performAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressTxids.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressTxidsInterceptors() ?? []
)
}
internal func getTaddressBalance(
_ request: AddressList,
callOptions: CallOptions? = nil
) async throws -> Balance {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressBalance.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressBalanceInterceptors() ?? []
)
}
internal func getTaddressBalanceStream<RequestStream>(
_ requests: RequestStream,
callOptions: CallOptions? = nil
) async throws -> Balance where RequestStream: Sequence, RequestStream.Element == Address {
return try await self.performAsyncClientStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressBalanceStream.path,
requests: requests,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressBalanceStreamInterceptors() ?? []
)
}
internal func getTaddressBalanceStream<RequestStream>(
_ requests: RequestStream,
callOptions: CallOptions? = nil
) async throws -> Balance where RequestStream: AsyncSequence & Sendable, RequestStream.Element == Address {
return try await self.performAsyncClientStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getTaddressBalanceStream.path,
requests: requests,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTaddressBalanceStreamInterceptors() ?? []
)
}
internal func getMempoolTx(
_ request: Exclude,
callOptions: CallOptions? = nil
) -> GRPCAsyncResponseStream<CompactTx> {
return self.performAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getMempoolTx.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetMempoolTxInterceptors() ?? []
)
}
internal func getMempoolStream(
_ request: Empty,
callOptions: CallOptions? = nil
) -> GRPCAsyncResponseStream<RawTransaction> {
return self.performAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getMempoolStream.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetMempoolStreamInterceptors() ?? []
)
}
internal func getTreeState(
_ request: BlockID,
callOptions: CallOptions? = nil
) async throws -> TreeState {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getTreeState.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetTreeStateInterceptors() ?? []
)
}
internal func getLatestTreeState(
_ request: Empty,
callOptions: CallOptions? = nil
) async throws -> TreeState {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLatestTreeState.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLatestTreeStateInterceptors() ?? []
)
}
internal func getSubtreeRoots(
_ request: GetSubtreeRootsArg,
callOptions: CallOptions? = nil
) -> GRPCAsyncResponseStream<SubtreeRoot> {
return self.performAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getSubtreeRoots.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetSubtreeRootsInterceptors() ?? []
)
}
internal func getAddressUtxos(
_ request: GetAddressUtxosArg,
callOptions: CallOptions? = nil
) async throws -> GetAddressUtxosReplyList {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getAddressUtxos.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetAddressUtxosInterceptors() ?? []
)
}
internal func getAddressUtxosStream(
_ request: GetAddressUtxosArg,
callOptions: CallOptions? = nil
) -> GRPCAsyncResponseStream<GetAddressUtxosReply> {
return self.performAsyncServerStreamingCall(
path: CompactTxStreamerClientMetadata.Methods.getAddressUtxosStream.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetAddressUtxosStreamInterceptors() ?? []
)
}
internal func getLightdInfo(
_ request: Empty,
callOptions: CallOptions? = nil
) async throws -> LightdInfo {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.getLightdInfo.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeGetLightdInfoInterceptors() ?? []
)
}
internal func ping(
_ request: Duration,
callOptions: CallOptions? = nil
) async throws -> PingResponse {
return try await self.performAsyncUnaryCall(
path: CompactTxStreamerClientMetadata.Methods.ping.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makePingInterceptors() ?? []
)
}
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal struct CompactTxStreamerAsyncClient: CompactTxStreamerAsyncClientProtocol {
internal var channel: GRPCChannel
internal var defaultCallOptions: CallOptions
internal var interceptors: CompactTxStreamerClientInterceptorFactoryProtocol?
internal init(
channel: GRPCChannel,
defaultCallOptions: CallOptions = CallOptions(),
interceptors: CompactTxStreamerClientInterceptorFactoryProtocol? = nil
) {
self.channel = channel
self.defaultCallOptions = defaultCallOptions
self.interceptors = interceptors
}
}
internal protocol CompactTxStreamerClientInterceptorFactoryProtocol: Sendable {
/// - Returns: Interceptors to use when invoking 'getLatestBlock'.
func makeGetLatestBlockInterceptors() -> [ClientInterceptor<ChainSpec, BlockID>]
/// - Returns: Interceptors to use when invoking 'getBlock'.
func makeGetBlockInterceptors() -> [ClientInterceptor<BlockID, CompactBlock>]
/// - Returns: Interceptors to use when invoking 'getBlockNullifiers'.
func makeGetBlockNullifiersInterceptors() -> [ClientInterceptor<BlockID, CompactBlock>]
/// - Returns: Interceptors to use when invoking 'getBlockRange'.
func makeGetBlockRangeInterceptors() -> [ClientInterceptor<BlockRange, CompactBlock>]
/// - Returns: Interceptors to use when invoking 'getBlockRangeNullifiers'.
func makeGetBlockRangeNullifiersInterceptors() -> [ClientInterceptor<BlockRange, CompactBlock>]
/// - Returns: Interceptors to use when invoking 'getTransaction'.
func makeGetTransactionInterceptors() -> [ClientInterceptor<TxFilter, RawTransaction>]
/// - Returns: Interceptors to use when invoking 'sendTransaction'.
func makeSendTransactionInterceptors() -> [ClientInterceptor<RawTransaction, SendResponse>]
/// - Returns: Interceptors to use when invoking 'getTaddressTxids'.
func makeGetTaddressTxidsInterceptors() -> [ClientInterceptor<TransparentAddressBlockFilter, RawTransaction>]
/// - Returns: Interceptors to use when invoking 'getTaddressBalance'.
func makeGetTaddressBalanceInterceptors() -> [ClientInterceptor<AddressList, Balance>]
/// - Returns: Interceptors to use when invoking 'getTaddressBalanceStream'.
func makeGetTaddressBalanceStreamInterceptors() -> [ClientInterceptor<Address, Balance>]
/// - Returns: Interceptors to use when invoking 'getMempoolTx'.
func makeGetMempoolTxInterceptors() -> [ClientInterceptor<Exclude, CompactTx>]
/// - Returns: Interceptors to use when invoking 'getMempoolStream'.
func makeGetMempoolStreamInterceptors() -> [ClientInterceptor<Empty, RawTransaction>]
/// - Returns: Interceptors to use when invoking 'getTreeState'.
func makeGetTreeStateInterceptors() -> [ClientInterceptor<BlockID, TreeState>]
/// - Returns: Interceptors to use when invoking 'getLatestTreeState'.
func makeGetLatestTreeStateInterceptors() -> [ClientInterceptor<Empty, TreeState>]
/// - Returns: Interceptors to use when invoking 'getSubtreeRoots'.
func makeGetSubtreeRootsInterceptors() -> [ClientInterceptor<GetSubtreeRootsArg, SubtreeRoot>]
/// - Returns: Interceptors to use when invoking 'getAddressUtxos'.
func makeGetAddressUtxosInterceptors() -> [ClientInterceptor<GetAddressUtxosArg, GetAddressUtxosReplyList>]
/// - Returns: Interceptors to use when invoking 'getAddressUtxosStream'.
func makeGetAddressUtxosStreamInterceptors() -> [ClientInterceptor<GetAddressUtxosArg, GetAddressUtxosReply>]
/// - Returns: Interceptors to use when invoking 'getLightdInfo'.
func makeGetLightdInfoInterceptors() -> [ClientInterceptor<Empty, LightdInfo>]
/// - Returns: Interceptors to use when invoking 'ping'.
func makePingInterceptors() -> [ClientInterceptor<Duration, PingResponse>]
}
internal enum CompactTxStreamerClientMetadata {
internal static let serviceDescriptor = GRPCServiceDescriptor(
name: "CompactTxStreamer",
fullName: "cash.z.wallet.sdk.rpc.CompactTxStreamer",
methods: [
CompactTxStreamerClientMetadata.Methods.getLatestBlock,
CompactTxStreamerClientMetadata.Methods.getBlock,
CompactTxStreamerClientMetadata.Methods.getBlockNullifiers,
CompactTxStreamerClientMetadata.Methods.getBlockRange,
CompactTxStreamerClientMetadata.Methods.getBlockRangeNullifiers,
CompactTxStreamerClientMetadata.Methods.getTransaction,
CompactTxStreamerClientMetadata.Methods.sendTransaction,
CompactTxStreamerClientMetadata.Methods.getTaddressTxids,
CompactTxStreamerClientMetadata.Methods.getTaddressBalance,
CompactTxStreamerClientMetadata.Methods.getTaddressBalanceStream,
CompactTxStreamerClientMetadata.Methods.getMempoolTx,
CompactTxStreamerClientMetadata.Methods.getMempoolStream,
CompactTxStreamerClientMetadata.Methods.getTreeState,
CompactTxStreamerClientMetadata.Methods.getLatestTreeState,
CompactTxStreamerClientMetadata.Methods.getSubtreeRoots,
CompactTxStreamerClientMetadata.Methods.getAddressUtxos,
CompactTxStreamerClientMetadata.Methods.getAddressUtxosStream,
CompactTxStreamerClientMetadata.Methods.getLightdInfo,
CompactTxStreamerClientMetadata.Methods.ping,
]
)
internal enum Methods {
internal static let getLatestBlock = GRPCMethodDescriptor(
name: "GetLatestBlock",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock",
type: GRPCCallType.unary
)
internal static let getBlock = GRPCMethodDescriptor(
name: "GetBlock",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock",
type: GRPCCallType.unary
)
internal static let getBlockNullifiers = GRPCMethodDescriptor(
name: "GetBlockNullifiers",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockNullifiers",
type: GRPCCallType.unary
)
internal static let getBlockRange = GRPCMethodDescriptor(
name: "GetBlockRange",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange",
type: GRPCCallType.serverStreaming
)
internal static let getBlockRangeNullifiers = GRPCMethodDescriptor(
name: "GetBlockRangeNullifiers",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRangeNullifiers",
type: GRPCCallType.serverStreaming
)
internal static let getTransaction = GRPCMethodDescriptor(
name: "GetTransaction",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction",
type: GRPCCallType.unary
)
internal static let sendTransaction = GRPCMethodDescriptor(
name: "SendTransaction",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction",
type: GRPCCallType.unary
)
internal static let getTaddressTxids = GRPCMethodDescriptor(
name: "GetTaddressTxids",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids",
type: GRPCCallType.serverStreaming
)
internal static let getTaddressBalance = GRPCMethodDescriptor(
name: "GetTaddressBalance",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance",
type: GRPCCallType.unary
)
internal static let getTaddressBalanceStream = GRPCMethodDescriptor(
name: "GetTaddressBalanceStream",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream",
type: GRPCCallType.clientStreaming
)
internal static let getMempoolTx = GRPCMethodDescriptor(
name: "GetMempoolTx",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx",
type: GRPCCallType.serverStreaming
)
internal static let getMempoolStream = GRPCMethodDescriptor(
name: "GetMempoolStream",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream",
type: GRPCCallType.serverStreaming
)
internal static let getTreeState = GRPCMethodDescriptor(
name: "GetTreeState",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState",
type: GRPCCallType.unary
)
internal static let getLatestTreeState = GRPCMethodDescriptor(
name: "GetLatestTreeState",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestTreeState",
type: GRPCCallType.unary
)
internal static let getSubtreeRoots = GRPCMethodDescriptor(
name: "GetSubtreeRoots",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetSubtreeRoots",
type: GRPCCallType.serverStreaming
)
internal static let getAddressUtxos = GRPCMethodDescriptor(
name: "GetAddressUtxos",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos",
type: GRPCCallType.unary
)
internal static let getAddressUtxosStream = GRPCMethodDescriptor(
name: "GetAddressUtxosStream",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream",
type: GRPCCallType.serverStreaming
)
internal static let getLightdInfo = GRPCMethodDescriptor(
name: "GetLightdInfo",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo",
type: GRPCCallType.unary
)
internal static let ping = GRPCMethodDescriptor(
name: "Ping",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping",
type: GRPCCallType.unary
)
}
}
/// To build a server, implement a class that conforms to this protocol.
internal protocol CompactTxStreamerProvider: CallHandlerProvider {
var interceptors: CompactTxStreamerServerInterceptorFactoryProtocol? { get }
/// Return the height of the tip of the best chain
func getLatestBlock(request: ChainSpec, context: StatusOnlyCallContext) -> EventLoopFuture<BlockID>
/// Return the compact block corresponding to the given block identifier
func getBlock(request: BlockID, context: StatusOnlyCallContext) -> EventLoopFuture<CompactBlock>
/// Same as GetBlock except actions contain only nullifiers
func getBlockNullifiers(request: BlockID, context: StatusOnlyCallContext) -> EventLoopFuture<CompactBlock>
/// Return a list of consecutive compact blocks
func getBlockRange(request: BlockRange, context: StreamingResponseCallContext<CompactBlock>) -> EventLoopFuture<GRPCStatus>
/// Same as GetBlockRange except actions contain only nullifiers
func getBlockRangeNullifiers(request: BlockRange, context: StreamingResponseCallContext<CompactBlock>) -> EventLoopFuture<GRPCStatus>
/// Return the requested full (not compact) transaction (as from zcashd)
func getTransaction(request: TxFilter, context: StatusOnlyCallContext) -> EventLoopFuture<RawTransaction>
/// Submit the given transaction to the Zcash network
func sendTransaction(request: RawTransaction, context: StatusOnlyCallContext) -> EventLoopFuture<SendResponse>
/// Return the transactions corresponding to the given t-address within the given block range
/// NB - this method is misnamed, it returns transactions, not transaction IDs.
func getTaddressTxids(request: TransparentAddressBlockFilter, context: StreamingResponseCallContext<RawTransaction>) -> EventLoopFuture<GRPCStatus>
func getTaddressBalance(request: AddressList, context: StatusOnlyCallContext) -> EventLoopFuture<Balance>
func getTaddressBalanceStream(context: UnaryResponseCallContext<Balance>) -> EventLoopFuture<(StreamEvent<Address>) -> Void>
/// Return the compact transactions currently in the mempool; the results
/// can be a few seconds out of date. If the Exclude list is empty, return
/// all transactions; otherwise return all *except* those in the Exclude list
/// (if any); this allows the client to avoid receiving transactions that it
/// already has (from an earlier call to this rpc). The transaction IDs in the
/// Exclude list can be shortened to any number of bytes to make the request
/// more bandwidth-efficient; if two or more transactions in the mempool
/// match a shortened txid, they are all sent (none is excluded). Transactions
/// in the exclude list that don't exist in the mempool are ignored.
func getMempoolTx(request: Exclude, context: StreamingResponseCallContext<CompactTx>) -> EventLoopFuture<GRPCStatus>
/// Return a stream of current Mempool transactions. This will keep the output stream open while
/// there are mempool transactions. It will close the returned stream when a new block is mined.
func getMempoolStream(request: Empty, context: StreamingResponseCallContext<RawTransaction>) -> EventLoopFuture<GRPCStatus>
/// GetTreeState returns the note commitment tree state corresponding to the given block.
/// See section 3.7 of the Zcash protocol specification. It returns several other useful
/// values also (even though they can be obtained using GetBlock).
/// The block can be specified by either height or hash.
func getTreeState(request: BlockID, context: StatusOnlyCallContext) -> EventLoopFuture<TreeState>
func getLatestTreeState(request: Empty, context: StatusOnlyCallContext) -> EventLoopFuture<TreeState>
/// Returns a stream of information about roots of subtrees of the note commitment tree
/// for the specified shielded protocol (Sapling or Orchard).
func getSubtreeRoots(request: GetSubtreeRootsArg, context: StreamingResponseCallContext<SubtreeRoot>) -> EventLoopFuture<GRPCStatus>
func getAddressUtxos(request: GetAddressUtxosArg, context: StatusOnlyCallContext) -> EventLoopFuture<GetAddressUtxosReplyList>
func getAddressUtxosStream(request: GetAddressUtxosArg, context: StreamingResponseCallContext<GetAddressUtxosReply>) -> EventLoopFuture<GRPCStatus>
/// Return information about this lightwalletd instance and the blockchain
func getLightdInfo(request: Empty, context: StatusOnlyCallContext) -> EventLoopFuture<LightdInfo>
/// Testing-only, requires lightwalletd --ping-very-insecure (do not enable in production)
func ping(request: Duration, context: StatusOnlyCallContext) -> EventLoopFuture<PingResponse>
}
extension CompactTxStreamerProvider {
internal var serviceName: Substring {
return CompactTxStreamerServerMetadata.serviceDescriptor.fullName[...]
}
/// Determines, calls and returns the appropriate request handler, depending on the request's method.
/// Returns nil for methods not handled by this service.
internal func handle(
method name: Substring,
context: CallHandlerContext
) -> GRPCServerHandlerProtocol? {
switch name {
case "GetLatestBlock":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<ChainSpec>(),
responseSerializer: ProtobufSerializer<BlockID>(),
interceptors: self.interceptors?.makeGetLatestBlockInterceptors() ?? [],
userFunction: self.getLatestBlock(request:context:)
)
case "GetBlock":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockID>(),
responseSerializer: ProtobufSerializer<CompactBlock>(),
interceptors: self.interceptors?.makeGetBlockInterceptors() ?? [],
userFunction: self.getBlock(request:context:)
)
case "GetBlockNullifiers":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockID>(),
responseSerializer: ProtobufSerializer<CompactBlock>(),
interceptors: self.interceptors?.makeGetBlockNullifiersInterceptors() ?? [],
userFunction: self.getBlockNullifiers(request:context:)
)
case "GetBlockRange":
return ServerStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockRange>(),
responseSerializer: ProtobufSerializer<CompactBlock>(),
interceptors: self.interceptors?.makeGetBlockRangeInterceptors() ?? [],
userFunction: self.getBlockRange(request:context:)
)
case "GetBlockRangeNullifiers":
return ServerStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockRange>(),
responseSerializer: ProtobufSerializer<CompactBlock>(),
interceptors: self.interceptors?.makeGetBlockRangeNullifiersInterceptors() ?? [],
userFunction: self.getBlockRangeNullifiers(request:context:)
)
case "GetTransaction":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<TxFilter>(),
responseSerializer: ProtobufSerializer<RawTransaction>(),
interceptors: self.interceptors?.makeGetTransactionInterceptors() ?? [],
userFunction: self.getTransaction(request:context:)
)
case "SendTransaction":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<RawTransaction>(),
responseSerializer: ProtobufSerializer<SendResponse>(),
interceptors: self.interceptors?.makeSendTransactionInterceptors() ?? [],
userFunction: self.sendTransaction(request:context:)
)
case "GetTaddressTxids":
return ServerStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<TransparentAddressBlockFilter>(),
responseSerializer: ProtobufSerializer<RawTransaction>(),
interceptors: self.interceptors?.makeGetTaddressTxidsInterceptors() ?? [],
userFunction: self.getTaddressTxids(request:context:)
)
case "GetTaddressBalance":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<AddressList>(),
responseSerializer: ProtobufSerializer<Balance>(),
interceptors: self.interceptors?.makeGetTaddressBalanceInterceptors() ?? [],
userFunction: self.getTaddressBalance(request:context:)
)
case "GetTaddressBalanceStream":
return ClientStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Address>(),
responseSerializer: ProtobufSerializer<Balance>(),
interceptors: self.interceptors?.makeGetTaddressBalanceStreamInterceptors() ?? [],
observerFactory: self.getTaddressBalanceStream(context:)
)
case "GetMempoolTx":
return ServerStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Exclude>(),
responseSerializer: ProtobufSerializer<CompactTx>(),
interceptors: self.interceptors?.makeGetMempoolTxInterceptors() ?? [],
userFunction: self.getMempoolTx(request:context:)
)
case "GetMempoolStream":
return ServerStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Empty>(),
responseSerializer: ProtobufSerializer<RawTransaction>(),
interceptors: self.interceptors?.makeGetMempoolStreamInterceptors() ?? [],
userFunction: self.getMempoolStream(request:context:)
)
case "GetTreeState":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockID>(),
responseSerializer: ProtobufSerializer<TreeState>(),
interceptors: self.interceptors?.makeGetTreeStateInterceptors() ?? [],
userFunction: self.getTreeState(request:context:)
)
case "GetLatestTreeState":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Empty>(),
responseSerializer: ProtobufSerializer<TreeState>(),
interceptors: self.interceptors?.makeGetLatestTreeStateInterceptors() ?? [],
userFunction: self.getLatestTreeState(request:context:)
)
case "GetSubtreeRoots":
return ServerStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<GetSubtreeRootsArg>(),
responseSerializer: ProtobufSerializer<SubtreeRoot>(),
interceptors: self.interceptors?.makeGetSubtreeRootsInterceptors() ?? [],
userFunction: self.getSubtreeRoots(request:context:)
)
case "GetAddressUtxos":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<GetAddressUtxosArg>(),
responseSerializer: ProtobufSerializer<GetAddressUtxosReplyList>(),
interceptors: self.interceptors?.makeGetAddressUtxosInterceptors() ?? [],
userFunction: self.getAddressUtxos(request:context:)
)
case "GetAddressUtxosStream":
return ServerStreamingServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<GetAddressUtxosArg>(),
responseSerializer: ProtobufSerializer<GetAddressUtxosReply>(),
interceptors: self.interceptors?.makeGetAddressUtxosStreamInterceptors() ?? [],
userFunction: self.getAddressUtxosStream(request:context:)
)
case "GetLightdInfo":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Empty>(),
responseSerializer: ProtobufSerializer<LightdInfo>(),
interceptors: self.interceptors?.makeGetLightdInfoInterceptors() ?? [],
userFunction: self.getLightdInfo(request:context:)
)
case "Ping":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Duration>(),
responseSerializer: ProtobufSerializer<PingResponse>(),
interceptors: self.interceptors?.makePingInterceptors() ?? [],
userFunction: self.ping(request:context:)
)
default:
return nil
}
}
}
/// To implement a server, implement an object which conforms to this protocol.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
internal protocol CompactTxStreamerAsyncProvider: CallHandlerProvider, Sendable {
static var serviceDescriptor: GRPCServiceDescriptor { get }
var interceptors: CompactTxStreamerServerInterceptorFactoryProtocol? { get }
/// Return the height of the tip of the best chain
func getLatestBlock(
request: ChainSpec,
context: GRPCAsyncServerCallContext
) async throws -> BlockID
/// Return the compact block corresponding to the given block identifier
func getBlock(
request: BlockID,
context: GRPCAsyncServerCallContext
) async throws -> CompactBlock
/// Same as GetBlock except actions contain only nullifiers
func getBlockNullifiers(
request: BlockID,
context: GRPCAsyncServerCallContext
) async throws -> CompactBlock
/// Return a list of consecutive compact blocks
func getBlockRange(
request: BlockRange,
responseStream: GRPCAsyncResponseStreamWriter<CompactBlock>,
context: GRPCAsyncServerCallContext
) async throws
/// Same as GetBlockRange except actions contain only nullifiers
func getBlockRangeNullifiers(
request: BlockRange,
responseStream: GRPCAsyncResponseStreamWriter<CompactBlock>,
context: GRPCAsyncServerCallContext
) async throws
/// Return the requested full (not compact) transaction (as from zcashd)
func getTransaction(
request: TxFilter,
context: GRPCAsyncServerCallContext
) async throws -> RawTransaction
/// Submit the given transaction to the Zcash network
func sendTransaction(
request: RawTransaction,
context: GRPCAsyncServerCallContext
) async throws -> SendResponse
/// Return the transactions corresponding to the given t-address within the given block range
/// NB - this method is misnamed, it returns transactions, not transaction IDs.
func getTaddressTxids(
request: TransparentAddressBlockFilter,
responseStream: GRPCAsyncResponseStreamWriter<RawTransaction>,
context: GRPCAsyncServerCallContext
) async throws
func getTaddressBalance(
request: AddressList,
context: GRPCAsyncServerCallContext
) async throws -> Balance
func getTaddressBalanceStream(
requestStream: GRPCAsyncRequestStream<Address>,
context: GRPCAsyncServerCallContext
) async throws -> Balance
/// Return the compact transactions currently in the mempool; the results
/// can be a few seconds out of date. If the Exclude list is empty, return
/// all transactions; otherwise return all *except* those in the Exclude list
/// (if any); this allows the client to avoid receiving transactions that it
/// already has (from an earlier call to this rpc). The transaction IDs in the
/// Exclude list can be shortened to any number of bytes to make the request
/// more bandwidth-efficient; if two or more transactions in the mempool
/// match a shortened txid, they are all sent (none is excluded). Transactions
/// in the exclude list that don't exist in the mempool are ignored.
func getMempoolTx(
request: Exclude,
responseStream: GRPCAsyncResponseStreamWriter<CompactTx>,
context: GRPCAsyncServerCallContext
) async throws
/// Return a stream of current Mempool transactions. This will keep the output stream open while
/// there are mempool transactions. It will close the returned stream when a new block is mined.
func getMempoolStream(
request: Empty,
responseStream: GRPCAsyncResponseStreamWriter<RawTransaction>,
context: GRPCAsyncServerCallContext
) async throws
/// GetTreeState returns the note commitment tree state corresponding to the given block.
/// See section 3.7 of the Zcash protocol specification. It returns several other useful
/// values also (even though they can be obtained using GetBlock).
/// The block can be specified by either height or hash.
func getTreeState(
request: BlockID,
context: GRPCAsyncServerCallContext
) async throws -> TreeState
func getLatestTreeState(
request: Empty,
context: GRPCAsyncServerCallContext
) async throws -> TreeState
/// Returns a stream of information about roots of subtrees of the note commitment tree
/// for the specified shielded protocol (Sapling or Orchard).
func getSubtreeRoots(
request: GetSubtreeRootsArg,
responseStream: GRPCAsyncResponseStreamWriter<SubtreeRoot>,
context: GRPCAsyncServerCallContext
) async throws
func getAddressUtxos(
request: GetAddressUtxosArg,
context: GRPCAsyncServerCallContext
) async throws -> GetAddressUtxosReplyList
func getAddressUtxosStream(
request: GetAddressUtxosArg,
responseStream: GRPCAsyncResponseStreamWriter<GetAddressUtxosReply>,
context: GRPCAsyncServerCallContext
) async throws
/// Return information about this lightwalletd instance and the blockchain
func getLightdInfo(
request: Empty,
context: GRPCAsyncServerCallContext
) async throws -> LightdInfo
/// Testing-only, requires lightwalletd --ping-very-insecure (do not enable in production)
func ping(
request: Duration,
context: GRPCAsyncServerCallContext
) async throws -> PingResponse
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension CompactTxStreamerAsyncProvider {
internal static var serviceDescriptor: GRPCServiceDescriptor {
return CompactTxStreamerServerMetadata.serviceDescriptor
}
internal var serviceName: Substring {
return CompactTxStreamerServerMetadata.serviceDescriptor.fullName[...]
}
internal var interceptors: CompactTxStreamerServerInterceptorFactoryProtocol? {
return nil
}
internal func handle(
method name: Substring,
context: CallHandlerContext
) -> GRPCServerHandlerProtocol? {
switch name {
case "GetLatestBlock":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<ChainSpec>(),
responseSerializer: ProtobufSerializer<BlockID>(),
interceptors: self.interceptors?.makeGetLatestBlockInterceptors() ?? [],
wrapping: { try await self.getLatestBlock(request: $0, context: $1) }
)
case "GetBlock":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockID>(),
responseSerializer: ProtobufSerializer<CompactBlock>(),
interceptors: self.interceptors?.makeGetBlockInterceptors() ?? [],
wrapping: { try await self.getBlock(request: $0, context: $1) }
)
case "GetBlockNullifiers":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockID>(),
responseSerializer: ProtobufSerializer<CompactBlock>(),
interceptors: self.interceptors?.makeGetBlockNullifiersInterceptors() ?? [],
wrapping: { try await self.getBlockNullifiers(request: $0, context: $1) }
)
case "GetBlockRange":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockRange>(),
responseSerializer: ProtobufSerializer<CompactBlock>(),
interceptors: self.interceptors?.makeGetBlockRangeInterceptors() ?? [],
wrapping: { try await self.getBlockRange(request: $0, responseStream: $1, context: $2) }
)
case "GetBlockRangeNullifiers":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockRange>(),
responseSerializer: ProtobufSerializer<CompactBlock>(),
interceptors: self.interceptors?.makeGetBlockRangeNullifiersInterceptors() ?? [],
wrapping: { try await self.getBlockRangeNullifiers(request: $0, responseStream: $1, context: $2) }
)
case "GetTransaction":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<TxFilter>(),
responseSerializer: ProtobufSerializer<RawTransaction>(),
interceptors: self.interceptors?.makeGetTransactionInterceptors() ?? [],
wrapping: { try await self.getTransaction(request: $0, context: $1) }
)
case "SendTransaction":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<RawTransaction>(),
responseSerializer: ProtobufSerializer<SendResponse>(),
interceptors: self.interceptors?.makeSendTransactionInterceptors() ?? [],
wrapping: { try await self.sendTransaction(request: $0, context: $1) }
)
case "GetTaddressTxids":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<TransparentAddressBlockFilter>(),
responseSerializer: ProtobufSerializer<RawTransaction>(),
interceptors: self.interceptors?.makeGetTaddressTxidsInterceptors() ?? [],
wrapping: { try await self.getTaddressTxids(request: $0, responseStream: $1, context: $2) }
)
case "GetTaddressBalance":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<AddressList>(),
responseSerializer: ProtobufSerializer<Balance>(),
interceptors: self.interceptors?.makeGetTaddressBalanceInterceptors() ?? [],
wrapping: { try await self.getTaddressBalance(request: $0, context: $1) }
)
case "GetTaddressBalanceStream":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Address>(),
responseSerializer: ProtobufSerializer<Balance>(),
interceptors: self.interceptors?.makeGetTaddressBalanceStreamInterceptors() ?? [],
wrapping: { try await self.getTaddressBalanceStream(requestStream: $0, context: $1) }
)
case "GetMempoolTx":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Exclude>(),
responseSerializer: ProtobufSerializer<CompactTx>(),
interceptors: self.interceptors?.makeGetMempoolTxInterceptors() ?? [],
wrapping: { try await self.getMempoolTx(request: $0, responseStream: $1, context: $2) }
)
case "GetMempoolStream":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Empty>(),
responseSerializer: ProtobufSerializer<RawTransaction>(),
interceptors: self.interceptors?.makeGetMempoolStreamInterceptors() ?? [],
wrapping: { try await self.getMempoolStream(request: $0, responseStream: $1, context: $2) }
)
case "GetTreeState":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<BlockID>(),
responseSerializer: ProtobufSerializer<TreeState>(),
interceptors: self.interceptors?.makeGetTreeStateInterceptors() ?? [],
wrapping: { try await self.getTreeState(request: $0, context: $1) }
)
case "GetLatestTreeState":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Empty>(),
responseSerializer: ProtobufSerializer<TreeState>(),
interceptors: self.interceptors?.makeGetLatestTreeStateInterceptors() ?? [],
wrapping: { try await self.getLatestTreeState(request: $0, context: $1) }
)
case "GetSubtreeRoots":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<GetSubtreeRootsArg>(),
responseSerializer: ProtobufSerializer<SubtreeRoot>(),
interceptors: self.interceptors?.makeGetSubtreeRootsInterceptors() ?? [],
wrapping: { try await self.getSubtreeRoots(request: $0, responseStream: $1, context: $2) }
)
case "GetAddressUtxos":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<GetAddressUtxosArg>(),
responseSerializer: ProtobufSerializer<GetAddressUtxosReplyList>(),
interceptors: self.interceptors?.makeGetAddressUtxosInterceptors() ?? [],
wrapping: { try await self.getAddressUtxos(request: $0, context: $1) }
)
case "GetAddressUtxosStream":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<GetAddressUtxosArg>(),
responseSerializer: ProtobufSerializer<GetAddressUtxosReply>(),
interceptors: self.interceptors?.makeGetAddressUtxosStreamInterceptors() ?? [],
wrapping: { try await self.getAddressUtxosStream(request: $0, responseStream: $1, context: $2) }
)
case "GetLightdInfo":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Empty>(),
responseSerializer: ProtobufSerializer<LightdInfo>(),
interceptors: self.interceptors?.makeGetLightdInfoInterceptors() ?? [],
wrapping: { try await self.getLightdInfo(request: $0, context: $1) }
)
case "Ping":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Duration>(),
responseSerializer: ProtobufSerializer<PingResponse>(),
interceptors: self.interceptors?.makePingInterceptors() ?? [],
wrapping: { try await self.ping(request: $0, context: $1) }
)
default:
return nil
}
}
}
internal protocol CompactTxStreamerServerInterceptorFactoryProtocol: Sendable {
/// - Returns: Interceptors to use when handling 'getLatestBlock'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetLatestBlockInterceptors() -> [ServerInterceptor<ChainSpec, BlockID>]
/// - Returns: Interceptors to use when handling 'getBlock'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetBlockInterceptors() -> [ServerInterceptor<BlockID, CompactBlock>]
/// - Returns: Interceptors to use when handling 'getBlockNullifiers'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetBlockNullifiersInterceptors() -> [ServerInterceptor<BlockID, CompactBlock>]
/// - Returns: Interceptors to use when handling 'getBlockRange'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetBlockRangeInterceptors() -> [ServerInterceptor<BlockRange, CompactBlock>]
/// - Returns: Interceptors to use when handling 'getBlockRangeNullifiers'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetBlockRangeNullifiersInterceptors() -> [ServerInterceptor<BlockRange, CompactBlock>]
/// - Returns: Interceptors to use when handling 'getTransaction'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetTransactionInterceptors() -> [ServerInterceptor<TxFilter, RawTransaction>]
/// - Returns: Interceptors to use when handling 'sendTransaction'.
/// Defaults to calling `self.makeInterceptors()`.
func makeSendTransactionInterceptors() -> [ServerInterceptor<RawTransaction, SendResponse>]
/// - Returns: Interceptors to use when handling 'getTaddressTxids'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetTaddressTxidsInterceptors() -> [ServerInterceptor<TransparentAddressBlockFilter, RawTransaction>]
/// - Returns: Interceptors to use when handling 'getTaddressBalance'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetTaddressBalanceInterceptors() -> [ServerInterceptor<AddressList, Balance>]
/// - Returns: Interceptors to use when handling 'getTaddressBalanceStream'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetTaddressBalanceStreamInterceptors() -> [ServerInterceptor<Address, Balance>]
/// - Returns: Interceptors to use when handling 'getMempoolTx'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetMempoolTxInterceptors() -> [ServerInterceptor<Exclude, CompactTx>]
/// - Returns: Interceptors to use when handling 'getMempoolStream'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetMempoolStreamInterceptors() -> [ServerInterceptor<Empty, RawTransaction>]
/// - Returns: Interceptors to use when handling 'getTreeState'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetTreeStateInterceptors() -> [ServerInterceptor<BlockID, TreeState>]
/// - Returns: Interceptors to use when handling 'getLatestTreeState'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetLatestTreeStateInterceptors() -> [ServerInterceptor<Empty, TreeState>]
/// - Returns: Interceptors to use when handling 'getSubtreeRoots'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetSubtreeRootsInterceptors() -> [ServerInterceptor<GetSubtreeRootsArg, SubtreeRoot>]
/// - Returns: Interceptors to use when handling 'getAddressUtxos'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetAddressUtxosInterceptors() -> [ServerInterceptor<GetAddressUtxosArg, GetAddressUtxosReplyList>]
/// - Returns: Interceptors to use when handling 'getAddressUtxosStream'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetAddressUtxosStreamInterceptors() -> [ServerInterceptor<GetAddressUtxosArg, GetAddressUtxosReply>]
/// - Returns: Interceptors to use when handling 'getLightdInfo'.
/// Defaults to calling `self.makeInterceptors()`.
func makeGetLightdInfoInterceptors() -> [ServerInterceptor<Empty, LightdInfo>]
/// - Returns: Interceptors to use when handling 'ping'.
/// Defaults to calling `self.makeInterceptors()`.
func makePingInterceptors() -> [ServerInterceptor<Duration, PingResponse>]
}
internal enum CompactTxStreamerServerMetadata {
internal static let serviceDescriptor = GRPCServiceDescriptor(
name: "CompactTxStreamer",
fullName: "cash.z.wallet.sdk.rpc.CompactTxStreamer",
methods: [
CompactTxStreamerServerMetadata.Methods.getLatestBlock,
CompactTxStreamerServerMetadata.Methods.getBlock,
CompactTxStreamerServerMetadata.Methods.getBlockNullifiers,
CompactTxStreamerServerMetadata.Methods.getBlockRange,
CompactTxStreamerServerMetadata.Methods.getBlockRangeNullifiers,
CompactTxStreamerServerMetadata.Methods.getTransaction,
CompactTxStreamerServerMetadata.Methods.sendTransaction,
CompactTxStreamerServerMetadata.Methods.getTaddressTxids,
CompactTxStreamerServerMetadata.Methods.getTaddressBalance,
CompactTxStreamerServerMetadata.Methods.getTaddressBalanceStream,
CompactTxStreamerServerMetadata.Methods.getMempoolTx,
CompactTxStreamerServerMetadata.Methods.getMempoolStream,
CompactTxStreamerServerMetadata.Methods.getTreeState,
CompactTxStreamerServerMetadata.Methods.getLatestTreeState,
CompactTxStreamerServerMetadata.Methods.getSubtreeRoots,
CompactTxStreamerServerMetadata.Methods.getAddressUtxos,
CompactTxStreamerServerMetadata.Methods.getAddressUtxosStream,
CompactTxStreamerServerMetadata.Methods.getLightdInfo,
CompactTxStreamerServerMetadata.Methods.ping,
]
)
internal enum Methods {
internal static let getLatestBlock = GRPCMethodDescriptor(
name: "GetLatestBlock",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock",
type: GRPCCallType.unary
)
internal static let getBlock = GRPCMethodDescriptor(
name: "GetBlock",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock",
type: GRPCCallType.unary
)
internal static let getBlockNullifiers = GRPCMethodDescriptor(
name: "GetBlockNullifiers",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockNullifiers",
type: GRPCCallType.unary
)
internal static let getBlockRange = GRPCMethodDescriptor(
name: "GetBlockRange",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange",
type: GRPCCallType.serverStreaming
)
internal static let getBlockRangeNullifiers = GRPCMethodDescriptor(
name: "GetBlockRangeNullifiers",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRangeNullifiers",
type: GRPCCallType.serverStreaming
)
internal static let getTransaction = GRPCMethodDescriptor(
name: "GetTransaction",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction",
type: GRPCCallType.unary
)
internal static let sendTransaction = GRPCMethodDescriptor(
name: "SendTransaction",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction",
type: GRPCCallType.unary
)
internal static let getTaddressTxids = GRPCMethodDescriptor(
name: "GetTaddressTxids",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids",
type: GRPCCallType.serverStreaming
)
internal static let getTaddressBalance = GRPCMethodDescriptor(
name: "GetTaddressBalance",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance",
type: GRPCCallType.unary
)
internal static let getTaddressBalanceStream = GRPCMethodDescriptor(
name: "GetTaddressBalanceStream",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream",
type: GRPCCallType.clientStreaming
)
internal static let getMempoolTx = GRPCMethodDescriptor(
name: "GetMempoolTx",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx",
type: GRPCCallType.serverStreaming
)
internal static let getMempoolStream = GRPCMethodDescriptor(
name: "GetMempoolStream",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream",
type: GRPCCallType.serverStreaming
)
internal static let getTreeState = GRPCMethodDescriptor(
name: "GetTreeState",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState",
type: GRPCCallType.unary
)
internal static let getLatestTreeState = GRPCMethodDescriptor(
name: "GetLatestTreeState",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestTreeState",
type: GRPCCallType.unary
)
internal static let getSubtreeRoots = GRPCMethodDescriptor(
name: "GetSubtreeRoots",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetSubtreeRoots",
type: GRPCCallType.serverStreaming
)
internal static let getAddressUtxos = GRPCMethodDescriptor(
name: "GetAddressUtxos",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos",
type: GRPCCallType.unary
)
internal static let getAddressUtxosStream = GRPCMethodDescriptor(
name: "GetAddressUtxosStream",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream",
type: GRPCCallType.serverStreaming
)
internal static let getLightdInfo = GRPCMethodDescriptor(
name: "GetLightdInfo",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo",
type: GRPCCallType.unary
)
internal static let ping = GRPCMethodDescriptor(
name: "Ping",
path: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping",
type: GRPCCallType.unary
)
}
}