diff --git a/crates/rooch/src/commands/transaction/commands/mod.rs b/crates/rooch/src/commands/transaction/commands/mod.rs index 49e8f17232..2e778f84b9 100644 --- a/crates/rooch/src/commands/transaction/commands/mod.rs +++ b/crates/rooch/src/commands/transaction/commands/mod.rs @@ -3,3 +3,4 @@ pub mod get_transactions_by_hash; pub mod get_transactions_by_order; +pub mod submit; diff --git a/crates/rooch/src/commands/transaction/commands/submit.rs b/crates/rooch/src/commands/transaction/commands/submit.rs new file mode 100644 index 0000000000..29c9047163 --- /dev/null +++ b/crates/rooch/src/commands/transaction/commands/submit.rs @@ -0,0 +1,39 @@ +// Copyright (c) RoochNetwork +// SPDX-License-Identifier: Apache-2.0 + +use crate::cli_types::{CommandAction, WalletContextOptions}; +use async_trait::async_trait; +use rooch_rpc_api::jsonrpc_types::TransactionWithInfoPageView; +use rooch_types::error::RoochResult; + +/// Get transactions by order +#[derive(Debug, clap::Parser)] +pub struct SubmitCommand { + /// Transaction's hash + #[clap(long)] + pub cursor: Option, + + #[clap(long)] + pub limit: Option, + + /// descending order + #[clap(short = 'd', long)] + descending_order: Option, + + #[clap(flatten)] + pub(crate) context_options: WalletContextOptions, +} + +#[async_trait] +impl CommandAction for SubmitCommand { + async fn execute(self) -> RoochResult { + let client = self.context_options.build()?.get_client().await?; + + let resp = client + .rooch + .get_transactions_by_order(self.cursor, self.limit, self.descending_order) + .await?; + + Ok(resp) + } +} diff --git a/crates/rooch/src/commands/transaction/mod.rs b/crates/rooch/src/commands/transaction/mod.rs index 83f6107d1a..e09e2ccfed 100644 --- a/crates/rooch/src/commands/transaction/mod.rs +++ b/crates/rooch/src/commands/transaction/mod.rs @@ -4,7 +4,7 @@ use crate::cli_types::CommandAction; use crate::commands::transaction::commands::{ get_transactions_by_hash::GetTransactionsByHashCommand, - get_transactions_by_order::GetTransactionsByOrderCommand, + get_transactions_by_order::GetTransactionsByOrderCommand, submit::SubmitCommand, }; use async_trait::async_trait; use clap::{Parser, Subcommand}; @@ -25,6 +25,7 @@ impl CommandAction for Transaction { match self.cmd { TransactionCommand::GetTransactionsByOrder(cmd) => cmd.execute_serialized().await, TransactionCommand::GetTransactionsByHash(cmd) => cmd.execute_serialized().await, + TransactionCommand::Submit(cmd) => cmd.execute_serialized().await, } } } @@ -33,4 +34,5 @@ impl CommandAction for Transaction { pub enum TransactionCommand { GetTransactionsByOrder(GetTransactionsByOrderCommand), GetTransactionsByHash(GetTransactionsByHashCommand), + Submit(SubmitCommand), }