mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-22 02:08:00 +00:00
deps: remove polkadot-sdk umbrella crate (#1926)
* deps: get rid of polkadot-sdk umbrella crate * fix nits * Update subxt/src/backend/mod.rs * Update subxt/src/events/events_client.rs * Update metadata/src/utils/validation.rs * cargo clippy fix * fix ui tests
This commit is contained in:
Generated
+170
-5722
File diff suppressed because it is too large
Load Diff
+9
-1
@@ -140,7 +140,15 @@ web-time = { version = "1.1", default-features = false }
|
||||
tokio-util = "0.7.12"
|
||||
|
||||
# Substrate crates:
|
||||
polkadot-sdk = { version = "0.7", default-features = false }
|
||||
sc-executor = { version = "0.41.0", default-features = false }
|
||||
sc-executor-common = { version = "0.36.0", default-features = false }
|
||||
sp-crypto-hashing = { version = "0.1.0", default-features = false }
|
||||
sp-core = { version = "35.0.0", default-features = false }
|
||||
sp-keyring = { version = "40.0.0", default-features = false }
|
||||
sp-maybe-compressed-blob = { version = "11.0.0", default-features = false }
|
||||
sp-io = { version = "39.0.0", default-features = false }
|
||||
sp-state-machine = { version = "0.44.0", default-features = false }
|
||||
sp-runtime = { version = "40.0.1", default-features = false }
|
||||
|
||||
# Subxt workspace crates:
|
||||
subxt = { version = "0.39.0", path = "subxt", default-features = false }
|
||||
|
||||
+4
-3
@@ -27,6 +27,7 @@ std = [
|
||||
"tracing/std",
|
||||
"impl-serde/std",
|
||||
"primitive-types/std",
|
||||
"sp-crypto-hashing/std",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
@@ -44,11 +45,10 @@ hex = { workspace = true }
|
||||
serde = { workspace = true, default-features = false, features = ["derive"] }
|
||||
serde_json = { workspace = true, default-features = false, features = ["raw_value", "alloc"] }
|
||||
tracing = { workspace = true, default-features = false }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-crypto-hashing"] }
|
||||
sp-crypto-hashing = { workspace = true }
|
||||
hashbrown = { workspace = true }
|
||||
thiserror = { workspace = true, default-features = false }
|
||||
|
||||
|
||||
# For ss58 encoding AccountId32 to serialize them properly:
|
||||
base58 = { workspace = true }
|
||||
blake2 = { workspace = true }
|
||||
@@ -66,7 +66,8 @@ bitvec = { workspace = true }
|
||||
codec = { workspace = true, features = ["derive", "bit-vec"] }
|
||||
subxt-macro = { workspace = true }
|
||||
subxt-signer = { workspace = true, features = ["sr25519", "subxt"] }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-crypto-hashing", "sp-core", "sp-keyring"] }
|
||||
sp-core = { workspace = true }
|
||||
sp-keyring = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
//! Substrate specific configuration
|
||||
|
||||
use super::{Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, Hasher, Header};
|
||||
pub use crate::utils::{AccountId32, MultiAddress, MultiSignature};
|
||||
use alloc::format;
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Decode, Encode};
|
||||
use polkadot_sdk::sp_crypto_hashing;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use crate::utils::{AccountId32, MultiAddress, MultiSignature};
|
||||
pub use primitive_types::{H256, U256};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Default set of commonly used types by Substrate runtimes.
|
||||
// Note: We only use this at the type level, so it should be impossible to
|
||||
|
||||
+2
-4
@@ -181,10 +181,8 @@ impl<T: Config> Events<T> {
|
||||
/// them, and return only those which should decode to the provided `Ev` type.
|
||||
/// If an error occurs, all subsequent iterations return `None`.
|
||||
pub fn find<Ev: StaticEvent>(&self) -> impl Iterator<Item = Result<Ev, Error>> + '_ {
|
||||
self.iter().filter_map(|ev| {
|
||||
ev.and_then(|ev| ev.as_event::<Ev>().map_err(Into::into))
|
||||
.transpose()
|
||||
})
|
||||
self.iter()
|
||||
.filter_map(|ev| ev.and_then(|ev| ev.as_event::<Ev>()).transpose())
|
||||
}
|
||||
|
||||
/// Iterate through the events using metadata to dynamically decode and skip
|
||||
|
||||
@@ -11,7 +11,6 @@ use crate::error::{Error, MetadataError};
|
||||
use crate::metadata::Metadata;
|
||||
use alloc::borrow::ToOwned;
|
||||
use alloc::vec::Vec;
|
||||
use polkadot_sdk::sp_crypto_hashing;
|
||||
use subxt_metadata::{PalletMetadata, StorageEntryMetadata, StorageHasher};
|
||||
|
||||
/// Return the root of a given [`Address`]: hash the pallet name and entry name
|
||||
|
||||
+1
-1
@@ -65,8 +65,8 @@ use alloc::borrow::{Cow, ToOwned};
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Compact, Encode};
|
||||
use payload::Payload;
|
||||
use polkadot_sdk::sp_crypto_hashing::blake2_256;
|
||||
use signer::Signer as SignerT;
|
||||
use sp_crypto_hashing::blake2_256;
|
||||
|
||||
// Expose these here since we expect them in some calls below.
|
||||
pub use crate::client::{ClientState, RuntimeVersion};
|
||||
|
||||
@@ -163,8 +163,8 @@ impl core::str::FromStr for AccountId32 {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use polkadot_sdk::sp_core::{self, crypto::Ss58Codec};
|
||||
use polkadot_sdk::sp_keyring::AccountKeyring;
|
||||
use sp_core::{self, crypto::Ss58Codec};
|
||||
use sp_keyring::AccountKeyring;
|
||||
|
||||
#[test]
|
||||
fn ss58_is_compatible_with_substrate_impl() {
|
||||
|
||||
@@ -57,7 +57,7 @@ impl AccountId20 {
|
||||
|
||||
for (i, ch) in hex_address.chars().enumerate() {
|
||||
// Get the corresponding nibble from the hash
|
||||
let nibble = hash[i / 2] >> (if i % 2 == 0 { 4 } else { 0 }) & 0xf;
|
||||
let nibble = (hash[i / 2] >> (if i % 2 == 0 { 4 } else { 0 })) & 0xf;
|
||||
|
||||
if nibble >= 8 {
|
||||
checksum_address.push(ch.to_ascii_uppercase());
|
||||
|
||||
+6
-2
@@ -15,7 +15,7 @@ description = "Generate types and helpers for interacting with Substrate runtime
|
||||
|
||||
[features]
|
||||
web = ["subxt-codegen/web"]
|
||||
runtime-metadata-path = ["polkadot-sdk"]
|
||||
runtime-metadata-path = ["sc-executor", "sc-executor-common", "sp-maybe-compressed-blob", "sp-io", "sp-state-machine"]
|
||||
runtime-metadata-insecure-url = ["subxt-utils-fetchmetadata/url"]
|
||||
|
||||
[lib]
|
||||
@@ -30,7 +30,11 @@ quote = { workspace = true }
|
||||
subxt-codegen = { workspace = true }
|
||||
subxt-utils-fetchmetadata = { workspace = true }
|
||||
scale-typegen = { workspace = true }
|
||||
polkadot-sdk = { workspace = true, optional = true, features = ["sp-io", "sc-executor-common", "sp-state-machine", "sp-maybe-compressed-blob", "sc-executor"] }
|
||||
sc-executor = { workspace = true, optional = true }
|
||||
sc-executor-common = { workspace = true, optional = true }
|
||||
sp-maybe-compressed-blob = { workspace = true, optional = true }
|
||||
sp-io = { workspace = true, optional = true }
|
||||
sp-state-machine = { workspace = true, optional = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -5,13 +5,9 @@
|
||||
use std::{borrow::Cow, path::Path};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use polkadot_sdk::{
|
||||
sc_executor::{self, WasmExecutionMethod, WasmExecutor},
|
||||
sc_executor_common::runtime_blob::RuntimeBlob,
|
||||
sp_io,
|
||||
sp_maybe_compressed_blob::{self, CODE_BLOB_BOMB_LIMIT},
|
||||
sp_state_machine,
|
||||
};
|
||||
use sc_executor::{WasmExecutionMethod, WasmExecutor};
|
||||
use sc_executor_common::runtime_blob::RuntimeBlob;
|
||||
use sp_maybe_compressed_blob::{self, CODE_BLOB_BOMB_LIMIT};
|
||||
use subxt_codegen::{CodegenError, Metadata};
|
||||
|
||||
static SUPPORTED_METADATA_VERSIONS: [u32; 2] = [14, 15];
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ scale-info = { workspace = true, default-features = false }
|
||||
frame-decode = { workspace = true }
|
||||
frame-metadata = { workspace = true, default-features = false, features = ["current", "decode"] }
|
||||
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive"] }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-crypto-hashing"] }
|
||||
sp-crypto-hashing = { workspace = true }
|
||||
hashbrown = { workspace = true }
|
||||
thiserror = { workspace = true, default-features = false }
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ use crate::{
|
||||
use alloc::vec::Vec;
|
||||
use hashbrown::HashMap;
|
||||
use outer_enum_hashes::OuterEnumHashes;
|
||||
use polkadot_sdk::sp_crypto_hashing;
|
||||
use scale_info::{form::PortableForm, Field, PortableRegistry, TypeDef, TypeDefVariant, Variant};
|
||||
|
||||
pub mod outer_enum_hashes;
|
||||
|
||||
@@ -69,10 +69,7 @@ impl<T: RpcConfig> LegacyRpcMethods<T> {
|
||||
) -> Result<Vec<StorageChangeSet<T::Hash>>, Error> {
|
||||
let keys: Vec<String> = keys.into_iter().map(to_hex).collect();
|
||||
let params = rpc_params![keys, from, to];
|
||||
self.client
|
||||
.request("state_queryStorage", params)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
self.client.request("state_queryStorage", params).await
|
||||
}
|
||||
|
||||
/// Query storage entries at some block, using the best block if none is given.
|
||||
@@ -85,10 +82,7 @@ impl<T: RpcConfig> LegacyRpcMethods<T> {
|
||||
) -> Result<Vec<StorageChangeSet<T::Hash>>, Error> {
|
||||
let keys: Vec<String> = keys.into_iter().map(to_hex).collect();
|
||||
let params = rpc_params![keys, at];
|
||||
self.client
|
||||
.request("state_queryStorageAt", params)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
self.client.request("state_queryStorageAt", params).await
|
||||
}
|
||||
|
||||
/// Fetch the genesis hash
|
||||
|
||||
+3
-2
@@ -59,7 +59,7 @@ cfg-if = { workspace = true }
|
||||
codec = { package = "parity-scale-codec", workspace = true, features = [
|
||||
"derive",
|
||||
] }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-crypto-hashing"] }
|
||||
sp-crypto-hashing = { workspace = true }
|
||||
pbkdf2 = { workspace = true }
|
||||
sha2 = { workspace = true }
|
||||
hmac = { workspace = true }
|
||||
@@ -87,7 +87,8 @@ getrandom = { workspace = true, optional = true }
|
||||
[dev-dependencies]
|
||||
proptest = { workspace = true }
|
||||
hex-literal = { workspace = true }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-core", "sp-keyring"] }
|
||||
sp-core = { workspace = true }
|
||||
sp-keyring = { workspace = true }
|
||||
|
||||
[package.metadata.cargo-machete]
|
||||
ignored = ["getrandom"]
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use polkadot_sdk::sp_crypto_hashing;
|
||||
|
||||
// This code is taken from sp_core::crypto::DeriveJunction. The logic should be identical,
|
||||
// though the API is tweaked a touch.
|
||||
|
||||
+1
-2
@@ -8,7 +8,6 @@ use codec::Encode;
|
||||
use crate::crypto::{seed_from_entropy, DeriveJunction, SecretUri};
|
||||
use core::str::FromStr;
|
||||
use hex::FromHex;
|
||||
use polkadot_sdk::sp_crypto_hashing;
|
||||
use secp256k1::{ecdsa::RecoverableSignature, Message, Secp256k1, SecretKey};
|
||||
use secrecy::ExposeSecret;
|
||||
|
||||
@@ -362,7 +361,7 @@ mod test {
|
||||
|
||||
use super::*;
|
||||
|
||||
use polkadot_sdk::sp_core::{self, crypto::Pair as _, ecdsa::Pair as SpPair};
|
||||
use sp_core::{self, crypto::Pair as _, ecdsa::Pair as SpPair};
|
||||
|
||||
#[test]
|
||||
fn check_from_phrase_matches() {
|
||||
|
||||
@@ -354,8 +354,7 @@ mod test {
|
||||
|
||||
use super::*;
|
||||
|
||||
use polkadot_sdk::sp_core::{self, crypto::Pair as _, sr25519::Pair as SpPair};
|
||||
use polkadot_sdk::sp_keyring;
|
||||
use sp_core::{self, crypto::Pair as _, sr25519::Pair as SpPair};
|
||||
|
||||
#[test]
|
||||
fn check_from_phrase_matches() {
|
||||
|
||||
+5
-3
@@ -29,7 +29,7 @@ native = [
|
||||
"subxt-rpcs/native",
|
||||
"tokio-util",
|
||||
"tokio?/sync",
|
||||
"polkadot-sdk/std",
|
||||
"sp-crypto-hashing/std",
|
||||
]
|
||||
|
||||
# Enable this for web/wasm builds.
|
||||
@@ -86,7 +86,7 @@ futures = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true, features = ["default", "raw_value"] }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-crypto-hashing"] }
|
||||
sp-crypto-hashing = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
frame-metadata = { workspace = true }
|
||||
@@ -123,7 +123,9 @@ bitvec = { workspace = true }
|
||||
codec = { workspace = true, features = ["derive", "bit-vec"] }
|
||||
scale-info = { workspace = true, features = ["bit-vec"] }
|
||||
tokio = { workspace = true, features = ["macros", "time", "rt-multi-thread", "sync"] }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-core", "sp-keyring", "sp-runtime", "std"] }
|
||||
sp-core = { workspace = true, features = ["std"] }
|
||||
sp-keyring = { workspace = true, features = ["std"] }
|
||||
sp-runtime = { workspace = true, features = ["std"] }
|
||||
assert_matches = { workspace = true }
|
||||
subxt-signer = { path = "../signer", features = ["unstable-eth"] }
|
||||
subxt-rpcs = { workspace = true, features = ["subxt", "mock-rpc-client"] }
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#![allow(missing_docs, unused)]
|
||||
|
||||
use polkadot_sdk::sp_core::{sr25519, Pair as _};
|
||||
use sp_core::{sr25519, Pair as _};
|
||||
use subxt::config::substrate::MultiAddress;
|
||||
use subxt::{Config, OnlineClient, PolkadotConfig};
|
||||
|
||||
@@ -17,7 +17,7 @@ pub mod polkadot {}
|
||||
/// and that PolkadotConfig is the runtime configuration.
|
||||
mod pair_signer {
|
||||
use super::*;
|
||||
use polkadot_sdk::sp_runtime::{
|
||||
use sp_runtime::{
|
||||
traits::{IdentifyAccount, Verify},
|
||||
MultiSignature as SpMultiSignature,
|
||||
};
|
||||
@@ -26,7 +26,7 @@ mod pair_signer {
|
||||
tx::Signer,
|
||||
};
|
||||
|
||||
/// A [`Signer`] implementation for [`polkadot_sdk::sp_core::sr25519::Pair`].
|
||||
/// A [`Signer`] implementation for [`sp_core::sr25519::Pair`].
|
||||
#[derive(Clone)]
|
||||
pub struct PairSigner {
|
||||
account_id: <PolkadotConfig as Config>::AccountId,
|
||||
|
||||
@@ -382,7 +382,6 @@ mod test {
|
||||
use crate::backend::StorageResponse;
|
||||
use core::convert::Infallible;
|
||||
use futures::StreamExt;
|
||||
use polkadot_sdk::sp_core;
|
||||
use primitive_types::H256;
|
||||
use rpc::RpcClientT;
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
use crate::backend::{Backend, BackendExt, BlockRef};
|
||||
use crate::{client::OnlineClientT, error::Error, events::Events, Config};
|
||||
use derive_where::derive_where;
|
||||
use polkadot_sdk::sp_crypto_hashing;
|
||||
use std::future::Future;
|
||||
|
||||
/// A client for working with events.
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ pub mod ext {
|
||||
/// runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale",
|
||||
/// substitute_type(
|
||||
/// path = "sp_runtime::multiaddress::MultiAddress<A, B>",
|
||||
/// with = "::subxt::utils::Static<polkadot_sdk::sp_runtime::MultiAddress<A, B>>"
|
||||
/// with = "::subxt::utils::Static<sp_runtime::MultiAddress<A, B>>"
|
||||
/// )
|
||||
/// )]
|
||||
/// mod polkadot {}
|
||||
|
||||
@@ -12,7 +12,6 @@ use crate::{
|
||||
use codec::Decode;
|
||||
use derive_where::derive_where;
|
||||
use futures::StreamExt;
|
||||
use polkadot_sdk::sp_crypto_hashing;
|
||||
use std::{future::Future, marker::PhantomData};
|
||||
use subxt_core::storage::address::{Address, StorageHashers, StorageKey};
|
||||
use subxt_core::utils::Yes;
|
||||
|
||||
@@ -635,8 +635,8 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn transaction_validity_decoding_is_ok() {
|
||||
use polkadot_sdk::sp_runtime::transaction_validity as sp;
|
||||
use polkadot_sdk::sp_runtime::transaction_validity::TransactionValidity as T;
|
||||
use sp_runtime::transaction_validity as sp;
|
||||
use sp_runtime::transaction_validity::TransactionValidity as T;
|
||||
|
||||
let pairs = vec![
|
||||
(
|
||||
|
||||
@@ -34,7 +34,7 @@ hex = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
scale-info = { workspace = true, features = ["bit-vec"] }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-core", "std"] }
|
||||
sp-core = { workspace = true, features = ["std"] }
|
||||
syn = { workspace = true }
|
||||
subxt = { workspace = true, features = ["unstable-metadata", "native", "jsonrpsee", "reconnecting-rpc-client"] }
|
||||
subxt-signer = { workspace = true, features = ["default"] }
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{node_runtime, subxt_test, test_context, utils::wait_for_blocks};
|
||||
use polkadot_sdk::sp_core;
|
||||
|
||||
#[cfg(fullclient)]
|
||||
use subxt::utils::AccountId32;
|
||||
|
||||
@@ -55,8 +55,7 @@ error: Type `Event` does not exist at path `sp_runtime::multiaddress::Event`
|
||||
2 | | runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
3 | | substitute_type(
|
||||
4 | | path = "sp_runtime::multiaddress::Event",
|
||||
5 | | with = "crate::MyEvent"
|
||||
6 | | )
|
||||
... |
|
||||
7 | | )]
|
||||
| |__^
|
||||
|
|
||||
|
||||
@@ -7,8 +7,7 @@ error: Type `DispatchInfo` does not exist at path `frame_support::dispatch::Disp
|
||||
2 | | runtime_metadata_path = "../../../../artifacts/polkadot_metadata_small.scale",
|
||||
3 | | substitute_type(
|
||||
4 | | path = "frame_support::dispatch::DispatchInfo",
|
||||
5 | | with = "my_mod::DispatchInfo"
|
||||
6 | | )
|
||||
... |
|
||||
7 | | )]
|
||||
| |__^
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user