diff --git a/Cargo.lock b/Cargo.lock index 4c12e4f358..343d08e3cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -793,9 +793,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", diff --git a/cli/src/commands/explore/pallets/calls.rs b/cli/src/commands/explore/pallets/calls.rs index f5d9609a2e..13edbd83ec 100644 --- a/cli/src/commands/explore/pallets/calls.rs +++ b/cli/src/commands/explore/pallets/calls.rs @@ -154,7 +154,7 @@ fn mocked_offline_client(metadata: Metadata) -> OfflineClient { H256::from_str("91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3") .expect("Valid hash; qed"); - let runtime_version = subxt::backend::RuntimeVersion { + let runtime_version = subxt::RuntimeVersion { spec_version: 9370, transaction_version: 20, }; diff --git a/core/src/lib.rs b/core/src/lib.rs index 455d0b8b07..ed04b54775 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -15,7 +15,7 @@ pub mod config; pub mod constants; pub mod custom_values; pub mod dynamic; -mod error; +pub mod error; pub mod metadata; pub mod runtime_api; pub mod signer; @@ -23,17 +23,21 @@ pub mod storage; pub mod tx; pub mod utils; -pub use error::{Error, ExtrinsicParamsError, MetadataError, StorageAddressError}; - pub use client::{ClientBase, RuntimeVersion}; pub use config::{ - BlockHash, Config, ExtrinsicParams, ExtrinsicParamsEncoder, PolkadotConfig, - PolkadotExtrinsicParams, SubstrateConfig, SubstrateExtrinsicParams, + signed_extensions, BlockHash, Config, ExtrinsicParams, ExtrinsicParamsEncoder, Hasher, Header, + PolkadotConfig, PolkadotExtrinsicParams, SignedExtension, SubstrateConfig, + SubstrateExtrinsicParams, }; +pub use dynamic::{DecodedValue, DecodedValueThunk}; +pub use error::{Error, ExtrinsicParamsError, MetadataError, StorageAddressError}; pub use metadata::Metadata; pub use signer::Signer; pub use storage::StorageAddress; -pub use utils::{to_hex, AccountId32, MultiAddress, MultiSignature, Yes, H160, H256, H512}; +pub use utils::{ + strip_compact_prefix, to_hex, AccountId32, KeyedVec, MultiAddress, MultiSignature, Yes, H160, + H256, H512, +}; #[macro_use] mod macros; diff --git a/core/src/tx/mod.rs b/core/src/tx/mod.rs index de2f45b64a..ebf5ca73f1 100644 --- a/core/src/tx/mod.rs +++ b/core/src/tx/mod.rs @@ -38,6 +38,20 @@ pub trait TxPayload { fn validation_details(&self) -> Option> { None } + + fn validate(&self, metadata: &Metadata) -> Result<(), Error> { + if let Some(details) = self.validation_details() { + let expected_hash = metadata + .pallet_by_name_err(details.pallet_name)? + .call_hash(details.call_name) + .ok_or_else(|| MetadataError::CallNameNotFound(details.call_name.to_owned()))?; + + if details.hash != expected_hash { + return Err(MetadataError::IncompatibleCodegen.into()); + } + } + Ok(()) + } } pub struct ValidationDetails<'a> { diff --git a/subxt/Cargo.toml b/subxt/Cargo.toml index cb3fc3363f..80786edc7a 100644 --- a/subxt/Cargo.toml +++ b/subxt/Cargo.toml @@ -24,23 +24,11 @@ default = ["jsonrpsee", "native"] # Enable this for native (ie non web/wasm builds). # Exactly 1 of "web" and "native" is expected. -native = [ - "jsonrpsee?/async-client", - "jsonrpsee?/client-ws-transport-native-tls", - "subxt-lightclient?/native", - "tokio-util" -] +native = ["jsonrpsee?/async-client", "jsonrpsee?/client-ws-transport-native-tls", "subxt-lightclient?/native", "tokio-util"] # Enable this for web/wasm builds. # Exactly 1 of "web" and "native" is expected. -web = [ - "jsonrpsee?/async-wasm-client", - "jsonrpsee?/client-web-transport", - "getrandom/js", - "subxt-lightclient?/web", - "subxt-macro/web", - "instant/wasm-bindgen" -] +web = ["jsonrpsee?/async-wasm-client", "jsonrpsee?/client-web-transport", "getrandom/js", "subxt-lightclient?/web", "subxt-macro/web", "instant/wasm-bindgen"] # Enable this to use the reconnecting rpc client unstable-reconnecting-rpc-client = ["dep:reconnecting-jsonrpsee-ws-client"] @@ -51,7 +39,7 @@ jsonrpsee = ["dep:jsonrpsee"] # Enable this to pull in extra Substrate dependencies which make it possible to # use the `sp_core::crypto::Pair` Signer implementation, as well as adding some # `From` impls for types like `AccountId32`. Cannot be used with "web". -substrate-compat = ["sp-core", "sp-runtime"] +substrate-compat = ["sp-core", "sp-runtime", "subxt-core/substrate-compat"] # Enable this to fetch and utilize the latest unstable metadata from a node. # The unstable metadata is subject to breaking changes and the subxt might diff --git a/subxt/examples/setup_config_custom.rs b/subxt/examples/setup_config_custom.rs index 0f2ad2e27b..886999df7a 100644 --- a/subxt/examples/setup_config_custom.rs +++ b/subxt/examples/setup_config_custom.rs @@ -1,6 +1,6 @@ #![allow(missing_docs)] use codec::Encode; -use subxt::client::OfflineClientT; +use subxt::client::{ClientBase}; use subxt::config::{Config, ExtrinsicParams, ExtrinsicParamsEncoder}; use subxt_core::ExtrinsicParamsError; use subxt_signer::sr25519::dev; @@ -57,9 +57,9 @@ impl ExtrinsicParams for CustomExtrinsicParams { type OtherParams = CustomExtrinsicParamsBuilder; // Gather together all of the params we will need to encode: - fn new>( + fn new( _nonce: u64, - client: Client, + client: ClientBase, other_params: Self::OtherParams, ) -> Result { Ok(Self { diff --git a/subxt/examples/setup_config_signed_extension.rs b/subxt/examples/setup_config_signed_extension.rs index a48e17570f..01593f7fed 100644 --- a/subxt/examples/setup_config_signed_extension.rs +++ b/subxt/examples/setup_config_signed_extension.rs @@ -2,7 +2,6 @@ use codec::Encode; use scale_encode::EncodeAsType; use scale_info::PortableRegistry; -use subxt::client::OfflineClientT; use subxt::config::{ Config, DefaultExtrinsicParamsBuilder, ExtrinsicParams, ExtrinsicParamsEncoder, }; @@ -62,7 +61,7 @@ impl ExtrinsicParams for CustomSignedExtension { fn new( _nonce: u64, - _client: subxt_core::ClientBase, + _client: subxt_core::ClientBase, _other_params: Self::OtherParams, ) -> Result { Ok(CustomSignedExtension) diff --git a/subxt/src/backend/legacy/mod.rs b/subxt/src/backend/legacy/mod.rs index cffb3f4475..507d6d9ce5 100644 --- a/subxt/src/backend/legacy/mod.rs +++ b/subxt/src/backend/legacy/mod.rs @@ -12,12 +12,13 @@ use crate::backend::{ rpc::RpcClient, Backend, BlockRef, RuntimeVersion, StorageResponse, StreamOf, StreamOfResults, TransactionStatus, }; -use crate::{config::Header, Config, Error}; +use crate::Error; use async_trait::async_trait; use futures::{future, future::Either, stream, Future, FutureExt, Stream, StreamExt}; use std::collections::VecDeque; use std::pin::Pin; use std::task::{Context, Poll}; +use subxt_core::{config::Header, Config}; // Expose the RPC methods. pub use rpc_methods::LegacyRpcMethods; diff --git a/subxt/src/backend/unstable/follow_stream.rs b/subxt/src/backend/unstable/follow_stream.rs index 9474f7a302..6a55def6c0 100644 --- a/subxt/src/backend/unstable/follow_stream.rs +++ b/subxt/src/backend/unstable/follow_stream.rs @@ -3,12 +3,12 @@ // see LICENSE for license details. use super::rpc_methods::{FollowEvent, UnstableRpcMethods}; -use crate::config::Config; use crate::error::Error; use futures::{FutureExt, Stream, StreamExt}; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; +use subxt_core::config::Config; /// A `Stream` whose goal is to remain subscribed to `chainHead_follow`. It will re-subscribe if the subscription /// is ended for any reason, and it will return the current `subscription_id` as an event, along with the other @@ -206,9 +206,9 @@ pub(super) mod test_utils { use crate::backend::unstable::rpc_methods::{ BestBlockChanged, Finalized, Initialized, NewBlock, }; - use crate::config::substrate::H256; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; + use subxt_core::config::substrate::H256; /// Given some events, returns a follow stream getter that we can use in /// place of the usual RPC method. diff --git a/subxt/src/backend/unstable/follow_stream_driver.rs b/subxt/src/backend/unstable/follow_stream_driver.rs index d32c98a104..295bca5ab8 100644 --- a/subxt/src/backend/unstable/follow_stream_driver.rs +++ b/subxt/src/backend/unstable/follow_stream_driver.rs @@ -4,7 +4,6 @@ use super::follow_stream_unpin::{BlockRef, FollowStreamMsg, FollowStreamUnpin}; use crate::backend::unstable::rpc_methods::{FollowEvent, Initialized, RuntimeEvent}; -use crate::config::BlockHash; use crate::error::Error; use futures::stream::{Stream, StreamExt}; use std::collections::{HashMap, HashSet, VecDeque}; @@ -12,6 +11,7 @@ use std::ops::DerefMut; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll, Waker}; +use subxt_core::config::BlockHash; /// A `Stream` which builds on `FollowStreamDriver`, and allows multiple subscribers to obtain events /// from the single underlying subscription (each being provided an `Initialized` message and all new diff --git a/subxt/src/backend/unstable/follow_stream_unpin.rs b/subxt/src/backend/unstable/follow_stream_unpin.rs index ca00e37690..7b97ae33de 100644 --- a/subxt/src/backend/unstable/follow_stream_unpin.rs +++ b/subxt/src/backend/unstable/follow_stream_unpin.rs @@ -7,7 +7,6 @@ use super::UnstableRpcMethods; use crate::backend::unstable::rpc_methods::{ BestBlockChanged, Finalized, FollowEvent, Initialized, NewBlock, }; -use crate::config::{BlockHash, Config}; use crate::error::Error; use futures::stream::{FuturesUnordered, Stream, StreamExt}; use std::collections::{HashMap, HashSet}; @@ -15,6 +14,7 @@ use std::future::Future; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll, Waker}; +use subxt_core::config::{BlockHash, Config}; /// The type of stream item. pub use super::follow_stream::FollowStreamMsg; @@ -455,7 +455,7 @@ impl Drop for BlockRef { pub(super) mod test_utils { use super::super::follow_stream::{test_utils::test_stream_getter, FollowStream}; use super::*; - use crate::config::substrate::H256; + use subxt_core::config::substrate::H256; pub type UnpinRx = std::sync::mpsc::Receiver<(Hash, Arc)>; @@ -542,7 +542,7 @@ mod test { }; use super::test_utils::{assert_from_unpin_rx, ev_new_block_ref, test_unpin_stream_getter}; use super::*; - use crate::config::substrate::H256; + use subxt_core::config::substrate::H256; #[tokio::test] async fn hands_back_blocks() { diff --git a/subxt/src/backend/unstable/mod.rs b/subxt/src/backend/unstable/mod.rs index 82a2d50d48..8d6af54cd9 100644 --- a/subxt/src/backend/unstable/mod.rs +++ b/subxt/src/backend/unstable/mod.rs @@ -25,7 +25,6 @@ use crate::backend::{ rpc::RpcClient, Backend, BlockRef, BlockRefT, RuntimeVersion, StorageResponse, StreamOf, StreamOfResults, TransactionStatus, }; -use crate::config::BlockHash; use crate::error::{Error, RpcError}; use crate::Config; use async_trait::async_trait; @@ -35,6 +34,7 @@ use std::collections::HashMap; use std::sync::Arc; use std::task::Poll; use storage_items::StorageItems; +use subxt_core::config::BlockHash; // Expose the RPC methods. pub use rpc_methods::UnstableRpcMethods; diff --git a/subxt/src/backend/unstable/rpc_methods.rs b/subxt/src/backend/unstable/rpc_methods.rs index a397d2fbdb..107f615187 100644 --- a/subxt/src/backend/unstable/rpc_methods.rs +++ b/subxt/src/backend/unstable/rpc_methods.rs @@ -7,13 +7,13 @@ //! methods exposed here. use crate::backend::rpc::{rpc_params, RpcClient, RpcSubscription}; -use crate::config::BlockHash; use crate::{Config, Error}; use derivative::Derivative; use futures::{Stream, StreamExt}; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, VecDeque}; use std::task::Poll; +use subxt_core::config::BlockHash; use subxt_core::to_hex; /// An interface to call the unstable RPC methods. This interface is instantiated with diff --git a/subxt/src/backend/unstable/storage_items.rs b/subxt/src/backend/unstable/storage_items.rs index 73790765ea..148eac15f2 100644 --- a/subxt/src/backend/unstable/storage_items.rs +++ b/subxt/src/backend/unstable/storage_items.rs @@ -7,7 +7,6 @@ use super::follow_stream_unpin::BlockRef; use super::rpc_methods::{ FollowEvent, MethodResponse, StorageQuery, StorageResult, UnstableRpcMethods, }; -use crate::config::Config; use crate::error::{Error, RpcError}; use futures::{FutureExt, Stream, StreamExt}; use std::collections::VecDeque; @@ -15,6 +14,7 @@ use std::future::Future; use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; +use subxt_core::config::Config; /// Obtain a stream of storage items given some query. this handles continuing /// and stopping under the hood, and returns a stream of `StorageResult`s. diff --git a/subxt/src/blocks/block_types.rs b/subxt/src/blocks/block_types.rs index a1cb01ec25..f6c27fe2d8 100644 --- a/subxt/src/blocks/block_types.rs +++ b/subxt/src/blocks/block_types.rs @@ -6,16 +6,15 @@ use crate::{ backend::BlockRef, blocks::{extrinsic_types::ExtrinsicPartTypeIds, Extrinsics}, client::{OfflineClientT, OnlineClientT}, - config::{Config, Header}, error::{BlockError, DecodeError, Error}, events, runtime_api::RuntimeApi, storage::Storage, }; - use codec::{Decode, Encode}; use futures::lock::Mutex as AsyncMutex; use std::sync::Arc; +use subxt_core::{Config, Header}; /// A representation of a block. pub struct Block { @@ -57,7 +56,7 @@ where } /// Return the block number. - pub fn number(&self) -> ::Number { + pub fn number(&self) -> ::Number { self.header().number() } diff --git a/subxt/src/blocks/blocks_client.rs b/subxt/src/blocks/blocks_client.rs index 9ec031a35a..7d86de3d01 100644 --- a/subxt/src/blocks/blocks_client.rs +++ b/subxt/src/blocks/blocks_client.rs @@ -6,13 +6,13 @@ use super::Block; use crate::{ backend::{BlockRef, StreamOfResults}, client::OnlineClientT, - config::Config, error::{BlockError, Error}, - utils::PhantomDataSendSync, }; use derivative::Derivative; use futures::StreamExt; use std::future::Future; +use subxt_core::utils::PhantomDataSendSync; +use subxt_core::Config; type BlockStream = StreamOfResults; type BlockStreamRes = Result, Error>; diff --git a/subxt/src/blocks/extrinsic_types.rs b/subxt/src/blocks/extrinsic_types.rs index e90e3c3bdc..734862d1ff 100644 --- a/subxt/src/blocks/extrinsic_types.rs +++ b/subxt/src/blocks/extrinsic_types.rs @@ -5,22 +5,20 @@ use crate::{ blocks::block_types::{get_events, CachedEvents}, client::{OfflineClientT, OnlineClientT}, - config::{Config, Hasher}, error::{BlockError, Error, MetadataError}, - events, Metadata, + events, +}; +use subxt_core::{ + metadata::MetadatExt, + signed_extensions::{ChargeAssetTxPayment, ChargeTransactionPayment, CheckNonce}, + strip_compact_prefix, Config, Hasher, Metadata, }; -use subxt_core::metadata::{types::PalletMetadata, MetadatExt}; - -use crate::config::signed_extensions::{ - ChargeAssetTxPayment, ChargeTransactionPayment, CheckNonce, -}; -use crate::config::SignedExtension; -use crate::dynamic::DecodedValue; -use crate::utils::strip_compact_prefix; use codec::Decode; use derivative::Derivative; use scale_decode::{DecodeAsFields, DecodeAsType}; +use subxt_core::{DecodedValue, SignedExtension}; +use subxt_metadata::PalletMetadata; use std::sync::Arc; diff --git a/subxt/src/client/mod.rs b/subxt/src/client/mod.rs index c764af4b59..1eabeeed52 100644 --- a/subxt/src/client/mod.rs +++ b/subxt/src/client/mod.rs @@ -23,3 +23,4 @@ pub use offline_client::{OfflineClient, OfflineClientT}; pub use online_client::{ ClientRuntimeUpdater, OnlineClient, OnlineClientT, RuntimeUpdaterStream, Update, UpgradeError, }; +pub use subxt_core::ClientBase; \ No newline at end of file diff --git a/subxt/src/lib.rs b/subxt/src/lib.rs index 5842f513e9..6774f2eecb 100644 --- a/subxt/src/lib.rs +++ b/subxt/src/lib.rs @@ -66,7 +66,15 @@ pub use crate::{ }; // We replace this by proper exports, once the API of subxt_core is aggreed upon. -pub use subxt_core::*; +// pub use subxt_core::*; + +pub use subxt_core::{ + dynamic, signed_extensions, AccountId32, BlockHash, ClientBase, Config, DecodedValue, + DecodedValueThunk, ExtrinsicParams, ExtrinsicParamsEncoder, Hasher, Header, Metadata, + MultiAddress, PolkadotConfig, PolkadotExtrinsicParams, RuntimeVersion, Signer, StorageAddress, + SubstrateConfig, SubstrateExtrinsicParams, + config, metadata, +}; /// Re-export external crates that are made use of in the subxt API. pub mod ext { @@ -77,6 +85,7 @@ pub mod ext { pub use scale_decode; pub use scale_encode; pub use scale_value; + pub use subxt_core; cfg_substrate_compat! { pub use sp_runtime; diff --git a/subxt/src/macros.rs b/subxt/src/macros.rs index 47362f18ca..3c6d2a8e6c 100644 --- a/subxt/src/macros.rs +++ b/subxt/src/macros.rs @@ -64,7 +64,7 @@ macro_rules! cfg_reconnecting_rpc_client { } pub(crate) use { - cfg_feature, cfg_jsonrpsee, cfg_reconnecting_rpc_client, cfg_substrate_compat, + cfg_feature, cfg_jsonrpsee, cfg_reconnecting_rpc_client, cfg_unstable_light_client, }; diff --git a/subxt/src/runtime_api/runtime_client.rs b/subxt/src/runtime_api/runtime_client.rs index 5770285b83..708c0fb253 100644 --- a/subxt/src/runtime_api/runtime_client.rs +++ b/subxt/src/runtime_api/runtime_client.rs @@ -4,9 +4,10 @@ use super::runtime_types::RuntimeApi; -use crate::{backend::BlockRef, client::OnlineClientT, error::Error, Config}; +use crate::{backend::BlockRef, client::OnlineClientT, error::Error}; use derivative::Derivative; use std::{future::Future, marker::PhantomData}; +use subxt_core::Config; /// Execute runtime API calls. #[derive(Derivative)] diff --git a/subxt/src/runtime_api/runtime_types.rs b/subxt/src/runtime_api/runtime_types.rs index 0bc518fe6b..03c8256788 100644 --- a/subxt/src/runtime_api/runtime_types.rs +++ b/subxt/src/runtime_api/runtime_types.rs @@ -6,12 +6,12 @@ use crate::{ backend::{BackendExt, BlockRef}, client::OnlineClientT, error::{Error, MetadataError}, - Config, }; use codec::Decode; use derivative::Derivative; use std::{future::Future, marker::PhantomData}; use subxt_core::metadata::{DecodeWithMetadata, MetadatExt}; +use subxt_core::Config; use super::RuntimeApiPayload; diff --git a/subxt/src/storage/storage_client.rs b/subxt/src/storage/storage_client.rs index 7b62ed6b9a..98cca519a8 100644 --- a/subxt/src/storage/storage_client.rs +++ b/subxt/src/storage/storage_client.rs @@ -7,10 +7,10 @@ use crate::{ backend::BlockRef, client::{OfflineClientT, OnlineClientT}, error::Error, - Config, }; use derivative::Derivative; use std::{future::Future, marker::PhantomData}; +use subxt_core::Config; use subxt_core::{ metadata::MetadatExt, storage::utils::{storage_address_bytes, storage_address_root_bytes, validate_storage_address}, diff --git a/subxt/src/storage/storage_type.rs b/subxt/src/storage/storage_type.rs index 51cc4cac18..8761ed0108 100644 --- a/subxt/src/storage/storage_type.rs +++ b/subxt/src/storage/storage_type.rs @@ -14,13 +14,13 @@ use crate::{ backend::{BackendExt, BlockRef}, client::OnlineClientT, error::{Error, MetadataError}, - Config, }; use codec::Decode; use derivative::Derivative; use futures::StreamExt; use std::{future::Future, marker::PhantomData}; use subxt_core::metadata::DecodeWithMetadata; +use subxt_core::Config; /// This is returned from a couple of storage functions. pub use crate::backend::StreamOfResults; diff --git a/subxt/src/tx/tx_client.rs b/subxt/src/tx/tx_client.rs index 8029781f91..0e2eca679f 100644 --- a/subxt/src/tx/tx_client.rs +++ b/subxt/src/tx/tx_client.rs @@ -4,19 +4,20 @@ use std::borrow::Cow; +use super::TxProgress; use crate::{ backend::{BackendExt, BlockRef, TransactionStatus}, client::{OfflineClientT, OnlineClientT}, - config::{Config, ExtrinsicParams, ExtrinsicParamsEncoder, Hasher}, - error::{Error, MetadataError}, - utils::{Encoded, PhantomDataSendSync}, + error::Error, }; use codec::{Compact, Decode, Encode}; use derivative::Derivative; use sp_core_hashing::blake2_256; -use subxt_core::{metadata::MetadatExt, tx::TxPayload, Signer as SignerT}; - -use super::TxProgress; +use subxt_core::{ + tx::TxPayload, + utils::{Encoded, PhantomDataSendSync}, + Config, ExtrinsicParams, ExtrinsicParamsEncoder, Hasher, Signer as SignerT, +}; /// A client for working with transactions. #[derive(Derivative)] @@ -45,18 +46,7 @@ impl> TxClient { where Call: TxPayload, { - if let Some(details) = call.validation_details() { - let expected_hash = self - .client - .metadata() - .pallet_by_name_err(details.pallet_name)? - .call_hash(details.call_name) - .ok_or_else(|| MetadataError::CallNameNotFound(details.call_name.to_owned()))?; - - if details.hash != expected_hash { - return Err(MetadataError::IncompatibleCodegen.into()); - } - } + call.validate(&self.client.metadata())?; Ok(()) } diff --git a/subxt/src/tx/tx_progress.rs b/subxt/src/tx/tx_progress.rs index 166b2cda33..77b3f98cfb 100644 --- a/subxt/src/tx/tx_progress.rs +++ b/subxt/src/tx/tx_progress.rs @@ -6,16 +6,16 @@ use std::task::Poll; -use crate::utils::strip_compact_prefix; use crate::{ backend::{BlockRef, StreamOfResults, TransactionStatus as BackendTxStatus}, client::OnlineClientT, error::{DispatchError, Error, RpcError, TransactionError}, events::EventsClient, - Config, }; use derivative::Derivative; use futures::{Stream, StreamExt}; +use subxt_core::utils::strip_compact_prefix; +use subxt_core::Config; /// This struct represents a subscription to the progress of some transaction. pub struct TxProgress { @@ -296,7 +296,7 @@ impl> TxInBlock { let extrinsic_idx = block_body .iter() .position(|ext| { - use crate::config::Hasher; + use subxt_core::Hasher; let Ok((_, stripped)) = strip_compact_prefix(ext) else { return false; }; @@ -325,9 +325,11 @@ mod test { backend::{StreamOfResults, TransactionStatus}, client::{OfflineClientT, OnlineClientT}, tx::TxProgress, - Config, Error, SubstrateConfig, + Error, }; + use subxt_core::{Config, SubstrateConfig}; + type MockTxProgress = TxProgress; type MockHash = ::Hash; type MockSubstrateTxStatus = TransactionStatus; diff --git a/subxt/src/utils.rs b/subxt/src/utils.rs index b02acebba0..d7cedf98da 100644 --- a/subxt/src/utils.rs +++ b/subxt/src/utils.rs @@ -4,7 +4,7 @@ //! Utility functions used in subxt. Reexports all elements from [`subxt_core::utils`]; -pub use subxt_core::utils::*; +pub use subxt_core::utils::{strip_compact_prefix, to_hex,UncheckedExtrinsic, AccountId32, MultiAddress, MultiSignature, KeyedVec, Yes, H160, H256, H512, bits }; use url::Url;