diff --git a/core/rpc/src/api/flk.rs b/core/rpc/src/api/flk.rs index 6ba0324d6..7939ee56c 100644 --- a/core/rpc/src/api/flk.rs +++ b/core/rpc/src/api/flk.rs @@ -182,6 +182,9 @@ pub trait FleekApi { #[method(name = "get_last_epoch_hash")] async fn get_last_epoch_hash(&self) -> RpcResult<([u8; 32], Epoch)>; + #[method(name = "get_sub_dag_index")] + async fn get_sub_dag_index(&self) -> RpcResult<(u64, Epoch)>; + #[method(name = "send_txn")] async fn send_txn(&self, tx: TransactionRequest) -> RpcResult<()>; diff --git a/core/rpc/src/logic/flk_impl.rs b/core/rpc/src/logic/flk_impl.rs index 746265397..ad2c409c5 100644 --- a/core/rpc/src/logic/flk_impl.rs +++ b/core/rpc/src/logic/flk_impl.rs @@ -379,6 +379,14 @@ impl FleekApiServer for FleekApi { )) } + async fn get_sub_dag_index(&self) -> RpcResult<(u64, Epoch)> { + let sub_dag_index = match self.data.query_runner.get_metadata(&Metadata::SubDagIndex) { + Some(Value::SubDagIndex(index)) => index, + _ => 0, + }; + Ok((sub_dag_index, self.data.query_runner.get_epoch_info().epoch)) + } + async fn send_txn(&self, tx: TransactionRequest) -> RpcResult<()> { Ok(self .data