mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
deps: use polkadot-sdk umbrella crate (#1786)
* deps: unify usage of polkadot-sdk crates * cargo fmt * fix macro crate * make tests compile * fix more nits * fix doc tests * fix more nits * more nits * core: remove polkadot-sdk/std * cargo fmt * remove polkadot-sdk/std by default * Update metadata/Cargo.toml * remove more std * Update Cargo.toml
This commit is contained in:
+3
-9
@@ -32,7 +32,7 @@ std = [
|
||||
"impl-serde/std",
|
||||
"primitive-types/std",
|
||||
]
|
||||
substrate-compat = ["sp-core", "sp-runtime"]
|
||||
substrate-compat = ["polkadot-sdk/sp-core", "polkadot-sdk/sp-runtime", "polkadot-sdk/std"]
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive"] }
|
||||
@@ -50,7 +50,6 @@ serde = { workspace = true, default-features = false, features = ["derive"] }
|
||||
serde_json = { workspace = true, default-features = false, features = ["raw_value", "alloc"] }
|
||||
hashbrown = { workspace = true }
|
||||
|
||||
|
||||
# For ss58 encoding AccountId32 to serialize them properly:
|
||||
base58 = { workspace = true }
|
||||
blake2 = { workspace = true }
|
||||
@@ -58,11 +57,9 @@ blake2 = { workspace = true }
|
||||
# Provides some deserialization, types like U256/H256 and hashing impls like twox/blake256:
|
||||
impl-serde = { workspace = true, default-features = false }
|
||||
primitive-types = { workspace = true, default-features = false, features = ["codec", "serde_no_std", "scale-info"] }
|
||||
sp-crypto-hashing = { workspace = true }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-crypto-hashing"] }
|
||||
|
||||
# Included if the "substrate-compat" feature is enabled.
|
||||
sp-core = { workspace = true, optional = true }
|
||||
sp-runtime = { workspace = true, optional = true }
|
||||
tracing = { workspace = true, default-features = false }
|
||||
|
||||
# AccountId20
|
||||
@@ -74,12 +71,9 @@ bitvec = { workspace = true }
|
||||
codec = { workspace = true, features = ["derive", "bit-vec"] }
|
||||
subxt-macro = { workspace = true }
|
||||
subxt-signer = { workspace = true, features = ["sr25519", "subxt"] }
|
||||
sp-core = { workspace = true }
|
||||
sp-keyring = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
polkadot-sdk = { workspace = true, features = ["sp-crypto-hashing", "sp-core", "sp-keyring"] }
|
||||
hex = { workspace = true }
|
||||
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
defalt-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
@@ -132,6 +132,7 @@ cfg_substrate_compat! {
|
||||
/// implement subxt's Hasher and Header traits for some substrate structs
|
||||
mod substrate_impls {
|
||||
use super::*;
|
||||
use polkadot_sdk::sp_runtime;
|
||||
|
||||
impl<T: sp_runtime::traits::Header> Header for T
|
||||
where
|
||||
|
||||
@@ -8,6 +8,7 @@ use super::{Config, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, Hashe
|
||||
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};
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ pub mod ext {
|
||||
pub use scale_value;
|
||||
|
||||
cfg_substrate_compat! {
|
||||
pub use sp_runtime;
|
||||
pub use sp_core;
|
||||
pub use polkadot_sdk::sp_runtime;
|
||||
pub use polkadot_sdk::sp_core;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ 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};
|
||||
|
||||
@@ -35,8 +35,8 @@ cfg_substrate_compat! {
|
||||
mod pair_signer {
|
||||
use super::Signer;
|
||||
use crate::Config;
|
||||
use sp_core::Pair as PairT;
|
||||
use sp_runtime::{
|
||||
use polkadot_sdk::sp_core::Pair as PairT;
|
||||
use polkadot_sdk::sp_runtime::{
|
||||
traits::{IdentifyAccount, Verify},
|
||||
AccountId32 as SpAccountId32, MultiSignature as SpMultiSignature,
|
||||
};
|
||||
|
||||
@@ -175,6 +175,7 @@ impl core::str::FromStr for AccountId32 {
|
||||
#[cfg(feature = "substrate-compat")]
|
||||
mod substrate_impls {
|
||||
use super::*;
|
||||
use polkadot_sdk::{sp_core, sp_runtime};
|
||||
|
||||
impl From<sp_runtime::AccountId32> for AccountId32 {
|
||||
fn from(value: sp_runtime::AccountId32) -> Self {
|
||||
@@ -199,8 +200,8 @@ mod substrate_impls {
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
use sp_core::crypto::Ss58Codec;
|
||||
use sp_keyring::AccountKeyring;
|
||||
use polkadot_sdk::sp_core::{self, crypto::Ss58Codec};
|
||||
use polkadot_sdk::sp_keyring::AccountKeyring;
|
||||
|
||||
#[test]
|
||||
fn ss58_is_compatible_with_substrate_impl() {
|
||||
|
||||
@@ -48,6 +48,7 @@ impl<AccountId, AccountIndex> From<AccountId> for MultiAddress<AccountId, Accoun
|
||||
#[cfg(feature = "substrate-compat")]
|
||||
mod substrate_impls {
|
||||
use super::{super::AccountId32, *};
|
||||
use polkadot_sdk::sp_runtime;
|
||||
|
||||
impl<N> From<sp_runtime::AccountId32> for MultiAddress<AccountId32, N> {
|
||||
fn from(value: sp_runtime::AccountId32) -> Self {
|
||||
|
||||
@@ -24,6 +24,7 @@ pub enum MultiSignature {
|
||||
#[cfg(feature = "substrate-compat")]
|
||||
mod substrate_impls {
|
||||
use super::*;
|
||||
use polkadot_sdk::{sp_core, sp_runtime};
|
||||
|
||||
impl From<sp_runtime::MultiSignature> for MultiSignature {
|
||||
fn from(value: sp_runtime::MultiSignature) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user