Skip to content

Commit

Permalink
fix(celestia-grpc-macros): Fix standalone build for celestia-grpc-mac…
Browse files Browse the repository at this point in the history
…ros, add CI (#470)


Signed-off-by: Mikołaj Florkiewicz <[email protected]>
Co-authored-by: Yiannis Marangos <[email protected]>
  • Loading branch information
fl0rek and oblique authored Dec 3, 2024
1 parent 080c3c5 commit 82c51f6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- name: Run clippy for native
run: cargo clippy --all --all-targets -- -D warnings

- name: Run clippy for celestia-grpc-macros
run: cargo clippy -p celestia-grpc-macros --all-targets -- -D warnings

- name: Run clippy for wasm32
run: cargo clippy --all --all-targets --target=wasm32-unknown-unknown -- -D warnings

Expand Down
8 changes: 7 additions & 1 deletion grpc/grpc-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
name = "celestia-grpc-macros"
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
description = "Helper crate for grpc_method macro for creating gRPC client, used by celestia-grpc"
authors = ["Eiger <[email protected]>"]
homepage = "https://www.eiger.co"
repository = "https://github.com/eigerco/lumina"
readme = "README.md"

[dependencies]
quote = "1.0.37"
syn = "2.0.87"
syn = { version = "2.0.87", features = ["full", "extra-traits"] }
proc-macro2 = "1.0.89"

[lib]
Expand Down
26 changes: 26 additions & 0 deletions grpc/grpc-macros/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Helper crate for grpc_method macro for creating a tonic gRPC client, used by [celestia-grpc](https://docs.rs/celestia-grpc/latest/celestia_grpc/).

# Example

```rust,ignore
use celestia_proto::cosmos::auth::v1beta1::query_client::QueryClient;
use tonic::service::Interceptor;
use tonic::transport::Channel;
pub struct GrpcClient<I>
where
I: Interceptor,
{
grpc_channel: Channel,
auth_interceptor: I,
}
impl<I> GrpcClient<I>
where
I: Interceptor + Clone,
{
/// Get auth params
#[grpc_method(AuthQueryClient::params)]
async fn get_auth_params(&mut self) -> Result<AuthParams, Error>;
}
```
26 changes: 1 addition & 25 deletions grpc/grpc-macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
//! Helper crate for grpc_method macro for creating gRPC methods
//!
//! # Example
//! ```rust,ignore
//! use celestia_proto::cosmos::auth::v1beta1::query_client::QueryClient;
//! # use tonic::service::Interceptor;
//! # use tonic::transport::Channel;
//! #
//! # pub struct GrpcClient<I>
//! # where
//! # I: Interceptor,
//! # {
//! # grpc_channel: Channel,
//! # auth_interceptor: I,
//! # }
//!
//! impl<I> GrpcClient<I>
//! where
//! I: Interceptor + Clone,
//! {
//! /// Get auth params
//! #[grpc_method(AuthQueryClient::params)]
//! async fn get_auth_params(&mut self) -> Result<AuthParams, Error>;
//! }
//! ```
#![doc = include_str!("../README.md")]

extern crate proc_macro;

Expand Down

0 comments on commit 82c51f6

Please sign in to comment.