Merge branch 'master' into tadeohepperle-static-decoding-of-signed-extensions

This commit is contained in:
Tadeo hepperle
2023-10-31 15:21:51 +01:00
37 changed files with 825 additions and 765 deletions
+10
View File
@@ -48,6 +48,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!(" {pallet_name}_{event_name}");
println!(" {}", event_values);
}
println!(" Signed Extensions:");
if let Some(signed_extensions) = ext.signed_extensions() {
for signed_extension in signed_extensions.iter() {
let signed_extension = signed_extension?;
let name = signed_extension.name();
let value = signed_extension.value()?.to_string();
println!(" {name}: {value}");
}
}
}
}
+4 -6
View File
@@ -349,11 +349,7 @@ where
.map(|e| &self.bytes[e.address_start_idx..e.address_end_idx])
}
/// Return only the bytes of the signature for this signed extrinsic.
///
/// # Note
///
/// Returns `None` if the extrinsic is not signed.
/// Returns Some(signature_bytes) if the extrinsic was signed otherwise None is returned.
pub fn signature_bytes(&self) -> Option<&[u8]> {
self.signed_details
.as_ref()
@@ -696,6 +692,8 @@ impl<'a, T: Config> ExtrinsicSignedExtensions<'a, T> {
}
/// The nonce of the account that submitted the extrinsic, extracted from the CheckNonce signed extension.
///
/// Returns `None` if `nonce` was not found or decoding failed.
pub fn nonce(&self) -> Option<u64> {
let nonce = self
.iter()
@@ -712,7 +710,7 @@ impl<'a, T: Config> ExtrinsicSignedExtension<'a, T> {
}
/// The name of the signed extension.
pub fn name(&self) -> &str {
pub fn name(&self) -> &'a str {
self.identifier
}
+4 -1
View File
@@ -13,7 +13,10 @@ pub use crate::backend::BlockRef;
pub use block_types::Block;
pub use blocks_client::BlocksClient;
pub use extrinsic_types::{ExtrinsicDetails, ExtrinsicEvents, Extrinsics, StaticExtrinsic};
pub use extrinsic_types::{
ExtrinsicDetails, ExtrinsicEvents, ExtrinsicSignedExtension, ExtrinsicSignedExtensions,
Extrinsics, StaticExtrinsic,
};
// We get account nonce info in tx_client, too, so re-use the logic:
pub(crate) use block_types::get_account_nonce;
+1 -1
View File
@@ -309,7 +309,7 @@ pub mod ext {
/// the metadata first. This is **not recommended** in production code, since the unstable metadata a node is providing is likely
/// to be incompatible with Subxt.
///
/// ```rust,no_run
/// ```rust,ignore
/// #[subxt::subxt(
/// runtime_metadata_url = "wss://rpc.polkadot.io:443",
/// unstable_metadata