Skip to content

Commit 4e4937f

Browse files
authored
feat: include eth_sendRawTransactionSync in eth namesapce (#17070)
1 parent 988c0f0 commit 4e4937f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

crates/rpc/rpc-eth-api/src/core.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ pub trait EthApi<TxReq: RpcObject, T: RpcObject, B: RpcObject, R: RpcObject, H:
339339
#[method(name = "sendRawTransaction")]
340340
async fn send_raw_transaction(&self, bytes: Bytes) -> RpcResult<B256>;
341341

342+
/// Sends a signed transaction and awaits the transaction receipt.
343+
///
344+
/// This will return a timeout error if the transaction isn't included within some time period.
345+
#[method(name = "sendRawTransactionSync")]
346+
async fn send_raw_transaction_sync(&self, bytes: Bytes) -> RpcResult<R>;
347+
342348
/// Returns an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n"
343349
/// + len(message) + message))).
344350
#[method(name = "sign")]
@@ -804,6 +810,12 @@ where
804810
Ok(EthTransactions::send_raw_transaction(self, tx).await?)
805811
}
806812

813+
/// Handler for: `eth_sendRawTransactionSync`
814+
async fn send_raw_transaction_sync(&self, tx: Bytes) -> RpcResult<RpcReceipt<T::NetworkTypes>> {
815+
trace!(target: "rpc::eth", ?tx, "Serving eth_sendRawTransactionSync");
816+
Ok(EthTransactions::send_raw_transaction_sync(self, tx).await?)
817+
}
818+
807819
/// Handler for: `eth_sign`
808820
async fn sign(&self, address: Address, message: Bytes) -> RpcResult<Bytes> {
809821
trace!(target: "rpc::eth", ?address, ?message, "Serving eth_sign");

0 commit comments

Comments
 (0)