MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / eth_send_raw_transaction

Function eth_send_raw_transaction

chain/src/method.rs:128–145  ·  view source on GitHub ↗
(module: &mut RpcModule<Context>)

Source from the content-addressed store, hash-verified

126}
127
128pub(crate) fn eth_send_raw_transaction(module: &mut RpcModule<Context>) -> Result<()> {
129 module.register_async_method(
130 "eth_sendRawTransaction",
131 move |params, blockchain| async move {
132 let raw_transaction = params.one::<Bytes>()?;
133 let transaction_hash = blockchain
134 .lock()
135 .await
136 .send_raw_transaction(raw_transaction)
137 .await
138 .map_err(|e| Error::Custom(e.to_string()))?;
139
140 Ok(transaction_hash)
141 },
142 )?;
143
144 Ok(())
145}
146
147pub(crate) fn eth_get_transaction_receipt(module: &mut RpcModule<Context>) -> Result<()> {
148 module.register_async_method(

Callers 1

serveFunction · 0.85

Calls 1

send_raw_transactionMethod · 0.80

Tested by

no test coverage detected