mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 14:01:06 +00:00
minor corrections
This commit is contained in:
+14
-2
@@ -24,11 +24,23 @@ 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"]
|
||||
|
||||
@@ -78,10 +78,10 @@ impl ExtrinsicParamsEncoder for CustomSignedExtension {
|
||||
}
|
||||
|
||||
// When composing a tuple of signed extensions, the user parameters we need must
|
||||
// be able to convert `Into` a tuple of corresponding `OtherParams`. Here, we just
|
||||
// "hijack" the default param builder, but add the `OtherParams` (`()`) for our
|
||||
// be able to convert `Into` a tuple of corresponding `Params`. Here, we just
|
||||
// "hijack" the default param builder, but add the `Params` (`()`) for our
|
||||
// new signed extension at the end, to make the types line up. IN reality you may wish
|
||||
// to construct an entirely new interface to provide the relevant `OtherParams`.
|
||||
// to construct an entirely new interface to provide the relevant `Params`.
|
||||
pub fn custom(
|
||||
params: DefaultExtrinsicParamsBuilder<CustomConfig>,
|
||||
) -> <<CustomConfig as Config>::ExtrinsicParams as ExtrinsicParams<CustomConfig>>::Params {
|
||||
|
||||
@@ -66,7 +66,7 @@ where
|
||||
&self.header
|
||||
}
|
||||
|
||||
/// Return the entire block header. Consumes the block itself
|
||||
/// Return the entire block header. Consumes the block.
|
||||
pub fn into_header(self) -> T::Header {
|
||||
self.header
|
||||
}
|
||||
|
||||
@@ -71,8 +71,10 @@
|
||||
//!
|
||||
//! The `ExtrinsicParams` config type expects to be given an implementation of the [`crate::config::ExtrinsicParams`] trait.
|
||||
//! Implementations of the [`crate::config::ExtrinsicParams`] trait are handed some parameters from Subxt itself, and can
|
||||
//! accept arbitrary `OtherParams` from users, and are then expected to provide this "extra" and "additional" data when asked
|
||||
//! via the required [`crate::config::ExtrinsicParamsEncoder`] impl.
|
||||
//! accept arbitrary `Params` from users, and are then expected to provide this "extra" and "additional" data when asked
|
||||
//! via the required [`crate::config::ExtrinsicParamsEncoder`] impl. These arbitrary `Params` params must also be constructable by a
|
||||
//! client with sensible defaults, in case they are not directly provided by a user. They have to implement the [`crate::config::FromBaseParams`]
|
||||
//! trait to fulfill this requirement.
|
||||
//!
|
||||
//! **In most cases, the default [crate::config::DefaultExtrinsicParams] type will work**: it understands the "standard"
|
||||
//! signed extensions that are in use, and allows the user to provide things like a tip, and set the extrinsic mortality via
|
||||
|
||||
@@ -27,7 +27,8 @@ pub use online_client::{
|
||||
|
||||
use crate::{backend::RuntimeVersion, Config, Metadata};
|
||||
|
||||
/// The inner values, any client should contain.
|
||||
/// Some inner values any client should contain.
|
||||
/// In a [`crate::OfflineClient`] these are fixed, while in a [`crate::OnlineClient`] they might get updated over time.
|
||||
#[derive(Derivative)]
|
||||
#[derivative(Debug(bound = ""), Clone(bound = ""))]
|
||||
pub struct BaseClient<T: Config> {
|
||||
|
||||
@@ -87,8 +87,10 @@ pub struct BaseParams<T: Config> {
|
||||
pub nonce: u64,
|
||||
}
|
||||
|
||||
/// Types implementing this trait can be constructed from a minimal set of data provided by the client.
|
||||
/// Types implementing this trait can be constructed from some minimal data ([`BaseParams`]) provided by the client.
|
||||
/// Implementing this trait is similar to implementing Default, only that we pass in some prior information here.
|
||||
/// We use this trait to provide defaults for the `Params` associated type of ExtrinsicParams for cases where the `Params`
|
||||
/// are not specified by the user.
|
||||
pub trait FromBaseParams<T: Config> {
|
||||
/// Constructs the value from the given mandatory params.
|
||||
fn from_base_params(params: &BaseParams<T>) -> Self;
|
||||
@@ -98,7 +100,7 @@ impl<T: Config> FromBaseParams<T> for () {
|
||||
fn from_base_params(_params: &BaseParams<T>) {}
|
||||
}
|
||||
|
||||
macro_rules! impl_default_from_tuples {
|
||||
macro_rules! impl_tuples {
|
||||
($($ident:ident),+) => {
|
||||
impl <T: Config, $($ident),+> FromBaseParams<T> for ($($ident,)+)
|
||||
where
|
||||
@@ -113,28 +115,28 @@ macro_rules! impl_default_from_tuples {
|
||||
}
|
||||
}
|
||||
|
||||
// Note: these implementations are necessary, such that `DefaultOrFrom` works with `AnyOf` where arbitrary tuples are the `OtherParams`.
|
||||
// Note: these implementations are necessary, such that `FromBaseParams` works with `AnyOf` where arbitrary tuples are the `Params`.
|
||||
#[rustfmt::skip]
|
||||
const _: () = {
|
||||
impl_default_from_tuples!(A);
|
||||
impl_default_from_tuples!(A, B);
|
||||
impl_default_from_tuples!(A, B, C);
|
||||
impl_default_from_tuples!(A, B, C, D);
|
||||
impl_default_from_tuples!(A, B, C, D, E);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U);
|
||||
impl_default_from_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U, V);
|
||||
impl_tuples!(A);
|
||||
impl_tuples!(A, B);
|
||||
impl_tuples!(A, B, C);
|
||||
impl_tuples!(A, B, C, D);
|
||||
impl_tuples!(A, B, C, D, E);
|
||||
impl_tuples!(A, B, C, D, E, F);
|
||||
impl_tuples!(A, B, C, D, E, F, G);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U);
|
||||
impl_tuples!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, U, V);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user