Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions grpc/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
use celestia_proto::cosmos::bank::v1beta1::query_client::QueryClient as BankQueryClient;
pub use celestia_proto::cosmos::base::abci::v1beta1::GasInfo;
use celestia_proto::cosmos::base::node::v1beta1::service_client::ServiceClient as ConfigServiceClient;
use celestia_proto::cosmos::base::node::v1beta1::ConfigResponse;
use celestia_proto::cosmos::base::tendermint::v1beta1::service_client::ServiceClient as TendermintServiceClient;
use celestia_proto::cosmos::staking::v1beta1::query_client::QueryClient as StakingQueryClient;
use celestia_proto::cosmos::tx::v1beta1::service_client::ServiceClient as TxServiceClient;
use celestia_proto::tendermint_celestia_mods::rpc::grpc::block_api_client::BlockApiClient;
use celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse;
use celestia_types::blob::BlobParams;
use celestia_types::block::Block;
use celestia_types::consts::appconsts;
Expand Down Expand Up @@ -50,6 +53,8 @@
mod blob;
// cosmos.tx
mod cosmos_tx;
// tendermint.rpc.grpc
mod tendermint_rpc;

pub use crate::grpc::celestia_tx::{TxStatus, TxStatusResponse};
pub use crate::grpc::cosmos_tx::{BroadcastMode, GetTxResponse};
Expand Down Expand Up @@ -176,10 +181,25 @@

// cosmos.base.node

/// Get Minimum Gas price
/// Get node's minimum gas price
#[grpc_method(ConfigServiceClient::config)]
async fn get_min_gas_price(&self) -> Result<f64>;

/// Get node's config
#[grpc_method(ConfigServiceClient::config)]
async fn get_node_config(&self) -> Result<ConfigResponse>;

// tendermint.rpc.grpc
// TODO: expose all api's from this module

/// Get node's status
///
/// Please note that this uses `tendermint.rpc.grpc.BlockAPI` from
/// `celestia-core` fork of commetbft rather than `cosmos.base.node.v1beta1.Service`
/// to get more celestia specific info.
#[grpc_method(BlockApiClient::status)]

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

the trait bound `StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / clippy (celestia-client)

the trait bound `StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / clippy (celestia-grpc)

the trait bound `StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / clippy (celestia-grpc)

the trait bound `StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-uniffi)

the trait bound `StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / test-bindings (uniffi-swift, ./node-uniffi/tests/swift/run.sh)

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / test-bindings (uniffi-kotlin, ./node-uniffi/tests/kotlin/run.sh)

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / docs

the trait bound `StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / build-android

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / unused dependencies

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-grpc, grpc)

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / test (celestia-client)

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / test (celestia-grpc)

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / test (lumina-node-uniffi)

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / build-ios

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied

Check failure on line 200 in grpc/src/grpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

the trait bound `celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse: FromGrpcResponse<_>` is not satisfied
async fn get_node_status(&self) -> Result<StatusResponse>;

// cosmos.base.tendermint

/// Get latest block
Expand Down Expand Up @@ -320,12 +340,23 @@

macro_rules! make_empty_params {
($request_type:ident) => {
impl crate::grpc::IntoGrpcParam<$request_type> for () {
impl $crate::grpc::IntoGrpcParam<$request_type> for () {
fn into_parameter(self) -> $request_type {
$request_type {}
}
}
};
}

macro_rules! make_response_identity {
($response_type:ident) => {
impl $crate::grpc::FromGrpcResponse<$response_type> for $response_type {
fn try_from_response(self) -> $crate::Result<$response_type> {
Ok(self)
}
}
};
}

pub(crate) use make_empty_params;
pub(crate) use make_response_identity;
4 changes: 3 additions & 1 deletion grpc/src/grpc/node.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use celestia_proto::cosmos::base::node::v1beta1::{ConfigRequest, ConfigResponse};

use crate::grpc::{make_empty_params, FromGrpcResponse};
use crate::grpc::{make_empty_params, make_response_identity, FromGrpcResponse};
use crate::{Error, Result};

impl FromGrpcResponse<f64> for ConfigResponse {
Expand All @@ -19,4 +19,6 @@ impl FromGrpcResponse<f64> for ConfigResponse {
}
}

make_response_identity!(ConfigResponse);

make_empty_params!(ConfigRequest);
138 changes: 138 additions & 0 deletions grpc/src/grpc/tendermint_rpc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
use celestia_proto::tendermint_celestia_mods::rpc::grpc::{
StatusRequest, StatusResponse as RawStatusResponse,

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (celestia-client)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (celestia-grpc)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-uniffi)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-bindings (uniffi-swift, ./node-uniffi/tests/swift/run.sh)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-bindings (uniffi-kotlin, ./node-uniffi/tests/kotlin/run.sh)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / docs

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-android

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / unused dependencies

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-grpc, grpc)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test (celestia-client)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test (celestia-grpc)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test (lumina-node-uniffi)

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-ios

unused import: `StatusResponse as RawStatusResponse`

Check failure on line 2 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

unused import: `StatusResponse as RawStatusResponse`
};
use celestia_types::{Hash, Height};

Check failure on line 4 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

unresolved import `celestia_types::Hash`

Check failure on line 4 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (celestia-client)

unresolved import `celestia_types::Hash`

Check failure on line 4 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

unresolved import `celestia_types::Hash`

Check failure on line 4 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-grpc, grpc)

unresolved import `celestia_types::Hash`

Check failure on line 4 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test (celestia-client)

unresolved import `celestia_types::Hash`

Check failure on line 4 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

unresolved import `celestia_types::Hash`

Check failure on line 4 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

unresolved import `celestia_types::Hash`
use tendermint::{validator, AppHash, Time};
use tendermint_proto::v0_38::p2p::DefaultNodeInfo;
#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
use wasm_bindgen::prelude::wasm_bindgen;
#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
use wasm_bindgen::JsValue;

use crate::grpc::{make_empty_params, make_response_identity};

/// A state of the blockchain synchronization of consensus node.
#[derive(Clone, Debug, PartialEq, Eq)]
// #[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(getter_with_clone)

Check failure on line 19 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

the trait bound `tendermint::AppHash: wasm_bindgen::convert::FromWasmAbi` is not satisfied

Check failure on line 19 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

the trait bound `tendermint::AppHash: wasm_bindgen::convert::IntoWasmAbi` is not satisfied

Check failure on line 19 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

the trait bound `AppHash: FromWasmAbi` is not satisfied

Check failure on line 19 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

the trait bound `AppHash: IntoWasmAbi` is not satisfied

Check failure on line 19 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

the trait bound `AppHash: FromWasmAbi` is not satisfied

Check failure on line 19 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

the trait bound `AppHash: IntoWasmAbi` is not satisfied

Check failure on line 19 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

the trait bound `AppHash: FromWasmAbi` is not satisfied

Check failure on line 19 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

the trait bound `AppHash: IntoWasmAbi` is not satisfied
)]
pub struct SyncInfo {
/// Hash of the latest block synced by the node
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(js_name = latestBlockHash)
)]
pub latest_block_hash: Hash,

/// App hash of the latest block synced by the node
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(js_name = latestAppHash)
)]
pub latest_app_hash: AppHash,

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

the trait bound `tendermint::AppHash: wasm_bindgen::convert::FromWasmAbi` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

the trait bound `tendermint::AppHash: wasm_bindgen::describe::WasmDescribe` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

the trait bound `tendermint::AppHash: wasm_bindgen::convert::IntoWasmAbi` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

the trait bound `AppHash: FromWasmAbi` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

the trait bound `AppHash: wasm_bindgen::describe::WasmDescribe` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

the trait bound `AppHash: IntoWasmAbi` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

the trait bound `AppHash: FromWasmAbi` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

the trait bound `AppHash: wasm_bindgen::describe::WasmDescribe` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

the trait bound `AppHash: IntoWasmAbi` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

the trait bound `AppHash: FromWasmAbi` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

the trait bound `AppHash: wasm_bindgen::describe::WasmDescribe` is not satisfied

Check failure on line 34 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

the trait bound `AppHash: IntoWasmAbi` is not satisfied

/// Height of the latest block synced by the node
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(skip)
)]
pub latest_block_height: Height,

/// Time of the latest block synced by the node
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(skip)
)]
pub latest_block_time: Time,

/// Hash of the earliest block synced by the node
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(js_name = earliestBlockHash)
)]
pub earliest_block_hash: Hash,

/// App hash of the earliest block synced by the node
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(js_name = earliestAppHash)
)]
pub earliest_app_hash: AppHash,

/// Height of the earliest block synced by the node
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(skip)
)]
pub earliest_block_height: Height,

/// Time of the earliest block synced by the node
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(skip)
)]
pub earliest_block_time: Time,

/// Indicates if node is still during initial sync
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(js_name = catchingUp)
)]
pub catching_up: bool,
}

#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
#[wasm_bindgen]
impl SyncInfo {
/// Height of the latest block synced by the node
#[wasm_bindgen(getter, js_name = latestBlockHeight)]
pub fn js_latest_block_height(&self) -> u64 {
self.latest_block_height.value()
}

/// Time of the latest block synced by the node
#[wasm_bindgen(getter, js_name = latestBlockTime)]
pub fn js_latest_block_time(&self) -> Result<f64, JsValue> {
Ok(self
.latest_block_time
.duration_since(Time::unix_epoch())
.map_err(|e| JsError::new(&e.to_string()))?

Check failure on line 101 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

failed to resolve: use of undeclared type `JsError`

Check failure on line 101 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

failed to resolve: use of undeclared type `JsError`

Check failure on line 101 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

failed to resolve: use of undeclared type `JsError`

Check failure on line 101 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

failed to resolve: use of undeclared type `JsError`
.as_secs_f64()
* 1000.0)
}

/// Height of the earliest block synced by the node
#[wasm_bindgen(getter, js_name = earliestBlockHeight)]
pub fn js_earliest_block_height(&self) -> u64 {
self.earliest_block_height.value()
}

/// Time of the earliest block synced by the node
#[wasm_bindgen(getter, js_name = earliestBlockTime)]
pub fn js_earliest_block_time(&self) -> Result<f64, JsValue> {
Ok(self
.earliest_block_time
.duration_since(Time::unix_epoch())
.map_err(|e| JsError::new(&e.to_string()))?

Check failure on line 118 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / clippy (lumina-node-wasm)

failed to resolve: use of undeclared type `JsError`

Check failure on line 118 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / build-wasm

failed to resolve: use of undeclared type `JsError`

Check failure on line 118 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (celestia-client, client)

failed to resolve: use of undeclared type `JsError`

Check failure on line 118 in grpc/src/grpc/tendermint_rpc.rs

View workflow job for this annotation

GitHub Actions / test-wasm (lumina-node-wasm, node-wasm, --release)

failed to resolve: use of undeclared type `JsError`
.as_secs_f64()
* 1000.0)
}
}

/// A state of the blockchain synchronization of consensus node.
#[derive(Clone, Debug, PartialEq)]
// #[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
#[cfg_attr(
all(target_arch = "wasm32", feature = "wasm-bindgen"),
wasm_bindgen(getter_with_clone)
)]
pub struct StatusResponse {
node_info: DefaultNodeInfo,
sync_info: SyncInfo,
validator_info: validator::Info,
}

make_response_identity!(StatusResponse);
make_empty_params!(StatusRequest);
12 changes: 11 additions & 1 deletion grpc/src/js_client/grpc_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use wasm_bindgen::prelude::*;

use celestia_proto::tendermint_celestia_mods::rpc::grpc::StatusResponse;
use celestia_types::blob::BlobParams;
use celestia_types::block::Block;
use celestia_types::state::auth::{JsAuthParams, JsBaseAccount};
Expand Down Expand Up @@ -107,11 +108,20 @@ impl GrpcClient {
.collect())
}

/// Get Minimum Gas price
/// Get node's minimum gas price
pub async fn get_min_gas_price(&self) -> Result<f64> {
self.client.get_min_gas_price().await
}

/// Get node's status
///
/// Please note that this uses `tendermint.rpc.grpc.BlockAPI` from
/// `celestia-core` fork of commetbft rather than `cosmos.base.node.v1beta1.Service`
/// to get more celestia specific info.
pub async fn get_node_status(&self) -> Result<StatusResponse> {
self.client.get_node_status().await
}

/// Get latest block
pub async fn get_latest_block(&self) -> Result<Block> {
self.client.get_latest_block().await
Expand Down
Loading