/// CompactBlock is a packaging of ONLY the data from a block that's needed to: /// 1. Detect a payment to your shielded Sapling address /// 2. Detect a spend of your shielded Sapling notes /// 3. Update your witnesses to generate new Sapling spend proofs. #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompactBlock { /// the version of this wire format, for storage #[prost(uint32, tag="1")] pub proto_version: u32, /// the height of this block #[prost(uint64, tag="2")] pub height: u64, /// the ID (hash) of this block, same as in block explorers #[prost(bytes="vec", tag="3")] pub hash: ::prost::alloc::vec::Vec, /// the ID (hash) of this block's predecessor #[prost(bytes="vec", tag="4")] pub prev_hash: ::prost::alloc::vec::Vec, /// Unix epoch time when the block was mined #[prost(uint32, tag="5")] pub time: u32, /// (hash, prevHash, and time) OR (full header) #[prost(bytes="vec", tag="6")] pub header: ::prost::alloc::vec::Vec, /// zero or more compact transactions from this block #[prost(message, repeated, tag="7")] pub vtx: ::prost::alloc::vec::Vec, } /// CompactTx contains the minimum information for a wallet to know if this transaction /// is relevant to it (either pays to it or spends from it) via shielded elements /// only. This message will not encode a transparent-to-transparent transaction. #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompactTx { /// the index within the full block #[prost(uint64, tag="1")] pub index: u64, /// the ID (hash) of this transaction, same as in block explorers #[prost(bytes="vec", tag="2")] pub hash: ::prost::alloc::vec::Vec, /// The transaction fee: present if server can provide. In the case of a /// stateless server and a transaction with transparent inputs, this will be /// unset because the calculation requires reference to prior transactions. /// in a pure-Sapling context, the fee will be calculable as: /// valueBalance + (sum(vPubNew) - sum(vPubOld) - sum(tOut)) #[prost(uint32, tag="3")] pub fee: u32, /// inputs #[prost(message, repeated, tag="4")] pub spends: ::prost::alloc::vec::Vec, /// outputs #[prost(message, repeated, tag="5")] pub outputs: ::prost::alloc::vec::Vec, #[prost(message, repeated, tag="6")] pub actions: ::prost::alloc::vec::Vec, } /// CompactSaplingSpend is a Sapling Spend Description as described in 7.3 of the Zcash /// protocol specification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompactSaplingSpend { /// nullifier (see the Zcash protocol specification) #[prost(bytes="vec", tag="1")] pub nf: ::prost::alloc::vec::Vec, } /// output is a Sapling Output Description as described in section 7.4 of the /// Zcash protocol spec. Total size is 948. #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompactSaplingOutput { /// note commitment u-coordinate #[prost(bytes="vec", tag="1")] pub cmu: ::prost::alloc::vec::Vec, /// ephemeral public key #[prost(bytes="vec", tag="2")] pub epk: ::prost::alloc::vec::Vec, /// first 52 bytes of ciphertext #[prost(bytes="vec", tag="3")] pub ciphertext: ::prost::alloc::vec::Vec, } /// /// (but not all fields are needed) #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompactOrchardAction { /// \[32\] The nullifier of the input note #[prost(bytes="vec", tag="1")] pub nullifier: ::prost::alloc::vec::Vec, /// \[32\] The x-coordinate of the note commitment for the output note #[prost(bytes="vec", tag="2")] pub cmx: ::prost::alloc::vec::Vec, /// \[32\] An encoding of an ephemeral Pallas public key #[prost(bytes="vec", tag="3")] pub ephemeral_key: ::prost::alloc::vec::Vec, /// \[52\] The note plaintext component of the encCiphertext field #[prost(bytes="vec", tag="4")] pub ciphertext: ::prost::alloc::vec::Vec, } /// A BlockID message contains identifiers to select a block: a height or a /// hash. Specification by hash is not implemented, but may be in the future. #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockId { #[prost(uint64, tag="1")] pub height: u64, #[prost(bytes="vec", tag="2")] pub hash: ::prost::alloc::vec::Vec, } /// BlockRange specifies a series of blocks from start to end inclusive. /// Both BlockIDs must be heights; specification by hash is not yet supported. #[derive(Clone, PartialEq, ::prost::Message)] pub struct BlockRange { #[prost(message, optional, tag="1")] pub start: ::core::option::Option, #[prost(message, optional, tag="2")] pub end: ::core::option::Option, #[prost(uint64, tag="3")] pub spam_filter_threshold: u64, } /// A TxFilter contains the information needed to identify a particular /// transaction: either a block and an index, or a direct transaction hash. /// Currently, only specification by hash is supported. #[derive(Clone, PartialEq, ::prost::Message)] pub struct TxFilter { /// block identifier, height or hash #[prost(message, optional, tag="1")] pub block: ::core::option::Option, /// index within the block #[prost(uint64, tag="2")] pub index: u64, /// transaction ID (hash, txid) #[prost(bytes="vec", tag="3")] pub hash: ::prost::alloc::vec::Vec, } /// RawTransaction contains the complete transaction data. It also optionally includes /// the block height in which the transaction was included, or, when returned /// by GetMempoolStream(), the latest block height. #[derive(Clone, PartialEq, ::prost::Message)] pub struct RawTransaction { /// exact data returned by Zcash 'getrawtransaction' #[prost(bytes="vec", tag="1")] pub data: ::prost::alloc::vec::Vec, /// height that the transaction was mined (or -1) #[prost(uint64, tag="2")] pub height: u64, } /// A SendResponse encodes an error code and a string. It is currently used /// only by SendTransaction(). If error code is zero, the operation was /// successful; if non-zero, it and the message specify the failure. #[derive(Clone, PartialEq, ::prost::Message)] pub struct SendResponse { #[prost(int32, tag="1")] pub error_code: i32, #[prost(string, tag="2")] pub error_message: ::prost::alloc::string::String, } /// Chainspec is a placeholder to allow specification of a particular chain fork. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ChainSpec { } /// Empty is for gRPCs that take no arguments, currently only GetLightdInfo. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Empty { } /// LightdInfo returns various information about this lightwalletd instance /// and the state of the blockchain. #[derive(Clone, PartialEq, ::prost::Message)] pub struct LightdInfo { #[prost(string, tag="1")] pub version: ::prost::alloc::string::String, #[prost(string, tag="2")] pub vendor: ::prost::alloc::string::String, /// true #[prost(bool, tag="3")] pub taddr_support: bool, /// either "main" or "test" #[prost(string, tag="4")] pub chain_name: ::prost::alloc::string::String, /// depends on mainnet or testnet #[prost(uint64, tag="5")] pub sapling_activation_height: u64, /// protocol identifier, see consensus/upgrades.cpp #[prost(string, tag="6")] pub consensus_branch_id: ::prost::alloc::string::String, /// latest block on the best chain #[prost(uint64, tag="7")] pub block_height: u64, #[prost(string, tag="8")] pub git_commit: ::prost::alloc::string::String, #[prost(string, tag="9")] pub branch: ::prost::alloc::string::String, #[prost(string, tag="10")] pub build_date: ::prost::alloc::string::String, #[prost(string, tag="11")] pub build_user: ::prost::alloc::string::String, /// less than tip height if zcashd is syncing #[prost(uint64, tag="12")] pub estimated_height: u64, /// example: "v4.1.1-877212414" #[prost(string, tag="13")] pub zcashd_build: ::prost::alloc::string::String, /// example: "/MagicBean:4.1.1/" #[prost(string, tag="14")] pub zcashd_subversion: ::prost::alloc::string::String, } /// TransparentAddressBlockFilter restricts the results to the given address /// or block range. #[derive(Clone, PartialEq, ::prost::Message)] pub struct TransparentAddressBlockFilter { /// t-address #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, /// start, end heights #[prost(message, optional, tag="2")] pub range: ::core::option::Option, } /// Duration is currently used only for testing, so that the Ping rpc /// can simulate a delay, to create many simultaneous connections. Units /// are microseconds. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Duration { #[prost(int64, tag="1")] pub interval_us: i64, } /// PingResponse is used to indicate concurrency, how many Ping rpcs /// are executing upon entry and upon exit (after the delay). /// This rpc is used for testing only. #[derive(Clone, PartialEq, ::prost::Message)] pub struct PingResponse { #[prost(int64, tag="1")] pub entry: i64, #[prost(int64, tag="2")] pub exit: i64, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Address { #[prost(string, tag="1")] pub address: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct AddressList { #[prost(string, repeated, tag="1")] pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Balance { #[prost(int64, tag="1")] pub value_zat: i64, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Exclude { #[prost(bytes="vec", repeated, tag="1")] pub txid: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, } /// The TreeState is derived from the Zcash z_gettreestate rpc. #[derive(Clone, PartialEq, ::prost::Message)] pub struct TreeState { /// "main" or "test" #[prost(string, tag="1")] pub network: ::prost::alloc::string::String, /// block height #[prost(uint64, tag="2")] pub height: u64, /// block id #[prost(string, tag="3")] pub hash: ::prost::alloc::string::String, /// Unix epoch time when the block was mined #[prost(uint32, tag="4")] pub time: u32, /// sapling commitment tree state #[prost(string, tag="5")] pub sapling_tree: ::prost::alloc::string::String, /// orchard commitment tree state #[prost(string, tag="6")] pub orchard_tree: ::prost::alloc::string::String, } /// Results are sorted by height, which makes it easy to issue another /// request that picks up from where the previous left off. #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetAddressUtxosArg { #[prost(string, repeated, tag="1")] pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(uint64, tag="2")] pub start_height: u64, /// zero means unlimited #[prost(uint32, tag="3")] pub max_entries: u32, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetAddressUtxosReply { #[prost(string, tag="6")] pub address: ::prost::alloc::string::String, #[prost(bytes="vec", tag="1")] pub txid: ::prost::alloc::vec::Vec, #[prost(int32, tag="2")] pub index: i32, #[prost(bytes="vec", tag="3")] pub script: ::prost::alloc::vec::Vec, #[prost(int64, tag="4")] pub value_zat: i64, #[prost(uint64, tag="5")] pub height: u64, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetAddressUtxosReplyList { #[prost(message, repeated, tag="1")] pub address_utxos: ::prost::alloc::vec::Vec, } /// Generated client implementations. pub mod compact_tx_streamer_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; #[derive(Debug, Clone)] pub struct CompactTxStreamerClient { inner: tonic::client::Grpc, } impl CompactTxStreamerClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: std::convert::TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl CompactTxStreamerClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> CompactTxStreamerClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + Send + Sync, { CompactTxStreamerClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with `gzip`. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_gzip(mut self) -> Self { self.inner = self.inner.send_gzip(); self } /// Enable decompressing responses with `gzip`. #[must_use] pub fn accept_gzip(mut self) -> Self { self.inner = self.inner.accept_gzip(); self } /// Return the height of the tip of the best chain pub async fn get_latest_block( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock", ); self.inner.unary(request.into_request(), path, codec).await } /// Return the compact block corresponding to the given block identifier pub async fn get_block( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock", ); self.inner.unary(request.into_request(), path, codec).await } /// Return a list of consecutive compact blocks pub async fn get_block_range( &mut self, request: impl tonic::IntoRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange", ); self.inner.server_streaming(request.into_request(), path, codec).await } /// Return the requested full (not compact) transaction (as from zcashd) pub async fn get_transaction( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction", ); self.inner.unary(request.into_request(), path, codec).await } /// Submit the given transaction to the Zcash network pub async fn send_transaction( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction", ); self.inner.unary(request.into_request(), path, codec).await } /// Return the txids corresponding to the given t-address within the given block range pub async fn get_taddress_txids( &mut self, request: impl tonic::IntoRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids", ); self.inner.server_streaming(request.into_request(), path, codec).await } pub async fn get_taddress_balance( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance", ); self.inner.unary(request.into_request(), path, codec).await } pub async fn get_taddress_balance_stream( &mut self, request: impl tonic::IntoStreamingRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream", ); self.inner .client_streaming(request.into_streaming_request(), path, codec) .await } /// 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. pub async fn get_mempool_tx( &mut self, request: impl tonic::IntoRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx", ); self.inner.server_streaming(request.into_request(), path, codec).await } /// 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. pub async fn get_mempool_stream( &mut self, request: impl tonic::IntoRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream", ); self.inner.server_streaming(request.into_request(), path, codec).await } /// 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. pub async fn get_tree_state( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState", ); self.inner.unary(request.into_request(), path, codec).await } pub async fn get_address_utxos( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos", ); self.inner.unary(request.into_request(), path, codec).await } pub async fn get_address_utxos_stream( &mut self, request: impl tonic::IntoRequest, ) -> Result< tonic::Response>, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream", ); self.inner.server_streaming(request.into_request(), path, codec).await } /// Return information about this lightwalletd instance and the blockchain pub async fn get_lightd_info( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo", ); self.inner.unary(request.into_request(), path, codec).await } /// Testing-only, requires lightwalletd --ping-very-insecure (do not enable in production) pub async fn ping( &mut self, request: impl tonic::IntoRequest, ) -> Result, tonic::Status> { self.inner .ready() .await .map_err(|e| { tonic::Status::new( tonic::Code::Unknown, format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping", ); self.inner.unary(request.into_request(), path, codec).await } } } /// Generated server implementations. pub mod compact_tx_streamer_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; ///Generated trait containing gRPC methods that should be implemented for use with CompactTxStreamerServer. #[async_trait] pub trait CompactTxStreamer: Send + Sync + 'static { /// Return the height of the tip of the best chain async fn get_latest_block( &self, request: tonic::Request, ) -> Result, tonic::Status>; /// Return the compact block corresponding to the given block identifier async fn get_block( &self, request: tonic::Request, ) -> Result, tonic::Status>; ///Server streaming response type for the GetBlockRange method. type GetBlockRangeStream: futures_core::Stream< Item = Result, > + Send + 'static; /// Return a list of consecutive compact blocks async fn get_block_range( &self, request: tonic::Request, ) -> Result, tonic::Status>; /// Return the requested full (not compact) transaction (as from zcashd) async fn get_transaction( &self, request: tonic::Request, ) -> Result, tonic::Status>; /// Submit the given transaction to the Zcash network async fn send_transaction( &self, request: tonic::Request, ) -> Result, tonic::Status>; ///Server streaming response type for the GetTaddressTxids method. type GetTaddressTxidsStream: futures_core::Stream< Item = Result, > + Send + 'static; /// Return the txids corresponding to the given t-address within the given block range async fn get_taddress_txids( &self, request: tonic::Request, ) -> Result, tonic::Status>; async fn get_taddress_balance( &self, request: tonic::Request, ) -> Result, tonic::Status>; async fn get_taddress_balance_stream( &self, request: tonic::Request>, ) -> Result, tonic::Status>; ///Server streaming response type for the GetMempoolTx method. type GetMempoolTxStream: futures_core::Stream< Item = Result, > + Send + 'static; /// 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. async fn get_mempool_tx( &self, request: tonic::Request, ) -> Result, tonic::Status>; ///Server streaming response type for the GetMempoolStream method. type GetMempoolStreamStream: futures_core::Stream< Item = Result, > + Send + 'static; /// 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. async fn get_mempool_stream( &self, request: tonic::Request, ) -> Result, tonic::Status>; /// 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. async fn get_tree_state( &self, request: tonic::Request, ) -> Result, tonic::Status>; async fn get_address_utxos( &self, request: tonic::Request, ) -> Result, tonic::Status>; ///Server streaming response type for the GetAddressUtxosStream method. type GetAddressUtxosStreamStream: futures_core::Stream< Item = Result, > + Send + 'static; async fn get_address_utxos_stream( &self, request: tonic::Request, ) -> Result, tonic::Status>; /// Return information about this lightwalletd instance and the blockchain async fn get_lightd_info( &self, request: tonic::Request, ) -> Result, tonic::Status>; /// Testing-only, requires lightwalletd --ping-very-insecure (do not enable in production) async fn ping( &self, request: tonic::Request, ) -> Result, tonic::Status>; } #[derive(Debug)] pub struct CompactTxStreamerServer { inner: _Inner, accept_compression_encodings: (), send_compression_encodings: (), } struct _Inner(Arc); impl CompactTxStreamerServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } } impl tonic::codegen::Service> for CompactTxStreamerServer where T: CompactTxStreamer, B: Body + Send + 'static, B::Error: Into + Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { let inner = self.inner.clone(); match req.uri().path() { "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock" => { #[allow(non_camel_case_types)] struct GetLatestBlockSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::UnaryService for GetLatestBlockSvc { type Response = super::BlockId; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_latest_block(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetLatestBlockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock" => { #[allow(non_camel_case_types)] struct GetBlockSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::UnaryService for GetBlockSvc { type Response = super::CompactBlock; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_block(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetBlockSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange" => { #[allow(non_camel_case_types)] struct GetBlockRangeSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::ServerStreamingService for GetBlockRangeSvc { type Response = super::CompactBlock; type ResponseStream = T::GetBlockRangeStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_block_range(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetBlockRangeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction" => { #[allow(non_camel_case_types)] struct GetTransactionSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::UnaryService for GetTransactionSvc { type Response = super::RawTransaction; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_transaction(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetTransactionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction" => { #[allow(non_camel_case_types)] struct SendTransactionSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::UnaryService for SendTransactionSvc { type Response = super::SendResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).send_transaction(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = SendTransactionSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressTxids" => { #[allow(non_camel_case_types)] struct GetTaddressTxidsSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::ServerStreamingService< super::TransparentAddressBlockFilter, > for GetTaddressTxidsSvc { type Response = super::RawTransaction; type ResponseStream = T::GetTaddressTxidsStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_taddress_txids(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetTaddressTxidsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalance" => { #[allow(non_camel_case_types)] struct GetTaddressBalanceSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::UnaryService for GetTaddressBalanceSvc { type Response = super::Balance; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_taddress_balance(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetTaddressBalanceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTaddressBalanceStream" => { #[allow(non_camel_case_types)] struct GetTaddressBalanceStreamSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::ClientStreamingService for GetTaddressBalanceStreamSvc { type Response = super::Balance; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request>, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_taddress_balance_stream(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetTaddressBalanceStreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.client_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolTx" => { #[allow(non_camel_case_types)] struct GetMempoolTxSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::ServerStreamingService for GetMempoolTxSvc { type Response = super::CompactTx; type ResponseStream = T::GetMempoolTxStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_mempool_tx(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetMempoolTxSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetMempoolStream" => { #[allow(non_camel_case_types)] struct GetMempoolStreamSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::ServerStreamingService for GetMempoolStreamSvc { type Response = super::RawTransaction; type ResponseStream = T::GetMempoolStreamStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_mempool_stream(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetMempoolStreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTreeState" => { #[allow(non_camel_case_types)] struct GetTreeStateSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::UnaryService for GetTreeStateSvc { type Response = super::TreeState; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_tree_state(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetTreeStateSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxos" => { #[allow(non_camel_case_types)] struct GetAddressUtxosSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::UnaryService for GetAddressUtxosSvc { type Response = super::GetAddressUtxosReplyList; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_address_utxos(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetAddressUtxosSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetAddressUtxosStream" => { #[allow(non_camel_case_types)] struct GetAddressUtxosStreamSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::ServerStreamingService for GetAddressUtxosStreamSvc { type Response = super::GetAddressUtxosReply; type ResponseStream = T::GetAddressUtxosStreamStream; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_address_utxos_stream(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetAddressUtxosStreamSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.server_streaming(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLightdInfo" => { #[allow(non_camel_case_types)] struct GetLightdInfoSvc(pub Arc); impl tonic::server::UnaryService for GetLightdInfoSvc { type Response = super::LightdInfo; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).get_lightd_info(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = GetLightdInfoSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/cash.z.wallet.sdk.rpc.CompactTxStreamer/Ping" => { #[allow(non_camel_case_types)] struct PingSvc(pub Arc); impl< T: CompactTxStreamer, > tonic::server::UnaryService for PingSvc { type Response = super::PingResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = self.0.clone(); let fut = async move { (*inner).ping(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; let method = PingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { Ok( http::Response::builder() .status(200) .header("grpc-status", "12") .header("content-type", "application/grpc") .body(empty_body()) .unwrap(), ) }) } } } } impl Clone for CompactTxStreamerServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, } } } impl Clone for _Inner { fn clone(&self) -> Self { Self(self.0.clone()) } } impl std::fmt::Debug for _Inner { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) } } impl tonic::transport::NamedService for CompactTxStreamerServer { const NAME: &'static str = "cash.z.wallet.sdk.rpc.CompactTxStreamer"; } }