Skip to content
Snippets Groups Projects
Unverified Commit e1a1e4d8 authored by Alexandru Vasile's avatar Alexandru Vasile Committed by GitHub
Browse files

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: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: default avatarNiklas Adolfsson <niklasadolfsson1@gmail.com>
parent ad4396ff
Branches
No related merge requests found
Pipeline #519818 waiting for manual action with stages
in 1 hour, 17 minutes, and 39 seconds
title: Rename archive call method result to value
doc:
- audience: [Node Dev, Node Operator]
description: |
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.
crates:
- name: sc-rpc-spec-v2
bump: major
...@@ -49,7 +49,7 @@ pub enum MethodResult { ...@@ -49,7 +49,7 @@ pub enum MethodResult {
impl MethodResult { impl MethodResult {
/// Constructs a successful result. /// Constructs a successful result.
pub fn ok(result: impl Into<String>) -> MethodResult { pub fn ok(result: impl Into<String>) -> MethodResult {
MethodResult::Ok(MethodResultOk { success: true, result: result.into() }) MethodResult::Ok(MethodResultOk { success: true, value: result.into() })
} }
/// Constructs an error result. /// Constructs an error result.
...@@ -65,7 +65,7 @@ pub struct MethodResultOk { ...@@ -65,7 +65,7 @@ pub struct MethodResultOk {
/// Method was successful. /// Method was successful.
success: bool, success: bool,
/// The result of the method. /// The result of the method.
pub result: String, pub value: String,
} }
/// The error result of an RPC method. /// The error result of an RPC method.
...@@ -92,7 +92,7 @@ mod tests { ...@@ -92,7 +92,7 @@ mod tests {
let ok = MethodResult::ok("hello"); let ok = MethodResult::ok("hello");
let ser = serde_json::to_string(&ok).unwrap(); let ser = serde_json::to_string(&ok).unwrap();
let exp = r#"{"success":true,"result":"hello"}"#; let exp = r#"{"success":true,"value":"hello"}"#;
assert_eq!(ser, exp); assert_eq!(ser, exp);
let ok_dec: MethodResult = serde_json::from_str(exp).unwrap(); let ok_dec: MethodResult = serde_json::from_str(exp).unwrap();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment