rpc: Enable transaction_unstable_broadcast RPC V2 API (#3713)

This PR enables the `transaction_unstable_broadcast ` and
`transaction_unstable_stop` RPC API.

Since the API is unstable, we don't need to expose this in the release
notes.

After merging this, we could validate the API in subxt and stabilize it.

Spec PR that stabilizes the API:
https://github.com/paritytech/json-rpc-interface-spec/pull/139

cc @paritytech/subxt-team

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2024-03-19 16:01:22 +02:00
committed by GitHub
parent 817870e3b2
commit 923f27ccab
+13 -1
View File
@@ -64,7 +64,9 @@ use sc_rpc::{
DenyUnsafe, SubscriptionTaskExecutor,
};
use sc_rpc_spec_v2::{
archive::ArchiveApiServer, chain_head::ChainHeadApiServer, transaction::TransactionApiServer,
archive::ArchiveApiServer,
chain_head::ChainHeadApiServer,
transaction::{TransactionApiServer, TransactionBroadcastApiServer},
};
use sc_telemetry::{telemetry, ConnectionMessage, Telemetry, TelemetryHandle, SUBSTRATE_INFO};
use sc_transaction_pool_api::{MaintainedTransactionPool, TransactionPool};
@@ -653,6 +655,13 @@ where
(chain, state, child_state)
};
let transaction_broadcast_rpc_v2 = sc_rpc_spec_v2::transaction::TransactionBroadcast::new(
client.clone(),
transaction_pool.clone(),
task_executor.clone(),
)
.into_rpc();
let transaction_v2 = sc_rpc_spec_v2::transaction::Transaction::new(
client.clone(),
transaction_pool.clone(),
@@ -708,6 +717,9 @@ where
// Part of the RPC v2 spec.
rpc_api.merge(transaction_v2).map_err(|e| Error::Application(e.into()))?;
rpc_api
.merge(transaction_broadcast_rpc_v2)
.map_err(|e| Error::Application(e.into()))?;
rpc_api.merge(chain_head_v2).map_err(|e| Error::Application(e.into()))?;
// Part of the old RPC spec.