From 6f2623e11de8c7a77d6e8d0075cbe910f287bc3f Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Fri, 18 Nov 2022 18:30:13 +0200 Subject: [PATCH 01/37] scripts: Fix `generate_changelog.sh` with empty printf (#719) Signed-off-by: Alexandru Vasile --- scripts/generate_changelog.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/generate_changelog.sh b/scripts/generate_changelog.sh index e2e3fbdb229..3eaabe913b9 100755 --- a/scripts/generate_changelog.sh +++ b/scripts/generate_changelog.sh @@ -55,8 +55,10 @@ function generate_changelog() { pr_link="$REMOTE_LINK$pr_number" # Generate the link as markdown. pr_md_link=" ([#$pr_number]($pr_link))" - # Print the changelog line as `- commit-title pr-link`. - echo "$line" | awk -v var="$pr_md_link" '{NF--; printf "- "; printf; print var}' + # Print every word from the commit title, except the last word. + # The last word is the PR id that is already included by the pr-link. + # The changelog line is `- commit-title pr-link`. + echo "$line" | awk -v link="$pr_md_link" '{ printf "- "; for(i=1;i<=NF-1;i++) { printf $i" "} print link}' done <<< "$prs" } From 37392f33a585343b35e9e891a94cad310a86971f Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Mon, 21 Nov 2022 16:04:16 +0100 Subject: [PATCH 02/37] fix(ci): wasm tests (#720) --- .github/workflows/rust.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8ea01482b71..e86d6648516 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -176,9 +176,15 @@ jobs: steps: - uses: actions/checkout@v3.1.0 - - name: Install + - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + - name: Install firefox + uses: browser-actions/setup-firefox@latest + + - name: Install chrome + uses: browser-actions/setup-chrome@latest + - name: Download Substrate run: | curl $SUBSTRATE_URL --output substrate --location From 15ffbb6c4b8be1dace182ff9b16c0b2f8cbd29f5 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Mon, 21 Nov 2022 18:05:42 +0100 Subject: [PATCH 03/37] fix(ci): wasm tests with cache + disable logging (#722) * fix(ci): wasm tests with cache * disable logging in wasm tests --- .github/workflows/rust.yml | 3 +++ testing/wasm-tests/tests/wasm.rs | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e86d6648516..c6912560c04 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -185,6 +185,9 @@ jobs: - name: Install chrome uses: browser-actions/setup-chrome@latest + - name: Rust Cache + uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 + - name: Download Substrate run: | curl $SUBSTRATE_URL --output substrate --location diff --git a/testing/wasm-tests/tests/wasm.rs b/testing/wasm-tests/tests/wasm.rs index 310d6da3110..eed10af5659 100644 --- a/testing/wasm-tests/tests/wasm.rs +++ b/testing/wasm-tests/tests/wasm.rs @@ -7,15 +7,8 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); /// Run the tests by `$ wasm-pack test --firefox --headless` -fn init_tracing() { - console_error_panic_hook::set_once(); - tracing_wasm::set_as_global_default(); -} - #[wasm_bindgen_test] async fn wasm_ws_transport_works() { - init_tracing(); - let client = subxt::client::OnlineClient::::from_url("ws://127.0.0.1:9944") .await From 8b46f5c786513ae2a66ddd33d16f98b7dbc5d741 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Wed, 23 Nov 2022 12:28:49 +0100 Subject: [PATCH 04/37] Retain Rust code items from `mod` decorated with `subxt` attribute (#721) * refactor: Simplify collecting type substitutes * Simplify ItemMod::from * Preserve inner Rust items when expanding the subxt::subxt macro * No named lifetimes * Update codegen/src/api/mod.rs Co-authored-by: Andrew Jones * Move passing UI tests under `ui_tests` Co-authored-by: Andrew Jones --- codegen/src/api/mod.rs | 11 ++++--- codegen/src/ir.rs | 20 +++++++++---- .../src/correct/rust-items-preserved.rs | 30 +++++++++++++++++++ testing/ui-tests/src/lib.rs | 2 ++ 4 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 testing/ui-tests/src/correct/rust-items-preserved.rs diff --git a/codegen/src/api/mod.rs b/codegen/src/api/mod.rs index df31e4ad020..a35f7ecd207 100644 --- a/codegen/src/api/mod.rs +++ b/codegen/src/api/mod.rs @@ -204,9 +204,7 @@ impl RuntimeGenerator { }) .collect::>(); - for (path, substitute) in item_mod_ir.type_substitutes().iter() { - type_substitutes.insert(path.to_string(), substitute.clone()); - } + type_substitutes.extend(item_mod_ir.type_substitutes().into_iter()); let type_gen = TypeGenerator::new( &self.metadata.types, @@ -302,7 +300,7 @@ impl RuntimeGenerator { } }; - let mod_ident = item_mod_ir.ident; + let mod_ident = &item_mod_ir.ident; let pallets_with_constants: Vec<_> = pallets_with_mod_names .iter() .filter_map(|(pallet, pallet_mod_name)| { @@ -324,9 +322,14 @@ impl RuntimeGenerator { }) .collect(); + let rust_items = item_mod_ir.rust_items(); + quote! { #[allow(dead_code, unused_imports, non_camel_case_types)] pub mod #mod_ident { + // Preserve any Rust items that were previously defined in the adorned module + #( #rust_items ) * + // Make it easy to access the root via `root_mod` at different levels: use super::#mod_ident as root_mod; // Identify the pallets composing the static metadata by name. diff --git a/codegen/src/ir.rs b/codegen/src/ir.rs index a2b8f10a77c..6050bb7bf9d 100644 --- a/codegen/src/ir.rs +++ b/codegen/src/ir.rs @@ -26,16 +26,13 @@ impl From for ItemMod { abort!(module, "out-of-line subxt modules are not supported",) } }; - let items = items - .into_iter() - .map(>::from) - .collect::>(); + Self { vis: module.vis, mod_token: module.mod_token, ident: module.ident, brace, - items, + items: items.into_iter().map(From::from).collect(), } } } @@ -57,6 +54,10 @@ impl ItemMod { }) .collect() } + + pub fn rust_items(&self) -> impl Iterator { + self.items.iter().filter_map(Item::as_rust) + } } #[allow(clippy::large_enum_variant)] @@ -66,6 +67,15 @@ pub enum Item { Subxt(SubxtItem), } +impl Item { + pub fn as_rust(&self) -> Option<&syn::Item> { + match self { + Item::Rust(item) => Some(item), + _ => None, + } + } +} + impl From for Item { fn from(item: syn::Item) -> Self { if let syn::Item::Use(ref use_) = item { diff --git a/testing/ui-tests/src/correct/rust-items-preserved.rs b/testing/ui-tests/src/correct/rust-items-preserved.rs new file mode 100644 index 00000000000..99a31f4d205 --- /dev/null +++ b/testing/ui-tests/src/correct/rust-items-preserved.rs @@ -0,0 +1,30 @@ +#[subxt::subxt(runtime_metadata_path = "../../../artifacts/polkadot_metadata.scale")] +pub mod node_runtime { + pub struct SomeStruct; + pub enum SomeEnum { + A, + B, + } + pub trait SomeTrait { + fn some_func(&self) -> u32; + } + impl SomeTrait for SomeStruct { + fn some_func(&self) -> u32 { + 1 + } + } + impl SomeTrait for SomeEnum { + fn some_func(&self) -> u32 { + 2 + } + } +} + +fn main() { + use node_runtime::SomeTrait; + + let unit = node_runtime::SomeStruct; + assert_eq!(unit.some_func(), 1); + let enumeration = node_runtime::SomeEnum::A; + assert_eq!(enumeration.some_func(), 2); +} diff --git a/testing/ui-tests/src/lib.rs b/testing/ui-tests/src/lib.rs index fbcc0a9d105..8c3e30d30a5 100644 --- a/testing/ui-tests/src/lib.rs +++ b/testing/ui-tests/src/lib.rs @@ -25,6 +25,8 @@ fn ui_tests() { let mut m = MetadataTestRunner::default(); let t = trybuild::TestCases::new(); + t.pass("src/correct/*.rs"); + // Check that storage maps with no keys are handled properly. t.pass(&m.path_to_ui_test_for_metadata( "storage_map_no_keys", From 523534464f1813e7fe32e6165cad0b23200208df Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Wed, 23 Nov 2022 12:30:13 +0100 Subject: [PATCH 05/37] Add and adapt a publish.sh utility script from jsonrpsee (#723) * refactor: Explicitly indicate which crates should be published * chore: Add a convenience publish.sh script * Update scripts/publish.sh Co-authored-by: Niklas Adolfsson * Update scripts/publish.sh Co-authored-by: Niklas Adolfsson * fix: Don't use unsupported -P flag in BSD grep in publish.sh Co-authored-by: Niklas Adolfsson --- cli/Cargo.toml | 1 + codegen/Cargo.toml | 1 + macro/Cargo.toml | 1 + metadata/Cargo.toml | 1 + scripts/publish.sh | 100 +++++++++++++++++++++++++++ subxt/Cargo.toml | 1 + testing/integration-tests/Cargo.toml | 1 + testing/test-runtime/Cargo.toml | 1 + testing/ui-tests/Cargo.toml | 1 + testing/wasm-tests/Cargo.toml | 1 + 10 files changed, 109 insertions(+) create mode 100755 scripts/publish.sh diff --git a/cli/Cargo.toml b/cli/Cargo.toml index d0c934fc03a..9a9b1b527a3 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -3,6 +3,7 @@ name = "subxt-cli" version = "0.25.0" authors = ["Parity Technologies "] edition = "2021" +publish = true license = "Apache-2.0 OR GPL-3.0" repository = "https://github.com/paritytech/subxt" diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 04ffc54a7ec..c906ec1d266 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -3,6 +3,7 @@ name = "subxt-codegen" version = "0.25.0" authors = ["Parity Technologies "] edition = "2021" +publish = true license = "Apache-2.0 OR GPL-3.0" repository = "https://github.com/paritytech/subxt" diff --git a/macro/Cargo.toml b/macro/Cargo.toml index 4a4eaaf9fe3..098503efcfc 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -3,6 +3,7 @@ name = "subxt-macro" version = "0.25.0" authors = ["Parity Technologies "] edition = "2021" +publish = true autotests = false license = "Apache-2.0 OR GPL-3.0" diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index ca10bf1201a..74492aa5953 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -3,6 +3,7 @@ name = "subxt-metadata" version = "0.25.0" authors = ["Parity Technologies "] edition = "2021" +publish = true autotests = false license = "Apache-2.0 OR GPL-3.0" diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 00000000000..a127e4196f2 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +# +# This script is copied from `https://github.com/paritytech/jsonrpsee` with some minor tweaks. +# Add `--dry-run` and/or `--allow-dirty` to your command line to test things before publication. + +set -eu + +# Find publishable crates by running something like this below and figure out the topological order: +# $ find . -iname 'Cargo.toml' | xargs grep "publish\ *=\ *true" | grep "^.*\.toml" -o +ORDER=(metadata codegen macro subxt cli) + +function read_toml () { + NAME="" + VERSION="" + # Extract and parse the "name = ..." line that belongs to the [package] section + NAME=$(grep -e "\[package\]" -e 'name*=*' ./Cargo.toml | grep -A1 "\[package\]" | tail -n 1 | sed -e 's/.*"\(.*\)"/\1/') + VERSION=$(grep "^version" ./Cargo.toml | sed -e 's/.*"\(.*\)"/\1/') +} +function remote_version () { + REMOTE_VERSION="" + REMOTE_VERSION=$(cargo search "$NAME" | grep "^$NAME =" | sed -e 's/.*"\(.*\)".*/\1/') +} + +# First display the plan +for CRATE_DIR in ${ORDER[@]}; do + cd $CRATE_DIR > /dev/null + read_toml + echo "$NAME@$VERSION" + cd - > /dev/null +done + +read -p ">>>> Really publish?. Press [enter] to continue. " + +set -x + +cargo clean + +set +x + +# Then actually perform publishing. +for CRATE_DIR in ${ORDER[@]}; do + cd $CRATE_DIR > /dev/null + read_toml + remote_version + # Seems the latest version matches, skip by default. + if [ "$REMOTE_VERSION" = "$VERSION" ] || [[ "$REMOTE_VERSION" > "$VERSION" ]]; then + RET="" + echo "Seems like $NAME@$REMOTE_VERSION is already published. Continuing in 5s. " + read -t 5 -p ">>>> Type [r][enter] to retry, or [enter] to continue... " RET || true + if [ "$RET" != "r" ]; then + echo "Skipping $NAME@$VERSION" + cd - > /dev/null + continue + fi + fi + + # Attempt to publish (allow retries) + while : ; do + # give the user an opportunity to abort or skip before publishing + echo "🚀 Publishing $NAME@$VERSION..." + sleep 3 + + set +e && set -x + cargo publish $@ + RES=$? + set +x && set -e + # Check if it succeeded + if [ "$RES" != "0" ]; then + CHOICE="" + echo "##### Publishing $NAME failed" + read -p ">>>>> Type [s][enter] to skip, or [enter] to retry.. " CHOICE + if [ "$CHOICE" = "s" ]; then + break + fi + else + break + fi + done + + # Wait again to make sure that the new version is published and available. + echo "Waiting for $NAME@$VERSION to become available at the registry..." + while : ; do + sleep 3 + remote_version + if [ "$REMOTE_VERSION" = "$VERSION" ]; then + echo "🥳 $NAME@$VERSION published succesfully." + sleep 3 + break + else + echo "#### Got $NAME@$REMOTE_VERSION but expected $NAME@$VERSION. Retrying..." + fi + done + cd - > /dev/null +done + +echo "Tagging subxt@$VERSION" +set -x +git tag -s -a v$VERSION -m "Version $VERSION" +sleep 3 +git push --tags diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index cf7c02fd417..f340c01df29 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -3,6 +3,7 @@ name = "subxt" version = "0.25.0" authors = ["Parity Technologies "] edition = "2021" +publish = true license = "Apache-2.0 OR GPL-3.0" readme = "../README.md" diff --git a/testing/integration-tests/Cargo.toml b/testing/integration-tests/Cargo.toml index 98632016a69..9c766159741 100644 --- a/testing/integration-tests/Cargo.toml +++ b/testing/integration-tests/Cargo.toml @@ -3,6 +3,7 @@ name = "integration-tests" version = "0.25.0" authors = ["Parity Technologies "] edition = "2021" +publish = false license = "Apache-2.0 OR GPL-3.0" readme = "../README.md" diff --git a/testing/test-runtime/Cargo.toml b/testing/test-runtime/Cargo.toml index a738f0cc89a..ae32e25e6d0 100644 --- a/testing/test-runtime/Cargo.toml +++ b/testing/test-runtime/Cargo.toml @@ -2,6 +2,7 @@ name = "test-runtime" version = "0.25.0" edition = "2021" +publish = false [dependencies] subxt = { path = "../../subxt" } diff --git a/testing/ui-tests/Cargo.toml b/testing/ui-tests/Cargo.toml index f3f66965739..b544d1f5095 100644 --- a/testing/ui-tests/Cargo.toml +++ b/testing/ui-tests/Cargo.toml @@ -2,6 +2,7 @@ name = "ui-tests" version = "0.25.0" edition = "2021" +publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/testing/wasm-tests/Cargo.toml b/testing/wasm-tests/Cargo.toml index d539bebb877..48c60ec44c7 100644 --- a/testing/wasm-tests/Cargo.toml +++ b/testing/wasm-tests/Cargo.toml @@ -2,6 +2,7 @@ name = "wasm-test" version = "0.1.0" edition = "2021" +publish = false [dev-dependencies] wasm-bindgen-test = "0.3.24" From 1c9aabf0f5113986aa919573a5409c64b657bd86 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Wed, 23 Nov 2022 16:03:04 +0200 Subject: [PATCH 06/37] events: Fetch metadata at arbitrary blocks (#727) * subxt/rpc: Fetch metadata at arbitrary blocks Signed-off-by: Alexandru Vasile * subxt/events: Fetch metadata for events at arbitrary blocks Signed-off-by: Alexandru Vasile * Revert "subxt/events: Fetch metadata for events at arbitrary blocks" This reverts commit 381409b7a8916611d7c44dc6ad58a90993b6c297. * subxt/events: Custom constructor with metadata for events Signed-off-by: Alexandru Vasile * Update subxt/src/events/events_type.rs Co-authored-by: James Wilson Signed-off-by: Alexandru Vasile Co-authored-by: James Wilson --- subxt/src/client/online_client.rs | 4 +-- subxt/src/events/events_client.rs | 25 ++++++++++++----- subxt/src/events/events_type.rs | 46 +++++++++++++++++++++++++++++++ subxt/src/rpc/rpc.rs | 4 +-- 4 files changed, 68 insertions(+), 11 deletions(-) diff --git a/subxt/src/client/online_client.rs b/subxt/src/client/online_client.rs index fc85fad5fd2..668ddf65b17 100644 --- a/subxt/src/client/online_client.rs +++ b/subxt/src/client/online_client.rs @@ -93,7 +93,7 @@ impl OnlineClient { let (genesis_hash, runtime_version, metadata) = future::join3( rpc.genesis_hash(), rpc.runtime_version(None), - rpc.metadata(), + rpc.metadata(None), ) .await; @@ -310,7 +310,7 @@ impl RuntimeUpdaterStream { Err(err) => return Some(Err(err)), }; - let metadata = match self.client.rpc().metadata().await { + let metadata = match self.client.rpc().metadata(None).await { Ok(metadata) => metadata, Err(err) => return Some(Err(err)), }; diff --git a/subxt/src/events/events_client.rs b/subxt/src/events/events_client.rs index e91bf15c50e..eb0e3368702 100644 --- a/subxt/src/events/events_client.rs +++ b/subxt/src/events/events_client.rs @@ -66,13 +66,7 @@ where } }; - let event_bytes = client - .rpc() - .storage(&system_events_key().0, Some(block_hash)) - .await? - .map(|e| e.0) - .unwrap_or_else(Vec::new); - + let event_bytes = get_event_bytes(&client, Some(block_hash)).await?; Ok(Events::new(client.metadata(), block_hash, event_bytes)) } } @@ -84,3 +78,20 @@ fn system_events_key() -> StorageKey { storage_key.extend(twox_128(b"Events").to_vec()); StorageKey(storage_key) } + +// Get the event bytes from the provided client, at the provided block hash. +pub(crate) async fn get_event_bytes( + client: &Client, + block_hash: Option, +) -> Result, Error> +where + T: Config, + Client: OnlineClientT, +{ + Ok(client + .rpc() + .storage(&system_events_key().0, block_hash) + .await? + .map(|e| e.0) + .unwrap_or_else(Vec::new)) +} diff --git a/subxt/src/events/events_type.rs b/subxt/src/events/events_type.rs index d0b8ade853e..234f6aa7b5e 100644 --- a/subxt/src/events/events_type.rs +++ b/subxt/src/events/events_type.rs @@ -9,7 +9,9 @@ use super::{ StaticEvent, }; use crate::{ + client::OnlineClientT, error::Error, + events::events_client::get_event_bytes, metadata::EventMetadata, Config, Metadata, @@ -64,6 +66,50 @@ impl Events { } } + /// Obtain the events from a block hash given custom metadata and a client. + /// + /// This method gives users the ability to inspect the events of older blocks, + /// where the metadata changed. For those cases, the user is responsible for + /// providing a valid metadata. + /// + /// # Example + /// + /// ```no_run + /// # #[tokio::main] + /// # async fn main() -> Result<(), Box> { + /// use subxt::{ OnlineClient, PolkadotConfig, events::Events }; + /// + /// let client = OnlineClient::::new().await.unwrap(); + /// + /// // Get the hash of an older block. + /// let block_hash = client + /// .rpc() + /// .block_hash(Some(1u32.into())) + /// .await? + /// .expect("didn't pass a block number; qed"); + /// // Fetch the metadata of the given block. + /// let metadata = client.rpc().metadata(Some(block_hash)).await?; + /// // Fetch the events from the client. + /// let events = Events::new_from_client(metadata, block_hash, client); + /// # Ok(()) + /// # } + /// ``` + /// + /// # Note + /// + /// Prefer to use [`crate::events::EventsClient::at`] to obtain the events. + pub async fn new_from_client( + metadata: Metadata, + block_hash: T::Hash, + client: Client, + ) -> Result + where + Client: OnlineClientT, + { + let event_bytes = get_event_bytes(&client, Some(block_hash)).await?; + Ok(Events::new(metadata, block_hash, event_bytes)) + } + /// The number of events. pub fn len(&self) -> u32 { self.num_events diff --git a/subxt/src/rpc/rpc.rs b/subxt/src/rpc/rpc.rs index 47f716c8db9..c12ce885e6c 100644 --- a/subxt/src/rpc/rpc.rs +++ b/subxt/src/rpc/rpc.rs @@ -443,10 +443,10 @@ impl Rpc { } /// Fetch the metadata - pub async fn metadata(&self) -> Result { + pub async fn metadata(&self, at: Option) -> Result { let bytes: Bytes = self .client - .request("state_getMetadata", rpc_params![]) + .request("state_getMetadata", rpc_params![at]) .await?; let meta: RuntimeMetadataPrefixed = Decode::decode(&mut &bytes[..])?; let metadata: Metadata = meta.try_into()?; From 702e87e58d64df5cbc0fd1d1d63672d50a583f6b Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Wed, 23 Nov 2022 16:08:26 +0100 Subject: [PATCH 07/37] Remove a soon-to-be-removed `const_err` lint (#731) Removed in Rust 1.66: ``` warning: lint `const_err` has been removed: converted into hard error, see issue #71800 for more information --> subxt/src/lib.rs:114:5 | 114 | const_err, | ^^^^^^^^^ | = note: `#[warn(renamed_and_removed_lints)]` on by default ``` --- subxt/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/subxt/src/lib.rs b/subxt/src/lib.rs index 18e705015a8..98660ba4ded 100644 --- a/subxt/src/lib.rs +++ b/subxt/src/lib.rs @@ -111,7 +111,6 @@ #![deny( bad_style, - const_err, improper_ctypes, missing_docs, non_shorthand_field_patterns, From a80d6cfd3095181201ef06818b5e7912206e74c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Miguel=20Garc=C3=ADa?= Date: Wed, 23 Nov 2022 16:25:32 +0100 Subject: [PATCH 08/37] Add `--derive-for-type` to cli (#708) * Add `--derive-for-type` to cli * Remove clippy warnings --- cli/src/commands/codegen.rs | 42 ++++++++++++++----- examples/examples/storage_iterating.rs | 2 +- macro/src/lib.rs | 2 +- testing/test-runtime/build.rs | 4 +- testing/ui-tests/src/lib.rs | 8 ++-- .../src/utils/metadata_test_runner.rs | 4 +- 6 files changed, 41 insertions(+), 21 deletions(-) diff --git a/cli/src/commands/codegen.rs b/cli/src/commands/codegen.rs index d7f7a38d218..a89b8631746 100644 --- a/cli/src/commands/codegen.rs +++ b/cli/src/commands/codegen.rs @@ -28,14 +28,27 @@ pub struct Opts { /// Additional derives #[clap(long = "derive")] derives: Vec, + /// Additional derives for a given type. + /// + /// Example `--derive-for-type my_module::my_type=serde::Serialize`. + #[clap(long = "derive-for-type", value_parser = derive_for_type_parser)] + derives_for_type: Vec<(String, String)>, /// The `subxt` crate access path in the generated code. /// Defaults to `::subxt`. #[clap(long = "crate")] crate_path: Option, } +fn derive_for_type_parser(src: &str) -> Result<(String, String), String> { + let (ty, derive) = src + .split_once('=') + .ok_or_else(|| String::from("Invalid pattern for `derive-for-type`. It should be `type=derive`, like `my_type=serde::Serialize`"))?; + + Ok((ty.to_string(), derive.to_string())) +} + pub async fn run(opts: Opts) -> color_eyre::Result<()> { - if let Some(file) = opts.file.as_ref() { + let bytes = if let Some(file) = opts.file.as_ref() { if opts.url.is_some() { eyre::bail!("specify one of `--url` or `--file` but not both") }; @@ -43,23 +56,24 @@ pub async fn run(opts: Opts) -> color_eyre::Result<()> { let mut file = fs::File::open(file)?; let mut bytes = Vec::new(); file.read_to_end(&mut bytes)?; - codegen(&bytes, opts.derives, opts.crate_path)?; - return Ok(()) - } + bytes + } else { + let url = opts.url.unwrap_or_else(|| { + "http://localhost:9933" + .parse::() + .expect("default url is valid") + }); + subxt_codegen::utils::fetch_metadata_bytes(&url).await? + }; - let url = opts.url.unwrap_or_else(|| { - "http://localhost:9933" - .parse::() - .expect("default url is valid") - }); - let bytes = subxt_codegen::utils::fetch_metadata_bytes(&url).await?; - codegen(&bytes, opts.derives, opts.crate_path)?; + codegen(&bytes, opts.derives, opts.derives_for_type, opts.crate_path)?; Ok(()) } fn codegen( metadata_bytes: &[u8], raw_derives: Vec, + derives_for_type: Vec<(String, String)>, crate_path: Option, ) -> color_eyre::Result<()> { let item_mod = syn::parse_quote!( @@ -75,6 +89,12 @@ fn codegen( let mut derives = DerivesRegistry::new(&crate_path); derives.extend_for_all(p.into_iter()); + for (ty, derive) in derives_for_type.into_iter() { + let ty = syn::parse_str(&ty)?; + let derive = syn::parse_str(&derive)?; + derives.extend_for_type(ty, std::iter::once(derive), &crate_path) + } + let runtime_api = subxt_codegen::generate_runtime_api_from_bytes( item_mod, metadata_bytes, diff --git a/examples/examples/storage_iterating.rs b/examples/examples/storage_iterating.rs index c9bed2c645d..bb0873466ed 100644 --- a/examples/examples/storage_iterating.rs +++ b/examples/examples/storage_iterating.rs @@ -39,7 +39,7 @@ async fn main() -> Result<(), Box> { println!("\nExample 1. Obtained keys:"); while let Some((key, value)) = iter.next().await? { - println!("Key: 0x{}", hex::encode(&key)); + println!("Key: 0x{}", hex::encode(key)); println!(" Value: {}", value); } } diff --git a/macro/src/lib.rs b/macro/src/lib.rs index cd685d6c380..ae5b623b2e4 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -160,7 +160,7 @@ pub fn subxt(args: TokenStream, input: TokenStream) -> TokenStream { let path = root_path.join(rest_of_path); subxt_codegen::generate_runtime_api_from_path( item_mod, - &path, + path, derives_registry, crate_path, ) diff --git a/testing/test-runtime/build.rs b/testing/test-runtime/build.rs index 783d6027537..3b910b5d3e3 100644 --- a/testing/test-runtime/build.rs +++ b/testing/test-runtime/build.rs @@ -80,7 +80,7 @@ async fn run() { // Save metadata to a file: let out_dir = env::var_os("OUT_DIR").unwrap(); let metadata_path = Path::new(&out_dir).join("metadata.scale"); - fs::write(&metadata_path, &metadata_bytes.0).expect("Couldn't write metadata output"); + fs::write(&metadata_path, metadata_bytes.0).expect("Couldn't write metadata output"); // Write out our expression to generate the runtime API to a file. Ideally, we'd just write this code // in lib.rs, but we must pass a string literal (and not `concat!(..)`) as an arg to `runtime_metadata_path`, @@ -101,7 +101,7 @@ async fn run() { .expect("Path to metadata should be stringifiable") ); let runtime_path = Path::new(&out_dir).join("runtime.rs"); - fs::write(&runtime_path, runtime_api_contents) + fs::write(runtime_path, runtime_api_contents) .expect("Couldn't write runtime rust output"); let substrate_path = diff --git a/testing/ui-tests/src/lib.rs b/testing/ui-tests/src/lib.rs index 8c3e30d30a5..d9cee8c3fa2 100644 --- a/testing/ui-tests/src/lib.rs +++ b/testing/ui-tests/src/lib.rs @@ -28,21 +28,21 @@ fn ui_tests() { t.pass("src/correct/*.rs"); // Check that storage maps with no keys are handled properly. - t.pass(&m.path_to_ui_test_for_metadata( + t.pass(m.path_to_ui_test_for_metadata( "storage_map_no_keys", storage::metadata_storage_map_no_keys(), )); // Test that the codegen can handle the different types of DispatchError. - t.pass(&m.path_to_ui_test_for_metadata( + t.pass(m.path_to_ui_test_for_metadata( "named_field_dispatch_error", dispatch_errors::metadata_named_field_dispatch_error(), )); - t.pass(&m.path_to_ui_test_for_metadata( + t.pass(m.path_to_ui_test_for_metadata( "legacy_dispatch_error", dispatch_errors::metadata_legacy_dispatch_error(), )); - t.pass(&m.path_to_ui_test_for_metadata( + t.pass(m.path_to_ui_test_for_metadata( "array_dispatch_error", dispatch_errors::metadata_array_dispatch_error(), )); diff --git a/testing/ui-tests/src/utils/metadata_test_runner.rs b/testing/ui-tests/src/utils/metadata_test_runner.rs index 5db07b355b4..a041c76062a 100644 --- a/testing/ui-tests/src/utils/metadata_test_runner.rs +++ b/testing/ui-tests/src/utils/metadata_test_runner.rs @@ -52,9 +52,9 @@ impl MetadataTestRunner { std::fs::create_dir_all(&tmp_dir).expect("could not create tmp ui test dir"); // Write metadata to tmp folder: - std::fs::write(&tmp_metadata_path, &encoded_metadata).unwrap(); + std::fs::write(&tmp_metadata_path, encoded_metadata).unwrap(); // Write test file to tmp folder (it'll be moved by trybuild): - std::fs::write(&tmp_rust_path, &rust_file).unwrap(); + std::fs::write(&tmp_rust_path, rust_file).unwrap(); tmp_rust_path } From f0ce26db7b9ad31c84d8d814b2b0e2b423f83320 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Thu, 24 Nov 2022 15:09:20 +0100 Subject: [PATCH 09/37] Add bitvec-like generic support to the scale-bits type for use in codegen (#718) * Add bitvec-like generic support to the scale-bits type for use in codegen * Use nightly 1.66 formatting * Fix reading input while decoding bit sequences * Add tests for our DecodedBits wrapper * Add convenience DecodedBits::(in)to_bits functions * Don't expose DecodedBits::bit_format * Re-export scale_bits as peer dependency * Move subxt::utils into a separate file * Hide DecodedBits internals * Don't re-export types from the `bits` module * Update subxt/src/utils/bits.rs Co-authored-by: Niklas Adolfsson * Update subxt/src/utils/bits.rs Co-authored-by: Niklas Adolfsson * Address review feedback * Clarify the byte needed calculation in DecodedBits encoding * Remove remaining dbg! invocations Co-authored-by: Niklas Adolfsson --- codegen/Cargo.toml | 5 +- codegen/src/api/mod.rs | 4 +- codegen/src/types/tests.rs | 18 +- codegen/src/types/type_path.rs | 2 +- subxt/Cargo.toml | 9 +- subxt/src/lib.rs | 2 +- subxt/src/utils/bits.rs | 227 ++++++++++++++++++ subxt/src/{utils.rs => utils/mod.rs} | 2 + .../integration-tests/src/codegen/polkadot.rs | 32 +-- 9 files changed, 273 insertions(+), 28 deletions(-) create mode 100644 subxt/src/utils/bits.rs rename subxt/src/{utils.rs => utils/mod.rs} (99%) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index c906ec1d266..662e7b48cb8 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -12,7 +12,7 @@ homepage = "https://www.parity.io/" description = "Generate an API for interacting with a substrate node from FRAME metadata" [dependencies] -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full"] } darling = "0.14.0" frame-metadata = "15.0.0" heck = "0.4.0" @@ -20,7 +20,7 @@ proc-macro2 = "1.0.24" proc-macro-error = "1.0.4" quote = "1.0.8" syn = "1.0.58" -scale-info = { version = "2.0.0", features = ["bit-vec"] } +scale-info = "2.0.0" subxt-metadata = { version = "0.25.0", path = "../metadata" } jsonrpsee = { version = "0.16.0", features = ["async-client", "client-ws-transport", "http-client"] } hex = "0.4.3" @@ -28,4 +28,5 @@ tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } [dev-dependencies] bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } +scale-info = { version = "2.0.0", features = ["bit-vec"] } pretty_assertions = "1.0.0" diff --git a/codegen/src/api/mod.rs b/codegen/src/api/mod.rs index a35f7ecd207..121a4670328 100644 --- a/codegen/src/api/mod.rs +++ b/codegen/src/api/mod.rs @@ -161,11 +161,11 @@ impl RuntimeGenerator { let mut type_substitutes = [ ( "bitvec::order::Lsb0", - parse_quote!(#crate_path::ext::bitvec::order::Lsb0), + parse_quote!(#crate_path::utils::bits::Lsb0), ), ( "bitvec::order::Msb0", - parse_quote!(#crate_path::ext::bitvec::order::Msb0), + parse_quote!(#crate_path::utils::bits::Msb0), ), ( "sp_core::crypto::AccountId32", diff --git a/codegen/src/types/tests.rs b/codegen/src/types/tests.rs index c2949d476f2..6c183c52167 100644 --- a/codegen/src/types/tests.rs +++ b/codegen/src/types/tests.rs @@ -745,10 +745,22 @@ fn generate_bitvec() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let substitutes = [ + ( + String::from("bitvec::order::Lsb0"), + parse_quote!(::subxt_path::utils::bits::Lsb0), + ), + ( + String::from("bitvec::order::Msb0"), + parse_quote!(::subxt_path::utils::bits::Msb0), + ), + ] + .into(); + let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), + substitutes, DerivesRegistry::new(&"::subxt_path".into()), "::subxt_path".into(), ); @@ -762,8 +774,8 @@ fn generate_bitvec() { use super::root; #[derive(::subxt_path::ext::codec::Decode, ::subxt_path::ext::codec::Encode, Debug)] pub struct S { - pub lsb: ::subxt_path::ext::bitvec::vec::BitVec<::core::primitive::u8, root::bitvec::order::Lsb0>, - pub msb: ::subxt_path::ext::bitvec::vec::BitVec<::core::primitive::u16, root::bitvec::order::Msb0>, + pub lsb: ::subxt_path::utils::bits::DecodedBits<::core::primitive::u8, ::subxt_path::utils::bits::Lsb0>, + pub msb: ::subxt_path::utils::bits::DecodedBits<::core::primitive::u16, ::subxt_path::utils::bits::Msb0>, } } } diff --git a/codegen/src/types/type_path.rs b/codegen/src/types/type_path.rs index 4c26821e728..2391783243c 100644 --- a/codegen/src/types/type_path.rs +++ b/codegen/src/types/type_path.rs @@ -246,7 +246,7 @@ impl TypePathType { bit_store_type, crate_path, } => { - let type_path = parse_quote! { #crate_path::ext::bitvec::vec::BitVec<#bit_store_type, #bit_order_type> }; + let type_path = parse_quote! { #crate_path::utils::bits::DecodedBits<#bit_store_type, #bit_order_type> }; syn::Type::Path(type_path) } } diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index f340c01df29..9467578858a 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -27,10 +27,10 @@ jsonrpsee-ws = ["jsonrpsee/async-client", "jsonrpsee/client-ws-transport"] jsonrpsee-web = ["jsonrpsee/async-wasm-client", "jsonrpsee/client-web-transport"] [dependencies] -bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] } -scale-info = { version = "2.0.0", features = ["bit-vec"] } +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full"] } +scale-info = "2.0.0" scale-value = "0.6.0" +scale-bits = "0.3" scale-decode = "0.4.0" futures = { version = "0.3.13", default-features = false } hex = "0.4.3" @@ -54,4 +54,7 @@ derivative = "2.2.0" getrandom = { version = "0.2", features = ["js"] } [dev-dependencies] +bitvec = "1" +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] } +scale-info = { version = "2.0.0", features = ["bit-vec"] } tokio = { version = "1.8", features = ["macros", "time", "rt-multi-thread"] } diff --git a/subxt/src/lib.rs b/subxt/src/lib.rs index 98660ba4ded..f1c41156b69 100644 --- a/subxt/src/lib.rs +++ b/subxt/src/lib.rs @@ -177,9 +177,9 @@ pub use crate::{ /// Re-export external crates that are made use of in the subxt API. pub mod ext { - pub use bitvec; pub use codec; pub use frame_metadata; + pub use scale_bits; pub use scale_value; pub use sp_core; pub use sp_runtime; diff --git a/subxt/src/utils/bits.rs b/subxt/src/utils/bits.rs new file mode 100644 index 00000000000..409597fad9a --- /dev/null +++ b/subxt/src/utils/bits.rs @@ -0,0 +1,227 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +//! Generic `scale_bits` over `bitvec`-like `BitOrder` and `BitFormat` types. + +use codec::{ + Compact, + Input, +}; +use scale_bits::{ + scale::format::{ + Format, + OrderFormat, + StoreFormat, + }, + Bits, +}; +use std::marker::PhantomData; + +macro_rules! store { + ($ident: ident; $(($ty: ident, $wrapped: ty)),*) => { + /// Associates `bitvec::store::BitStore` trait with corresponding, type-erased `scale_bits::StoreFormat` enum. + /// + /// Used to decode bit sequences by providing `scale_bits::StoreFormat` using + /// `bitvec`-like type type parameters. + pub trait $ident { + /// Corresponding `scale_bits::StoreFormat` value. + const FORMAT: StoreFormat; + /// Number of bits that the backing store types holds. + const BITS: u32; + } + + $( + impl $ident for $wrapped { + const FORMAT: StoreFormat = StoreFormat::$ty; + const BITS: u32 = <$wrapped>::BITS; + } + )* + }; + } + +macro_rules! order { + ($ident: ident; $($ty: ident),*) => { + /// Associates `bitvec::order::BitOrder` trait with corresponding, type-erased `scale_bits::OrderFormat` enum. + /// + /// Used to decode bit sequences in runtime by providing `scale_bits::OrderFormat` using + /// `bitvec`-like type type parameters. + pub trait $ident { + /// Corresponding `scale_bits::OrderFormat` value. + const FORMAT: OrderFormat; + } + + $( + #[doc = concat!("Type-level value that corresponds to `scale_bits::OrderFormat::", stringify!($ty), "` at run-time")] + #[doc = concat!(" and `bitvec::order::BitOrder::", stringify!($ty), "` at the type level.")] + #[derive(Clone, Debug, PartialEq, Eq)] + pub enum $ty {} + impl $ident for $ty { + const FORMAT: OrderFormat = OrderFormat::$ty; + } + )* + }; + } + +store!(BitStore; (U8, u8), (U16, u16), (U32, u32), (U64, u64)); +order!(BitOrder; Lsb0, Msb0); + +/// Constructs a run-time format parameters based on the corresponding type-level parameters. +fn bit_format() -> Format { + Format { + order: Order::FORMAT, + store: Store::FORMAT, + } +} + +/// `scale_bits::Bits` generic over the bit store (`u8`/`u16`/`u32`/`u64`) and bit order (LSB, MSB) +/// used for SCALE encoding/decoding. Uses `scale_bits::Bits`-default `u8` and LSB format underneath. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct DecodedBits( + Bits, + PhantomData, + PhantomData, +); + +impl DecodedBits { + /// Extracts the underlying `scale_bits::Bits` value. + pub fn into_bits(self) -> Bits { + self.0 + } + + /// References the underlying `scale_bits::Bits` value. + pub fn as_bits(&self) -> &Bits { + &self.0 + } +} + +impl core::iter::FromIterator + for DecodedBits +{ + fn from_iter>(iter: T) -> Self { + DecodedBits(Bits::from_iter(iter), PhantomData, PhantomData) + } +} + +impl codec::Decode for DecodedBits { + fn decode(input: &mut I) -> Result { + /// Equivalent of `BitSlice::MAX_BITS` on 32bit machine. + const ARCH32BIT_BITSLICE_MAX_BITS: u32 = 0x1fff_ffff; + + let Compact(bits) = >::decode(input)?; + // Otherwise it is impossible to store it on 32bit machine. + if bits > ARCH32BIT_BITSLICE_MAX_BITS { + return Err("Attempt to decode a BitVec with too many bits".into()) + } + // NOTE: Replace with `bits.div_ceil(Store::BITS)` if `int_roundings` is stabilised + let elements = (bits / Store::BITS) + u32::from(bits % Store::BITS != 0); + let bytes_in_elem = Store::BITS.saturating_div(u8::BITS); + let bytes_needed = (elements * bytes_in_elem) as usize; + + // NOTE: We could reduce allocations if it would be possible to directly + // decode from an `Input` type using a custom format (rather than default ) + // for the `Bits` type. + let mut storage = codec::Encode::encode(&Compact(bits)); + let prefix_len = storage.len(); + storage.reserve_exact(bytes_needed); + storage.extend(vec![0; bytes_needed]); + input.read(&mut storage[prefix_len..])?; + + let decoder = + scale_bits::decode_using_format_from(&storage, bit_format::())?; + let bits = decoder.collect::, _>>()?; + let bits = Bits::from_iter(bits); + + Ok(DecodedBits(bits, PhantomData, PhantomData)) + } +} + +impl codec::Encode for DecodedBits { + fn size_hint(&self) -> usize { + self.0.size_hint() + } + + fn encoded_size(&self) -> usize { + self.0.encoded_size() + } + + fn encode(&self) -> Vec { + scale_bits::encode_using_format(self.0.iter(), bit_format::()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + use core::fmt::Debug; + + use bitvec::vec::BitVec; + use codec::Decode as _; + + // NOTE: We don't use `bitvec::order` types in our implementation, since we + // don't want to depend on `bitvec`. Rather than reimplementing the unsafe + // trait on our types here for testing purposes, we simply convert and + // delegate to `bitvec`'s own types. + trait ToBitVec { + type Order: bitvec::order::BitOrder; + } + impl ToBitVec for Lsb0 { + type Order = bitvec::order::Lsb0; + } + impl ToBitVec for Msb0 { + type Order = bitvec::order::Msb0; + } + + fn scales_like_bitvec_and_roundtrips< + 'a, + Store: BitStore + bitvec::store::BitStore + PartialEq, + Order: BitOrder + ToBitVec + Debug + PartialEq, + >( + input: impl IntoIterator, + ) where + BitVec::Order>: codec::Encode + codec::Decode, + { + let input: Vec<_> = input.into_iter().copied().collect(); + + let decoded_bits = DecodedBits::::from_iter(input.clone()); + let bitvec = BitVec::::Order>::from_iter(input); + + let decoded_bits_encoded = codec::Encode::encode(&decoded_bits); + let bitvec_encoded = codec::Encode::encode(&bitvec); + assert_eq!(decoded_bits_encoded, bitvec_encoded); + + let decoded_bits_decoded = + DecodedBits::::decode(&mut &decoded_bits_encoded[..]) + .expect("SCALE-encoding DecodedBits to roundtrip"); + let bitvec_decoded = + BitVec::::Order>::decode(&mut &bitvec_encoded[..]) + .expect("SCALE-encoding BitVec to roundtrip"); + assert_eq!(decoded_bits, decoded_bits_decoded); + assert_eq!(bitvec, bitvec_decoded); + } + + #[test] + fn decoded_bitvec_scales_and_roundtrips() { + let test_cases = [ + vec![], + vec![true], + vec![false], + vec![true, false, true], + vec![true, false, true, false, false, false, false, false, true], + [vec![true; 5], vec![false; 5], vec![true; 1], vec![false; 3]].concat(), + [vec![true; 9], vec![false; 9], vec![true; 9], vec![false; 9]].concat(), + ]; + + for test_case in &test_cases { + scales_like_bitvec_and_roundtrips::(test_case); + scales_like_bitvec_and_roundtrips::(test_case); + scales_like_bitvec_and_roundtrips::(test_case); + scales_like_bitvec_and_roundtrips::(test_case); + scales_like_bitvec_and_roundtrips::(test_case); + scales_like_bitvec_and_roundtrips::(test_case); + scales_like_bitvec_and_roundtrips::(test_case); + scales_like_bitvec_and_roundtrips::(test_case); + } + } +} diff --git a/subxt/src/utils.rs b/subxt/src/utils/mod.rs similarity index 99% rename from subxt/src/utils.rs rename to subxt/src/utils/mod.rs index d8bff8d7fb3..ec6761c1b78 100644 --- a/subxt/src/utils.rs +++ b/subxt/src/utils/mod.rs @@ -4,6 +4,8 @@ //! Miscellaneous utility helpers. +pub mod bits; + use codec::{ Decode, DecodeAll, diff --git a/testing/integration-tests/src/codegen/polkadot.rs b/testing/integration-tests/src/codegen/polkadot.rs index 54ec32b1059..92d0d7570d6 100644 --- a/testing/integration-tests/src/codegen/polkadot.rs +++ b/testing/integration-tests/src/codegen/polkadot.rs @@ -38145,9 +38145,9 @@ pub mod api { Debug, )] pub struct AvailabilityBitfield( - pub ::subxt::ext::bitvec::vec::BitVec< + pub ::subxt::utils::bits::DecodedBits< ::core::primitive::u8, - ::subxt::ext::bitvec::order::Lsb0, + ::subxt::utils::bits::Lsb0, >, ); #[derive( @@ -38163,9 +38163,9 @@ pub mod api { pub validity_votes: ::std::vec::Vec< runtime_types::polkadot_primitives::v2::ValidityAttestation, >, - pub validator_indices: ::subxt::ext::bitvec::vec::BitVec< + pub validator_indices: ::subxt::utils::bits::DecodedBits< ::core::primitive::u8, - ::subxt::ext::bitvec::order::Lsb0, + ::subxt::utils::bits::Lsb0, >, } #[derive( @@ -38255,13 +38255,13 @@ pub mod api { Debug, )] pub struct DisputeState<_0> { - pub validators_for: ::subxt::ext::bitvec::vec::BitVec< + pub validators_for: ::subxt::utils::bits::DecodedBits< ::core::primitive::u8, - ::subxt::ext::bitvec::order::Lsb0, + ::subxt::utils::bits::Lsb0, >, - pub validators_against: ::subxt::ext::bitvec::vec::BitVec< + pub validators_against: ::subxt::utils::bits::DecodedBits< ::core::primitive::u8, - ::subxt::ext::bitvec::order::Lsb0, + ::subxt::utils::bits::Lsb0, >, pub start: _0, pub concluded_at: ::core::option::Option<_0>, @@ -40088,13 +40088,13 @@ pub mod api { pub hash: runtime_types::polkadot_core_primitives::CandidateHash, pub descriptor: runtime_types::polkadot_primitives::v2::CandidateDescriptor<_0>, - pub availability_votes: ::subxt::ext::bitvec::vec::BitVec< + pub availability_votes: ::subxt::utils::bits::DecodedBits< ::core::primitive::u8, - ::subxt::ext::bitvec::order::Lsb0, + ::subxt::utils::bits::Lsb0, >, - pub backers: ::subxt::ext::bitvec::vec::BitVec< + pub backers: ::subxt::utils::bits::DecodedBits< ::core::primitive::u8, - ::subxt::ext::bitvec::order::Lsb0, + ::subxt::utils::bits::Lsb0, >, pub relay_parent_number: _1, pub backed_in_number: _1, @@ -40263,13 +40263,13 @@ pub mod api { Debug, )] pub struct PvfCheckActiveVoteState<_0> { - pub votes_accept: ::subxt::ext::bitvec::vec::BitVec< + pub votes_accept: ::subxt::utils::bits::DecodedBits< ::core::primitive::u8, - ::subxt::ext::bitvec::order::Lsb0, + ::subxt::utils::bits::Lsb0, >, - pub votes_reject: ::subxt::ext::bitvec::vec::BitVec< + pub votes_reject: ::subxt::utils::bits::DecodedBits< ::core::primitive::u8, - ::subxt::ext::bitvec::order::Lsb0, + ::subxt::utils::bits::Lsb0, >, pub age: _0, pub created_at: _0, From 463e2aa93f2940b324672f5608bc857d290083ed Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Fri, 25 Nov 2022 17:07:26 +0200 Subject: [PATCH 10/37] rpc: Expose the `subscription ID` for `RpcClientT` (#733) * rpc: Extend `RpcClientT` to return the subscription ID Signed-off-by: Alexandru Vasile * rpc: Return `RpcSubscriptionId` for jsonrpsee clients Signed-off-by: Alexandru Vasile * rpc: Expose subscription ID via subxt subscription Signed-off-by: Alexandru Vasile * examples: Adjust example to return subscription ID Signed-off-by: Alexandru Vasile * rpc: Add structure for subscription stream and subscription id Signed-off-by: Alexandru Vasile Signed-off-by: Alexandru Vasile --- examples/examples/custom_rpc_client.rs | 3 ++- subxt/src/rpc/jsonrpsee_impl.rs | 37 +++++++++++++++++--------- subxt/src/rpc/mod.rs | 2 ++ subxt/src/rpc/rpc_client.rs | 8 +++++- subxt/src/rpc/rpc_client_t.rs | 13 ++++++++- 5 files changed, 48 insertions(+), 15 deletions(-) diff --git a/examples/examples/custom_rpc_client.rs b/examples/examples/custom_rpc_client.rs index 52e0cd82275..ca56a53e9cb 100644 --- a/examples/examples/custom_rpc_client.rs +++ b/examples/examples/custom_rpc_client.rs @@ -68,7 +68,8 @@ impl RpcClientT for MyLoggingClient { let res = RawValue::from_string("[]".to_string()).unwrap(); let stream = futures::stream::once(async move { Ok(res) }); let stream: Pin + Send>> = Box::pin(stream); - Box::pin(std::future::ready(Ok(stream))) + // This subscription does not provide an ID. + Box::pin(std::future::ready(Ok(RpcSubscription { stream, id: None }))) } } diff --git a/subxt/src/rpc/jsonrpsee_impl.rs b/subxt/src/rpc/jsonrpsee_impl.rs index 09dbfe663ba..e04a7828b89 100644 --- a/subxt/src/rpc/jsonrpsee_impl.rs +++ b/subxt/src/rpc/jsonrpsee_impl.rs @@ -12,14 +12,18 @@ use futures::stream::{ StreamExt, TryStreamExt, }; -use jsonrpsee::core::{ - client::{ - Client, - ClientT, - SubscriptionClientT, +use jsonrpsee::{ + core::{ + client::{ + Client, + ClientT, + SubscriptionClientT, + SubscriptionKind, + }, + traits::ToRpcParams, + Error as JsonRpseeError, }, - traits::ToRpcParams, - Error as JsonRpseeError, + types::SubscriptionId, }; use serde_json::value::RawValue; @@ -52,17 +56,26 @@ impl RpcClientT for Client { unsub: &'a str, ) -> RpcFuture<'a, RpcSubscription> { Box::pin(async move { - let sub = SubscriptionClientT::subscribe::, _>( + let stream = SubscriptionClientT::subscribe::, _>( self, sub, Params(params), unsub, ) .await - .map_err(|e| RpcError::ClientError(Box::new(e)))? - .map_err(|e| RpcError::ClientError(Box::new(e))) - .boxed(); - Ok(sub) + .map_err(|e| RpcError::ClientError(Box::new(e)))?; + + let id = match stream.kind() { + SubscriptionKind::Subscription(SubscriptionId::Str(id)) => { + Some(id.clone().into_owned()) + } + _ => None, + }; + + let stream = stream + .map_err(|e| RpcError::ClientError(Box::new(e))) + .boxed(); + Ok(RpcSubscription { stream, id }) }) } } diff --git a/subxt/src/rpc/mod.rs b/subxt/src/rpc/mod.rs index ad08b55d59c..db26f67702d 100644 --- a/subxt/src/rpc/mod.rs +++ b/subxt/src/rpc/mod.rs @@ -67,6 +67,8 @@ pub use rpc_client_t::{ RpcClientT, RpcFuture, RpcSubscription, + RpcSubscriptionId, + RpcSubscriptionStream, }; pub use rpc_client::{ diff --git a/subxt/src/rpc/rpc_client.rs b/subxt/src/rpc/rpc_client.rs index 56592c03631..2d49dc1926e 100644 --- a/subxt/src/rpc/rpc_client.rs +++ b/subxt/src/rpc/rpc_client.rs @@ -5,6 +5,7 @@ use super::{ RpcClientT, RpcSubscription, + RpcSubscriptionId, }; use crate::error::Error; use futures::{ @@ -185,6 +186,11 @@ impl Subscription { _marker: std::marker::PhantomData, } } + + /// Obtain the ID associated with this subscription. + pub fn subscription_id(&self) -> Option<&RpcSubscriptionId> { + self.inner.id.as_ref() + } } impl Subscription { @@ -203,7 +209,7 @@ impl Stream for Subscription { mut self: Pin<&mut Self>, cx: &mut std::task::Context<'_>, ) -> Poll> { - let res = futures::ready!(self.inner.poll_next_unpin(cx)); + let res = futures::ready!(self.inner.stream.poll_next_unpin(cx)); // Decode the inner RawValue to the type we're expecting and map // any errors to the right shape: diff --git a/subxt/src/rpc/rpc_client_t.rs b/subxt/src/rpc/rpc_client_t.rs index d32924ffbee..7e1ed0f6650 100644 --- a/subxt/src/rpc/rpc_client_t.rs +++ b/subxt/src/rpc/rpc_client_t.rs @@ -59,6 +59,17 @@ pub trait RpcClientT: Send + Sync + 'static { pub type RpcFuture<'a, T> = Pin> + Send + 'a>>; +/// The RPC subscription returned from [`RpcClientT`]'s `subscription` method. +pub struct RpcSubscription { + /// The subscription stream. + pub stream: RpcSubscriptionStream, + /// The ID associated with the subscription. + pub id: Option, +} + /// The inner subscription stream returned from our [`RpcClientT`]'s `subscription` method. -pub type RpcSubscription = +pub type RpcSubscriptionStream = Pin, RpcError>> + Send + 'static>>; + +/// The ID associated with the [`RpcClientT`]'s `subscription`. +pub type RpcSubscriptionId = String; From 8484c18624783af36476fc5bf6a0f08d5363a3db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Dec 2022 10:56:33 +0000 Subject: [PATCH 11/37] Bump JasonEtco/create-an-issue from 2.6.0 to 2.8.1 (#736) Bumps [JasonEtco/create-an-issue](https://github.com/JasonEtco/create-an-issue) from 2.6.0 to 2.8.1. - [Release notes](https://github.com/JasonEtco/create-an-issue/releases) - [Commits](https://github.com/JasonEtco/create-an-issue/compare/9e6213aec58987fa7d2f4deb8b256b99e63107a2...77399b6110ef82b94c1c9f9f615acf9e604f7f56) --- updated-dependencies: - dependency-name: JasonEtco/create-an-issue dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0a1a16c88c1..92eecede751 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -45,7 +45,7 @@ jobs: # If the previous step fails, create a new Github issue # to nofity us about it. - if: ${{ failure() }} - uses: JasonEtco/create-an-issue@9e6213aec58987fa7d2f4deb8b256b99e63107a2 # v2.6.0 + uses: JasonEtco/create-an-issue@77399b6110ef82b94c1c9f9f615acf9e604f7f56 # v2.8.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 0ff4e13b838f2f8ca7a87f120024563ed5ec4d3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Dec 2022 13:24:18 +0200 Subject: [PATCH 12/37] Bump JasonEtco/create-an-issue from 2.8.1 to 2.8.2 (#744) Bumps [JasonEtco/create-an-issue](https://github.com/JasonEtco/create-an-issue) from 2.8.1 to 2.8.2. - [Release notes](https://github.com/JasonEtco/create-an-issue/releases) - [Commits](https://github.com/JasonEtco/create-an-issue/compare/77399b6110ef82b94c1c9f9f615acf9e604f7f56...3a8ba796516b57db8cb2ee6dfc65bc76cd39d56d) --- updated-dependencies: - dependency-name: JasonEtco/create-an-issue dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 92eecede751..a62fd772871 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -45,7 +45,7 @@ jobs: # If the previous step fails, create a new Github issue # to nofity us about it. - if: ${{ failure() }} - uses: JasonEtco/create-an-issue@77399b6110ef82b94c1c9f9f615acf9e604f7f56 # v2.8.1 + uses: JasonEtco/create-an-issue@3a8ba796516b57db8cb2ee6dfc65bc76cd39d56d # v2.8.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 392c1915caf474631c294ae18251073315faecce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 15:42:14 +0100 Subject: [PATCH 13/37] Bump JasonEtco/create-an-issue from 2.8.2 to 2.9.1 (#757) Bumps [JasonEtco/create-an-issue](https://github.com/JasonEtco/create-an-issue) from 2.8.2 to 2.9.1. - [Release notes](https://github.com/JasonEtco/create-an-issue/releases) - [Commits](https://github.com/JasonEtco/create-an-issue/compare/3a8ba796516b57db8cb2ee6dfc65bc76cd39d56d...e27dddc79c92bc6e4562f268fffa5ed752639abd) --- updated-dependencies: - dependency-name: JasonEtco/create-an-issue dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a62fd772871..8ced1b81ae4 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -45,7 +45,7 @@ jobs: # If the previous step fails, create a new Github issue # to nofity us about it. - if: ${{ failure() }} - uses: JasonEtco/create-an-issue@3a8ba796516b57db8cb2ee6dfc65bc76cd39d56d # v2.8.2 + uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd # v2.9.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From d41f6574174d0a7d35ffcc6c3ff4d3740f5251ec Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Mon, 9 Jan 2023 17:43:50 +0300 Subject: [PATCH 14/37] Make verbose rpc error display (#758) * Make verbose rpc erro display * Apply review results * Minor fix doc-comment --- subxt/src/error.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subxt/src/error.rs b/subxt/src/error.rs index dd87277646a..b2548e43cff 100644 --- a/subxt/src/error.rs +++ b/subxt/src/error.rs @@ -107,13 +107,14 @@ impl From for Error { /// An RPC error. Since we are generic over the RPC client that is used, /// the error is boxed and could be casted. #[derive(Debug, thiserror::Error)] -#[error("RPC error")] pub enum RpcError { // Dev note: We need the error to be safely sent between threads // for `subscribe_to_block_headers_filling_in_gaps` and friends. /// Error related to the RPC client. + #[error("RPC error: {0}")] ClientError(Box), /// The RPC subscription dropped. + #[error("RPC error: subscription dropped.")] SubscriptionDropped, } From ea5daa444fb4e32b0b8f20d2b56f2c8e673ce8f7 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 10 Jan 2023 11:47:07 +0100 Subject: [PATCH 15/37] ci: Appease Clippy (#761) This should make the CI green again, as the lints have been introduced in a new stable release, outside of the changes made in this repository. --- examples/examples/dynamic_multisig.rs | 2 +- examples/examples/multisig.rs | 2 +- testing/integration-tests/src/frame/balances.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/examples/dynamic_multisig.rs b/examples/examples/dynamic_multisig.rs index 226ef98aee2..001a26fce77 100644 --- a/examples/examples/dynamic_multisig.rs +++ b/examples/examples/dynamic_multisig.rs @@ -70,7 +70,7 @@ async fn main() -> Result<(), Box> { ); // Submit it: - let encoded = hex::encode(&api.tx().call_data(&tx)?); + let encoded = hex::encode(api.tx().call_data(&tx)?); println!("Call data: {encoded}"); let tx_hash = api.tx().sign_and_submit_default(&tx, &signer).await?; println!("Submitted tx with hash {tx_hash}"); diff --git a/examples/examples/multisig.rs b/examples/examples/multisig.rs index f5e522b70d2..abb82b0e8da 100644 --- a/examples/examples/multisig.rs +++ b/examples/examples/multisig.rs @@ -67,7 +67,7 @@ async fn main() -> Result<(), Box> { ); // Submit the extrinsic with default params: - let encoded = hex::encode(&api.tx().call_data(&tx)?); + let encoded = hex::encode(api.tx().call_data(&tx)?); println!("Call data: {encoded}"); let tx_hash = api.tx().sign_and_submit_default(&tx, &signer).await?; println!("Submitted tx with hash {tx_hash}"); diff --git a/testing/integration-tests/src/frame/balances.rs b/testing/integration-tests/src/frame/balances.rs index d787bdbc5f4..83bdf06c976 100644 --- a/testing/integration-tests/src/frame/balances.rs +++ b/testing/integration-tests/src/frame/balances.rs @@ -271,7 +271,7 @@ async fn storage_balance_lock() -> Result<(), subxt::Error> { let locks_addr = node_runtime::storage() .balances() - .locks(&AccountKeyring::Bob.to_account_id()); + .locks(AccountKeyring::Bob.to_account_id()); let locks = api.storage().fetch_or_default(&locks_addr, None).await?; From b316301d61f924c510c40f505995f28a83c1365f Mon Sep 17 00:00:00 2001 From: James Wilson Date: Tue, 10 Jan 2023 12:02:41 +0000 Subject: [PATCH 16/37] Make sp_core and sp_runtime dependencies optional, and bump to latest (#760) * begin porting over traits; remove Config use of Hash * port over the Header bits that we need * sp_core_hashing where possible, move Verify to PairSigner, remove unused errors * tidy up Config things and move related bits into one place * fix codegen * copy Era over * move AccountId, Address, Signer to Signer trait and a pass over fixing examples * impl MultiAddress, MultiSignature, AccountId32 and add back to Config (for decoding later) * Copy over StorageKey, StorageData, StorageChangeSet * subxt core compiling with no sp_core or sp_runtime * Get examples compiling * pass over fixing tests * cargo fmt * clippy tweaks and update polkadot.rs * fix codegen docs * port over special DigestItem encoding/decoding * clippy and doc fixes * cargo fmt and example fix * more cargo fmt-ing... * substrate-extra to substrate-compat * cargo.toml comments * simplify PairSigner trait bounds * move RPC types to a separate file * fix docs * Add some tests for things and other PR feedback * bump to latest sp deps * avoid needing substrate-compat feature in a test --- codegen/src/api/mod.rs | 16 +- examples/Cargo.toml | 4 +- .../examples/balance_transfer_with_params.rs | 14 +- .../examples/concurrent_storage_requests.rs | 2 +- examples/examples/custom_config.rs | 10 +- examples/examples/fetch_staking_details.rs | 12 +- examples/examples/multisig.rs | 2 +- .../examples/rpc_call_subscribe_blocks.rs | 9 +- metadata/Cargo.toml | 2 +- metadata/src/lib.rs | 4 +- subxt/Cargo.toml | 32 +- subxt/src/blocks/block_types.rs | 16 +- subxt/src/blocks/blocks_client.rs | 10 +- subxt/src/client/offline_client.rs | 2 +- subxt/src/client/online_client.rs | 6 +- .../params.rs => config/extrinsic_params.rs} | 151 +- subxt/src/{config.rs => config/mod.rs} | 119 +- subxt/src/config/polkadot.rs | 49 + subxt/src/config/substrate.rs | 294 +++ subxt/src/error.rs | 20 - subxt/src/events/events_client.rs | 9 +- subxt/src/lib.rs | 2 - subxt/src/rpc/mod.rs | 5 +- subxt/src/rpc/rpc.rs | 401 +--- subxt/src/rpc/types.rs | 558 +++++ subxt/src/storage/mod.rs | 4 +- subxt/src/storage/storage_client.rs | 8 +- subxt/src/storage/storage_map_key.rs | 13 +- subxt/src/storage/utils.rs | 4 +- subxt/src/tx/mod.rs | 40 +- subxt/src/tx/signer.rs | 113 +- subxt/src/tx/tx_client.rs | 57 +- subxt/src/tx/tx_progress.rs | 8 +- subxt/src/utils/account_id.rs | 203 ++ subxt/src/utils/mod.rs | 15 + subxt/src/utils/multi_address.rs | 66 + subxt/src/utils/multi_signature.rs | 61 + testing/integration-tests/Cargo.toml | 6 +- testing/integration-tests/src/blocks/mod.rs | 4 +- testing/integration-tests/src/client/mod.rs | 18 +- testing/integration-tests/src/codegen/mod.rs | 2 +- .../integration-tests/src/codegen/polkadot.rs | 1945 ++++++++--------- .../integration-tests/src/frame/balances.rs | 36 +- .../integration-tests/src/frame/contracts.rs | 2 +- testing/integration-tests/src/storage/mod.rs | 11 +- testing/test-runtime/Cargo.toml | 3 +- testing/test-runtime/build.rs | 2 +- 47 files changed, 2646 insertions(+), 1724 deletions(-) rename subxt/src/{tx/params.rs => config/extrinsic_params.rs} (59%) rename subxt/src/{config.rs => config/mod.rs} (53%) create mode 100644 subxt/src/config/polkadot.rs create mode 100644 subxt/src/config/substrate.rs create mode 100644 subxt/src/rpc/types.rs create mode 100644 subxt/src/utils/account_id.rs create mode 100644 subxt/src/utils/multi_address.rs create mode 100644 subxt/src/utils/multi_signature.rs diff --git a/codegen/src/api/mod.rs b/codegen/src/api/mod.rs index 121a4670328..8d11f2bfeab 100644 --- a/codegen/src/api/mod.rs +++ b/codegen/src/api/mod.rs @@ -169,23 +169,23 @@ impl RuntimeGenerator { ), ( "sp_core::crypto::AccountId32", - parse_quote!(#crate_path::ext::sp_core::crypto::AccountId32), + parse_quote!(#crate_path::utils::AccountId32), + ), + ( + "sp_runtime::multiaddress::MultiAddress", + parse_quote!(#crate_path::utils::MultiAddress), ), ( "primitive_types::H160", - parse_quote!(#crate_path::ext::sp_core::H160), + parse_quote!(#crate_path::utils::H160), ), ( "primitive_types::H256", - parse_quote!(#crate_path::ext::sp_core::H256), + parse_quote!(#crate_path::utils::H256), ), ( "primitive_types::H512", - parse_quote!(#crate_path::ext::sp_core::H512), - ), - ( - "sp_runtime::multiaddress::MultiAddress", - parse_quote!(#crate_path::ext::sp_runtime::MultiAddress), + parse_quote!(#crate_path::utils::H512), ), ( "frame_support::traits::misc::WrapperKeepOpaque", diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 60238f2d430..31da6f146bc 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -14,8 +14,10 @@ description = "Subxt example usage" [dev-dependencies] subxt = { path = "../subxt" } tokio = { version = "1.8", features = ["rt-multi-thread", "macros", "time"] } -sp-keyring = "7.0.0" +sp-keyring = "12.0.0" futures = "0.3.13" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] } hex = "0.4.3" tracing-subscriber = "0.3.11" +sp-core = { version = "11.0.0", default-features = false } +sp-runtime = { version = "12.0.0" } diff --git a/examples/examples/balance_transfer_with_params.rs b/examples/examples/balance_transfer_with_params.rs index 62880c01f7f..98a1812dcec 100644 --- a/examples/examples/balance_transfer_with_params.rs +++ b/examples/examples/balance_transfer_with_params.rs @@ -12,14 +12,16 @@ use sp_keyring::AccountKeyring; use subxt::{ - tx::{ - Era, - PairSigner, - PlainTip, - PolkadotExtrinsicParamsBuilder as Params, + config::{ + polkadot::{ + Era, + PlainTip, + PolkadotExtrinsicParamsBuilder as Params, + }, + PolkadotConfig, }, + tx::PairSigner, OnlineClient, - PolkadotConfig, }; #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")] diff --git a/examples/examples/concurrent_storage_requests.rs b/examples/examples/concurrent_storage_requests.rs index 80ef8dea0b7..064d46204d1 100644 --- a/examples/examples/concurrent_storage_requests.rs +++ b/examples/examples/concurrent_storage_requests.rs @@ -24,7 +24,7 @@ pub mod polkadot {} async fn main() -> Result<(), Box> { let api = OnlineClient::::new().await?; - let addr = AccountKeyring::Bob.to_account_id(); + let addr = AccountKeyring::Bob.to_account_id().into(); // Construct storage addresses to access: let staking_bonded = polkadot::storage().staking().bonded(&addr); diff --git a/examples/examples/custom_config.rs b/examples/examples/custom_config.rs index d0caba54b16..b3626faefa0 100644 --- a/examples/examples/custom_config.rs +++ b/examples/examples/custom_config.rs @@ -8,13 +8,11 @@ use sp_keyring::AccountKeyring; use subxt::{ config::{ + substrate::SubstrateExtrinsicParams, Config, SubstrateConfig, }, - tx::{ - PairSigner, - SubstrateExtrinsicParams, - }, + tx::PairSigner, OnlineClient, }; @@ -34,10 +32,10 @@ impl Config for MyConfig { type Index = u64; type BlockNumber = ::BlockNumber; type Hash = ::Hash; - type Hashing = ::Hashing; + type Hasher = ::Hasher; + type Header = ::Header; type AccountId = ::AccountId; type Address = ::Address; - type Header = ::Header; type Signature = ::Signature; // ExtrinsicParams makes use of the index type, so we need to adjust it // too to align with our modified index type, above: diff --git a/examples/examples/fetch_staking_details.rs b/examples/examples/fetch_staking_details.rs index cd7986bbf2e..cd1f5efdf67 100644 --- a/examples/examples/fetch_staking_details.rs +++ b/examples/examples/fetch_staking_details.rs @@ -10,15 +10,13 @@ //! polkadot --dev --tmp //! ``` +use sp_core::{ + sr25519, + Pair, +}; use sp_keyring::AccountKeyring; use subxt::{ - ext::{ - sp_core::{ - sr25519, - Pair, - }, - sp_runtime::AccountId32, - }, + utils::AccountId32, OnlineClient, PolkadotConfig, }; diff --git a/examples/examples/multisig.rs b/examples/examples/multisig.rs index abb82b0e8da..7daa281c0a1 100644 --- a/examples/examples/multisig.rs +++ b/examples/examples/multisig.rs @@ -54,7 +54,7 @@ async fn main() -> Result<(), Box> { // threshold 1, // other signatories - vec![signer_account_id], + vec![signer_account_id.into()], // maybe timepoint None, // call diff --git a/examples/examples/rpc_call_subscribe_blocks.rs b/examples/examples/rpc_call_subscribe_blocks.rs index 232ef46ae1e..7081adf3f10 100644 --- a/examples/examples/rpc_call_subscribe_blocks.rs +++ b/examples/examples/rpc_call_subscribe_blocks.rs @@ -11,11 +11,7 @@ //! ``` use subxt::{ - ext::sp_runtime::{ - generic::Header, - traits::BlakeTwo256, - }, - rpc::Subscription, + config::Header, OnlineClient, PolkadotConfig, }; @@ -28,8 +24,7 @@ async fn main() -> Result<(), Box> { OnlineClient::::from_url("wss://rpc.polkadot.io:443").await?; // For non-finalised blocks use `.subscribe_blocks()` - let mut blocks: Subscription> = - api.rpc().subscribe_finalized_block_headers().await?; + let mut blocks = api.rpc().subscribe_finalized_block_headers().await?; while let Some(Ok(block)) = blocks.next().await { println!( diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index 74492aa5953..7d24cf87a3c 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -16,7 +16,7 @@ description = "Command line utilities for checking metadata compatibility betwee codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full"] } frame-metadata = "15.0.0" scale-info = "2.0.0" -sp-core = "7.0.0" +sp-core-hashing = "6.0.0" [dev-dependencies] bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] } diff --git a/metadata/src/lib.rs b/metadata/src/lib.rs index 8626893d000..e9a5aeeb8bd 100644 --- a/metadata/src/lib.rs +++ b/metadata/src/lib.rs @@ -32,8 +32,8 @@ enum TypeBeingHashed { } /// Hashing function utilized internally. -fn hash(bytes: &[u8]) -> [u8; 32] { - sp_core::hashing::twox_256(bytes) +fn hash(data: &[u8]) -> [u8; 32] { + sp_core_hashing::twox_256(data) } /// XOR two hashes together. If we have two pseudorandom hashes, then this will diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index 9467578858a..03fcf8d5cf9 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -14,7 +14,14 @@ description = "Submit extrinsics (transactions) to a substrate node via RPC" keywords = ["parity", "substrate", "blockchain"] [features] -default = ["jsonrpsee-ws"] +default = ["jsonrpsee-ws", "substrate-compat"] + +# Activate this feature to pull in extra Substrate dependencies which make it +# possible to provide a proper extrinsic Signer implementation (PairSigner). +substrate-compat = [ + "sp-core", + "sp-runtime" +] # Activate this to expose functionality only used for integration testing. # The exposed functionality is subject to breaking changes at any point, @@ -32,7 +39,7 @@ scale-info = "2.0.0" scale-value = "0.6.0" scale-bits = "0.3" scale-decode = "0.4.0" -futures = { version = "0.3.13", default-features = false } +futures = { version = "0.3.13", default-features = false, features = ["std"] } hex = "0.4.3" jsonrpsee = { version = "0.16", optional = true, features = ["jsonrpsee-types"] } serde = { version = "1.0.124", features = ["derive"] } @@ -40,15 +47,24 @@ serde_json = { version = "1.0.64", features = ["raw_value"] } thiserror = "1.0.24" tracing = "0.1.34" parking_lot = "0.12.0" +frame-metadata = "15.0.0" +derivative = "2.2.0" subxt-macro = { version = "0.25.0", path = "../macro" } subxt-metadata = { version = "0.25.0", path = "../metadata" } -sp-core = { version = "7.0.0", default-features = false } -sp-runtime = "7.0.0" +# Provides some deserialization, types like U256/H256 and hashing impls like twox/blake256: +impl-serde = { version = "0.4.0" } +primitive-types = { version = "0.12.0", default-features = false, features = ["codec", "scale-info", "serde"] } +sp-core-hashing = "6.0.0" -frame-metadata = "15.0.0" -derivative = "2.2.0" +# For ss58 encoding AccountId32 to serialize them properly: +base58 = { version = "0.2.0" } +blake2 = { version = "0.10.4", default-features = false } + +# These are only included is "substrate-compat" is enabled. +sp-core = { version = "11.0.0", default-features = false, optional = true } +sp-runtime = { version = "12.0.0", optional = true } [target.wasm32-unknown-unknown.dependencies] getrandom = { version = "0.2", features = ["js"] } @@ -58,3 +74,7 @@ bitvec = "1" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] } scale-info = { version = "2.0.0", features = ["bit-vec"] } tokio = { version = "1.8", features = ["macros", "time", "rt-multi-thread"] } +sp-core = { version = "11.0.0", default-features = false } +sp-runtime = { version = "12.0.0" } +sp-keyring = "12.0.0" +sp-version = "10.0.0" diff --git a/subxt/src/blocks/block_types.rs b/subxt/src/blocks/block_types.rs index 3522991521e..9adba3b8ea6 100644 --- a/subxt/src/blocks/block_types.rs +++ b/subxt/src/blocks/block_types.rs @@ -7,20 +7,20 @@ use crate::{ OfflineClientT, OnlineClientT, }, + config::{ + Config, + Hasher, + Header, + }, error::{ BlockError, Error, }, events, - rpc::ChainBlockResponse, - Config, + rpc::types::ChainBlockResponse, }; use derivative::Derivative; use futures::lock::Mutex as AsyncMutex; -use sp_runtime::traits::{ - Hash, - Header, -}; use std::sync::Arc; /// A representation of a block. @@ -56,7 +56,7 @@ where /// Return the block number. pub fn number(&self) -> T::BlockNumber { - *self.header().number() + self.header().number() } /// Return the entire block header. @@ -170,7 +170,7 @@ where pub async fn events(&self) -> Result, Error> { let events = get_events(&self.client, self.block_hash, &self.cached_events).await?; - let ext_hash = T::Hashing::hash_of(&self.bytes); + let ext_hash = T::Hasher::hash_of(&self.bytes); Ok(ExtrinsicEvents::new(ext_hash, self.index, events)) } } diff --git a/subxt/src/blocks/blocks_client.rs b/subxt/src/blocks/blocks_client.rs index 9fa82b66ccc..cd48db53608 100644 --- a/subxt/src/blocks/blocks_client.rs +++ b/subxt/src/blocks/blocks_client.rs @@ -5,12 +5,15 @@ use super::Block; use crate::{ client::OnlineClientT, + config::{ + Config, + Header, + }, error::{ BlockError, Error, }, utils::PhantomDataSendSync, - Config, }; use derivative::Derivative; use futures::{ @@ -19,7 +22,6 @@ use futures::{ Stream, StreamExt, }; -use sp_runtime::traits::Header; use std::{ future::Future, pin::Pin, @@ -137,7 +139,7 @@ where .rpc() .header(Some(last_finalized_block_hash)) .await? - .map(|h| (*h.number()).into()); + .map(|h| h.number().into()); let sub = client.rpc().subscribe_finalized_block_headers().await?; @@ -203,7 +205,7 @@ where }; // We want all previous details up to, but not including this current block num. - let end_block_num = (*header.number()).into(); + let end_block_num = header.number().into(); // This is one after the last block we returned details for last time. let start_block_num = last_block_num.map(|n| n + 1).unwrap_or(end_block_num); diff --git a/subxt/src/client/offline_client.rs b/subxt/src/client/offline_client.rs index 0abb78f3acc..4055787f98f 100644 --- a/subxt/src/client/offline_client.rs +++ b/subxt/src/client/offline_client.rs @@ -6,7 +6,7 @@ use crate::{ blocks::BlocksClient, constants::ConstantsClient, events::EventsClient, - rpc::RuntimeVersion, + rpc::types::RuntimeVersion, storage::StorageClient, tx::TxClient, Config, diff --git a/subxt/src/client/online_client.rs b/subxt/src/client/online_client.rs index 668ddf65b17..0fea1591a4c 100644 --- a/subxt/src/client/online_client.rs +++ b/subxt/src/client/online_client.rs @@ -12,10 +12,12 @@ use crate::{ error::Error, events::EventsClient, rpc::{ + types::{ + RuntimeVersion, + Subscription, + }, Rpc, RpcClientT, - RuntimeVersion, - Subscription, }, storage::StorageClient, tx::TxClient, diff --git a/subxt/src/tx/params.rs b/subxt/src/config/extrinsic_params.rs similarity index 59% rename from subxt/src/tx/params.rs rename to subxt/src/config/extrinsic_params.rs index b2bf9cc6297..e9fae6e022a 100644 --- a/subxt/src/tx/params.rs +++ b/subxt/src/config/extrinsic_params.rs @@ -2,19 +2,26 @@ // This file is dual-licensed as Apache-2.0 or GPL-3.0. // see LICENSE for license details. +//! This module contains a trait which controls the parameters that must +//! be provided in order to successfully construct an extrinsic. A basic +//! implementation of the trait is provided ([`BaseExtrinsicParams`]) which is +//! used by the provided Substrate and Polkadot configuration. + use crate::{ utils::Encoded, Config, }; use codec::{ Compact, + Decode, Encode, }; use core::fmt::Debug; use derivative::Derivative; - -// We require Era as a param below, so make it available from here. -pub use sp_runtime::generic::Era; +use serde::{ + Deserialize, + Serialize, +}; /// This trait allows you to configure the "signed extra" and /// "additional" parameters that are signed and used in transactions. @@ -48,22 +55,6 @@ pub trait ExtrinsicParams: Debug + 'static { fn encode_additional_to(&self, v: &mut Vec); } -/// A struct representing the signed extra and additional parameters required -/// to construct a transaction for the default substrate node. -pub type SubstrateExtrinsicParams = BaseExtrinsicParams; - -/// A builder which leads to [`SubstrateExtrinsicParams`] being constructed. -/// This is what you provide to methods like `sign_and_submit()`. -pub type SubstrateExtrinsicParamsBuilder = BaseExtrinsicParamsBuilder; - -/// A struct representing the signed extra and additional parameters required -/// to construct a transaction for a polkadot node. -pub type PolkadotExtrinsicParams = BaseExtrinsicParams; - -/// A builder which leads to [`PolkadotExtrinsicParams`] being constructed. -/// This is what you provide to methods like `sign_and_submit()`. -pub type PolkadotExtrinsicParamsBuilder = BaseExtrinsicParamsBuilder; - /// An implementation of [`ExtrinsicParams`] that is suitable for constructing /// extrinsics that can be sent to a node with the same signed extra and additional /// parameters as a Polkadot/Substrate node. The way that tip payments are specified @@ -90,8 +81,9 @@ pub struct BaseExtrinsicParams { /// construct a [`BaseExtrinsicParams`] value. This implements [`Default`], which allows /// [`BaseExtrinsicParams`] to be used with convenience methods like `sign_and_submit_default()`. /// -/// Prefer to use [`SubstrateExtrinsicParamsBuilder`] for a version of this tailored towards -/// Substrate, or [`PolkadotExtrinsicParamsBuilder`] for a version tailored to Polkadot. +/// Prefer to use [`super::substrate::SubstrateExtrinsicParamsBuilder`] for a version of this +/// tailored towards Substrate, or [`super::polkadot::PolkadotExtrinsicParamsBuilder`] for a +/// version tailored to Polkadot. #[derive(Derivative)] #[derivative( Debug(bound = "Tip: Debug"), @@ -185,53 +177,94 @@ impl ExtrinsicParams Self { - PlainTip { tip: amount } - } + /// Period and phase are encoded: + /// - The period of validity from the block hash found in the signing material. + /// - The phase in the period that this transaction's lifetime begins (and, importantly, + /// implies which block hash is included in the signature material). If the `period` is + /// greater than 1 << 12, then it will be a factor of the times greater than 1<<12 that + /// `period` is. + /// + /// When used on `FRAME`-based runtimes, `period` cannot exceed `BlockHashCount` parameter + /// of `system` module. + Mortal(Period, Phase), } -impl From for PlainTip { - fn from(n: u128) -> Self { - PlainTip::new(n) - } -} +/// Era period +pub type Period = u64; -/// A tip payment made in the form of a specific asset. -#[derive(Copy, Clone, Debug, Default, Encode)] -pub struct AssetTip { - #[codec(compact)] - tip: u128, - asset: Option, -} +/// Era phase +pub type Phase = u64; -impl AssetTip { - /// Create a new tip of the amount provided. - pub fn new(amount: u128) -> Self { - AssetTip { - tip: amount, - asset: None, - } +// E.g. with period == 4: +// 0 10 20 30 40 +// 0123456789012345678901234567890123456789012 +// |...| +// authored -/ \- expiry +// phase = 1 +// n = Q(current - phase, period) + phase +impl Era { + /// Create a new era based on a period (which should be a power of two between 4 and 65536 + /// inclusive) and a block number on which it should start (or, for long periods, be shortly + /// after the start). + /// + /// If using `Era` in the context of `FRAME` runtime, make sure that `period` + /// does not exceed `BlockHashCount` parameter passed to `system` module, since that + /// prunes old blocks and renders transactions immediately invalid. + pub fn mortal(period: u64, current: u64) -> Self { + let period = period + .checked_next_power_of_two() + .unwrap_or(1 << 16) + .clamp(4, 1 << 16); + let phase = current % period; + let quantize_factor = (period >> 12).max(1); + let quantized_phase = phase / quantize_factor * quantize_factor; + + Self::Mortal(period, quantized_phase) } - /// Designate the tip as being of a particular asset class. - /// If this is not set, then the native currency is used. - pub fn of_asset(mut self, asset: u32) -> Self { - self.asset = Some(asset); - self + /// Create an "immortal" transaction. + pub fn immortal() -> Self { + Self::Immortal } } -impl From for AssetTip { - fn from(n: u128) -> Self { - AssetTip::new(n) +// Both copied from `sp_runtime::generic::Era`; this is the wire interface and so +// it's really the most important bit here. +impl Encode for Era { + fn encode_to(&self, output: &mut T) { + match self { + Self::Immortal => output.push_byte(0), + Self::Mortal(period, phase) => { + let quantize_factor = (*period >> 12).max(1); + let encoded = (period.trailing_zeros() - 1).clamp(1, 15) as u16 + | ((phase / quantize_factor) << 4) as u16; + encoded.encode_to(output); + } + } + } +} +impl Decode for Era { + fn decode(input: &mut I) -> Result { + let first = input.read_byte()?; + if first == 0 { + Ok(Self::Immortal) + } else { + let encoded = first as u64 + ((input.read_byte()? as u64) << 8); + let period = 2 << (encoded % (1 << 4)); + let quantize_factor = (period >> 12).max(1); + let phase = (encoded >> 4) * quantize_factor; + if period >= 4 && phase < period { + Ok(Self::Mortal(period, phase)) + } else { + Err("Invalid period and phase".into()) + } + } } } diff --git a/subxt/src/config.rs b/subxt/src/config/mod.rs similarity index 53% rename from subxt/src/config.rs rename to subxt/src/config/mod.rs index ddd04d763cc..b7a2fbada63 100644 --- a/subxt/src/config.rs +++ b/subxt/src/config/mod.rs @@ -8,20 +8,21 @@ //! default Substrate node implementation, and [`PolkadotConfig`] for a //! Polkadot node. +pub mod extrinsic_params; +pub mod polkadot; +pub mod substrate; + use codec::{ Codec, Encode, EncodeLike, }; use core::fmt::Debug; -use sp_runtime::traits::{ - AtLeast32Bit, - Hash, - Header, - MaybeSerializeDeserialize, - Member, - Verify, -}; +use serde::Serialize; + +pub use extrinsic_params::ExtrinsicParams; +pub use polkadot::PolkadotConfig; +pub use substrate::SubstrateConfig; /// Runtime types. // Note: the 'static bound isn't strictly required, but currently deriving TypeInfo @@ -34,7 +35,6 @@ pub trait Config: 'static { + Member + serde::de::DeserializeOwned + Default - + AtLeast32Bit + Copy + scale_info::TypeInfo + Into; @@ -44,14 +44,15 @@ pub trait Config: 'static { + Member + Default + Copy - + core::hash::Hash - + core::str::FromStr + + std::hash::Hash + + std::str::FromStr + Into; /// The output of the `Hashing` function. type Hash: Parameter + Member - + MaybeSerializeDeserialize + + serde::Serialize + + serde::de::DeserializeOwned + Ord + Default + Copy @@ -60,85 +61,97 @@ pub trait Config: 'static { + AsMut<[u8]> + scale_info::TypeInfo; - /// The hashing system (algorithm) being used in the runtime (e.g. Blake2). - type Hashing: Hash; + /// The account ID type. + type AccountId: Clone + Serialize; + + /// The address type. + type Address: Encode + From; - /// The user account identifier type for the runtime. - type AccountId: Parameter + Member + serde::Serialize; + /// The signature type. + type Signature: Encode; - /// The address type. This instead of `::Source`. - type Address: Codec + Clone + PartialEq; + /// The hashing system (algorithm) being used in the runtime (e.g. Blake2). + type Hasher: Hasher; /// The block header. type Header: Parameter - + Header + + Header + + Member + serde::de::DeserializeOwned; - /// Signature type. - type Signature: Verify + Encode + Send + Sync + 'static; - /// This type defines the extrinsic extra and additional parameters. - type ExtrinsicParams: crate::tx::ExtrinsicParams; + type ExtrinsicParams: extrinsic_params::ExtrinsicParams; } -/// Parameter trait copied from `substrate::frame_support` +/// Parameter trait copied from `substrate::frame_support`. pub trait Parameter: Codec + EncodeLike + Clone + Eq + Debug {} impl Parameter for T where T: Codec + EncodeLike + Clone + Eq + Debug {} -/// Default set of commonly used types by Substrate runtimes. -// Note: We only use this at the type level, so it should be impossible to -// create an instance of it. -pub enum SubstrateConfig {} - -impl Config for SubstrateConfig { - type Index = u32; - type BlockNumber = u32; - type Hash = sp_core::H256; - type Hashing = sp_runtime::traits::BlakeTwo256; - type AccountId = sp_runtime::AccountId32; - type Address = sp_runtime::MultiAddress; - type Header = - sp_runtime::generic::Header; - type Signature = sp_runtime::MultiSignature; - type ExtrinsicParams = crate::tx::SubstrateExtrinsicParams; +/// A type that can be used in runtime structures. Copied from `sp_runtime::traits`. +pub trait Member: Send + Sync + Sized + Debug + Eq + PartialEq + Clone + 'static {} +impl Member for T {} + +/// This represents the hasher used by a node to hash things like block headers +/// and extrinsics. +pub trait Hasher { + /// The type given back from the hash operation + type Output; + + /// Hash some bytes to the given output type. + fn hash(s: &[u8]) -> Self::Output; + + /// Hash some SCALE encodable type to the given output type. + fn hash_of(s: &S) -> Self::Output { + let out = s.encode(); + Self::hash(&out) + } } -/// Default set of commonly used types by Polkadot nodes. -pub type PolkadotConfig = WithExtrinsicParams< - SubstrateConfig, - crate::tx::PolkadotExtrinsicParams, ->; +/// This represents the block header type used by a node. +pub trait Header: Sized + Encode { + /// The block number type for this header. + type Number; + /// The hasher used to hash this header. + type Hasher: Hasher; + + /// Return the block number of this header. + fn number(&self) -> Self::Number; + + /// Hash this header. + fn hash(&self) -> ::Output { + Self::Hasher::hash_of(self) + } +} /// Take a type implementing [`Config`] (eg [`SubstrateConfig`]), and some type which describes the -/// additional and extra parameters to pass to an extrinsic (see [`crate::tx::ExtrinsicParams`]), -/// and returns a type implementing [`Config`] with those new `ExtrinsicParams`. +/// additional and extra parameters to pass to an extrinsic (see [`ExtrinsicParams`]), +/// and returns a type implementing [`Config`] with those new [`ExtrinsicParams`]. /// /// # Example /// /// ``` -/// use subxt::config::{ SubstrateConfig, WithExtrinsicParams }; -/// use subxt::tx::PolkadotExtrinsicParams; +/// use subxt::config::{ SubstrateConfig, WithExtrinsicParams, polkadot::PolkadotExtrinsicParams }; /// /// // This is how PolkadotConfig is implemented: /// type PolkadotConfig = WithExtrinsicParams>; /// ``` pub struct WithExtrinsicParams< T: Config, - E: crate::tx::ExtrinsicParams, + E: extrinsic_params::ExtrinsicParams, > { _marker: std::marker::PhantomData<(T, E)>, } -impl> Config +impl> Config for WithExtrinsicParams { type Index = T::Index; type BlockNumber = T::BlockNumber; type Hash = T::Hash; - type Hashing = T::Hashing; type AccountId = T::AccountId; type Address = T::Address; - type Header = T::Header; type Signature = T::Signature; + type Hasher = T::Hasher; + type Header = T::Header; type ExtrinsicParams = E; } diff --git a/subxt/src/config/polkadot.rs b/subxt/src/config/polkadot.rs new file mode 100644 index 00000000000..b9a5e2263ad --- /dev/null +++ b/subxt/src/config/polkadot.rs @@ -0,0 +1,49 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +//! Polkadot specific configuration + +use codec::Encode; + +use super::extrinsic_params::{ + BaseExtrinsicParams, + BaseExtrinsicParamsBuilder, +}; + +/// Default set of commonly used types by Polkadot nodes. +pub type PolkadotConfig = super::WithExtrinsicParams< + super::SubstrateConfig, + PolkadotExtrinsicParams, +>; + +/// A struct representing the signed extra and additional parameters required +/// to construct a transaction for a polkadot node. +pub type PolkadotExtrinsicParams = BaseExtrinsicParams; + +/// A builder which leads to [`PolkadotExtrinsicParams`] being constructed. +/// This is what you provide to methods like `sign_and_submit()`. +pub type PolkadotExtrinsicParamsBuilder = BaseExtrinsicParamsBuilder; + +// Because Era is one of the args to our extrinsic params. +pub use super::extrinsic_params::Era; + +/// A tip payment. +#[derive(Copy, Clone, Debug, Default, Encode)] +pub struct PlainTip { + #[codec(compact)] + tip: u128, +} + +impl PlainTip { + /// Create a new tip of the amount provided. + pub fn new(amount: u128) -> Self { + PlainTip { tip: amount } + } +} + +impl From for PlainTip { + fn from(n: u128) -> Self { + PlainTip::new(n) + } +} diff --git a/subxt/src/config/substrate.rs b/subxt/src/config/substrate.rs new file mode 100644 index 00000000000..e9c559addd0 --- /dev/null +++ b/subxt/src/config/substrate.rs @@ -0,0 +1,294 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +//! Substrate specific configuration + +use super::{ + extrinsic_params::{ + BaseExtrinsicParams, + BaseExtrinsicParamsBuilder, + }, + Config, + Hasher, + Header, +}; +use codec::{ + Decode, + Encode, +}; +use serde::{ + Deserialize, + Serialize, +}; + +pub use crate::utils::{ + account_id::AccountId32, + multi_address::MultiAddress, + multi_signature::MultiSignature, +}; +pub use primitive_types::{ + H256, + U256, +}; + +/// Default set of commonly used types by Substrate runtimes. +// Note: We only use this at the type level, so it should be impossible to +// create an instance of it. +pub enum SubstrateConfig {} + +impl Config for SubstrateConfig { + type Index = u32; + type BlockNumber = u32; + type Hash = H256; + type AccountId = AccountId32; + type Address = MultiAddress; + type Signature = MultiSignature; + type Hasher = BlakeTwo256; + type Header = SubstrateHeader; + type ExtrinsicParams = SubstrateExtrinsicParams; +} + +/// A struct representing the signed extra and additional parameters required +/// to construct a transaction for the default substrate node. +pub type SubstrateExtrinsicParams = BaseExtrinsicParams; + +/// A builder which leads to [`SubstrateExtrinsicParams`] being constructed. +/// This is what you provide to methods like `sign_and_submit()`. +pub type SubstrateExtrinsicParamsBuilder = BaseExtrinsicParamsBuilder; + +// Because Era is one of the args to our extrinsic params. +pub use super::extrinsic_params::Era; + +/// A tip payment made in the form of a specific asset. +#[derive(Copy, Clone, Debug, Default, Encode)] +pub struct AssetTip { + #[codec(compact)] + tip: u128, + asset: Option, +} + +impl AssetTip { + /// Create a new tip of the amount provided. + pub fn new(amount: u128) -> Self { + AssetTip { + tip: amount, + asset: None, + } + } + + /// Designate the tip as being of a particular asset class. + /// If this is not set, then the native currency is used. + pub fn of_asset(mut self, asset: u32) -> Self { + self.asset = Some(asset); + self + } +} + +impl From for AssetTip { + fn from(n: u128) -> Self { + AssetTip::new(n) + } +} + +/// A type that can hash values using the blaks2_256 algorithm. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode)] +pub struct BlakeTwo256; + +impl Hasher for BlakeTwo256 { + type Output = H256; + fn hash(s: &[u8]) -> Self::Output { + sp_core_hashing::blake2_256(s).into() + } +} + +/// A generic Substrate header type, adapted from `sp_runtime::generic::Header`. +/// The block number and hasher can be configured to adapt this for other nodes. +#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SubstrateHeader + TryFrom, H: Hasher> { + /// The parent hash. + pub parent_hash: H::Output, + /// The block number. + #[serde( + serialize_with = "serialize_number", + deserialize_with = "deserialize_number" + )] + #[codec(compact)] + pub number: N, + /// The state trie merkle root + pub state_root: H::Output, + /// The merkle root of the extrinsics. + pub extrinsics_root: H::Output, + /// A chain-specific digest of data useful for light clients or referencing auxiliary data. + pub digest: Digest, +} + +impl + TryFrom + Encode, H: Hasher + Encode> Header + for SubstrateHeader +where + N: Copy + Into + TryFrom + Encode, + H: Hasher + Encode, + SubstrateHeader: Encode, +{ + type Number = N; + type Hasher = H; + fn number(&self) -> Self::Number { + self.number + } +} + +/// Generic header digest. From `sp_runtime::generic::digest`. +#[derive( + Encode, Decode, Debug, PartialEq, Eq, Clone, Serialize, Deserialize, Default, +)] +pub struct Digest { + /// A list of digest items. + pub logs: Vec, +} + +/// Digest item that is able to encode/decode 'system' digest items and +/// provide opaque access to other items. From `sp_runtime::generic::digest`. +#[derive(Debug, PartialEq, Eq, Clone)] +pub enum DigestItem { + /// A pre-runtime digest. + /// + /// These are messages from the consensus engine to the runtime, although + /// the consensus engine can (and should) read them itself to avoid + /// code and state duplication. It is erroneous for a runtime to produce + /// these, but this is not (yet) checked. + /// + /// NOTE: the runtime is not allowed to panic or fail in an `on_initialize` + /// call if an expected `PreRuntime` digest is not present. It is the + /// responsibility of a external block verifier to check this. Runtime API calls + /// will initialize the block without pre-runtime digests, so initialization + /// cannot fail when they are missing. + PreRuntime(ConsensusEngineId, Vec), + + /// A message from the runtime to the consensus engine. This should *never* + /// be generated by the native code of any consensus engine, but this is not + /// checked (yet). + Consensus(ConsensusEngineId, Vec), + + /// Put a Seal on it. This is only used by native code, and is never seen + /// by runtimes. + Seal(ConsensusEngineId, Vec), + + /// Some other thing. Unsupported and experimental. + Other(Vec), + + /// An indication for the light clients that the runtime execution + /// environment is updated. + /// + /// Currently this is triggered when: + /// 1. Runtime code blob is changed or + /// 2. `heap_pages` value is changed. + RuntimeEnvironmentUpdated, +} + +// From sp_runtime::generic, DigestItem enum indexes are encoded using this: +#[repr(u32)] +#[derive(Encode, Decode)] +enum DigestItemType { + Other = 0u32, + Consensus = 4u32, + Seal = 5u32, + PreRuntime = 6u32, + RuntimeEnvironmentUpdated = 8u32, +} +impl Encode for DigestItem { + fn encode(&self) -> Vec { + let mut v = Vec::new(); + + match self { + Self::Consensus(val, data) => { + DigestItemType::Consensus.encode_to(&mut v); + (val, data).encode_to(&mut v); + } + Self::Seal(val, sig) => { + DigestItemType::Seal.encode_to(&mut v); + (val, sig).encode_to(&mut v); + } + Self::PreRuntime(val, data) => { + DigestItemType::PreRuntime.encode_to(&mut v); + (val, data).encode_to(&mut v); + } + Self::Other(val) => { + DigestItemType::Other.encode_to(&mut v); + val.encode_to(&mut v); + } + Self::RuntimeEnvironmentUpdated => { + DigestItemType::RuntimeEnvironmentUpdated.encode_to(&mut v); + } + } + + v + } +} +impl Decode for DigestItem { + fn decode(input: &mut I) -> Result { + let item_type: DigestItemType = Decode::decode(input)?; + match item_type { + DigestItemType::PreRuntime => { + let vals: (ConsensusEngineId, Vec) = Decode::decode(input)?; + Ok(Self::PreRuntime(vals.0, vals.1)) + } + DigestItemType::Consensus => { + let vals: (ConsensusEngineId, Vec) = Decode::decode(input)?; + Ok(Self::Consensus(vals.0, vals.1)) + } + DigestItemType::Seal => { + let vals: (ConsensusEngineId, Vec) = Decode::decode(input)?; + Ok(Self::Seal(vals.0, vals.1)) + } + DigestItemType::Other => Ok(Self::Other(Decode::decode(input)?)), + DigestItemType::RuntimeEnvironmentUpdated => { + Ok(Self::RuntimeEnvironmentUpdated) + } + } + } +} + +/// Consensus engine unique ID. From `sp_runtime::ConsensusEngineId`. +pub type ConsensusEngineId = [u8; 4]; + +impl serde::Serialize for DigestItem { + fn serialize(&self, seq: S) -> Result + where + S: serde::Serializer, + { + self.using_encoded(|bytes| impl_serde::serialize::serialize(bytes, seq)) + } +} + +impl<'a> serde::Deserialize<'a> for DigestItem { + fn deserialize(de: D) -> Result + where + D: serde::Deserializer<'a>, + { + let r = impl_serde::serialize::deserialize(de)?; + Decode::decode(&mut &r[..]) + .map_err(|e| serde::de::Error::custom(format!("Decode error: {}", e))) + } +} + +fn serialize_number + TryFrom>( + val: &T, + s: S, +) -> Result +where + S: serde::Serializer, +{ + let u256: U256 = (*val).into(); + serde::Serialize::serialize(&u256, s) +} + +fn deserialize_number<'a, D, T: Copy + Into + TryFrom>( + d: D, +) -> Result +where + D: serde::Deserializer<'a>, +{ + let u256: U256 = serde::Deserialize::deserialize(d)?; + TryFrom::try_from(u256).map_err(|_| serde::de::Error::custom("Try from failed")) +} diff --git a/subxt/src/error.rs b/subxt/src/error.rs index b2548e43cff..90c1683a15d 100644 --- a/subxt/src/error.rs +++ b/subxt/src/error.rs @@ -19,8 +19,6 @@ pub use scale_value::scale::{ DecodeError, EncodeError, }; -pub use sp_core::crypto::SecretStringError; -pub use sp_runtime::transaction_validity::TransactionValidityError; /// The underlying error enum, generic over the type held by the `Runtime` /// variant. Prefer to use the [`Error`] and [`Error`] aliases over @@ -39,12 +37,6 @@ pub enum Error { /// Serde serialization error #[error("Serde json error: {0}")] Serialization(#[from] serde_json::error::Error), - /// Secret string error. - #[error("Secret String Error")] - SecretString(SecretStringError), - /// Extrinsic validity error - #[error("Transaction Validity Error: {0:?}")] - Invalid(TransactionValidityError), /// Invalid metadata error #[error("Invalid Metadata: {0}")] InvalidMetadata(#[from] InvalidMetadataError), @@ -74,18 +66,6 @@ pub enum Error { Other(String), } -impl From for Error { - fn from(error: SecretStringError) -> Self { - Error::SecretString(error) - } -} - -impl From for Error { - fn from(error: TransactionValidityError) -> Self { - Error::Invalid(error) - } -} - impl From<&str> for Error { fn from(error: &str) -> Self { Error::Other(error.into()) diff --git a/subxt/src/events/events_client.rs b/subxt/src/events/events_client.rs index eb0e3368702..c5ea1bab3be 100644 --- a/subxt/src/events/events_client.rs +++ b/subxt/src/events/events_client.rs @@ -6,13 +6,10 @@ use crate::{ client::OnlineClientT, error::Error, events::Events, + rpc::types::StorageKey, Config, }; use derivative::Derivative; -use sp_core::{ - storage::StorageKey, - twox_128, -}; use std::future::Future; /// A client for working with events. @@ -74,8 +71,8 @@ where // The storage key needed to access events. fn system_events_key() -> StorageKey { - let mut storage_key = twox_128(b"System").to_vec(); - storage_key.extend(twox_128(b"Events").to_vec()); + let mut storage_key = sp_core_hashing::twox_128(b"System").to_vec(); + storage_key.extend(sp_core_hashing::twox_128(b"Events").to_vec()); StorageKey(storage_key) } diff --git a/subxt/src/lib.rs b/subxt/src/lib.rs index f1c41156b69..b9b46fb85c4 100644 --- a/subxt/src/lib.rs +++ b/subxt/src/lib.rs @@ -181,6 +181,4 @@ pub mod ext { pub use frame_metadata; pub use scale_bits; pub use scale_value; - pub use sp_core; - pub use sp_runtime; } diff --git a/subxt/src/rpc/mod.rs b/subxt/src/rpc/mod.rs index db26f67702d..8be955b6c53 100644 --- a/subxt/src/rpc/mod.rs +++ b/subxt/src/rpc/mod.rs @@ -59,7 +59,10 @@ mod rpc; mod rpc_client; mod rpc_client_t; -// Expose the `Rpc` struct and any associated types. +// Expose our RPC types here. +pub mod types; + +// Expose the `Rpc` struct. pub use rpc::*; pub use rpc_client_t::{ diff --git a/subxt/src/rpc/rpc.rs b/subxt/src/rpc/rpc.rs index c12ce885e6c..b8d1c1b4860 100644 --- a/subxt/src/rpc/rpc.rs +++ b/subxt/src/rpc/rpc.rs @@ -41,6 +41,7 @@ use super::{ rpc_params, + types, RpcClient, RpcClientT, Subscription, @@ -56,293 +57,8 @@ use codec::{ Encode, }; use frame_metadata::RuntimeMetadataPrefixed; -use serde::{ - Deserialize, - Serialize, -}; -use sp_core::{ - storage::{ - StorageChangeSet, - StorageData, - StorageKey, - }, - Bytes, - U256, -}; -use sp_runtime::ApplyExtrinsicResult; -use std::{ - collections::HashMap, - sync::Arc, -}; - -/// A number type that can be serialized both as a number or a string that encodes a number in a -/// string. -/// -/// We allow two representations of the block number as input. Either we deserialize to the type -/// that is specified in the block type or we attempt to parse given hex value. -/// -/// The primary motivation for having this type is to avoid overflows when using big integers in -/// JavaScript (which we consider as an important RPC API consumer). -#[derive(Copy, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(untagged)] -pub enum NumberOrHex { - /// The number represented directly. - Number(u64), - /// Hex representation of the number. - Hex(U256), -} - -/// The response from `chain_getBlock` -#[derive(Debug, Deserialize)] -#[serde(bound = "T: Config")] -pub struct ChainBlockResponse { - /// The block itself. - pub block: ChainBlock, - /// Block justification. - pub justifications: Option, -} - -/// Block details in the [`ChainBlockResponse`]. -#[derive(Debug, Deserialize)] -pub struct ChainBlock { - /// The block header. - pub header: T::Header, - /// The accompanying extrinsics. - pub extrinsics: Vec, -} - -/// Bytes representing an extrinsic in a [`ChainBlock`]. -#[derive(Debug)] -pub struct ChainBlockExtrinsic(pub Vec); - -impl<'a> ::serde::Deserialize<'a> for ChainBlockExtrinsic { - fn deserialize(de: D) -> Result - where - D: ::serde::Deserializer<'a>, - { - let r = sp_core::bytes::deserialize(de)?; - let bytes = Decode::decode(&mut &r[..]) - .map_err(|e| ::serde::de::Error::custom(format!("Decode error: {}", e)))?; - Ok(ChainBlockExtrinsic(bytes)) - } -} - -/// Wrapper for NumberOrHex to allow custom From impls -#[derive(Serialize)] -pub struct BlockNumber(NumberOrHex); - -impl From for BlockNumber { - fn from(x: NumberOrHex) -> Self { - BlockNumber(x) - } -} - -impl Default for NumberOrHex { - fn default() -> Self { - Self::Number(Default::default()) - } -} - -impl NumberOrHex { - /// Converts this number into an U256. - pub fn into_u256(self) -> U256 { - match self { - NumberOrHex::Number(n) => n.into(), - NumberOrHex::Hex(h) => h, - } - } -} - -impl From for NumberOrHex { - fn from(n: u32) -> Self { - NumberOrHex::Number(n.into()) - } -} - -impl From for NumberOrHex { - fn from(n: u64) -> Self { - NumberOrHex::Number(n) - } -} - -impl From for NumberOrHex { - fn from(n: u128) -> Self { - NumberOrHex::Hex(n.into()) - } -} - -impl From for NumberOrHex { - fn from(n: U256) -> Self { - NumberOrHex::Hex(n) - } -} - -/// An error type that signals an out-of-range conversion attempt. -#[derive(Debug, thiserror::Error)] -#[error("Out-of-range conversion attempt")] -pub struct TryFromIntError; - -impl TryFrom for u32 { - type Error = TryFromIntError; - fn try_from(num_or_hex: NumberOrHex) -> Result { - num_or_hex - .into_u256() - .try_into() - .map_err(|_| TryFromIntError) - } -} - -impl TryFrom for u64 { - type Error = TryFromIntError; - fn try_from(num_or_hex: NumberOrHex) -> Result { - num_or_hex - .into_u256() - .try_into() - .map_err(|_| TryFromIntError) - } -} - -impl TryFrom for u128 { - type Error = TryFromIntError; - fn try_from(num_or_hex: NumberOrHex) -> Result { - num_or_hex - .into_u256() - .try_into() - .map_err(|_| TryFromIntError) - } -} - -impl From for U256 { - fn from(num_or_hex: NumberOrHex) -> U256 { - num_or_hex.into_u256() - } -} - -// All unsigned ints can be converted into a BlockNumber: -macro_rules! into_block_number { - ($($t: ty)+) => { - $( - impl From<$t> for BlockNumber { - fn from(x: $t) -> Self { - NumberOrHex::Number(x.into()).into() - } - } - )+ - } -} -into_block_number!(u8 u16 u32 u64); - -/// Arbitrary properties defined in the chain spec as a JSON object. -pub type SystemProperties = serde_json::Map; - -/// Possible transaction status events. -/// -/// # Note -/// -/// This is copied from `sp-transaction-pool` to avoid a dependency on that crate. Therefore it -/// must be kept compatible with that type from the target substrate version. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub enum SubstrateTxStatus { - /// Transaction is part of the future queue. - Future, - /// Transaction is part of the ready queue. - Ready, - /// The transaction has been broadcast to the given peers. - Broadcast(Vec), - /// Transaction has been included in block with given hash. - InBlock(BlockHash), - /// The block this transaction was included in has been retracted. - Retracted(BlockHash), - /// Maximum number of finality watchers has been reached, - /// old watchers are being removed. - FinalityTimeout(BlockHash), - /// Transaction has been finalized by a finality-gadget, e.g GRANDPA - Finalized(BlockHash), - /// Transaction has been replaced in the pool, by another transaction - /// that provides the same tags. (e.g. same (sender, nonce)). - Usurped(Hash), - /// Transaction has been dropped from the pool because of the limit. - Dropped, - /// Transaction is no longer valid in the current state. - Invalid, -} - -/// This contains the runtime version information necessary to make transactions, as obtained from -/// the RPC call `state_getRuntimeVersion`, -#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct RuntimeVersion { - /// Version of the runtime specification. A full-node will not attempt to use its native - /// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, - /// `spec_version` and `authoring_version` are the same between Wasm and native. - pub spec_version: u32, - - /// All existing dispatches are fully compatible when this number doesn't change. If this - /// number changes, then `spec_version` must change, also. - /// - /// This number must change when an existing dispatchable (module ID, dispatch ID) is changed, - /// either through an alteration in its user-level semantics, a parameter - /// added/removed/changed, a dispatchable being removed, a module being removed, or a - /// dispatchable/module changing its index. - /// - /// It need *not* change when a new module is added or when a dispatchable is added. - pub transaction_version: u32, - - /// The other fields present may vary and aren't necessary for `subxt`; they are preserved in - /// this map. - #[serde(flatten)] - pub other: HashMap, -} - -/// ReadProof struct returned by the RPC -/// -/// # Note -/// -/// This is copied from `sc-rpc-api` to avoid a dependency on that crate. Therefore it -/// must be kept compatible with that type from the target substrate version. -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ReadProof { - /// Block hash used to generate the proof - pub at: Hash, - /// A proof used to prove that storage entries are included in the storage trie - pub proof: Vec, -} - -/// Statistics of a block returned by the `dev_getBlockStats` RPC. -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct BlockStats { - /// The length in bytes of the storage proof produced by executing the block. - pub witness_len: u64, - /// The length in bytes of the storage proof after compaction. - pub witness_compact_len: u64, - /// Length of the block in bytes. - /// - /// This information can also be acquired by downloading the whole block. This merely - /// saves some complexity on the client side. - pub block_len: u64, - /// Number of extrinsics in the block. - /// - /// This information can also be acquired by downloading the whole block. This merely - /// saves some complexity on the client side. - pub num_extrinsics: u64, -} - -/// Health struct returned by the RPC -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Health { - /// Number of connected peers - pub peers: usize, - /// Is the node syncing - pub is_syncing: bool, - /// Should this node have any peers - /// - /// Might be false for local chains or when running without discovery. - pub should_have_peers: bool, -} +use serde::Serialize; +use std::sync::Arc; /// Client for substrate rpc interfaces pub struct Rpc { @@ -382,7 +98,7 @@ impl Rpc { &self, key: &[u8], hash: Option, - ) -> Result, Error> { + ) -> Result, Error> { let params = rpc_params![to_hex(key), hash]; let data = self.client.request("state_getStorage", params).await?; Ok(data) @@ -397,7 +113,7 @@ impl Rpc { count: u32, start_key: Option<&[u8]>, hash: Option, - ) -> Result, Error> { + ) -> Result, Error> { let start_key = start_key.map(to_hex); let params = rpc_params![to_hex(key), count, start_key, hash]; let data = self.client.request("state_getKeysPaged", params).await?; @@ -410,7 +126,7 @@ impl Rpc { keys: impl IntoIterator, from: T::Hash, to: Option, - ) -> Result>, Error> { + ) -> Result>, Error> { let keys: Vec = keys.into_iter().map(to_hex).collect(); let params = rpc_params![keys, from, to]; self.client @@ -424,7 +140,7 @@ impl Rpc { &self, keys: impl IntoIterator, at: Option, - ) -> Result>, Error> { + ) -> Result>, Error> { let keys: Vec = keys.into_iter().map(to_hex).collect(); let params = rpc_params![keys, at]; self.client @@ -444,7 +160,7 @@ impl Rpc { /// Fetch the metadata pub async fn metadata(&self, at: Option) -> Result { - let bytes: Bytes = self + let bytes: types::Bytes = self .client .request("state_getMetadata", rpc_params![at]) .await?; @@ -454,14 +170,14 @@ impl Rpc { } /// Fetch system properties - pub async fn system_properties(&self) -> Result { + pub async fn system_properties(&self) -> Result { self.client .request("system_properties", rpc_params![]) .await } /// Fetch system health - pub async fn system_health(&self) -> Result { + pub async fn system_health(&self) -> Result { self.client.request("system_health", rpc_params![]).await } @@ -481,9 +197,9 @@ impl Rpc { } /// Fetch the current nonce for the given account ID. - pub async fn system_account_next_index( + pub async fn system_account_next_index( &self, - account: &T::AccountId, + account: &AccountId, ) -> Result { self.client .request("system_accountNextIndex", rpc_params![account]) @@ -503,7 +219,7 @@ impl Rpc { /// Get a block hash, returns hash of latest block by default pub async fn block_hash( &self, - block_number: Option, + block_number: Option, ) -> Result, Error> { let params = rpc_params![block_number]; let block_hash = self.client.request("chain_getBlockHash", params).await?; @@ -523,7 +239,7 @@ impl Rpc { pub async fn block( &self, hash: Option, - ) -> Result>, Error> { + ) -> Result>, Error> { let params = rpc_params![hash]; let block = self.client.request("chain_getBlock", params).await?; Ok(block) @@ -537,7 +253,7 @@ impl Rpc { pub async fn block_stats( &self, block_hash: T::Hash, - ) -> Result, Error> { + ) -> Result, Error> { let params = rpc_params![block_hash]; let stats = self.client.request("dev_getBlockStats", params).await?; Ok(stats) @@ -548,7 +264,7 @@ impl Rpc { &self, keys: impl IntoIterator, hash: Option, - ) -> Result, Error> { + ) -> Result, Error> { let keys: Vec = keys.into_iter().map(to_hex).collect(); let params = rpc_params![keys, hash]; let proof = self.client.request("state_getReadProof", params).await?; @@ -559,7 +275,7 @@ impl Rpc { pub async fn runtime_version( &self, at: Option, - ) -> Result { + ) -> Result { let params = rpc_params![at]; let version = self .client @@ -629,7 +345,7 @@ impl Rpc { /// Subscribe to runtime version updates that produce changes in the metadata. pub async fn subscribe_runtime_version( &self, - ) -> Result, Error> { + ) -> Result, Error> { let subscription = self .client .subscribe( @@ -646,7 +362,7 @@ impl Rpc { &self, extrinsic: X, ) -> Result { - let bytes: Bytes = extrinsic.encode().into(); + let bytes: types::Bytes = extrinsic.encode().into(); let params = rpc_params![bytes]; let xt_hash = self .client @@ -659,8 +375,8 @@ impl Rpc { pub async fn watch_extrinsic( &self, extrinsic: X, - ) -> Result>, Error> { - let bytes: Bytes = extrinsic.encode().into(); + ) -> Result>, Error> { + let bytes: types::Bytes = extrinsic.encode().into(); let params = rpc_params![bytes]; let subscription = self .client @@ -678,7 +394,7 @@ impl Rpc { &self, key_type: String, suri: String, - public: Bytes, + public: types::Bytes, ) -> Result<(), Error> { let params = rpc_params![key_type, suri, public]; self.client.request("author_insertKey", params).await?; @@ -686,7 +402,7 @@ impl Rpc { } /// Generate new session keys and returns the corresponding public keys. - pub async fn rotate_keys(&self) -> Result { + pub async fn rotate_keys(&self) -> Result { self.client .request("author_rotateKeys", rpc_params![]) .await @@ -697,7 +413,10 @@ impl Rpc { /// `session_keys` is the SCALE encoded session keys object from the runtime. /// /// Returns `true` iff all private keys could be found. - pub async fn has_session_keys(&self, session_keys: Bytes) -> Result { + pub async fn has_session_keys( + &self, + session_keys: types::Bytes, + ) -> Result { let params = rpc_params![session_keys]; self.client.request("author_hasSessionKeys", params).await } @@ -707,7 +426,7 @@ impl Rpc { /// Returns `true` if a private key could be found. pub async fn has_key( &self, - public_key: Bytes, + public_key: types::Bytes, key_type: String, ) -> Result { let params = rpc_params![public_key, key_type]; @@ -716,73 +435,19 @@ impl Rpc { /// Submits the extrinsic to the dry_run RPC, to test if it would succeed. /// - /// Returns `Ok` with an [`ApplyExtrinsicResult`], which is the result of applying of an extrinsic. + /// Returns a [`types::DryRunResult`], which is the result of performing the dry run. pub async fn dry_run( &self, encoded_signed: &[u8], at: Option, - ) -> Result { + ) -> Result { let params = rpc_params![to_hex(encoded_signed), at]; - let result_bytes: Bytes = self.client.request("system_dryRun", params).await?; - let data: ApplyExtrinsicResult = - codec::Decode::decode(&mut result_bytes.0.as_slice())?; - Ok(data) + let result_bytes: types::Bytes = + self.client.request("system_dryRun", params).await?; + Ok(types::decode_dry_run_result(&mut &*result_bytes.0)?) } } fn to_hex(bytes: impl AsRef<[u8]>) -> String { format!("0x{}", hex::encode(bytes.as_ref())) } - -#[cfg(test)] -mod test { - use super::*; - - /// A util function to assert the result of serialization and deserialization is the same. - pub(crate) fn assert_deser(s: &str, expected: T) - where - T: std::fmt::Debug - + serde::ser::Serialize - + serde::de::DeserializeOwned - + PartialEq, - { - assert_eq!(serde_json::from_str::(s).unwrap(), expected); - assert_eq!(serde_json::to_string(&expected).unwrap(), s); - } - - #[test] - fn test_deser_runtime_version() { - let val: RuntimeVersion = serde_json::from_str( - r#"{ - "specVersion": 123, - "transactionVersion": 456, - "foo": true, - "wibble": [1,2,3] - }"#, - ) - .expect("deserializing failed"); - - let mut m = std::collections::HashMap::new(); - m.insert("foo".to_owned(), serde_json::json!(true)); - m.insert("wibble".to_owned(), serde_json::json!([1, 2, 3])); - - assert_eq!( - val, - RuntimeVersion { - spec_version: 123, - transaction_version: 456, - other: m - } - ); - } - - #[test] - fn should_serialize_and_deserialize() { - assert_deser(r#""0x1234""#, NumberOrHex::Hex(0x1234.into())); - assert_deser(r#""0x0""#, NumberOrHex::Hex(0.into())); - assert_deser(r#"5"#, NumberOrHex::Number(5)); - assert_deser(r#"10000"#, NumberOrHex::Number(10000)); - assert_deser(r#"0"#, NumberOrHex::Number(0)); - assert_deser(r#"1000000000000"#, NumberOrHex::Number(1000000000000)); - } -} diff --git a/subxt/src/rpc/types.rs b/subxt/src/rpc/types.rs new file mode 100644 index 00000000000..989308d7181 --- /dev/null +++ b/subxt/src/rpc/types.rs @@ -0,0 +1,558 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +//! Types sent to/from the Substrate RPC interface. + +use crate::Config; +use codec::{ + Decode, + Encode, +}; +use primitive_types::U256; +use serde::{ + Deserialize, + Serialize, +}; +use std::collections::HashMap; + +// Subscription types are returned from some calls, so expose it with the rest of the returned types. +pub use super::rpc_client::Subscription; + +/// Signal what the result of doing a dry run of an extrinsic is. +pub type DryRunResult = Result<(), DryRunError>; + +/// An error dry running an extrinsic. +#[derive(Clone, PartialEq, Eq, Debug)] +pub enum DryRunError { + /// The extrinsic will not be included in the block + TransactionValidityError, + /// The extrinsic will be included in the block, but the call failed to dispatch. + DispatchError, +} + +/// dryRun returns an ApplyExtrinsicResult, which is basically a +/// `Result, TransactionValidityError>`. We want to convert this to +/// a [`DryRunResult`]. +/// +/// - if `Ok(inner)`, the transaction will be included in the block +/// - if `Ok(Ok(()))`, the transaction will be included and the call will be dispatched +/// successfully +/// - if `Ok(Err(e))`, the transaction will be included but there is some error dispatching +/// the call to the module. +/// +/// The errors get a bit involved and have been known to change over time. At the moment +/// then, we will keep things simple here and just decode the Result portion (ie the initial bytes) +/// and ignore the rest. +pub(crate) fn decode_dry_run_result( + input: &mut I, +) -> Result { + let res = match , ()>>::decode(input)? { + Ok(Ok(())) => Ok(()), + Ok(Err(())) => Err(DryRunError::DispatchError), + Err(()) => Err(DryRunError::TransactionValidityError), + }; + Ok(res) +} + +/// A number type that can be serialized both as a number or a string that encodes a number in a +/// string. +/// +/// We allow two representations of the block number as input. Either we deserialize to the type +/// that is specified in the block type or we attempt to parse given hex value. +/// +/// The primary motivation for having this type is to avoid overflows when using big integers in +/// JavaScript (which we consider as an important RPC API consumer). +#[derive(Copy, Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] +#[serde(untagged)] +pub enum NumberOrHex { + /// The number represented directly. + Number(u64), + /// Hex representation of the number. + Hex(U256), +} + +/// Hex-serialized shim for `Vec`. +#[derive(PartialEq, Eq, Clone, Serialize, Deserialize, Hash, PartialOrd, Ord, Debug)] +pub struct Bytes(#[serde(with = "impl_serde::serialize")] pub Vec); +impl std::ops::Deref for Bytes { + type Target = [u8]; + fn deref(&self) -> &[u8] { + &self.0[..] + } +} +impl From> for Bytes { + fn from(s: Vec) -> Self { + Bytes(s) + } +} + +/// The response from `chain_getBlock` +#[derive(Debug, Deserialize)] +#[serde(bound = "T: Config")] +pub struct ChainBlockResponse { + /// The block itself. + pub block: ChainBlock, + /// Block justification. + pub justifications: Option>, +} + +/// Block details in the [`ChainBlockResponse`]. +#[derive(Debug, Deserialize)] +pub struct ChainBlock { + /// The block header. + pub header: T::Header, + /// The accompanying extrinsics. + pub extrinsics: Vec, +} + +/// An abstraction over justification for a block's validity under a consensus algorithm. +pub type Justification = (ConsensusEngineId, EncodedJustification); +/// Consensus engine unique ID. +pub type ConsensusEngineId = [u8; 4]; +/// The encoded justification specific to a consensus engine. +pub type EncodedJustification = Vec; + +/// Bytes representing an extrinsic in a [`ChainBlock`]. +#[derive(Debug)] +pub struct ChainBlockExtrinsic(pub Vec); + +impl<'a> ::serde::Deserialize<'a> for ChainBlockExtrinsic { + fn deserialize(de: D) -> Result + where + D: ::serde::Deserializer<'a>, + { + let r = impl_serde::serialize::deserialize(de)?; + let bytes = Decode::decode(&mut &r[..]) + .map_err(|e| ::serde::de::Error::custom(format!("Decode error: {}", e)))?; + Ok(ChainBlockExtrinsic(bytes)) + } +} + +/// Wrapper for NumberOrHex to allow custom From impls +#[derive(Serialize)] +pub struct BlockNumber(NumberOrHex); + +impl From for BlockNumber { + fn from(x: NumberOrHex) -> Self { + BlockNumber(x) + } +} + +impl Default for NumberOrHex { + fn default() -> Self { + Self::Number(Default::default()) + } +} + +impl NumberOrHex { + /// Converts this number into an U256. + pub fn into_u256(self) -> U256 { + match self { + NumberOrHex::Number(n) => n.into(), + NumberOrHex::Hex(h) => h, + } + } +} + +impl From for NumberOrHex { + fn from(n: u32) -> Self { + NumberOrHex::Number(n.into()) + } +} + +impl From for NumberOrHex { + fn from(n: u64) -> Self { + NumberOrHex::Number(n) + } +} + +impl From for NumberOrHex { + fn from(n: u128) -> Self { + NumberOrHex::Hex(n.into()) + } +} + +impl From for NumberOrHex { + fn from(n: U256) -> Self { + NumberOrHex::Hex(n) + } +} + +/// An error type that signals an out-of-range conversion attempt. +#[derive(Debug, thiserror::Error)] +#[error("Out-of-range conversion attempt")] +pub struct TryFromIntError; + +impl TryFrom for u32 { + type Error = TryFromIntError; + fn try_from(num_or_hex: NumberOrHex) -> Result { + num_or_hex + .into_u256() + .try_into() + .map_err(|_| TryFromIntError) + } +} + +impl TryFrom for u64 { + type Error = TryFromIntError; + fn try_from(num_or_hex: NumberOrHex) -> Result { + num_or_hex + .into_u256() + .try_into() + .map_err(|_| TryFromIntError) + } +} + +impl TryFrom for u128 { + type Error = TryFromIntError; + fn try_from(num_or_hex: NumberOrHex) -> Result { + num_or_hex + .into_u256() + .try_into() + .map_err(|_| TryFromIntError) + } +} + +impl From for U256 { + fn from(num_or_hex: NumberOrHex) -> U256 { + num_or_hex.into_u256() + } +} + +// All unsigned ints can be converted into a BlockNumber: +macro_rules! into_block_number { + ($($t: ty)+) => { + $( + impl From<$t> for BlockNumber { + fn from(x: $t) -> Self { + NumberOrHex::Number(x.into()).into() + } + } + )+ + } +} +into_block_number!(u8 u16 u32 u64); + +/// Arbitrary properties defined in the chain spec as a JSON object. +pub type SystemProperties = serde_json::Map; + +/// Possible transaction status events. +/// +/// # Note +/// +/// This is copied from `sp-transaction-pool` to avoid a dependency on that crate. Therefore it +/// must be kept compatible with that type from the target substrate version. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum SubstrateTxStatus { + /// Transaction is part of the future queue. + Future, + /// Transaction is part of the ready queue. + Ready, + /// The transaction has been broadcast to the given peers. + Broadcast(Vec), + /// Transaction has been included in block with given hash. + InBlock(BlockHash), + /// The block this transaction was included in has been retracted. + Retracted(BlockHash), + /// Maximum number of finality watchers has been reached, + /// old watchers are being removed. + FinalityTimeout(BlockHash), + /// Transaction has been finalized by a finality-gadget, e.g GRANDPA + Finalized(BlockHash), + /// Transaction has been replaced in the pool, by another transaction + /// that provides the same tags. (e.g. same (sender, nonce)). + Usurped(Hash), + /// Transaction has been dropped from the pool because of the limit. + Dropped, + /// Transaction is no longer valid in the current state. + Invalid, +} + +/// This contains the runtime version information necessary to make transactions, as obtained from +/// the RPC call `state_getRuntimeVersion`, +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RuntimeVersion { + /// Version of the runtime specification. A full-node will not attempt to use its native + /// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, + /// `spec_version` and `authoring_version` are the same between Wasm and native. + pub spec_version: u32, + + /// All existing dispatches are fully compatible when this number doesn't change. If this + /// number changes, then `spec_version` must change, also. + /// + /// This number must change when an existing dispatchable (module ID, dispatch ID) is changed, + /// either through an alteration in its user-level semantics, a parameter + /// added/removed/changed, a dispatchable being removed, a module being removed, or a + /// dispatchable/module changing its index. + /// + /// It need *not* change when a new module is added or when a dispatchable is added. + pub transaction_version: u32, + + /// The other fields present may vary and aren't necessary for `subxt`; they are preserved in + /// this map. + #[serde(flatten)] + pub other: HashMap, +} + +/// ReadProof struct returned by the RPC +/// +/// # Note +/// +/// This is copied from `sc-rpc-api` to avoid a dependency on that crate. Therefore it +/// must be kept compatible with that type from the target substrate version. +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ReadProof { + /// Block hash used to generate the proof + pub at: Hash, + /// A proof used to prove that storage entries are included in the storage trie + pub proof: Vec, +} + +/// Statistics of a block returned by the `dev_getBlockStats` RPC. +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct BlockStats { + /// The length in bytes of the storage proof produced by executing the block. + pub witness_len: u64, + /// The length in bytes of the storage proof after compaction. + pub witness_compact_len: u64, + /// Length of the block in bytes. + /// + /// This information can also be acquired by downloading the whole block. This merely + /// saves some complexity on the client side. + pub block_len: u64, + /// Number of extrinsics in the block. + /// + /// This information can also be acquired by downloading the whole block. This merely + /// saves some complexity on the client side. + pub num_extrinsics: u64, +} + +/// Storage key. +#[derive( + Serialize, + Deserialize, + Hash, + PartialOrd, + Ord, + PartialEq, + Eq, + Clone, + Encode, + Decode, + Debug, +)] +pub struct StorageKey(#[serde(with = "impl_serde::serialize")] pub Vec); +impl AsRef<[u8]> for StorageKey { + fn as_ref(&self) -> &[u8] { + &self.0 + } +} + +/// Storage data. +#[derive( + Serialize, + Deserialize, + Hash, + PartialOrd, + Ord, + PartialEq, + Eq, + Clone, + Encode, + Decode, + Debug, +)] +pub struct StorageData(#[serde(with = "impl_serde::serialize")] pub Vec); +impl AsRef<[u8]> for StorageData { + fn as_ref(&self) -> &[u8] { + &self.0 + } +} + +/// Storage change set +#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)] +#[serde(rename_all = "camelCase")] +pub struct StorageChangeSet { + /// Block hash + pub block: Hash, + /// A list of changes + pub changes: Vec<(StorageKey, Option)>, +} + +/// Health struct returned by the RPC +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Health { + /// Number of connected peers + pub peers: usize, + /// Is the node syncing + pub is_syncing: bool, + /// Should this node have any peers + /// + /// Might be false for local chains or when running without discovery. + pub should_have_peers: bool, +} + +#[cfg(test)] +mod test { + use super::*; + + /// A util function to assert the result of serialization and deserialization is the same. + pub fn assert_deser(s: &str, expected: T) + where + T: std::fmt::Debug + + serde::ser::Serialize + + serde::de::DeserializeOwned + + PartialEq, + { + assert_eq!(serde_json::from_str::(s).unwrap(), expected); + assert_eq!(serde_json::to_string(&expected).unwrap(), s); + } + + // Check that some A can be serialized and then deserialized into some B. + pub fn assert_ser_deser(a: &A, b: &B) + where + A: serde::Serialize, + B: serde::de::DeserializeOwned + PartialEq + std::fmt::Debug, + { + let json = serde_json::to_string(a).expect("serializing failed"); + let new_b: B = serde_json::from_str(&json).expect("deserializing failed"); + + assert_eq!(b, &new_b); + } + + #[test] + fn runtime_version_is_substrate_compatible() { + use sp_version::RuntimeVersion as SpRuntimeVersion; + + let substrate_runtime_version = SpRuntimeVersion { + spec_version: 123, + transaction_version: 456, + ..Default::default() + }; + + let json = serde_json::to_string(&substrate_runtime_version) + .expect("serializing failed"); + let val: RuntimeVersion = + serde_json::from_str(&json).expect("deserializing failed"); + + // We ignore any other properties. + assert_eq!(val.spec_version, 123); + assert_eq!(val.transaction_version, 456); + } + + #[test] + fn runtime_version_handles_arbitrary_params() { + let val: RuntimeVersion = serde_json::from_str( + r#"{ + "specVersion": 123, + "transactionVersion": 456, + "foo": true, + "wibble": [1,2,3] + }"#, + ) + .expect("deserializing failed"); + + let mut m = std::collections::HashMap::new(); + m.insert("foo".to_owned(), serde_json::json!(true)); + m.insert("wibble".to_owned(), serde_json::json!([1, 2, 3])); + + assert_eq!( + val, + RuntimeVersion { + spec_version: 123, + transaction_version: 456, + other: m + } + ); + } + + #[test] + fn number_or_hex_deserializes_from_either_repr() { + assert_deser(r#""0x1234""#, NumberOrHex::Hex(0x1234.into())); + assert_deser(r#""0x0""#, NumberOrHex::Hex(0.into())); + assert_deser(r#"5"#, NumberOrHex::Number(5)); + assert_deser(r#"10000"#, NumberOrHex::Number(10000)); + assert_deser(r#"0"#, NumberOrHex::Number(0)); + assert_deser(r#"1000000000000"#, NumberOrHex::Number(1000000000000)); + } + + #[test] + fn dry_run_result_is_substrate_compatible() { + use sp_runtime::{ + transaction_validity::{ + InvalidTransaction as SpInvalidTransaction, + TransactionValidityError as SpTransactionValidityError, + }, + ApplyExtrinsicResult as SpApplyExtrinsicResult, + DispatchError as SpDispatchError, + }; + + let pairs = vec![ + // All ok + (SpApplyExtrinsicResult::Ok(Ok(())), Ok(())), + // Some transaction error + ( + SpApplyExtrinsicResult::Err(SpTransactionValidityError::Invalid( + SpInvalidTransaction::BadProof, + )), + Err(DryRunError::TransactionValidityError), + ), + // Some dispatch error + ( + SpApplyExtrinsicResult::Ok(Err(SpDispatchError::BadOrigin)), + Err(DryRunError::DispatchError), + ), + ]; + + for (actual, expected) in pairs { + let encoded = actual.encode(); + assert_eq!(decode_dry_run_result(&mut &*encoded).unwrap(), expected); + } + } + + #[test] + fn justification_is_substrate_compatible() { + use sp_runtime::Justification as SpJustification; + + // As much as anything, this just checks that the Justification type + // is still a tuple as given. + assert_ser_deser::( + &([1, 2, 3, 4], vec![5, 6, 7, 8]), + &([1, 2, 3, 4], vec![5, 6, 7, 8]), + ); + } + + #[test] + fn storage_types_are_substrate_compatible() { + use sp_core::storage::{ + StorageChangeSet as SpStorageChangeSet, + StorageData as SpStorageData, + StorageKey as SpStorageKey, + }; + + assert_ser_deser( + &SpStorageKey(vec![1, 2, 3, 4, 5]), + &StorageKey(vec![1, 2, 3, 4, 5]), + ); + assert_ser_deser( + &SpStorageData(vec![1, 2, 3, 4, 5]), + &StorageData(vec![1, 2, 3, 4, 5]), + ); + assert_ser_deser( + &SpStorageChangeSet { + block: 1u64, + changes: vec![(SpStorageKey(vec![1]), Some(SpStorageData(vec![2])))], + }, + &StorageChangeSet { + block: 1u64, + changes: vec![(StorageKey(vec![1]), Some(StorageData(vec![2])))], + }, + ); + } +} diff --git a/subxt/src/storage/mod.rs b/subxt/src/storage/mod.rs index 61b400fad7a..072560182e4 100644 --- a/subxt/src/storage/mod.rs +++ b/subxt/src/storage/mod.rs @@ -15,8 +15,8 @@ pub use storage_client::{ StorageClient, }; -// Re-export as this is used in the public API: -pub use sp_core::storage::StorageKey; +// Re-export as this is used in the public API in this module: +pub use crate::rpc::types::StorageKey; /// Types representing an address which describes where a storage /// entry lives and how to properly decode it. diff --git a/subxt/src/storage/storage_client.rs b/subxt/src/storage/storage_client.rs index e6777b567b1..068098e592b 100644 --- a/subxt/src/storage/storage_client.rs +++ b/subxt/src/storage/storage_client.rs @@ -16,15 +16,15 @@ use crate::{ DecodeWithMetadata, Metadata, }, + rpc::types::{ + StorageData, + StorageKey, + }, Config, }; use derivative::Derivative; use frame_metadata::StorageEntryType; use scale_info::form::PortableForm; -use sp_core::storage::{ - StorageData, - StorageKey, -}; use std::{ future::Future, marker::PhantomData, diff --git a/subxt/src/storage/storage_map_key.rs b/subxt/src/storage/storage_map_key.rs index bd5b96ec1e1..2f0b585cbae 100644 --- a/subxt/src/storage/storage_map_key.rs +++ b/subxt/src/storage/storage_map_key.rs @@ -3,7 +3,6 @@ // see LICENSE for license details. use codec::Encode; -pub use sp_runtime::traits::SignedExtension; // We use this type a bunch, so export it from here. pub use frame_metadata::StorageHasher; @@ -37,16 +36,16 @@ impl StorageMapKey { pub(super) fn hash_bytes(input: &[u8], hasher: &StorageHasher, bytes: &mut Vec) { match hasher { StorageHasher::Identity => bytes.extend(input), - StorageHasher::Blake2_128 => bytes.extend(sp_core::blake2_128(input)), + StorageHasher::Blake2_128 => bytes.extend(sp_core_hashing::blake2_128(input)), StorageHasher::Blake2_128Concat => { - bytes.extend(sp_core::blake2_128(input)); + bytes.extend(sp_core_hashing::blake2_128(input)); bytes.extend(input); } - StorageHasher::Blake2_256 => bytes.extend(sp_core::blake2_256(input)), - StorageHasher::Twox128 => bytes.extend(sp_core::twox_128(input)), - StorageHasher::Twox256 => bytes.extend(sp_core::twox_256(input)), + StorageHasher::Blake2_256 => bytes.extend(sp_core_hashing::blake2_256(input)), + StorageHasher::Twox128 => bytes.extend(sp_core_hashing::twox_128(input)), + StorageHasher::Twox256 => bytes.extend(sp_core_hashing::twox_256(input)), StorageHasher::Twox64Concat => { - bytes.extend(sp_core::twox_64(input)); + bytes.extend(sp_core_hashing::twox_64(input)); bytes.extend(input); } } diff --git a/subxt/src/storage/utils.rs b/subxt/src/storage/utils.rs index 811743586dd..2e3c678a50f 100644 --- a/subxt/src/storage/utils.rs +++ b/subxt/src/storage/utils.rs @@ -18,8 +18,8 @@ pub fn write_storage_address_root_bytes( addr: &Address, out: &mut Vec, ) { - out.extend(sp_core::twox_128(addr.pallet_name().as_bytes())); - out.extend(sp_core::twox_128(addr.entry_name().as_bytes())); + out.extend(sp_core_hashing::twox_128(addr.pallet_name().as_bytes())); + out.extend(sp_core_hashing::twox_128(addr.entry_name().as_bytes())); } /// Outputs the [`storage_address_root_bytes`] as well as any additional bytes that represent diff --git a/subxt/src/tx/mod.rs b/subxt/src/tx/mod.rs index cb0fcd4e518..2c52645e22e 100644 --- a/subxt/src/tx/mod.rs +++ b/subxt/src/tx/mod.rs @@ -2,45 +2,25 @@ // This file is dual-licensed as Apache-2.0 or GPL-3.0. // see LICENSE for license details. -//! Create signed or unsigned extrinsics. -//! -//! This modules exposes the extrinsic's parameters and the ability to sign an extrinsic. -//! +//! Create and submit extrinsics. //! //! An extrinsic is submitted with an "signed extra" and "additional" parameters, which can be -//! different for each chain. The trait [ExtrinsicParams] determines exactly which -//! additional and signed extra parameters are used when constructing an extrinsic. -//! -//! -//! The structure [BaseExtrinsicParams] is a base implementation of the trait which -//! configures most of the "signed extra" and "additional" parameters as needed for -//! Polkadot and Substrate nodes. Only the shape of the tip payments differs, leading to -//! [SubstrateExtrinsicParams] and [PolkadotExtrinsicParams] structs which pick an -//! appropriate shape for Substrate/Polkadot chains respectively. +//! different for each chain. The trait [`crate::config::ExtrinsicParams`] determines exactly which +//! additional and signed extra parameters are used when constructing an extrinsic, and is a part +//! of the chain configuration (see [`crate::config::Config`]). -mod params; mod signer; mod tx_client; mod tx_payload; mod tx_progress; +// The PairSigner impl currently relies on Substrate bits and pieces, so make it an optional +// feature if we want to avoid needing sp_core and sp_runtime. +#[cfg(feature = "substrate-compat")] +pub use self::signer::PairSigner; + pub use self::{ - params::{ - AssetTip, - BaseExtrinsicParams, - BaseExtrinsicParamsBuilder, - Era, - ExtrinsicParams, - PlainTip, - PolkadotExtrinsicParams, - PolkadotExtrinsicParamsBuilder, - SubstrateExtrinsicParams, - SubstrateExtrinsicParamsBuilder, - }, - signer::{ - PairSigner, - Signer, - }, + signer::Signer, tx_client::{ SubmittableExtrinsic, TxClient, diff --git a/subxt/src/tx/signer.rs b/subxt/src/tx/signer.rs index 5e4f90c4181..8a9583ad44c 100644 --- a/subxt/src/tx/signer.rs +++ b/subxt/src/tx/signer.rs @@ -6,11 +6,6 @@ //! [substrate](https://github.com/paritytech/substrate) node via RPC. use crate::Config; -use sp_core::Pair; -use sp_runtime::traits::{ - IdentifyAccount, - Verify, -}; /// Signing transactions requires a [`Signer`]. This is responsible for /// providing the "from" account that the transaction is being signed by, @@ -29,55 +24,79 @@ pub trait Signer { fn sign(&self, signer_payload: &[u8]) -> T::Signature; } -/// A [`Signer`] implementation that can be constructed from an [`Pair`]. -#[derive(Clone, Debug)] -pub struct PairSigner { - account_id: T::AccountId, - signer: P, -} +#[cfg(feature = "substrate-compat")] +pub use pair_signer::PairSigner; -impl PairSigner -where - T: Config, - T::Signature: From, - ::Signer: - From + IdentifyAccount, - P: Pair, -{ - /// Creates a new [`Signer`] from a [`Pair`]. - pub fn new(signer: P) -> Self { - let account_id = - ::Signer::from(signer.public()).into_account(); - Self { account_id, signer } - } +// A signer suitable for substrate based chains. This provides compatibility with Substrate +// packages like sp_keyring and such, and so relies on sp_core and sp_runtime to be included. +#[cfg(feature = "substrate-compat")] +mod pair_signer { + use super::Signer; + use crate::Config; + use sp_core::Pair as PairT; + use sp_runtime::{ + traits::{ + IdentifyAccount, + Verify, + }, + AccountId32 as SpAccountId32, + MultiSignature as SpMultiSignature, + }; - /// Returns the [`Pair`] implementation used to construct this. - pub fn signer(&self) -> &P { - &self.signer + /// A [`Signer`] implementation that can be constructed from an [`sp_core::Pair`]. + #[derive(Clone, Debug)] + pub struct PairSigner { + account_id: T::AccountId, + signer: Pair, } - /// Return the account ID. - pub fn account_id(&self) -> &T::AccountId { - &self.account_id - } -} + impl PairSigner + where + T: Config, + Pair: PairT, + // We go via an sp_runtime::MultiSignature. We can probably generalise this + // by implementing some of these traits on our built-in MultiSignature and then + // requiring them on all T::Signatures, to avoid any go-between. + ::Signer: From, + T::AccountId: From, + { + /// Creates a new [`Signer`] from an [`sp_core::Pair`]. + pub fn new(signer: Pair) -> Self { + let account_id = ::Signer::from(signer.public()) + .into_account(); + Self { + account_id: account_id.into(), + signer, + } + } -impl Signer for PairSigner -where - T: Config, - T::AccountId: Into + Clone + 'static, - P: Pair + 'static, - P::Signature: Into + 'static, -{ - fn account_id(&self) -> &T::AccountId { - &self.account_id - } + /// Returns the [`sp_core::Pair`] implementation used to construct this. + pub fn signer(&self) -> &Pair { + &self.signer + } - fn address(&self) -> T::Address { - self.account_id.clone().into() + /// Return the account ID. + pub fn account_id(&self) -> &T::AccountId { + &self.account_id + } } - fn sign(&self, signer_payload: &[u8]) -> T::Signature { - self.signer.sign(signer_payload).into() + impl Signer for PairSigner + where + T: Config, + Pair: PairT, + Pair::Signature: Into, + { + fn account_id(&self) -> &T::AccountId { + &self.account_id + } + + fn address(&self) -> T::Address { + self.account_id.clone().into() + } + + fn sign(&self, signer_payload: &[u8]) -> T::Signature { + self.signer.sign(signer_payload).into() + } } } diff --git a/subxt/src/tx/tx_client.rs b/subxt/src/tx/tx_client.rs index 36d0fbad646..eb84d14eeda 100644 --- a/subxt/src/tx/tx_client.rs +++ b/subxt/src/tx/tx_client.rs @@ -8,27 +8,29 @@ use crate::{ OfflineClientT, OnlineClientT, }, + config::{ + Config, + ExtrinsicParams, + Hasher, + }, error::Error, tx::{ - ExtrinsicParams, - Signer, + Signer as SignerT, TxProgress, }, utils::{ Encoded, PhantomDataSendSync, }, - Config, }; use codec::{ Compact, Encode, }; use derivative::Derivative; -use sp_runtime::{ - traits::Hash, - ApplyExtrinsicResult, -}; + +// This is returned from an API below, so expose it here. +pub use crate::rpc::types::DryRunResult; /// A client for working with transactions. #[derive(Derivative)] @@ -121,15 +123,16 @@ impl> TxClient { } /// Creates a raw signed extrinsic without submitting it. - pub fn create_signed_with_nonce( + pub fn create_signed_with_nonce( &self, call: &Call, - signer: &(dyn Signer + Send + Sync), + signer: &Signer, account_nonce: T::Index, other_params: >::OtherParams, ) -> Result, Error> where Call: TxPayload, + Signer: SignerT, { // 1. Validate this call against the current node metadata if the call comes // with a hash allowing us to do so. @@ -166,7 +169,7 @@ impl> TxClient { additional_and_extra_params.encode_extra_to(&mut bytes); additional_and_extra_params.encode_additional_to(&mut bytes); if bytes.len() > 256 { - signer.sign(&sp_core::blake2_256(&bytes)) + signer.sign(T::Hasher::hash_of(&bytes).as_ref()) } else { signer.sign(&bytes) } @@ -214,14 +217,15 @@ where C: OnlineClientT, { /// Creates a raw signed extrinsic, without submitting it. - pub async fn create_signed( + pub async fn create_signed( &self, call: &Call, - signer: &(dyn Signer + Send + Sync), + signer: &Signer, other_params: >::OtherParams, ) -> Result, Error> where Call: TxPayload, + Signer: SignerT, { // Get nonce from the node. let account_nonce = self @@ -238,13 +242,14 @@ where /// /// Returns a [`TxProgress`], which can be used to track the status of the transaction /// and obtain details about it, once it has made it into a block. - pub async fn sign_and_submit_then_watch_default( + pub async fn sign_and_submit_then_watch_default( &self, call: &Call, - signer: &(dyn Signer + Send + Sync), + signer: &Signer, ) -> Result, Error> where Call: TxPayload, + Signer: SignerT, >::OtherParams: Default, { self.sign_and_submit_then_watch(call, signer, Default::default()) @@ -255,14 +260,15 @@ where /// /// Returns a [`TxProgress`], which can be used to track the status of the transaction /// and obtain details about it, once it has made it into a block. - pub async fn sign_and_submit_then_watch( + pub async fn sign_and_submit_then_watch( &self, call: &Call, - signer: &(dyn Signer + Send + Sync), + signer: &Signer, other_params: >::OtherParams, ) -> Result, Error> where Call: TxPayload, + Signer: SignerT, { self.create_signed(call, signer, other_params) .await? @@ -280,13 +286,14 @@ where /// /// Success does not mean the extrinsic has been included in the block, just that it is valid /// and has been included in the transaction pool. - pub async fn sign_and_submit_default( + pub async fn sign_and_submit_default( &self, call: &Call, - signer: &(dyn Signer + Send + Sync), + signer: &Signer, ) -> Result where Call: TxPayload, + Signer: SignerT, >::OtherParams: Default, { self.sign_and_submit(call, signer, Default::default()).await @@ -300,14 +307,15 @@ where /// /// Success does not mean the extrinsic has been included in the block, just that it is valid /// and has been included in the transaction pool. - pub async fn sign_and_submit( + pub async fn sign_and_submit( &self, call: &Call, - signer: &(dyn Signer + Send + Sync), + signer: &Signer, other_params: >::OtherParams, ) -> Result where Call: TxPayload, + Signer: SignerT, { self.create_signed(call, signer, other_params) .await? @@ -366,7 +374,7 @@ where /// and obtain details about it, once it has made it into a block. pub async fn submit_and_watch(&self) -> Result, Error> { // Get a hash of the extrinsic (we'll need this later). - let ext_hash = T::Hashing::hash_of(&self.encoded); + let ext_hash = T::Hasher::hash_of(&self.encoded); // Submit and watch for transaction progress. let sub = self.client.rpc().watch_extrinsic(&self.encoded).await?; @@ -388,11 +396,8 @@ where /// Submits the extrinsic to the dry_run RPC, to test if it would succeed. /// - /// Returns `Ok` with an [`ApplyExtrinsicResult`], which is the result of applying of an extrinsic. - pub async fn dry_run( - &self, - at: Option, - ) -> Result { + /// Returns `Ok` with a [`DryRunResult`], which is the result of attempting to dry run the extrinsic. + pub async fn dry_run(&self, at: Option) -> Result { self.client.rpc().dry_run(self.encoded(), at).await } } diff --git a/subxt/src/tx/tx_progress.rs b/subxt/src/tx/tx_progress.rs index 0db6a53d80f..c6b0179f1d5 100644 --- a/subxt/src/tx/tx_progress.rs +++ b/subxt/src/tx/tx_progress.rs @@ -15,7 +15,7 @@ use crate::{ TransactionError, }, events::EventsClient, - rpc::{ + rpc::types::{ Subscription, SubstrateTxStatus, }, @@ -26,9 +26,6 @@ use futures::{ Stream, StreamExt, }; -use sp_runtime::traits::Hash; - -pub use sp_runtime::traits::SignedExtension; /// This struct represents a subscription to the progress of some transaction. #[derive(Derivative)] @@ -373,7 +370,8 @@ impl> TxInBlock { let extrinsic_idx = block.block.extrinsics .iter() .position(|ext| { - let hash = T::Hashing::hash_of(&ext.0); + use crate::config::Hasher; + let hash = T::Hasher::hash_of(&ext.0); hash == self.ext_hash }) // If we successfully obtain the block hash we think contains our diff --git a/subxt/src/utils/account_id.rs b/subxt/src/utils/account_id.rs new file mode 100644 index 00000000000..34e56cd87e1 --- /dev/null +++ b/subxt/src/utils/account_id.rs @@ -0,0 +1,203 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +//! The "default" Substrate/Polkadot AccountId. This is used in codegen, as well as signing related bits. +//! This doesn't contain much functionality itself, but is easy to convert to/from an `sp_core::AccountId32` +//! for instance, to gain functionality without forcing a dependency on Substrate crates here. + +use codec::{ + Decode, + Encode, +}; +use serde::Serialize; + +/// A 32-byte cryptographic identifier. This is a simplified version of Substrate's +/// `sp_core::crypto::AccountId32`. To obtain more functionality, convert this into +/// that type. +#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug)] +pub struct AccountId32(pub [u8; 32]); + +impl AsRef<[u8]> for AccountId32 { + fn as_ref(&self) -> &[u8] { + &self.0[..] + } +} + +impl AsRef<[u8; 32]> for AccountId32 { + fn as_ref(&self) -> &[u8; 32] { + &self.0 + } +} + +impl From<[u8; 32]> for AccountId32 { + fn from(x: [u8; 32]) -> Self { + AccountId32(x) + } +} + +impl AccountId32 { + // Return the ss58-check string for this key. Adapted from `sp_core::crypto`. We need this to + // serialize our account appropriately but otherwise don't care. + fn to_ss58check(&self) -> String { + // For serializing to a string to obtain the account nonce, we use the default substrate + // prefix (since we have no way to otherwise pick one). It doesn't really matter, since when + // it's deserialized back in system_accountNextIndex, we ignore this (so long as it's valid). + const SUBSTRATE_SS58_PREFIX: u8 = 42; + // prefix <= 63 just take up one byte at the start: + let mut v = vec![SUBSTRATE_SS58_PREFIX]; + // then push the account ID bytes. + v.extend(self.0); + // then push a 2 byte checksum of what we have so far. + let r = ss58hash(&v); + v.extend(&r[0..2]); + // then encode to base58. + use base58::ToBase58; + v.to_base58() + } + + // This isn't strictly needed, but to give our AccountId32 a little more usefulness, we also + // implement the logic needed to decode an AccountId32 from an SS58 encoded string. This is exposed + // via a `FromStr` impl. + fn from_ss58check(s: &str) -> Result { + const CHECKSUM_LEN: usize = 2; + let body_len = 32; + + use base58::FromBase58; + let data = s.from_base58().map_err(|_| FromSs58Error::BadBase58)?; + if data.len() < 2 { + return Err(FromSs58Error::BadLength) + } + let prefix_len = match data[0] { + 0..=63 => 1, + 64..=127 => 2, + _ => return Err(FromSs58Error::InvalidPrefix), + }; + if data.len() != prefix_len + body_len + CHECKSUM_LEN { + return Err(FromSs58Error::BadLength) + } + let hash = ss58hash(&data[0..body_len + prefix_len]); + let checksum = &hash[0..CHECKSUM_LEN]; + if data[body_len + prefix_len..body_len + prefix_len + CHECKSUM_LEN] != *checksum + { + // Invalid checksum. + return Err(FromSs58Error::InvalidChecksum) + } + + let result = data[prefix_len..body_len + prefix_len] + .try_into() + .map_err(|_| FromSs58Error::BadLength)?; + Ok(AccountId32(result)) + } +} + +/// An error obtained from trying to interpret an SS58 encoded string into an AccountId32 +#[derive(thiserror::Error, Clone, Copy, Eq, PartialEq, Debug)] +#[allow(missing_docs)] +pub enum FromSs58Error { + #[error("Base 58 requirement is violated")] + BadBase58, + #[error("Length is bad")] + BadLength, + #[error("Invalid checksum")] + InvalidChecksum, + #[error("Invalid SS58 prefix byte.")] + InvalidPrefix, +} + +// We do this just to get a checksum to help verify the validity of the address in to_ss58check +fn ss58hash(data: &[u8]) -> Vec { + use blake2::{ + Blake2b512, + Digest, + }; + const PREFIX: &[u8] = b"SS58PRE"; + let mut ctx = Blake2b512::new(); + ctx.update(PREFIX); + ctx.update(data); + ctx.finalize().to_vec() +} + +impl Serialize for AccountId32 { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(&self.to_ss58check()) + } +} + +impl std::fmt::Display for AccountId32 { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{}", self.to_ss58check()) + } +} + +impl std::str::FromStr for AccountId32 { + type Err = FromSs58Error; + fn from_str(s: &str) -> Result { + AccountId32::from_ss58check(s) + } +} + +// Improve compat with the substrate version if we're using those crates: +#[cfg(feature = "substrate-compat")] +mod substrate_impls { + use super::*; + + impl From for AccountId32 { + fn from(value: sp_runtime::AccountId32) -> Self { + Self(value.into()) + } + } + impl From for AccountId32 { + fn from(value: sp_core::sr25519::Public) -> Self { + let acc: sp_runtime::AccountId32 = value.into(); + acc.into() + } + } + impl From for AccountId32 { + fn from(value: sp_core::ed25519::Public) -> Self { + let acc: sp_runtime::AccountId32 = value.into(); + acc.into() + } + } +} + +#[cfg(test)] +mod test { + use super::*; + + use sp_core::crypto::Ss58Codec; + use sp_keyring::AccountKeyring; + + #[test] + fn ss58_is_compatible_with_substrate_impl() { + let keyrings = vec![ + AccountKeyring::Alice, + AccountKeyring::Bob, + AccountKeyring::Charlie, + ]; + + for keyring in keyrings { + let substrate_account = keyring.to_account_id(); + // Avoid "From" impl hidden behind "substrate-compat" feature so that this test + // can work either way: + let local_account = AccountId32(substrate_account.clone().into()); + + // Both should encode to ss58 the same way: + let substrate_ss58 = substrate_account.to_ss58check(); + assert_eq!(substrate_ss58, local_account.to_ss58check()); + + // Both should decode from ss58 back to the same: + assert_eq!( + sp_core::crypto::AccountId32::from_ss58check(&substrate_ss58).unwrap(), + substrate_account + ); + assert_eq!( + AccountId32::from_ss58check(&substrate_ss58).unwrap(), + local_account + ); + } + } +} diff --git a/subxt/src/utils/mod.rs b/subxt/src/utils/mod.rs index ec6761c1b78..b544eb8b7f3 100644 --- a/subxt/src/utils/mod.rs +++ b/subxt/src/utils/mod.rs @@ -4,7 +4,10 @@ //! Miscellaneous utility helpers. +pub mod account_id; pub mod bits; +pub mod multi_address; +pub mod multi_signature; use codec::{ Decode, @@ -13,6 +16,18 @@ use codec::{ }; use derivative::Derivative; +pub use account_id::AccountId32; +pub use multi_address::MultiAddress; +pub use multi_signature::MultiSignature; + +// Used in codegen +#[doc(hidden)] +pub use primitive_types::{ + H160, + H256, + H512, +}; + /// Wraps an already encoded byte vector, prevents being encoded as a raw byte vector as part of /// the transaction payload #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/subxt/src/utils/multi_address.rs b/subxt/src/utils/multi_address.rs new file mode 100644 index 00000000000..c6308a8e923 --- /dev/null +++ b/subxt/src/utils/multi_address.rs @@ -0,0 +1,66 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +//! The "default" Substrate/Polkadot Address type. This is used in codegen, as well as signing related bits. +//! This doesn't contain much functionality itself, but is easy to convert to/from an `sp_runtime::MultiAddress` +//! for instance, to gain functionality without forcing a dependency on Substrate crates here. + +use codec::{ + Decode, + Encode, +}; + +/// A multi-format address wrapper for on-chain accounts. This is a simplified version of Substrate's +/// `sp_runtime::MultiAddress`. To obtain more functionality, convert this into that type (this conversion +/// functionality is provided via `From` impls if the `substrate-compat` feature is enabled). +#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug)] +pub enum MultiAddress { + /// It's an account ID (pubkey). + Id(AccountId), + /// It's an account index. + Index(#[codec(compact)] AccountIndex), + /// It's some arbitrary raw bytes. + Raw(Vec), + /// It's a 32 byte representation. + Address32([u8; 32]), + /// Its a 20 byte representation. + Address20([u8; 20]), +} + +impl From for MultiAddress { + fn from(a: AccountId) -> Self { + Self::Id(a) + } +} + +// Improve compat with the substrate version if we're using those crates: +#[cfg(feature = "substrate-compat")] +mod substrate_impls { + use super::{ + super::AccountId32, + *, + }; + + impl From for MultiAddress { + fn from(value: sp_runtime::AccountId32) -> Self { + let val: AccountId32 = value.into(); + val.into() + } + } + + impl From> for MultiAddress + where + Id: Into, + { + fn from(value: sp_runtime::MultiAddress) -> Self { + match value { + sp_runtime::MultiAddress::Id(v) => Self::Id(v.into()), + sp_runtime::MultiAddress::Index(v) => Self::Index(v), + sp_runtime::MultiAddress::Raw(v) => Self::Raw(v), + sp_runtime::MultiAddress::Address32(v) => Self::Address32(v), + sp_runtime::MultiAddress::Address20(v) => Self::Address20(v), + } + } + } +} diff --git a/subxt/src/utils/multi_signature.rs b/subxt/src/utils/multi_signature.rs new file mode 100644 index 00000000000..482bcc1f6a4 --- /dev/null +++ b/subxt/src/utils/multi_signature.rs @@ -0,0 +1,61 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +//! The "default" Substrate/Polkadot Signature type. This is used in codegen, as well as signing related bits. +//! This doesn't contain much functionality itself, but is easy to convert to/from an `sp_runtime::MultiSignature` +//! for instance, to gain functionality without forcing a dependency on Substrate crates here. + +use codec::{ + Decode, + Encode, +}; + +/// Signature container that can store known signature types. This is a simplified version of +/// `sp_runtime::MultiSignature`. To obtain more functionality, convert this into that type. +#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug)] +pub enum MultiSignature { + /// An Ed25519 signature. + Ed25519([u8; 64]), + /// An Sr25519 signature. + Sr25519([u8; 64]), + /// An ECDSA/SECP256k1 signature (a 512-bit value, plus 8 bits for recovery ID). + Ecdsa([u8; 65]), +} + +// Improve compat with the substrate version if we're using those crates: +#[cfg(feature = "substrate-compat")] +mod substrate_impls { + use super::*; + + impl From for MultiSignature { + fn from(value: sp_runtime::MultiSignature) -> Self { + match value { + sp_runtime::MultiSignature::Ed25519(s) => Self::Ed25519(s.0), + sp_runtime::MultiSignature::Sr25519(s) => Self::Sr25519(s.0), + sp_runtime::MultiSignature::Ecdsa(s) => Self::Ecdsa(s.0), + } + } + } + + impl From for MultiSignature { + fn from(value: sp_core::ed25519::Signature) -> Self { + let sig: sp_runtime::MultiSignature = value.into(); + sig.into() + } + } + + impl From for MultiSignature { + fn from(value: sp_core::sr25519::Signature) -> Self { + let sig: sp_runtime::MultiSignature = value.into(); + sig.into() + } + } + + impl From for MultiSignature { + fn from(value: sp_core::ecdsa::Signature) -> Self { + let sig: sp_runtime::MultiSignature = value.into(); + sig.into() + } + } +} diff --git a/testing/integration-tests/Cargo.toml b/testing/integration-tests/Cargo.toml index 9c766159741..ba378a39d20 100644 --- a/testing/integration-tests/Cargo.toml +++ b/testing/integration-tests/Cargo.toml @@ -23,9 +23,9 @@ futures = "0.3.13" hex = "0.4.3" regex = "1.5.0" scale-info = { version = "2.0.0", features = ["bit-vec"] } -sp-core = { version = "7.0.0", default-features = false } -sp-keyring = "7.0.0" -sp-runtime = "7.0.0" +sp-core = { version = "11.0.0", default-features = false } +sp-keyring = "12.0.0" +sp-runtime = "12.0.0" syn = "1.0.0" subxt = { version = "0.25.0", path = "../../subxt" } subxt-codegen = { version = "0.25.0", path = "../../codegen" } diff --git a/testing/integration-tests/src/blocks/mod.rs b/testing/integration-tests/src/blocks/mod.rs index d3449ecc663..71ddc257ebf 100644 --- a/testing/integration-tests/src/blocks/mod.rs +++ b/testing/integration-tests/src/blocks/mod.rs @@ -75,8 +75,8 @@ async fn missing_block_headers_will_be_filled_in() -> Result<(), subxt::Error> { while let Some(header) = all_finalized_blocks.next().await { let header = header?; - use sp_runtime::traits::Header; - let block_number: u128 = (*header.number()).into(); + use subxt::config::Header; + let block_number: u128 = header.number().into(); if let Some(last) = last_block_number { assert_eq!(last + 1, block_number); diff --git a/testing/integration-tests/src/client/mod.rs b/testing/integration-tests/src/client/mod.rs index 77a5a5f5e21..0214c4901ff 100644 --- a/testing/integration-tests/src/client/mod.rs +++ b/testing/integration-tests/src/client/mod.rs @@ -17,7 +17,10 @@ use sp_core::{ Pair, }; use sp_keyring::AccountKeyring; -use subxt::error::DispatchError; +use subxt::{ + error::DispatchError, + rpc::types::DryRunError, +}; #[tokio::test] async fn insert_key() { @@ -162,8 +165,7 @@ async fn dry_run_passes() { .dry_run(None) .await .expect("dryrunning failed") - .expect("expected dryrunning to be successful") - .unwrap(); + .expect("dry run should be successful"); signed_extrinsic .submit_and_watch() @@ -198,15 +200,9 @@ async fn dry_run_fails() { let dry_run_res = signed_extrinsic .dry_run(None) .await - .expect("dryrunning failed") - .expect("expected dryrun transaction to be valid"); + .expect("dryrunning failed"); - if let Err(sp_runtime::DispatchError::Module(module_error)) = dry_run_res { - assert_eq!(module_error.index, 6); - assert_eq!(module_error.error, [2, 0, 0, 0]); - } else { - panic!("expected a module error when dryrunning"); - } + assert_eq!(dry_run_res, Err(DryRunError::DispatchError)); let res = signed_extrinsic .submit_and_watch() diff --git a/testing/integration-tests/src/codegen/mod.rs b/testing/integration-tests/src/codegen/mod.rs index 3199a68e2bf..c8b8142fb02 100644 --- a/testing/integration-tests/src/codegen/mod.rs +++ b/testing/integration-tests/src/codegen/mod.rs @@ -8,7 +8,7 @@ /// Generate by: /// /// - run `polkadot --dev --tmp` node locally -/// - `cargo run --release -p subxt-cli -- codegen | rustfmt > integration-tests/src/codegen/polkadot.rs` +/// - `cargo run -p subxt-cli -- codegen | rustfmt > testing/integration-tests/src/codegen/polkadot.rs` #[rustfmt::skip] #[allow(clippy::all)] mod polkadot; diff --git a/testing/integration-tests/src/codegen/polkadot.rs b/testing/integration-tests/src/codegen/polkadot.rs index 92d0d7570d6..732faf74d64 100644 --- a/testing/integration-tests/src/codegen/polkadot.rs +++ b/testing/integration-tests/src/codegen/polkadot.rs @@ -462,7 +462,7 @@ pub mod api { )] #[doc = "A new account was created."] pub struct NewAccount { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for NewAccount { const PALLET: &'static str = "System"; @@ -475,7 +475,7 @@ pub mod api { )] #[doc = "An account was reaped."] pub struct KilledAccount { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for KilledAccount { const PALLET: &'static str = "System"; @@ -488,8 +488,8 @@ pub mod api { )] #[doc = "On on-chain remark happened."] pub struct Remarked { - pub sender: ::subxt::ext::sp_core::crypto::AccountId32, - pub hash: ::subxt::ext::sp_core::H256, + pub sender: ::subxt::utils::account_id::AccountId32, + pub hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Remarked { const PALLET: &'static str = "System"; @@ -503,7 +503,7 @@ pub mod api { #[doc = " The full account information for a particular account ID."] pub fn account( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::frame_system::AccountInfo< @@ -632,7 +632,7 @@ pub mod api { &self, _0: impl ::std::borrow::Borrow<::core::primitive::u32>, ) -> ::subxt::storage::address::StaticStorageAddress< - ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::H256>, + ::subxt::metadata::DecodeStaticType<::subxt::utils::H256>, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -656,7 +656,7 @@ pub mod api { pub fn block_hash_root( &self, ) -> ::subxt::storage::address::StaticStorageAddress< - ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::H256>, + ::subxt::metadata::DecodeStaticType<::subxt::utils::H256>, (), ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -748,7 +748,7 @@ pub mod api { pub fn parent_hash( &self, ) -> ::subxt::storage::address::StaticStorageAddress< - ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::H256>, + ::subxt::metadata::DecodeStaticType<::subxt::utils::H256>, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, (), @@ -802,7 +802,7 @@ pub mod api { ::std::vec::Vec< runtime_types::frame_system::EventRecord< runtime_types::polkadot_runtime::RuntimeEvent, - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, >, >, @@ -855,7 +855,7 @@ pub mod api { #[doc = " no notification will be triggered thus the event might be lost."] pub fn event_topics( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::u32)>, @@ -1484,7 +1484,7 @@ pub mod api { ], ) } - #[doc = " Items to be executed, indexed by the block number that they should be executed on."] pub fn agenda (& self , _0 : impl :: std :: borrow :: Borrow < :: core :: primitive :: u32 > ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: sp_core :: bounded :: bounded_vec :: BoundedVec < :: core :: option :: Option < runtime_types :: pallet_scheduler :: Scheduled < [:: core :: primitive :: u8 ; 32usize] , runtime_types :: frame_support :: traits :: preimages :: Bounded < runtime_types :: polkadot_runtime :: RuntimeCall > , :: core :: primitive :: u32 , runtime_types :: polkadot_runtime :: OriginCaller , :: subxt :: ext :: sp_core :: crypto :: AccountId32 > > > > , :: subxt :: storage :: address :: Yes , :: subxt :: storage :: address :: Yes , :: subxt :: storage :: address :: Yes >{ + #[doc = " Items to be executed, indexed by the block number that they should be executed on."] pub fn agenda (& self , _0 : impl :: std :: borrow :: Borrow < :: core :: primitive :: u32 > ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: sp_core :: bounded :: bounded_vec :: BoundedVec < :: core :: option :: Option < runtime_types :: pallet_scheduler :: Scheduled < [:: core :: primitive :: u8 ; 32usize] , runtime_types :: frame_support :: traits :: preimages :: Bounded < runtime_types :: polkadot_runtime :: RuntimeCall > , :: core :: primitive :: u32 , runtime_types :: polkadot_runtime :: OriginCaller , :: subxt :: utils :: account_id :: AccountId32 > > > > , :: subxt :: storage :: address :: Yes , :: subxt :: storage :: address :: Yes , :: subxt :: storage :: address :: Yes >{ ::subxt::storage::address::StaticStorageAddress::new( "Scheduler", "Agenda", @@ -1500,7 +1500,7 @@ pub mod api { ], ) } - #[doc = " Items to be executed, indexed by the block number that they should be executed on."] pub fn agenda_root (& self ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: sp_core :: bounded :: bounded_vec :: BoundedVec < :: core :: option :: Option < runtime_types :: pallet_scheduler :: Scheduled < [:: core :: primitive :: u8 ; 32usize] , runtime_types :: frame_support :: traits :: preimages :: Bounded < runtime_types :: polkadot_runtime :: RuntimeCall > , :: core :: primitive :: u32 , runtime_types :: polkadot_runtime :: OriginCaller , :: subxt :: ext :: sp_core :: crypto :: AccountId32 > > > > , () , :: subxt :: storage :: address :: Yes , :: subxt :: storage :: address :: Yes >{ + #[doc = " Items to be executed, indexed by the block number that they should be executed on."] pub fn agenda_root (& self ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: sp_core :: bounded :: bounded_vec :: BoundedVec < :: core :: option :: Option < runtime_types :: pallet_scheduler :: Scheduled < [:: core :: primitive :: u8 ; 32usize] , runtime_types :: frame_support :: traits :: preimages :: Bounded < runtime_types :: polkadot_runtime :: RuntimeCall > , :: core :: primitive :: u32 , runtime_types :: polkadot_runtime :: OriginCaller , :: subxt :: utils :: account_id :: AccountId32 > > > > , () , :: subxt :: storage :: address :: Yes , :: subxt :: storage :: address :: Yes >{ ::subxt::storage::address::StaticStorageAddress::new( "Scheduler", "Agenda", @@ -1638,7 +1638,7 @@ pub mod api { Debug, )] pub struct UnnotePreimage { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -1646,7 +1646,7 @@ pub mod api { Debug, )] pub struct RequestPreimage { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -1654,7 +1654,7 @@ pub mod api { Debug, )] pub struct UnrequestPreimage { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } pub struct TransactionApi; impl TransactionApi { @@ -1686,7 +1686,7 @@ pub mod api { #[doc = "- `len`: The length of the preimage of `hash`."] pub fn unnote_preimage( &self, - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Preimage", @@ -1706,7 +1706,7 @@ pub mod api { #[doc = "a user may have paid, and take the control of the preimage out of their hands."] pub fn request_preimage( &self, - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Preimage", @@ -1725,7 +1725,7 @@ pub mod api { #[doc = "NOTE: THIS MUST NOT BE CALLED ON `hash` MORE TIMES THAN `request_preimage`."] pub fn unrequest_preimage( &self, - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Preimage", @@ -1752,7 +1752,7 @@ pub mod api { )] #[doc = "A preimage has been noted."] pub struct Noted { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Noted { const PALLET: &'static str = "Preimage"; @@ -1765,7 +1765,7 @@ pub mod api { )] #[doc = "A preimage has been requested."] pub struct Requested { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Requested { const PALLET: &'static str = "Preimage"; @@ -1778,7 +1778,7 @@ pub mod api { )] #[doc = "A preimage has ben cleared."] pub struct Cleared { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Cleared { const PALLET: &'static str = "Preimage"; @@ -1792,11 +1792,11 @@ pub mod api { #[doc = " The request status of a given hash."] pub fn status_for( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_preimage::RequestStatus< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -1825,7 +1825,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_preimage::RequestStatus< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -1847,7 +1847,7 @@ pub mod api { } pub fn preimage_for( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, _1: impl ::std::borrow::Borrow<::core::primitive::u32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< @@ -2688,8 +2688,8 @@ pub mod api { Debug, )] pub struct Transfer { - pub new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub index: ::core::primitive::u32, @@ -2709,8 +2709,8 @@ pub mod api { Debug, )] pub struct ForceTransfer { - pub new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub index: ::core::primitive::u32, @@ -2783,8 +2783,8 @@ pub mod api { #[doc = "# "] pub fn transfer( &self, - new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, index: ::core::primitive::u32, @@ -2858,8 +2858,8 @@ pub mod api { #[doc = "# "] pub fn force_transfer( &self, - new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, index: ::core::primitive::u32, @@ -2924,7 +2924,7 @@ pub mod api { )] #[doc = "A account index was assigned."] pub struct IndexAssigned { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub index: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for IndexAssigned { @@ -2953,7 +2953,7 @@ pub mod api { #[doc = "A account index has been frozen to its current account ID."] pub struct IndexFrozen { pub index: ::core::primitive::u32, - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for IndexFrozen { const PALLET: &'static str = "Indices"; @@ -2970,7 +2970,7 @@ pub mod api { _0: impl ::std::borrow::Borrow<::core::primitive::u32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::bool, )>, @@ -2998,7 +2998,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::bool, )>, @@ -3058,8 +3058,8 @@ pub mod api { Debug, )] pub struct Transfer { - pub dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -3071,8 +3071,8 @@ pub mod api { Debug, )] pub struct SetBalance { - pub who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -3086,12 +3086,12 @@ pub mod api { Debug, )] pub struct ForceTransfer { - pub source: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub source: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -3103,8 +3103,8 @@ pub mod api { Debug, )] pub struct TransferKeepAlive { - pub dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -3116,8 +3116,8 @@ pub mod api { Debug, )] pub struct TransferAll { - pub dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub keep_alive: ::core::primitive::bool, @@ -3128,8 +3128,8 @@ pub mod api { Debug, )] pub struct ForceUnreserve { - pub who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub amount: ::core::primitive::u128, @@ -3163,8 +3163,8 @@ pub mod api { #[doc = "# "] pub fn transfer( &self, - dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, value: ::core::primitive::u128, @@ -3191,8 +3191,8 @@ pub mod api { #[doc = "The dispatch origin for this call is `root`."] pub fn set_balance( &self, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, new_free: ::core::primitive::u128, @@ -3222,12 +3222,12 @@ pub mod api { #[doc = "# "] pub fn force_transfer( &self, - source: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + source: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, value: ::core::primitive::u128, @@ -3256,8 +3256,8 @@ pub mod api { #[doc = "[`transfer`]: struct.Pallet.html#method.transfer"] pub fn transfer_keep_alive( &self, - dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, value: ::core::primitive::u128, @@ -3293,8 +3293,8 @@ pub mod api { #[doc = " #"] pub fn transfer_all( &self, - dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, keep_alive: ::core::primitive::bool, @@ -3316,8 +3316,8 @@ pub mod api { #[doc = "Can only be called by ROOT."] pub fn force_unreserve( &self, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, amount: ::core::primitive::u128, @@ -3347,7 +3347,7 @@ pub mod api { )] #[doc = "An account was created with some free balance."] pub struct Endowed { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, pub free_balance: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Endowed { @@ -3362,7 +3362,7 @@ pub mod api { #[doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] #[doc = "resulting in an outright loss."] pub struct DustLost { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for DustLost { @@ -3376,8 +3376,8 @@ pub mod api { )] #[doc = "Transfer succeeded."] pub struct Transfer { - pub from: ::subxt::ext::sp_core::crypto::AccountId32, - pub to: ::subxt::ext::sp_core::crypto::AccountId32, + pub from: ::subxt::utils::account_id::AccountId32, + pub to: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Transfer { @@ -3391,7 +3391,7 @@ pub mod api { )] #[doc = "A balance was set by root."] pub struct BalanceSet { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub free: ::core::primitive::u128, pub reserved: ::core::primitive::u128, } @@ -3406,7 +3406,7 @@ pub mod api { )] #[doc = "Some balance was reserved (moved from free to reserved)."] pub struct Reserved { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Reserved { @@ -3420,7 +3420,7 @@ pub mod api { )] #[doc = "Some balance was unreserved (moved from reserved to free)."] pub struct Unreserved { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Unreserved { @@ -3435,8 +3435,8 @@ pub mod api { #[doc = "Some balance was moved from the reserve of the first account to the second account."] #[doc = "Final argument indicates the destination balance type."] pub struct ReserveRepatriated { - pub from: ::subxt::ext::sp_core::crypto::AccountId32, - pub to: ::subxt::ext::sp_core::crypto::AccountId32, + pub from: ::subxt::utils::account_id::AccountId32, + pub to: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, pub destination_status: runtime_types::frame_support::traits::tokens::misc::BalanceStatus, @@ -3452,7 +3452,7 @@ pub mod api { )] #[doc = "Some amount was deposited (e.g. for transaction fees)."] pub struct Deposit { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Deposit { @@ -3466,7 +3466,7 @@ pub mod api { )] #[doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] pub struct Withdraw { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Withdraw { @@ -3480,7 +3480,7 @@ pub mod api { )] #[doc = "Some amount was removed from the account (e.g. for misbehavior)."] pub struct Slashed { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Slashed { @@ -3539,7 +3539,7 @@ pub mod api { #[doc = " NOTE: This is only used in the case that this pallet is used to store balances."] pub fn account( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_balances::AccountData< @@ -3617,7 +3617,7 @@ pub mod api { #[doc = " NOTE: Should only be accessed when setting, changing and freeing a lock."] pub fn locks( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::sp_core::bounded::weak_bounded_vec::WeakBoundedVec< @@ -3676,7 +3676,7 @@ pub mod api { #[doc = " Named reserves on some account balances."] pub fn reserves( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::sp_core::bounded::bounded_vec::BoundedVec< @@ -3834,7 +3834,7 @@ pub mod api { #[doc = "A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee,"] #[doc = "has been paid by `who`."] pub struct TransactionFeePaid { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub actual_fee: ::core::primitive::u128, pub tip: ::core::primitive::u128, } @@ -3996,8 +3996,8 @@ pub mod api { runtime_types::sp_core::bounded::bounded_vec::BoundedVec< runtime_types::pallet_authorship::UncleEntryItem< ::core::primitive::u32, - ::subxt::ext::sp_core::H256, - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::H256, + ::subxt::utils::account_id::AccountId32, >, >, >, @@ -4022,7 +4022,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ::subxt::storage::address::Yes, (), @@ -4103,14 +4103,14 @@ pub mod api { Debug, )] pub struct Bond { - pub controller: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub controller: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] pub value: ::core::primitive::u128, pub payee: runtime_types::pallet_staking::RewardDestination< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, } #[derive( @@ -4155,8 +4155,8 @@ pub mod api { )] pub struct Nominate { pub targets: ::std::vec::Vec< - ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, >, @@ -4174,7 +4174,7 @@ pub mod api { )] pub struct SetPayee { pub payee: runtime_types::pallet_staking::RewardDestination< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, } #[derive( @@ -4183,8 +4183,8 @@ pub mod api { Debug, )] pub struct SetController { - pub controller: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub controller: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -4233,7 +4233,7 @@ pub mod api { )] pub struct SetInvulnerables { pub invulnerables: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -4241,7 +4241,7 @@ pub mod api { Debug, )] pub struct ForceUnstake { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub num_slashing_spans: ::core::primitive::u32, } #[derive( @@ -4265,7 +4265,7 @@ pub mod api { Debug, )] pub struct PayoutStakers { - pub validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub validator_stash: ::subxt::utils::account_id::AccountId32, pub era: ::core::primitive::u32, } #[derive( @@ -4283,7 +4283,7 @@ pub mod api { Debug, )] pub struct ReapStash { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub num_slashing_spans: ::core::primitive::u32, } #[derive( @@ -4293,8 +4293,8 @@ pub mod api { )] pub struct Kick { pub who: ::std::vec::Vec< - ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, >, @@ -4336,7 +4336,7 @@ pub mod api { Debug, )] pub struct ChillOther { - pub controller: ::subxt::ext::sp_core::crypto::AccountId32, + pub controller: ::subxt::utils::account_id::AccountId32, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -4344,7 +4344,7 @@ pub mod api { Debug, )] pub struct ForceApplyMinCommission { - pub validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub validator_stash: ::subxt::utils::account_id::AccountId32, } pub struct TransactionApi; impl TransactionApi { @@ -4367,13 +4367,13 @@ pub mod api { #[doc = "# "] pub fn bond( &self, - controller: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + controller: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, value: ::core::primitive::u128, payee: runtime_types::pallet_staking::RewardDestination< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -4524,8 +4524,8 @@ pub mod api { pub fn nominate( &self, targets: ::std::vec::Vec< - ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, >, @@ -4585,7 +4585,7 @@ pub mod api { pub fn set_payee( &self, payee: runtime_types::pallet_staking::RewardDestination< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -4618,8 +4618,8 @@ pub mod api { #[doc = "# "] pub fn set_controller( &self, - controller: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + controller: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -4771,7 +4771,7 @@ pub mod api { pub fn set_invulnerables( &self, invulnerables: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -4791,7 +4791,7 @@ pub mod api { #[doc = "The dispatch origin must be Root."] pub fn force_unstake( &self, - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, num_slashing_spans: ::core::primitive::u32, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -4878,7 +4878,7 @@ pub mod api { #[doc = "# "] pub fn payout_stakers( &self, - validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + validator_stash: ::subxt::utils::account_id::AccountId32, era: ::core::primitive::u32, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -4935,7 +4935,7 @@ pub mod api { #[doc = "Refunds the transaction fees upon successful execution."] pub fn reap_stash( &self, - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, num_slashing_spans: ::core::primitive::u32, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -4967,8 +4967,8 @@ pub mod api { pub fn kick( &self, who: ::std::vec::Vec< - ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, >, @@ -5058,7 +5058,7 @@ pub mod api { #[doc = "who do not satisfy these requirements."] pub fn chill_other( &self, - controller: ::subxt::ext::sp_core::crypto::AccountId32, + controller: ::subxt::utils::account_id::AccountId32, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Staking", @@ -5077,7 +5077,7 @@ pub mod api { #[doc = "can call this."] pub fn force_apply_min_commission( &self, - validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + validator_stash: ::subxt::utils::account_id::AccountId32, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -5121,7 +5121,7 @@ pub mod api { )] #[doc = "The nominator has been rewarded by this amount."] pub struct Rewarded { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Rewarded { @@ -5135,7 +5135,7 @@ pub mod api { )] #[doc = "One staker (and potentially its nominators) has been slashed by the given amount."] pub struct Slashed { - pub staker: ::subxt::ext::sp_core::crypto::AccountId32, + pub staker: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Slashed { @@ -5178,7 +5178,7 @@ pub mod api { #[doc = "NOTE: This event is only emitted when funds are bonded via a dispatchable. Notably,"] #[doc = "it will not be emitted for staking rewards when they are added to stake."] pub struct Bonded { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Bonded { @@ -5192,7 +5192,7 @@ pub mod api { )] #[doc = "An account has unbonded this amount."] pub struct Unbonded { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Unbonded { @@ -5207,7 +5207,7 @@ pub mod api { #[doc = "An account has called `withdraw_unbonded` and removed unbonding chunks worth `Balance`"] #[doc = "from the unlocking queue."] pub struct Withdrawn { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Withdrawn { @@ -5221,8 +5221,8 @@ pub mod api { )] #[doc = "A nominator has been kicked from a validator."] pub struct Kicked { - pub nominator: ::subxt::ext::sp_core::crypto::AccountId32, - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub nominator: ::subxt::utils::account_id::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Kicked { const PALLET: &'static str = "Staking"; @@ -5246,7 +5246,7 @@ pub mod api { )] #[doc = "An account has stopped participating as either a validator or nominator."] pub struct Chilled { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Chilled { const PALLET: &'static str = "Staking"; @@ -5260,7 +5260,7 @@ pub mod api { #[doc = "The stakers' rewards are getting paid."] pub struct PayoutStarted { pub era_index: ::core::primitive::u32, - pub validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub validator_stash: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for PayoutStarted { const PALLET: &'static str = "Staking"; @@ -5273,7 +5273,7 @@ pub mod api { )] #[doc = "A validator has set their preferences."] pub struct ValidatorPrefsSet { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub prefs: runtime_types::pallet_staking::ValidatorPrefs, } impl ::subxt::events::StaticEvent for ValidatorPrefsSet { @@ -5334,7 +5334,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, >, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -5355,10 +5355,10 @@ pub mod api { #[doc = " Map from all locked \"stash\" accounts to the controller account."] pub fn bonded( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ::subxt::storage::address::Yes, (), @@ -5384,7 +5384,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, (), (), @@ -5472,7 +5472,7 @@ pub mod api { #[doc = " Map from all (unlocked) \"controller\" accounts to the info regarding the staking."] pub fn ledger( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::StakingLedger, @@ -5522,11 +5522,11 @@ pub mod api { #[doc = " Where the reward payment should be made. Keyed by stash."] pub fn payee( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::RewardDestination< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, >, ::subxt::storage::address::Yes, @@ -5554,7 +5554,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::RewardDestination< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, >, (), @@ -5576,7 +5576,7 @@ pub mod api { #[doc = " The map from (wannabe) validator stash key to the preferences of that validator."] pub fn validators( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::ValidatorPrefs, @@ -5685,7 +5685,7 @@ pub mod api { #[doc = " [`Call::chill_other`] dispatchable by anyone."] pub fn nominators( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::Nominations, @@ -5902,11 +5902,11 @@ pub mod api { pub fn eras_stakers( &self, _0: impl ::std::borrow::Borrow<::core::primitive::u32>, - _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _1: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::Exposure< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -5946,7 +5946,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::Exposure< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -5980,11 +5980,11 @@ pub mod api { pub fn eras_stakers_clipped( &self, _0: impl ::std::borrow::Borrow<::core::primitive::u32>, - _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _1: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::Exposure< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -6029,7 +6029,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::Exposure< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -6057,7 +6057,7 @@ pub mod api { pub fn eras_validator_prefs( &self, _0: impl ::std::borrow::Borrow<::core::primitive::u32>, - _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _1: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::ValidatorPrefs, @@ -6172,7 +6172,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::EraRewardPoints< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, >, ::subxt::storage::address::Yes, @@ -6201,7 +6201,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::EraRewardPoints< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, >, (), @@ -6346,7 +6346,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType< ::std::vec::Vec< runtime_types::pallet_staking::UnappliedSlash< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -6377,7 +6377,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType< ::std::vec::Vec< runtime_types::pallet_staking::UnappliedSlash< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -6429,7 +6429,7 @@ pub mod api { pub fn validator_slash_in_era( &self, _0: impl ::std::borrow::Borrow<::core::primitive::u32>, - _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _1: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( runtime_types::sp_arithmetic::per_things::Perbill, @@ -6489,7 +6489,7 @@ pub mod api { pub fn nominator_slash_in_era( &self, _0: impl ::std::borrow::Borrow<::core::primitive::u32>, - _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _1: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, ::subxt::storage::address::Yes, @@ -6541,7 +6541,7 @@ pub mod api { #[doc = " Slashing spans for stash accounts."] pub fn slashing_spans( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_staking::slashing::SlashingSpans, @@ -6592,7 +6592,7 @@ pub mod api { #[doc = " as well as how much reward has been paid out."] pub fn span_slash( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, _1: impl ::std::borrow::Borrow<::core::primitive::u32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< @@ -6946,15 +6946,15 @@ pub mod api { #[doc = " The primary structure that holds all offence records keyed by report identifiers."] pub fn reports( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::sp_staking::offence::OffenceDetails< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_staking::Exposure< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, ), @@ -6985,11 +6985,11 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::sp_staking::offence::OffenceDetails< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_staking::Exposure< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, ), @@ -7018,7 +7018,7 @@ pub mod api { _1: impl ::std::borrow::Borrow<[::core::primitive::u8]>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::std::vec::Vec<::subxt::ext::sp_core::H256>, + ::std::vec::Vec<::subxt::utils::H256>, >, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -7050,7 +7050,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::std::vec::Vec<::subxt::ext::sp_core::H256>, + ::std::vec::Vec<::subxt::utils::H256>, >, (), ::subxt::storage::address::Yes, @@ -7251,7 +7251,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, >, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -7319,7 +7319,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::polkadot_runtime::SessionKeys, )>, >, @@ -7369,7 +7369,7 @@ pub mod api { #[doc = " The next session keys for a validator."] pub fn next_keys( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_runtime::SessionKeys, @@ -7423,7 +7423,7 @@ pub mod api { _1: impl ::std::borrow::Borrow<[::core::primitive::u8]>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ::subxt::storage::address::Yes, (), @@ -7449,7 +7449,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, (), (), @@ -7486,7 +7486,7 @@ pub mod api { pub struct ReportEquivocation { pub equivocation_proof: ::std::boxed::Box< runtime_types::sp_finality_grandpa::EquivocationProof< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, ::core::primitive::u32, >, >, @@ -7500,7 +7500,7 @@ pub mod api { pub struct ReportEquivocationUnsigned { pub equivocation_proof: ::std::boxed::Box< runtime_types::sp_finality_grandpa::EquivocationProof< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, ::core::primitive::u32, >, >, @@ -7523,7 +7523,7 @@ pub mod api { #[doc = "will be reported."] pub fn report_equivocation( &self, - equivocation_proof : runtime_types :: sp_finality_grandpa :: EquivocationProof < :: subxt :: ext :: sp_core :: H256 , :: core :: primitive :: u32 >, + equivocation_proof : runtime_types :: sp_finality_grandpa :: EquivocationProof < :: subxt :: utils :: H256 , :: core :: primitive :: u32 >, key_owner_proof: runtime_types::sp_session::MembershipProof, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -7554,7 +7554,7 @@ pub mod api { #[doc = "reporter."] pub fn report_equivocation_unsigned( &self, - equivocation_proof : runtime_types :: sp_finality_grandpa :: EquivocationProof < :: subxt :: ext :: sp_core :: H256 , :: core :: primitive :: u32 >, + equivocation_proof : runtime_types :: sp_finality_grandpa :: EquivocationProof < :: subxt :: utils :: H256 , :: core :: primitive :: u32 >, key_owner_proof: runtime_types::sp_session::MembershipProof, ) -> ::subxt::tx::StaticTxPayload { @@ -7942,9 +7942,9 @@ pub mod api { #[doc = "At the end of the session, at least one validator was found to be offline."] pub struct SomeOffline { pub offline: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_staking::Exposure< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, )>, @@ -8082,7 +8082,7 @@ pub mod api { pub fn authored_blocks( &self, _0: impl ::std::borrow::Borrow<::core::primitive::u32>, - _1: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _1: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, ::subxt::storage::address::Yes, @@ -8251,7 +8251,7 @@ pub mod api { Debug, )] pub struct FastTrack { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub voting_period: ::core::primitive::u32, pub delay: ::core::primitive::u32, } @@ -8261,7 +8261,7 @@ pub mod api { Debug, )] pub struct VetoExternal { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -8278,8 +8278,8 @@ pub mod api { Debug, )] pub struct Delegate { - pub to: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub to: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub conviction: runtime_types::pallet_democracy::conviction::Conviction, @@ -8303,8 +8303,8 @@ pub mod api { Debug, )] pub struct Unlock { - pub target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -8323,8 +8323,8 @@ pub mod api { Debug, )] pub struct RemoveOtherVote { - pub target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub index: ::core::primitive::u32, @@ -8335,7 +8335,7 @@ pub mod api { Debug, )] pub struct Blacklist { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub maybe_ref_index: ::core::option::Option<::core::primitive::u32>, } #[derive( @@ -8551,7 +8551,7 @@ pub mod api { #[doc = "Weight: `O(1)`"] pub fn fast_track( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, voting_period: ::core::primitive::u32, delay: ::core::primitive::u32, ) -> ::subxt::tx::StaticTxPayload { @@ -8582,7 +8582,7 @@ pub mod api { #[doc = "Weight: `O(V + log(V))` where V is number of `existing vetoers`"] pub fn veto_external( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Democracy", @@ -8641,8 +8641,8 @@ pub mod api { #[doc = " voted on. Weight is charged as if maximum votes."] pub fn delegate( &self, - to: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + to: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, conviction: runtime_types::pallet_democracy::conviction::Conviction, @@ -8718,8 +8718,8 @@ pub mod api { #[doc = "Weight: `O(R)` with R number of vote of target."] pub fn unlock( &self, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -8795,8 +8795,8 @@ pub mod api { #[doc = " Weight is calculated for the maximum number of vote."] pub fn remove_other_vote( &self, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, index: ::core::primitive::u32, @@ -8830,7 +8830,7 @@ pub mod api { #[doc = " reasonable value)."] pub fn blacklist( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, maybe_ref_index: ::core::option::Option<::core::primitive::u32>, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -8980,8 +8980,8 @@ pub mod api { )] #[doc = "An account has delegated their vote to another account."] pub struct Delegated { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, - pub target: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, + pub target: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Delegated { const PALLET: &'static str = "Democracy"; @@ -8994,7 +8994,7 @@ pub mod api { )] #[doc = "An account has cancelled a previous delegation operation."] pub struct Undelegated { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Undelegated { const PALLET: &'static str = "Democracy"; @@ -9007,8 +9007,8 @@ pub mod api { )] #[doc = "An external proposal has been vetoed."] pub struct Vetoed { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub who: ::subxt::utils::account_id::AccountId32, + pub proposal_hash: ::subxt::utils::H256, pub until: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for Vetoed { @@ -9022,7 +9022,7 @@ pub mod api { )] #[doc = "A proposal_hash has been blacklisted permanently."] pub struct Blacklisted { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Blacklisted { const PALLET: &'static str = "Democracy"; @@ -9035,7 +9035,7 @@ pub mod api { )] #[doc = "An account has voted in a referendum"] pub struct Voted { - pub voter: ::subxt::ext::sp_core::crypto::AccountId32, + pub voter: ::subxt::utils::account_id::AccountId32, pub ref_index: ::core::primitive::u32, pub vote: runtime_types::pallet_democracy::vote::AccountVote< ::core::primitive::u128, @@ -9052,7 +9052,7 @@ pub mod api { )] #[doc = "An account has secconded a proposal"] pub struct Seconded { - pub seconder: ::subxt::ext::sp_core::crypto::AccountId32, + pub seconder: ::subxt::utils::account_id::AccountId32, pub prop_index: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for Seconded { @@ -9109,7 +9109,7 @@ pub mod api { runtime_types::frame_support::traits::preimages::Bounded< runtime_types::polkadot_runtime::RuntimeCall, >, - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, )>, >, ::subxt::storage::address::Yes, @@ -9137,7 +9137,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ::core::primitive::u128, )>, @@ -9168,7 +9168,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ::core::primitive::u128, )>, @@ -9303,12 +9303,12 @@ pub mod api { #[doc = " TWOX-NOTE: SAFE as `AccountId`s are crypto hashes anyway."] pub fn voting_of( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_democracy::vote::Voting< ::core::primitive::u128, - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u32, >, >, @@ -9341,7 +9341,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType< runtime_types::pallet_democracy::vote::Voting< ::core::primitive::u128, - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u32, >, >, @@ -9416,12 +9416,12 @@ pub mod api { #[doc = " (until when it may not be resubmitted) and who vetoed it."] pub fn blacklist( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( ::core::primitive::u32, runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, )>, ::subxt::storage::address::Yes, @@ -9451,7 +9451,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType<( ::core::primitive::u32, runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, )>, (), @@ -9473,7 +9473,7 @@ pub mod api { #[doc = " Record of all proposals that have been subject to emergency cancellation."] pub fn cancellations( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<::core::primitive::bool>, ::subxt::storage::address::Yes, @@ -9755,10 +9755,9 @@ pub mod api { Debug, )] pub struct SetMembers { - pub new_members: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub new_members: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, pub prime: - ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + ::core::option::Option<::subxt::utils::account_id::AccountId32>, pub old_count: ::core::primitive::u32, } #[derive( @@ -9791,7 +9790,7 @@ pub mod api { Debug, )] pub struct Vote { - pub proposal: ::subxt::ext::sp_core::H256, + pub proposal: ::subxt::utils::H256, #[codec(compact)] pub index: ::core::primitive::u32, pub approve: ::core::primitive::bool, @@ -9802,7 +9801,7 @@ pub mod api { Debug, )] pub struct CloseOldWeight { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, #[codec(compact)] pub index: ::core::primitive::u32, #[codec(compact)] @@ -9816,7 +9815,7 @@ pub mod api { Debug, )] pub struct DisapproveProposal { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -9824,7 +9823,7 @@ pub mod api { Debug, )] pub struct Close { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, #[codec(compact)] pub index: ::core::primitive::u32, pub proposal_weight_bound: runtime_types::sp_weights::weight_v2::Weight, @@ -9867,11 +9866,9 @@ pub mod api { #[doc = "# "] pub fn set_members( &self, - new_members: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, - >, + new_members: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, prime: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, old_count: ::core::primitive::u32, ) -> ::subxt::tx::StaticTxPayload { @@ -9988,7 +9985,7 @@ pub mod api { #[doc = "# "] pub fn vote( &self, - proposal: ::subxt::ext::sp_core::H256, + proposal: ::subxt::utils::H256, index: ::core::primitive::u32, approve: ::core::primitive::bool, ) -> ::subxt::tx::StaticTxPayload { @@ -10042,7 +10039,7 @@ pub mod api { #[doc = "# "] pub fn close_old_weight( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, index: ::core::primitive::u32, proposal_weight_bound: runtime_types::sp_weights::OldWeight, length_bound: ::core::primitive::u32, @@ -10080,7 +10077,7 @@ pub mod api { #[doc = "# "] pub fn disapprove_proposal( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Council", @@ -10128,7 +10125,7 @@ pub mod api { #[doc = "# "] pub fn close( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, index: ::core::primitive::u32, proposal_weight_bound: runtime_types::sp_weights::weight_v2::Weight, length_bound: ::core::primitive::u32, @@ -10164,9 +10161,9 @@ pub mod api { #[doc = "A motion (given hash) has been proposed (by given account) with a threshold (given"] #[doc = "`MemberCount`)."] pub struct Proposed { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, pub proposal_index: ::core::primitive::u32, - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub threshold: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for Proposed { @@ -10181,8 +10178,8 @@ pub mod api { #[doc = "A motion (given hash) has been voted on by given account, leaving"] #[doc = "a tally (yes votes and no votes given respectively as `MemberCount`)."] pub struct Voted { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub account: ::subxt::utils::account_id::AccountId32, + pub proposal_hash: ::subxt::utils::H256, pub voted: ::core::primitive::bool, pub yes: ::core::primitive::u32, pub no: ::core::primitive::u32, @@ -10198,7 +10195,7 @@ pub mod api { )] #[doc = "A motion was approved by the required threshold."] pub struct Approved { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Approved { const PALLET: &'static str = "Council"; @@ -10211,7 +10208,7 @@ pub mod api { )] #[doc = "A motion was not approved by the required threshold."] pub struct Disapproved { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Disapproved { const PALLET: &'static str = "Council"; @@ -10224,7 +10221,7 @@ pub mod api { )] #[doc = "A motion was executed; result will be `Ok` if it returned without error."] pub struct Executed { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, } @@ -10239,7 +10236,7 @@ pub mod api { )] #[doc = "A single member did some action; result will be `Ok` if it returned without error."] pub struct MemberExecuted { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, } @@ -10254,7 +10251,7 @@ pub mod api { )] #[doc = "A proposal was closed because its threshold was reached or after its duration was up."] pub struct Closed { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub yes: ::core::primitive::u32, pub no: ::core::primitive::u32, } @@ -10273,7 +10270,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, >, ::subxt::storage::address::Yes, @@ -10295,7 +10292,7 @@ pub mod api { #[doc = " Actual proposal for a given hash, if it's current."] pub fn proposal_of( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_runtime::RuntimeCall, @@ -10345,11 +10342,11 @@ pub mod api { #[doc = " Votes on a given proposal, if it is ongoing."] pub fn voting( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_collective::Votes< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u32, >, >, @@ -10378,7 +10375,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_collective::Votes< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u32, >, >, @@ -10424,7 +10421,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, >, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -10447,7 +10444,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ::subxt::storage::address::Yes, (), @@ -10482,10 +10479,9 @@ pub mod api { Debug, )] pub struct SetMembers { - pub new_members: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub new_members: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, pub prime: - ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + ::core::option::Option<::subxt::utils::account_id::AccountId32>, pub old_count: ::core::primitive::u32, } #[derive( @@ -10518,7 +10514,7 @@ pub mod api { Debug, )] pub struct Vote { - pub proposal: ::subxt::ext::sp_core::H256, + pub proposal: ::subxt::utils::H256, #[codec(compact)] pub index: ::core::primitive::u32, pub approve: ::core::primitive::bool, @@ -10529,7 +10525,7 @@ pub mod api { Debug, )] pub struct CloseOldWeight { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, #[codec(compact)] pub index: ::core::primitive::u32, #[codec(compact)] @@ -10543,7 +10539,7 @@ pub mod api { Debug, )] pub struct DisapproveProposal { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10551,7 +10547,7 @@ pub mod api { Debug, )] pub struct Close { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, #[codec(compact)] pub index: ::core::primitive::u32, pub proposal_weight_bound: runtime_types::sp_weights::weight_v2::Weight, @@ -10594,11 +10590,9 @@ pub mod api { #[doc = "# "] pub fn set_members( &self, - new_members: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, - >, + new_members: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, prime: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, old_count: ::core::primitive::u32, ) -> ::subxt::tx::StaticTxPayload { @@ -10715,7 +10709,7 @@ pub mod api { #[doc = "# "] pub fn vote( &self, - proposal: ::subxt::ext::sp_core::H256, + proposal: ::subxt::utils::H256, index: ::core::primitive::u32, approve: ::core::primitive::bool, ) -> ::subxt::tx::StaticTxPayload { @@ -10769,7 +10763,7 @@ pub mod api { #[doc = "# "] pub fn close_old_weight( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, index: ::core::primitive::u32, proposal_weight_bound: runtime_types::sp_weights::OldWeight, length_bound: ::core::primitive::u32, @@ -10807,7 +10801,7 @@ pub mod api { #[doc = "# "] pub fn disapprove_proposal( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "TechnicalCommittee", @@ -10855,7 +10849,7 @@ pub mod api { #[doc = "# "] pub fn close( &self, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, index: ::core::primitive::u32, proposal_weight_bound: runtime_types::sp_weights::weight_v2::Weight, length_bound: ::core::primitive::u32, @@ -10891,9 +10885,9 @@ pub mod api { #[doc = "A motion (given hash) has been proposed (by given account) with a threshold (given"] #[doc = "`MemberCount`)."] pub struct Proposed { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, pub proposal_index: ::core::primitive::u32, - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub threshold: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for Proposed { @@ -10908,8 +10902,8 @@ pub mod api { #[doc = "A motion (given hash) has been voted on by given account, leaving"] #[doc = "a tally (yes votes and no votes given respectively as `MemberCount`)."] pub struct Voted { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub account: ::subxt::utils::account_id::AccountId32, + pub proposal_hash: ::subxt::utils::H256, pub voted: ::core::primitive::bool, pub yes: ::core::primitive::u32, pub no: ::core::primitive::u32, @@ -10925,7 +10919,7 @@ pub mod api { )] #[doc = "A motion was approved by the required threshold."] pub struct Approved { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Approved { const PALLET: &'static str = "TechnicalCommittee"; @@ -10938,7 +10932,7 @@ pub mod api { )] #[doc = "A motion was not approved by the required threshold."] pub struct Disapproved { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Disapproved { const PALLET: &'static str = "TechnicalCommittee"; @@ -10951,7 +10945,7 @@ pub mod api { )] #[doc = "A motion was executed; result will be `Ok` if it returned without error."] pub struct Executed { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, } @@ -10966,7 +10960,7 @@ pub mod api { )] #[doc = "A single member did some action; result will be `Ok` if it returned without error."] pub struct MemberExecuted { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, } @@ -10981,7 +10975,7 @@ pub mod api { )] #[doc = "A proposal was closed because its threshold was reached or after its duration was up."] pub struct Closed { - pub proposal_hash: ::subxt::ext::sp_core::H256, + pub proposal_hash: ::subxt::utils::H256, pub yes: ::core::primitive::u32, pub no: ::core::primitive::u32, } @@ -11000,7 +10994,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, >, ::subxt::storage::address::Yes, @@ -11022,7 +11016,7 @@ pub mod api { #[doc = " Actual proposal for a given hash, if it's current."] pub fn proposal_of( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_runtime::RuntimeCall, @@ -11072,11 +11066,11 @@ pub mod api { #[doc = " Votes on a given proposal, if it is ongoing."] pub fn voting( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_collective::Votes< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u32, >, >, @@ -11105,7 +11099,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_collective::Votes< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u32, >, >, @@ -11151,7 +11145,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, >, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -11174,7 +11168,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ::subxt::storage::address::Yes, (), @@ -11209,7 +11203,7 @@ pub mod api { Debug, )] pub struct Vote { - pub votes: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub votes: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, #[codec(compact)] pub value: ::core::primitive::u128, } @@ -11242,8 +11236,8 @@ pub mod api { Debug, )] pub struct RemoveMember { - pub who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub slash_bond: ::core::primitive::bool, @@ -11285,7 +11279,7 @@ pub mod api { #[doc = "# "] pub fn vote( &self, - votes: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + votes: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, value: ::core::primitive::u128, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -11403,8 +11397,8 @@ pub mod api { #[doc = "# "] pub fn remove_member( &self, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, slash_bond: ::core::primitive::bool, @@ -11474,7 +11468,7 @@ pub mod api { #[doc = "begin with."] pub struct NewTerm { pub new_members: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, )>, } @@ -11513,7 +11507,7 @@ pub mod api { #[doc = "A member has been removed. This should always be followed by either `NewTerm` or"] #[doc = "`EmptyTerm`."] pub struct MemberKicked { - pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub member: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for MemberKicked { const PALLET: &'static str = "PhragmenElection"; @@ -11526,7 +11520,7 @@ pub mod api { )] #[doc = "Someone has renounced their candidacy."] pub struct Renounced { - pub candidate: ::subxt::ext::sp_core::crypto::AccountId32, + pub candidate: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Renounced { const PALLET: &'static str = "PhragmenElection"; @@ -11542,7 +11536,7 @@ pub mod api { #[doc = ""] #[doc = "Note that old members and runners-up are also candidates."] pub struct CandidateSlashed { - pub candidate: ::subxt::ext::sp_core::crypto::AccountId32, + pub candidate: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for CandidateSlashed { @@ -11556,7 +11550,7 @@ pub mod api { )] #[doc = "A seat holder was slashed by amount by being forcefully removed from the set."] pub struct SeatHolderSlashed { - pub seat_holder: ::subxt::ext::sp_core::crypto::AccountId32, + pub seat_holder: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for SeatHolderSlashed { @@ -11577,7 +11571,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType< ::std::vec::Vec< runtime_types::pallet_elections_phragmen::SeatHolder< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -11608,7 +11602,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType< ::std::vec::Vec< runtime_types::pallet_elections_phragmen::SeatHolder< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -11640,7 +11634,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, )>, >, @@ -11686,11 +11680,11 @@ pub mod api { #[doc = " TWOX-NOTE: SAFE as `AccountId` is a crypto hash."] pub fn voting( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_elections_phragmen::Voter< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -11721,7 +11715,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_elections_phragmen::Voter< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -11929,8 +11923,8 @@ pub mod api { Debug, )] pub struct AddMember { - pub who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -11940,8 +11934,8 @@ pub mod api { Debug, )] pub struct RemoveMember { - pub who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -11951,12 +11945,12 @@ pub mod api { Debug, )] pub struct SwapMember { - pub remove: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub remove: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub add: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub add: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -11966,7 +11960,7 @@ pub mod api { Debug, )] pub struct ResetMembers { - pub members: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub members: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11974,8 +11968,8 @@ pub mod api { Debug, )] pub struct ChangeKey { - pub new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -11985,8 +11979,8 @@ pub mod api { Debug, )] pub struct SetPrime { - pub who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -12003,8 +11997,8 @@ pub mod api { #[doc = "May only be called from `T::AddOrigin`."] pub fn add_member( &self, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -12025,8 +12019,8 @@ pub mod api { #[doc = "May only be called from `T::RemoveOrigin`."] pub fn remove_member( &self, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -12049,12 +12043,12 @@ pub mod api { #[doc = "Prime membership is *not* passed from `remove` to `add`, if extant."] pub fn swap_member( &self, - remove: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + remove: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - add: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + add: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -12076,7 +12070,7 @@ pub mod api { #[doc = "May only be called from `T::ResetOrigin`."] pub fn reset_members( &self, - members: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + members: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "TechnicalMembership", @@ -12097,8 +12091,8 @@ pub mod api { #[doc = "Prime membership is passed from the origin account to `new`, if extant."] pub fn change_key( &self, - new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -12119,8 +12113,8 @@ pub mod api { #[doc = "May only be called from `T::PrimeOrigin`."] pub fn set_prime( &self, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -12235,7 +12229,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, >, ::subxt::storage::address::Yes, @@ -12259,7 +12253,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ::subxt::storage::address::Yes, (), @@ -12296,8 +12290,8 @@ pub mod api { pub struct ProposeSpend { #[codec(compact)] pub value: ::core::primitive::u128, - pub beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -12327,8 +12321,8 @@ pub mod api { pub struct Spend { #[codec(compact)] pub amount: ::core::primitive::u128, - pub beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -12355,8 +12349,8 @@ pub mod api { pub fn propose_spend( &self, value: ::core::primitive::u128, - beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -12434,8 +12428,8 @@ pub mod api { pub fn spend( &self, amount: ::core::primitive::u128, - beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -12528,7 +12522,7 @@ pub mod api { pub struct Awarded { pub proposal_index: ::core::primitive::u32, pub award: ::core::primitive::u128, - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Awarded { const PALLET: &'static str = "Treasury"; @@ -12599,7 +12593,7 @@ pub mod api { pub struct SpendApproved { pub proposal_index: ::core::primitive::u32, pub amount: ::core::primitive::u128, - pub beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for SpendApproved { const PALLET: &'static str = "Treasury"; @@ -12638,7 +12632,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_treasury::Proposal< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -12667,7 +12661,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_treasury::Proposal< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -12865,7 +12859,7 @@ pub mod api { Debug, )] pub struct Claim { - pub dest: ::subxt::ext::sp_core::crypto::AccountId32, + pub dest: ::subxt::utils::account_id::AccountId32, pub ethereum_signature: runtime_types::polkadot_runtime_common::claims::EcdsaSignature, } @@ -12892,7 +12886,7 @@ pub mod api { Debug, )] pub struct ClaimAttest { - pub dest: ::subxt::ext::sp_core::crypto::AccountId32, + pub dest: ::subxt::utils::account_id::AccountId32, pub ethereum_signature: runtime_types::polkadot_runtime_common::claims::EcdsaSignature, pub statement: ::std::vec::Vec<::core::primitive::u8>, @@ -12914,7 +12908,7 @@ pub mod api { pub old: runtime_types::polkadot_runtime_common::claims::EthereumAddress, pub new: runtime_types::polkadot_runtime_common::claims::EthereumAddress, pub maybe_preclaim: - ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + ::core::option::Option<::subxt::utils::account_id::AccountId32>, } pub struct TransactionApi; impl TransactionApi { @@ -12944,7 +12938,7 @@ pub mod api { #[doc = ""] pub fn claim( &self, - dest: ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::account_id::AccountId32, ethereum_signature : runtime_types :: polkadot_runtime_common :: claims :: EcdsaSignature, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -13035,7 +13029,7 @@ pub mod api { #[doc = ""] pub fn claim_attest( &self, - dest: ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::account_id::AccountId32, ethereum_signature : runtime_types :: polkadot_runtime_common :: claims :: EcdsaSignature, statement: ::std::vec::Vec<::core::primitive::u8>, ) -> ::subxt::tx::StaticTxPayload { @@ -13093,7 +13087,7 @@ pub mod api { old: runtime_types::polkadot_runtime_common::claims::EthereumAddress, new: runtime_types::polkadot_runtime_common::claims::EthereumAddress, maybe_preclaim: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -13125,7 +13119,7 @@ pub mod api { )] #[doc = "Someone claimed some DOTs."] pub struct Claimed { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub ethereum_address: runtime_types::polkadot_runtime_common::claims::EthereumAddress, pub amount: ::core::primitive::u128, @@ -13322,7 +13316,7 @@ pub mod api { #[doc = " Pre-claimed Ethereum accounts, by the Account ID that they are claimed to."] pub fn preclaims( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_runtime_common::claims::EthereumAddress, @@ -13416,8 +13410,8 @@ pub mod api { Debug, )] pub struct VestOther { - pub target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -13427,8 +13421,8 @@ pub mod api { Debug, )] pub struct VestedTransfer { - pub target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< @@ -13442,12 +13436,12 @@ pub mod api { Debug, )] pub struct ForceVestedTransfer { - pub source: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub source: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< @@ -13509,8 +13503,8 @@ pub mod api { #[doc = "# "] pub fn vest_other( &self, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -13545,8 +13539,8 @@ pub mod api { #[doc = "# "] pub fn vested_transfer( &self, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< @@ -13586,12 +13580,12 @@ pub mod api { #[doc = "# "] pub fn force_vested_transfer( &self, - source: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + source: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, schedule: runtime_types::pallet_vesting::vesting_info::VestingInfo< @@ -13670,7 +13664,7 @@ pub mod api { #[doc = "The amount vested has been updated. This could indicate a change in funds available."] #[doc = "The balance given is the amount which is left unvested (and thus locked)."] pub struct VestingUpdated { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, pub unvested: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for VestingUpdated { @@ -13684,7 +13678,7 @@ pub mod api { )] #[doc = "An \\[account\\] has become fully vested."] pub struct VestingCompleted { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for VestingCompleted { const PALLET: &'static str = "Vesting"; @@ -13698,7 +13692,7 @@ pub mod api { #[doc = " Information regarding the vesting of a given account."] pub fn vesting( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::sp_core::bounded::bounded_vec::BoundedVec< @@ -14153,8 +14147,8 @@ pub mod api { Debug, )] pub struct AddRegistrar { - pub account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -14175,7 +14169,7 @@ pub mod api { )] pub struct SetSubs { pub subs: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_identity::types::Data, )>, } @@ -14224,8 +14218,8 @@ pub mod api { pub struct SetAccountId { #[codec(compact)] pub index: ::core::primitive::u32, - pub new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -14249,14 +14243,14 @@ pub mod api { pub struct ProvideJudgement { #[codec(compact)] pub reg_index: ::core::primitive::u32, - pub target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub judgement: runtime_types::pallet_identity::types::Judgement< ::core::primitive::u128, >, - pub identity: ::subxt::ext::sp_core::H256, + pub identity: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -14264,8 +14258,8 @@ pub mod api { Debug, )] pub struct KillIdentity { - pub target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -14275,8 +14269,8 @@ pub mod api { Debug, )] pub struct AddSub { - pub sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub data: runtime_types::pallet_identity::types::Data, @@ -14287,8 +14281,8 @@ pub mod api { Debug, )] pub struct RenameSub { - pub sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub data: runtime_types::pallet_identity::types::Data, @@ -14299,8 +14293,8 @@ pub mod api { Debug, )] pub struct RemoveSub { - pub sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -14327,8 +14321,8 @@ pub mod api { #[doc = "# "] pub fn add_registrar( &self, - account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -14405,7 +14399,7 @@ pub mod api { pub fn set_subs( &self, subs: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_identity::types::Data, )>, ) -> ::subxt::tx::StaticTxPayload { @@ -14573,8 +14567,8 @@ pub mod api { pub fn set_account_id( &self, index: ::core::primitive::u32, - new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -14645,14 +14639,14 @@ pub mod api { pub fn provide_judgement( &self, reg_index: ::core::primitive::u32, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, judgement: runtime_types::pallet_identity::types::Judgement< ::core::primitive::u128, >, - identity: ::subxt::ext::sp_core::H256, + identity: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Identity", @@ -14692,8 +14686,8 @@ pub mod api { #[doc = "# "] pub fn kill_identity( &self, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -14718,8 +14712,8 @@ pub mod api { #[doc = "sub identity of `sub`."] pub fn add_sub( &self, - sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, data: runtime_types::pallet_identity::types::Data, @@ -14742,8 +14736,8 @@ pub mod api { #[doc = "sub identity of `sub`."] pub fn rename_sub( &self, - sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, data: runtime_types::pallet_identity::types::Data, @@ -14769,8 +14763,8 @@ pub mod api { #[doc = "sub identity of `sub`."] pub fn remove_sub( &self, - sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -14822,7 +14816,7 @@ pub mod api { )] #[doc = "A name was set or reset (which will remove all judgements)."] pub struct IdentitySet { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for IdentitySet { const PALLET: &'static str = "Identity"; @@ -14835,7 +14829,7 @@ pub mod api { )] #[doc = "A name was cleared, and the given balance returned."] pub struct IdentityCleared { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub deposit: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for IdentityCleared { @@ -14849,7 +14843,7 @@ pub mod api { )] #[doc = "A name was removed and the given balance slashed."] pub struct IdentityKilled { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub deposit: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for IdentityKilled { @@ -14863,7 +14857,7 @@ pub mod api { )] #[doc = "A judgement was asked from a registrar."] pub struct JudgementRequested { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub registrar_index: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for JudgementRequested { @@ -14877,7 +14871,7 @@ pub mod api { )] #[doc = "A judgement request was retracted."] pub struct JudgementUnrequested { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub registrar_index: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for JudgementUnrequested { @@ -14891,7 +14885,7 @@ pub mod api { )] #[doc = "A judgement was given by a registrar."] pub struct JudgementGiven { - pub target: ::subxt::ext::sp_core::crypto::AccountId32, + pub target: ::subxt::utils::account_id::AccountId32, pub registrar_index: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for JudgementGiven { @@ -14919,8 +14913,8 @@ pub mod api { )] #[doc = "A sub-identity was added to an identity and the deposit paid."] pub struct SubIdentityAdded { - pub sub: ::subxt::ext::sp_core::crypto::AccountId32, - pub main: ::subxt::ext::sp_core::crypto::AccountId32, + pub sub: ::subxt::utils::account_id::AccountId32, + pub main: ::subxt::utils::account_id::AccountId32, pub deposit: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for SubIdentityAdded { @@ -14934,8 +14928,8 @@ pub mod api { )] #[doc = "A sub-identity was removed from an identity and the deposit freed."] pub struct SubIdentityRemoved { - pub sub: ::subxt::ext::sp_core::crypto::AccountId32, - pub main: ::subxt::ext::sp_core::crypto::AccountId32, + pub sub: ::subxt::utils::account_id::AccountId32, + pub main: ::subxt::utils::account_id::AccountId32, pub deposit: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for SubIdentityRemoved { @@ -14950,8 +14944,8 @@ pub mod api { #[doc = "A sub-identity was cleared, and the given deposit repatriated from the"] #[doc = "main identity account to the sub-identity account."] pub struct SubIdentityRevoked { - pub sub: ::subxt::ext::sp_core::crypto::AccountId32, - pub main: ::subxt::ext::sp_core::crypto::AccountId32, + pub sub: ::subxt::utils::account_id::AccountId32, + pub main: ::subxt::utils::account_id::AccountId32, pub deposit: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for SubIdentityRevoked { @@ -14968,7 +14962,7 @@ pub mod api { #[doc = " TWOX-NOTE: OK ― `AccountId` is a secure hash."] pub fn identity_of( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_identity::types::Registration< @@ -15025,10 +15019,10 @@ pub mod api { #[doc = " context. If the account is not some other account's sub-identity, then just `None`."] pub fn super_of( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_identity::types::Data, )>, ::subxt::storage::address::Yes, @@ -15056,7 +15050,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_identity::types::Data, )>, (), @@ -15082,12 +15076,12 @@ pub mod api { #[doc = " TWOX-NOTE: OK ― `AccountId` is a secure hash."] pub fn subs_of( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( ::core::primitive::u128, runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, )>, ::subxt::storage::address::Yes, @@ -15120,7 +15114,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType<( ::core::primitive::u128, runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, )>, (), @@ -15151,7 +15145,7 @@ pub mod api { ::core::option::Option< runtime_types::pallet_identity::types::RegistrarInfo< ::core::primitive::u128, - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, >, >, @@ -15301,8 +15295,8 @@ pub mod api { Debug, )] pub struct Proxy { - pub real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub force_proxy_type: @@ -15315,8 +15309,8 @@ pub mod api { Debug, )] pub struct AddProxy { - pub delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -15328,8 +15322,8 @@ pub mod api { Debug, )] pub struct RemoveProxy { - pub delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -15357,8 +15351,8 @@ pub mod api { Debug, )] pub struct KillPure { - pub spawner: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub spawner: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -15374,11 +15368,11 @@ pub mod api { Debug, )] pub struct Announce { - pub real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub call_hash: ::subxt::ext::sp_core::H256, + pub call_hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -15386,11 +15380,11 @@ pub mod api { Debug, )] pub struct RemoveAnnouncement { - pub real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub call_hash: ::subxt::ext::sp_core::H256, + pub call_hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -15398,11 +15392,11 @@ pub mod api { Debug, )] pub struct RejectAnnouncement { - pub delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub call_hash: ::subxt::ext::sp_core::H256, + pub call_hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -15410,12 +15404,12 @@ pub mod api { Debug, )] pub struct ProxyAnnounced { - pub delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub force_proxy_type: @@ -15437,8 +15431,8 @@ pub mod api { #[doc = "- `call`: The call to be made by the `real` account."] pub fn proxy( &self, - real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, force_proxy_type: ::core::option::Option< @@ -15473,8 +15467,8 @@ pub mod api { #[doc = "zero."] pub fn add_proxy( &self, - delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -15505,8 +15499,8 @@ pub mod api { #[doc = "- `proxy_type`: The permissions currently enabled for the removed proxy account."] pub fn remove_proxy( &self, - delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -15607,8 +15601,8 @@ pub mod api { #[doc = "account whose `pure` call has corresponding parameters."] pub fn kill_pure( &self, - spawner: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + spawner: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -15651,11 +15645,11 @@ pub mod api { #[doc = "- `call_hash`: The hash of the call to be made by the `real` account."] pub fn announce( &self, - real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - call_hash: ::subxt::ext::sp_core::H256, + call_hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Proxy", @@ -15681,11 +15675,11 @@ pub mod api { #[doc = "- `call_hash`: The hash of the call to be made by the `real` account."] pub fn remove_announcement( &self, - real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - call_hash: ::subxt::ext::sp_core::H256, + call_hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Proxy", @@ -15711,11 +15705,11 @@ pub mod api { #[doc = "- `call_hash`: The hash of the call to be made."] pub fn reject_announcement( &self, - delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - call_hash: ::subxt::ext::sp_core::H256, + call_hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Proxy", @@ -15745,12 +15739,12 @@ pub mod api { #[doc = "- `call`: The call to be made by the `real` account."] pub fn proxy_announced( &self, - delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, force_proxy_type: ::core::option::Option< @@ -15803,8 +15797,8 @@ pub mod api { #[doc = "A pure account has been created by new proxy with given"] #[doc = "disambiguation index and proxy type."] pub struct PureCreated { - pub pure: ::subxt::ext::sp_core::crypto::AccountId32, - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub pure: ::subxt::utils::account_id::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub proxy_type: runtime_types::polkadot_runtime::ProxyType, pub disambiguation_index: ::core::primitive::u16, } @@ -15819,9 +15813,9 @@ pub mod api { )] #[doc = "An announcement was placed to make a call in the future."] pub struct Announced { - pub real: ::subxt::ext::sp_core::crypto::AccountId32, - pub proxy: ::subxt::ext::sp_core::crypto::AccountId32, - pub call_hash: ::subxt::ext::sp_core::H256, + pub real: ::subxt::utils::account_id::AccountId32, + pub proxy: ::subxt::utils::account_id::AccountId32, + pub call_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for Announced { const PALLET: &'static str = "Proxy"; @@ -15834,8 +15828,8 @@ pub mod api { )] #[doc = "A proxy was added."] pub struct ProxyAdded { - pub delegator: ::subxt::ext::sp_core::crypto::AccountId32, - pub delegatee: ::subxt::ext::sp_core::crypto::AccountId32, + pub delegator: ::subxt::utils::account_id::AccountId32, + pub delegatee: ::subxt::utils::account_id::AccountId32, pub proxy_type: runtime_types::polkadot_runtime::ProxyType, pub delay: ::core::primitive::u32, } @@ -15850,8 +15844,8 @@ pub mod api { )] #[doc = "A proxy was removed."] pub struct ProxyRemoved { - pub delegator: ::subxt::ext::sp_core::crypto::AccountId32, - pub delegatee: ::subxt::ext::sp_core::crypto::AccountId32, + pub delegator: ::subxt::utils::account_id::AccountId32, + pub delegatee: ::subxt::utils::account_id::AccountId32, pub proxy_type: runtime_types::polkadot_runtime::ProxyType, pub delay: ::core::primitive::u32, } @@ -15868,12 +15862,12 @@ pub mod api { #[doc = " which are being delegated to, together with the amount held on deposit."] pub fn proxies( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( runtime_types::sp_core::bounded::bounded_vec::BoundedVec< runtime_types::pallet_proxy::ProxyDefinition< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::polkadot_runtime::ProxyType, ::core::primitive::u32, >, @@ -15907,7 +15901,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType<( runtime_types::sp_core::bounded::bounded_vec::BoundedVec< runtime_types::pallet_proxy::ProxyDefinition< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::polkadot_runtime::ProxyType, ::core::primitive::u32, >, @@ -15933,13 +15927,13 @@ pub mod api { #[doc = " The announcements made by the proxy (key)."] pub fn announcements( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<( runtime_types::sp_core::bounded::bounded_vec::BoundedVec< runtime_types::pallet_proxy::Announcement< - ::subxt::ext::sp_core::crypto::AccountId32, - ::subxt::ext::sp_core::H256, + ::subxt::utils::account_id::AccountId32, + ::subxt::utils::H256, ::core::primitive::u32, >, >, @@ -15971,8 +15965,8 @@ pub mod api { ::subxt::metadata::DecodeStaticType<( runtime_types::sp_core::bounded::bounded_vec::BoundedVec< runtime_types::pallet_proxy::Announcement< - ::subxt::ext::sp_core::crypto::AccountId32, - ::subxt::ext::sp_core::H256, + ::subxt::utils::account_id::AccountId32, + ::subxt::utils::H256, ::core::primitive::u32, >, >, @@ -16133,7 +16127,7 @@ pub mod api { )] pub struct AsMultiThreshold1 { pub other_signatories: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, pub call: ::std::boxed::Box, } #[derive( @@ -16144,7 +16138,7 @@ pub mod api { pub struct AsMulti { pub threshold: ::core::primitive::u16, pub other_signatories: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, pub maybe_timepoint: ::core::option::Option< runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, >, @@ -16159,7 +16153,7 @@ pub mod api { pub struct ApproveAsMulti { pub threshold: ::core::primitive::u16, pub other_signatories: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, pub maybe_timepoint: ::core::option::Option< runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, >, @@ -16174,7 +16168,7 @@ pub mod api { pub struct CancelAsMulti { pub threshold: ::core::primitive::u16, pub other_signatories: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, pub timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, pub call_hash: [::core::primitive::u8; 32usize], @@ -16200,7 +16194,7 @@ pub mod api { pub fn as_multi_threshold_1( &self, other_signatories: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, call: runtime_types::polkadot_runtime::RuntimeCall, ) -> ::subxt::tx::StaticTxPayload { @@ -16268,7 +16262,7 @@ pub mod api { &self, threshold: ::core::primitive::u16, other_signatories: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, maybe_timepoint: ::core::option::Option< runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, @@ -16333,7 +16327,7 @@ pub mod api { &self, threshold: ::core::primitive::u16, other_signatories: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, maybe_timepoint: ::core::option::Option< runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, @@ -16389,7 +16383,7 @@ pub mod api { &self, threshold: ::core::primitive::u16, other_signatories: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, timepoint: runtime_types::pallet_multisig::Timepoint< ::core::primitive::u32, @@ -16426,8 +16420,8 @@ pub mod api { )] #[doc = "A new multisig operation has begun."] pub struct NewMultisig { - pub approving: ::subxt::ext::sp_core::crypto::AccountId32, - pub multisig: ::subxt::ext::sp_core::crypto::AccountId32, + pub approving: ::subxt::utils::account_id::AccountId32, + pub multisig: ::subxt::utils::account_id::AccountId32, pub call_hash: [::core::primitive::u8; 32usize], } impl ::subxt::events::StaticEvent for NewMultisig { @@ -16441,10 +16435,10 @@ pub mod api { )] #[doc = "A multisig operation has been approved by someone."] pub struct MultisigApproval { - pub approving: ::subxt::ext::sp_core::crypto::AccountId32, + pub approving: ::subxt::utils::account_id::AccountId32, pub timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, - pub multisig: ::subxt::ext::sp_core::crypto::AccountId32, + pub multisig: ::subxt::utils::account_id::AccountId32, pub call_hash: [::core::primitive::u8; 32usize], } impl ::subxt::events::StaticEvent for MultisigApproval { @@ -16458,10 +16452,10 @@ pub mod api { )] #[doc = "A multisig operation has been executed."] pub struct MultisigExecuted { - pub approving: ::subxt::ext::sp_core::crypto::AccountId32, + pub approving: ::subxt::utils::account_id::AccountId32, pub timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, - pub multisig: ::subxt::ext::sp_core::crypto::AccountId32, + pub multisig: ::subxt::utils::account_id::AccountId32, pub call_hash: [::core::primitive::u8; 32usize], pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, @@ -16477,10 +16471,10 @@ pub mod api { )] #[doc = "A multisig operation has been cancelled."] pub struct MultisigCancelled { - pub cancelling: ::subxt::ext::sp_core::crypto::AccountId32, + pub cancelling: ::subxt::utils::account_id::AccountId32, pub timepoint: runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, - pub multisig: ::subxt::ext::sp_core::crypto::AccountId32, + pub multisig: ::subxt::utils::account_id::AccountId32, pub call_hash: [::core::primitive::u8; 32usize], } impl ::subxt::events::StaticEvent for MultisigCancelled { @@ -16495,14 +16489,14 @@ pub mod api { #[doc = " The set of open multisig operations."] pub fn multisigs( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, _1: impl ::std::borrow::Borrow<[::core::primitive::u8; 32usize]>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_multisig::Multisig< ::core::primitive::u32, ::core::primitive::u128, - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, >, ::subxt::storage::address::Yes, @@ -16519,7 +16513,7 @@ pub mod api { runtime_types::pallet_multisig::Multisig< ::core::primitive::u32, ::core::primitive::u128, - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, >, (), @@ -16640,8 +16634,8 @@ pub mod api { pub struct ProposeCurator { #[codec(compact)] pub bounty_id: ::core::primitive::u32, - pub curator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub curator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -16673,8 +16667,8 @@ pub mod api { pub struct AwardBounty { #[codec(compact)] pub bounty_id: ::core::primitive::u32, - pub beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -16771,8 +16765,8 @@ pub mod api { pub fn propose_curator( &self, bounty_id: ::core::primitive::u32, - curator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + curator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, fee: ::core::primitive::u128, @@ -16865,8 +16859,8 @@ pub mod api { pub fn award_bounty( &self, bounty_id: ::core::primitive::u32, - beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -17019,7 +17013,7 @@ pub mod api { #[doc = "A bounty is awarded to a beneficiary."] pub struct BountyAwarded { pub index: ::core::primitive::u32, - pub beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for BountyAwarded { const PALLET: &'static str = "Bounties"; @@ -17034,7 +17028,7 @@ pub mod api { pub struct BountyClaimed { pub index: ::core::primitive::u32, pub payout: ::core::primitive::u128, - pub beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for BountyClaimed { const PALLET: &'static str = "Bounties"; @@ -17101,7 +17095,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_bounties::Bounty< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::u32, >, @@ -17131,7 +17125,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_bounties::Bounty< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::u32, >, @@ -17434,8 +17428,8 @@ pub mod api { pub parent_bounty_id: ::core::primitive::u32, #[codec(compact)] pub child_bounty_id: ::core::primitive::u32, - pub curator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub curator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -17473,8 +17467,8 @@ pub mod api { pub parent_bounty_id: ::core::primitive::u32, #[codec(compact)] pub child_bounty_id: ::core::primitive::u32, - pub beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -17562,8 +17556,8 @@ pub mod api { &self, parent_bounty_id: ::core::primitive::u32, child_bounty_id: ::core::primitive::u32, - curator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + curator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, fee: ::core::primitive::u128, @@ -17699,8 +17693,8 @@ pub mod api { &self, parent_bounty_id: ::core::primitive::u32, child_bounty_id: ::core::primitive::u32, - beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -17827,7 +17821,7 @@ pub mod api { pub struct Awarded { pub index: ::core::primitive::u32, pub child_index: ::core::primitive::u32, - pub beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Awarded { const PALLET: &'static str = "ChildBounties"; @@ -17843,7 +17837,7 @@ pub mod api { pub index: ::core::primitive::u32, pub child_index: ::core::primitive::u32, pub payout: ::core::primitive::u128, - pub beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + pub beneficiary: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Claimed { const PALLET: &'static str = "ChildBounties"; @@ -17945,7 +17939,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_child_bounties::ChildBounty< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::u32, >, @@ -17981,7 +17975,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_child_bounties::ChildBounty< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::u32, >, @@ -18160,8 +18154,8 @@ pub mod api { )] pub struct ReportAwesome { pub reason: ::std::vec::Vec<::core::primitive::u8>, - pub who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -18171,7 +18165,7 @@ pub mod api { Debug, )] pub struct RetractTip { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -18180,8 +18174,8 @@ pub mod api { )] pub struct TipNew { pub reason: ::std::vec::Vec<::core::primitive::u8>, - pub who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -18193,7 +18187,7 @@ pub mod api { Debug, )] pub struct Tip { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, #[codec(compact)] pub tip_value: ::core::primitive::u128, } @@ -18203,7 +18197,7 @@ pub mod api { Debug, )] pub struct CloseTip { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -18211,7 +18205,7 @@ pub mod api { Debug, )] pub struct SlashTip { - pub hash: ::subxt::ext::sp_core::H256, + pub hash: ::subxt::utils::H256, } pub struct TransactionApi; impl TransactionApi { @@ -18237,8 +18231,8 @@ pub mod api { pub fn report_awesome( &self, reason: ::std::vec::Vec<::core::primitive::u8>, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -18275,7 +18269,7 @@ pub mod api { #[doc = "# "] pub fn retract_tip( &self, - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Tips", @@ -18314,8 +18308,8 @@ pub mod api { pub fn tip_new( &self, reason: ::std::vec::Vec<::core::primitive::u8>, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, tip_value: ::core::primitive::u128, @@ -18362,7 +18356,7 @@ pub mod api { #[doc = "# "] pub fn tip( &self, - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, tip_value: ::core::primitive::u128, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -18395,7 +18389,7 @@ pub mod api { #[doc = "# "] pub fn close_tip( &self, - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Tips", @@ -18423,7 +18417,7 @@ pub mod api { #[doc = "# "] pub fn slash_tip( &self, - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "Tips", @@ -18450,7 +18444,7 @@ pub mod api { )] #[doc = "A new tip suggestion has been opened."] pub struct NewTip { - pub tip_hash: ::subxt::ext::sp_core::H256, + pub tip_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for NewTip { const PALLET: &'static str = "Tips"; @@ -18463,7 +18457,7 @@ pub mod api { )] #[doc = "A tip suggestion has reached threshold and is closing."] pub struct TipClosing { - pub tip_hash: ::subxt::ext::sp_core::H256, + pub tip_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for TipClosing { const PALLET: &'static str = "Tips"; @@ -18476,8 +18470,8 @@ pub mod api { )] #[doc = "A tip suggestion has been closed."] pub struct TipClosed { - pub tip_hash: ::subxt::ext::sp_core::H256, - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub tip_hash: ::subxt::utils::H256, + pub who: ::subxt::utils::account_id::AccountId32, pub payout: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for TipClosed { @@ -18491,7 +18485,7 @@ pub mod api { )] #[doc = "A tip suggestion has been retracted."] pub struct TipRetracted { - pub tip_hash: ::subxt::ext::sp_core::H256, + pub tip_hash: ::subxt::utils::H256, } impl ::subxt::events::StaticEvent for TipRetracted { const PALLET: &'static str = "Tips"; @@ -18504,8 +18498,8 @@ pub mod api { )] #[doc = "A tip suggestion has been slashed."] pub struct TipSlashed { - pub tip_hash: ::subxt::ext::sp_core::H256, - pub finder: ::subxt::ext::sp_core::crypto::AccountId32, + pub tip_hash: ::subxt::utils::H256, + pub finder: ::subxt::utils::account_id::AccountId32, pub deposit: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for TipSlashed { @@ -18522,14 +18516,14 @@ pub mod api { #[doc = " guaranteed to be a secure hash."] pub fn tips( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_tips::OpenTip< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::u32, - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, >, ::subxt::storage::address::Yes, @@ -18559,10 +18553,10 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_tips::OpenTip< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::u32, - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, >, (), @@ -18585,7 +18579,7 @@ pub mod api { #[doc = " insecure enumerable hash since the key is guaranteed to be the result of a secure hash."] pub fn reasons( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< ::std::vec::Vec<::core::primitive::u8>, @@ -18762,9 +18756,9 @@ pub mod api { )] pub struct SetEmergencyElectionResult { pub supports: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::sp_npos_elections::Support< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, )>, } @@ -18860,9 +18854,9 @@ pub mod api { pub fn set_emergency_election_result( &self, supports: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::sp_npos_elections::Support< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, )>, ) -> ::subxt::tx::StaticTxPayload @@ -18992,7 +18986,7 @@ pub mod api { )] #[doc = "An account has been rewarded for their signed submission being finalized."] pub struct Rewarded { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, pub value: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Rewarded { @@ -19006,7 +19000,7 @@ pub mod api { )] #[doc = "An account has been slashed for submitting an invalid signed submission."] pub struct Slashed { - pub account: ::subxt::ext::sp_core::crypto::AccountId32, + pub account: ::subxt::utils::account_id::AccountId32, pub value: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Slashed { @@ -19230,7 +19224,7 @@ pub mod api { #[doc = " allowing us to keep only a single one in memory at a time."] #[doc = ""] #[doc = " Twox note: the key of the map is an auto-incrementing index which users cannot inspect or"] - #[doc = " affect; we shouldn't need a cryptographically secure hasher."] pub fn signed_submissions_map (& self , _0 : impl :: std :: borrow :: Borrow < :: core :: primitive :: u32 > ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: pallet_election_provider_multi_phase :: signed :: SignedSubmission < :: subxt :: ext :: sp_core :: crypto :: AccountId32 , :: core :: primitive :: u128 , runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , :: subxt :: storage :: address :: Yes , () , :: subxt :: storage :: address :: Yes >{ + #[doc = " affect; we shouldn't need a cryptographically secure hasher."] pub fn signed_submissions_map (& self , _0 : impl :: std :: borrow :: Borrow < :: core :: primitive :: u32 > ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: pallet_election_provider_multi_phase :: signed :: SignedSubmission < :: subxt :: utils :: account_id :: AccountId32 , :: core :: primitive :: u128 , runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , :: subxt :: storage :: address :: Yes , () , :: subxt :: storage :: address :: Yes >{ ::subxt::storage::address::StaticStorageAddress::new( "ElectionProviderMultiPhase", "SignedSubmissionsMap", @@ -19252,7 +19246,7 @@ pub mod api { #[doc = " allowing us to keep only a single one in memory at a time."] #[doc = ""] #[doc = " Twox note: the key of the map is an auto-incrementing index which users cannot inspect or"] - #[doc = " affect; we shouldn't need a cryptographically secure hasher."] pub fn signed_submissions_map_root (& self ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: pallet_election_provider_multi_phase :: signed :: SignedSubmission < :: subxt :: ext :: sp_core :: crypto :: AccountId32 , :: core :: primitive :: u128 , runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , () , () , :: subxt :: storage :: address :: Yes >{ + #[doc = " affect; we shouldn't need a cryptographically secure hasher."] pub fn signed_submissions_map_root (& self ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: pallet_election_provider_multi_phase :: signed :: SignedSubmission < :: subxt :: utils :: account_id :: AccountId32 , :: core :: primitive :: u128 , runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , () , () , :: subxt :: storage :: address :: Yes >{ ::subxt::storage::address::StaticStorageAddress::new( "ElectionProviderMultiPhase", "SignedSubmissionsMap", @@ -19662,8 +19656,8 @@ pub mod api { Debug, )] pub struct Rebag { - pub dislocated: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub dislocated: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -19673,8 +19667,8 @@ pub mod api { Debug, )] pub struct PutInFrontOf { - pub lighter: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub lighter: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -19692,8 +19686,8 @@ pub mod api { #[doc = "If `dislocated` does not exists, it returns an error."] pub fn rebag( &self, - dislocated: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dislocated: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -19719,8 +19713,8 @@ pub mod api { #[doc = "- and `origin` has a greater `Score` than `lighter`."] pub fn put_in_front_of( &self, - lighter: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + lighter: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -19749,7 +19743,7 @@ pub mod api { )] #[doc = "Moved an account from one bag to another."] pub struct Rebagged { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub from: ::core::primitive::u64, pub to: ::core::primitive::u64, } @@ -19764,7 +19758,7 @@ pub mod api { )] #[doc = "Updated the score of some account to the given amount."] pub struct ScoreUpdated { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub new_score: ::core::primitive::u64, } impl ::subxt::events::StaticEvent for ScoreUpdated { @@ -19781,7 +19775,7 @@ pub mod api { #[doc = " Nodes store links forward and back within their respective bags."] pub fn list_nodes( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_bags_list::list::Node, @@ -20015,8 +20009,8 @@ pub mod api { Debug, )] pub struct Unbond { - pub member_account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub member_account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -20037,8 +20031,8 @@ pub mod api { Debug, )] pub struct WithdrawUnbonded { - pub member_account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub member_account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub num_slashing_spans: ::core::primitive::u32, @@ -20051,16 +20045,16 @@ pub mod api { pub struct Create { #[codec(compact)] pub amount: ::core::primitive::u128, - pub root: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub root: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub nominator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub nominator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub state_toggler: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub state_toggler: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, } @@ -20072,16 +20066,16 @@ pub mod api { pub struct CreateWithPoolId { #[codec(compact)] pub amount: ::core::primitive::u128, - pub root: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub root: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub nominator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub nominator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - pub state_toggler: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + pub state_toggler: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pub pool_id: ::core::primitive::u32, @@ -20093,8 +20087,7 @@ pub mod api { )] pub struct Nominate { pub pool_id: ::core::primitive::u32, - pub validators: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub validators: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -20145,13 +20138,13 @@ pub mod api { pub struct UpdateRoles { pub pool_id: ::core::primitive::u32, pub new_root: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, pub new_nominator: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, pub new_state_toggler: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, } #[derive( @@ -20265,8 +20258,8 @@ pub mod api { #[doc = "`NoMoreChunks` error from the staking system."] pub fn unbond( &self, - member_account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + member_account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, unbonding_points: ::core::primitive::u128, @@ -20333,8 +20326,8 @@ pub mod api { #[doc = "If the target is the depositor, the pool will be destroyed."] pub fn withdraw_unbonded( &self, - member_account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + member_account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, num_slashing_spans: ::core::primitive::u32, @@ -20374,16 +20367,16 @@ pub mod api { pub fn create( &self, amount: ::core::primitive::u128, - root: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + root: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - nominator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + nominator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - state_toggler: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + state_toggler: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, ) -> ::subxt::tx::StaticTxPayload { @@ -20413,16 +20406,16 @@ pub mod api { pub fn create_with_pool_id( &self, amount: ::core::primitive::u128, - root: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + root: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - nominator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + nominator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - state_toggler: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + state_toggler: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pool_id: ::core::primitive::u32, @@ -20455,9 +20448,7 @@ pub mod api { pub fn nominate( &self, pool_id: ::core::primitive::u32, - validators: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, - >, + validators: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( "NominationPools", @@ -20577,13 +20568,13 @@ pub mod api { &self, pool_id: ::core::primitive::u32, new_root: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, new_nominator: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, new_state_toggler: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -20639,7 +20630,7 @@ pub mod api { )] #[doc = "A pool has been created."] pub struct Created { - pub depositor: ::subxt::ext::sp_core::crypto::AccountId32, + pub depositor: ::subxt::utils::account_id::AccountId32, pub pool_id: ::core::primitive::u32, } impl ::subxt::events::StaticEvent for Created { @@ -20653,7 +20644,7 @@ pub mod api { )] #[doc = "A member has became bonded in a pool."] pub struct Bonded { - pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub member: ::subxt::utils::account_id::AccountId32, pub pool_id: ::core::primitive::u32, pub bonded: ::core::primitive::u128, pub joined: ::core::primitive::bool, @@ -20669,7 +20660,7 @@ pub mod api { )] #[doc = "A payout has been made to a member."] pub struct PaidOut { - pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub member: ::subxt::utils::account_id::AccountId32, pub pool_id: ::core::primitive::u32, pub payout: ::core::primitive::u128, } @@ -20694,7 +20685,7 @@ pub mod api { #[doc = "number of points that are issued in the unbonding pool will be less than the amount"] #[doc = "requested to be unbonded."] pub struct Unbonded { - pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub member: ::subxt::utils::account_id::AccountId32, pub pool_id: ::core::primitive::u32, pub balance: ::core::primitive::u128, pub points: ::core::primitive::u128, @@ -20716,7 +20707,7 @@ pub mod api { #[doc = "Similar to `Unbonded` event, in the absence of slashing, the ratio of point to balance"] #[doc = "will be 1."] pub struct Withdrawn { - pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub member: ::subxt::utils::account_id::AccountId32, pub pool_id: ::core::primitive::u32, pub balance: ::core::primitive::u128, pub points: ::core::primitive::u128, @@ -20763,7 +20754,7 @@ pub mod api { #[doc = "The removal can be voluntary (withdrawn all unbonded funds) or involuntary (kicked)."] pub struct MemberRemoved { pub pool_id: ::core::primitive::u32, - pub member: ::subxt::ext::sp_core::crypto::AccountId32, + pub member: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for MemberRemoved { const PALLET: &'static str = "NominationPools"; @@ -20777,12 +20768,11 @@ pub mod api { #[doc = "The roles of a pool have been updated to the given new roles. Note that the depositor"] #[doc = "can never change."] pub struct RolesUpdated { - pub root: - ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + pub root: ::core::option::Option<::subxt::utils::account_id::AccountId32>, pub state_toggler: - ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + ::core::option::Option<::subxt::utils::account_id::AccountId32>, pub nominator: - ::core::option::Option<::subxt::ext::sp_core::crypto::AccountId32>, + ::core::option::Option<::subxt::utils::account_id::AccountId32>, } impl ::subxt::events::StaticEvent for RolesUpdated { const PALLET: &'static str = "NominationPools"; @@ -20939,7 +20929,7 @@ pub mod api { #[doc = " Active members."] pub fn pool_members( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::pallet_nomination_pools::PoolMember, @@ -21326,7 +21316,7 @@ pub mod api { #[doc = " accounts are deterministically derived from it."] pub fn reverse_pool_id_lookup( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, ::subxt::storage::address::Yes, @@ -21567,7 +21557,7 @@ pub mod api { )] #[doc = "A staker was unstaked."] pub struct Unstaked { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub result: ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, } @@ -21582,7 +21572,7 @@ pub mod api { )] #[doc = "A staker was slashed for requesting fast-unstake whilst being exposed."] pub struct Slashed { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Slashed { @@ -21597,7 +21587,7 @@ pub mod api { #[doc = "Some internal error happened while migrating stash. They are removed as head as a"] #[doc = "consequence."] pub struct Errored { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Errored { const PALLET: &'static str = "FastUnstake"; @@ -21674,7 +21664,7 @@ pub mod api { #[doc = " Keeps track of `AccountId` wishing to unstake and it's corresponding deposit."] pub fn queue( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<::core::primitive::u128>, ::subxt::storage::address::Yes, @@ -23161,7 +23151,7 @@ pub mod api { #[doc = "A candidate was backed. `[candidate, head_data]`"] pub struct CandidateBacked( pub runtime_types::polkadot_primitives::v2::CandidateReceipt< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, pub runtime_types::polkadot_parachain::primitives::HeadData, pub runtime_types::polkadot_primitives::v2::CoreIndex, @@ -23179,7 +23169,7 @@ pub mod api { #[doc = "A candidate was included. `[candidate, head_data]`"] pub struct CandidateIncluded( pub runtime_types::polkadot_primitives::v2::CandidateReceipt< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, pub runtime_types::polkadot_parachain::primitives::HeadData, pub runtime_types::polkadot_primitives::v2::CoreIndex, @@ -23197,7 +23187,7 @@ pub mod api { #[doc = "A candidate timed out. `[candidate, head_data]`"] pub struct CandidateTimedOut( pub runtime_types::polkadot_primitives::v2::CandidateReceipt< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, pub runtime_types::polkadot_parachain::primitives::HeadData, pub runtime_types::polkadot_primitives::v2::CoreIndex, @@ -23240,7 +23230,7 @@ pub mod api { ], ) } - #[doc = " Candidates pending availability by `ParaId`."] pub fn pending_availability (& self , _0 : impl :: std :: borrow :: Borrow < runtime_types :: polkadot_parachain :: primitives :: Id > ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: polkadot_runtime_parachains :: inclusion :: CandidatePendingAvailability < :: subxt :: ext :: sp_core :: H256 , :: core :: primitive :: u32 > > , :: subxt :: storage :: address :: Yes , () , :: subxt :: storage :: address :: Yes >{ + #[doc = " Candidates pending availability by `ParaId`."] pub fn pending_availability (& self , _0 : impl :: std :: borrow :: Borrow < runtime_types :: polkadot_parachain :: primitives :: Id > ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: polkadot_runtime_parachains :: inclusion :: CandidatePendingAvailability < :: subxt :: utils :: H256 , :: core :: primitive :: u32 > > , :: subxt :: storage :: address :: Yes , () , :: subxt :: storage :: address :: Yes >{ ::subxt::storage::address::StaticStorageAddress::new( "ParaInclusion", "PendingAvailability", @@ -23256,7 +23246,7 @@ pub mod api { ], ) } - #[doc = " Candidates pending availability by `ParaId`."] pub fn pending_availability_root (& self ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: polkadot_runtime_parachains :: inclusion :: CandidatePendingAvailability < :: subxt :: ext :: sp_core :: H256 , :: core :: primitive :: u32 > > , () , () , :: subxt :: storage :: address :: Yes >{ + #[doc = " Candidates pending availability by `ParaId`."] pub fn pending_availability_root (& self ,) -> :: subxt :: storage :: address :: StaticStorageAddress :: < :: subxt :: metadata :: DecodeStaticType < runtime_types :: polkadot_runtime_parachains :: inclusion :: CandidatePendingAvailability < :: subxt :: utils :: H256 , :: core :: primitive :: u32 > > , () , () , :: subxt :: storage :: address :: Yes >{ ::subxt::storage::address::StaticStorageAddress::new( "ParaInclusion", "PendingAvailability", @@ -23411,7 +23401,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_primitives::v2::ScrapedOnChainVotes< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, >, ::subxt::storage::address::Yes, @@ -25005,7 +24995,7 @@ pub mod api { runtime_types::polkadot_parachain::primitives::Id, >, ) -> ::subxt::storage::address::StaticStorageAddress< - ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::H256>, + ::subxt::metadata::DecodeStaticType<::subxt::utils::H256>, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -25035,7 +25025,7 @@ pub mod api { pub fn downward_message_queue_heads_root( &self, ) -> ::subxt::storage::address::StaticStorageAddress< - ::subxt::metadata::DecodeStaticType<::subxt::ext::sp_core::H256>, + ::subxt::metadata::DecodeStaticType<::subxt::utils::H256>, (), ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, @@ -26608,7 +26598,7 @@ pub mod api { _0: impl ::std::borrow::Borrow<::core::primitive::u32>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, >, ::subxt::storage::address::Yes, (), @@ -26634,7 +26624,7 @@ pub mod api { &self, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, >, (), (), @@ -26972,7 +26962,7 @@ pub mod api { Debug, )] pub struct ForceRegister { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub deposit: ::core::primitive::u128, pub id: runtime_types::polkadot_parachain::primitives::Id, pub genesis_head: runtime_types::polkadot_parachain::primitives::HeadData, @@ -27083,7 +27073,7 @@ pub mod api { #[doc = "can be registered, including sub-1000 IDs which are System Parachains."] pub fn force_register( &self, - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, deposit: ::core::primitive::u128, id: runtime_types::polkadot_parachain::primitives::Id, genesis_head: runtime_types::polkadot_parachain::primitives::HeadData, @@ -27275,7 +27265,7 @@ pub mod api { )] pub struct Registered { pub para_id: runtime_types::polkadot_parachain::primitives::Id, - pub manager: ::subxt::ext::sp_core::crypto::AccountId32, + pub manager: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Registered { const PALLET: &'static str = "Registrar"; @@ -27300,7 +27290,7 @@ pub mod api { )] pub struct Reserved { pub para_id: runtime_types::polkadot_parachain::primitives::Id, - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, } impl ::subxt::events::StaticEvent for Reserved { const PALLET: &'static str = "Registrar"; @@ -27375,7 +27365,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_runtime_common::paras_registrar::ParaInfo< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -27407,7 +27397,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_runtime_common::paras_registrar::ParaInfo< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, >, @@ -27509,7 +27499,7 @@ pub mod api { )] pub struct ForceLease { pub para: runtime_types::polkadot_parachain::primitives::Id, - pub leaser: ::subxt::ext::sp_core::crypto::AccountId32, + pub leaser: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, pub period_begin: ::core::primitive::u32, pub period_count: ::core::primitive::u32, @@ -27539,7 +27529,7 @@ pub mod api { pub fn force_lease( &self, para: runtime_types::polkadot_parachain::primitives::Id, - leaser: ::subxt::ext::sp_core::crypto::AccountId32, + leaser: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, period_begin: ::core::primitive::u32, period_count: ::core::primitive::u32, @@ -27634,7 +27624,7 @@ pub mod api { #[doc = "Second balance is the total amount reserved."] pub struct Leased { pub para_id: runtime_types::polkadot_parachain::primitives::Id, - pub leaser: ::subxt::ext::sp_core::crypto::AccountId32, + pub leaser: ::subxt::utils::account_id::AccountId32, pub period_begin: ::core::primitive::u32, pub period_count: ::core::primitive::u32, pub extra_reserved: ::core::primitive::u128, @@ -27674,7 +27664,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType< ::std::vec::Vec< ::core::option::Option<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, )>, >, @@ -27720,7 +27710,7 @@ pub mod api { ::subxt::metadata::DecodeStaticType< ::std::vec::Vec< ::core::option::Option<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, )>, >, @@ -27957,7 +27947,7 @@ pub mod api { #[doc = "Funds were reserved for a winning bid. First balance is the extra amount reserved."] #[doc = "Second is the total."] pub struct Reserved { - pub bidder: ::subxt::ext::sp_core::crypto::AccountId32, + pub bidder: ::subxt::utils::account_id::AccountId32, pub extra_reserved: ::core::primitive::u128, pub total_amount: ::core::primitive::u128, } @@ -27972,7 +27962,7 @@ pub mod api { )] #[doc = "Funds were unreserved since bidder is no longer active. `[bidder, amount]`"] pub struct Unreserved { - pub bidder: ::subxt::ext::sp_core::crypto::AccountId32, + pub bidder: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for Unreserved { @@ -27988,7 +27978,7 @@ pub mod api { #[doc = "but no parachain slot has been leased."] pub struct ReserveConfiscated { pub para_id: runtime_types::polkadot_parachain::primitives::Id, - pub leaser: ::subxt::ext::sp_core::crypto::AccountId32, + pub leaser: ::subxt::utils::account_id::AccountId32, pub amount: ::core::primitive::u128, } impl ::subxt::events::StaticEvent for ReserveConfiscated { @@ -28002,7 +27992,7 @@ pub mod api { )] #[doc = "A new bid has been accepted as the current winner."] pub struct BidAccepted { - pub bidder: ::subxt::ext::sp_core::crypto::AccountId32, + pub bidder: ::subxt::utils::account_id::AccountId32, pub para_id: runtime_types::polkadot_parachain::primitives::Id, pub amount: ::core::primitive::u128, pub first_slot: ::core::primitive::u32, @@ -28084,7 +28074,7 @@ pub mod api { #[doc = " (sub-)ranges."] pub fn reserved_amounts( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::crypto::AccountId32>, + _0: impl ::std::borrow::Borrow<::subxt::utils::account_id::AccountId32>, _1: impl ::std::borrow::Borrow< runtime_types::polkadot_parachain::primitives::Id, >, @@ -28140,7 +28130,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< [::core::option::Option<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::polkadot_parachain::primitives::Id, ::core::primitive::u128, )>; 36usize], @@ -28172,7 +28162,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< [::core::option::Option<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::polkadot_parachain::primitives::Id, ::core::primitive::u128, )>; 36usize], @@ -28316,7 +28306,7 @@ pub mod api { Debug, )] pub struct Withdraw { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, #[codec(compact)] pub index: runtime_types::polkadot_parachain::primitives::Id, } @@ -28466,7 +28456,7 @@ pub mod api { #[doc = "- `index`: The parachain to whose crowdloan the contribution was made."] pub fn withdraw( &self, - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, index: runtime_types::polkadot_parachain::primitives::Id, ) -> ::subxt::tx::StaticTxPayload { ::subxt::tx::StaticTxPayload::new( @@ -28638,7 +28628,7 @@ pub mod api { )] #[doc = "Contributed to a crowd sale."] pub struct Contributed { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub fund_index: runtime_types::polkadot_parachain::primitives::Id, pub amount: ::core::primitive::u128, } @@ -28653,7 +28643,7 @@ pub mod api { )] #[doc = "Withdrew full balance of a contributor."] pub struct Withdrew { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub fund_index: runtime_types::polkadot_parachain::primitives::Id, pub amount: ::core::primitive::u128, } @@ -28736,7 +28726,7 @@ pub mod api { )] #[doc = "A memo has been updated."] pub struct MemoUpdated { - pub who: ::subxt::ext::sp_core::crypto::AccountId32, + pub who: ::subxt::utils::account_id::AccountId32, pub para_id: runtime_types::polkadot_parachain::primitives::Id, pub memo: ::std::vec::Vec<::core::primitive::u8>, } @@ -28771,7 +28761,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_runtime_common::crowdloan::FundInfo< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::u32, ::core::primitive::u32, @@ -28802,7 +28792,7 @@ pub mod api { ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType< runtime_types::polkadot_runtime_common::crowdloan::FundInfo< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, ::core::primitive::u32, ::core::primitive::u32, @@ -29597,7 +29587,7 @@ pub mod api { #[doc = ""] #[doc = "\\[ hash, origin, assets \\]"] pub struct AssetsTrapped( - pub ::subxt::ext::sp_core::H256, + pub ::subxt::utils::H256, pub runtime_types::xcm::v1::multilocation::MultiLocation, pub runtime_types::xcm::VersionedMultiAssets, ); @@ -29682,7 +29672,7 @@ pub mod api { #[doc = ""] #[doc = "\\[ hash, origin, assets \\]"] pub struct AssetsClaimed( - pub ::subxt::ext::sp_core::H256, + pub ::subxt::utils::H256, pub runtime_types::xcm::v1::multilocation::MultiLocation, pub runtime_types::xcm::VersionedMultiAssets, ); @@ -29776,7 +29766,7 @@ pub mod api { #[doc = " times this pair has been trapped (usually just 1 if it exists at all)."] pub fn asset_traps( &self, - _0: impl ::std::borrow::Borrow<::subxt::ext::sp_core::H256>, + _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::StaticStorageAddress< ::subxt::metadata::DecodeStaticType<::core::primitive::u32>, ::subxt::storage::address::Yes, @@ -30142,7 +30132,7 @@ pub mod api { pub enum Bounded<_0> { #[codec(index = 0)] Legacy { - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, }, #[codec(index = 1)] Inline( @@ -30152,7 +30142,7 @@ pub mod api { ), #[codec(index = 2)] Lookup { - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, len: ::core::primitive::u32, }, __Ignore(::core::marker::PhantomData<_0>), @@ -30435,18 +30425,18 @@ pub mod api { #[codec(index = 3)] #[doc = "A new account was created."] NewAccount { - account: ::subxt::ext::sp_core::crypto::AccountId32, + account: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 4)] #[doc = "An account was reaped."] KilledAccount { - account: ::subxt::ext::sp_core::crypto::AccountId32, + account: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 5)] #[doc = "On on-chain remark happened."] Remarked { - sender: ::subxt::ext::sp_core::crypto::AccountId32, - hash: ::subxt::ext::sp_core::H256, + sender: ::subxt::utils::account_id::AccountId32, + hash: ::subxt::utils::H256, }, } } @@ -30604,12 +30594,10 @@ pub mod api { Debug, )] pub struct Bag { - pub head: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, - >, - pub tail: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, - >, + pub head: + ::core::option::Option<::subxt::utils::account_id::AccountId32>, + pub tail: + ::core::option::Option<::subxt::utils::account_id::AccountId32>, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -30632,13 +30620,11 @@ pub mod api { Debug, )] pub struct Node { - pub id: ::subxt::ext::sp_core::crypto::AccountId32, - pub prev: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, - >, - pub next: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, - >, + pub id: ::subxt::utils::account_id::AccountId32, + pub prev: + ::core::option::Option<::subxt::utils::account_id::AccountId32>, + pub next: + ::core::option::Option<::subxt::utils::account_id::AccountId32>, pub bag_upper: ::core::primitive::u64, pub score: ::core::primitive::u64, } @@ -30664,8 +30650,8 @@ pub mod api { #[doc = ""] #[doc = "If `dislocated` does not exists, it returns an error."] rebag { - dislocated: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dislocated: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -30679,8 +30665,8 @@ pub mod api { #[doc = "- both nodes are within the same bag,"] #[doc = "- and `origin` has a greater `Score` than `lighter`."] put_in_front_of { - lighter: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + lighter: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -30706,14 +30692,14 @@ pub mod api { #[codec(index = 0)] #[doc = "Moved an account from one bag to another."] Rebagged { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, from: ::core::primitive::u64, to: ::core::primitive::u64, }, #[codec(index = 1)] #[doc = "Updated the score of some account to the given amount."] ScoreUpdated { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, new_score: ::core::primitive::u64, }, } @@ -30757,8 +30743,8 @@ pub mod api { #[doc = "- Origin account is already in memory, so no DB operations for them."] #[doc = "# "] transfer { - dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -30774,8 +30760,8 @@ pub mod api { #[doc = ""] #[doc = "The dispatch origin for this call is `root`."] set_balance { - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -30791,12 +30777,12 @@ pub mod api { #[doc = " assumed to be in the overlay."] #[doc = "# "] force_transfer { - source: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + source: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -30810,8 +30796,8 @@ pub mod api { #[doc = ""] #[doc = "[`transfer`]: struct.Pallet.html#method.transfer"] transfer_keep_alive { - dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -30836,8 +30822,8 @@ pub mod api { #[doc = "- O(1). Just like transfer, but reading the user's transferable balance first."] #[doc = " #"] transfer_all { - dest: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + dest: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, keep_alive: ::core::primitive::bool, @@ -30847,8 +30833,8 @@ pub mod api { #[doc = ""] #[doc = "Can only be called by ROOT."] force_unreserve { - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, amount: ::core::primitive::u128, @@ -30893,7 +30879,7 @@ pub mod api { )] #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] pub enum Event { - # [codec (index = 0)] # [doc = "An account was created with some free balance."] Endowed { account : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , free_balance : :: core :: primitive :: u128 , } , # [codec (index = 1)] # [doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] # [doc = "resulting in an outright loss."] DustLost { account : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 2)] # [doc = "Transfer succeeded."] Transfer { from : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , to : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 3)] # [doc = "A balance was set by root."] BalanceSet { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , free : :: core :: primitive :: u128 , reserved : :: core :: primitive :: u128 , } , # [codec (index = 4)] # [doc = "Some balance was reserved (moved from free to reserved)."] Reserved { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 5)] # [doc = "Some balance was unreserved (moved from reserved to free)."] Unreserved { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 6)] # [doc = "Some balance was moved from the reserve of the first account to the second account."] # [doc = "Final argument indicates the destination balance type."] ReserveRepatriated { from : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , to : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , amount : :: core :: primitive :: u128 , destination_status : runtime_types :: frame_support :: traits :: tokens :: misc :: BalanceStatus , } , # [codec (index = 7)] # [doc = "Some amount was deposited (e.g. for transaction fees)."] Deposit { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 8)] # [doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] Withdraw { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 9)] # [doc = "Some amount was removed from the account (e.g. for misbehavior)."] Slashed { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , amount : :: core :: primitive :: u128 , } , } + # [codec (index = 0)] # [doc = "An account was created with some free balance."] Endowed { account : :: subxt :: utils :: account_id :: AccountId32 , free_balance : :: core :: primitive :: u128 , } , # [codec (index = 1)] # [doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] # [doc = "resulting in an outright loss."] DustLost { account : :: subxt :: utils :: account_id :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 2)] # [doc = "Transfer succeeded."] Transfer { from : :: subxt :: utils :: account_id :: AccountId32 , to : :: subxt :: utils :: account_id :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 3)] # [doc = "A balance was set by root."] BalanceSet { who : :: subxt :: utils :: account_id :: AccountId32 , free : :: core :: primitive :: u128 , reserved : :: core :: primitive :: u128 , } , # [codec (index = 4)] # [doc = "Some balance was reserved (moved from free to reserved)."] Reserved { who : :: subxt :: utils :: account_id :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 5)] # [doc = "Some balance was unreserved (moved from reserved to free)."] Unreserved { who : :: subxt :: utils :: account_id :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 6)] # [doc = "Some balance was moved from the reserve of the first account to the second account."] # [doc = "Final argument indicates the destination balance type."] ReserveRepatriated { from : :: subxt :: utils :: account_id :: AccountId32 , to : :: subxt :: utils :: account_id :: AccountId32 , amount : :: core :: primitive :: u128 , destination_status : runtime_types :: frame_support :: traits :: tokens :: misc :: BalanceStatus , } , # [codec (index = 7)] # [doc = "Some amount was deposited (e.g. for transaction fees)."] Deposit { who : :: subxt :: utils :: account_id :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 8)] # [doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] Withdraw { who : :: subxt :: utils :: account_id :: AccountId32 , amount : :: core :: primitive :: u128 , } , # [codec (index = 9)] # [doc = "Some amount was removed from the account (e.g. for misbehavior)."] Slashed { who : :: subxt :: utils :: account_id :: AccountId32 , amount : :: core :: primitive :: u128 , } , } } #[derive( :: subxt :: ext :: codec :: Decode, @@ -31003,8 +30989,8 @@ pub mod api { propose_curator { #[codec(compact)] bounty_id: ::core::primitive::u32, - curator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + curator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -31061,8 +31047,8 @@ pub mod api { award_bounty { #[codec(compact)] bounty_id: ::core::primitive::u32, - beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -31177,14 +31163,14 @@ pub mod api { #[doc = "A bounty is awarded to a beneficiary."] BountyAwarded { index: ::core::primitive::u32, - beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 4)] #[doc = "A bounty is claimed by beneficiary."] BountyClaimed { index: ::core::primitive::u32, payout: ::core::primitive::u128, - beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 5)] #[doc = "A bounty is cancelled."] @@ -31290,8 +31276,8 @@ pub mod api { parent_bounty_id: ::core::primitive::u32, #[codec(compact)] child_bounty_id: ::core::primitive::u32, - curator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + curator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -31387,8 +31373,8 @@ pub mod api { parent_bounty_id: ::core::primitive::u32, #[codec(compact)] child_bounty_id: ::core::primitive::u32, - beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -31480,7 +31466,7 @@ pub mod api { Awarded { index: ::core::primitive::u32, child_index: ::core::primitive::u32, - beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 2)] #[doc = "A child-bounty is claimed by beneficiary."] @@ -31488,7 +31474,7 @@ pub mod api { index: ::core::primitive::u32, child_index: ::core::primitive::u32, payout: ::core::primitive::u128, - beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 3)] #[doc = "A child-bounty is cancelled."] @@ -31577,9 +31563,9 @@ pub mod api { #[doc = "# "] set_members { new_members: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, prime: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, old_count: ::core::primitive::u32, }, @@ -31656,7 +31642,7 @@ pub mod api { #[doc = "- 1 event"] #[doc = "# "] vote { - proposal: ::subxt::ext::sp_core::H256, + proposal: ::subxt::utils::H256, #[codec(compact)] index: ::core::primitive::u32, approve: ::core::primitive::bool, @@ -31695,7 +31681,7 @@ pub mod api { #[doc = "- up to 3 events"] #[doc = "# "] close_old_weight { - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, #[codec(compact)] index: ::core::primitive::u32, #[codec(compact)] @@ -31718,9 +31704,7 @@ pub mod api { #[doc = "* Reads: Proposals"] #[doc = "* Writes: Voting, Proposals, ProposalOf"] #[doc = "# "] - disapprove_proposal { - proposal_hash: ::subxt::ext::sp_core::H256, - }, + disapprove_proposal { proposal_hash: ::subxt::utils::H256 }, #[codec(index = 6)] #[doc = "Close a vote that is either approved, disapproved or whose voting period has ended."] #[doc = ""] @@ -31755,7 +31739,7 @@ pub mod api { #[doc = "- up to 3 events"] #[doc = "# "] close { - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, #[codec(compact)] index: ::core::primitive::u32, proposal_weight_bound: @@ -31813,35 +31797,31 @@ pub mod api { #[doc = "A motion (given hash) has been proposed (by given account) with a threshold (given"] #[doc = "`MemberCount`)."] Proposed { - account: ::subxt::ext::sp_core::crypto::AccountId32, + account: ::subxt::utils::account_id::AccountId32, proposal_index: ::core::primitive::u32, - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, threshold: ::core::primitive::u32, }, #[codec(index = 1)] #[doc = "A motion (given hash) has been voted on by given account, leaving"] #[doc = "a tally (yes votes and no votes given respectively as `MemberCount`)."] Voted { - account: ::subxt::ext::sp_core::crypto::AccountId32, - proposal_hash: ::subxt::ext::sp_core::H256, + account: ::subxt::utils::account_id::AccountId32, + proposal_hash: ::subxt::utils::H256, voted: ::core::primitive::bool, yes: ::core::primitive::u32, no: ::core::primitive::u32, }, #[codec(index = 2)] #[doc = "A motion was approved by the required threshold."] - Approved { - proposal_hash: ::subxt::ext::sp_core::H256, - }, + Approved { proposal_hash: ::subxt::utils::H256 }, #[codec(index = 3)] #[doc = "A motion was not approved by the required threshold."] - Disapproved { - proposal_hash: ::subxt::ext::sp_core::H256, - }, + Disapproved { proposal_hash: ::subxt::utils::H256 }, #[codec(index = 4)] #[doc = "A motion was executed; result will be `Ok` if it returned without error."] Executed { - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, result: ::core::result::Result< (), runtime_types::sp_runtime::DispatchError, @@ -31850,7 +31830,7 @@ pub mod api { #[codec(index = 5)] #[doc = "A single member did some action; result will be `Ok` if it returned without error."] MemberExecuted { - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, result: ::core::result::Result< (), runtime_types::sp_runtime::DispatchError, @@ -31859,7 +31839,7 @@ pub mod api { #[codec(index = 6)] #[doc = "A proposal was closed because its threshold was reached or after its duration was up."] Closed { - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, yes: ::core::primitive::u32, no: ::core::primitive::u32, }, @@ -32047,7 +32027,7 @@ pub mod api { #[doc = ""] #[doc = "Weight: `O(1)`"] fast_track { - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, voting_period: ::core::primitive::u32, delay: ::core::primitive::u32, }, @@ -32061,9 +32041,7 @@ pub mod api { #[doc = "Emits `Vetoed`."] #[doc = ""] #[doc = "Weight: `O(V + log(V))` where V is number of `existing vetoers`"] - veto_external { - proposal_hash: ::subxt::ext::sp_core::H256, - }, + veto_external { proposal_hash: ::subxt::utils::H256 }, #[codec(index = 9)] #[doc = "Remove a referendum."] #[doc = ""] @@ -32098,8 +32076,8 @@ pub mod api { #[doc = "Weight: `O(R)` where R is the number of referendums the voter delegating to has"] #[doc = " voted on. Weight is charged as if maximum votes."] delegate { - to: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + to: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, conviction: @@ -32136,8 +32114,8 @@ pub mod api { #[doc = ""] #[doc = "Weight: `O(R)` with R number of vote of target."] unlock { - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -32187,8 +32165,8 @@ pub mod api { #[doc = "Weight: `O(R + log R)` where R is the number of referenda that `target` has voted on."] #[doc = " Weight is calculated for the maximum number of vote."] remove_other_vote { - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, index: ::core::primitive::u32, @@ -32210,7 +32188,7 @@ pub mod api { #[doc = "Weight: `O(p)` (though as this is an high-privilege dispatch, we assume it has a"] #[doc = " reasonable value)."] blacklist { - proposal_hash: ::subxt::ext::sp_core::H256, + proposal_hash: ::subxt::utils::H256, maybe_ref_index: ::core::option::Option<::core::primitive::u32>, }, #[codec(index = 17)] @@ -32311,7 +32289,7 @@ pub mod api { )] #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] pub enum Event { - # [codec (index = 0)] # [doc = "A motion has been proposed by a public account."] Proposed { proposal_index : :: core :: primitive :: u32 , deposit : :: core :: primitive :: u128 , } , # [codec (index = 1)] # [doc = "A public proposal has been tabled for referendum vote."] Tabled { proposal_index : :: core :: primitive :: u32 , deposit : :: core :: primitive :: u128 , } , # [codec (index = 2)] # [doc = "An external proposal has been tabled."] ExternalTabled , # [codec (index = 3)] # [doc = "A referendum has begun."] Started { ref_index : :: core :: primitive :: u32 , threshold : runtime_types :: pallet_democracy :: vote_threshold :: VoteThreshold , } , # [codec (index = 4)] # [doc = "A proposal has been approved by referendum."] Passed { ref_index : :: core :: primitive :: u32 , } , # [codec (index = 5)] # [doc = "A proposal has been rejected by referendum."] NotPassed { ref_index : :: core :: primitive :: u32 , } , # [codec (index = 6)] # [doc = "A referendum has been cancelled."] Cancelled { ref_index : :: core :: primitive :: u32 , } , # [codec (index = 7)] # [doc = "An account has delegated their vote to another account."] Delegated { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , target : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , } , # [codec (index = 8)] # [doc = "An account has cancelled a previous delegation operation."] Undelegated { account : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , } , # [codec (index = 9)] # [doc = "An external proposal has been vetoed."] Vetoed { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , proposal_hash : :: subxt :: ext :: sp_core :: H256 , until : :: core :: primitive :: u32 , } , # [codec (index = 10)] # [doc = "A proposal_hash has been blacklisted permanently."] Blacklisted { proposal_hash : :: subxt :: ext :: sp_core :: H256 , } , # [codec (index = 11)] # [doc = "An account has voted in a referendum"] Voted { voter : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , ref_index : :: core :: primitive :: u32 , vote : runtime_types :: pallet_democracy :: vote :: AccountVote < :: core :: primitive :: u128 > , } , # [codec (index = 12)] # [doc = "An account has secconded a proposal"] Seconded { seconder : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , prop_index : :: core :: primitive :: u32 , } , # [codec (index = 13)] # [doc = "A proposal got canceled."] ProposalCanceled { prop_index : :: core :: primitive :: u32 , } , } + # [codec (index = 0)] # [doc = "A motion has been proposed by a public account."] Proposed { proposal_index : :: core :: primitive :: u32 , deposit : :: core :: primitive :: u128 , } , # [codec (index = 1)] # [doc = "A public proposal has been tabled for referendum vote."] Tabled { proposal_index : :: core :: primitive :: u32 , deposit : :: core :: primitive :: u128 , } , # [codec (index = 2)] # [doc = "An external proposal has been tabled."] ExternalTabled , # [codec (index = 3)] # [doc = "A referendum has begun."] Started { ref_index : :: core :: primitive :: u32 , threshold : runtime_types :: pallet_democracy :: vote_threshold :: VoteThreshold , } , # [codec (index = 4)] # [doc = "A proposal has been approved by referendum."] Passed { ref_index : :: core :: primitive :: u32 , } , # [codec (index = 5)] # [doc = "A proposal has been rejected by referendum."] NotPassed { ref_index : :: core :: primitive :: u32 , } , # [codec (index = 6)] # [doc = "A referendum has been cancelled."] Cancelled { ref_index : :: core :: primitive :: u32 , } , # [codec (index = 7)] # [doc = "An account has delegated their vote to another account."] Delegated { who : :: subxt :: utils :: account_id :: AccountId32 , target : :: subxt :: utils :: account_id :: AccountId32 , } , # [codec (index = 8)] # [doc = "An account has cancelled a previous delegation operation."] Undelegated { account : :: subxt :: utils :: account_id :: AccountId32 , } , # [codec (index = 9)] # [doc = "An external proposal has been vetoed."] Vetoed { who : :: subxt :: utils :: account_id :: AccountId32 , proposal_hash : :: subxt :: utils :: H256 , until : :: core :: primitive :: u32 , } , # [codec (index = 10)] # [doc = "A proposal_hash has been blacklisted permanently."] Blacklisted { proposal_hash : :: subxt :: utils :: H256 , } , # [codec (index = 11)] # [doc = "An account has voted in a referendum"] Voted { voter : :: subxt :: utils :: account_id :: AccountId32 , ref_index : :: core :: primitive :: u32 , vote : runtime_types :: pallet_democracy :: vote :: AccountVote < :: core :: primitive :: u128 > , } , # [codec (index = 12)] # [doc = "An account has secconded a proposal"] Seconded { seconder : :: subxt :: utils :: account_id :: AccountId32 , prop_index : :: core :: primitive :: u32 , } , # [codec (index = 13)] # [doc = "A proposal got canceled."] ProposalCanceled { prop_index : :: core :: primitive :: u32 , } , } } pub mod types { use super::runtime_types; @@ -32452,7 +32430,7 @@ pub mod api { )] #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] pub enum Call { - # [codec (index = 0)] # [doc = "Submit a solution for the unsigned phase."] # [doc = ""] # [doc = "The dispatch origin fo this call must be __none__."] # [doc = ""] # [doc = "This submission is checked on the fly. Moreover, this unsigned solution is only"] # [doc = "validated when submitted to the pool from the **local** node. Effectively, this means"] # [doc = "that only active validators can submit this transaction when authoring a block (similar"] # [doc = "to an inherent)."] # [doc = ""] # [doc = "To prevent any incorrect solution (and thus wasted time/weight), this transaction will"] # [doc = "panic if the solution submitted by the validator is invalid in any way, effectively"] # [doc = "putting their authoring reward at risk."] # [doc = ""] # [doc = "No deposit or reward is associated with this submission."] submit_unsigned { raw_solution : :: std :: boxed :: Box < runtime_types :: pallet_election_provider_multi_phase :: RawSolution < runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , witness : runtime_types :: pallet_election_provider_multi_phase :: SolutionOrSnapshotSize , } , # [codec (index = 1)] # [doc = "Set a new value for `MinimumUntrustedScore`."] # [doc = ""] # [doc = "Dispatch origin must be aligned with `T::ForceOrigin`."] # [doc = ""] # [doc = "This check can be turned off by setting the value to `None`."] set_minimum_untrusted_score { maybe_next_score : :: core :: option :: Option < runtime_types :: sp_npos_elections :: ElectionScore > , } , # [codec (index = 2)] # [doc = "Set a solution in the queue, to be handed out to the client of this pallet in the next"] # [doc = "call to `ElectionProvider::elect`."] # [doc = ""] # [doc = "This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`."] # [doc = ""] # [doc = "The solution is not checked for any feasibility and is assumed to be trustworthy, as any"] # [doc = "feasibility check itself can in principle cause the election process to fail (due to"] # [doc = "memory/weight constrains)."] set_emergency_election_result { supports : :: std :: vec :: Vec < (:: subxt :: ext :: sp_core :: crypto :: AccountId32 , runtime_types :: sp_npos_elections :: Support < :: subxt :: ext :: sp_core :: crypto :: AccountId32 > ,) > , } , # [codec (index = 3)] # [doc = "Submit a solution for the signed phase."] # [doc = ""] # [doc = "The dispatch origin fo this call must be __signed__."] # [doc = ""] # [doc = "The solution is potentially queued, based on the claimed score and processed at the end"] # [doc = "of the signed phase."] # [doc = ""] # [doc = "A deposit is reserved and recorded for the solution. Based on the outcome, the solution"] # [doc = "might be rewarded, slashed, or get all or a part of the deposit back."] submit { raw_solution : :: std :: boxed :: Box < runtime_types :: pallet_election_provider_multi_phase :: RawSolution < runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , } , # [codec (index = 4)] # [doc = "Trigger the governance fallback."] # [doc = ""] # [doc = "This can only be called when [`Phase::Emergency`] is enabled, as an alternative to"] # [doc = "calling [`Call::set_emergency_election_result`]."] governance_fallback { maybe_max_voters : :: core :: option :: Option < :: core :: primitive :: u32 > , maybe_max_targets : :: core :: option :: Option < :: core :: primitive :: u32 > , } , } + # [codec (index = 0)] # [doc = "Submit a solution for the unsigned phase."] # [doc = ""] # [doc = "The dispatch origin fo this call must be __none__."] # [doc = ""] # [doc = "This submission is checked on the fly. Moreover, this unsigned solution is only"] # [doc = "validated when submitted to the pool from the **local** node. Effectively, this means"] # [doc = "that only active validators can submit this transaction when authoring a block (similar"] # [doc = "to an inherent)."] # [doc = ""] # [doc = "To prevent any incorrect solution (and thus wasted time/weight), this transaction will"] # [doc = "panic if the solution submitted by the validator is invalid in any way, effectively"] # [doc = "putting their authoring reward at risk."] # [doc = ""] # [doc = "No deposit or reward is associated with this submission."] submit_unsigned { raw_solution : :: std :: boxed :: Box < runtime_types :: pallet_election_provider_multi_phase :: RawSolution < runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , witness : runtime_types :: pallet_election_provider_multi_phase :: SolutionOrSnapshotSize , } , # [codec (index = 1)] # [doc = "Set a new value for `MinimumUntrustedScore`."] # [doc = ""] # [doc = "Dispatch origin must be aligned with `T::ForceOrigin`."] # [doc = ""] # [doc = "This check can be turned off by setting the value to `None`."] set_minimum_untrusted_score { maybe_next_score : :: core :: option :: Option < runtime_types :: sp_npos_elections :: ElectionScore > , } , # [codec (index = 2)] # [doc = "Set a solution in the queue, to be handed out to the client of this pallet in the next"] # [doc = "call to `ElectionProvider::elect`."] # [doc = ""] # [doc = "This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`."] # [doc = ""] # [doc = "The solution is not checked for any feasibility and is assumed to be trustworthy, as any"] # [doc = "feasibility check itself can in principle cause the election process to fail (due to"] # [doc = "memory/weight constrains)."] set_emergency_election_result { supports : :: std :: vec :: Vec < (:: subxt :: utils :: account_id :: AccountId32 , runtime_types :: sp_npos_elections :: Support < :: subxt :: utils :: account_id :: AccountId32 > ,) > , } , # [codec (index = 3)] # [doc = "Submit a solution for the signed phase."] # [doc = ""] # [doc = "The dispatch origin fo this call must be __signed__."] # [doc = ""] # [doc = "The solution is potentially queued, based on the claimed score and processed at the end"] # [doc = "of the signed phase."] # [doc = ""] # [doc = "A deposit is reserved and recorded for the solution. Based on the outcome, the solution"] # [doc = "might be rewarded, slashed, or get all or a part of the deposit back."] submit { raw_solution : :: std :: boxed :: Box < runtime_types :: pallet_election_provider_multi_phase :: RawSolution < runtime_types :: polkadot_runtime :: NposCompactSolution16 > > , } , # [codec (index = 4)] # [doc = "Trigger the governance fallback."] # [doc = ""] # [doc = "This can only be called when [`Phase::Emergency`] is enabled, as an alternative to"] # [doc = "calling [`Call::set_emergency_election_result`]."] governance_fallback { maybe_max_voters : :: core :: option :: Option < :: core :: primitive :: u32 > , maybe_max_targets : :: core :: option :: Option < :: core :: primitive :: u32 > , } , } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -32510,7 +32488,7 @@ pub mod api { )] #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] pub enum Event { - # [codec (index = 0)] # [doc = "A solution was stored with the given compute."] # [doc = ""] # [doc = "If the solution is signed, this means that it hasn't yet been processed. If the"] # [doc = "solution is unsigned, this means that it has also been processed."] # [doc = ""] # [doc = "The `bool` is `true` when a previous solution was ejected to make room for this one."] SolutionStored { compute : runtime_types :: pallet_election_provider_multi_phase :: ElectionCompute , prev_ejected : :: core :: primitive :: bool , } , # [codec (index = 1)] # [doc = "The election has been finalized, with the given computation and score."] ElectionFinalized { compute : runtime_types :: pallet_election_provider_multi_phase :: ElectionCompute , score : runtime_types :: sp_npos_elections :: ElectionScore , } , # [codec (index = 2)] # [doc = "An election failed."] # [doc = ""] # [doc = "Not much can be said about which computes failed in the process."] ElectionFailed , # [codec (index = 3)] # [doc = "An account has been rewarded for their signed submission being finalized."] Rewarded { account : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , value : :: core :: primitive :: u128 , } , # [codec (index = 4)] # [doc = "An account has been slashed for submitting an invalid signed submission."] Slashed { account : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , value : :: core :: primitive :: u128 , } , # [codec (index = 5)] # [doc = "The signed phase of the given round has started."] SignedPhaseStarted { round : :: core :: primitive :: u32 , } , # [codec (index = 6)] # [doc = "The unsigned phase of the given round has started."] UnsignedPhaseStarted { round : :: core :: primitive :: u32 , } , } + # [codec (index = 0)] # [doc = "A solution was stored with the given compute."] # [doc = ""] # [doc = "If the solution is signed, this means that it hasn't yet been processed. If the"] # [doc = "solution is unsigned, this means that it has also been processed."] # [doc = ""] # [doc = "The `bool` is `true` when a previous solution was ejected to make room for this one."] SolutionStored { compute : runtime_types :: pallet_election_provider_multi_phase :: ElectionCompute , prev_ejected : :: core :: primitive :: bool , } , # [codec (index = 1)] # [doc = "The election has been finalized, with the given computation and score."] ElectionFinalized { compute : runtime_types :: pallet_election_provider_multi_phase :: ElectionCompute , score : runtime_types :: sp_npos_elections :: ElectionScore , } , # [codec (index = 2)] # [doc = "An election failed."] # [doc = ""] # [doc = "Not much can be said about which computes failed in the process."] ElectionFailed , # [codec (index = 3)] # [doc = "An account has been rewarded for their signed submission being finalized."] Rewarded { account : :: subxt :: utils :: account_id :: AccountId32 , value : :: core :: primitive :: u128 , } , # [codec (index = 4)] # [doc = "An account has been slashed for submitting an invalid signed submission."] Slashed { account : :: subxt :: utils :: account_id :: AccountId32 , value : :: core :: primitive :: u128 , } , # [codec (index = 5)] # [doc = "The signed phase of the given round has started."] SignedPhaseStarted { round : :: core :: primitive :: u32 , } , # [codec (index = 6)] # [doc = "The unsigned phase of the given round has started."] UnsignedPhaseStarted { round : :: core :: primitive :: u32 , } , } } pub mod signed { use super::runtime_types; @@ -32578,9 +32556,9 @@ pub mod api { )] pub struct ReadySolution { pub supports: runtime_types::sp_core::bounded::bounded_vec::BoundedVec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::sp_npos_elections::Support< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, )>, pub score: runtime_types::sp_npos_elections::ElectionScore, @@ -32594,13 +32572,13 @@ pub mod api { )] pub struct RoundSnapshot { pub voters: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u64, runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, )>, - pub targets: ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + pub targets: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -32650,8 +32628,7 @@ pub mod api { #[doc = "We assume the maximum weight among all 3 cases: vote_equal, vote_more and vote_less."] #[doc = "# "] vote { - votes: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + votes: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, #[codec(compact)] value: ::core::primitive::u128, }, @@ -32724,8 +32701,8 @@ pub mod api { #[doc = "will go into phragmen, we assume full block for now."] #[doc = "# "] remove_member { - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, slash_bond: ::core::primitive::bool, @@ -32821,7 +32798,7 @@ pub mod api { #[doc = "begin with."] NewTerm { new_members: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, )>, }, @@ -32836,12 +32813,12 @@ pub mod api { #[doc = "A member has been removed. This should always be followed by either `NewTerm` or"] #[doc = "`EmptyTerm`."] MemberKicked { - member: ::subxt::ext::sp_core::crypto::AccountId32, + member: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 4)] #[doc = "Someone has renounced their candidacy."] Renounced { - candidate: ::subxt::ext::sp_core::crypto::AccountId32, + candidate: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 5)] #[doc = "A candidate was slashed by amount due to failing to obtain a seat as member or"] @@ -32849,13 +32826,13 @@ pub mod api { #[doc = ""] #[doc = "Note that old members and runners-up are also candidates."] CandidateSlashed { - candidate: ::subxt::ext::sp_core::crypto::AccountId32, + candidate: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 6)] #[doc = "A seat holder was slashed by amount by being forcefully removed from the set."] SeatHolderSlashed { - seat_holder: ::subxt::ext::sp_core::crypto::AccountId32, + seat_holder: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, } @@ -32980,7 +32957,7 @@ pub mod api { #[codec(index = 0)] #[doc = "A staker was unstaked."] Unstaked { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, result: ::core::result::Result< (), runtime_types::sp_runtime::DispatchError, @@ -32989,14 +32966,14 @@ pub mod api { #[codec(index = 1)] #[doc = "A staker was slashed for requesting fast-unstake whilst being exposed."] Slashed { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 2)] #[doc = "Some internal error happened while migrating stash. They are removed as head as a"] #[doc = "consequence."] Errored { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 3)] #[doc = "An internal error happened. Operations will be paused now."] @@ -33024,7 +33001,7 @@ pub mod api { pub struct UnstakeRequest { pub stashes: runtime_types::sp_core::bounded::bounded_vec::BoundedVec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, )>, pub checked: runtime_types::sp_core::bounded::bounded_vec::BoundedVec< @@ -33052,7 +33029,7 @@ pub mod api { report_equivocation { equivocation_proof: ::std::boxed::Box< runtime_types::sp_finality_grandpa::EquivocationProof< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, ::core::primitive::u32, >, >, @@ -33071,7 +33048,7 @@ pub mod api { report_equivocation_unsigned { equivocation_proof: ::std::boxed::Box< runtime_types::sp_finality_grandpa::EquivocationProof< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, ::core::primitive::u32, >, >, @@ -33206,8 +33183,8 @@ pub mod api { #[doc = "- One event."] #[doc = "# "] add_registrar { - account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -33260,7 +33237,7 @@ pub mod api { #[doc = "# "] set_subs { subs: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_identity::types::Data, )>, }, @@ -33370,8 +33347,8 @@ pub mod api { set_account_id { #[codec(compact)] index: ::core::primitive::u32, - new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -33420,14 +33397,14 @@ pub mod api { provide_judgement { #[codec(compact)] reg_index: ::core::primitive::u32, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, judgement: runtime_types::pallet_identity::types::Judgement< ::core::primitive::u128, >, - identity: ::subxt::ext::sp_core::H256, + identity: ::subxt::utils::H256, }, #[codec(index = 10)] #[doc = "Remove an account's identity and sub-account information and slash the deposits."] @@ -33450,8 +33427,8 @@ pub mod api { #[doc = "- One event."] #[doc = "# "] kill_identity { - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -33464,8 +33441,8 @@ pub mod api { #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] #[doc = "sub identity of `sub`."] add_sub { - sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, data: runtime_types::pallet_identity::types::Data, @@ -33476,8 +33453,8 @@ pub mod api { #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] #[doc = "sub identity of `sub`."] rename_sub { - sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, data: runtime_types::pallet_identity::types::Data, @@ -33491,8 +33468,8 @@ pub mod api { #[doc = "The dispatch origin for this call must be _Signed_ and the sender must have a registered"] #[doc = "sub identity of `sub`."] remove_sub { - sub: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -33581,36 +33558,36 @@ pub mod api { #[codec(index = 0)] #[doc = "A name was set or reset (which will remove all judgements)."] IdentitySet { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 1)] #[doc = "A name was cleared, and the given balance returned."] IdentityCleared { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, deposit: ::core::primitive::u128, }, #[codec(index = 2)] #[doc = "A name was removed and the given balance slashed."] IdentityKilled { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, deposit: ::core::primitive::u128, }, #[codec(index = 3)] #[doc = "A judgement was asked from a registrar."] JudgementRequested { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, registrar_index: ::core::primitive::u32, }, #[codec(index = 4)] #[doc = "A judgement request was retracted."] JudgementUnrequested { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, registrar_index: ::core::primitive::u32, }, #[codec(index = 5)] #[doc = "A judgement was given by a registrar."] JudgementGiven { - target: ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::account_id::AccountId32, registrar_index: ::core::primitive::u32, }, #[codec(index = 6)] @@ -33621,23 +33598,23 @@ pub mod api { #[codec(index = 7)] #[doc = "A sub-identity was added to an identity and the deposit paid."] SubIdentityAdded { - sub: ::subxt::ext::sp_core::crypto::AccountId32, - main: ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::account_id::AccountId32, + main: ::subxt::utils::account_id::AccountId32, deposit: ::core::primitive::u128, }, #[codec(index = 8)] #[doc = "A sub-identity was removed from an identity and the deposit freed."] SubIdentityRemoved { - sub: ::subxt::ext::sp_core::crypto::AccountId32, - main: ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::account_id::AccountId32, + main: ::subxt::utils::account_id::AccountId32, deposit: ::core::primitive::u128, }, #[codec(index = 9)] #[doc = "A sub-identity was cleared, and the given deposit repatriated from the"] #[doc = "main identity account to the sub-identity account."] SubIdentityRevoked { - sub: ::subxt::ext::sp_core::crypto::AccountId32, - main: ::subxt::ext::sp_core::crypto::AccountId32, + sub: ::subxt::utils::account_id::AccountId32, + main: ::subxt::utils::account_id::AccountId32, deposit: ::core::primitive::u128, }, } @@ -33876,9 +33853,9 @@ pub mod api { #[doc = "At the end of the session, at least one validator was found to be offline."] SomeOffline { offline: ::std::vec::Vec<( - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, runtime_types::pallet_staking::Exposure< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, ::core::primitive::u128, >, )>, @@ -33986,8 +33963,8 @@ pub mod api { #[doc = " - Writes: Indices Accounts, System Account (recipient)"] #[doc = "# "] transfer { - new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, index: ::core::primitive::u32, @@ -34035,8 +34012,8 @@ pub mod api { #[doc = " - Writes: Indices Accounts, System Account (original owner)"] #[doc = "# "] force_transfer { - new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, index: ::core::primitive::u32, @@ -34096,7 +34073,7 @@ pub mod api { #[codec(index = 0)] #[doc = "A account index was assigned."] IndexAssigned { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, index: ::core::primitive::u32, }, #[codec(index = 1)] @@ -34106,7 +34083,7 @@ pub mod api { #[doc = "A account index has been frozen to its current account ID."] IndexFrozen { index: ::core::primitive::u32, - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, }, } } @@ -34127,8 +34104,8 @@ pub mod api { #[doc = ""] #[doc = "May only be called from `T::AddOrigin`."] add_member { - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -34137,8 +34114,8 @@ pub mod api { #[doc = ""] #[doc = "May only be called from `T::RemoveOrigin`."] remove_member { - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -34149,12 +34126,12 @@ pub mod api { #[doc = ""] #[doc = "Prime membership is *not* passed from `remove` to `add`, if extant."] swap_member { - remove: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + remove: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - add: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + add: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -34164,8 +34141,7 @@ pub mod api { #[doc = ""] #[doc = "May only be called from `T::ResetOrigin`."] reset_members { - members: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + members: ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, }, #[codec(index = 4)] #[doc = "Swap out the sending member for some other key `new`."] @@ -34174,8 +34150,8 @@ pub mod api { #[doc = ""] #[doc = "Prime membership is passed from the origin account to `new`, if extant."] change_key { - new: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + new: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -34184,8 +34160,8 @@ pub mod api { #[doc = ""] #[doc = "May only be called from `T::PrimeOrigin`."] set_prime { - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -34270,7 +34246,7 @@ pub mod api { #[doc = "# "] as_multi_threshold_1 { other_signatories: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, call: ::std::boxed::Box< runtime_types::polkadot_runtime::RuntimeCall, >, @@ -34324,7 +34300,7 @@ pub mod api { as_multi { threshold: ::core::primitive::u16, other_signatories: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, maybe_timepoint: ::core::option::Option< runtime_types::pallet_multisig::Timepoint< ::core::primitive::u32, @@ -34374,7 +34350,7 @@ pub mod api { approve_as_multi { threshold: ::core::primitive::u16, other_signatories: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, maybe_timepoint: ::core::option::Option< runtime_types::pallet_multisig::Timepoint< ::core::primitive::u32, @@ -34413,7 +34389,7 @@ pub mod api { cancel_as_multi { threshold: ::core::primitive::u16, other_signatories: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, timepoint: runtime_types::pallet_multisig::Timepoint< ::core::primitive::u32, >, @@ -34480,28 +34456,28 @@ pub mod api { #[codec(index = 0)] #[doc = "A new multisig operation has begun."] NewMultisig { - approving: ::subxt::ext::sp_core::crypto::AccountId32, - multisig: ::subxt::ext::sp_core::crypto::AccountId32, + approving: ::subxt::utils::account_id::AccountId32, + multisig: ::subxt::utils::account_id::AccountId32, call_hash: [::core::primitive::u8; 32usize], }, #[codec(index = 1)] #[doc = "A multisig operation has been approved by someone."] MultisigApproval { - approving: ::subxt::ext::sp_core::crypto::AccountId32, + approving: ::subxt::utils::account_id::AccountId32, timepoint: runtime_types::pallet_multisig::Timepoint< ::core::primitive::u32, >, - multisig: ::subxt::ext::sp_core::crypto::AccountId32, + multisig: ::subxt::utils::account_id::AccountId32, call_hash: [::core::primitive::u8; 32usize], }, #[codec(index = 2)] #[doc = "A multisig operation has been executed."] MultisigExecuted { - approving: ::subxt::ext::sp_core::crypto::AccountId32, + approving: ::subxt::utils::account_id::AccountId32, timepoint: runtime_types::pallet_multisig::Timepoint< ::core::primitive::u32, >, - multisig: ::subxt::ext::sp_core::crypto::AccountId32, + multisig: ::subxt::utils::account_id::AccountId32, call_hash: [::core::primitive::u8; 32usize], result: ::core::result::Result< (), @@ -34511,11 +34487,11 @@ pub mod api { #[codec(index = 3)] #[doc = "A multisig operation has been cancelled."] MultisigCancelled { - cancelling: ::subxt::ext::sp_core::crypto::AccountId32, + cancelling: ::subxt::utils::account_id::AccountId32, timepoint: runtime_types::pallet_multisig::Timepoint< ::core::primitive::u32, >, - multisig: ::subxt::ext::sp_core::crypto::AccountId32, + multisig: ::subxt::utils::account_id::AccountId32, call_hash: [::core::primitive::u8; 32usize], }, } @@ -34619,8 +34595,8 @@ pub mod api { #[doc = "there are too many unlocking chunks, the result of this call will likely be the"] #[doc = "`NoMoreChunks` error from the staking system."] unbond { - member_account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + member_account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -34658,8 +34634,8 @@ pub mod api { #[doc = ""] #[doc = "If the target is the depositor, the pool will be destroyed."] withdraw_unbonded { - member_account: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + member_account: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, num_slashing_spans: ::core::primitive::u32, @@ -34685,16 +34661,16 @@ pub mod api { create { #[codec(compact)] amount: ::core::primitive::u128, - root: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + root: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - nominator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + nominator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - state_toggler: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + state_toggler: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -34708,16 +34684,16 @@ pub mod api { create_with_pool_id { #[codec(compact)] amount: ::core::primitive::u128, - root: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + root: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - nominator: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + nominator: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - state_toggler: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + state_toggler: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, pool_id: ::core::primitive::u32, @@ -34733,7 +34709,7 @@ pub mod api { nominate { pool_id: ::core::primitive::u32, validators: - ::std::vec::Vec<::subxt::ext::sp_core::crypto::AccountId32>, + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, }, #[codec(index = 9)] #[doc = "Set a new state for the pool."] @@ -34799,14 +34775,14 @@ pub mod api { update_roles { pool_id: ::core::primitive::u32, new_root: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, new_nominator: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, new_state_toggler: runtime_types::pallet_nomination_pools::ConfigOp< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, }, #[codec(index = 13)] @@ -34933,13 +34909,13 @@ pub mod api { #[codec(index = 0)] #[doc = "A pool has been created."] Created { - depositor: ::subxt::ext::sp_core::crypto::AccountId32, + depositor: ::subxt::utils::account_id::AccountId32, pool_id: ::core::primitive::u32, }, #[codec(index = 1)] #[doc = "A member has became bonded in a pool."] Bonded { - member: ::subxt::ext::sp_core::crypto::AccountId32, + member: ::subxt::utils::account_id::AccountId32, pool_id: ::core::primitive::u32, bonded: ::core::primitive::u128, joined: ::core::primitive::bool, @@ -34947,7 +34923,7 @@ pub mod api { #[codec(index = 2)] #[doc = "A payout has been made to a member."] PaidOut { - member: ::subxt::ext::sp_core::crypto::AccountId32, + member: ::subxt::utils::account_id::AccountId32, pool_id: ::core::primitive::u32, payout: ::core::primitive::u128, }, @@ -34964,7 +34940,7 @@ pub mod api { #[doc = "number of points that are issued in the unbonding pool will be less than the amount"] #[doc = "requested to be unbonded."] Unbonded { - member: ::subxt::ext::sp_core::crypto::AccountId32, + member: ::subxt::utils::account_id::AccountId32, pool_id: ::core::primitive::u32, balance: ::core::primitive::u128, points: ::core::primitive::u128, @@ -34978,7 +34954,7 @@ pub mod api { #[doc = "Similar to `Unbonded` event, in the absence of slashing, the ratio of point to balance"] #[doc = "will be 1."] Withdrawn { - member: ::subxt::ext::sp_core::crypto::AccountId32, + member: ::subxt::utils::account_id::AccountId32, pool_id: ::core::primitive::u32, balance: ::core::primitive::u128, points: ::core::primitive::u128, @@ -34998,20 +34974,20 @@ pub mod api { #[doc = "The removal can be voluntary (withdrawn all unbonded funds) or involuntary (kicked)."] MemberRemoved { pool_id: ::core::primitive::u32, - member: ::subxt::ext::sp_core::crypto::AccountId32, + member: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 8)] #[doc = "The roles of a pool have been updated to the given new roles. Note that the depositor"] #[doc = "can never change."] RolesUpdated { root: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, state_toggler: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, nominator: ::core::option::Option< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, }, #[codec(index = 9)] @@ -35050,7 +35026,7 @@ pub mod api { pub state: runtime_types::pallet_nomination_pools::PoolState, pub member_counter: ::core::primitive::u32, pub roles: runtime_types::pallet_nomination_pools::PoolRoles< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, } #[derive( @@ -35188,18 +35164,18 @@ pub mod api { #[doc = ""] #[doc = "- `hash`: The hash of the preimage to be removed from the store."] #[doc = "- `len`: The length of the preimage of `hash`."] - unnote_preimage { hash: ::subxt::ext::sp_core::H256 }, + unnote_preimage { hash: ::subxt::utils::H256 }, #[codec(index = 2)] #[doc = "Request a preimage be uploaded to the chain without paying any fees or deposits."] #[doc = ""] #[doc = "If the preimage requests has already been provided on-chain, we unreserve any deposit"] #[doc = "a user may have paid, and take the control of the preimage out of their hands."] - request_preimage { hash: ::subxt::ext::sp_core::H256 }, + request_preimage { hash: ::subxt::utils::H256 }, #[codec(index = 3)] #[doc = "Clear a previously made request for a preimage."] #[doc = ""] #[doc = "NOTE: THIS MUST NOT BE CALLED ON `hash` MORE TIMES THAN `request_preimage`."] - unrequest_preimage { hash: ::subxt::ext::sp_core::H256 }, + unrequest_preimage { hash: ::subxt::utils::H256 }, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -35236,13 +35212,13 @@ pub mod api { pub enum Event { #[codec(index = 0)] #[doc = "A preimage has been noted."] - Noted { hash: ::subxt::ext::sp_core::H256 }, + Noted { hash: ::subxt::utils::H256 }, #[codec(index = 1)] #[doc = "A preimage has been requested."] - Requested { hash: ::subxt::ext::sp_core::H256 }, + Requested { hash: ::subxt::utils::H256 }, #[codec(index = 2)] #[doc = "A preimage has ben cleared."] - Cleared { hash: ::subxt::ext::sp_core::H256 }, + Cleared { hash: ::subxt::utils::H256 }, } } #[derive( @@ -35288,8 +35264,8 @@ pub mod api { #[doc = "- `force_proxy_type`: Specify the exact proxy type to be used and checked for this call."] #[doc = "- `call`: The call to be made by the `real` account."] proxy { - real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, force_proxy_type: ::core::option::Option< @@ -35310,8 +35286,8 @@ pub mod api { #[doc = "- `delay`: The announcement period required of the initial proxy. Will generally be"] #[doc = "zero."] add_proxy { - delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -35326,8 +35302,8 @@ pub mod api { #[doc = "- `proxy`: The account that the `caller` would like to remove as a proxy."] #[doc = "- `proxy_type`: The permissions currently enabled for the removed proxy account."] remove_proxy { - delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -35383,8 +35359,8 @@ pub mod api { #[doc = "Fails with `NoPermission` in case the caller is not a previously created pure"] #[doc = "account whose `pure` call has corresponding parameters."] kill_pure { - spawner: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + spawner: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, proxy_type: runtime_types::polkadot_runtime::ProxyType, @@ -35411,11 +35387,11 @@ pub mod api { #[doc = "- `real`: The account that the proxy will make a call on behalf of."] #[doc = "- `call_hash`: The hash of the call to be made by the `real` account."] announce { - real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - call_hash: ::subxt::ext::sp_core::H256, + call_hash: ::subxt::utils::H256, }, #[codec(index = 7)] #[doc = "Remove a given announcement."] @@ -35429,11 +35405,11 @@ pub mod api { #[doc = "- `real`: The account that the proxy will make a call on behalf of."] #[doc = "- `call_hash`: The hash of the call to be made by the `real` account."] remove_announcement { - real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - call_hash: ::subxt::ext::sp_core::H256, + call_hash: ::subxt::utils::H256, }, #[codec(index = 8)] #[doc = "Remove the given announcement of a delegate."] @@ -35447,11 +35423,11 @@ pub mod api { #[doc = "- `delegate`: The account that previously announced the call."] #[doc = "- `call_hash`: The hash of the call to be made."] reject_announcement { - delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - call_hash: ::subxt::ext::sp_core::H256, + call_hash: ::subxt::utils::H256, }, #[codec(index = 9)] #[doc = "Dispatch the given `call` from an account that the sender is authorized for through"] @@ -35466,12 +35442,12 @@ pub mod api { #[doc = "- `force_proxy_type`: Specify the exact proxy type to be used and checked for this call."] #[doc = "- `call`: The call to be made by the `real` account."] proxy_announced { - delegate: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + delegate: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - real: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + real: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, force_proxy_type: ::core::option::Option< @@ -35533,31 +35509,31 @@ pub mod api { #[doc = "A pure account has been created by new proxy with given"] #[doc = "disambiguation index and proxy type."] PureCreated { - pure: ::subxt::ext::sp_core::crypto::AccountId32, - who: ::subxt::ext::sp_core::crypto::AccountId32, + pure: ::subxt::utils::account_id::AccountId32, + who: ::subxt::utils::account_id::AccountId32, proxy_type: runtime_types::polkadot_runtime::ProxyType, disambiguation_index: ::core::primitive::u16, }, #[codec(index = 2)] #[doc = "An announcement was placed to make a call in the future."] Announced { - real: ::subxt::ext::sp_core::crypto::AccountId32, - proxy: ::subxt::ext::sp_core::crypto::AccountId32, - call_hash: ::subxt::ext::sp_core::H256, + real: ::subxt::utils::account_id::AccountId32, + proxy: ::subxt::utils::account_id::AccountId32, + call_hash: ::subxt::utils::H256, }, #[codec(index = 3)] #[doc = "A proxy was added."] ProxyAdded { - delegator: ::subxt::ext::sp_core::crypto::AccountId32, - delegatee: ::subxt::ext::sp_core::crypto::AccountId32, + delegator: ::subxt::utils::account_id::AccountId32, + delegatee: ::subxt::utils::account_id::AccountId32, proxy_type: runtime_types::polkadot_runtime::ProxyType, delay: ::core::primitive::u32, }, #[codec(index = 4)] #[doc = "A proxy was removed."] ProxyRemoved { - delegator: ::subxt::ext::sp_core::crypto::AccountId32, - delegatee: ::subxt::ext::sp_core::crypto::AccountId32, + delegator: ::subxt::utils::account_id::AccountId32, + delegatee: ::subxt::utils::account_id::AccountId32, proxy_type: runtime_types::polkadot_runtime::ProxyType, delay: ::core::primitive::u32, }, @@ -35876,14 +35852,14 @@ pub mod api { #[doc = "------------------"] #[doc = "# "] bond { - controller: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + controller: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] value: ::core::primitive::u128, payee: runtime_types::pallet_staking::RewardDestination< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, }, #[codec(index = 1)] @@ -35972,8 +35948,8 @@ pub mod api { #[doc = "# "] nominate { targets: ::std::vec::Vec< - ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, >, @@ -36010,7 +35986,7 @@ pub mod api { #[doc = "# "] set_payee { payee: runtime_types::pallet_staking::RewardDestination< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, }, #[codec(index = 8)] @@ -36031,8 +36007,8 @@ pub mod api { #[doc = "- Write: Bonded, Ledger New Controller, Ledger Old Controller"] #[doc = "# "] set_controller { - controller: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + controller: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -36114,16 +36090,15 @@ pub mod api { #[doc = ""] #[doc = "The dispatch origin must be Root."] set_invulnerables { - invulnerables: ::std::vec::Vec< - ::subxt::ext::sp_core::crypto::AccountId32, - >, + invulnerables: + ::std::vec::Vec<::subxt::utils::account_id::AccountId32>, }, #[codec(index = 15)] #[doc = "Force a current staker to become completely unstaked, immediately."] #[doc = ""] #[doc = "The dispatch origin must be Root."] force_unstake { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, num_slashing_spans: ::core::primitive::u32, }, #[codec(index = 16)] @@ -36170,7 +36145,7 @@ pub mod api { #[doc = " Paying even a dead controller is cheaper weight-wise. We don't do any refunds here."] #[doc = "# "] payout_stakers { - validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + validator_stash: ::subxt::utils::account_id::AccountId32, era: ::core::primitive::u32, }, #[codec(index = 19)] @@ -36201,7 +36176,7 @@ pub mod api { #[doc = ""] #[doc = "Refunds the transaction fees upon successful execution."] reap_stash { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, num_slashing_spans: ::core::primitive::u32, }, #[codec(index = 21)] @@ -36218,8 +36193,8 @@ pub mod api { #[doc = "block any further nominations."] kick { who: ::std::vec::Vec< - ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, >, @@ -36296,14 +36271,14 @@ pub mod api { #[doc = "This can be helpful if bond requirements are updated, and we need to remove old users"] #[doc = "who do not satisfy these requirements."] chill_other { - controller: ::subxt::ext::sp_core::crypto::AccountId32, + controller: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 24)] #[doc = "Force a validator to have at least the minimum commission. This will not affect a"] #[doc = "validator who already has a commission greater than or equal to the minimum. Any account"] #[doc = "can call this."] force_apply_min_commission { - validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + validator_stash: ::subxt::utils::account_id::AccountId32, }, } #[derive( @@ -36424,13 +36399,13 @@ pub mod api { #[codec(index = 1)] #[doc = "The nominator has been rewarded by this amount."] Rewarded { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 2)] #[doc = "One staker (and potentially its nominators) has been slashed by the given amount."] Slashed { - staker: ::subxt::ext::sp_core::crypto::AccountId32, + staker: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 3)] @@ -36448,27 +36423,27 @@ pub mod api { #[doc = "NOTE: This event is only emitted when funds are bonded via a dispatchable. Notably,"] #[doc = "it will not be emitted for staking rewards when they are added to stake."] Bonded { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 6)] #[doc = "An account has unbonded this amount."] Unbonded { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 7)] #[doc = "An account has called `withdraw_unbonded` and removed unbonding chunks worth `Balance`"] #[doc = "from the unlocking queue."] Withdrawn { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 8)] #[doc = "A nominator has been kicked from a validator."] Kicked { - nominator: ::subxt::ext::sp_core::crypto::AccountId32, - stash: ::subxt::ext::sp_core::crypto::AccountId32, + nominator: ::subxt::utils::account_id::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 9)] #[doc = "The election failed. No new era is planned."] @@ -36476,18 +36451,18 @@ pub mod api { #[codec(index = 10)] #[doc = "An account has stopped participating as either a validator or nominator."] Chilled { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 11)] #[doc = "The stakers' rewards are getting paid."] PayoutStarted { era_index: ::core::primitive::u32, - validator_stash: ::subxt::ext::sp_core::crypto::AccountId32, + validator_stash: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 12)] #[doc = "A validator has set their preferences."] ValidatorPrefsSet { - stash: ::subxt::ext::sp_core::crypto::AccountId32, + stash: ::subxt::utils::account_id::AccountId32, prefs: runtime_types::pallet_staking::ValidatorPrefs, }, } @@ -36580,7 +36555,7 @@ pub mod api { )] pub struct Nominations { pub targets: runtime_types::sp_core::bounded::bounded_vec::BoundedVec< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, pub submitted_in: ::core::primitive::u32, pub suppressed: ::core::primitive::bool, @@ -36639,7 +36614,7 @@ pub mod api { Debug, )] pub struct StakingLedger { - pub stash: ::subxt::ext::sp_core::crypto::AccountId32, + pub stash: ::subxt::utils::account_id::AccountId32, #[codec(compact)] pub total: ::core::primitive::u128, #[codec(compact)] @@ -36754,8 +36729,8 @@ pub mod api { #[doc = "# "] report_awesome { reason: ::std::vec::Vec<::core::primitive::u8>, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -36779,7 +36754,7 @@ pub mod api { #[doc = "- DbReads: `Tips`, `origin account`"] #[doc = "- DbWrites: `Reasons`, `Tips`, `origin account`"] #[doc = "# "] - retract_tip { hash: ::subxt::ext::sp_core::H256 }, + retract_tip { hash: ::subxt::utils::H256 }, #[codec(index = 2)] #[doc = "Give a tip for something new; no finder's fee will be taken."] #[doc = ""] @@ -36805,8 +36780,8 @@ pub mod api { #[doc = "# "] tip_new { reason: ::std::vec::Vec<::core::primitive::u8>, - who: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, #[codec(compact)] @@ -36838,7 +36813,7 @@ pub mod api { #[doc = "- DbWrites: `Tips`"] #[doc = "# "] tip { - hash: ::subxt::ext::sp_core::H256, + hash: ::subxt::utils::H256, #[codec(compact)] tip_value: ::core::primitive::u128, }, @@ -36859,7 +36834,7 @@ pub mod api { #[doc = "- DbReads: `Tips`, `Tippers`, `tip finder`"] #[doc = "- DbWrites: `Reasons`, `Tips`, `Tippers`, `tip finder`"] #[doc = "# "] - close_tip { hash: ::subxt::ext::sp_core::H256 }, + close_tip { hash: ::subxt::utils::H256 }, #[codec(index = 5)] #[doc = "Remove and slash an already-open tip."] #[doc = ""] @@ -36873,7 +36848,7 @@ pub mod api { #[doc = " `T` is charged as upper bound given by `ContainsLengthBound`."] #[doc = " The actual cost depends on the implementation of `T::Tippers`."] #[doc = "# "] - slash_tip { hash: ::subxt::ext::sp_core::H256 }, + slash_tip { hash: ::subxt::utils::H256 }, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -36910,31 +36885,25 @@ pub mod api { pub enum Event { #[codec(index = 0)] #[doc = "A new tip suggestion has been opened."] - NewTip { - tip_hash: ::subxt::ext::sp_core::H256, - }, + NewTip { tip_hash: ::subxt::utils::H256 }, #[codec(index = 1)] #[doc = "A tip suggestion has reached threshold and is closing."] - TipClosing { - tip_hash: ::subxt::ext::sp_core::H256, - }, + TipClosing { tip_hash: ::subxt::utils::H256 }, #[codec(index = 2)] #[doc = "A tip suggestion has been closed."] TipClosed { - tip_hash: ::subxt::ext::sp_core::H256, - who: ::subxt::ext::sp_core::crypto::AccountId32, + tip_hash: ::subxt::utils::H256, + who: ::subxt::utils::account_id::AccountId32, payout: ::core::primitive::u128, }, #[codec(index = 3)] #[doc = "A tip suggestion has been retracted."] - TipRetracted { - tip_hash: ::subxt::ext::sp_core::H256, - }, + TipRetracted { tip_hash: ::subxt::utils::H256 }, #[codec(index = 4)] #[doc = "A tip suggestion has been slashed."] TipSlashed { - tip_hash: ::subxt::ext::sp_core::H256, - finder: ::subxt::ext::sp_core::crypto::AccountId32, + tip_hash: ::subxt::utils::H256, + finder: ::subxt::utils::account_id::AccountId32, deposit: ::core::primitive::u128, }, } @@ -36969,7 +36938,7 @@ pub mod api { #[doc = "A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee,"] #[doc = "has been paid by `who`."] TransactionFeePaid { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, actual_fee: ::core::primitive::u128, tip: ::core::primitive::u128, }, @@ -37019,8 +36988,8 @@ pub mod api { propose_spend { #[codec(compact)] value: ::core::primitive::u128, - beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -37065,8 +37034,8 @@ pub mod api { spend { #[codec(compact)] amount: ::core::primitive::u128, - beneficiary: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -37137,7 +37106,7 @@ pub mod api { Awarded { proposal_index: ::core::primitive::u32, award: ::core::primitive::u128, - account: ::subxt::ext::sp_core::crypto::AccountId32, + account: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 3)] #[doc = "A proposal was rejected; funds were slashed."] @@ -37163,7 +37132,7 @@ pub mod api { SpendApproved { proposal_index: ::core::primitive::u32, amount: ::core::primitive::u128, - beneficiary: ::subxt::ext::sp_core::crypto::AccountId32, + beneficiary: ::subxt::utils::account_id::AccountId32, }, } } @@ -37385,8 +37354,8 @@ pub mod api { #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account"] #[doc = "# "] vest_other { - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, }, @@ -37409,8 +37378,8 @@ pub mod api { #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]"] #[doc = "# "] vested_transfer { - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, schedule: @@ -37439,12 +37408,12 @@ pub mod api { #[doc = " - Writes: Vesting Storage, Balances Locks, Target Account, Source Account"] #[doc = "# "] force_vested_transfer { - source: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + source: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, - target: ::subxt::ext::sp_runtime::MultiAddress< - ::subxt::ext::sp_core::crypto::AccountId32, + target: ::subxt::utils::multi_address::MultiAddress< + ::subxt::utils::account_id::AccountId32, (), >, schedule: @@ -37515,13 +37484,13 @@ pub mod api { #[doc = "The amount vested has been updated. This could indicate a change in funds available."] #[doc = "The balance given is the amount which is left unvested (and thus locked)."] VestingUpdated { - account: ::subxt::ext::sp_core::crypto::AccountId32, + account: ::subxt::utils::account_id::AccountId32, unvested: ::core::primitive::u128, }, #[codec(index = 1)] #[doc = "An \\[account\\] has become fully vested."] VestingCompleted { - account: ::subxt::ext::sp_core::crypto::AccountId32, + account: ::subxt::utils::account_id::AccountId32, }, } } @@ -37905,7 +37874,7 @@ pub mod api { #[doc = ""] #[doc = "\\[ hash, origin, assets \\]"] AssetsTrapped( - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, runtime_types::xcm::v1::multilocation::MultiLocation, runtime_types::xcm::VersionedMultiAssets, ), @@ -37950,7 +37919,7 @@ pub mod api { #[doc = ""] #[doc = "\\[ hash, origin, assets \\]"] AssetsClaimed( - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, runtime_types::xcm::v1::multilocation::MultiLocation, runtime_types::xcm::VersionedMultiAssets, ), @@ -38018,7 +37987,7 @@ pub mod api { :: subxt :: ext :: codec :: Encode, Debug, )] - pub struct CandidateHash(pub ::subxt::ext::sp_core::H256); + pub struct CandidateHash(pub ::subxt::utils::H256); #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -38084,7 +38053,7 @@ pub mod api { :: subxt :: ext :: codec :: Encode, Debug, )] - pub struct ValidationCodeHash(pub ::subxt::ext::sp_core::H256); + pub struct ValidationCodeHash(pub ::subxt::utils::H256); } } pub mod polkadot_primitives { @@ -38318,7 +38287,7 @@ pub mod api { >, pub backed_candidates: ::std::vec::Vec< runtime_types::polkadot_primitives::v2::BackedCandidate< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, >, pub disputes: ::std::vec::Vec< @@ -38448,9 +38417,9 @@ pub mod api { #[codec(index = 0)] Explicit, #[codec(index = 1)] - BackingSeconded(::subxt::ext::sp_core::H256), + BackingSeconded(::subxt::utils::H256), #[codec(index = 2)] - BackingValid(::subxt::ext::sp_core::H256), + BackingValid(::subxt::utils::H256), #[codec(index = 3)] ApprovalChecking, } @@ -38650,19 +38619,19 @@ pub mod api { #[codec(index = 0)] system( runtime_types::frame_support::dispatch::RawOrigin< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ), #[codec(index = 15)] Council( runtime_types::pallet_collective::RawOrigin< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ), #[codec(index = 16)] TechnicalCommittee( runtime_types::pallet_collective::RawOrigin< - ::subxt::ext::sp_core::crypto::AccountId32, + ::subxt::utils::account_id::AccountId32, >, ), #[codec(index = 50)] @@ -38846,14 +38815,14 @@ pub mod api { #[doc = "Funds were reserved for a winning bid. First balance is the extra amount reserved."] #[doc = "Second is the total."] Reserved { - bidder: ::subxt::ext::sp_core::crypto::AccountId32, + bidder: ::subxt::utils::account_id::AccountId32, extra_reserved: ::core::primitive::u128, total_amount: ::core::primitive::u128, }, #[codec(index = 3)] #[doc = "Funds were unreserved since bidder is no longer active. `[bidder, amount]`"] Unreserved { - bidder: ::subxt::ext::sp_core::crypto::AccountId32, + bidder: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 4)] @@ -38861,13 +38830,13 @@ pub mod api { #[doc = "but no parachain slot has been leased."] ReserveConfiscated { para_id: runtime_types::polkadot_parachain::primitives::Id, - leaser: ::subxt::ext::sp_core::crypto::AccountId32, + leaser: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, }, #[codec(index = 5)] #[doc = "A new bid has been accepted as the current winner."] BidAccepted { - bidder: ::subxt::ext::sp_core::crypto::AccountId32, + bidder: ::subxt::utils::account_id::AccountId32, para_id: runtime_types::polkadot_parachain::primitives::Id, amount: ::core::primitive::u128, first_slot: ::core::primitive::u32, @@ -38893,7 +38862,7 @@ pub mod api { )] #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] pub enum Call { - # [codec (index = 0)] # [doc = "Make a claim to collect your DOTs."] # [doc = ""] # [doc = "The dispatch origin for this call must be _None_."] # [doc = ""] # [doc = "Unsigned Validation:"] # [doc = "A call to claim is deemed valid if the signature provided matches"] # [doc = "the expected signed message of:"] # [doc = ""] # [doc = "> Ethereum Signed Message:"] # [doc = "> (configured prefix string)(address)"] # [doc = ""] # [doc = "and `address` matches the `dest` account."] # [doc = ""] # [doc = "Parameters:"] # [doc = "- `dest`: The destination account to payout the claim."] # [doc = "- `ethereum_signature`: The signature of an ethereum signed message"] # [doc = " matching the format described above."] # [doc = ""] # [doc = ""] # [doc = "The weight of this call is invariant over the input parameters."] # [doc = "Weight includes logic to validate unsigned `claim` call."] # [doc = ""] # [doc = "Total Complexity: O(1)"] # [doc = ""] claim { dest : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , ethereum_signature : runtime_types :: polkadot_runtime_common :: claims :: EcdsaSignature , } , # [codec (index = 1)] # [doc = "Mint a new claim to collect DOTs."] # [doc = ""] # [doc = "The dispatch origin for this call must be _Root_."] # [doc = ""] # [doc = "Parameters:"] # [doc = "- `who`: The Ethereum address allowed to collect this claim."] # [doc = "- `value`: The number of DOTs that will be claimed."] # [doc = "- `vesting_schedule`: An optional vesting schedule for these DOTs."] # [doc = ""] # [doc = ""] # [doc = "The weight of this call is invariant over the input parameters."] # [doc = "We assume worst case that both vesting and statement is being inserted."] # [doc = ""] # [doc = "Total Complexity: O(1)"] # [doc = ""] mint_claim { who : runtime_types :: polkadot_runtime_common :: claims :: EthereumAddress , value : :: core :: primitive :: u128 , vesting_schedule : :: core :: option :: Option < (:: core :: primitive :: u128 , :: core :: primitive :: u128 , :: core :: primitive :: u32 ,) > , statement : :: core :: option :: Option < runtime_types :: polkadot_runtime_common :: claims :: StatementKind > , } , # [codec (index = 2)] # [doc = "Make a claim to collect your DOTs by signing a statement."] # [doc = ""] # [doc = "The dispatch origin for this call must be _None_."] # [doc = ""] # [doc = "Unsigned Validation:"] # [doc = "A call to `claim_attest` is deemed valid if the signature provided matches"] # [doc = "the expected signed message of:"] # [doc = ""] # [doc = "> Ethereum Signed Message:"] # [doc = "> (configured prefix string)(address)(statement)"] # [doc = ""] # [doc = "and `address` matches the `dest` account; the `statement` must match that which is"] # [doc = "expected according to your purchase arrangement."] # [doc = ""] # [doc = "Parameters:"] # [doc = "- `dest`: The destination account to payout the claim."] # [doc = "- `ethereum_signature`: The signature of an ethereum signed message"] # [doc = " matching the format described above."] # [doc = "- `statement`: The identity of the statement which is being attested to in the signature."] # [doc = ""] # [doc = ""] # [doc = "The weight of this call is invariant over the input parameters."] # [doc = "Weight includes logic to validate unsigned `claim_attest` call."] # [doc = ""] # [doc = "Total Complexity: O(1)"] # [doc = ""] claim_attest { dest : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , ethereum_signature : runtime_types :: polkadot_runtime_common :: claims :: EcdsaSignature , statement : :: std :: vec :: Vec < :: core :: primitive :: u8 > , } , # [codec (index = 3)] # [doc = "Attest to a statement, needed to finalize the claims process."] # [doc = ""] # [doc = "WARNING: Insecure unless your chain includes `PrevalidateAttests` as a `SignedExtension`."] # [doc = ""] # [doc = "Unsigned Validation:"] # [doc = "A call to attest is deemed valid if the sender has a `Preclaim` registered"] # [doc = "and provides a `statement` which is expected for the account."] # [doc = ""] # [doc = "Parameters:"] # [doc = "- `statement`: The identity of the statement which is being attested to in the signature."] # [doc = ""] # [doc = ""] # [doc = "The weight of this call is invariant over the input parameters."] # [doc = "Weight includes logic to do pre-validation on `attest` call."] # [doc = ""] # [doc = "Total Complexity: O(1)"] # [doc = ""] attest { statement : :: std :: vec :: Vec < :: core :: primitive :: u8 > , } , # [codec (index = 4)] move_claim { old : runtime_types :: polkadot_runtime_common :: claims :: EthereumAddress , new : runtime_types :: polkadot_runtime_common :: claims :: EthereumAddress , maybe_preclaim : :: core :: option :: Option < :: subxt :: ext :: sp_core :: crypto :: AccountId32 > , } , } + # [codec (index = 0)] # [doc = "Make a claim to collect your DOTs."] # [doc = ""] # [doc = "The dispatch origin for this call must be _None_."] # [doc = ""] # [doc = "Unsigned Validation:"] # [doc = "A call to claim is deemed valid if the signature provided matches"] # [doc = "the expected signed message of:"] # [doc = ""] # [doc = "> Ethereum Signed Message:"] # [doc = "> (configured prefix string)(address)"] # [doc = ""] # [doc = "and `address` matches the `dest` account."] # [doc = ""] # [doc = "Parameters:"] # [doc = "- `dest`: The destination account to payout the claim."] # [doc = "- `ethereum_signature`: The signature of an ethereum signed message"] # [doc = " matching the format described above."] # [doc = ""] # [doc = ""] # [doc = "The weight of this call is invariant over the input parameters."] # [doc = "Weight includes logic to validate unsigned `claim` call."] # [doc = ""] # [doc = "Total Complexity: O(1)"] # [doc = ""] claim { dest : :: subxt :: utils :: account_id :: AccountId32 , ethereum_signature : runtime_types :: polkadot_runtime_common :: claims :: EcdsaSignature , } , # [codec (index = 1)] # [doc = "Mint a new claim to collect DOTs."] # [doc = ""] # [doc = "The dispatch origin for this call must be _Root_."] # [doc = ""] # [doc = "Parameters:"] # [doc = "- `who`: The Ethereum address allowed to collect this claim."] # [doc = "- `value`: The number of DOTs that will be claimed."] # [doc = "- `vesting_schedule`: An optional vesting schedule for these DOTs."] # [doc = ""] # [doc = ""] # [doc = "The weight of this call is invariant over the input parameters."] # [doc = "We assume worst case that both vesting and statement is being inserted."] # [doc = ""] # [doc = "Total Complexity: O(1)"] # [doc = ""] mint_claim { who : runtime_types :: polkadot_runtime_common :: claims :: EthereumAddress , value : :: core :: primitive :: u128 , vesting_schedule : :: core :: option :: Option < (:: core :: primitive :: u128 , :: core :: primitive :: u128 , :: core :: primitive :: u32 ,) > , statement : :: core :: option :: Option < runtime_types :: polkadot_runtime_common :: claims :: StatementKind > , } , # [codec (index = 2)] # [doc = "Make a claim to collect your DOTs by signing a statement."] # [doc = ""] # [doc = "The dispatch origin for this call must be _None_."] # [doc = ""] # [doc = "Unsigned Validation:"] # [doc = "A call to `claim_attest` is deemed valid if the signature provided matches"] # [doc = "the expected signed message of:"] # [doc = ""] # [doc = "> Ethereum Signed Message:"] # [doc = "> (configured prefix string)(address)(statement)"] # [doc = ""] # [doc = "and `address` matches the `dest` account; the `statement` must match that which is"] # [doc = "expected according to your purchase arrangement."] # [doc = ""] # [doc = "Parameters:"] # [doc = "- `dest`: The destination account to payout the claim."] # [doc = "- `ethereum_signature`: The signature of an ethereum signed message"] # [doc = " matching the format described above."] # [doc = "- `statement`: The identity of the statement which is being attested to in the signature."] # [doc = ""] # [doc = ""] # [doc = "The weight of this call is invariant over the input parameters."] # [doc = "Weight includes logic to validate unsigned `claim_attest` call."] # [doc = ""] # [doc = "Total Complexity: O(1)"] # [doc = ""] claim_attest { dest : :: subxt :: utils :: account_id :: AccountId32 , ethereum_signature : runtime_types :: polkadot_runtime_common :: claims :: EcdsaSignature , statement : :: std :: vec :: Vec < :: core :: primitive :: u8 > , } , # [codec (index = 3)] # [doc = "Attest to a statement, needed to finalize the claims process."] # [doc = ""] # [doc = "WARNING: Insecure unless your chain includes `PrevalidateAttests` as a `SignedExtension`."] # [doc = ""] # [doc = "Unsigned Validation:"] # [doc = "A call to attest is deemed valid if the sender has a `Preclaim` registered"] # [doc = "and provides a `statement` which is expected for the account."] # [doc = ""] # [doc = "Parameters:"] # [doc = "- `statement`: The identity of the statement which is being attested to in the signature."] # [doc = ""] # [doc = ""] # [doc = "The weight of this call is invariant over the input parameters."] # [doc = "Weight includes logic to do pre-validation on `attest` call."] # [doc = ""] # [doc = "Total Complexity: O(1)"] # [doc = ""] attest { statement : :: std :: vec :: Vec < :: core :: primitive :: u8 > , } , # [codec (index = 4)] move_claim { old : runtime_types :: polkadot_runtime_common :: claims :: EthereumAddress , new : runtime_types :: polkadot_runtime_common :: claims :: EthereumAddress , maybe_preclaim : :: core :: option :: Option < :: subxt :: utils :: account_id :: AccountId32 > , } , } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -38928,7 +38897,7 @@ pub mod api { )] #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] pub enum Event { - # [codec (index = 0)] # [doc = "Someone claimed some DOTs."] Claimed { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , ethereum_address : runtime_types :: polkadot_runtime_common :: claims :: EthereumAddress , amount : :: core :: primitive :: u128 , } , } + # [codec (index = 0)] # [doc = "Someone claimed some DOTs."] Claimed { who : :: subxt :: utils :: account_id :: AccountId32 , ethereum_address : runtime_types :: polkadot_runtime_common :: claims :: EthereumAddress , amount : :: core :: primitive :: u128 , } , } } #[derive( :: subxt :: ext :: codec :: Decode, @@ -39022,7 +38991,7 @@ pub mod api { #[doc = "- `who`: The account whose contribution should be withdrawn."] #[doc = "- `index`: The parachain to whose crowdloan the contribution was made."] withdraw { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, #[codec(compact)] index: runtime_types::polkadot_parachain::primitives::Id, }, @@ -39179,14 +39148,14 @@ pub mod api { #[codec(index = 1)] #[doc = "Contributed to a crowd sale."] Contributed { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, fund_index: runtime_types::polkadot_parachain::primitives::Id, amount: ::core::primitive::u128, }, #[codec(index = 2)] #[doc = "Withdrew full balance of a contributor."] Withdrew { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, fund_index: runtime_types::polkadot_parachain::primitives::Id, amount: ::core::primitive::u128, }, @@ -39223,7 +39192,7 @@ pub mod api { #[codec(index = 8)] #[doc = "A memo has been updated."] MemoUpdated { - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, para_id: runtime_types::polkadot_parachain::primitives::Id, memo: ::std::vec::Vec<::core::primitive::u8>, }, @@ -39265,7 +39234,7 @@ pub mod api { )] #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] pub enum Call { - # [codec (index = 0)] # [doc = "Register head data and validation code for a reserved Para Id."] # [doc = ""] # [doc = "## Arguments"] # [doc = "- `origin`: Must be called by a `Signed` origin."] # [doc = "- `id`: The para ID. Must be owned/managed by the `origin` signing account."] # [doc = "- `genesis_head`: The genesis head data of the parachain/thread."] # [doc = "- `validation_code`: The initial validation code of the parachain/thread."] # [doc = ""] # [doc = "## Deposits/Fees"] # [doc = "The origin signed account must reserve a corresponding deposit for the registration. Anything already"] # [doc = "reserved previously for this para ID is accounted for."] # [doc = ""] # [doc = "## Events"] # [doc = "The `Registered` event is emitted in case of success."] register { id : runtime_types :: polkadot_parachain :: primitives :: Id , genesis_head : runtime_types :: polkadot_parachain :: primitives :: HeadData , validation_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode , } , # [codec (index = 1)] # [doc = "Force the registration of a Para Id on the relay chain."] # [doc = ""] # [doc = "This function must be called by a Root origin."] # [doc = ""] # [doc = "The deposit taken can be specified for this registration. Any `ParaId`"] # [doc = "can be registered, including sub-1000 IDs which are System Parachains."] force_register { who : :: subxt :: ext :: sp_core :: crypto :: AccountId32 , deposit : :: core :: primitive :: u128 , id : runtime_types :: polkadot_parachain :: primitives :: Id , genesis_head : runtime_types :: polkadot_parachain :: primitives :: HeadData , validation_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode , } , # [codec (index = 2)] # [doc = "Deregister a Para Id, freeing all data and returning any deposit."] # [doc = ""] # [doc = "The caller must be Root, the `para` owner, or the `para` itself. The para must be a parathread."] deregister { id : runtime_types :: polkadot_parachain :: primitives :: Id , } , # [codec (index = 3)] # [doc = "Swap a parachain with another parachain or parathread."] # [doc = ""] # [doc = "The origin must be Root, the `para` owner, or the `para` itself."] # [doc = ""] # [doc = "The swap will happen only if there is already an opposite swap pending. If there is not,"] # [doc = "the swap will be stored in the pending swaps map, ready for a later confirmatory swap."] # [doc = ""] # [doc = "The `ParaId`s remain mapped to the same head data and code so external code can rely on"] # [doc = "`ParaId` to be a long-term identifier of a notional \"parachain\". However, their"] # [doc = "scheduling info (i.e. whether they're a parathread or parachain), auction information"] # [doc = "and the auction deposit are switched."] swap { id : runtime_types :: polkadot_parachain :: primitives :: Id , other : runtime_types :: polkadot_parachain :: primitives :: Id , } , # [codec (index = 4)] # [doc = "Remove a manager lock from a para. This will allow the manager of a"] # [doc = "previously locked para to deregister or swap a para without using governance."] # [doc = ""] # [doc = "Can only be called by the Root origin or the parachain."] remove_lock { para : runtime_types :: polkadot_parachain :: primitives :: Id , } , # [codec (index = 5)] # [doc = "Reserve a Para Id on the relay chain."] # [doc = ""] # [doc = "This function will reserve a new Para Id to be owned/managed by the origin account."] # [doc = "The origin account is able to register head data and validation code using `register` to create"] # [doc = "a parathread. Using the Slots pallet, a parathread can then be upgraded to get a parachain slot."] # [doc = ""] # [doc = "## Arguments"] # [doc = "- `origin`: Must be called by a `Signed` origin. Becomes the manager/owner of the new para ID."] # [doc = ""] # [doc = "## Deposits/Fees"] # [doc = "The origin must reserve a deposit of `ParaDeposit` for the registration."] # [doc = ""] # [doc = "## Events"] # [doc = "The `Reserved` event is emitted in case of success, which provides the ID reserved for use."] reserve , # [codec (index = 6)] # [doc = "Add a manager lock from a para. This will prevent the manager of a"] # [doc = "para to deregister or swap a para."] # [doc = ""] # [doc = "Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked."] add_lock { para : runtime_types :: polkadot_parachain :: primitives :: Id , } , # [codec (index = 7)] # [doc = "Schedule a parachain upgrade."] # [doc = ""] # [doc = "Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked."] schedule_code_upgrade { para : runtime_types :: polkadot_parachain :: primitives :: Id , new_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode , } , # [codec (index = 8)] # [doc = "Set the parachain's current head."] # [doc = ""] # [doc = "Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked."] set_current_head { para : runtime_types :: polkadot_parachain :: primitives :: Id , new_head : runtime_types :: polkadot_parachain :: primitives :: HeadData , } , } + # [codec (index = 0)] # [doc = "Register head data and validation code for a reserved Para Id."] # [doc = ""] # [doc = "## Arguments"] # [doc = "- `origin`: Must be called by a `Signed` origin."] # [doc = "- `id`: The para ID. Must be owned/managed by the `origin` signing account."] # [doc = "- `genesis_head`: The genesis head data of the parachain/thread."] # [doc = "- `validation_code`: The initial validation code of the parachain/thread."] # [doc = ""] # [doc = "## Deposits/Fees"] # [doc = "The origin signed account must reserve a corresponding deposit for the registration. Anything already"] # [doc = "reserved previously for this para ID is accounted for."] # [doc = ""] # [doc = "## Events"] # [doc = "The `Registered` event is emitted in case of success."] register { id : runtime_types :: polkadot_parachain :: primitives :: Id , genesis_head : runtime_types :: polkadot_parachain :: primitives :: HeadData , validation_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode , } , # [codec (index = 1)] # [doc = "Force the registration of a Para Id on the relay chain."] # [doc = ""] # [doc = "This function must be called by a Root origin."] # [doc = ""] # [doc = "The deposit taken can be specified for this registration. Any `ParaId`"] # [doc = "can be registered, including sub-1000 IDs which are System Parachains."] force_register { who : :: subxt :: utils :: account_id :: AccountId32 , deposit : :: core :: primitive :: u128 , id : runtime_types :: polkadot_parachain :: primitives :: Id , genesis_head : runtime_types :: polkadot_parachain :: primitives :: HeadData , validation_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode , } , # [codec (index = 2)] # [doc = "Deregister a Para Id, freeing all data and returning any deposit."] # [doc = ""] # [doc = "The caller must be Root, the `para` owner, or the `para` itself. The para must be a parathread."] deregister { id : runtime_types :: polkadot_parachain :: primitives :: Id , } , # [codec (index = 3)] # [doc = "Swap a parachain with another parachain or parathread."] # [doc = ""] # [doc = "The origin must be Root, the `para` owner, or the `para` itself."] # [doc = ""] # [doc = "The swap will happen only if there is already an opposite swap pending. If there is not,"] # [doc = "the swap will be stored in the pending swaps map, ready for a later confirmatory swap."] # [doc = ""] # [doc = "The `ParaId`s remain mapped to the same head data and code so external code can rely on"] # [doc = "`ParaId` to be a long-term identifier of a notional \"parachain\". However, their"] # [doc = "scheduling info (i.e. whether they're a parathread or parachain), auction information"] # [doc = "and the auction deposit are switched."] swap { id : runtime_types :: polkadot_parachain :: primitives :: Id , other : runtime_types :: polkadot_parachain :: primitives :: Id , } , # [codec (index = 4)] # [doc = "Remove a manager lock from a para. This will allow the manager of a"] # [doc = "previously locked para to deregister or swap a para without using governance."] # [doc = ""] # [doc = "Can only be called by the Root origin or the parachain."] remove_lock { para : runtime_types :: polkadot_parachain :: primitives :: Id , } , # [codec (index = 5)] # [doc = "Reserve a Para Id on the relay chain."] # [doc = ""] # [doc = "This function will reserve a new Para Id to be owned/managed by the origin account."] # [doc = "The origin account is able to register head data and validation code using `register` to create"] # [doc = "a parathread. Using the Slots pallet, a parathread can then be upgraded to get a parachain slot."] # [doc = ""] # [doc = "## Arguments"] # [doc = "- `origin`: Must be called by a `Signed` origin. Becomes the manager/owner of the new para ID."] # [doc = ""] # [doc = "## Deposits/Fees"] # [doc = "The origin must reserve a deposit of `ParaDeposit` for the registration."] # [doc = ""] # [doc = "## Events"] # [doc = "The `Reserved` event is emitted in case of success, which provides the ID reserved for use."] reserve , # [codec (index = 6)] # [doc = "Add a manager lock from a para. This will prevent the manager of a"] # [doc = "para to deregister or swap a para."] # [doc = ""] # [doc = "Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked."] add_lock { para : runtime_types :: polkadot_parachain :: primitives :: Id , } , # [codec (index = 7)] # [doc = "Schedule a parachain upgrade."] # [doc = ""] # [doc = "Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked."] schedule_code_upgrade { para : runtime_types :: polkadot_parachain :: primitives :: Id , new_code : runtime_types :: polkadot_parachain :: primitives :: ValidationCode , } , # [codec (index = 8)] # [doc = "Set the parachain's current head."] # [doc = ""] # [doc = "Can be called by Root, the parachain, or the parachain manager if the parachain is unlocked."] set_current_head { para : runtime_types :: polkadot_parachain :: primitives :: Id , new_head : runtime_types :: polkadot_parachain :: primitives :: HeadData , } , } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -39327,7 +39296,7 @@ pub mod api { #[codec(index = 0)] Registered { para_id: runtime_types::polkadot_parachain::primitives::Id, - manager: ::subxt::ext::sp_core::crypto::AccountId32, + manager: ::subxt::utils::account_id::AccountId32, }, #[codec(index = 1)] Deregistered { @@ -39336,7 +39305,7 @@ pub mod api { #[codec(index = 2)] Reserved { para_id: runtime_types::polkadot_parachain::primitives::Id, - who: ::subxt::ext::sp_core::crypto::AccountId32, + who: ::subxt::utils::account_id::AccountId32, }, } } @@ -39369,7 +39338,7 @@ pub mod api { #[doc = "The dispatch origin for this call must match `T::ForceOrigin`."] force_lease { para: runtime_types::polkadot_parachain::primitives::Id, - leaser: ::subxt::ext::sp_core::crypto::AccountId32, + leaser: ::subxt::utils::account_id::AccountId32, amount: ::core::primitive::u128, period_begin: ::core::primitive::u32, period_count: ::core::primitive::u32, @@ -39425,7 +39394,7 @@ pub mod api { #[doc = "Second balance is the total amount reserved."] Leased { para_id: runtime_types::polkadot_parachain::primitives::Id, - leaser: ::subxt::ext::sp_core::crypto::AccountId32, + leaser: ::subxt::utils::account_id::AccountId32, period_begin: ::core::primitive::u32, period_count: ::core::primitive::u32, extra_reserved: ::core::primitive::u128, @@ -39903,7 +39872,7 @@ pub mod api { pub max_message_size: ::core::primitive::u32, pub msg_count: ::core::primitive::u32, pub total_size: ::core::primitive::u32, - pub mqc_head: ::core::option::Option<::subxt::ext::sp_core::H256>, + pub mqc_head: ::core::option::Option<::subxt::utils::H256>, pub sender_deposit: ::core::primitive::u128, pub recipient_deposit: ::core::primitive::u128, } @@ -40041,7 +40010,7 @@ pub mod api { #[doc = "A candidate was backed. `[candidate, head_data]`"] CandidateBacked( runtime_types::polkadot_primitives::v2::CandidateReceipt< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, runtime_types::polkadot_parachain::primitives::HeadData, runtime_types::polkadot_primitives::v2::CoreIndex, @@ -40051,7 +40020,7 @@ pub mod api { #[doc = "A candidate was included. `[candidate, head_data]`"] CandidateIncluded( runtime_types::polkadot_primitives::v2::CandidateReceipt< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, runtime_types::polkadot_parachain::primitives::HeadData, runtime_types::polkadot_primitives::v2::CoreIndex, @@ -40061,7 +40030,7 @@ pub mod api { #[doc = "A candidate timed out. `[candidate, head_data]`"] CandidateTimedOut( runtime_types::polkadot_primitives::v2::CandidateReceipt< - ::subxt::ext::sp_core::H256, + ::subxt::utils::H256, >, runtime_types::polkadot_parachain::primitives::HeadData, runtime_types::polkadot_primitives::v2::CoreIndex, @@ -41458,11 +41427,11 @@ pub mod api { Debug, )] pub struct Header<_0, _1> { - pub parent_hash: ::subxt::ext::sp_core::H256, + pub parent_hash: ::subxt::utils::H256, #[codec(compact)] pub number: _0, - pub state_root: ::subxt::ext::sp_core::H256, - pub extrinsics_root: ::subxt::ext::sp_core::H256, + pub state_root: ::subxt::utils::H256, + pub extrinsics_root: ::subxt::utils::H256, pub digest: runtime_types::sp_runtime::generic::digest::Digest, #[codec(skip)] pub __subxt_unused_type_params: ::core::marker::PhantomData<_1>, diff --git a/testing/integration-tests/src/frame/balances.rs b/testing/integration-tests/src/frame/balances.rs index 83bdf06c976..65cd880808c 100644 --- a/testing/integration-tests/src/frame/balances.rs +++ b/testing/integration-tests/src/frame/balances.rs @@ -18,13 +18,15 @@ use sp_core::{ Pair as _, }; use sp_keyring::AccountKeyring; -use sp_runtime::{ - AccountId32, - MultiAddress, -}; -use subxt::error::{ - DispatchError, - Error, +use subxt::{ + error::{ + DispatchError, + Error, + }, + utils::{ + AccountId32, + MultiAddress, + }, }; #[tokio::test] @@ -250,8 +252,9 @@ async fn storage_total_issuance() { #[tokio::test] async fn storage_balance_lock() -> Result<(), subxt::Error> { - let bob = pair_signer(AccountKeyring::Bob.pair()); - let charlie = AccountKeyring::Charlie.to_account_id(); + let bob_signer = pair_signer(AccountKeyring::Bob.pair()); + let bob: AccountId32 = AccountKeyring::Bob.to_account_id().into(); + let charlie: AccountId32 = AccountKeyring::Charlie.to_account_id().into(); let ctx = test_context().await; let api = ctx.client(); @@ -262,16 +265,14 @@ async fn storage_balance_lock() -> Result<(), subxt::Error> { ); api.tx() - .sign_and_submit_then_watch_default(&tx, &bob) + .sign_and_submit_then_watch_default(&tx, &bob_signer) .await? .wait_for_finalized_success() .await? .find_first::()? .expect("No ExtrinsicSuccess Event found"); - let locks_addr = node_runtime::storage() - .balances() - .locks(AccountKeyring::Bob.to_account_id()); + let locks_addr = node_runtime::storage().balances().locks(bob); let locks = api.storage().fetch_or_default(&locks_addr, None).await?; @@ -330,12 +331,13 @@ async fn transfer_error() { #[tokio::test] async fn transfer_implicit_subscription() { let alice = pair_signer(AccountKeyring::Alice.pair()); - let bob = AccountKeyring::Bob.to_account_id(); - let bob_addr = bob.clone().into(); + let bob: AccountId32 = AccountKeyring::Bob.to_account_id().into(); let ctx = test_context().await; let api = ctx.client(); - let to_bob_tx = node_runtime::tx().balances().transfer(bob_addr, 10_000); + let to_bob_tx = node_runtime::tx() + .balances() + .transfer(bob.clone().into(), 10_000); let event = api .tx() @@ -353,7 +355,7 @@ async fn transfer_implicit_subscription() { event, balances::events::Transfer { from: alice.account_id().clone(), - to: bob.clone(), + to: bob, amount: 10_000 } ); diff --git a/testing/integration-tests/src/frame/contracts.rs b/testing/integration-tests/src/frame/contracts.rs index 1dfc44a88e9..84cf1b89538 100644 --- a/testing/integration-tests/src/frame/contracts.rs +++ b/testing/integration-tests/src/frame/contracts.rs @@ -18,12 +18,12 @@ use crate::{ TestContext, }; use sp_core::sr25519::Pair; -use sp_runtime::MultiAddress; use subxt::{ tx::{ PairSigner, TxProgress, }, + utils::MultiAddress, Config, Error, OnlineClient, diff --git a/testing/integration-tests/src/storage/mod.rs b/testing/integration-tests/src/storage/mod.rs index 3cae0ef37f2..458f8596a6c 100644 --- a/testing/integration-tests/src/storage/mod.rs +++ b/testing/integration-tests/src/storage/mod.rs @@ -9,6 +9,7 @@ use crate::{ utils::wait_for_blocks, }; use sp_keyring::AccountKeyring; +use subxt::utils::AccountId32; #[tokio::test] async fn storage_plain_lookup() -> Result<(), subxt::Error> { @@ -32,7 +33,7 @@ async fn storage_map_lookup() -> Result<(), subxt::Error> { let api = ctx.client(); let signer = pair_signer(AccountKeyring::Alice.pair()); - let alice = AccountKeyring::Alice.to_account_id(); + let alice: AccountId32 = AccountKeyring::Alice.to_account_id().into(); // Do some transaction to bump the Alice nonce to 1: let remark_tx = node_runtime::tx().system().remark(vec![1, 2, 3, 4, 5]); @@ -43,7 +44,7 @@ async fn storage_map_lookup() -> Result<(), subxt::Error> { .await?; // Look up the nonce for the user (we expect it to be 1). - let nonce_addr = node_runtime::storage().system().account(&alice); + let nonce_addr = node_runtime::storage().system().account(alice); let entry = api.storage().fetch_or_default(&nonce_addr, None).await?; assert_eq!(entry.nonce, 1); @@ -90,8 +91,8 @@ async fn storage_n_map_storage_lookup() -> Result<(), subxt::Error> { // we "approveTransfer" of some of this asset class. This gives us an // entry in the `Approvals` StorageNMap that we can try to look up. let signer = pair_signer(AccountKeyring::Alice.pair()); - let alice = AccountKeyring::Alice.to_account_id(); - let bob = AccountKeyring::Bob.to_account_id(); + let alice: AccountId32 = AccountKeyring::Alice.to_account_id().into(); + let bob: AccountId32 = AccountKeyring::Bob.to_account_id().into(); let tx1 = node_runtime::tx() .assets() @@ -111,7 +112,7 @@ async fn storage_n_map_storage_lookup() -> Result<(), subxt::Error> { .await?; // The actual test; look up this approval in storage: - let addr = node_runtime::storage().assets().approvals(99, &alice, &bob); + let addr = node_runtime::storage().assets().approvals(99, alice, bob); let entry = api.storage().fetch(&addr, None).await?; assert_eq!(entry.map(|a| a.amount), Some(123)); Ok(()) diff --git a/testing/test-runtime/Cargo.toml b/testing/test-runtime/Cargo.toml index ae32e25e6d0..c00248003fe 100644 --- a/testing/test-runtime/Cargo.toml +++ b/testing/test-runtime/Cargo.toml @@ -6,12 +6,11 @@ publish = false [dependencies] subxt = { path = "../../subxt" } -sp-runtime = "7.0.0" +sp-runtime = "12.0.0" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] } [build-dependencies] subxt = { path = "../../subxt" } -sp-core = { version = "7.0.0", default-features = false } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } which = "4.2.2" jsonrpsee = { version = "0.16.0", features = ["async-client", "client-ws-transport"] } diff --git a/testing/test-runtime/build.rs b/testing/test-runtime/build.rs index 3b910b5d3e3..7d437fcff15 100644 --- a/testing/test-runtime/build.rs +++ b/testing/test-runtime/build.rs @@ -47,7 +47,7 @@ async fn run() { }; // Download metadata from binary; retry until successful, or a limit is hit. - let metadata_bytes: sp_core::Bytes = { + let metadata_bytes: subxt::rpc::types::Bytes = { const MAX_RETRIES: usize = 6; let mut retries = 0; From a71f32f60d48ebd5f0d2cc62eaf4466f00701cbd Mon Sep 17 00:00:00 2001 From: James Wilson Date: Wed, 11 Jan 2023 11:04:05 +0000 Subject: [PATCH 17/37] Fix decoding events via `.as_root_event()` and add test (#767) * fix decoding events via as_root_event and add test * fmt and clippy * Update subxt/src/events/events_type.rs Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Co-authored-by: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> --- subxt/src/events/events_type.rs | 62 +++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/subxt/src/events/events_type.rs b/subxt/src/events/events_type.rs index 234f6aa7b5e..7efc7d93d40 100644 --- a/subxt/src/events/events_type.rs +++ b/subxt/src/events/events_type.rs @@ -201,10 +201,12 @@ pub struct EventDetails { all_bytes: Arc<[u8]>, // start of the bytes (phase, pallet/variant index and then fields and then topic to follow). start_idx: usize, - // start of the fields (ie after phase nad pallet/variant index). - fields_start_idx: usize, + // start of the event (ie pallet/variant index and then the fields and topic after). + event_start_idx: usize, + // start of the fields (ie after phase and pallet/variant index). + event_fields_start_idx: usize, // end of the fields. - fields_end_idx: usize, + event_fields_end_idx: usize, // end of everything (fields + topics) end_idx: usize, metadata: Metadata, @@ -221,10 +223,13 @@ impl EventDetails { let input = &mut &all_bytes[start_idx..]; let phase = Phase::decode(input)?; + + let event_start_idx = all_bytes.len() - input.len(); + let pallet_index = u8::decode(input)?; let variant_index = u8::decode(input)?; - let fields_start_idx = all_bytes.len() - input.len(); + let event_fields_start_idx = all_bytes.len() - input.len(); // Get metadata for the event: let event_metadata = metadata.event(pallet_index, variant_index)?; @@ -246,7 +251,7 @@ impl EventDetails { } // the end of the field bytes. - let fields_end_idx = all_bytes.len() - input.len(); + let event_fields_end_idx = all_bytes.len() - input.len(); // topics come after the event data in EventRecord. They aren't used for // anything at the moment, so just decode and throw them away. @@ -259,8 +264,9 @@ impl EventDetails { phase, index, start_idx, - fields_start_idx, - fields_end_idx, + event_start_idx, + event_fields_start_idx, + event_fields_end_idx, end_idx, all_bytes, metadata, @@ -281,14 +287,14 @@ impl EventDetails { pub fn pallet_index(&self) -> u8 { // Note: never panics; we expect these bytes to exist // in order that the EventDetails could be created. - self.all_bytes[self.fields_start_idx - 2] + self.all_bytes[self.event_fields_start_idx - 2] } /// The index of the event variant that the event originated from. pub fn variant_index(&self) -> u8 { // Note: never panics; we expect these bytes to exist // in order that the EventDetails could be created. - self.all_bytes[self.fields_start_idx - 1] + self.all_bytes[self.event_fields_start_idx - 1] } /// The name of the pallet from whence the Event originated. @@ -319,7 +325,7 @@ impl EventDetails { /// Return the bytes representing the fields stored in this event. pub fn field_bytes(&self) -> &[u8] { - &self.all_bytes[self.fields_start_idx..self.fields_end_idx] + &self.all_bytes[self.event_fields_start_idx..self.event_fields_end_idx] } /// Decode and provide the event fields back in the form of a [`scale_value::Composite`] @@ -384,7 +390,7 @@ impl EventDetails { /// the pallet and event enum variants as well as the event fields). A compatible /// type for this is exposed via static codegen as a root level `Event` type. pub fn as_root_event(&self) -> Result { - E::decode(&mut self.bytes()) + E::decode(&mut &self.all_bytes[self.event_start_idx..self.event_fields_end_idx]) } } @@ -503,6 +509,7 @@ mod tests { event_record, events, events_raw, + AllEvents, }, *, }; @@ -572,6 +579,39 @@ mod tests { assert_eq!(actual_fields_no_context, expected.fields); } + #[test] + fn statically_decode_single_root_event() { + #[derive(Clone, Debug, PartialEq, Decode, Encode, TypeInfo)] + enum Event { + A(u8, bool, Vec), + } + + // Create fake metadata that knows about our single event, above: + let metadata = metadata::(); + + // Encode our events in the format we expect back from a node, and + // construst an Events object to iterate them: + let event = Event::A(1, true, vec!["Hi".into()]); + let events = events::( + metadata, + vec![event_record(Phase::ApplyExtrinsic(123), event.clone())], + ); + + let ev = events + .iter() + .next() + .expect("one event expected") + .expect("event should be extracted OK"); + + // This is the line we're testing: + let decoded_event = ev + .as_root_event::>() + .expect("can decode event into root enum again"); + + // It should equal the event we put in: + assert_eq!(decoded_event, AllEvents::Test(event)); + } + #[test] fn dynamically_decode_single_event() { #[derive(Clone, Debug, PartialEq, Decode, Encode, TypeInfo)] From a4330821186761743252b96bf125316d40f7facc Mon Sep 17 00:00:00 2001 From: James Wilson Date: Wed, 11 Jan 2023 12:33:40 +0000 Subject: [PATCH 18/37] Make dependabot less aggressive (#771) * Make dependabot less aggressive And ignore sp- crates, since they need to be updated together, and dependabot can't yet do grouped PRs. We should periodically just keep on top of this anyway, but I don't think we need to be constantly updating them. * dependency-name * Try weekly instead of monthly --- .github/dependabot.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fc4483685fb..1ccfdde27cb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,8 +3,16 @@ updates: - package-ecosystem: "cargo" directory: "/" schedule: - interval: "daily" + interval: weekly + ignore: + # these need to be updated together, so dependabot PRs + # are just noise. So, ignore them: + - dependency-name: sp-core + - dependency-name: sp-keyring + - dependency-name: sp-runtime + - dependency-name: sp-core-hashing + - dependency-name: sp-version - package-ecosystem: github-actions directory: '/' schedule: - interval: daily + interval: weekly From d8c2e16151eeb53c12d0d4616fcb91b6f3c9cd1c Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Mon, 16 Jan 2023 17:35:00 +0100 Subject: [PATCH 19/37] fix(ci): pin trybuild `v1.0.75` (#783) --- testing/ui-tests/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/ui-tests/Cargo.toml b/testing/ui-tests/Cargo.toml index b544d1f5095..0efe6c62751 100644 --- a/testing/ui-tests/Cargo.toml +++ b/testing/ui-tests/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] [dev-dependencies] -trybuild = "1.0.63" +trybuild = "=1.0.75" scale-info = { version = "2.3.0", features = ["bit-vec"] } frame-metadata = "15.0.0" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] } From 25245ad1125e8a57397f1570a1ff05f6ba9af1d6 Mon Sep 17 00:00:00 2001 From: abhi Date: Mon, 16 Jan 2023 22:08:07 +0530 Subject: [PATCH 20/37] make ChainBlockExtrinsic cloneable (#778) --- subxt/src/rpc/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subxt/src/rpc/types.rs b/subxt/src/rpc/types.rs index 989308d7181..c68b17a08f8 100644 --- a/subxt/src/rpc/types.rs +++ b/subxt/src/rpc/types.rs @@ -114,7 +114,7 @@ pub type ConsensusEngineId = [u8; 4]; pub type EncodedJustification = Vec; /// Bytes representing an extrinsic in a [`ChainBlock`]. -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct ChainBlockExtrinsic(pub Vec); impl<'a> ::serde::Deserialize<'a> for ChainBlockExtrinsic { From 24c26e13a56b6a34e278f954e6fdaf438642707b Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Mon, 16 Jan 2023 18:43:02 +0200 Subject: [PATCH 21/37] ci: Print substrate version (#780) * ci: Print substrate version Signed-off-by: Alexandru Vasile * ci: Move substrate version to dedicated CI step Signed-off-by: Alexandru Vasile * Revert "ci: Move substrate version to dedicated CI step" This reverts commit b83de672d5bd3c2f09b02a598d63fd88a38fd9ab. * ci: Add version for all steps that download substrate Signed-off-by: Alexandru Vasile Signed-off-by: Alexandru Vasile --- .github/workflows/nightly.yml | 1 + .github/workflows/rust.yml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 8ced1b81ae4..5d8bb801213 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -23,6 +23,7 @@ jobs: run: | curl $SUBSTRATE_URL --output substrate --location chmod +x substrate + ./substrate --version mkdir -p ~/.local/bin mv substrate ~/.local/bin diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c6912560c04..cb117f10b86 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -29,6 +29,7 @@ jobs: run: | curl $SUBSTRATE_URL --output substrate --location chmod +x substrate + ./substrate --version mkdir -p ~/.local/bin mv substrate ~/.local/bin @@ -86,6 +87,7 @@ jobs: run: | curl $SUBSTRATE_URL --output substrate --location chmod +x substrate + ./substrate --version mkdir -p ~/.local/bin mv substrate ~/.local/bin @@ -119,6 +121,7 @@ jobs: run: | curl $SUBSTRATE_URL --output substrate --location chmod +x substrate + ./substrate --version mkdir -p ~/.local/bin mv substrate ~/.local/bin @@ -149,6 +152,7 @@ jobs: run: | curl $SUBSTRATE_URL --output substrate --location chmod +x substrate + ./substrate --version mkdir -p ~/.local/bin mv substrate ~/.local/bin @@ -192,6 +196,7 @@ jobs: run: | curl $SUBSTRATE_URL --output substrate --location chmod +x substrate + ./substrate --version mkdir -p ~/.local/bin mv substrate ~/.local/bin From a3713476da3581483014c464a4989e7029923416 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Tue, 17 Jan 2023 11:41:09 +0200 Subject: [PATCH 22/37] Update `trybuild` to the latest version (#785) * Update to trybuild version 1.0.76 Signed-off-by: Alexandru Vasile * tests: Adjust testing to the new trybuild location Signed-off-by: Alexandru Vasile Signed-off-by: Alexandru Vasile --- testing/ui-tests/Cargo.toml | 2 +- testing/ui-tests/src/correct/rust-items-preserved.rs | 2 +- testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs | 2 +- testing/ui-tests/src/incorrect/url_and_path_provided.rs | 2 +- testing/ui-tests/src/incorrect/url_and_path_provided.stderr | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testing/ui-tests/Cargo.toml b/testing/ui-tests/Cargo.toml index 0efe6c62751..01a9e548991 100644 --- a/testing/ui-tests/Cargo.toml +++ b/testing/ui-tests/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] [dev-dependencies] -trybuild = "=1.0.75" +trybuild = "1.0.76" scale-info = { version = "2.3.0", features = ["bit-vec"] } frame-metadata = "15.0.0" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] } diff --git a/testing/ui-tests/src/correct/rust-items-preserved.rs b/testing/ui-tests/src/correct/rust-items-preserved.rs index 99a31f4d205..e8269e768b6 100644 --- a/testing/ui-tests/src/correct/rust-items-preserved.rs +++ b/testing/ui-tests/src/correct/rust-items-preserved.rs @@ -1,4 +1,4 @@ -#[subxt::subxt(runtime_metadata_path = "../../../artifacts/polkadot_metadata.scale")] +#[subxt::subxt(runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale")] pub mod node_runtime { pub struct SomeStruct; pub enum SomeEnum { diff --git a/testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs b/testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs index 98424f05bc2..c5ad11e355c 100644 --- a/testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs +++ b/testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs @@ -1,4 +1,4 @@ -#[subxt::subxt(runtime_metadata_path = "../../../artifacts/polkadot_metadata.scale")] +#[subxt::subxt(runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale")] pub mod node_runtime { #[subxt::subxt(substitute_type = "sp_arithmetic::per_things::Perbill")] use sp_runtime::Perbill; diff --git a/testing/ui-tests/src/incorrect/url_and_path_provided.rs b/testing/ui-tests/src/incorrect/url_and_path_provided.rs index a6561cabf1a..47fd5b5d269 100644 --- a/testing/ui-tests/src/incorrect/url_and_path_provided.rs +++ b/testing/ui-tests/src/incorrect/url_and_path_provided.rs @@ -1,5 +1,5 @@ #[subxt::subxt( - runtime_metadata_path = "../../../artifacts/polkadot_metadata.scale", + runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale", runtime_metadata_url = "wss://rpc.polkadot.io:443" )] pub mod node_runtime {} diff --git a/testing/ui-tests/src/incorrect/url_and_path_provided.stderr b/testing/ui-tests/src/incorrect/url_and_path_provided.stderr index a680ed24924..5a98277e762 100644 --- a/testing/ui-tests/src/incorrect/url_and_path_provided.stderr +++ b/testing/ui-tests/src/incorrect/url_and_path_provided.stderr @@ -2,7 +2,7 @@ error: Only one of 'runtime_metadata_path' or 'runtime_metadata_url' can be prov --> src/incorrect/url_and_path_provided.rs:1:1 | 1 | / #[subxt::subxt( -2 | | runtime_metadata_path = "../../../artifacts/polkadot_metadata.scale", +2 | | runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale", 3 | | runtime_metadata_url = "wss://rpc.polkadot.io:443" 4 | | )] | |__^ From 26b8a81c17e6a00bf66cb5d37a1006ff8a262974 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Tue, 17 Jan 2023 09:42:04 +0000 Subject: [PATCH 23/37] Codegen: Preserve attrs and add #[allow(clippy::all)] (#784) * Preserve attrs on codegen and ignore all clippy on generated code * tweak and test attr preservation --- codegen/src/api/mod.rs | 3 ++ .../src/codegen/codegen_documentation.rs | 45 ++++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/codegen/src/api/mod.rs b/codegen/src/api/mod.rs index 8d11f2bfeab..65d347d24df 100644 --- a/codegen/src/api/mod.rs +++ b/codegen/src/api/mod.rs @@ -154,6 +154,7 @@ impl RuntimeGenerator { derives: DerivesRegistry, crate_path: CratePath, ) -> TokenStream2 { + let item_mod_attrs = item_mod.attrs.clone(); let item_mod_ir = ir::ItemMod::from(item_mod); let default_derives = derives.default_derives(); @@ -325,7 +326,9 @@ impl RuntimeGenerator { let rust_items = item_mod_ir.rust_items(); quote! { + #( #item_mod_attrs )* #[allow(dead_code, unused_imports, non_camel_case_types)] + #[allow(clippy::all)] pub mod #mod_ident { // Preserve any Rust items that were previously defined in the adorned module #( #rust_items ) * diff --git a/testing/integration-tests/src/codegen/codegen_documentation.rs b/testing/integration-tests/src/codegen/codegen_documentation.rs index 998d148fad6..547c1a1b37f 100644 --- a/testing/integration-tests/src/codegen/codegen_documentation.rs +++ b/testing/integration-tests/src/codegen/codegen_documentation.rs @@ -9,11 +9,14 @@ use subxt_codegen::{ RuntimeGenerator, }; +fn load_test_metadata() -> frame_metadata::RuntimeMetadataPrefixed { + let bytes = test_runtime::METADATA; + codec::Decode::decode(&mut &*bytes).expect("Cannot decode scale metadata") +} + fn metadata_docs() -> Vec { // Load the runtime metadata downloaded from a node via `test-runtime`. - let bytes = test_runtime::METADATA; - let meta: frame_metadata::RuntimeMetadataPrefixed = - codec::Decode::decode(&mut &*bytes).expect("Cannot decode scale metadata"); + let meta = load_test_metadata(); let metadata = match meta.1 { frame_metadata::RuntimeMetadata::V14(v14) => v14, _ => panic!("Unsupported metadata version {:?}", meta.1), @@ -45,9 +48,7 @@ fn metadata_docs() -> Vec { fn generate_runtime_interface(crate_path: CratePath) -> String { // Load the runtime metadata downloaded from a node via `test-runtime`. - let bytes = test_runtime::METADATA; - let metadata: frame_metadata::RuntimeMetadataPrefixed = - codec::Decode::decode(&mut &*bytes).expect("Cannot decode scale metadata"); + let metadata = load_test_metadata(); // Generate a runtime interface from the provided metadata. let generator = RuntimeGenerator::new(metadata); @@ -108,3 +109,35 @@ fn check_documentation() { ); } } + +#[test] +fn check_root_attrs_preserved() { + let metadata = load_test_metadata(); + + // Test that the root docs/attr are preserved. + let item_mod = syn::parse_quote!( + /// Some root level documentation + #[some_root_attribute] + pub mod api {} + ); + + // Generate a runtime interface from the provided metadata. + let generator = RuntimeGenerator::new(metadata); + let derives = DerivesRegistry::new(&CratePath::default()); + let generated_code = generator + .generate_runtime(item_mod, derives, CratePath::default()) + .to_string(); + + let doc_str_loc = generated_code + .find("Some root level documentation") + .expect("root docs should be preserved"); + let attr_loc = generated_code.find("some_root_attribute") // '#' is space separated in generated output. + .expect("root attr should be preserved"); + let mod_start = generated_code + .find("pub mod api") + .expect("'pub mod api' expected"); + + // These things should be before the mod start + assert!(doc_str_loc < mod_start); + assert!(attr_loc < mod_start); +} From c9f414f4ed7e9f6891eded667a6181dd5345590c Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Tue, 17 Jan 2023 18:42:44 +0900 Subject: [PATCH 24/37] Implement deserialize (#773) --- subxt/src/utils/account_id.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/subxt/src/utils/account_id.rs b/subxt/src/utils/account_id.rs index 34e56cd87e1..2c8ae354c1f 100644 --- a/subxt/src/utils/account_id.rs +++ b/subxt/src/utils/account_id.rs @@ -10,7 +10,10 @@ use codec::{ Decode, Encode, }; -use serde::Serialize; +use serde::{ + Deserialize, + Serialize, +}; /// A 32-byte cryptographic identifier. This is a simplified version of Substrate's /// `sp_core::crypto::AccountId32`. To obtain more functionality, convert this into @@ -127,6 +130,16 @@ impl Serialize for AccountId32 { } } +impl<'de> Deserialize<'de> for AccountId32 { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + AccountId32::from_ss58check(&String::deserialize(deserializer)?) + .map_err(|e| serde::de::Error::custom(format!("{:?}", e))) + } +} + impl std::fmt::Display for AccountId32 { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{}", self.to_ss58check()) From 08d6640a6cffb12f2b756fb438165f8093887932 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Tue, 17 Jan 2023 17:29:12 +0000 Subject: [PATCH 25/37] Expose version info in CLI tool with build-time obtained git hash (#787) * version info with built-time obtained git hash * clippy * rerun-if-changed properly and handle git command failing * cargo fmt --- cli/Cargo.toml | 2 +- cli/build.rs | 35 +++++++++++++++++++++++++++++++++++ cli/src/commands/mod.rs | 1 + cli/src/commands/version.rs | 16 ++++++++++++++++ cli/src/main.rs | 2 ++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 cli/build.rs create mode 100644 cli/src/commands/version.rs diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 9a9b1b527a3..ea0fa5ce570 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -21,7 +21,7 @@ subxt-codegen = { version = "0.25.0", path = "../codegen" } # perform node compatibility subxt-metadata = { version = "0.25.0", path = "../metadata" } # parse command line args -clap = { version = "4.0.8", features = ["derive"] } +clap = { version = "4.0.8", features = ["derive", "cargo"] } # colourful error reports color-eyre = "0.6.1" # serialize the metadata diff --git a/cli/build.rs b/cli/build.rs new file mode 100644 index 00000000000..0e4f3e26148 --- /dev/null +++ b/cli/build.rs @@ -0,0 +1,35 @@ +use std::{ + borrow::Cow, + process::Command, +}; + +fn main() { + // Make git hash available via GIT_HASH build-time env var: + output_git_short_hash(); +} + +fn output_git_short_hash() { + let output = Command::new("git") + .args(["rev-parse", "--short=11", "HEAD"]) + .output(); + + let git_hash = match output { + Ok(o) if o.status.success() => { + let sha = String::from_utf8_lossy(&o.stdout).trim().to_owned(); + Cow::from(sha) + } + Ok(o) => { + println!("cargo:warning=Git command failed with status: {}", o.status); + Cow::from("unknown") + } + Err(err) => { + println!("cargo:warning=Failed to execute git command: {}", err); + Cow::from("unknown") + } + }; + + println!("cargo:rustc-env=GIT_HASH={}", git_hash); + println!("cargo:rerun-if-changed=../.git/HEAD"); + println!("cargo:rerun-if-changed=../.git/refs"); + println!("cargo:rerun-if-changed=build.rs"); +} diff --git a/cli/src/commands/mod.rs b/cli/src/commands/mod.rs index 3b5093741b8..4ff1876522c 100644 --- a/cli/src/commands/mod.rs +++ b/cli/src/commands/mod.rs @@ -5,3 +5,4 @@ pub mod codegen; pub mod compatibility; pub mod metadata; +pub mod version; diff --git a/cli/src/commands/version.rs b/cli/src/commands/version.rs new file mode 100644 index 00000000000..397a322fcf8 --- /dev/null +++ b/cli/src/commands/version.rs @@ -0,0 +1,16 @@ +use clap::Parser as ClapParser; + +/// Prints version information +#[derive(Debug, ClapParser)] +pub struct Opts {} + +pub fn run(_opts: Opts) -> color_eyre::Result<()> { + let git_hash = env!("GIT_HASH"); + println!( + "{} {}-{}", + clap::crate_name!(), + clap::crate_version!(), + git_hash + ); + Ok(()) +} diff --git a/cli/src/main.rs b/cli/src/main.rs index bdfcf7422db..a56e8b55d07 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -13,6 +13,7 @@ enum Command { Metadata(commands::metadata::Opts), Codegen(commands::codegen::Opts), Compatibility(commands::compatibility::Opts), + Version(commands::version::Opts), } #[tokio::main] @@ -24,5 +25,6 @@ async fn main() -> color_eyre::Result<()> { Command::Metadata(opts) => commands::metadata::run(opts).await, Command::Codegen(opts) => commands::codegen::run(opts).await, Command::Compatibility(opts) => commands::compatibility::run(opts).await, + Command::Version(opts) => commands::version::run(opts), } } From e036087db794622e9447514dad0801bf91722dde Mon Sep 17 00:00:00 2001 From: kylezs Date: Wed, 18 Jan 2023 05:41:12 +1100 Subject: [PATCH 26/37] Expose `Update` (#791) This will allow for use of `apply_update` on the `OnlineClient` which is already exposed as public. --- subxt/src/client/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/subxt/src/client/mod.rs b/subxt/src/client/mod.rs index 673beee6cde..8ec0d3c78c9 100644 --- a/subxt/src/client/mod.rs +++ b/subxt/src/client/mod.rs @@ -20,5 +20,6 @@ pub use online_client::{ OnlineClient, OnlineClientT, RuntimeUpdaterStream, + Update, UpgradeError, }; From 8ef80638d036cb9ce20d6fd900fb0c30f193ec65 Mon Sep 17 00:00:00 2001 From: kylezs Date: Wed, 18 Jan 2023 21:05:16 +1100 Subject: [PATCH 27/37] rename subscribe_to_updates() to updater() (#792) --- examples/examples/subscribe_runtime_updates.rs | 2 +- subxt/src/client/online_client.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/examples/subscribe_runtime_updates.rs b/examples/examples/subscribe_runtime_updates.rs index bda2ee83a7d..27a9830d8cc 100644 --- a/examples/examples/subscribe_runtime_updates.rs +++ b/examples/examples/subscribe_runtime_updates.rs @@ -25,7 +25,7 @@ async fn main() -> Result<(), Box> { // Start a new tokio task to perform the runtime updates while // utilizing the API for other use cases. - let update_client = api.subscribe_to_updates(); + let update_client = api.updater(); tokio::spawn(async move { let result = update_client.perform_runtime_updates().await; println!("Runtime update failed with result={:?}", result); diff --git a/subxt/src/client/online_client.rs b/subxt/src/client/online_client.rs index 0fea1591a4c..01ea563fbe6 100644 --- a/subxt/src/client/online_client.rs +++ b/subxt/src/client/online_client.rs @@ -123,7 +123,7 @@ impl OnlineClient { /// /// // high level API. /// - /// let update_task = client.subscribe_to_updates(); + /// let update_task = client.updater(); /// tokio::spawn(async move { /// update_task.perform_runtime_updates().await; /// }); @@ -131,7 +131,7 @@ impl OnlineClient { /// /// // low level API. /// - /// let updater = client.subscribe_to_updates(); + /// let updater = client.updater(); /// tokio::spawn(async move { /// let mut update_stream = updater.runtime_updates().await.unwrap(); /// @@ -150,7 +150,7 @@ impl OnlineClient { /// }); /// # } /// ``` - pub fn subscribe_to_updates(&self) -> ClientRuntimeUpdater { + pub fn updater(&self) -> ClientRuntimeUpdater { ClientRuntimeUpdater(self.clone()) } @@ -234,7 +234,7 @@ impl OnlineClientT for OnlineClient { } } -/// Client wrapper for performing runtime updates. See [`OnlineClient::subscribe_to_updates()`] +/// Client wrapper for performing runtime updates. See [`OnlineClient::updater()`] /// for example usage. pub struct ClientRuntimeUpdater(OnlineClient); From b4bb17662a6670383a082dcad8629e7f2dbb6a01 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Wed, 18 Jan 2023 17:49:20 +0200 Subject: [PATCH 28/37] Add Runtime API to execute runtime calls (#777) * rpc: Add RuntimeAPI call via `state_call` method Signed-off-by: Alexandru Vasile * subxt: Add runtime API Signed-off-by: Alexandru Vasile * Expose the RuntimeAPI client Signed-off-by: Alexandru Vasile * tests: Test the runtime API call against the metadata Signed-off-by: Alexandru Vasile * client: Fetch the metadata from runtime API Signed-off-by: Alexandru Vasile * blocks: Fix doc typo Signed-off-by: Alexandru Vasile * blocks: Use &str instead of String to identify fn names Signed-off-by: Alexandru Vasile * Update subxt/src/runtime_api/runtime_client.rs Co-authored-by: Niklas Adolfsson Signed-off-by: Alexandru Vasile Co-authored-by: Niklas Adolfsson --- subxt/src/blocks/block_types.rs | 6 ++ subxt/src/client/offline_client.rs | 6 ++ subxt/src/client/online_client.rs | 22 ++++++- subxt/src/lib.rs | 1 + subxt/src/rpc/rpc.rs | 19 ++++++ subxt/src/runtime_api/mod.rs | 11 ++++ subxt/src/runtime_api/runtime_client.rs | 66 +++++++++++++++++++++ subxt/src/runtime_api/runtime_types.rs | 59 ++++++++++++++++++ testing/integration-tests/src/blocks/mod.rs | 32 ++++++++++ testing/integration-tests/src/client/mod.rs | 31 ++++++++++ 10 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 subxt/src/runtime_api/mod.rs create mode 100644 subxt/src/runtime_api/runtime_client.rs create mode 100644 subxt/src/runtime_api/runtime_types.rs diff --git a/subxt/src/blocks/block_types.rs b/subxt/src/blocks/block_types.rs index 9adba3b8ea6..82372974ba1 100644 --- a/subxt/src/blocks/block_types.rs +++ b/subxt/src/blocks/block_types.rs @@ -18,6 +18,7 @@ use crate::{ }, events, rpc::types::ChainBlockResponse, + runtime_api::RuntimeApi, }; use derivative::Derivative; use futures::lock::Mutex as AsyncMutex; @@ -89,6 +90,11 @@ where self.cached_events.clone(), )) } + + /// Execute a runtime API call at this block. + pub async fn runtime_api(&self) -> Result, Error> { + Ok(RuntimeApi::new(self.client.clone(), self.hash())) + } } /// The body of a block. diff --git a/subxt/src/client/offline_client.rs b/subxt/src/client/offline_client.rs index 4055787f98f..c2681102f5b 100644 --- a/subxt/src/client/offline_client.rs +++ b/subxt/src/client/offline_client.rs @@ -7,6 +7,7 @@ use crate::{ constants::ConstantsClient, events::EventsClient, rpc::types::RuntimeVersion, + runtime_api::RuntimeApiClient, storage::StorageClient, tx::TxClient, Config, @@ -49,6 +50,11 @@ pub trait OfflineClientT: Clone + Send + Sync + 'static { fn blocks(&self) -> BlocksClient { BlocksClient::new(self.clone()) } + + /// Work with runtime API. + fn runtime_api(&self) -> RuntimeApiClient { + RuntimeApiClient::new(self.clone()) + } } /// A client that is capable of performing offline-only operations. diff --git a/subxt/src/client/online_client.rs b/subxt/src/client/online_client.rs index 01ea563fbe6..f5917166d44 100644 --- a/subxt/src/client/online_client.rs +++ b/subxt/src/client/online_client.rs @@ -19,12 +19,18 @@ use crate::{ Rpc, RpcClientT, }, + runtime_api::RuntimeApiClient, storage::StorageClient, tx::TxClient, Config, Metadata, }; +use codec::{ + Compact, + Decode, +}; use derivative::Derivative; +use frame_metadata::RuntimeMetadataPrefixed; use futures::future; use parking_lot::RwLock; use std::sync::Arc; @@ -95,7 +101,7 @@ impl OnlineClient { let (genesis_hash, runtime_version, metadata) = future::join3( rpc.genesis_hash(), rpc.runtime_version(None), - rpc.metadata(None), + OnlineClient::fetch_metadata(&rpc), ) .await; @@ -109,6 +115,15 @@ impl OnlineClient { }) } + /// Fetch the metadata from substrate using the runtime API. + async fn fetch_metadata(rpc: &Rpc) -> Result { + let bytes = rpc.state_call("Metadata_metadata", None, None).await?; + let cursor = &mut &*bytes; + let _ = >::decode(cursor)?; + let meta: RuntimeMetadataPrefixed = Decode::decode(cursor)?; + Ok(meta.try_into()?) + } + /// Create an object which can be used to keep the runtime up to date /// in a separate thread. /// @@ -214,6 +229,11 @@ impl OnlineClient { pub fn blocks(&self) -> BlocksClient { >::blocks(self) } + + /// Work with runtime API. + pub fn runtime_api(&self) -> RuntimeApiClient { + >::runtime_api(self) + } } impl OfflineClientT for OnlineClient { diff --git a/subxt/src/lib.rs b/subxt/src/lib.rs index b9b46fb85c4..4a37a597517 100644 --- a/subxt/src/lib.rs +++ b/subxt/src/lib.rs @@ -155,6 +155,7 @@ pub mod error; pub mod events; pub mod metadata; pub mod rpc; +pub mod runtime_api; pub mod storage; pub mod tx; pub mod utils; diff --git a/subxt/src/rpc/rpc.rs b/subxt/src/rpc/rpc.rs index b8d1c1b4860..fee29799d48 100644 --- a/subxt/src/rpc/rpc.rs +++ b/subxt/src/rpc/rpc.rs @@ -371,6 +371,25 @@ impl Rpc { Ok(xt_hash) } + /// Execute a runtime API call. + pub async fn state_call( + &self, + function: &str, + call_parameters: Option<&[u8]>, + at: Option, + ) -> Result { + let call_parameters = call_parameters.unwrap_or_default(); + + let bytes: types::Bytes = self + .client + .request( + "state_call", + rpc_params![function, to_hex(call_parameters), at], + ) + .await?; + Ok(bytes) + } + /// Create and submit an extrinsic and return a subscription to the events triggered. pub async fn watch_extrinsic( &self, diff --git a/subxt/src/runtime_api/mod.rs b/subxt/src/runtime_api/mod.rs new file mode 100644 index 00000000000..7b55a3905a2 --- /dev/null +++ b/subxt/src/runtime_api/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +//! Types associated with executing runtime API calls. + +mod runtime_client; +mod runtime_types; + +pub use runtime_client::RuntimeApiClient; +pub use runtime_types::RuntimeApi; diff --git a/subxt/src/runtime_api/runtime_client.rs b/subxt/src/runtime_api/runtime_client.rs new file mode 100644 index 00000000000..745bd4f8209 --- /dev/null +++ b/subxt/src/runtime_api/runtime_client.rs @@ -0,0 +1,66 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +use super::runtime_types::RuntimeApi; + +use crate::{ + client::OnlineClientT, + error::Error, + Config, +}; +use derivative::Derivative; +use std::{ + future::Future, + marker::PhantomData, +}; + +/// Execute runtime API calls. +#[derive(Derivative)] +#[derivative(Clone(bound = "Client: Clone"))] +pub struct RuntimeApiClient { + client: Client, + _marker: PhantomData, +} + +impl RuntimeApiClient { + /// Create a new [`RuntimeApiClient`] + pub fn new(client: Client) -> Self { + Self { + client, + _marker: PhantomData, + } + } +} + +impl RuntimeApiClient +where + T: Config, + Client: OnlineClientT, +{ + /// Obtain a runtime API at some block hash. + pub fn at( + &self, + block_hash: Option, + ) -> impl Future, Error>> + Send + 'static { + // Clone and pass the client in like this so that we can explicitly + // return a Future that's Send + 'static, rather than tied to &self. + let client = self.client.clone(); + async move { + // If block hash is not provided, get the hash + // for the latest block and use that. + let block_hash = match block_hash { + Some(hash) => hash, + None => { + client + .rpc() + .block_hash(None) + .await? + .expect("substrate RPC returns the best block when no block number is provided; qed") + } + }; + + Ok(RuntimeApi::new(client, block_hash)) + } + } +} diff --git a/subxt/src/runtime_api/runtime_types.rs b/subxt/src/runtime_api/runtime_types.rs new file mode 100644 index 00000000000..a449c0e3777 --- /dev/null +++ b/subxt/src/runtime_api/runtime_types.rs @@ -0,0 +1,59 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +use crate::{ + client::OnlineClientT, + error::Error, + Config, +}; +use derivative::Derivative; +use std::{ + future::Future, + marker::PhantomData, +}; + +/// Execute runtime API calls. +#[derive(Derivative)] +#[derivative(Clone(bound = "Client: Clone"))] +pub struct RuntimeApi { + client: Client, + block_hash: T::Hash, + _marker: PhantomData, +} + +impl RuntimeApi { + /// Create a new [`RuntimeApi`] + pub(crate) fn new(client: Client, block_hash: T::Hash) -> Self { + Self { + client, + block_hash, + _marker: PhantomData, + } + } +} + +impl RuntimeApi +where + T: Config, + Client: OnlineClientT, +{ + /// Execute a raw runtime API call. + pub fn call_raw<'a>( + &self, + function: &'a str, + call_parameters: Option<&'a [u8]>, + ) -> impl Future, Error>> + 'a { + let client = self.client.clone(); + let block_hash = self.block_hash; + // Ensure that the returned future doesn't have a lifetime tied to api.runtime_api(), + // which is a temporary thing we'll be throwing away quickly: + async move { + let data = client + .rpc() + .state_call(function, call_parameters, Some(block_hash)) + .await?; + Ok(data.0) + } + } +} diff --git a/testing/integration-tests/src/blocks/mod.rs b/testing/integration-tests/src/blocks/mod.rs index 71ddc257ebf..a3730752fd2 100644 --- a/testing/integration-tests/src/blocks/mod.rs +++ b/testing/integration-tests/src/blocks/mod.rs @@ -3,6 +3,11 @@ // see LICENSE for license details. use crate::test_context; +use codec::{ + Compact, + Decode, +}; +use frame_metadata::RuntimeMetadataPrefixed; use futures::StreamExt; // Check that we can subscribe to non-finalized blocks. @@ -87,3 +92,30 @@ async fn missing_block_headers_will_be_filled_in() -> Result<(), subxt::Error> { assert!(last_block_number.is_some()); Ok(()) } + +// Check that we can subscribe to non-finalized blocks. +#[tokio::test] +async fn runtime_api_call() -> Result<(), subxt::Error> { + let ctx = test_context().await; + let api = ctx.client(); + + let mut sub = api.blocks().subscribe_best().await?; + + let block = sub.next().await.unwrap()?; + let rt = block.runtime_api().await?; + + let bytes = rt.call_raw("Metadata_metadata", None).await?; + let cursor = &mut &*bytes; + let _ = >::decode(cursor)?; + let meta: RuntimeMetadataPrefixed = Decode::decode(cursor)?; + let metadata_call = match meta.1 { + frame_metadata::RuntimeMetadata::V14(metadata) => metadata, + _ => panic!("Metadata V14 unavailable"), + }; + + // Compare the runtime API call against the `state_getMetadata`. + let metadata = api.rpc().metadata(None).await?; + let metadata = metadata.runtime_metadata(); + assert_eq!(&metadata_call, metadata); + Ok(()) +} diff --git a/testing/integration-tests/src/client/mod.rs b/testing/integration-tests/src/client/mod.rs index 0214c4901ff..ad18d439e43 100644 --- a/testing/integration-tests/src/client/mod.rs +++ b/testing/integration-tests/src/client/mod.rs @@ -11,6 +11,11 @@ use crate::{ wait_for_blocks, }, }; +use codec::{ + Compact, + Decode, +}; +use frame_metadata::RuntimeMetadataPrefixed; use sp_core::{ sr25519::Pair as Sr25519Pair, storage::well_known_keys, @@ -250,3 +255,29 @@ async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() { // Make sure our encoding is the same as the encoding polkadot UI created. assert_eq!(actual_tx_bytes, expected_tx_bytes); } + +#[tokio::test] +async fn rpc_state_call() { + let ctx = test_context().await; + let api = ctx.client(); + + // Call into the runtime of the chain to get the Metadata. + let metadata_bytes = api + .rpc() + .state_call("Metadata_metadata", None, None) + .await + .unwrap(); + + let cursor = &mut &*metadata_bytes; + let _ = >::decode(cursor).unwrap(); + let meta: RuntimeMetadataPrefixed = Decode::decode(cursor).unwrap(); + let metadata_call = match meta.1 { + frame_metadata::RuntimeMetadata::V14(metadata) => metadata, + _ => panic!("Metadata V14 unavailable"), + }; + + // Compare the runtime API call against the `state_getMetadata`. + let metadata = api.rpc().metadata(None).await.unwrap(); + let metadata = metadata.runtime_metadata(); + assert_eq!(&metadata_call, metadata); +} From c0198acea854b24e161dbeb714e71d56830d51ef Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Wed, 18 Jan 2023 18:10:29 +0200 Subject: [PATCH 29/37] Add `Cargo.lock` for deterministic builds (#795) * Remove Cargo.lock from gitignore Signed-off-by: Alexandru Vasile * cargo: Add `Cargo.lock` Signed-off-by: Alexandru Vasile * Update the releasing process Signed-off-by: Alexandru Vasile Signed-off-by: Alexandru Vasile --- .gitignore | 1 - Cargo.lock | 4371 ++++++++++++++++++++++++++++++++++++++++++++++++++ RELEASING.md | 16 +- 3 files changed, 4382 insertions(+), 6 deletions(-) create mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index a9b332d833e..40fe9a994fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /target **/*.rs.bk **/.DS_Store -Cargo.lock cargo-timing* \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000000..66091ae8c99 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4371 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli 0.26.2", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli 0.27.0", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.8", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" + +[[package]] +name = "array-bytes" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[package]] +name = "async-lock" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +dependencies = [ + "event-listener", + "futures-lite", +] + +[[package]] +name = "async-trait" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +dependencies = [ + "addr2line 0.19.0", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.30.2", + "rustc-demangle", +] + +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "block-buffer" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "bumpalo" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "iana-time-zone", + "num-integer", + "num-traits", + "winapi", +] + +[[package]] +name = "ciborium" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c137568cc60b904a7724001b35ce2630fd00d5d84805fbb608ab89509d788f" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346de753af073cc87b52b2083a506b38ac176a44cfb05497b622e27be899b369" + +[[package]] +name = "ciborium-ll" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213030a2b5a4e0c0892b6652260cf6ccac84827b83a85a534e178e3906c4cf1b" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "clap" +version = "3.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +dependencies = [ + "bitflags", + "clap_lex 0.2.4", + "indexmap", + "textwrap", +] + +[[package]] +name = "clap" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2" +dependencies = [ + "bitflags", + "clap_derive", + "clap_lex 0.3.1", + "is-terminal", + "once_cell", + "strsim", + "termcolor", +] + +[[package]] +name = "clap_derive" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "clap_lex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "cmake" +version = "0.1.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +dependencies = [ + "cc", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "color-eyre" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" +dependencies = [ + "backtrace", + "color-spantrace", + "eyre", + "indenter", + "once_cell", + "owo-colors", + "tracing-error", +] + +[[package]] +name = "color-spantrace" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba75b3d9449ecdccb27ecbc479fdc0b87fa2dd43d2f8298f9bf0e59aacc8dce" +dependencies = [ + "once_cell", + "owo-colors", + "tracing-core", + "tracing-error", +] + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-entity" +version = "0.88.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" +dependencies = [ + "serde", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "criterion" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb" +dependencies = [ + "anes", + "atty", + "cast", + "ciborium", + "clap 3.2.23", + "criterion-plot", + "itertools", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.7.1", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.6", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + +[[package]] +name = "ctor" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "curve25519-dalek" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" +dependencies = [ + "byteorder", + "digest 0.8.1", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "cxx" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "digest" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer 0.10.3", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "dyn-clonable" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] + +[[package]] +name = "dyn-clonable-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dyn-clone" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" + +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "either" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" + +[[package]] +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "eyre" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "frame-metadata" +version = "15.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df6bb8542ef006ef0de09a5c4420787d79823c0ed7924225822362fd2bf2ff2d" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" + +[[package]] +name = "futures-executor" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" + +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-macro" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" + +[[package]] +name = "futures-task" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +dependencies = [ + "gloo-timers", + "send_wrapper", +] + +[[package]] +name = "futures-util" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" + +[[package]] +name = "glob" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "gloo-net" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9050ff8617e950288d7bf7f300707639fdeda5ca0d0ecf380cff448cfd52f4a6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8e8fc851e9c7b9852508bc6e3f690f452f474417e8545ec9857b7f7377036b5" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + +[[package]] +name = "hash-db" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array 0.14.6", + "hmac 0.8.1", +] + +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki-roots", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", + "serde", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + +[[package]] +name = "integration-tests" +version = "0.25.0" +dependencies = [ + "assert_matches", + "frame-metadata", + "futures", + "hex", + "parity-scale-codec", + "regex", + "scale-info", + "sp-core", + "sp-keyring", + "sp-runtime", + "subxt", + "subxt-codegen", + "syn", + "test-runtime", + "tokio", + "tracing", + "tracing-subscriber 0.3.16", + "wabt", + "which", +] + +[[package]] +name = "io-lifetimes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys 0.42.0", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi 0.2.6", + "io-lifetimes 1.0.4", + "rustix 0.36.6", + "windows-sys 0.42.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" + +[[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonrpsee" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +dependencies = [ + "anyhow", + "futures-channel", + "futures-timer", + "futures-util", + "gloo-net", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "rustls-native-certs", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "webpki-roots", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +dependencies = [ + "anyhow", + "async-lock", + "async-trait", + "beef", + "futures-channel", + "futures-timer", + "futures-util", + "hyper", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "wasm-bindgen-futures", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "keccak" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "libm" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64 0.13.1", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.8.5", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memory-db" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" +dependencies = [ + "hash-db", + "hashbrown", +] + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "merlin" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.42.0", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-format" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec 0.7.2", + "itoa", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi 0.2.6", + "libc", +] + +[[package]] +name = "object" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "crc32fast", + "hashbrown", + "indexmap", + "memchr", +] + +[[package]] +name = "object" +version = "0.30.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b8c786513eb403643f2a88c244c2aaa270ef2153f55094587d0c48a3cf22a83" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" + +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "os_str_bytes" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + +[[package]] +name = "output_vt100" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" +dependencies = [ + "winapi", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + +[[package]] +name = "parity-scale-codec" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +dependencies = [ + "arrayvec 0.7.2", + "bitvec", + "byte-slice-cast", + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "parity-wasm" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.42.0", +] + +[[package]] +name = "paste" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" + +[[package]] +name = "pbkdf2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" +dependencies = [ + "crypto-mac 0.11.1", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "plotters" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b639e642295546c50fcd545198c9d64ee2a38620a628724a3b266d5fbf97" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" + +[[package]] +name = "plotters-svg" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f" +dependencies = [ + "plotters-backend", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "pretty_assertions" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a25e9bcb20aa780fd0bb16b72403a9064d6b3f22f026946029acb941a50af755" +dependencies = [ + "ctor", + "diff", + "output_vt100", + "yansi", +] + +[[package]] +name = "primitive-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +dependencies = [ + "once_cell", + "thiserror", + "toml", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "quote" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rayon" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ref-cast" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustix" +version = "0.35.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes 0.7.5", + "libc", + "linux-raw-sys 0.0.46", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustix" +version = "0.36.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes 1.0.4", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.42.0", +] + +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64 0.21.0", +] + +[[package]] +name = "rustversion" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" + +[[package]] +name = "ryu" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scale-bits" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd7aca73785181cc41f0bbe017263e682b585ca660540ba569133901d013ecf" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d823d4be477fc33321f93d08fb6c2698273d044f01362dc27573a750deb7c233" +dependencies = [ + "parity-scale-codec", + "scale-bits", + "scale-info", + "thiserror", +] + +[[package]] +name = "scale-info" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +dependencies = [ + "bitvec", + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", + "serde", +] + +[[package]] +name = "scale-info-derive" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "scale-value" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a5e7810815bd295da73e4216d1dfbced3c7c7c7054d70fa5f6e4c58123fff4" +dependencies = [ + "either", + "frame-metadata", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-info", + "serde", + "thiserror", + "yap", +] + +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + +[[package]] +name = "schnorrkel" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "curve25519-dalek 2.1.3", + "getrandom 0.1.16", + "merlin", + "rand 0.7.3", + "rand_core 0.5.1", + "sha2 0.8.2", + "subtle", + "zeroize", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "scratch" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "secp256k1" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +dependencies = [ + "cc", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "serde" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + +[[package]] +name = "sha3" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +dependencies = [ + "digest 0.10.6", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64 0.13.1", + "bytes", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1", +] + +[[package]] +name = "sp-application-crypto" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a72575f160b1b134ee277a2ab46af4361c072a3fe661c48e474255406cb01c97" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-std", +] + +[[package]] +name = "sp-arithmetic" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2038010f7514d50775dcbd3edb569e17fa9bda63128580a9e172abb1795f2c1d" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-std", + "static_assertions", +] + +[[package]] +name = "sp-core" +version = "11.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d99984f57c9eb858d29fbe0e4cf44092eec484b2ff72176d5afa4ab7bf1dc8b1" +dependencies = [ + "array-bytes", + "base58", + "bitflags", + "blake2", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "lazy_static", + "libsecp256k1", + "log", + "merlin", + "parity-scale-codec", + "parking_lot", + "primitive-types", + "rand 0.8.5", + "regex", + "scale-info", + "schnorrkel", + "secp256k1", + "secrecy", + "serde", + "sp-core-hashing", + "sp-debug-derive", + "sp-externalities", + "sp-runtime-interface", + "sp-std", + "sp-storage", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tiny-bip39", + "zeroize", +] + +[[package]] +name = "sp-core-hashing" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc2d1947252b7a4e403b0a260f596920443742791765ec111daa2bbf98eff25" +dependencies = [ + "blake2", + "byteorder", + "digest 0.10.6", + "sha2 0.10.6", + "sha3", + "sp-std", + "twox-hash", +] + +[[package]] +name = "sp-core-hashing-proc-macro" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5833921310f9883f2093849d3f5e9e57e9890f6b60839498b08d4c72572cc602" +dependencies = [ + "proc-macro2", + "quote", + "sp-core-hashing", + "syn", +] + +[[package]] +name = "sp-debug-derive" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66fb9dc63d54de7d7bed62a505b6e0bd66c122525ea1abb348f6564717c3df2d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-externalities" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc754e1cec66b93df0b48a8986d019c1a2a90431c42cf2614cc35a291597c329" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std", + "sp-storage", +] + +[[package]] +name = "sp-io" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ac917b37c7733e3778e7ffc3958f1181a151ac3b14116d65fb10fe7b08db10e" +dependencies = [ + "bytes", + "ed25519", + "ed25519-dalek", + "futures", + "libsecp256k1", + "log", + "parity-scale-codec", + "secp256k1", + "sp-core", + "sp-externalities", + "sp-keystore", + "sp-runtime-interface", + "sp-state-machine", + "sp-std", + "sp-tracing", + "sp-trie", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-keyring" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a392505294f3f2a15d568fe155372c269c97cff4fe3f9fa0c1f12fce6b03805" +dependencies = [ + "lazy_static", + "sp-core", + "sp-runtime", + "strum", +] + +[[package]] +name = "sp-keystore" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ada8b7a72404bda58b3353830bc42f027ec764e13a28b4cd4386cf34fb1ae7c" +dependencies = [ + "async-trait", + "futures", + "merlin", + "parity-scale-codec", + "parking_lot", + "schnorrkel", + "sp-core", + "sp-externalities", + "thiserror", +] + +[[package]] +name = "sp-panic-handler" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4abed79c3d5b3622f65ab065676addd9923b9b122cd257df23e2757ce487c6d2" +dependencies = [ + "backtrace", + "lazy_static", + "regex", +] + +[[package]] +name = "sp-runtime" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86578c67b060a6ecab52af64f1cf18b3892fca7fba5ffc5c49934b2e76b1929" +dependencies = [ + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "paste", + "rand 0.8.5", + "scale-info", + "serde", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-std", + "sp-weights", +] + +[[package]] +name = "sp-runtime-interface" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3858935567385728ea45f6d159f9970b0b278eb22a8e77625bbf4a63e43a85a" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "primitive-types", + "sp-externalities", + "sp-runtime-interface-proc-macro", + "sp-std", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00083a77e938c4f35d0bde7ca0b6e5f616158ebe11af6063795aa664d92a238b" +dependencies = [ + "Inflector", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-state-machine" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1fd4c600df0b5abf26c19b6c61d928b64e0c2b8a709a3dbef872be0507cd1ca" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot", + "rand 0.8.5", + "smallvec", + "sp-core", + "sp-externalities", + "sp-panic-handler", + "sp-std", + "sp-trie", + "thiserror", + "tracing", +] + +[[package]] +name = "sp-std" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af0ee286f98455272f64ac5bb1384ff21ac029fbb669afbaf48477faff12760e" + +[[package]] +name = "sp-storage" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9acb4059eb0ae4fa8cf9ca9119b0178ad312a592d4c6054bd17b411034f233e9" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "sp-tracing" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b22d28a0bc2365dfb86644d14f2682a79da35891d4656d4896fb09fb05ff1e6c" +dependencies = [ + "parity-scale-codec", + "sp-std", + "tracing", + "tracing-core", + "tracing-subscriber 0.2.25", +] + +[[package]] +name = "sp-trie" +version = "11.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db085f134cb444e52ca569a442d12c84bd17667532613d78dd6f568942632da4" +dependencies = [ + "ahash", + "hash-db", + "hashbrown", + "lazy_static", + "lru", + "memory-db", + "nohash-hasher", + "parity-scale-codec", + "parking_lot", + "scale-info", + "sp-core", + "sp-std", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-version" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd5ddc34360c0497480ddb134d93c2adcfdaa344f30a0db601f05c2af2a6eae" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-core-hashing-proc-macro", + "sp-runtime", + "sp-std", + "sp-version-proc-macro", + "thiserror", +] + +[[package]] +name = "sp-version-proc-macro" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97bbeece15266afc30881ecae586fd28e6c123810b9ced1b8706daa081fe9c2e" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-wasm-interface" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ebc377987d42f8fc20e3f4ec4fd1147dd098fe90bcb4269e1eddb04e920f889" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std", + "wasmi", + "wasmtime", +] + +[[package]] +name = "sp-weights" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90eca2a19f48978e9cd605e23905d0602419f7880a9360ac717b03412e9c7916" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "ss58-registry" +version = "1.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d44528162f980c0e03c71e005d334332c8da0aec9f2b0b4bdc557ed4a9f24776" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "substrate-bip39" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49eee6965196b32f882dd2ee85a92b1dbead41b04e53907f269de3b0dc04733c" +dependencies = [ + "hmac 0.11.0", + "pbkdf2 0.8.0", + "schnorrkel", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "subxt" +version = "0.25.0" +dependencies = [ + "base58", + "bitvec", + "blake2", + "derivative", + "frame-metadata", + "futures", + "getrandom 0.2.8", + "hex", + "impl-serde", + "jsonrpsee", + "parity-scale-codec", + "parking_lot", + "primitive-types", + "scale-bits", + "scale-decode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-core", + "sp-core-hashing", + "sp-keyring", + "sp-runtime", + "sp-version", + "subxt-macro", + "subxt-metadata", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "subxt-cli" +version = "0.25.0" +dependencies = [ + "clap 4.1.1", + "color-eyre", + "frame-metadata", + "hex", + "jsonrpsee", + "parity-scale-codec", + "serde", + "serde_json", + "subxt-codegen", + "subxt-metadata", + "syn", + "tokio", +] + +[[package]] +name = "subxt-codegen" +version = "0.25.0" +dependencies = [ + "bitvec", + "darling", + "frame-metadata", + "heck", + "hex", + "jsonrpsee", + "parity-scale-codec", + "pretty_assertions", + "proc-macro-error", + "proc-macro2", + "quote", + "scale-info", + "subxt-metadata", + "syn", + "tokio", +] + +[[package]] +name = "subxt-examples" +version = "0.25.0" +dependencies = [ + "futures", + "hex", + "parity-scale-codec", + "sp-core", + "sp-keyring", + "sp-runtime", + "subxt", + "tokio", + "tracing-subscriber 0.3.16", +] + +[[package]] +name = "subxt-macro" +version = "0.25.0" +dependencies = [ + "darling", + "proc-macro-error", + "subxt-codegen", + "syn", +] + +[[package]] +name = "subxt-metadata" +version = "0.25.0" +dependencies = [ + "bitvec", + "criterion", + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-core-hashing", +] + +[[package]] +name = "syn" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "test-runtime" +version = "0.25.0" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "sp-runtime", + "subxt", + "tokio", + "which", +] + +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + +[[package]] +name = "thiserror" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tiny-bip39" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" +dependencies = [ + "anyhow", + "hmac 0.12.1", + "once_cell", + "pbkdf2 0.11.0", + "rand 0.8.5", + "rustc-hash", + "sha2 0.10.6", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.42.0", +] + +[[package]] +name = "tokio-macros" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +dependencies = [ + "tracing", + "tracing-subscriber 0.3.16", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "trie-db" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" +dependencies = [ + "hash-db", + "hashbrown", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-root" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" +dependencies = [ + "hash-db", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "trybuild" +version = "1.0.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed2c57956f91546d4d33614265a85d55c8e1ab91484853a10335894786d7db6" +dependencies = [ + "glob 0.3.1", + "once_cell", + "serde", + "serde_derive", + "serde_json", + "termcolor", + "toml", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "digest 0.10.6", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "ui-tests" +version = "0.25.0" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "subxt", + "trybuild", +] + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wabt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00bef93d5e6c81a293bccf107cf43aa47239382f455ba14869d36695d8963b9c" +dependencies = [ + "serde", + "serde_derive", + "serde_json", + "wabt-sys", +] + +[[package]] +name = "wabt-sys" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a4e043159f63e16986e713e9b5e1c06043df4848565bf672e27c523864c7791" +dependencies = [ + "cc", + "cmake", + "glob 0.2.11", +] + +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "wasmi" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" +dependencies = [ + "parity-wasm", + "wasmi-validation", + "wasmi_core", +] + +[[package]] +name = "wasmi-validation" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasmi_core" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" +dependencies = [ + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", +] + +[[package]] +name = "wasmparser" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap", + "libc", + "log", + "object 0.29.0", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-environ" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.26.2", + "indexmap", + "log", + "object 0.29.0", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +dependencies = [ + "addr2line 0.17.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.26.2", + "log", + "object 0.29.0", + "rustc-demangle", + "rustix 0.35.13", + "serde", + "target-lexicon", + "thiserror", + "wasmtime-environ", + "wasmtime-runtime", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-runtime" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap", + "libc", + "log", + "mach", + "memoffset 0.6.5", + "paste", + "rand 0.8.5", + "rustix 0.35.13", + "thiserror", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-types" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + +[[package]] +name = "which" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +dependencies = [ + "either", + "libc", + "once_cell", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "yap" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc77f52dc9e9b10d55d3f4462c3b7fc393c4f17975d641542833ab2d3bc26ef" + +[[package]] +name = "zeroize" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] diff --git a/RELEASING.md b/RELEASING.md index ced73b86f90..1ec6d489ffc 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -28,7 +28,13 @@ We also assume that ongoing work done is being merged directly to the `master` b 4. Bump the crate version in `Cargo.toml` to whatever was decided in step 2 for `subxt-metadata`, `subxt-cli`, `subxt-codegen`, `subxt-examples`, `subxt-macro` ,`subxt`, `integration-tests`, `test-runtime`, `ui-tests`. -5. Update `CHANGELOG.md` to reflect the difference between this release and the last. If you're unsure of +5. Ensure the `Cargo.lock` file is up to date. + + ``` + cargo generate-lockfile + ``` + +6. Update `CHANGELOG.md` to reflect the difference between this release and the last. If you're unsure of what to add, check with the Tools team. See the `CHANGELOG.md` file for details of the format it follows. First, if there have been any significant changes, add a description of those changes to the top of the @@ -44,11 +50,11 @@ We also assume that ongoing work done is being merged directly to the `master` b provide `[+] Latest release tag: v0.16.0` ). Then group the PRs into "Fixed", "Added" and "Changed" sections, and make any other adjustments that you feel are necessary for clarity. -6. Commit any of the above changes to the release branch and open a PR in GitHub with a base of `master`. +7. Commit any of the above changes to the release branch and open a PR in GitHub with a base of `master`. -7. Once the branch has been reviewed and passes CI, merge it. +8. Once the branch has been reviewed and passes CI, merge it. -8. Now, we're ready to publish the release to crates.io. +9. Now, we're ready to publish the release to crates.io. 1. Checkout `master`, ensuring we're looking at that latest merge (`git pull`). @@ -80,7 +86,7 @@ We also assume that ongoing work done is being merged directly to the `master` b If you run into any issues regarding crates not being able to find suitable versions of other `subxt-*` crates, you may just need to wait a little longer and then run the remaining portion of that command. -9. If the release was successful, tag the commit that we released in the `master` branch with the +10. If the release was successful, tag the commit that we released in the `master` branch with the version that we just released, for example: ``` From 61878cc20ad755832bd908eb316cf9c60589a1e2 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Thu, 19 Jan 2023 18:48:06 +0800 Subject: [PATCH 30/37] Fix bad signature when the extrinsic size is over 256 bytes (#796) --- subxt/src/tx/tx_client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subxt/src/tx/tx_client.rs b/subxt/src/tx/tx_client.rs index eb84d14eeda..5abe69affd6 100644 --- a/subxt/src/tx/tx_client.rs +++ b/subxt/src/tx/tx_client.rs @@ -169,7 +169,7 @@ impl> TxClient { additional_and_extra_params.encode_extra_to(&mut bytes); additional_and_extra_params.encode_additional_to(&mut bytes); if bytes.len() > 256 { - signer.sign(T::Hasher::hash_of(&bytes).as_ref()) + signer.sign(T::Hasher::hash_of(&Encoded(bytes)).as_ref()) } else { signer.sign(&bytes) } From b7a29a5efe60f7c21de556f737e486cfcc852cf3 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Thu, 19 Jan 2023 10:49:00 +0000 Subject: [PATCH 31/37] Add ability to set custom metadata etc on OnlineClient (#794) * Add _at and _with methods to OnlineClient to allow for more instantiation options * tweak warnings * move a confusing comment * expose ability to set metadata and such in OnlineClient, but remove most _at methods --- subxt/src/client/mod.rs | 6 +++ subxt/src/client/online_client.rs | 86 +++++++++++++++++++++++++++---- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/subxt/src/client/mod.rs b/subxt/src/client/mod.rs index 8ec0d3c78c9..f056abde9d5 100644 --- a/subxt/src/client/mod.rs +++ b/subxt/src/client/mod.rs @@ -23,3 +23,9 @@ pub use online_client::{ Update, UpgradeError, }; + +#[cfg(any( + feature = "jsonrpsee-ws", + all(feature = "jsonrpsee-web", target_arch = "wasm32") +))] +pub use online_client::default_rpc_client; diff --git a/subxt/src/client/online_client.rs b/subxt/src/client/online_client.rs index f5917166d44..6babec8971a 100644 --- a/subxt/src/client/online_client.rs +++ b/subxt/src/client/online_client.rs @@ -68,6 +68,18 @@ impl std::fmt::Debug for OnlineClient { } } +/// The default RPC client that's used (based on [`jsonrpsee`]). +#[cfg(any( + feature = "jsonrpsee-ws", + all(feature = "jsonrpsee-web", target_arch = "wasm32") +))] +pub async fn default_rpc_client>(url: U) -> Result { + let client = jsonrpsee_helpers::client(url.as_ref()) + .await + .map_err(|e| crate::error::RpcError::ClientError(Box::new(e)))?; + Ok(client) +} + // The default constructors assume Jsonrpsee. #[cfg(any( feature = "jsonrpsee-ws", @@ -83,9 +95,7 @@ impl OnlineClient { /// Construct a new [`OnlineClient`], providing a URL to connect to. pub async fn from_url(url: impl AsRef) -> Result, Error> { - let client = jsonrpsee_helpers::client(url.as_ref()) - .await - .map_err(|e| crate::error::RpcError::ClientError(Box::new(e)))?; + let client = default_rpc_client(url).await?; OnlineClient::from_rpc_client(Arc::new(client)).await } } @@ -96,8 +106,7 @@ impl OnlineClient { pub async fn from_rpc_client( rpc_client: Arc, ) -> Result, Error> { - let rpc = Rpc::new(rpc_client); - + let rpc = Rpc::::new(rpc_client.clone()); let (genesis_hash, runtime_version, metadata) = future::join3( rpc.genesis_hash(), rpc.runtime_version(None), @@ -105,13 +114,39 @@ impl OnlineClient { ) .await; + OnlineClient::from_rpc_client_with( + genesis_hash?, + runtime_version?, + metadata?, + rpc_client, + ) + } + + /// Construct a new [`OnlineClient`] by providing all of the underlying details needed + /// to make it work. + /// + /// # Warning + /// + /// This is considered the most primitive and also error prone way to + /// instantiate a client; the genesis hash, metadata and runtime version provided will + /// entirely determine which node and blocks this client will be able to interact with, + /// and whether it will be able to successfully do things like submit transactions. + /// + /// If you're unsure what you're doing, prefer one of the alternate methods to instantiate + /// a client. + pub fn from_rpc_client_with( + genesis_hash: T::Hash, + runtime_version: RuntimeVersion, + metadata: Metadata, + rpc_client: Arc, + ) -> Result, Error> { Ok(OnlineClient { inner: Arc::new(RwLock::new(Inner { - genesis_hash: genesis_hash?, - runtime_version: runtime_version?, - metadata: metadata?, + genesis_hash, + runtime_version, + metadata, })), - rpc, + rpc: Rpc::new(rpc_client), }) } @@ -175,18 +210,51 @@ impl OnlineClient { inner.metadata.clone() } + /// Change the [`Metadata`] used in this client. + /// + /// # Warning + /// + /// Setting custom metadata may leave Subxt unable to work with certain blocks, + /// subscribe to latest blocks or submit valid transactions. + pub fn set_metadata(&self, metadata: Metadata) { + let mut inner = self.inner.write(); + inner.metadata = metadata; + } + /// Return the genesis hash. pub fn genesis_hash(&self) -> T::Hash { let inner = self.inner.read(); inner.genesis_hash } + /// Change the genesis hash used in this client. + /// + /// # Warning + /// + /// Setting a custom genesis hash may leave Subxt unable to + /// submit valid transactions. + pub fn set_genesis_hash(&self, genesis_hash: T::Hash) { + let mut inner = self.inner.write(); + inner.genesis_hash = genesis_hash; + } + /// Return the runtime version. pub fn runtime_version(&self) -> RuntimeVersion { let inner = self.inner.read(); inner.runtime_version.clone() } + /// Change the [`RuntimeVersion`] used in this client. + /// + /// # Warning + /// + /// Setting a custom runtime version may leave Subxt unable to + /// submit valid transactions. + pub fn set_runtime_version(&self, runtime_version: RuntimeVersion) { + let mut inner = self.inner.write(); + inner.runtime_version = runtime_version; + } + /// Return an RPC client to make raw requests with. pub fn rpc(&self) -> &Rpc { &self.rpc From 977f2a3333922b2b833ab526469ec63c4abef847 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Thu, 19 Jan 2023 10:49:57 +0000 Subject: [PATCH 32/37] Allow for remapping type parameters in type substitutions (#735) * feat!: Allow for remapping type parameters in type substitutions * chore: cargo fmt * chore: cargo clippy * chore: Remove some old code * a little tidy * address comment nit Co-authored-by: James Wilson --- cli/src/commands/codegen.rs | 8 +- codegen/src/api/mod.rs | 78 ++---- codegen/src/ir.rs | 129 +-------- codegen/src/lib.rs | 7 +- codegen/src/types/mod.rs | 96 +++---- codegen/src/types/substitutes.rs | 254 ++++++++++++++++++ codegen/src/types/tests.rs | 156 ++++++----- codegen/src/types/type_def.rs | 6 +- macro/src/lib.rs | 34 ++- .../src/codegen/codegen_documentation.rs | 7 +- testing/test-runtime/build.rs | 11 +- .../ui-tests/src/correct/generic-params.rs | 67 +++++ .../incorrect/substitute_path_not_absolute.rs | 13 +- .../substitute_path_not_absolute.stderr | 6 +- 14 files changed, 541 insertions(+), 331 deletions(-) create mode 100644 codegen/src/types/substitutes.rs create mode 100644 testing/ui-tests/src/correct/generic-params.rs diff --git a/cli/src/commands/codegen.rs b/cli/src/commands/codegen.rs index a89b8631746..391a23eceb8 100644 --- a/cli/src/commands/codegen.rs +++ b/cli/src/commands/codegen.rs @@ -10,7 +10,10 @@ use std::{ io::Read, path::PathBuf, }; -use subxt_codegen::DerivesRegistry; +use subxt_codegen::{ + DerivesRegistry, + TypeSubstitutes, +}; /// Generate runtime API client code from metadata. /// @@ -95,10 +98,13 @@ fn codegen( derives.extend_for_type(ty, std::iter::once(derive), &crate_path) } + let type_substitutes = TypeSubstitutes::new(&crate_path); + let runtime_api = subxt_codegen::generate_runtime_api_from_bytes( item_mod, metadata_bytes, derives, + type_substitutes, crate_path, ); println!("{}", runtime_api); diff --git a/codegen/src/api/mod.rs b/codegen/src/api/mod.rs index 65d347d24df..b0a3314d8df 100644 --- a/codegen/src/api/mod.rs +++ b/codegen/src/api/mod.rs @@ -18,6 +18,7 @@ use crate::{ CompositeDef, CompositeDefFields, TypeGenerator, + TypeSubstitutes, }, utils::{ fetch_metadata_bytes_blocking, @@ -39,7 +40,6 @@ use quote::{ quote, }; use std::{ - collections::HashMap, fs, io::Read, path, @@ -54,6 +54,7 @@ use syn::parse_quote; /// * `item_mod` - The module declaration for which the API is implemented. /// * `path` - The path to the scale encoded metadata of the runtime node. /// * `derives` - Provide custom derives for the generated types. +/// * `type_substitutes` - Provide custom type substitutes. /// * `crate_path` - Path to the `subxt` crate. /// /// **Note:** This is a wrapper over [RuntimeGenerator] for static metadata use-cases. @@ -61,6 +62,7 @@ pub fn generate_runtime_api_from_path

( item_mod: syn::ItemMod, path: P, derives: DerivesRegistry, + type_substitutes: TypeSubstitutes, crate_path: CratePath, ) -> TokenStream2 where @@ -74,7 +76,13 @@ where file.read_to_end(&mut bytes) .unwrap_or_else(|e| abort_call_site!("Failed to read metadata file: {}", e)); - generate_runtime_api_from_bytes(item_mod, &bytes, derives, crate_path) + generate_runtime_api_from_bytes( + item_mod, + &bytes, + derives, + type_substitutes, + crate_path, + ) } /// Generates the API for interacting with a substrate runtime, using metadata @@ -86,6 +94,7 @@ where /// * `item_mod` - The module declaration for which the API is implemented. /// * `url` - HTTP/WS URL to the substrate node you'd like to pull metadata from. /// * `derives` - Provide custom derives for the generated types. +/// * `type_substitutes` - Provide custom type substitutes. /// * `crate_path` - Path to the `subxt` crate. /// /// **Note:** This is a wrapper over [RuntimeGenerator] for static metadata use-cases. @@ -93,12 +102,19 @@ pub fn generate_runtime_api_from_url( item_mod: syn::ItemMod, url: &Uri, derives: DerivesRegistry, + type_substitutes: TypeSubstitutes, crate_path: CratePath, ) -> TokenStream2 { let bytes = fetch_metadata_bytes_blocking(url) .unwrap_or_else(|e| abort_call_site!("Failed to obtain metadata: {}", e)); - generate_runtime_api_from_bytes(item_mod, &bytes, derives, crate_path) + generate_runtime_api_from_bytes( + item_mod, + &bytes, + derives, + type_substitutes, + crate_path, + ) } /// Generates the API for interacting with a substrate runtime, using metadata bytes. @@ -106,8 +122,9 @@ pub fn generate_runtime_api_from_url( /// # Arguments /// /// * `item_mod` - The module declaration for which the API is implemented. -/// * `url` - HTTP/WS URL to the substrate node you'd like to pull metadata from. +/// * `bytes` - The raw metadata bytes. /// * `derives` - Provide custom derives for the generated types. +/// * `type_substitutes` - Provide custom type substitutes. /// * `crate_path` - Path to the `subxt` crate. /// /// **Note:** This is a wrapper over [RuntimeGenerator] for static metadata use-cases. @@ -115,13 +132,14 @@ pub fn generate_runtime_api_from_bytes( item_mod: syn::ItemMod, bytes: &[u8], derives: DerivesRegistry, + type_substitutes: TypeSubstitutes, crate_path: CratePath, ) -> TokenStream2 { let metadata = frame_metadata::RuntimeMetadataPrefixed::decode(&mut &bytes[..]) .unwrap_or_else(|e| abort_call_site!("Failed to decode metadata: {}", e)); let generator = RuntimeGenerator::new(metadata); - generator.generate_runtime(item_mod, derives, crate_path) + generator.generate_runtime(item_mod, derives, type_substitutes, crate_path) } /// Create the API for interacting with a Substrate runtime. @@ -152,61 +170,13 @@ impl RuntimeGenerator { &self, item_mod: syn::ItemMod, derives: DerivesRegistry, + type_substitutes: TypeSubstitutes, crate_path: CratePath, ) -> TokenStream2 { let item_mod_attrs = item_mod.attrs.clone(); let item_mod_ir = ir::ItemMod::from(item_mod); let default_derives = derives.default_derives(); - // Some hardcoded default type substitutes, can be overridden by user - let mut type_substitutes = [ - ( - "bitvec::order::Lsb0", - parse_quote!(#crate_path::utils::bits::Lsb0), - ), - ( - "bitvec::order::Msb0", - parse_quote!(#crate_path::utils::bits::Msb0), - ), - ( - "sp_core::crypto::AccountId32", - parse_quote!(#crate_path::utils::AccountId32), - ), - ( - "sp_runtime::multiaddress::MultiAddress", - parse_quote!(#crate_path::utils::MultiAddress), - ), - ( - "primitive_types::H160", - parse_quote!(#crate_path::utils::H160), - ), - ( - "primitive_types::H256", - parse_quote!(#crate_path::utils::H256), - ), - ( - "primitive_types::H512", - parse_quote!(#crate_path::utils::H512), - ), - ( - "frame_support::traits::misc::WrapperKeepOpaque", - parse_quote!(#crate_path::utils::WrapperKeepOpaque), - ), - // BTreeMap and BTreeSet impose an `Ord` constraint on their key types. This - // can cause an issue with generated code that doesn't impl `Ord` by default. - // Decoding them to Vec by default (KeyedVec is just an alias for Vec with - // suitable type params) avoids these issues. - ("BTreeMap", parse_quote!(#crate_path::utils::KeyedVec)), - ("BTreeSet", parse_quote!(::std::vec::Vec)), - ] - .iter() - .map(|(path, substitute): &(&str, syn::TypePath)| { - (path.to_string(), substitute.clone()) - }) - .collect::>(); - - type_substitutes.extend(item_mod_ir.type_substitutes().into_iter()); - let type_gen = TypeGenerator::new( &self.metadata.types, "runtime_types", diff --git a/codegen/src/ir.rs b/codegen/src/ir.rs index 6050bb7bf9d..7c6131bf7c0 100644 --- a/codegen/src/ir.rs +++ b/codegen/src/ir.rs @@ -3,11 +3,7 @@ // see LICENSE for license details. use proc_macro_error::abort; -use std::collections::HashMap; -use syn::{ - spanned::Spanned as _, - token, -}; +use syn::token; #[derive(Debug, PartialEq, Eq)] pub struct ItemMod { @@ -15,7 +11,7 @@ pub struct ItemMod { mod_token: token::Mod, pub ident: syn::Ident, brace: token::Brace, - items: Vec, + items: Vec, } impl From for ItemMod { @@ -32,130 +28,13 @@ impl From for ItemMod { mod_token: module.mod_token, ident: module.ident, brace, - items: items.into_iter().map(From::from).collect(), + items, } } } impl ItemMod { - pub fn type_substitutes(&self) -> HashMap { - self.items - .iter() - .filter_map(|item| { - if let Item::Subxt(SubxtItem::TypeSubstitute { - generated_type_path, - substitute_with: substitute_type, - }) = item - { - Some((generated_type_path.clone(), substitute_type.clone())) - } else { - None - } - }) - .collect() - } - pub fn rust_items(&self) -> impl Iterator { - self.items.iter().filter_map(Item::as_rust) - } -} - -#[allow(clippy::large_enum_variant)] -#[derive(Debug, PartialEq, Eq)] -pub enum Item { - Rust(syn::Item), - Subxt(SubxtItem), -} - -impl Item { - pub fn as_rust(&self) -> Option<&syn::Item> { - match self { - Item::Rust(item) => Some(item), - _ => None, - } - } -} - -impl From for Item { - fn from(item: syn::Item) -> Self { - if let syn::Item::Use(ref use_) = item { - let substitute_attrs = use_ - .attrs - .iter() - .map(|attr| { - let meta = attr.parse_meta().unwrap_or_else(|e| { - abort!(attr.span(), "Error parsing attribute: {}", e) - }); - ::from_meta(&meta).unwrap_or_else( - |e| abort!(attr.span(), "Error parsing attribute meta: {}", e), - ) - }) - .collect::>(); - if substitute_attrs.len() > 1 { - abort!( - use_.attrs[0].span(), - "Duplicate `substitute_type` attributes" - ) - } - if let Some(attr) = substitute_attrs.get(0) { - let use_path = &use_.tree; - let substitute_with: syn::TypePath = syn::parse_quote!( #use_path ); - - let is_crate = substitute_with - .path - .segments - .first() - .map(|segment| segment.ident == "crate") - .unwrap_or(false); - - // Check if the substitute path is a global absolute path, meaning it - // is prefixed with `::` or `crate`. - // - // Note: the leading colon is lost when parsing to `syn::TypePath` via - // `syn::parse_quote!`. Therefore, inspect `use_`'s leading colon. - if use_.leading_colon.is_none() && !is_crate { - abort!( - use_path.span(), - "The substitute path must be a global absolute path; try prefixing with `::` or `crate`" - ) - } - - let type_substitute = SubxtItem::TypeSubstitute { - generated_type_path: attr.substitute_type(), - substitute_with, - }; - Self::Subxt(type_substitute) - } else { - Self::Rust(item) - } - } else { - Self::Rust(item) - } - } -} - -#[derive(Debug, PartialEq, Eq)] -pub enum SubxtItem { - TypeSubstitute { - generated_type_path: String, - substitute_with: syn::TypePath, - }, -} - -mod attrs { - use darling::FromMeta; - - #[derive(Debug, FromMeta)] - #[darling(rename_all = "snake_case")] - pub enum Subxt { - SubstituteType(String), - } - - impl Subxt { - pub fn substitute_type(&self) -> String { - match self { - Self::SubstituteType(path) => path.clone(), - } - } + self.items.iter() } } diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index bd87e4f21d4..306cfe4bc1d 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -21,7 +21,7 @@ //! use std::fs; //! use codec::Decode; //! use frame_metadata::RuntimeMetadataPrefixed; -//! use subxt_codegen::{CratePath, DerivesRegistry}; +//! use subxt_codegen::{CratePath, DerivesRegistry, TypeSubstitutes}; //! //! let encoded = fs::read("../artifacts/polkadot_metadata.scale").unwrap(); //! @@ -33,9 +33,11 @@ //! ); //! // Default module derivatives. //! let mut derives = DerivesRegistry::new(&CratePath::default()); +//! // Default type substitutes. +//! let substs = TypeSubstitutes::new(&CratePath::default()); //! // Generate the Runtime API. //! let generator = subxt_codegen::RuntimeGenerator::new(metadata); -//! let runtime_api = generator.generate_runtime(item_mod, derives, CratePath::default()); +//! let runtime_api = generator.generate_runtime(item_mod, derives, substs, CratePath::default()); //! println!("{}", runtime_api); //! ``` @@ -60,5 +62,6 @@ pub use self::{ DerivesRegistry, Module, TypeGenerator, + TypeSubstitutes, }, }; diff --git a/codegen/src/types/mod.rs b/codegen/src/types/mod.rs index 5a9c2c7f23e..5b652a852d7 100644 --- a/codegen/src/types/mod.rs +++ b/codegen/src/types/mod.rs @@ -4,6 +4,7 @@ mod composite_def; mod derives; +mod substitutes; #[cfg(test)] mod tests; mod type_def; @@ -27,10 +28,7 @@ use scale_info::{ Type, TypeDef, }; -use std::collections::{ - BTreeMap, - HashMap, -}; +use std::collections::BTreeMap; pub use self::{ composite_def::{ @@ -42,6 +40,7 @@ pub use self::{ Derives, DerivesRegistry, }, + substitutes::TypeSubstitutes, type_def::TypeDefGen, type_def_params::TypeDefParameters, type_path::{ @@ -61,7 +60,7 @@ pub struct TypeGenerator<'a> { /// Registry of type definitions to be transformed into Rust type definitions. type_registry: &'a PortableRegistry, /// User defined overrides for generated types. - type_substitutes: HashMap, + type_substitutes: TypeSubstitutes, /// Set of derives with which to annotate generated types. derives: DerivesRegistry, /// The `subxt` crate access path in the generated code. @@ -73,7 +72,7 @@ impl<'a> TypeGenerator<'a> { pub fn new( type_registry: &'a PortableRegistry, root_mod: &'static str, - type_substitutes: HashMap, + type_substitutes: TypeSubstitutes, derives: DerivesRegistry, crate_path: CratePath, ) -> Self { @@ -89,53 +88,41 @@ impl<'a> TypeGenerator<'a> { /// Generate a module containing all types defined in the supplied type registry. pub fn generate_types_mod(&self) -> Module { - let mut root_mod = - Module::new(self.types_mod_ident.clone(), self.types_mod_ident.clone()); - - for ty in self.type_registry.types().iter() { - if ty.ty().path().namespace().is_empty() { - // prelude types e.g. Option/Result have no namespace, so we don't generate them + let root_mod_ident = &self.types_mod_ident; + let mut root_mod = Module::new(root_mod_ident.clone(), root_mod_ident.clone()); + + for ty in self.type_registry.types() { + let path = ty.ty().path(); + // Don't generate a type if it was substituted - the target type might + // not be in the type registry + our resolution already performs the substitution. + if self.type_substitutes.for_path(path).is_some() { continue } - self.insert_type( - ty.ty().clone(), - ty.ty().path().namespace().to_vec(), - &self.types_mod_ident, - &mut root_mod, - ) - } - root_mod - } - - fn insert_type( - &'a self, - ty: Type, - path: Vec, - root_mod_ident: &Ident, - module: &mut Module, - ) { - let joined_path = path.join("::"); - if self.type_substitutes.contains_key(&joined_path) { - return - } - - let segment = path.first().expect("path has at least one segment"); - let mod_ident = Ident::new(segment, Span::call_site()); - - let child_mod = module - .children - .entry(mod_ident.clone()) - .or_insert_with(|| Module::new(mod_ident, root_mod_ident.clone())); + let namespace = path.namespace(); + // prelude types e.g. Option/Result have no namespace, so we don't generate them + if namespace.is_empty() { + continue + } - if path.len() == 1 { - child_mod.types.insert( - ty.path().clone(), - TypeDefGen::from_type(ty, self, &self.crate_path), + // Lazily create submodules for the encountered namespace path, if they don't exist + let innermost_module = namespace + .iter() + .map(|segment| Ident::new(segment, Span::call_site())) + .fold(&mut root_mod, |module, ident| { + module + .children + .entry(ident.clone()) + .or_insert_with(|| Module::new(ident, root_mod_ident.clone())) + }); + + innermost_module.types.insert( + path.clone(), + TypeDefGen::from_type(ty.ty(), self, &self.crate_path), ); - } else { - self.insert_type(ty, path[1..].to_vec(), root_mod_ident, child_mod) } + + root_mod } /// # Panics @@ -208,7 +195,7 @@ impl<'a> TypeGenerator<'a> { ) } - let params = ty + let params: Vec<_> = ty .type_params() .iter() .filter_map(|f| { @@ -220,13 +207,16 @@ impl<'a> TypeGenerator<'a> { let ty = match ty.type_def() { TypeDef::Composite(_) | TypeDef::Variant(_) => { - let joined_path = ty.path().segments().join("::"); - if let Some(substitute_type_path) = - self.type_substitutes.get(&joined_path) + if let Some((path, params)) = self + .type_substitutes + .for_path_with_params(ty.path(), ¶ms) { TypePathType::Path { - path: substitute_type_path.clone(), - params, + path: syn::TypePath { + qself: None, + path: path.clone(), + }, + params: params.to_vec(), } } else { TypePathType::from_type_def_path( diff --git a/codegen/src/types/substitutes.rs b/codegen/src/types/substitutes.rs new file mode 100644 index 00000000000..3cd8d5f54ad --- /dev/null +++ b/codegen/src/types/substitutes.rs @@ -0,0 +1,254 @@ +// Copyright 2019-2023 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +use crate::CratePath; +use proc_macro_error::abort; +use std::{ + borrow::Cow, + collections::HashMap, +}; +use syn::{ + parse_quote, + spanned::Spanned as _, +}; + +use super::TypePath; + +#[derive(Debug)] +pub struct TypeSubstitutes { + substitutes: HashMap, +} + +#[derive(Debug)] +struct Substitute { + path: syn::Path, + param_mapping: TypeParamMapping, +} + +#[derive(Debug)] +enum TypeParamMapping { + None, + Specified(Vec), +} + +#[macro_export] +macro_rules! path_segments { + ($($ident: ident)::*) => { + PathSegments( + [$(stringify!($ident)),*].into_iter().map(String::from).collect::>() + ) + } +} + +impl TypeSubstitutes { + pub fn new(crate_path: &CratePath) -> Self { + // Some hardcoded default type substitutes, can be overridden by user + let defaults = [ + ( + path_segments!(bitvec::order::Lsb0), + parse_quote!(#crate_path::utils::bits::Lsb0), + ), + ( + path_segments!(bitvec::order::Msb0), + parse_quote!(#crate_path::utils::bits::Msb0), + ), + ( + path_segments!(sp_core::crypto::AccountId32), + parse_quote!(#crate_path::utils::AccountId32), + ), + ( + path_segments!(sp_runtime::multiaddress::MultiAddress), + parse_quote!(#crate_path::utils::MultiAddress), + ), + ( + path_segments!(primitive_types::H160), + parse_quote!(#crate_path::utils::H160), + ), + ( + path_segments!(primitive_types::H256), + parse_quote!(#crate_path::utils::H256), + ), + ( + path_segments!(primitive_types::H512), + parse_quote!(#crate_path::utils::H512), + ), + ( + path_segments!(frame_support::traits::misc::WrapperKeepOpaque), + parse_quote!(#crate_path::utils::WrapperKeepOpaque), + ), + // BTreeMap and BTreeSet impose an `Ord` constraint on their key types. This + // can cause an issue with generated code that doesn't impl `Ord` by default. + // Decoding them to Vec by default (KeyedVec is just an alias for Vec with + // suitable type params) avoids these issues. + ( + path_segments!(BTreeMap), + parse_quote!(#crate_path::utils::KeyedVec), + ), + (path_segments!(BTreeSet), parse_quote!(::std::vec::Vec)), + ]; + + let default_substitutes = defaults + .into_iter() + .map(|(k, v)| { + ( + k, + Substitute { + path: v, + param_mapping: TypeParamMapping::None, + }, + ) + }) + .collect(); + + Self { + substitutes: default_substitutes, + } + } + + pub fn extend(&mut self, elems: impl IntoIterator) { + self.substitutes + .extend(elems.into_iter().map(|(path, AbsolutePath(mut with))| { + let Some(syn::PathSegment { arguments: src_path_args, ..}) = path.segments.last() else { abort!(path.span(), "Empty path") }; + let Some(syn::PathSegment { arguments: target_path_args, ..}) = with.segments.last_mut() else { abort!(with.span(), "Empty path") }; + + let source_args: Vec<_> = type_args(src_path_args).collect(); + + let param_mapping = if source_args.is_empty() { + // If the type parameters on the source type are not specified, then this means that + // the type is either not generic or the user wants to pass through all the parameters + TypeParamMapping::None + } else { + // Describe the mapping in terms of "which source param idx is used for each target param". + // So, for each target param, find the matching source param index. + let mapping = type_args(target_path_args) + .filter_map(|arg| + source_args + .iter() + .position(|&src| src == arg) + .map(|src_idx| + u8::try_from(src_idx).expect("type arguments to be fewer than 256; qed"), + ) + ).collect(); + TypeParamMapping::Specified(mapping) + }; + + // NOTE: Params are late bound and held separately, so clear them + // here to not mess pretty printing this path and params together + *target_path_args = syn::PathArguments::None; + + (PathSegments::from(&path), Substitute { path: with, param_mapping }) + })); + } + + /// Given a source type path, return a substituted type path if a substitution is defined. + pub fn for_path(&self, path: impl Into) -> Option<&syn::Path> { + self.substitutes.get(&path.into()).map(|s| &s.path) + } + + /// Given a source type path and the resolved, supplied type parameters, + /// return a new path and optionally overwritten type parameters. + pub fn for_path_with_params<'a: 'b, 'b>( + &'a self, + path: impl Into, + params: &'b [TypePath], + ) -> Option<(&'a syn::Path, Cow<'b, [TypePath]>)> { + // For now, we only support: + // 1. Reordering the generics + // 2. Omitting certain generics + fn reorder_params<'a>( + params: &'a [TypePath], + mapping: &TypeParamMapping, + ) -> Cow<'a, [TypePath]> { + match mapping { + TypeParamMapping::Specified(mapping) => { + Cow::Owned( + mapping + .iter() + .filter_map(|&idx| params.get(idx as usize)) + .cloned() + .collect(), + ) + } + _ => Cow::Borrowed(params), + } + } + + let path = path.into(); + + self.substitutes + .get(&path) + .map(|sub| (&sub.path, reorder_params(params, &sub.param_mapping))) + } +} + +/// Identifiers joined by the `::` separator. +/// +/// We use this as a common denominator, since we need a consistent keys for both +/// `syn::TypePath` and `scale_info::ty::path::Path` types. +#[derive(Debug, Hash, PartialEq, Eq)] +pub struct PathSegments(Vec); + +impl From<&syn::Path> for PathSegments { + fn from(path: &syn::Path) -> Self { + PathSegments(path.segments.iter().map(|x| x.ident.to_string()).collect()) + } +} + +impl From<&scale_info::Path> for PathSegments { + fn from(path: &scale_info::Path) -> Self { + PathSegments( + path.segments() + .iter() + .map(|x| x.as_ref().to_owned()) + .collect(), + ) + } +} + +/// Returns an iterator over generic type parameters for `syn::PathArguments`. +/// For example: +/// - `<'a, T>` should only return T +/// - `(A, B) -> String` shouldn't return anything +fn type_args(path_args: &syn::PathArguments) -> impl Iterator { + let args_opt = match path_args { + syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments { + ref args, + .. + }) => Some(args), + _ => None, + }; + + args_opt.into_iter().flatten().filter_map(|arg| { + match arg { + syn::GenericArgument::Type(syn::Type::Path(type_path)) => { + Some(&type_path.path) + } + _ => None, + } + }) +} + +/// Whether a path is absolute - starts with `::` or `crate`. +fn is_absolute(path: &syn::Path) -> bool { + path.leading_colon.is_some() + || path + .segments + .first() + .map_or(false, |segment| segment.ident == "crate") +} + +pub struct AbsolutePath(syn::Path); + +impl TryFrom for AbsolutePath { + type Error = (syn::Path, String); + fn try_from(value: syn::Path) -> Result { + if is_absolute(&value) { + Ok(AbsolutePath(value)) + } else { + Err( + (value, "The substitute path must be a global absolute path; try prefixing with `::` or `crate`".to_owned()) + ) + } + } +} diff --git a/codegen/src/types/tests.rs b/codegen/src/types/tests.rs index 6c183c52167..a8df6860b10 100644 --- a/codegen/src/types/tests.rs +++ b/codegen/src/types/tests.rs @@ -39,12 +39,13 @@ fn generate_struct_with_primitives() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -86,12 +87,13 @@ fn generate_struct_with_a_struct_field() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -132,12 +134,13 @@ fn generate_tuple_struct() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -215,12 +218,13 @@ fn derive_compact_as_for_uint_wrapper_structs() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -280,12 +284,13 @@ fn generate_enum() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -339,12 +344,13 @@ fn compact_fields() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -396,12 +402,13 @@ fn compact_generic_parameter() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -438,12 +445,13 @@ fn generate_array_field() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -476,12 +484,13 @@ fn option_fields() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -517,12 +526,13 @@ fn box_fields_struct() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -558,12 +568,13 @@ fn box_fields_enum() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -599,12 +610,13 @@ fn range_fields() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -644,12 +656,13 @@ fn generics() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -693,12 +706,13 @@ fn generics_nested() { registry.register_type(&meta_type::>()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -745,24 +759,13 @@ fn generate_bitvec() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); - let substitutes = [ - ( - String::from("bitvec::order::Lsb0"), - parse_quote!(::subxt_path::utils::bits::Lsb0), - ), - ( - String::from("bitvec::order::Msb0"), - parse_quote!(::subxt_path::utils::bits::Msb0), - ), - ] - .into(); - + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - substitutes, - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -811,12 +814,13 @@ fn generics_with_alias_adds_phantom_data_marker() { registry.register_type(&meta_type::>()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -872,12 +876,13 @@ fn modules() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -930,12 +935,13 @@ fn dont_force_struct_names_camel_case() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), - DerivesRegistry::new(&"::subxt_path".into()), - "::subxt_path".into(), + TypeSubstitutes::new(&crate_path), + DerivesRegistry::new(&crate_path), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -968,16 +974,17 @@ fn apply_user_defined_derives_for_all_types() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); // configure derives - let mut derives = DerivesRegistry::new(&"::subxt_path".into()); + let mut derives = DerivesRegistry::new(&crate_path); derives.extend_for_all(vec![parse_quote!(Clone), parse_quote!(Eq)]); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), + TypeSubstitutes::new(&crate_path), derives, - "::subxt_path".into(), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); @@ -1017,15 +1024,16 @@ fn apply_user_defined_derives_for_specific_types() { registry.register_type(&meta_type::()); let portable_types: PortableRegistry = registry.into(); + let crate_path = "::subxt_path".into(); // configure derives - let mut derives = DerivesRegistry::new(&"::subxt_path".into()); + let mut derives = DerivesRegistry::new(&crate_path); // for all types derives.extend_for_all(vec![parse_quote!(Eq)]); // for specific types derives.extend_for_type( parse_quote!(subxt_codegen::types::tests::B), vec![parse_quote!(Hash)], - &"::subxt_path".into(), + &crate_path, ); // duplicates (in this case `Eq`) will be combined (i.e. a set union) derives.extend_for_type( @@ -1035,15 +1043,15 @@ fn apply_user_defined_derives_for_specific_types() { parse_quote!(Ord), parse_quote!(PartialOrd), ], - &"::subxt_path".into(), + &crate_path, ); let type_gen = TypeGenerator::new( &portable_types, "root", - Default::default(), + TypeSubstitutes::new(&crate_path), derives, - "::subxt_path".into(), + crate_path, ); let types = type_gen.generate_types_mod(); let tests_mod = get_mod(&types, MOD_PATH).unwrap(); diff --git a/codegen/src/types/type_def.rs b/codegen/src/types/type_def.rs index 2d8f0a8e6b8..bdfabecbca9 100644 --- a/codegen/src/types/type_def.rs +++ b/codegen/src/types/type_def.rs @@ -42,11 +42,11 @@ pub struct TypeDefGen { impl TypeDefGen { /// Construct a type definition for codegen from the given [`scale_info::Type`]. pub fn from_type( - ty: Type, + ty: &Type, type_gen: &TypeGenerator, crate_path: &CratePath, ) -> Self { - let derives = type_gen.type_derives(&ty); + let derives = type_gen.type_derives(ty); let type_params = ty .type_params() @@ -80,7 +80,7 @@ impl TypeDefGen { ); type_params.update_unused(fields.field_types()); let composite_def = CompositeDef::struct_def( - &ty, + ty, &type_name, type_params.clone(), fields, diff --git a/macro/src/lib.rs b/macro/src/lib.rs index ae5b623b2e4..480945bd502 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -31,11 +31,9 @@ //! ```ignore //! #[subxt::subxt( //! runtime_metadata_path = "polkadot_metadata.scale", +//! substitute_type(type = "sp_arithmetic::per_things::Perbill", with = "sp_runtime::Perbill") //! )] -//! pub mod polkadot { -//! #[subxt(substitute_type = "sp_arithmetic::per_things::Perbill")] -//! use sp_runtime::Perbill; -//! } +//! pub mod polkadot {} //! ``` //! //! This will replace the generated type and any usages with the specified type at the `use` import. @@ -94,16 +92,19 @@ use std::str::FromStr; use darling::FromMeta; use proc_macro::TokenStream; use proc_macro_error::{ + abort, abort_call_site, proc_macro_error, }; use subxt_codegen::{ utils::Uri, DerivesRegistry, + TypeSubstitutes, }; use syn::{ parse_macro_input, punctuated::Punctuated, + spanned::Spanned as _, }; #[derive(Debug, FromMeta)] @@ -116,6 +117,8 @@ struct RuntimeMetadataArgs { derive_for_all_types: Option>, #[darling(multiple)] derive_for_type: Vec, + #[darling(multiple)] + substitute_type: Vec, #[darling(default, rename = "crate")] crate_path: Option, } @@ -127,6 +130,13 @@ struct DeriveForType { derive: Punctuated, } +#[derive(Debug, FromMeta)] +struct SubstituteType { + #[darling(rename = "type")] + ty: syn::Path, + with: syn::Path, +} + #[proc_macro_attribute] #[proc_macro_error] pub fn subxt(args: TokenStream, input: TokenStream) -> TokenStream { @@ -142,6 +152,7 @@ pub fn subxt(args: TokenStream, input: TokenStream) -> TokenStream { None => subxt_codegen::CratePath::default(), }; let mut derives_registry = DerivesRegistry::new(&crate_path); + if let Some(derive_for_all) = args.derive_for_all_types { derives_registry.extend_for_all(derive_for_all.iter().cloned()); } @@ -153,6 +164,19 @@ pub fn subxt(args: TokenStream, input: TokenStream) -> TokenStream { ) } + let mut type_substitutes = TypeSubstitutes::new(&crate_path); + type_substitutes.extend(args.substitute_type.into_iter().map( + |SubstituteType { ty, with }| { + ( + ty, + with.try_into() + .unwrap_or_else(|(node, msg): (syn::Path, String)| { + abort!(node.span(), msg) + }), + ) + }, + )); + match (args.runtime_metadata_path, args.runtime_metadata_url) { (Some(rest_of_path), None) => { let root = std::env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| ".".into()); @@ -162,6 +186,7 @@ pub fn subxt(args: TokenStream, input: TokenStream) -> TokenStream { item_mod, path, derives_registry, + type_substitutes, crate_path, ) .into() @@ -174,6 +199,7 @@ pub fn subxt(args: TokenStream, input: TokenStream) -> TokenStream { item_mod, &url, derives_registry, + type_substitutes, crate_path, ) .into() diff --git a/testing/integration-tests/src/codegen/codegen_documentation.rs b/testing/integration-tests/src/codegen/codegen_documentation.rs index 547c1a1b37f..236e53c8b34 100644 --- a/testing/integration-tests/src/codegen/codegen_documentation.rs +++ b/testing/integration-tests/src/codegen/codegen_documentation.rs @@ -7,6 +7,7 @@ use subxt_codegen::{ CratePath, DerivesRegistry, RuntimeGenerator, + TypeSubstitutes, }; fn load_test_metadata() -> frame_metadata::RuntimeMetadataPrefixed { @@ -56,8 +57,9 @@ fn generate_runtime_interface(crate_path: CratePath) -> String { pub mod api {} ); let derives = DerivesRegistry::new(&crate_path); + let type_substitutes = TypeSubstitutes::new(&crate_path); generator - .generate_runtime(item_mod, derives, crate_path) + .generate_runtime(item_mod, derives, type_substitutes, crate_path) .to_string() } @@ -124,8 +126,9 @@ fn check_root_attrs_preserved() { // Generate a runtime interface from the provided metadata. let generator = RuntimeGenerator::new(metadata); let derives = DerivesRegistry::new(&CratePath::default()); + let type_substitutes = TypeSubstitutes::new(&CratePath::default()); let generated_code = generator - .generate_runtime(item_mod, derives, CratePath::default()) + .generate_runtime(item_mod, derives, type_substitutes, CratePath::default()) .to_string(); let doc_str_loc = generated_code diff --git a/testing/test-runtime/build.rs b/testing/test-runtime/build.rs index 7d437fcff15..1d7738afd7a 100644 --- a/testing/test-runtime/build.rs +++ b/testing/test-runtime/build.rs @@ -89,12 +89,13 @@ async fn run() { r#" #[subxt::subxt( runtime_metadata_path = "{}", - derive_for_all_types = "Eq, PartialEq" + derive_for_all_types = "Eq, PartialEq", + substitute_type( + type = "sp_arithmetic::per_things::Perbill", + with = "::sp_runtime::Perbill" + ) )] - pub mod node_runtime {{ - #[subxt(substitute_type = "sp_arithmetic::per_things::Perbill")] - use ::sp_runtime::Perbill; - }} + pub mod node_runtime {{}} "#, metadata_path .to_str() diff --git a/testing/ui-tests/src/correct/generic-params.rs b/testing/ui-tests/src/correct/generic-params.rs new file mode 100644 index 00000000000..975fb8d520c --- /dev/null +++ b/testing/ui-tests/src/correct/generic-params.rs @@ -0,0 +1,67 @@ +use core::marker::PhantomData; + +use codec::{Decode, Encode}; + +use subxt::utils::AccountId32; + +#[derive(Encode, Decode, Debug)] +pub struct CustomAddress(u16); +#[derive(Encode, Decode, Debug)] +pub struct Generic(T); +#[derive(Encode, Decode, Debug)] +pub struct Second(U, PhantomData); + +#[subxt::subxt( + runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale", + substitute_type( + type = "sp_runtime::multiaddress::MultiAddress", + with = "crate::CustomAddress" + ) +)] +pub mod node_runtime {} + +#[subxt::subxt( + runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale", + substitute_type( + type = "sp_runtime::multiaddress::MultiAddress", + with = "crate::Generic" + ) +)] +pub mod node_runtime2 {} + +#[subxt::subxt( + runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale", + substitute_type( + type = "sp_runtime::multiaddress::MultiAddress", + with = "crate::Generic" + ) +)] +pub mod node_runtime3 {} + +#[subxt::subxt( + runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale", + substitute_type( + type = "sp_runtime::multiaddress::MultiAddress", + with = "crate::Second" + ) +)] +pub mod node_runtime4 {} + +fn main() { + // We assume Polkadot's config of MultiAddress here + let _ = node_runtime::tx() + .balances() + .transfer(CustomAddress(1337), 123); + + let _ = node_runtime2::tx() + .balances() + .transfer(Generic(AccountId32::from([0x01;32])), 123); + + let _ = node_runtime3::tx() + .balances() + .transfer(Generic(()), 123); + + let _ = node_runtime4::tx() + .balances() + .transfer(Second(AccountId32::from([0x01;32]), PhantomData), 123); +} diff --git a/testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs b/testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs index c5ad11e355c..9ef7cbe610e 100644 --- a/testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs +++ b/testing/ui-tests/src/incorrect/substitute_path_not_absolute.rs @@ -1,7 +1,10 @@ -#[subxt::subxt(runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale")] -pub mod node_runtime { - #[subxt::subxt(substitute_type = "sp_arithmetic::per_things::Perbill")] - use sp_runtime::Perbill; -} +#[subxt::subxt( + runtime_metadata_path = "../../../../artifacts/polkadot_metadata.scale", + substitute_type( + type = "sp_arithmetic::per_things::Perbill", + with = "sp_runtime::Perbill" + ) +)] +pub mod node_runtime {} fn main() {} diff --git a/testing/ui-tests/src/incorrect/substitute_path_not_absolute.stderr b/testing/ui-tests/src/incorrect/substitute_path_not_absolute.stderr index 6e8f863a37b..da5c0b67c92 100644 --- a/testing/ui-tests/src/incorrect/substitute_path_not_absolute.stderr +++ b/testing/ui-tests/src/incorrect/substitute_path_not_absolute.stderr @@ -1,5 +1,5 @@ error: The substitute path must be a global absolute path; try prefixing with `::` or `crate` - --> src/incorrect/substitute_path_not_absolute.rs:4:9 + --> src/incorrect/substitute_path_not_absolute.rs:5:16 | -4 | use sp_runtime::Perbill; - | ^^^^^^^^^^ +5 | with = "sp_runtime::Perbill" + | ^^^^^^^^^^^^^^^^^^^^^ From 0750ccd5a0a51eeab413fd71e6512ce95f9fd609 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Thu, 19 Jan 2023 13:53:32 +0200 Subject: [PATCH 33/37] Add `chainHead` RPC methods (#766) * rpc/types: Add chainHead event types Signed-off-by: Alexandru Vasile * rpc: Add `chainHead` RPC methods Signed-off-by: Alexandru Vasile * rpc: Fix chainHead doc links Signed-off-by: Alexandru Vasile * Update subxt/src/rpc/rpc.rs Co-authored-by: James Wilson * tests: Test the chainHead RPC methods Signed-off-by: Alexandru Vasile * tests: Fix clippy Signed-off-by: Alexandru Vasile * rpc: Improve `chainhead_unstable_follow` docs Signed-off-by: Alexandru Vasile Signed-off-by: Alexandru Vasile Co-authored-by: James Wilson --- subxt/src/rpc/rpc.rs | 163 ++++++++- subxt/src/rpc/types.rs | 384 ++++++++++++++++++++ testing/integration-tests/src/client/mod.rs | 186 +++++++++- 3 files changed, 731 insertions(+), 2 deletions(-) diff --git a/subxt/src/rpc/rpc.rs b/subxt/src/rpc/rpc.rs index fee29799d48..befe75ea784 100644 --- a/subxt/src/rpc/rpc.rs +++ b/subxt/src/rpc/rpc.rs @@ -41,7 +41,11 @@ use super::{ rpc_params, - types, + types::{ + self, + ChainHeadEvent, + FollowEvent, + }, RpcClient, RpcClientT, Subscription, @@ -465,6 +469,163 @@ impl Rpc { self.client.request("system_dryRun", params).await?; Ok(types::decode_dry_run_result(&mut &*result_bytes.0)?) } + + /// Subscribe to `chainHead_unstable_follow` to obtain all reported blocks by the chain. + /// + /// The subscription ID can be used to make queries for the + /// block's body ([`chainhead_unstable_body`](Rpc::chainhead_unstable_follow)), + /// block's header ([`chainhead_unstable_header`](Rpc::chainhead_unstable_header)), + /// block's storage ([`chainhead_unstable_storage`](Rpc::chainhead_unstable_storage)) and submitting + /// runtime API calls at this block ([`chainhead_unstable_call`](Rpc::chainhead_unstable_call)). + /// + /// # Note + /// + /// When the user is no longer interested in a block, the user is responsible + /// for calling the [`chainhead_unstable_unpin`](Rpc::chainhead_unstable_unpin) method. + /// Failure to do so will result in the subscription being stopped by generating the `Stop` event. + pub async fn chainhead_unstable_follow( + &self, + runtime_updates: bool, + ) -> Result>, Error> { + let subscription = self + .client + .subscribe( + "chainHead_unstable_follow", + rpc_params![runtime_updates], + "chainHead_unstable_unfollow", + ) + .await?; + + Ok(subscription) + } + + /// Subscribe to `chainHead_unstable_body` to obtain events regarding the block's body. + /// + /// # Note + /// + /// The subscription ID is obtained from an open subscription created by + /// [`chainhead_unstable_follow`](Rpc::chainhead_unstable_follow). + pub async fn chainhead_unstable_body( + &self, + subscription_id: String, + hash: T::Hash, + ) -> Result>, Error> { + let subscription = self + .client + .subscribe( + "chainHead_unstable_body", + rpc_params![subscription_id, hash], + "chainHead_unstable_stopBody", + ) + .await?; + + Ok(subscription) + } + + /// Get the block's body using the `chainHead_unstable_header` method. + /// + /// # Note + /// + /// The subscription ID is obtained from an open subscription created by + /// [`chainhead_unstable_follow`](Rpc::chainhead_unstable_follow). + pub async fn chainhead_unstable_header( + &self, + subscription_id: String, + hash: T::Hash, + ) -> Result, Error> { + let header = self + .client + .request( + "chainHead_unstable_header", + rpc_params![subscription_id, hash], + ) + .await?; + + Ok(header) + } + + /// Subscribe to `chainHead_storage` to obtain events regarding the + /// block's storage. + /// + /// # Note + /// + /// The subscription ID is obtained from an open subscription created by + /// [`chainhead_unstable_follow`](Rpc::chainhead_unstable_follow). + pub async fn chainhead_unstable_storage( + &self, + subscription_id: String, + hash: T::Hash, + key: &[u8], + child_key: Option<&[u8]>, + ) -> Result>>, Error> { + let subscription = self + .client + .subscribe( + "chainHead_unstable_storage", + rpc_params![subscription_id, hash, to_hex(key), child_key.map(to_hex)], + "chainHead_unstable_stopStorage", + ) + .await?; + + Ok(subscription) + } + + /// Subscribe to `chainHead_call` to obtain events regarding the + /// runtime API call. + /// + /// # Note + /// + /// The subscription ID is obtained from an open subscription created by + /// [`chainhead_unstable_follow`](Rpc::chainhead_unstable_follow). + pub async fn chainhead_unstable_call( + &self, + subscription_id: String, + hash: T::Hash, + function: String, + call_parameters: &[u8], + ) -> Result>, Error> { + let subscription = self + .client + .subscribe( + "chainHead_unstable_call", + rpc_params![subscription_id, hash, function, to_hex(call_parameters)], + "chainHead_unstable_stopCall", + ) + .await?; + + Ok(subscription) + } + + /// Unpin a block reported by the `chainHead_follow` subscription. + /// + /// # Note + /// + /// The subscription ID is obtained from an open subscription created by + /// [`chainhead_unstable_follow`](Rpc::chainhead_unstable_follow). + pub async fn chainhead_unstable_unpin( + &self, + subscription_id: String, + hash: T::Hash, + ) -> Result<(), Error> { + self.client + .request( + "chainHead_unstable_unpin", + rpc_params![subscription_id, hash], + ) + .await?; + + Ok(()) + } + + /// Get genesis hash obtained from the `chainHead_genesisHash` method. + pub async fn chainhead_unstable_genesishash(&self) -> Result { + let hash = self + .client + .request("chainHead_unstable_genesisHash", rpc_params![]) + .await?; + + Ok(hash) + } } fn to_hex(bytes: impl AsRef<[u8]>) -> String { diff --git a/subxt/src/rpc/types.rs b/subxt/src/rpc/types.rs index c68b17a08f8..97723636712 100644 --- a/subxt/src/rpc/types.rs +++ b/subxt/src/rpc/types.rs @@ -398,6 +398,390 @@ pub struct Health { pub should_have_peers: bool, } +/// The operation could not be processed due to an error. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ErrorEvent { + /// Reason of the error. + pub error: String, +} + +/// The runtime specification of the current block. +/// +/// This event is generated for: +/// - the first announced block by the follow subscription +/// - blocks that suffered a change in runtime compared with their parents +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct RuntimeVersionEvent { + /// The runtime version. + pub spec: RuntimeVersion, +} + +/// The runtime event generated if the `follow` subscription +/// has set the `runtime_updates` flag. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +#[serde(tag = "type")] +pub enum RuntimeEvent { + /// The runtime version of this block. + Valid(RuntimeVersionEvent), + /// The runtime could not be obtained due to an error. + Invalid(ErrorEvent), +} + +/// Contain information about the latest finalized block. +/// +/// # Note +/// +/// This is the first event generated by the `follow` subscription +/// and is submitted only once. +/// +/// If the `runtime_updates` flag is set, then this event contains +/// the `RuntimeEvent`, otherwise the `RuntimeEvent` is not present. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Initialized { + /// The hash of the latest finalized block. + pub finalized_block_hash: Hash, + /// The runtime version of the finalized block. + /// + /// # Note + /// + /// This is present only if the `runtime_updates` flag is set for + /// the `follow` subscription. + pub finalized_block_runtime: Option, +} + +/// Indicate a new non-finalized block. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NewBlock { + /// The hash of the new block. + pub block_hash: Hash, + /// The parent hash of the new block. + pub parent_block_hash: Hash, + /// The runtime version of the new block. + /// + /// # Note + /// + /// This is present only if the `runtime_updates` flag is set for + /// the `follow` subscription. + pub new_runtime: Option, +} + +/// Indicate the block hash of the new best block. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct BestBlockChanged { + /// The block hash of the new best block. + pub best_block_hash: Hash, +} + +/// Indicate the finalized and pruned block hashes. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Finalized { + /// Block hashes that are finalized. + pub finalized_block_hashes: Vec, + /// Block hashes that are pruned (removed). + pub pruned_block_hashes: Vec, +} + +/// The event generated by the `chainHead_follow` method. +/// +/// The events are generated in the following order: +/// 1. Initialized - generated only once to signal the +/// latest finalized block +/// 2. NewBlock - a new block was added. +/// 3. BestBlockChanged - indicate that the best block +/// is now the one from this event. The block was +/// announced priorly with the `NewBlock` event. +/// 4. Finalized - State the finalized and pruned blocks. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +#[serde(tag = "event")] +pub enum FollowEvent { + /// The latest finalized block. + /// + /// This event is generated only once. + Initialized(Initialized), + /// A new non-finalized block was added. + NewBlock(NewBlock), + /// The best block of the chain. + BestBlockChanged(BestBlockChanged), + /// A list of finalized and pruned blocks. + Finalized(Finalized), + /// The subscription is dropped and no further events + /// will be generated. + Stop, +} + +/// The result of a chain head method. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ChainHeadResult { + /// Result of the method. + pub result: T, +} + +/// The event generated by the body / call / storage methods. +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "camelCase")] +#[serde(tag = "event")] +pub enum ChainHeadEvent { + /// The request completed successfully. + Done(ChainHeadResult), + /// The resources requested are inaccessible. + /// + /// Resubmitting the request later might succeed. + Inaccessible(ErrorEvent), + /// An error occurred. This is definitive. + Error(ErrorEvent), + /// The provided subscription ID is stale or invalid. + Disjoint, +} + +/// The transaction was broadcasted to a number of peers. +/// +/// # Note +/// +/// The RPC does not guarantee that the peers have received the +/// transaction. +/// +/// When the number of peers is zero, the event guarantees that +/// shutting down the local node will lead to the transaction +/// not being included in the chain. +#[derive(Debug, Clone, PartialEq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TransactionBroadcasted { + /// The number of peers the transaction was broadcasted to. + #[serde(with = "as_string")] + pub num_peers: usize, +} + +/// The transaction was included in a block of the chain. +#[derive(Debug, Clone, PartialEq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TransactionBlock { + /// The hash of the block the transaction was included into. + pub hash: Hash, + /// The index (zero-based) of the transaction within the body of the block. + #[serde(with = "as_string")] + pub index: usize, +} + +/// The transaction could not be processed due to an error. +#[derive(Debug, Clone, PartialEq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TransactionError { + /// Reason of the error. + pub error: String, +} + +/// The transaction was dropped because of exceeding limits. +#[derive(Debug, Clone, PartialEq, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TransactionDropped { + /// True if the transaction was broadcasted to other peers and + /// may still be included in the block. + pub broadcasted: bool, + /// Reason of the event. + pub error: String, +} + +/// Possible transaction status events. +/// +/// The status events can be grouped based on their kinds as: +/// +/// 1. Runtime validated the transaction: +/// - `Validated` +/// +/// 2. Inside the `Ready` queue: +/// - `Broadcast` +/// +/// 3. Leaving the pool: +/// - `BestChainBlockIncluded` +/// - `Invalid` +/// +/// 4. Block finalized: +/// - `Finalized` +/// +/// 5. At any time: +/// - `Dropped` +/// - `Error` +/// +/// The subscription's stream is considered finished whenever the following events are +/// received: `Finalized`, `Error`, `Invalid` or `Dropped`. However, the user is allowed +/// to unsubscribe at any moment. +#[derive(Debug, Clone, PartialEq, Deserialize)] +// We need to manually specify the trait bounds for the `Hash` trait to ensure `into` and +// `from` still work. +#[serde(bound(deserialize = "Hash: Deserialize<'de> + Clone"))] +#[serde(from = "TransactionEventIR")] +pub enum TransactionEvent { + /// The transaction was validated by the runtime. + Validated, + /// The transaction was broadcasted to a number of peers. + Broadcasted(TransactionBroadcasted), + /// The transaction was included in a best block of the chain. + /// + /// # Note + /// + /// This may contain `None` if the block is no longer a best + /// block of the chain. + BestChainBlockIncluded(Option>), + /// The transaction was included in a finalized block. + Finalized(TransactionBlock), + /// The transaction could not be processed due to an error. + Error(TransactionError), + /// The transaction is marked as invalid. + Invalid(TransactionError), + /// The client was not capable of keeping track of this transaction. + Dropped(TransactionDropped), +} + +/// Intermediate representation (IR) for the transaction events +/// that handles block events only. +/// +/// The block events require a JSON compatible interpretation similar to: +/// +/// ```json +/// { event: "EVENT", block: { hash: "0xFF", index: 0 } } +/// ``` +/// +/// This IR is introduced to circumvent that the block events need to +/// be serialized/deserialized with "tag" and "content", while other +/// events only require "tag". +#[derive(Debug, Clone, PartialEq, Deserialize)] +#[serde(rename_all = "camelCase")] +#[serde(tag = "event", content = "block")] +enum TransactionEventBlockIR { + /// The transaction was included in the best block of the chain. + BestChainBlockIncluded(Option>), + /// The transaction was included in a finalized block of the chain. + Finalized(TransactionBlock), +} + +/// Intermediate representation (IR) for the transaction events +/// that handles non-block events only. +/// +/// The non-block events require a JSON compatible interpretation similar to: +/// +/// ```json +/// { event: "EVENT", num_peers: 0 } +/// ``` +/// +/// This IR is introduced to circumvent that the block events need to +/// be serialized/deserialized with "tag" and "content", while other +/// events only require "tag". +#[derive(Debug, Clone, PartialEq, Deserialize)] +#[serde(rename_all = "camelCase")] +#[serde(tag = "event")] +enum TransactionEventNonBlockIR { + Validated, + Broadcasted(TransactionBroadcasted), + Error(TransactionError), + Invalid(TransactionError), + Dropped(TransactionDropped), +} + +/// Intermediate representation (IR) used for serialization/deserialization of the +/// [`TransactionEvent`] in a JSON compatible format. +/// +/// Serde cannot mix `#[serde(tag = "event")]` with `#[serde(tag = "event", content = "block")]` +/// for specific enum variants. Therefore, this IR is introduced to circumvent this +/// restriction, while exposing a simplified [`TransactionEvent`] for users of the +/// rust ecosystem. +#[derive(Debug, Clone, PartialEq, Deserialize)] +#[serde(bound(deserialize = "Hash: Deserialize<'de>"))] +#[serde(rename_all = "camelCase")] +#[serde(untagged)] +enum TransactionEventIR { + Block(TransactionEventBlockIR), + NonBlock(TransactionEventNonBlockIR), +} + +impl From> for TransactionEventIR { + fn from(value: TransactionEvent) -> Self { + match value { + TransactionEvent::Validated => { + TransactionEventIR::NonBlock(TransactionEventNonBlockIR::Validated) + } + TransactionEvent::Broadcasted(event) => { + TransactionEventIR::NonBlock(TransactionEventNonBlockIR::Broadcasted( + event, + )) + } + TransactionEvent::BestChainBlockIncluded(event) => { + TransactionEventIR::Block( + TransactionEventBlockIR::BestChainBlockIncluded(event), + ) + } + TransactionEvent::Finalized(event) => { + TransactionEventIR::Block(TransactionEventBlockIR::Finalized(event)) + } + TransactionEvent::Error(event) => { + TransactionEventIR::NonBlock(TransactionEventNonBlockIR::Error(event)) + } + TransactionEvent::Invalid(event) => { + TransactionEventIR::NonBlock(TransactionEventNonBlockIR::Invalid(event)) + } + TransactionEvent::Dropped(event) => { + TransactionEventIR::NonBlock(TransactionEventNonBlockIR::Dropped(event)) + } + } + } +} + +impl From> for TransactionEvent { + fn from(value: TransactionEventIR) -> Self { + match value { + TransactionEventIR::NonBlock(status) => { + match status { + TransactionEventNonBlockIR::Validated => TransactionEvent::Validated, + TransactionEventNonBlockIR::Broadcasted(event) => { + TransactionEvent::Broadcasted(event) + } + TransactionEventNonBlockIR::Error(event) => { + TransactionEvent::Error(event) + } + TransactionEventNonBlockIR::Invalid(event) => { + TransactionEvent::Invalid(event) + } + TransactionEventNonBlockIR::Dropped(event) => { + TransactionEvent::Dropped(event) + } + } + } + TransactionEventIR::Block(block) => { + match block { + TransactionEventBlockIR::Finalized(event) => { + TransactionEvent::Finalized(event) + } + TransactionEventBlockIR::BestChainBlockIncluded(event) => { + TransactionEvent::BestChainBlockIncluded(event) + } + } + } + } + } +} + +/// Serialize and deserialize helper as string. +mod as_string { + use super::*; + use serde::Deserializer; + + pub fn deserialize<'de, D: Deserializer<'de>>( + deserializer: D, + ) -> Result { + String::deserialize(deserializer)? + .parse() + .map_err(|e| serde::de::Error::custom(format!("Parsing failed: {}", e))) + } +} + #[cfg(test)] mod test { use super::*; diff --git a/testing/integration-tests/src/client/mod.rs b/testing/integration-tests/src/client/mod.rs index ad18d439e43..666bbad952d 100644 --- a/testing/integration-tests/src/client/mod.rs +++ b/testing/integration-tests/src/client/mod.rs @@ -11,9 +11,11 @@ use crate::{ wait_for_blocks, }, }; +use assert_matches::assert_matches; use codec::{ Compact, Decode, + Encode, }; use frame_metadata::RuntimeMetadataPrefixed; use sp_core::{ @@ -24,7 +26,15 @@ use sp_core::{ use sp_keyring::AccountKeyring; use subxt::{ error::DispatchError, - rpc::types::DryRunError, + rpc::types::{ + ChainHeadEvent, + DryRunError, + FollowEvent, + Initialized, + RuntimeEvent, + RuntimeVersionEvent, + }, + utils::AccountId32, }; #[tokio::test] @@ -281,3 +291,177 @@ async fn rpc_state_call() { let metadata = metadata.runtime_metadata(); assert_eq!(&metadata_call, metadata); } + +#[tokio::test] +async fn chainhead_unstable_follow() { + let ctx = test_context().await; + let api = ctx.client(); + + // Check subscription with runtime updates set on false. + let mut blocks = api.rpc().chainhead_unstable_follow(false).await.unwrap(); + let event = blocks.next().await.unwrap().unwrap(); + // The initialized event should contain the finalized block hash. + let finalized_block_hash = api.rpc().finalized_head().await.unwrap(); + assert_eq!( + event, + FollowEvent::Initialized(Initialized { + finalized_block_hash, + finalized_block_runtime: None, + }) + ); + + // Expect subscription to produce runtime versions. + let mut blocks = api.rpc().chainhead_unstable_follow(true).await.unwrap(); + let event = blocks.next().await.unwrap().unwrap(); + // The initialized event should contain the finalized block hash. + let finalized_block_hash = api.rpc().finalized_head().await.unwrap(); + let runtime_version = ctx.client().runtime_version(); + + assert_matches!( + event, + FollowEvent::Initialized(init) => { + assert_eq!(init.finalized_block_hash, finalized_block_hash); + assert_eq!(init.finalized_block_runtime, Some(RuntimeEvent::Valid(RuntimeVersionEvent { + spec: runtime_version, + }))); + } + ); +} + +#[tokio::test] +async fn chainhead_unstable_body() { + let ctx = test_context().await; + let api = ctx.client(); + + let mut blocks = api.rpc().chainhead_unstable_follow(false).await.unwrap(); + let event = blocks.next().await.unwrap().unwrap(); + let hash = match event { + FollowEvent::Initialized(init) => init.finalized_block_hash, + _ => panic!("Unexpected event"), + }; + let sub_id = blocks.subscription_id().unwrap().clone(); + + // Subscribe to fetch the block's body. + let mut sub = api + .rpc() + .chainhead_unstable_body(sub_id, hash) + .await + .unwrap(); + let event = sub.next().await.unwrap().unwrap(); + + // Expected block's extrinsics scale encoded and hex encoded. + let body = api.rpc().block(Some(hash)).await.unwrap().unwrap(); + let extrinsics: Vec> = + body.block.extrinsics.into_iter().map(|ext| ext.0).collect(); + let expected = format!("0x{}", hex::encode(extrinsics.encode())); + + assert_matches!(event, + ChainHeadEvent::Done(done) if done.result == expected + ); +} + +#[tokio::test] +async fn chainhead_unstable_header() { + let ctx = test_context().await; + let api = ctx.client(); + + let mut blocks = api.rpc().chainhead_unstable_follow(false).await.unwrap(); + let event = blocks.next().await.unwrap().unwrap(); + let hash = match event { + FollowEvent::Initialized(init) => init.finalized_block_hash, + _ => panic!("Unexpected event"), + }; + let sub_id = blocks.subscription_id().unwrap().clone(); + + let header = api.rpc().header(Some(hash)).await.unwrap().unwrap(); + let expected = format!("0x{}", hex::encode(header.encode())); + + let header = api + .rpc() + .chainhead_unstable_header(sub_id, hash) + .await + .unwrap() + .unwrap(); + + assert_eq!(header, expected); +} + +#[tokio::test] +async fn chainhead_unstable_storage() { + let ctx = test_context().await; + let api = ctx.client(); + + let mut blocks = api.rpc().chainhead_unstable_follow(false).await.unwrap(); + let event = blocks.next().await.unwrap().unwrap(); + let hash = match event { + FollowEvent::Initialized(init) => init.finalized_block_hash, + _ => panic!("Unexpected event"), + }; + let sub_id = blocks.subscription_id().unwrap().clone(); + + let alice: AccountId32 = AccountKeyring::Alice.to_account_id().into(); + let addr = node_runtime::storage().system().account(alice).to_bytes(); + let mut sub = api + .rpc() + .chainhead_unstable_storage(sub_id, hash, &addr, None) + .await + .unwrap(); + let event = sub.next().await.unwrap().unwrap(); + + assert_matches!(event, ChainHeadEvent::>::Done(done) if done.result.is_some()); +} + +#[tokio::test] +async fn chainhead_unstable_call() { + let ctx = test_context().await; + let api = ctx.client(); + + let mut blocks = api.rpc().chainhead_unstable_follow(true).await.unwrap(); + let event = blocks.next().await.unwrap().unwrap(); + let hash = match event { + FollowEvent::Initialized(init) => init.finalized_block_hash, + _ => panic!("Unexpected event"), + }; + let sub_id = blocks.subscription_id().unwrap().clone(); + + let alice_id = AccountKeyring::Alice.to_account_id(); + let mut sub = api + .rpc() + .chainhead_unstable_call( + sub_id, + hash, + "AccountNonceApi_account_nonce".into(), + &alice_id.encode(), + ) + .await + .unwrap(); + let event = sub.next().await.unwrap().unwrap(); + + assert_matches!(event, ChainHeadEvent::::Done(_)); +} + +#[tokio::test] +async fn chainhead_unstable_unpin() { + let ctx = test_context().await; + let api = ctx.client(); + + let mut blocks = api.rpc().chainhead_unstable_follow(true).await.unwrap(); + let event = blocks.next().await.unwrap().unwrap(); + let hash = match event { + FollowEvent::Initialized(init) => init.finalized_block_hash, + _ => panic!("Unexpected event"), + }; + let sub_id = blocks.subscription_id().unwrap().clone(); + + assert!(api + .rpc() + .chainhead_unstable_unpin(sub_id.clone(), hash) + .await + .is_ok()); + // The block was already unpinned. + assert!(api + .rpc() + .chainhead_unstable_unpin(sub_id, hash) + .await + .is_err()); +} From 4155850063dbf2ee973e3da778eb988b32d6fa6c Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Thu, 19 Jan 2023 16:13:36 +0200 Subject: [PATCH 34/37] tests: Ensure correct signing of extrinsics larger than 256 bytes (#797) * tests: Ensure correct signing of extrinsics larger than 256 bytes Signed-off-by: Alexandru Vasile * tests: Use `vec!` macro for blob creation Signed-off-by: Alexandru Vasile Signed-off-by: Alexandru Vasile --- testing/integration-tests/src/client/mod.rs | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/testing/integration-tests/src/client/mod.rs b/testing/integration-tests/src/client/mod.rs index 666bbad952d..f3323ac93db 100644 --- a/testing/integration-tests/src/client/mod.rs +++ b/testing/integration-tests/src/client/mod.rs @@ -234,6 +234,33 @@ async fn dry_run_fails() { } } +#[tokio::test] +async fn submit_large_extrinsic() { + let ctx = test_context().await; + let api = ctx.client(); + + let alice = pair_signer(AccountKeyring::Alice.pair()); + + // 2 MiB blob of data. + let bytes = vec![0_u8; 2 * 1024 * 1024]; + // The preimage pallet allows storing and managing large byte-blobs. + let tx = node_runtime::tx().preimage().note_preimage(bytes); + + let signed_extrinsic = api + .tx() + .create_signed(&tx, &alice, Default::default()) + .await + .unwrap(); + + signed_extrinsic + .submit_and_watch() + .await + .unwrap() + .wait_for_finalized_success() + .await + .unwrap(); +} + #[tokio::test] async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() { let ctx = test_context().await; From e4e9562b45451f807099a0749dfc4f9a100247c6 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Fri, 20 Jan 2023 12:49:19 +0200 Subject: [PATCH 35/37] Add block-centric Storage API (#774) * blocks: Add storage method Signed-off-by: Alexandru Vasile * Add support for runtime API calls and expose it to the blocks API Signed-off-by: Alexandru Vasile * storage: Add storage type for block centric API Signed-off-by: Alexandru Vasile * Adjust subxt to the new Storage interface Signed-off-by: Alexandru Vasile * Fix clippy Signed-off-by: Alexandru Vasile Signed-off-by: Alexandru Vasile --- .../examples/concurrent_storage_requests.rs | 4 +- examples/examples/dynamic_queries.rs | 11 +- examples/examples/fetch_all_accounts.rs | 2 +- examples/examples/fetch_staking_details.rs | 19 +- examples/examples/storage_iterating.rs | 21 +- subxt/src/blocks/block_types.rs | 7 + subxt/src/rpc/rpc.rs | 19 + subxt/src/storage/mod.rs | 7 +- subxt/src/storage/storage_client.rs | 374 ++-------------- subxt/src/storage/storage_type.rs | 404 ++++++++++++++++++ testing/integration-tests/src/client/mod.rs | 14 +- .../integration-tests/src/frame/balances.rs | 56 ++- .../integration-tests/src/frame/contracts.rs | 14 +- .../integration-tests/src/frame/staking.rs | 19 +- testing/integration-tests/src/frame/system.rs | 4 +- .../integration-tests/src/frame/timestamp.rs | 5 +- testing/integration-tests/src/storage/mod.rs | 16 +- 17 files changed, 608 insertions(+), 388 deletions(-) create mode 100644 subxt/src/storage/storage_type.rs diff --git a/examples/examples/concurrent_storage_requests.rs b/examples/examples/concurrent_storage_requests.rs index 064d46204d1..688fea960e5 100644 --- a/examples/examples/concurrent_storage_requests.rs +++ b/examples/examples/concurrent_storage_requests.rs @@ -32,8 +32,8 @@ async fn main() -> Result<(), Box> { // For storage requests, we can join futures together to // await multiple futures concurrently: - let a_fut = api.storage().fetch(&staking_bonded, None); - let b_fut = api.storage().fetch(&staking_ledger, None); + let a_fut = api.storage().at(None).await?.fetch(&staking_bonded); + let b_fut = api.storage().at(None).await?.fetch(&staking_ledger); let (a, b) = join!(a_fut, b_fut); println!("{a:?}, {b:?}"); diff --git a/examples/examples/dynamic_queries.rs b/examples/examples/dynamic_queries.rs index 08e67ea4612..e0f652f588c 100644 --- a/examples/examples/dynamic_queries.rs +++ b/examples/examples/dynamic_queries.rs @@ -66,7 +66,9 @@ async fn main() -> Result<(), Box> { ); let account = api .storage() - .fetch_or_default(&storage_address, None) + .at(None) + .await? + .fetch_or_default(&storage_address) .await? .to_value()?; println!("Bob's account details: {account}"); @@ -74,7 +76,12 @@ async fn main() -> Result<(), Box> { // 4. Dynamic storage iteration (the dynamic equivalent to the fetch_all_accounts example). let storage_address = subxt::dynamic::storage_root("System", "Account"); - let mut iter = api.storage().iter(storage_address, 10, None).await?; + let mut iter = api + .storage() + .at(None) + .await? + .iter(storage_address, 10) + .await?; while let Some((key, account)) = iter.next().await? { println!("{}: {}", hex::encode(key), account.to_value()?); } diff --git a/examples/examples/fetch_all_accounts.rs b/examples/examples/fetch_all_accounts.rs index e4c6262e664..2d8b18f9c9d 100644 --- a/examples/examples/fetch_all_accounts.rs +++ b/examples/examples/fetch_all_accounts.rs @@ -26,7 +26,7 @@ async fn main() -> Result<(), Box> { let address = polkadot::storage().system().account_root(); - let mut iter = api.storage().iter(address, 10, None).await?; + let mut iter = api.storage().at(None).await?.iter(address, 10).await?; while let Some((key, account)) = iter.next().await? { println!("{}: {}", hex::encode(key), account.data.free); diff --git a/examples/examples/fetch_staking_details.rs b/examples/examples/fetch_staking_details.rs index cd1f5efdf67..8da45696d68 100644 --- a/examples/examples/fetch_staking_details.rs +++ b/examples/examples/fetch_staking_details.rs @@ -32,7 +32,13 @@ async fn main() -> Result<(), Box> { let api = OnlineClient::::new().await?; let active_era_addr = polkadot::storage().staking().active_era(); - let era = api.storage().fetch(&active_era_addr, None).await?.unwrap(); + let era = api + .storage() + .at(None) + .await? + .fetch(&active_era_addr) + .await? + .unwrap(); println!( "Staking active era: index: {:?}, start: {:?}", era.index, era.start @@ -52,13 +58,20 @@ async fn main() -> Result<(), Box> { let controller_acc_addr = polkadot::storage().staking().bonded(&alice_stash_id); let controller_acc = api .storage() - .fetch(&controller_acc_addr, None) + .at(None) + .await? + .fetch(&controller_acc_addr) .await? .unwrap(); println!(" account controlled by: {:?}", controller_acc); let era_reward_addr = polkadot::storage().staking().eras_reward_points(era.index); - let era_result = api.storage().fetch(&era_reward_addr, None).await?; + let era_result = api + .storage() + .at(None) + .await? + .fetch(&era_reward_addr) + .await?; println!("Era reward points: {:?}", era_result); Ok(()) diff --git a/examples/examples/storage_iterating.rs b/examples/examples/storage_iterating.rs index bb0873466ed..16fd6b185a5 100644 --- a/examples/examples/storage_iterating.rs +++ b/examples/examples/storage_iterating.rs @@ -35,7 +35,7 @@ async fn main() -> Result<(), Box> { { let key_addr = polkadot::storage().xcm_pallet().version_notifiers_root(); - let mut iter = api.storage().iter(key_addr, 10, None).await?; + let mut iter = api.storage().at(None).await?.iter(key_addr, 10).await?; println!("\nExample 1. Obtained keys:"); while let Some((key, value)) = iter.next().await? { @@ -52,14 +52,18 @@ async fn main() -> Result<(), Box> { // Fetch at most 10 keys from below the prefix XcmPallet' VersionNotifiers. let keys = api .storage() - .fetch_keys(&key_addr.to_root_bytes(), 10, None, None) + .at(None) + .await? + .fetch_keys(&key_addr.to_root_bytes(), 10, None) .await?; println!("Example 2. Obtained keys:"); for key in keys.iter() { println!("Key: 0x{}", hex::encode(key)); - if let Some(storage_data) = api.storage().fetch_raw(&key.0, None).await? { + if let Some(storage_data) = + api.storage().at(None).await?.fetch_raw(&key.0).await? + { // We know the return value to be `QueryId` (`u64`) from inspecting either: // - polkadot code // - polkadot.rs generated file under `version_notifiers()` fn @@ -86,13 +90,20 @@ async fn main() -> Result<(), Box> { // `twox_128("XcmPallet") ++ twox_128("VersionNotifiers") ++ twox_64(2u32) ++ 2u32` println!("\nExample 3\nQuery key: 0x{}", hex::encode(&query_key)); - let keys = api.storage().fetch_keys(&query_key, 10, None, None).await?; + let keys = api + .storage() + .at(None) + .await? + .fetch_keys(&query_key, 10, None) + .await?; println!("Obtained keys:"); for key in keys.iter() { println!("Key: 0x{}", hex::encode(key)); - if let Some(storage_data) = api.storage().fetch_raw(&key.0, None).await? { + if let Some(storage_data) = + api.storage().at(None).await?.fetch_raw(&key.0).await? + { // We know the return value to be `QueryId` (`u64`) from inspecting either: // - polkadot code // - polkadot.rs generated file under `version_notifiers()` fn diff --git a/subxt/src/blocks/block_types.rs b/subxt/src/blocks/block_types.rs index 82372974ba1..e58afc21f9e 100644 --- a/subxt/src/blocks/block_types.rs +++ b/subxt/src/blocks/block_types.rs @@ -19,6 +19,7 @@ use crate::{ events, rpc::types::ChainBlockResponse, runtime_api::RuntimeApi, + storage::Storage, }; use derivative::Derivative; use futures::lock::Mutex as AsyncMutex; @@ -91,6 +92,12 @@ where )) } + /// Work with storage. + pub fn storage(&self) -> Storage { + let block_hash = self.hash(); + Storage::new(self.client.clone(), block_hash) + } + /// Execute a runtime API call at this block. pub async fn runtime_api(&self) -> Result, Error> { Ok(RuntimeApi::new(self.client.clone(), self.hash())) diff --git a/subxt/src/rpc/rpc.rs b/subxt/src/rpc/rpc.rs index befe75ea784..48b7ce5b661 100644 --- a/subxt/src/rpc/rpc.rs +++ b/subxt/src/rpc/rpc.rs @@ -173,6 +173,25 @@ impl Rpc { Ok(metadata) } + /// Execute a runtime API call. + pub async fn call( + &self, + function: String, + call_parameters: Option<&[u8]>, + at: Option, + ) -> Result { + let call_parameters = call_parameters.unwrap_or_default(); + + let bytes: types::Bytes = self + .client + .request( + "state_call", + rpc_params![function, to_hex(call_parameters), at], + ) + .await?; + Ok(bytes) + } + /// Fetch system properties pub async fn system_properties(&self) -> Result { self.client diff --git a/subxt/src/storage/mod.rs b/subxt/src/storage/mod.rs index 072560182e4..4edfd04a533 100644 --- a/subxt/src/storage/mod.rs +++ b/subxt/src/storage/mod.rs @@ -7,12 +7,15 @@ mod storage_address; mod storage_client; mod storage_map_key; +mod storage_type; pub mod utils; -pub use storage_client::{ +pub use storage_client::StorageClient; + +pub use storage_type::{ KeyIter, - StorageClient, + Storage, }; // Re-export as this is used in the public API in this module: diff --git a/subxt/src/storage/storage_client.rs b/subxt/src/storage/storage_client.rs index 068098e592b..60c5cc24e23 100644 --- a/subxt/src/storage/storage_client.rs +++ b/subxt/src/storage/storage_client.rs @@ -2,29 +2,23 @@ // This file is dual-licensed as Apache-2.0 or GPL-3.0. // see LICENSE for license details. -use super::storage_address::{ +use super::{ + storage_type::{ + validate_storage_address, + Storage, + }, StorageAddress, - Yes, }; + use crate::{ client::{ OfflineClientT, OnlineClientT, }, error::Error, - metadata::{ - DecodeWithMetadata, - Metadata, - }, - rpc::types::{ - StorageData, - StorageKey, - }, Config, }; use derivative::Derivative; -use frame_metadata::StorageEntryType; -use scale_info::form::PortableForm; use std::{ future::Future, marker::PhantomData, @@ -61,15 +55,7 @@ where &self, address: &Address, ) -> Result<(), Error> { - if let Some(hash) = address.validation_hash() { - validate_storage( - address.pallet_name(), - address.entry_name(), - hash, - &self.client.metadata(), - )?; - } - Ok(()) + validate_storage_address(address, &self.client.metadata()) } } @@ -78,339 +64,29 @@ where T: Config, Client: OnlineClientT, { - /// Fetch the raw encoded value at the address/key given. - pub fn fetch_raw<'a>( - &self, - key: &'a [u8], - hash: Option, - ) -> impl Future>, Error>> + 'a { - let client = self.client.clone(); - // Ensure that the returned future doesn't have a lifetime tied to api.storage(), - // which is a temporary thing we'll be throwing away quickly: - async move { - let data = client.rpc().storage(key, hash).await?; - Ok(data.map(|d| d.0)) - } - } - - /// Fetch a decoded value from storage at a given address and optional block hash. - /// - /// # Example - /// - /// ```no_run - /// use subxt::{ PolkadotConfig, OnlineClient }; - /// - /// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")] - /// pub mod polkadot {} - /// - /// # #[tokio::main] - /// # async fn main() { - /// let api = OnlineClient::::new().await.unwrap(); - /// - /// // Address to a storage entry we'd like to access. - /// let address = polkadot::storage().xcm_pallet().queries(&12345); - /// - /// // Fetch just the keys, returning up to 10 keys. - /// let value = api - /// .storage() - /// .fetch(&address, None) - /// .await - /// .unwrap(); - /// - /// println!("Value: {:?}", value); - /// # } - /// ``` - pub fn fetch<'a, Address>( - &self, - address: &'a Address, - hash: Option, - ) -> impl Future< - Output = Result::Target>, Error>, - > + 'a - where - Address: StorageAddress + 'a, - { - let client = self.clone(); - async move { - // Metadata validation checks whether the static address given - // is likely to actually correspond to a real storage entry or not. - // if not, it means static codegen doesn't line up with runtime - // metadata. - client.validate(address)?; - - // Look up the return type ID to enable DecodeWithMetadata: - let metadata = client.client.metadata(); - let lookup_bytes = super::utils::storage_address_bytes(address, &metadata)?; - if let Some(data) = client - .client - .storage() - .fetch_raw(&lookup_bytes, hash) - .await? - { - let val = ::decode_storage_with_metadata( - &mut &*data, - address.pallet_name(), - address.entry_name(), - &metadata, - )?; - Ok(Some(val)) - } else { - Ok(None) - } - } - } - - /// Fetch a StorageKey that has a default value with an optional block hash. - pub fn fetch_or_default<'a, Address>( + /// Obtain storage at some block hash. + pub fn at( &self, - address: &'a Address, - hash: Option, - ) -> impl Future::Target, Error>> - + 'a - where - Address: StorageAddress + 'a, - { + block_hash: Option, + ) -> impl Future, Error>> + Send + 'static { + // Clone and pass the client in like this so that we can explicitly + // return a Future that's Send + 'static, rather than tied to &self. let client = self.client.clone(); async move { - let pallet_name = address.pallet_name(); - let storage_name = address.entry_name(); - // Metadata validation happens via .fetch(): - if let Some(data) = client.storage().fetch(address, hash).await? { - Ok(data) - } else { - let metadata = client.metadata(); - - // We have to dig into metadata already, so no point using the optimised `decode_storage_with_metadata` call. - let pallet_metadata = metadata.pallet(pallet_name)?; - let storage_metadata = pallet_metadata.storage(storage_name)?; - let return_ty_id = - return_type_from_storage_entry_type(&storage_metadata.ty); - let bytes = &mut &storage_metadata.default[..]; - - let val = ::decode_with_metadata( - bytes, - return_ty_id, - &metadata, - )?; - Ok(val) - } - } - } - - /// Fetch up to `count` keys for a storage map in lexicographic order. - /// - /// Supports pagination by passing a value to `start_key`. - pub fn fetch_keys<'a>( - &self, - key: &'a [u8], - count: u32, - start_key: Option<&'a [u8]>, - hash: Option, - ) -> impl Future, Error>> + 'a { - let client = self.client.clone(); - async move { - let keys = client - .rpc() - .storage_keys_paged(key, count, start_key, hash) - .await?; - Ok(keys) - } - } - - /// Returns an iterator of key value pairs. - /// - /// ```no_run - /// use subxt::{ PolkadotConfig, OnlineClient }; - /// - /// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")] - /// pub mod polkadot {} - /// - /// # #[tokio::main] - /// # async fn main() { - /// let api = OnlineClient::::new().await.unwrap(); - /// - /// // Address to the root of a storage entry that we'd like to iterate over. - /// let address = polkadot::storage().xcm_pallet().version_notifiers_root(); - /// - /// // Iterate over keys and values at that address. - /// let mut iter = api - /// .storage() - /// .iter(address, 10, None) - /// .await - /// .unwrap(); - /// - /// while let Some((key, value)) = iter.next().await.unwrap() { - /// println!("Key: 0x{}", hex::encode(&key)); - /// println!("Value: {}", value); - /// } - /// # } - /// ``` - pub fn iter

( - &self, - address: Address, - page_size: u32, - hash: Option, - ) -> impl Future, Error>> + 'static - where - Address: StorageAddress + 'static, - { - let client = self.clone(); - async move { - // Metadata validation checks whether the static address given - // is likely to actually correspond to a real storage entry or not. - // if not, it means static codegen doesn't line up with runtime - // metadata. - client.validate(&address)?; - - // Fetch a concrete block hash to iterate over. We do this so that if new blocks - // are produced midway through iteration, we continue to iterate at the block - // we started with and not the new block. - let hash = if let Some(hash) = hash { - hash - } else { - client - .client - .rpc() - .block_hash(None) - .await? - .expect("didn't pass a block number; qed") - }; - - let metadata = client.client.metadata(); - - // Look up the return type for flexible decoding. Do this once here to avoid - // potentially doing it every iteration if we used `decode_storage_with_metadata` - // in the iterator. - let return_type_id = lookup_storage_return_type( - &metadata, - address.pallet_name(), - address.entry_name(), - )?; - - // The root pallet/entry bytes for this storage entry: - let address_root_bytes = super::utils::storage_address_root_bytes(&address); - - Ok(KeyIter { - client, - address_root_bytes, - metadata, - return_type_id, - block_hash: hash, - count: page_size, - start_key: None, - buffer: Default::default(), - _marker: std::marker::PhantomData, - }) - } - } -} - -/// Iterates over key value pairs in a map. -pub struct KeyIter { - client: StorageClient, - address_root_bytes: Vec, - return_type_id: u32, - metadata: Metadata, - count: u32, - block_hash: T::Hash, - start_key: Option, - buffer: Vec<(StorageKey, StorageData)>, - _marker: std::marker::PhantomData, -} - -impl<'a, T, Client, ReturnTy> KeyIter -where - T: Config, - Client: OnlineClientT, - ReturnTy: DecodeWithMetadata, -{ - /// Returns the next key value pair from a map. - pub async fn next( - &mut self, - ) -> Result, Error> { - loop { - if let Some((k, v)) = self.buffer.pop() { - let val = ReturnTy::decode_with_metadata( - &mut &v.0[..], - self.return_type_id, - &self.metadata, - )?; - return Ok(Some((k, val))) - } else { - let start_key = self.start_key.take(); - let keys = self - .client - .fetch_keys( - &self.address_root_bytes, - self.count, - start_key.as_ref().map(|k| &*k.0), - Some(self.block_hash), - ) - .await?; - - if keys.is_empty() { - return Ok(None) - } - - self.start_key = keys.last().cloned(); - - let change_sets = self - .client - .client - .rpc() - .query_storage_at(keys.iter().map(|k| &*k.0), Some(self.block_hash)) - .await?; - for change_set in change_sets { - for (k, v) in change_set.changes { - if let Some(v) = v { - self.buffer.push((k, v)); - } - } + // If block hash is not provided, get the hash + // for the latest block and use that. + let block_hash = match block_hash { + Some(hash) => hash, + None => { + client + .rpc() + .block_hash(None) + .await? + .expect("didn't pass a block number; qed") } - debug_assert_eq!(self.buffer.len(), keys.len()); - } - } - } -} + }; -/// Validate a storage entry against the metadata. -fn validate_storage( - pallet_name: &str, - storage_name: &str, - hash: [u8; 32], - metadata: &Metadata, -) -> Result<(), Error> { - let expected_hash = match metadata.storage_hash(pallet_name, storage_name) { - Ok(hash) => hash, - Err(e) => return Err(e.into()), - }; - match expected_hash == hash { - true => Ok(()), - false => { - Err(crate::error::MetadataError::IncompatibleStorageMetadata( - pallet_name.into(), - storage_name.into(), - ) - .into()) + Ok(Storage::new(client, block_hash)) } } } - -/// look up a return type ID for some storage entry. -fn lookup_storage_return_type( - metadata: &Metadata, - pallet: &str, - entry: &str, -) -> Result { - let storage_entry_type = &metadata.pallet(pallet)?.storage(entry)?.ty; - - Ok(return_type_from_storage_entry_type(storage_entry_type)) -} - -/// Fetch the return type out of a [`StorageEntryType`]. -fn return_type_from_storage_entry_type(entry: &StorageEntryType) -> u32 { - match entry { - StorageEntryType::Plain(ty) => ty.id(), - StorageEntryType::Map { value, .. } => value.id(), - } -} diff --git a/subxt/src/storage/storage_type.rs b/subxt/src/storage/storage_type.rs new file mode 100644 index 00000000000..f5c5e20c5c4 --- /dev/null +++ b/subxt/src/storage/storage_type.rs @@ -0,0 +1,404 @@ +// Copyright 2019-2022 Parity Technologies (UK) Ltd. +// This file is dual-licensed as Apache-2.0 or GPL-3.0. +// see LICENSE for license details. + +use super::storage_address::{ + StorageAddress, + Yes, +}; +use crate::{ + client::{ + OfflineClientT, + OnlineClientT, + }, + error::Error, + metadata::{ + DecodeWithMetadata, + Metadata, + }, + rpc::types::{ + StorageData, + StorageKey, + }, + Config, +}; +use derivative::Derivative; +use frame_metadata::StorageEntryType; +use scale_info::form::PortableForm; +use std::{ + future::Future, + marker::PhantomData, +}; + +/// Query the runtime storage. +#[derive(Derivative)] +#[derivative(Clone(bound = "Client: Clone"))] +pub struct Storage { + client: Client, + block_hash: T::Hash, + _marker: PhantomData, +} + +impl Storage { + /// Create a new [`Storage`] + pub(crate) fn new(client: Client, block_hash: T::Hash) -> Self { + Self { + client, + block_hash, + _marker: PhantomData, + } + } +} + +impl Storage +where + T: Config, + Client: OfflineClientT, +{ + /// Run the validation logic against some storage address you'd like to access. + /// + /// Method has the same meaning as [`StorageClient::validate`](super::storage_client::StorageClient::validate). + pub fn validate( + &self, + address: &Address, + ) -> Result<(), Error> { + validate_storage_address(address, &self.client.metadata()) + } +} + +impl Storage +where + T: Config, + Client: OnlineClientT, +{ + /// Fetch the raw encoded value at the address/key given. + pub fn fetch_raw<'a>( + &self, + key: &'a [u8], + ) -> impl Future>, Error>> + 'a { + let client = self.client.clone(); + let block_hash = self.block_hash; + // Ensure that the returned future doesn't have a lifetime tied to api.storage(), + // which is a temporary thing we'll be throwing away quickly: + async move { + let data = client.rpc().storage(key, Some(block_hash)).await?; + Ok(data.map(|d| d.0)) + } + } + + /// Fetch a decoded value from storage at a given address. + /// + /// # Example + /// + /// ```no_run + /// use subxt::{ PolkadotConfig, OnlineClient }; + /// + /// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")] + /// pub mod polkadot {} + /// + /// # #[tokio::main] + /// # async fn main() { + /// let api = OnlineClient::::new().await.unwrap(); + /// + /// // Address to a storage entry we'd like to access. + /// let address = polkadot::storage().xcm_pallet().queries(&12345); + /// + /// // Fetch just the keys, returning up to 10 keys. + /// let value = api + /// .storage() + /// .at(None) + /// .await + /// .unwrap() + /// .fetch(&address) + /// .await + /// .unwrap(); + /// + /// println!("Value: {:?}", value); + /// # } + /// ``` + pub fn fetch<'a, Address>( + &self, + address: &'a Address, + ) -> impl Future< + Output = Result::Target>, Error>, + > + 'a + where + Address: StorageAddress + 'a, + { + let client = self.clone(); + async move { + // Metadata validation checks whether the static address given + // is likely to actually correspond to a real storage entry or not. + // if not, it means static codegen doesn't line up with runtime + // metadata. + client.validate(address)?; + + // Look up the return type ID to enable DecodeWithMetadata: + let metadata = client.client.metadata(); + let lookup_bytes = super::utils::storage_address_bytes(address, &metadata)?; + if let Some(data) = client.fetch_raw(&lookup_bytes).await? { + let val = ::decode_storage_with_metadata( + &mut &*data, + address.pallet_name(), + address.entry_name(), + &metadata, + )?; + Ok(Some(val)) + } else { + Ok(None) + } + } + } + + /// Fetch a StorageKey that has a default value with an optional block hash. + pub fn fetch_or_default<'a, Address>( + &self, + address: &'a Address, + ) -> impl Future::Target, Error>> + + 'a + where + Address: StorageAddress + 'a, + { + let client = self.clone(); + async move { + let pallet_name = address.pallet_name(); + let storage_name = address.entry_name(); + // Metadata validation happens via .fetch(): + if let Some(data) = client.fetch(address).await? { + Ok(data) + } else { + let metadata = client.client.metadata(); + + // We have to dig into metadata already, so no point using the optimised `decode_storage_with_metadata` call. + let pallet_metadata = metadata.pallet(pallet_name)?; + let storage_metadata = pallet_metadata.storage(storage_name)?; + let return_ty_id = + return_type_from_storage_entry_type(&storage_metadata.ty); + let bytes = &mut &storage_metadata.default[..]; + + let val = ::decode_with_metadata( + bytes, + return_ty_id, + &metadata, + )?; + Ok(val) + } + } + } + + /// Fetch up to `count` keys for a storage map in lexicographic order. + /// + /// Supports pagination by passing a value to `start_key`. + pub fn fetch_keys<'a>( + &self, + key: &'a [u8], + count: u32, + start_key: Option<&'a [u8]>, + ) -> impl Future, Error>> + 'a { + let client = self.client.clone(); + let block_hash = self.block_hash; + async move { + let keys = client + .rpc() + .storage_keys_paged(key, count, start_key, Some(block_hash)) + .await?; + Ok(keys) + } + } + + /// Returns an iterator of key value pairs. + /// + /// ```no_run + /// use subxt::{ PolkadotConfig, OnlineClient }; + /// + /// #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")] + /// pub mod polkadot {} + /// + /// # #[tokio::main] + /// # async fn main() { + /// let api = OnlineClient::::new().await.unwrap(); + /// + /// // Address to the root of a storage entry that we'd like to iterate over. + /// let address = polkadot::storage().xcm_pallet().version_notifiers_root(); + /// + /// // Iterate over keys and values at that address. + /// let mut iter = api + /// .storage() + /// .at(None) + /// .await + /// .unwrap() + /// .iter(address, 10) + /// .await + /// .unwrap(); + /// + /// while let Some((key, value)) = iter.next().await.unwrap() { + /// println!("Key: 0x{}", hex::encode(&key)); + /// println!("Value: {}", value); + /// } + /// # } + /// ``` + pub fn iter
( + &self, + address: Address, + page_size: u32, + ) -> impl Future, Error>> + 'static + where + Address: StorageAddress + 'static, + { + let client = self.clone(); + let block_hash = self.block_hash; + async move { + // Metadata validation checks whether the static address given + // is likely to actually correspond to a real storage entry or not. + // if not, it means static codegen doesn't line up with runtime + // metadata. + client.validate(&address)?; + + let metadata = client.client.metadata(); + + // Look up the return type for flexible decoding. Do this once here to avoid + // potentially doing it every iteration if we used `decode_storage_with_metadata` + // in the iterator. + let return_type_id = lookup_storage_return_type( + &metadata, + address.pallet_name(), + address.entry_name(), + )?; + + // The root pallet/entry bytes for this storage entry: + let address_root_bytes = super::utils::storage_address_root_bytes(&address); + + Ok(KeyIter { + client, + address_root_bytes, + metadata, + return_type_id, + block_hash, + count: page_size, + start_key: None, + buffer: Default::default(), + _marker: std::marker::PhantomData, + }) + } + } +} + +/// Iterates over key value pairs in a map. +pub struct KeyIter { + client: Storage, + address_root_bytes: Vec, + return_type_id: u32, + metadata: Metadata, + count: u32, + block_hash: T::Hash, + start_key: Option, + buffer: Vec<(StorageKey, StorageData)>, + _marker: std::marker::PhantomData, +} + +impl<'a, T, Client, ReturnTy> KeyIter +where + T: Config, + Client: OnlineClientT, + ReturnTy: DecodeWithMetadata, +{ + /// Returns the next key value pair from a map. + pub async fn next( + &mut self, + ) -> Result, Error> { + loop { + if let Some((k, v)) = self.buffer.pop() { + let val = ReturnTy::decode_with_metadata( + &mut &v.0[..], + self.return_type_id, + &self.metadata, + )?; + return Ok(Some((k, val))) + } else { + let start_key = self.start_key.take(); + let keys = self + .client + .fetch_keys( + &self.address_root_bytes, + self.count, + start_key.as_ref().map(|k| &*k.0), + ) + .await?; + + if keys.is_empty() { + return Ok(None) + } + + self.start_key = keys.last().cloned(); + + let change_sets = self + .client + .client + .rpc() + .query_storage_at(keys.iter().map(|k| &*k.0), Some(self.block_hash)) + .await?; + for change_set in change_sets { + for (k, v) in change_set.changes { + if let Some(v) = v { + self.buffer.push((k, v)); + } + } + } + debug_assert_eq!(self.buffer.len(), keys.len()); + } + } + } +} + +/// Validate a storage address against the metadata. +pub(crate) fn validate_storage_address( + address: &Address, + metadata: &Metadata, +) -> Result<(), Error> { + if let Some(hash) = address.validation_hash() { + validate_storage(address.pallet_name(), address.entry_name(), hash, metadata)?; + } + Ok(()) +} + +/// Validate a storage entry against the metadata. +fn validate_storage( + pallet_name: &str, + storage_name: &str, + hash: [u8; 32], + metadata: &Metadata, +) -> Result<(), Error> { + let expected_hash = match metadata.storage_hash(pallet_name, storage_name) { + Ok(hash) => hash, + Err(e) => return Err(e.into()), + }; + match expected_hash == hash { + true => Ok(()), + false => { + Err(crate::error::MetadataError::IncompatibleStorageMetadata( + pallet_name.into(), + storage_name.into(), + ) + .into()) + } + } +} + +/// look up a return type ID for some storage entry. +fn lookup_storage_return_type( + metadata: &Metadata, + pallet: &str, + entry: &str, +) -> Result { + let storage_entry_type = &metadata.pallet(pallet)?.storage(entry)?.ty; + + Ok(return_type_from_storage_entry_type(storage_entry_type)) +} + +/// Fetch the return type out of a [`StorageEntryType`]. +fn return_type_from_storage_entry_type(entry: &StorageEntryType) -> u32 { + match entry { + StorageEntryType::Plain(ty) => ty.id(), + StorageEntryType::Map { value, .. } => value.id(), + } +} diff --git a/testing/integration-tests/src/client/mod.rs b/testing/integration-tests/src/client/mod.rs index f3323ac93db..297588d2e82 100644 --- a/testing/integration-tests/src/client/mod.rs +++ b/testing/integration-tests/src/client/mod.rs @@ -126,7 +126,10 @@ async fn fetch_keys() { let addr = node_runtime::storage().system().account_root(); let keys = api .storage() - .fetch_keys(&addr.to_root_bytes(), 4, None, None) + .at(None) + .await + .unwrap() + .fetch_keys(&addr.to_root_bytes(), 4, None) .await .unwrap(); assert_eq!(keys.len(), 4) @@ -138,7 +141,14 @@ async fn test_iter() { let api = ctx.client(); let addr = node_runtime::storage().system().account_root(); - let mut iter = api.storage().iter(addr, 10, None).await.unwrap(); + let mut iter = api + .storage() + .at(None) + .await + .unwrap() + .iter(addr, 10) + .await + .unwrap(); let mut i = 0; while iter.next().await.unwrap().is_some() { i += 1; diff --git a/testing/integration-tests/src/frame/balances.rs b/testing/integration-tests/src/frame/balances.rs index 65cd880808c..d6655346dcc 100644 --- a/testing/integration-tests/src/frame/balances.rs +++ b/testing/integration-tests/src/frame/balances.rs @@ -42,11 +42,15 @@ async fn tx_basic_transfer() -> Result<(), subxt::Error> { let alice_pre = api .storage() - .fetch_or_default(&alice_account_addr, None) + .at(None) + .await? + .fetch_or_default(&alice_account_addr) .await?; let bob_pre = api .storage() - .fetch_or_default(&bob_account_addr, None) + .at(None) + .await? + .fetch_or_default(&bob_account_addr) .await?; let tx = node_runtime::tx().balances().transfer(bob_address, 10_000); @@ -75,11 +79,15 @@ async fn tx_basic_transfer() -> Result<(), subxt::Error> { let alice_post = api .storage() - .fetch_or_default(&alice_account_addr, None) + .at(None) + .await? + .fetch_or_default(&alice_account_addr) .await?; let bob_post = api .storage() - .fetch_or_default(&bob_account_addr, None) + .at(None) + .await? + .fetch_or_default(&bob_account_addr) .await?; assert!(alice_pre.data.free - 10_000 >= alice_post.data.free); @@ -113,11 +121,15 @@ async fn tx_dynamic_transfer() -> Result<(), subxt::Error> { let alice_pre = api .storage() - .fetch_or_default(&alice_account_addr, None) + .at(None) + .await? + .fetch_or_default(&alice_account_addr) .await?; let bob_pre = api .storage() - .fetch_or_default(&bob_account_addr, None) + .at(None) + .await? + .fetch_or_default(&bob_account_addr) .await?; let tx = subxt::dynamic::tx( @@ -159,11 +171,15 @@ async fn tx_dynamic_transfer() -> Result<(), subxt::Error> { let alice_post = api .storage() - .fetch_or_default(&alice_account_addr, None) + .at(None) + .await? + .fetch_or_default(&alice_account_addr) .await?; let bob_post = api .storage() - .fetch_or_default(&bob_account_addr, None) + .at(None) + .await? + .fetch_or_default(&bob_account_addr) .await?; let alice_pre_free = alice_pre @@ -214,7 +230,9 @@ async fn multiple_transfers_work_nonce_incremented() -> Result<(), subxt::Error> let bob_pre = api .storage() - .fetch_or_default(&bob_account_addr, None) + .at(None) + .await? + .fetch_or_default(&bob_account_addr) .await?; let tx = node_runtime::tx() @@ -233,7 +251,9 @@ async fn multiple_transfers_work_nonce_incremented() -> Result<(), subxt::Error> let bob_post = api .storage() - .fetch_or_default(&bob_account_addr, None) + .at(None) + .await? + .fetch_or_default(&bob_account_addr) .await?; assert_eq!(bob_pre.data.free + 30_000, bob_post.data.free); @@ -246,7 +266,14 @@ async fn storage_total_issuance() { let api = ctx.client(); let addr = node_runtime::storage().balances().total_issuance(); - let total_issuance = api.storage().fetch_or_default(&addr, None).await.unwrap(); + let total_issuance = api + .storage() + .at(None) + .await + .unwrap() + .fetch_or_default(&addr) + .await + .unwrap(); assert_ne!(total_issuance, 0); } @@ -274,7 +301,12 @@ async fn storage_balance_lock() -> Result<(), subxt::Error> { let locks_addr = node_runtime::storage().balances().locks(bob); - let locks = api.storage().fetch_or_default(&locks_addr, None).await?; + let locks = api + .storage() + .at(None) + .await? + .fetch_or_default(&locks_addr) + .await?; assert_eq!( locks.0, diff --git a/testing/integration-tests/src/frame/contracts.rs b/testing/integration-tests/src/frame/contracts.rs index 84cf1b89538..0340c3882f4 100644 --- a/testing/integration-tests/src/frame/contracts.rs +++ b/testing/integration-tests/src/frame/contracts.rs @@ -222,13 +222,23 @@ async fn tx_call() { .contracts() .contract_info_of(&contract); - let contract_info = cxt.client().storage().fetch(&info_addr, None).await; + let contract_info = cxt + .client() + .storage() + .at(None) + .await + .unwrap() + .fetch(&info_addr) + .await; assert!(contract_info.is_ok()); let keys = cxt .client() .storage() - .fetch_keys(&info_addr.to_bytes(), 10, None, None) + .at(None) + .await + .unwrap() + .fetch_keys(&info_addr.to_bytes(), 10, None) .await .unwrap() .iter() diff --git a/testing/integration-tests/src/frame/staking.rs b/testing/integration-tests/src/frame/staking.rs index 16337d22854..be6adc20c21 100644 --- a/testing/integration-tests/src/frame/staking.rs +++ b/testing/integration-tests/src/frame/staking.rs @@ -150,7 +150,13 @@ async fn chill_works_for_controller_only() -> Result<(), Error> { .await?; let ledger_addr = node_runtime::storage().staking().ledger(alice.account_id()); - let ledger = api.storage().fetch(&ledger_addr, None).await?.unwrap(); + let ledger = api + .storage() + .at(None) + .await? + .fetch(&ledger_addr) + .await? + .unwrap(); assert_eq!(alice_stash.account_id(), &ledger.stash); let chill_tx = node_runtime::tx().staking().chill(); @@ -232,7 +238,9 @@ async fn storage_current_era() -> Result<(), Error> { let current_era_addr = node_runtime::storage().staking().current_era(); let _current_era = api .storage() - .fetch(¤t_era_addr, None) + .at(None) + .await? + .fetch(¤t_era_addr) .await? .expect("current era always exists"); Ok(()) @@ -243,7 +251,12 @@ async fn storage_era_reward_points() -> Result<(), Error> { let ctx = test_context().await; let api = ctx.client(); let reward_points_addr = node_runtime::storage().staking().eras_reward_points(0); - let current_era_result = api.storage().fetch(&reward_points_addr, None).await; + let current_era_result = api + .storage() + .at(None) + .await? + .fetch(&reward_points_addr) + .await; assert!(current_era_result.is_ok()); Ok(()) diff --git a/testing/integration-tests/src/frame/system.rs b/testing/integration-tests/src/frame/system.rs index e2e86105864..d5d9b5ac7d1 100644 --- a/testing/integration-tests/src/frame/system.rs +++ b/testing/integration-tests/src/frame/system.rs @@ -24,7 +24,9 @@ async fn storage_account() -> Result<(), subxt::Error> { let account_info = api .storage() - .fetch_or_default(&account_info_addr, None) + .at(None) + .await? + .fetch_or_default(&account_info_addr) .await; assert_matches!(account_info, Ok(_)); diff --git a/testing/integration-tests/src/frame/timestamp.rs b/testing/integration-tests/src/frame/timestamp.rs index 4db9942d2e7..a365ded117b 100644 --- a/testing/integration-tests/src/frame/timestamp.rs +++ b/testing/integration-tests/src/frame/timestamp.rs @@ -14,7 +14,10 @@ async fn storage_get_current_timestamp() { let timestamp = api .storage() - .fetch(&node_runtime::storage().timestamp().now(), None) + .at(None) + .await + .unwrap() + .fetch(&node_runtime::storage().timestamp().now()) .await; assert!(timestamp.is_ok()) diff --git a/testing/integration-tests/src/storage/mod.rs b/testing/integration-tests/src/storage/mod.rs index 458f8596a6c..684057986c9 100644 --- a/testing/integration-tests/src/storage/mod.rs +++ b/testing/integration-tests/src/storage/mod.rs @@ -21,7 +21,12 @@ async fn storage_plain_lookup() -> Result<(), subxt::Error> { wait_for_blocks(&api).await; let addr = node_runtime::storage().timestamp().now(); - let entry = api.storage().fetch_or_default(&addr, None).await?; + let entry = api + .storage() + .at(None) + .await? + .fetch_or_default(&addr) + .await?; assert!(entry > 0); Ok(()) @@ -45,7 +50,12 @@ async fn storage_map_lookup() -> Result<(), subxt::Error> { // Look up the nonce for the user (we expect it to be 1). let nonce_addr = node_runtime::storage().system().account(alice); - let entry = api.storage().fetch_or_default(&nonce_addr, None).await?; + let entry = api + .storage() + .at(None) + .await? + .fetch_or_default(&nonce_addr) + .await?; assert_eq!(entry.nonce, 1); Ok(()) @@ -113,7 +123,7 @@ async fn storage_n_map_storage_lookup() -> Result<(), subxt::Error> { // The actual test; look up this approval in storage: let addr = node_runtime::storage().assets().approvals(99, alice, bob); - let entry = api.storage().fetch(&addr, None).await?; + let entry = api.storage().at(None).await?.fetch(&addr).await?; assert_eq!(entry.map(|a| a.amount), Some(123)); Ok(()) } From 2a913a3aa99a07f7acaedbbaeed6925d34627303 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jan 2023 10:40:17 +0000 Subject: [PATCH 36/37] Bump which from 4.3.0 to 4.4.0 (#801) Bumps [which](https://github.com/harryfei/which-rs) from 4.3.0 to 4.4.0. - [Release notes](https://github.com/harryfei/which-rs/releases) - [Commits](https://github.com/harryfei/which-rs/compare/4.3.0...4.4.0) --- updated-dependencies: - dependency-name: which dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- testing/integration-tests/Cargo.toml | 2 +- testing/test-runtime/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66091ae8c99..36be459001d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4188,9 +4188,9 @@ dependencies = [ [[package]] name = "which" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" dependencies = [ "either", "libc", diff --git a/testing/integration-tests/Cargo.toml b/testing/integration-tests/Cargo.toml index ba378a39d20..66f24a20b98 100644 --- a/testing/integration-tests/Cargo.toml +++ b/testing/integration-tests/Cargo.toml @@ -34,4 +34,4 @@ tokio = { version = "1.8", features = ["macros", "time"] } tracing = "0.1.34" tracing-subscriber = "0.3.11" wabt = "0.10.0" -which = "4.0.2" +which = "4.4.0" diff --git a/testing/test-runtime/Cargo.toml b/testing/test-runtime/Cargo.toml index c00248003fe..278d0407df8 100644 --- a/testing/test-runtime/Cargo.toml +++ b/testing/test-runtime/Cargo.toml @@ -12,5 +12,5 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = [build-dependencies] subxt = { path = "../../subxt" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } -which = "4.2.2" +which = "4.4.0" jsonrpsee = { version = "0.16.0", features = ["async-client", "client-ws-transport"] } From d92352ad739836a4100e1ef1db607acc82ed8c5a Mon Sep 17 00:00:00 2001 From: James Wilson Date: Tue, 24 Jan 2023 16:55:27 +0000 Subject: [PATCH 37/37] Prep for releasing 0.26.0 (#802) * Prep for releasing 0.26.0 * link to new RPC spec --- CHANGELOG.md | 140 +++++++++++++++++++++++++++ Cargo.lock | 131 +++++++++++++++---------- cli/Cargo.toml | 6 +- codegen/Cargo.toml | 4 +- examples/Cargo.toml | 2 +- macro/Cargo.toml | 4 +- metadata/Cargo.toml | 2 +- subxt/Cargo.toml | 6 +- testing/integration-tests/Cargo.toml | 6 +- testing/test-runtime/Cargo.toml | 2 +- testing/ui-tests/Cargo.toml | 2 +- 11 files changed, 235 insertions(+), 70 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 314e8618664..2b034dc3f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,146 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.26.0] - 2022-01-24 + +This release adds a number of improvements, most notably: + +- We make Substrate dependencies optional ([#760](https://github.com/paritytech/subxt/pull/760)), which makes WASM builds both smaller and more reliable. To do this, we re-implement some core types like `AccountId32`, `MultiAddress` and `MultiSignature` internally. +- Allow access to storage entries ([#774](https://github.com/paritytech/subxt/pull/774)) and runtime API's ([#777](https://github.com/paritytech/subxt/pull/777)) from some block. This is part of a move towards a more "block centric" interface, which will better align with the newly available `chainHead` style RPC interface. +- Add RPC methods for the new `chainHead` style interface (see https://paritytech.github.io/json-rpc-interface-spec/). These are currently unstable, but will allow users to start experimenting with this new API if their nodes support it. +- More advanced type substitution is now possible in the codegen interface ([#735](https://github.com/paritytech/subxt/pull/735)). + +This release introduces a number of breaking changes that can be generally be fixed with mechanical tweaks to your code. The notable changes are described below. + +### Make Storage API more Block-centric + +See [#774](https://github.com/paritytech/subxt/pull/774). This PR makes the Storage API more consistent with the Events API, and allows access to it from a given block as part of a push to provide a more block centric API that will hopefully be easier to understand, and will align with the new RPC `chainHead` style RPC interface. + +Before, your code will look like: + +```rust +let a = api.storage().fetch(&staking_bonded, None).await?; +``` + +After, it should look like: + +```rust +let a = api.storage().at(None).await?.fetch(&staking_bonded).await?; +``` + +Essentially, the final parameter for choosing which block to call some method at has been moved out of the storage method itself and is now provided to instantiate the storage API, either explicitly via an `.at(optional_block_hash)` as above, or implicitly when calling `block.storage()` to access the same storage methods for some block. + +An alternate way to access the same storage (primarily used if you have subscribed to blocks or otherwise are working with some block) now is: + +```rust +let block = api.blocks().at(None).await? +let a = block.storage().fetch(&staking_bonded, None).await?; +``` + +### More advanced type substitution in codegen + +See [#735](https://github.com/paritytech/subxt/pull/735). Previously, you could perform basic type substitution like this: + +```rust +#[subxt::subxt(runtime_metadata_path = "../polkadot_metadata.scale")] +pub mod node_runtime { + #[subxt::subxt(substitute_type = "sp_arithmetic::per_things::Foo")] + use crate::Foo; +} +``` + +This example would use `crate::Foo` every time an `sp_arithmetic::per_things::Foo` was encountered in the codegen. However, this was limited; the substitute type had to have the name number and order of generic parameters for this to work. + +We've changed the interface above into: + +```rust +#[subxt::subxt( + runtime_metadata_path = "../polkadot_metadata.scale", + substitute_type( + type = "sp_arithmetic::per_things::Foo", + with = "crate::Foo" + ) +)] +pub mod node_runtime {} +``` + +In this example, we can (optionally) specify the generic parameters we expect to see on the original type ("type"), and then of those, decide which should be present on the substitute type ("with"). If no parameters are provided at all, we'll get the same behaviour as before. This allows much more flexibility when defining substitute types. + +### Optional Substrate dependencies + +See [#760](https://github.com/paritytech/subxt/pull/760). Subxt now has a "substrate-compat" feature (enabled by default, and disabled for WASM builds). At present, enabling this feature simply exposes the `PairSigner` (which was always available before), allowing transactions to be signed via Substrate signer logic (as before). When disabled, you (currently) must bring your own signer implementation, but in return we can avoid bringing in a substantial number of Substrate dependencies in the process. + +Regardless, this change also tidied up and moved various bits and pieces around to be consistent with this goal. To address some common moves, previously we'd have: + +```rust +use subxt::{ + ext::{ + sp_core::{ sr25519, Pair }, + sp_runtime::{ AccountId32, generic::Header }, + }, + tx::{ + Era, + PlainTip, + PolkadotExtrinsicParamsBuilder + } +}; +``` + +And now this would look more like: + +```rust +// `sp_core` and `sp_runtime` are no longer exposed via `ext`; add the crates yourself at matching versions to use: +use sp_core::{ + sr25519, + Pair, +}; +use subxt::{ + // You'll often want to use the "built-in" `AccountId32` now instead of the `sp_runtime` version: + utils::AccountId32, + // traits used in our `Config` trait are now provided directly in this module: + config::Header, + // Polkadot and Substrate specific Config types are now in the relevant Config section: + config::polkadot::{ + Era, + PlainTip, + PolkadotExtrinsicParamsBuilder + } +} +``` + +Additionally, the `type Hashing` in the `Config` trait is now called `Hasher`, to clarify what it is, and types returned directly from the RPC calls now all live in `crate::rpc::types`, rather than sometimes living in Substrate crates. + +Some other note worthy PRs that were merged since the last release: + +### Added + +- Add block-centric Storage API ([#774](https://github.com/paritytech/subxt/pull/774)) +- Add `chainHead` RPC methods ([#766](https://github.com/paritytech/subxt/pull/766)) +- Allow for remapping type parameters in type substitutions ([#735](https://github.com/paritytech/subxt/pull/735)) +- Add ability to set custom metadata etc on OnlineClient ([#794](https://github.com/paritytech/subxt/pull/794)) +- Add `Cargo.lock` for deterministic builds ([#795](https://github.com/paritytech/subxt/pull/795)) +- Add API to execute runtime calls ([#777](https://github.com/paritytech/subxt/pull/777)) +- Add bitvec-like generic support to the scale-bits type for use in codegen ([#718](https://github.com/paritytech/subxt/pull/718)) +- Add `--derive-for-type` to cli ([#708](https://github.com/paritytech/subxt/pull/708)) + +### Changed + +- rename subscribe_to_updates() to updater() ([#792](https://github.com/paritytech/subxt/pull/792)) +- Expose `Update` ([#791](https://github.com/paritytech/subxt/pull/791)) +- Expose version info in CLI tool with build-time obtained git hash ([#787](https://github.com/paritytech/subxt/pull/787)) +- Implement deserialize on AccountId32 ([#773](https://github.com/paritytech/subxt/pull/773)) +- Codegen: Preserve attrs and add #[allow(clippy::all)] ([#784](https://github.com/paritytech/subxt/pull/784)) +- make ChainBlockExtrinsic cloneable ([#778](https://github.com/paritytech/subxt/pull/778)) +- Make sp_core and sp_runtime dependencies optional, and bump to latest ([#760](https://github.com/paritytech/subxt/pull/760)) +- Make verbose rpc error display ([#758](https://github.com/paritytech/subxt/pull/758)) +- rpc: Expose the `subscription ID` for `RpcClientT` ([#733](https://github.com/paritytech/subxt/pull/733)) +- events: Fetch metadata at arbitrary blocks ([#727](https://github.com/paritytech/subxt/pull/727)) + +### Fixed + +- Fix decoding events via `.as_root_event()` and add test ([#767](https://github.com/paritytech/subxt/pull/767)) +- Retain Rust code items from `mod` decorated with `subxt` attribute ([#721](https://github.com/paritytech/subxt/pull/721)) + ## [0.25.0] - 2022-11-16 This release resolves the `parity-util-mem crate` several version guard by updating substrate related dependencies which makes diff --git a/Cargo.lock b/Cargo.lock index 36be459001d..2ede39707ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,7 +27,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.27.0", + "gimli 0.27.1", ] [[package]] @@ -128,9 +128,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.61" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282" +checksum = "eff18d764974428cf3a9328e23fc5c986f5fbed46e6cd4cdf42544df5d297ec1" dependencies = [ "proc-macro2", "quote", @@ -165,7 +165,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object 0.30.2", + "object 0.30.3", "rustc-demangle", ] @@ -372,9 +372,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.1" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2" +checksum = "d8d93d855ce6a0aa87b8473ef9169482f40abaa2e9e0993024c35c902cbd5920" dependencies = [ "bitflags", "clap_derive", @@ -667,9 +667,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" +checksum = "b61a7545f753a88bcbe0a70de1fcc0221e10bfc752f576754fa91e663db1622e" dependencies = [ "cc", "cxxbridge-flags", @@ -679,9 +679,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70" +checksum = "f464457d494b5ed6905c63b0c4704842aba319084a0a3561cdc1359536b53200" dependencies = [ "cc", "codespan-reporting", @@ -694,15 +694,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" +checksum = "43c7119ce3a3701ed81aca8410b9acf6fc399d2629d057b87e2efa4e63a3aaea" [[package]] name = "cxxbridge-macro" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" +checksum = "65e07508b90551e610910fa648a1878991d367064997a596135b86df30daf07e" dependencies = [ "proc-macro2", "quote", @@ -1145,9 +1145,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" +checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec" [[package]] name = "glob" @@ -1163,9 +1163,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "gloo-net" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9050ff8617e950288d7bf7f300707639fdeda5ca0d0ecf380cff448cfd52f4a6" +checksum = "9902a044653b26b99f7e3693a42f171312d9be8b26b5697bd1e43ad1f8a35e10" dependencies = [ "futures-channel", "futures-core", @@ -1183,9 +1183,9 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ "futures-channel", "futures-core", @@ -1495,7 +1495,7 @@ dependencies = [ [[package]] name = "integration-tests" -version = "0.25.0" +version = "0.26.0" dependencies = [ "assert_matches", "frame-metadata", @@ -1542,7 +1542,7 @@ checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" dependencies = [ "hermit-abi 0.2.6", "io-lifetimes 1.0.4", - "rustix 0.36.6", + "rustix 0.36.7", "windows-sys 0.42.0", ] @@ -1885,6 +1885,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1971,9 +1980,9 @@ dependencies = [ [[package]] name = "object" -version = "0.30.2" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8c786513eb403643f2a88c244c2aaa270ef2153f55094587d0c48a3cf22a83" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "memchr", ] @@ -2037,9 +2046,9 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] name = "parity-scale-codec" -version = "3.2.1" +version = "3.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366e44391a8af4cfd6002ef6ba072bae071a96aafca98d7d448a34c5dca38b6a" +checksum = "e7ab01d0f889e957861bc65888d5ccbe82c158d0270136ba46820d43837cdf72" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -2052,9 +2061,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" +checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2214,13 +2223,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -2363,9 +2371,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2477,9 +2485,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.6" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" dependencies = [ "bitflags", "errno", @@ -2687,9 +2695,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "645926f31b250a2dca3c232496c2d898d91036e45ca0e97e0e2390c54e11be36" dependencies = [ "bitflags", "core-foundation", @@ -2700,9 +2708,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ "core-foundation-sys", "libc", @@ -3248,9 +3256,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "ss58-registry" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d44528162f980c0e03c71e005d334332c8da0aec9f2b0b4bdc557ed4a9f24776" +checksum = "e40c020d72bc0a9c5660bb71e4a6fdef081493583062c474740a7d59f55f0e7b" dependencies = [ "Inflector", "num-format", @@ -3322,7 +3330,7 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "subxt" -version = "0.25.0" +version = "0.26.0" dependencies = [ "base58", "bitvec", @@ -3357,9 +3365,9 @@ dependencies = [ [[package]] name = "subxt-cli" -version = "0.25.0" +version = "0.26.0" dependencies = [ - "clap 4.1.1", + "clap 4.1.3", "color-eyre", "frame-metadata", "hex", @@ -3375,7 +3383,7 @@ dependencies = [ [[package]] name = "subxt-codegen" -version = "0.25.0" +version = "0.26.0" dependencies = [ "bitvec", "darling", @@ -3396,7 +3404,7 @@ dependencies = [ [[package]] name = "subxt-examples" -version = "0.25.0" +version = "0.26.0" dependencies = [ "futures", "hex", @@ -3411,7 +3419,7 @@ dependencies = [ [[package]] name = "subxt-macro" -version = "0.25.0" +version = "0.26.0" dependencies = [ "darling", "proc-macro-error", @@ -3421,7 +3429,7 @@ dependencies = [ [[package]] name = "subxt-metadata" -version = "0.25.0" +version = "0.26.0" dependencies = [ "bitvec", "criterion", @@ -3477,7 +3485,7 @@ dependencies = [ [[package]] name = "test-runtime" -version = "0.25.0" +version = "0.26.0" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -3623,13 +3631,30 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" + +[[package]] +name = "toml_edit" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "729bfd096e40da9c001f778f5cdecbd2957929a24e10e5883d9392220a751581" +dependencies = [ + "indexmap", + "nom8", + "toml_datetime", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -3799,7 +3824,7 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ui-tests" -version = "0.25.0" +version = "0.26.0" dependencies = [ "frame-metadata", "parity-scale-codec", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index ea0fa5ce570..e2fcea8633a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subxt-cli" -version = "0.25.0" +version = "0.26.0" authors = ["Parity Technologies "] edition = "2021" publish = true @@ -17,9 +17,9 @@ path = "src/main.rs" [dependencies] # perform subxt codegen -subxt-codegen = { version = "0.25.0", path = "../codegen" } +subxt-codegen = { version = "0.26.0", path = "../codegen" } # perform node compatibility -subxt-metadata = { version = "0.25.0", path = "../metadata" } +subxt-metadata = { version = "0.26.0", path = "../metadata" } # parse command line args clap = { version = "4.0.8", features = ["derive", "cargo"] } # colourful error reports diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 662e7b48cb8..685430d5215 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subxt-codegen" -version = "0.25.0" +version = "0.26.0" authors = ["Parity Technologies "] edition = "2021" publish = true @@ -21,7 +21,7 @@ proc-macro-error = "1.0.4" quote = "1.0.8" syn = "1.0.58" scale-info = "2.0.0" -subxt-metadata = { version = "0.25.0", path = "../metadata" } +subxt-metadata = { version = "0.26.0", path = "../metadata" } jsonrpsee = { version = "0.16.0", features = ["async-client", "client-ws-transport", "http-client"] } hex = "0.4.3" tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] } diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 31da6f146bc..a4e2d82540e 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subxt-examples" -version = "0.25.0" +version = "0.26.0" authors = ["Parity Technologies "] edition = "2021" publish = false diff --git a/macro/Cargo.toml b/macro/Cargo.toml index 098503efcfc..e9afcab0e74 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subxt-macro" -version = "0.25.0" +version = "0.26.0" authors = ["Parity Technologies "] edition = "2021" publish = true @@ -20,4 +20,4 @@ darling = "0.14.0" proc-macro-error = "1.0.4" syn = "1.0.58" -subxt-codegen = { path = "../codegen", version = "0.25.0" } +subxt-codegen = { path = "../codegen", version = "0.26.0" } diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index 7d24cf87a3c..9f77f1046b3 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subxt-metadata" -version = "0.25.0" +version = "0.26.0" authors = ["Parity Technologies "] edition = "2021" publish = true diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index 03fcf8d5cf9..5c9321cad5c 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subxt" -version = "0.25.0" +version = "0.26.0" authors = ["Parity Technologies "] edition = "2021" publish = true @@ -50,8 +50,8 @@ parking_lot = "0.12.0" frame-metadata = "15.0.0" derivative = "2.2.0" -subxt-macro = { version = "0.25.0", path = "../macro" } -subxt-metadata = { version = "0.25.0", path = "../metadata" } +subxt-macro = { version = "0.26.0", path = "../macro" } +subxt-metadata = { version = "0.26.0", path = "../metadata" } # Provides some deserialization, types like U256/H256 and hashing impls like twox/blake256: impl-serde = { version = "0.4.0" } diff --git a/testing/integration-tests/Cargo.toml b/testing/integration-tests/Cargo.toml index 66f24a20b98..78762700aa5 100644 --- a/testing/integration-tests/Cargo.toml +++ b/testing/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "integration-tests" -version = "0.25.0" +version = "0.26.0" authors = ["Parity Technologies "] edition = "2021" publish = false @@ -27,8 +27,8 @@ sp-core = { version = "11.0.0", default-features = false } sp-keyring = "12.0.0" sp-runtime = "12.0.0" syn = "1.0.0" -subxt = { version = "0.25.0", path = "../../subxt" } -subxt-codegen = { version = "0.25.0", path = "../../codegen" } +subxt = { version = "0.26.0", path = "../../subxt" } +subxt-codegen = { version = "0.26.0", path = "../../codegen" } test-runtime = { path = "../test-runtime" } tokio = { version = "1.8", features = ["macros", "time"] } tracing = "0.1.34" diff --git a/testing/test-runtime/Cargo.toml b/testing/test-runtime/Cargo.toml index 278d0407df8..dc03300a9f4 100644 --- a/testing/test-runtime/Cargo.toml +++ b/testing/test-runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test-runtime" -version = "0.25.0" +version = "0.26.0" edition = "2021" publish = false diff --git a/testing/ui-tests/Cargo.toml b/testing/ui-tests/Cargo.toml index 01a9e548991..4ade0a04c43 100644 --- a/testing/ui-tests/Cargo.toml +++ b/testing/ui-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ui-tests" -version = "0.25.0" +version = "0.26.0" edition = "2021" publish = false