Skip to content

Commit e1a1e4d

Browse files
lexnvniklasad1
andauthored
rpc-v2/archive: Rename archive call method result to value (#7885)
This PR modifies the archive_call method result to align with the rpc-v2 spec: - https://github.com/paritytech/json-rpc-interface-spec/blob/main/src/api/archive_unstable_call.md Previously, the method result was encoded to a json containing a "result" field, however the spec specifies a "value" field. This aims to rectify that. cc @paritytech/subxt-team --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: Niklas Adolfsson <[email protected]>
1 parent ad4396f commit e1a1e4d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

prdoc/pr_7885.prdoc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
title: Rename archive call method result to value
2+
3+
doc:
4+
- audience: [Node Dev, Node Operator]
5+
description: |
6+
Previously, the method result was encoded to a json containing a "result" field. However,
7+
the spec specifies a "value" field. This aims to rectify that.
8+
9+
crates:
10+
- name: sc-rpc-spec-v2
11+
bump: major

substrate/client/rpc-spec-v2/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub enum MethodResult {
4949
impl MethodResult {
5050
/// Constructs a successful result.
5151
pub fn ok(result: impl Into<String>) -> MethodResult {
52-
MethodResult::Ok(MethodResultOk { success: true, result: result.into() })
52+
MethodResult::Ok(MethodResultOk { success: true, value: result.into() })
5353
}
5454

5555
/// Constructs an error result.
@@ -65,7 +65,7 @@ pub struct MethodResultOk {
6565
/// Method was successful.
6666
success: bool,
6767
/// The result of the method.
68-
pub result: String,
68+
pub value: String,
6969
}
7070

7171
/// The error result of an RPC method.
@@ -92,7 +92,7 @@ mod tests {
9292
let ok = MethodResult::ok("hello");
9393

9494
let ser = serde_json::to_string(&ok).unwrap();
95-
let exp = r#"{"success":true,"result":"hello"}"#;
95+
let exp = r#"{"success":true,"value":"hello"}"#;
9696
assert_eq!(ser, exp);
9797

9898
let ok_dec: MethodResult = serde_json::from_str(exp).unwrap();

0 commit comments

Comments
 (0)