From eba3deca3e61855c237a33013e8a5e82c479e958 Mon Sep 17 00:00:00 2001
From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Date: Fri, 19 Apr 2024 12:48:44 +0300
Subject: [PATCH] txWatch: Stabilize txWatch to version 1 (#4171)

This PR stabilizes the txBroadcast API to version 1.

Needs from spec:
- https://github.com/paritytech/json-rpc-interface-spec/pull/153
- https://github.com/paritytech/json-rpc-interface-spec/pull/154


cc @paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---
 prdoc/pr_4171.prdoc                                       | 8 ++++++++
 substrate/client/rpc-spec-v2/src/transaction/api.rs       | 4 ++--
 .../src/transaction/tests/transaction_tests.rs            | 6 +++---
 3 files changed, 13 insertions(+), 5 deletions(-)
 create mode 100644 prdoc/pr_4171.prdoc

diff --git a/prdoc/pr_4171.prdoc b/prdoc/pr_4171.prdoc
new file mode 100644
index 00000000000..eef45ba922c
--- /dev/null
+++ b/prdoc/pr_4171.prdoc
@@ -0,0 +1,8 @@
+title: Stabilize transactionWatch RPC class to version 1
+
+doc:
+  - audience: Node Dev
+    description: |
+      The transactionWatch RPC API is stabilized to version 1.
+
+crates: [ ]
diff --git a/substrate/client/rpc-spec-v2/src/transaction/api.rs b/substrate/client/rpc-spec-v2/src/transaction/api.rs
index c4a89219058..ed358922d53 100644
--- a/substrate/client/rpc-spec-v2/src/transaction/api.rs
+++ b/substrate/client/rpc-spec-v2/src/transaction/api.rs
@@ -33,8 +33,8 @@ pub trait TransactionApi<Hash: Clone> {
 	///
 	/// This method is unstable and subject to change in the future.
 	#[subscription(
-		name = "transactionWatch_unstable_submitAndWatch" => "transactionWatch_unstable_watchEvent",
-		unsubscribe = "transactionWatch_unstable_unwatch",
+		name = "transactionWatch_v1_submitAndWatch" => "transactionWatch_v1_watchEvent",
+		unsubscribe = "transactionWatch_v1_unwatch",
 		item = TransactionEvent<Hash>,
 	)]
 	fn submit_and_watch(&self, bytes: Bytes);
diff --git a/substrate/client/rpc-spec-v2/src/transaction/tests/transaction_tests.rs b/substrate/client/rpc-spec-v2/src/transaction/tests/transaction_tests.rs
index c83bc948c43..7ce85b9feaf 100644
--- a/substrate/client/rpc-spec-v2/src/transaction/tests/transaction_tests.rs
+++ b/substrate/client/rpc-spec-v2/src/transaction/tests/transaction_tests.rs
@@ -38,7 +38,7 @@ async fn tx_invalid_bytes() {
 
 	// This should not rely on the tx pool state.
 	let mut sub = tx_api
-		.subscribe_unbounded("transactionWatch_unstable_submitAndWatch", rpc_params![&"0xdeadbeef"])
+		.subscribe_unbounded("transactionWatch_v1_submitAndWatch", rpc_params![&"0xdeadbeef"])
 		.await
 		.unwrap();
 
@@ -56,7 +56,7 @@ async fn tx_in_finalized() {
 	let xt = hex_string(&uxt.encode());
 
 	let mut sub = tx_api
-		.subscribe_unbounded("transactionWatch_unstable_submitAndWatch", rpc_params![&xt])
+		.subscribe_unbounded("transactionWatch_v1_submitAndWatch", rpc_params![&xt])
 		.await
 		.unwrap();
 
@@ -95,7 +95,7 @@ async fn tx_with_pruned_best_block() {
 	let xt = hex_string(&uxt.encode());
 
 	let mut sub = tx_api
-		.subscribe_unbounded("transactionWatch_unstable_submitAndWatch", rpc_params![&xt])
+		.subscribe_unbounded("transactionWatch_v1_submitAndWatch", rpc_params![&xt])
 		.await
 		.unwrap();
 
-- 
GitLab