use ethexe_common::{
HashOf,
injected::{
InjectedTransaction, InjectedTransactionAcceptance, SignedInjectedTransaction,
SignedTxReceipt,
},
};
use jsonrpsee::proc_macros::rpc;
#[rpc(client, namespace = "injected")]
pub trait Injected {
#[method(name = "sendTransaction")]
async fn send_transaction(
&self,
transaction: SignedInjectedTransaction,
) -> jsonrpsee::core::RpcResult<InjectedTransactionAcceptance>;
#[subscription(
name = "sendTransactionAndWatch",
unsubscribe = "sendTransactionAndWatchUnsubscribe",
item = SignedTxReceipt
)]
async fn send_transaction_and_watch(
&self,
transaction: SignedInjectedTransaction,
) -> jsonrpsee::core::SubscriptionResult;
#[method(name = "getTransactionReceipt")]
async fn get_transaction_receipt(
&self,
tx_hash: HashOf<InjectedTransaction>,
) -> jsonrpsee::core::RpcResult<Option<SignedTxReceipt>>;
#[method(name = "getTransactions")]
async fn get_transactions(
&self,
transaction_ids: Vec<HashOf<InjectedTransaction>>,
) -> jsonrpsee::core::RpcResult<Vec<Option<SignedInjectedTransaction>>>;
}