mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 10:47:55 +00:00
fix examples with core crate
This commit is contained in:
Generated
+2
-2
@@ -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",
|
||||
|
||||
@@ -154,7 +154,7 @@ fn mocked_offline_client(metadata: Metadata) -> OfflineClient<SubstrateConfig> {
|
||||
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,
|
||||
};
|
||||
|
||||
+10
-6
@@ -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;
|
||||
|
||||
@@ -38,6 +38,20 @@ pub trait TxPayload {
|
||||
fn validation_details(&self) -> Option<ValidationDetails<'_>> {
|
||||
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> {
|
||||
|
||||
+3
-15
@@ -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
|
||||
|
||||
@@ -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<T: Config> ExtrinsicParams<T> for CustomExtrinsicParams<T> {
|
||||
type OtherParams = CustomExtrinsicParamsBuilder;
|
||||
|
||||
// Gather together all of the params we will need to encode:
|
||||
fn new<Client: OfflineClientT<T>>(
|
||||
fn new(
|
||||
_nonce: u64,
|
||||
client: Client,
|
||||
client: ClientBase<T>,
|
||||
other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(Self {
|
||||
|
||||
@@ -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<T: Config> ExtrinsicParams<T> for CustomSignedExtension {
|
||||
|
||||
fn new(
|
||||
_nonce: u64,
|
||||
_client: subxt_core::ClientBase,
|
||||
_client: subxt_core::ClientBase<T>,
|
||||
_other_params: Self::OtherParams,
|
||||
) -> Result<Self, ExtrinsicParamsError> {
|
||||
Ok(CustomSignedExtension)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<Hash: BlockHash> Drop for BlockRef<Hash> {
|
||||
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<Hash> = std::sync::mpsc::Receiver<(Hash, Arc<str>)>;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<T: Config, C> {
|
||||
@@ -57,7 +56,7 @@ where
|
||||
}
|
||||
|
||||
/// Return the block number.
|
||||
pub fn number(&self) -> <T::Header as crate::config::Header>::Number {
|
||||
pub fn number(&self) -> <T::Header as subxt_core::Header>::Number {
|
||||
self.header().number()
|
||||
}
|
||||
|
||||
|
||||
@@ -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<T> = StreamOfResults<T>;
|
||||
type BlockStreamRes<T> = Result<BlockStream<T>, Error>;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
+10
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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},
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<T: Config, C: OfflineClientT<T>> TxClient<T, C> {
|
||||
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(())
|
||||
}
|
||||
|
||||
|
||||
@@ -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<T: Config, C> {
|
||||
@@ -296,7 +296,7 @@ impl<T: Config, C: OnlineClientT<T>> TxInBlock<T, C> {
|
||||
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<SubstrateConfig, MockClient>;
|
||||
type MockHash = <SubstrateConfig as Config>::Hash;
|
||||
type MockSubstrateTxStatus = TransactionStatus<MockHash>;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user