Update deps to use scale-type-resolver 0.2 (#1565)

* Updates for scale-type-resolver 0.2

* show that we can check the name too now

* Bump versions and fix WrapperKeepOpaque name check
This commit is contained in:
James Wilson
2024-04-30 08:45:39 +01:00
committed by GitHub
parent cdbf025db1
commit bc079e7c98
18 changed files with 247 additions and 252 deletions
@@ -25,7 +25,7 @@ pub fn explore_constants(
Usage:
subxt explore pallet {pallet_name} constants <CONSTANT>
explore a specific constant of this pallet
{constants}
"}
};
@@ -53,7 +53,7 @@ pub fn explore_constants(
writedoc! {output, "
Description:
{doc_string}
"}?;
}
@@ -64,11 +64,8 @@ pub fn explore_constants(
.highlight();
// value
let value = scale_value::scale::decode_as_type(
&mut constant.value(),
&constant.ty(),
metadata.types(),
)?;
let value =
scale_value::scale::decode_as_type(&mut constant.value(), constant.ty(), metadata.types())?;
let value = format_scale_value(&value).indent(4);
writedoc!(
+5 -5
View File
@@ -57,7 +57,7 @@ pub async fn explore_storage(
Usage:
subxt explore pallet {pallet_name} storage {storage_entry_placeholder}
explore a specific storage entry of this pallet
{storage_entries}
"}
};
@@ -139,7 +139,7 @@ pub async fn explore_storage(
"}?;
} else {
writedoc! {output,"
Can be accessed without providing a {key_value_placeholder}.
"}?;
}
@@ -164,12 +164,12 @@ pub async fn explore_storage(
let value = parse_string_into_scale_value(trailing_args)?;
let value_str = value.indent(4);
writedoc! {output, "
You submitted the following {key_value_placeholder}:
{value_str}
"}?;
let key_bytes = value.encode_as_type(&type_id, metadata.types())?;
let key_bytes = value.encode_as_type(type_id, metadata.types())?;
let bytes_composite = Value::from_bytes(key_bytes);
vec![bytes_composite]
}
@@ -191,7 +191,7 @@ pub async fn explore_storage(
let value = decoded_value_thunk.to_value()?.to_string().highlight();
writedoc! {output, "
The value of the storage entry is:
{value}
"}?;
+9 -9
View File
@@ -27,7 +27,7 @@ use subxt_metadata::RuntimeApiMetadata;
/// exectute is:
/// false => Show input type description + Example Value
/// true => validate (trailing args + build node connection)
/// validation is:
/// validation is:
/// Err => Show Error
/// Ok => Make a runtime api call witht the provided args.
/// response is:
@@ -51,7 +51,7 @@ pub async fn run<'a>(
Usage:
subxt explore api {api_name} <METHOD>
explore a specific runtime api method
{methods}
"}
};
@@ -63,7 +63,7 @@ pub async fn run<'a>(
writedoc! {output, "
Description:
{doc_string}
"}?;
}
writeln!(output, "{}", usage())?;
@@ -89,7 +89,7 @@ pub async fn run<'a>(
writedoc! {output, "
Description:
{doc_string}
"}?;
}
@@ -116,7 +116,7 @@ pub async fn run<'a>(
formatdoc! {"
The method expects an {input_value_placeholder} with this shape:
{fields_description}
For example you could provide this {input_value_placeholder}:
{fields_example}"}
};
@@ -156,13 +156,13 @@ pub async fn run<'a>(
let value_str = value.indent(4);
// convert to bytes:
writedoc! {output, "
You submitted the following {input_value_placeholder}:
{value_str}
"}?;
// encode, then decode. This ensures that the scale value is of the correct shape for the param:
let bytes = value.encode_as_type(&ty.ty, metadata.types())?;
let value = Value::decode_as_type(&mut &bytes[..], &ty.ty, metadata.types())?;
let bytes = value.encode_as_type(ty.ty, metadata.types())?;
let value = Value::decode_as_type(&mut &bytes[..], ty.ty, metadata.types())?;
Ok(value)
})
.collect::<color_eyre::Result<Vec<Value>>>()?;
@@ -178,7 +178,7 @@ pub async fn run<'a>(
let output_value = output_value.to_value()?.to_string().highlight();
writedoc! {output, "
Returned value:
{output_value}
"}?;