Rename traits to remove T suffix (#1535)

* Rename traits to renmove T suffix

* Fix doc links

* Fix straggler doc links
This commit is contained in:
James Wilson
2024-04-16 16:35:14 +01:00
committed by GitHub
parent 1e111ea9db
commit ac606cf625
32 changed files with 2426 additions and 2229 deletions
Generated
+3 -3
View File
@@ -3284,13 +3284,13 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf"
dependencies = [
"bit-set",
"bit-vec",
"bitflags 2.4.2",
"bitflags 2.5.0",
"lazy_static",
"num-traits",
"rand",
"rand_chacha",
"rand_xorshift",
"regex-syntax 0.8.2",
"regex-syntax 0.8.3",
"rusty-fork",
"tempfile",
"unarray",
@@ -5005,7 +5005,7 @@ checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
"rustix 0.38.31",
"rustix 0.38.32",
"windows-sys 0.52.0",
]
+3 -3
View File
@@ -10,7 +10,7 @@ use scale_typegen::typegen::ir::ToTokensWithSettings;
use scale_typegen::{typegen::ir::type_ir::CompositeIRKind, TypeGenerator};
use subxt_metadata::PalletMetadata;
/// Generate calls from the provided pallet's metadata. Each call returns a `StaticTxPayload`
/// Generate calls from the provided pallet's metadata. Each call returns a `StaticPayload`
/// that can be passed to the subxt client to submit/sign/encode.
///
/// # Arguments
@@ -92,8 +92,8 @@ pub fn generate_calls(
pub fn #fn_name(
&self,
#( #call_fn_args, )*
) -> #crate_path::tx::payload::Payload<types::#struct_name> {
#crate_path::tx::payload::Payload::new_static(
) -> #crate_path::tx::payload::StaticPayload<types::#struct_name> {
#crate_path::tx::payload::StaticPayload::new_static(
#pallet_name,
#call_name,
types::#struct_name { #( #call_args, )* },
+2 -2
View File
@@ -68,8 +68,8 @@ pub fn generate_constants(
Ok(quote! {
#docs
pub fn #fn_name(&self) -> #crate_path::constants::address::Address<#return_ty> {
#crate_path::constants::address::Address::new_static(
pub fn #fn_name(&self) -> #crate_path::constants::address::StaticAddress<#return_ty> {
#crate_path::constants::address::StaticAddress::new_static(
#pallet_name,
#constant_name,
[#(#constant_hash,)*]
+2 -2
View File
@@ -135,8 +135,8 @@ fn generate_runtime_api(
let method = quote!(
#docs
pub fn #method_name(&self, #( #fn_params, )* ) -> #crate_path::runtime_api::payload::Payload<types::#struct_name, types::#method_name::output::Output> {
#crate_path::runtime_api::payload::Payload::new_static(
pub fn #method_name(&self, #( #fn_params, )* ) -> #crate_path::runtime_api::payload::StaticPayload<types::#struct_name, types::#method_name::output::Output> {
#crate_path::runtime_api::payload::StaticPayload::new_static(
#trait_name_str,
#method_name_str,
types::#struct_name { #( #param_names, )* },
+2 -2
View File
@@ -258,14 +258,14 @@ fn generate_storage_entry_fns(
pub fn #fn_name(
&self,
#(#key_args,)*
) -> #crate_path::storage::address::Address::<
) -> #crate_path::storage::address::StaticAddress::<
#keys_type,
#alias_storage_path,
#is_fetchable_type,
#is_defaultable_type,
#is_iterable_type
> {
#crate_path::storage::address::Address::new_static(
#crate_path::storage::address::StaticAddress::new_static(
#pallet_name,
#storage_name,
#keys,
+9 -7
View File
@@ -12,7 +12,7 @@ use derive_where::derive_where;
/// This represents a constant address. Anything implementing this trait
/// can be used to fetch constants.
pub trait AddressT {
pub trait Address {
/// The target type of the value that lives at this address.
type Target: DecodeWithMetadata;
@@ -32,18 +32,20 @@ pub trait AddressT {
/// This represents the address of a constant.
#[derive_where(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)]
pub struct Address<ReturnTy> {
pub struct DefaultAddress<ReturnTy> {
pallet_name: Cow<'static, str>,
constant_name: Cow<'static, str>,
constant_hash: Option<[u8; 32]>,
_marker: core::marker::PhantomData<ReturnTy>,
}
/// The type of address used by our static codegen.
pub type StaticAddress<ReturnTy> = DefaultAddress<ReturnTy>;
/// The type of address typically used to return dynamic constant values.
pub type DynamicAddress = Address<DecodedValueThunk>;
pub type DynamicAddress = DefaultAddress<DecodedValueThunk>;
impl<ReturnTy> Address<ReturnTy> {
/// Create a new [`Address`] to use to look up a constant.
impl<ReturnTy> DefaultAddress<ReturnTy> {
/// Create a new [`DefaultAddress`] to use to look up a constant.
pub fn new(pallet_name: impl Into<String>, constant_name: impl Into<String>) -> Self {
Self {
pallet_name: Cow::Owned(pallet_name.into()),
@@ -53,7 +55,7 @@ impl<ReturnTy> Address<ReturnTy> {
}
}
/// Create a new [`Address`] that will be validated
/// Create a new [`DefaultAddress`] that will be validated
/// against node metadata using the hash given.
#[doc(hidden)]
pub fn new_static(
@@ -80,7 +82,7 @@ impl<ReturnTy> Address<ReturnTy> {
}
}
impl<ReturnTy: DecodeWithMetadata> AddressT for Address<ReturnTy> {
impl<ReturnTy: DecodeWithMetadata> Address for DefaultAddress<ReturnTy> {
type Target = ReturnTy;
fn pallet_name(&self) -> &str {
+4 -7
View File
@@ -40,7 +40,7 @@
pub mod address;
use address::AddressT;
use address::Address;
use alloc::borrow::ToOwned;
use crate::{error::MetadataError, metadata::DecodeWithMetadata, Error, Metadata};
@@ -50,7 +50,7 @@ use crate::{error::MetadataError, metadata::DecodeWithMetadata, Error, Metadata}
///
/// When the provided `address` is dynamic (and thus does not come with any expectation of the
/// shape of the constant value), this just returns `Ok(())`
pub fn validate<Address: AddressT>(address: &Address, metadata: &Metadata) -> Result<(), Error> {
pub fn validate<Addr: Address>(address: &Addr, metadata: &Metadata) -> Result<(), Error> {
if let Some(actual_hash) = address.validation_hash() {
let expected_hash = metadata
.pallet_by_name_err(address.pallet_name())?
@@ -67,10 +67,7 @@ pub fn validate<Address: AddressT>(address: &Address, metadata: &Metadata) -> Re
/// Fetch a constant out of the metadata given a constant address. If the `address` has been
/// statically generated, this will validate that the constant shape is as expected, too.
pub fn get<Address: AddressT>(
address: &Address,
metadata: &Metadata,
) -> Result<Address::Target, Error> {
pub fn get<Addr: Address>(address: &Addr, metadata: &Metadata) -> Result<Addr::Target, Error> {
// 1. Validate constant shape if hash given:
validate(address, metadata)?;
@@ -79,7 +76,7 @@ pub fn get<Address: AddressT>(
.pallet_by_name_err(address.pallet_name())?
.constant_by_name(address.constant_name())
.ok_or_else(|| MetadataError::ConstantNameNotFound(address.constant_name().to_owned()))?;
let value = <Address::Target as DecodeWithMetadata>::decode_with_metadata(
let value = <Addr::Target as DecodeWithMetadata>::decode_with_metadata(
&mut constant.value(),
constant.ty(),
metadata,
+4 -4
View File
@@ -8,13 +8,13 @@ use crate::dynamic::DecodedValueThunk;
use crate::metadata::DecodeWithMetadata;
use derive_where::derive_where;
/// Use this with [`AddressT::IsDecodable`].
/// Use this with [`Address::IsDecodable`].
pub use crate::utils::Yes;
/// This represents the address of a custom value in in the metadata.
/// Anything that implements it can be used to fetch custom values from the metadata.
/// The trait is implemented by [`str`] for dynamic lookup and [`StaticAddress`] for static queries.
pub trait AddressT {
pub trait Address {
/// The type of the custom value.
type Target: DecodeWithMetadata;
/// Should be set to `Yes` for Dynamic values and static values that have a valid type.
@@ -30,7 +30,7 @@ pub trait AddressT {
}
}
impl AddressT for str {
impl Address for str {
type Target = DecodedValueThunk;
type IsDecodable = Yes;
@@ -68,7 +68,7 @@ impl<ReturnTy, IsDecodable> StaticAddress<ReturnTy, IsDecodable> {
}
}
impl<R: DecodeWithMetadata, Y> AddressT for StaticAddress<R, Y> {
impl<R: DecodeWithMetadata, Y> Address for StaticAddress<R, Y> {
type Target = R;
type IsDecodable = Y;
+8 -11
View File
@@ -34,16 +34,13 @@ pub mod address;
use crate::utils::Yes;
use crate::{error::MetadataError, metadata::DecodeWithMetadata, Error, Metadata};
use address::AddressT;
use address::Address;
use alloc::vec::Vec;
/// Run the validation logic against some custom value address you'd like to access. Returns `Ok(())`
/// if the address is valid (or if it's not possible to check since the address has no validation hash).
/// Returns an error if the address was not valid (wrong name, type or raw bytes)
pub fn validate<Address: AddressT + ?Sized>(
address: &Address,
metadata: &Metadata,
) -> Result<(), Error> {
pub fn validate<Addr: Address + ?Sized>(address: &Addr, metadata: &Metadata) -> Result<(), Error> {
if let Some(actual_hash) = address.validation_hash() {
let custom = metadata.custom();
let custom_value = custom
@@ -62,16 +59,16 @@ pub fn validate<Address: AddressT + ?Sized>(
/// Access a custom value by the address it is registered under. This can be just a [str] to get back a dynamic value,
/// or a static address from the generated static interface to get a value of a static type returned.
pub fn get<Address: AddressT<IsDecodable = Yes> + ?Sized>(
address: &Address,
pub fn get<Addr: Address<IsDecodable = Yes> + ?Sized>(
address: &Addr,
metadata: &Metadata,
) -> Result<Address::Target, Error> {
) -> Result<Addr::Target, Error> {
// 1. Validate custom value shape if hash given:
validate(address, metadata)?;
// 2. Attempt to decode custom value:
let custom_value = metadata.custom_value_by_name_err(address.name())?;
let value = <Address::Target as DecodeWithMetadata>::decode_with_metadata(
let value = <Addr::Target as DecodeWithMetadata>::decode_with_metadata(
&mut custom_value.bytes(),
custom_value.type_id(),
metadata,
@@ -80,8 +77,8 @@ pub fn get<Address: AddressT<IsDecodable = Yes> + ?Sized>(
}
/// Access the bytes of a custom value by the address it is registered under.
pub fn get_bytes<Address: AddressT + ?Sized>(
address: &Address,
pub fn get_bytes<Addr: Address + ?Sized>(
address: &Addr,
metadata: &Metadata,
) -> Result<Vec<u8>, Error> {
// 1. Validate custom value shape if hash given:
+8 -11
View File
@@ -49,13 +49,13 @@ use alloc::borrow::ToOwned;
use alloc::format;
use alloc::string::String;
use alloc::vec::Vec;
use payload::PayloadT;
use payload::Payload;
/// Run the validation logic against some runtime API payload you'd like to use. Returns `Ok(())`
/// if the payload is valid (or if it's not possible to check since the payload has no validation hash).
/// Return an error if the payload was not valid or something went wrong trying to validate it (ie
/// the runtime API in question do not exist at all)
pub fn validate<Payload: PayloadT>(payload: &Payload, metadata: &Metadata) -> Result<(), Error> {
pub fn validate<P: Payload>(payload: &P, metadata: &Metadata) -> Result<(), Error> {
let Some(static_hash) = payload.validation_hash() else {
return Ok(());
};
@@ -72,30 +72,27 @@ pub fn validate<Payload: PayloadT>(payload: &Payload, metadata: &Metadata) -> Re
}
/// Return the name of the runtime API call from the payload.
pub fn call_name<Payload: PayloadT>(payload: &Payload) -> String {
pub fn call_name<P: Payload>(payload: &P) -> String {
format!("{}_{}", payload.trait_name(), payload.method_name())
}
/// Return the encoded call args given a runtime API payload.
pub fn call_args<Payload: PayloadT>(
payload: &Payload,
metadata: &Metadata,
) -> Result<Vec<u8>, Error> {
pub fn call_args<P: Payload>(payload: &P, metadata: &Metadata) -> Result<Vec<u8>, Error> {
payload.encode_args(metadata)
}
/// Decode the value bytes at the location given by the provided runtime API payload.
pub fn decode_value<Payload: PayloadT>(
pub fn decode_value<P: Payload>(
bytes: &mut &[u8],
payload: &Payload,
payload: &P,
metadata: &Metadata,
) -> Result<Payload::ReturnType, Error> {
) -> Result<P::ReturnType, Error> {
let api_method = metadata
.runtime_api_trait_by_name_err(payload.trait_name())?
.method_by_name(payload.method_name())
.ok_or_else(|| MetadataError::RuntimeMethodNotFound(payload.method_name().to_owned()))?;
let val = <Payload::ReturnType as DecodeWithMetadata>::decode_with_metadata(
let val = <P::ReturnType as DecodeWithMetadata>::decode_with_metadata(
&mut &bytes[..],
api_method.output_ty(),
metadata,
+17 -15
View File
@@ -40,7 +40,7 @@ use crate::metadata::{DecodeWithMetadata, Metadata};
/// - encoded arguments
///
/// Each argument of the runtime function must be scale-encoded.
pub trait PayloadT {
pub trait Payload {
/// The return type of the function call.
// Note: `DecodeWithMetadata` is needed to decode the function call result
// with the `subxt::Metadata.
@@ -56,7 +56,7 @@ pub trait PayloadT {
fn encode_args_to(&self, metadata: &Metadata, out: &mut Vec<u8>) -> Result<(), Error>;
/// Encode arguments data and return the output. This is a convenience
/// wrapper around [`PayloadT::encode_args_to`].
/// wrapper around [`Payload::encode_args_to`].
fn encode_args(&self, metadata: &Metadata) -> Result<Vec<u8>, Error> {
let mut v = Vec::new();
self.encode_args_to(metadata, &mut v)?;
@@ -75,7 +75,7 @@ pub trait PayloadT {
/// This can be created from static values (ie those generated
/// via the `subxt` macro) or dynamic values via [`dynamic`].
#[derive_where(Clone, Debug, Eq, Ord, PartialEq, PartialOrd; ArgsData)]
pub struct Payload<ArgsData, ReturnTy> {
pub struct DefaultPayload<ArgsData, ReturnTy> {
trait_name: Cow<'static, str>,
method_name: Cow<'static, str>,
args_data: ArgsData,
@@ -83,8 +83,13 @@ pub struct Payload<ArgsData, ReturnTy> {
_marker: PhantomData<ReturnTy>,
}
impl<ArgsData: EncodeAsFields, ReturnTy: DecodeWithMetadata> PayloadT
for Payload<ArgsData, ReturnTy>
/// A statically generated runtime API payload.
pub type StaticPayload<ArgsData, ReturnTy> = DefaultPayload<ArgsData, ReturnTy>;
/// A dynamic runtime API payload.
pub type DynamicPayload = DefaultPayload<Composite<()>, DecodedValueThunk>;
impl<ArgsData: EncodeAsFields, ReturnTy: DecodeWithMetadata> Payload
for DefaultPayload<ArgsData, ReturnTy>
{
type ReturnType = ReturnTy;
@@ -115,17 +120,14 @@ impl<ArgsData: EncodeAsFields, ReturnTy: DecodeWithMetadata> PayloadT
}
}
/// A dynamic runtime API payload.
pub type DynamicPayload = Payload<Composite<()>, DecodedValueThunk>;
impl<ReturnTy, ArgsData> Payload<ArgsData, ReturnTy> {
/// Create a new [`Payload`].
impl<ReturnTy, ArgsData> DefaultPayload<ArgsData, ReturnTy> {
/// Create a new [`DefaultPayload`].
pub fn new(
trait_name: impl Into<String>,
method_name: impl Into<String>,
args_data: ArgsData,
) -> Self {
Payload {
DefaultPayload {
trait_name: Cow::Owned(trait_name.into()),
method_name: Cow::Owned(method_name.into()),
args_data,
@@ -134,7 +136,7 @@ impl<ReturnTy, ArgsData> Payload<ArgsData, ReturnTy> {
}
}
/// Create a new static [`Payload`] using static function name
/// Create a new static [`DefaultPayload`] using static function name
/// and scale-encoded argument data.
///
/// This is only expected to be used from codegen.
@@ -144,8 +146,8 @@ impl<ReturnTy, ArgsData> Payload<ArgsData, ReturnTy> {
method_name: &'static str,
args_data: ArgsData,
hash: [u8; 32],
) -> Payload<ArgsData, ReturnTy> {
Payload {
) -> DefaultPayload<ArgsData, ReturnTy> {
DefaultPayload {
trait_name: Cow::Borrowed(trait_name),
method_name: Cow::Borrowed(method_name),
args_data,
@@ -184,5 +186,5 @@ pub fn dynamic(
method_name: impl Into<String>,
args_data: impl Into<Composite<()>>,
) -> DynamicPayload {
Payload::new(trait_name, method_name, args_data.into())
DefaultPayload::new(trait_name, method_name, args_data.into())
}
+10 -7
View File
@@ -21,7 +21,7 @@ pub use super::storage_key::{StaticStorageKey, StorageHashers, StorageHashersIte
/// This represents a storage address. Anything implementing this trait
/// can be used to fetch and iterate over storage entries.
pub trait AddressT {
pub trait Address {
/// The target type of the value that lives at this address.
type Target: DecodeWithMetadata;
/// The keys type used to construct this address.
@@ -57,7 +57,7 @@ pub trait AddressT {
/// A concrete storage address. This can be created from static values (ie those generated
/// via the `subxt` macro) or dynamic values via [`dynamic`].
#[derive_where(Clone, Debug, Eq, Ord, PartialEq, PartialOrd; Keys)]
pub struct Address<Keys: StorageKey, ReturnTy, Fetchable, Defaultable, Iterable> {
pub struct DefaultAddress<Keys: StorageKey, ReturnTy, Fetchable, Defaultable, Iterable> {
pallet_name: Cow<'static, str>,
entry_name: Cow<'static, str>,
keys: Keys,
@@ -65,9 +65,12 @@ pub struct Address<Keys: StorageKey, ReturnTy, Fetchable, Defaultable, Iterable>
_marker: core::marker::PhantomData<(ReturnTy, Fetchable, Defaultable, Iterable)>,
}
/// A storage address constructed by the static codegen.
pub type StaticAddress<Keys, ReturnTy, Fetchable, Defaultable, Iterable> =
DefaultAddress<Keys, ReturnTy, Fetchable, Defaultable, Iterable>;
/// A typical storage address constructed at runtime rather than via the `subxt` macro; this
/// has no restriction on what it can be used for (since we don't statically know).
pub type DynamicAddress<Keys> = Address<Keys, DecodedValueThunk, Yes, Yes, Yes>;
pub type DynamicAddress<Keys> = DefaultAddress<Keys, DecodedValueThunk, Yes, Yes, Yes>;
impl<Keys: StorageKey> DynamicAddress<Keys> {
/// Creates a new dynamic address. As `Keys` you can use a `Vec<scale_value::Value>`
@@ -83,7 +86,7 @@ impl<Keys: StorageKey> DynamicAddress<Keys> {
}
impl<Keys, ReturnTy, Fetchable, Defaultable, Iterable>
Address<Keys, ReturnTy, Fetchable, Defaultable, Iterable>
DefaultAddress<Keys, ReturnTy, Fetchable, Defaultable, Iterable>
where
Keys: StorageKey,
ReturnTy: DecodeWithMetadata,
@@ -108,7 +111,7 @@ where
}
impl<Keys, ReturnTy, Fetchable, Defaultable, Iterable>
Address<Keys, ReturnTy, Fetchable, Defaultable, Iterable>
DefaultAddress<Keys, ReturnTy, Fetchable, Defaultable, Iterable>
where
Keys: StorageKey,
ReturnTy: DecodeWithMetadata,
@@ -127,8 +130,8 @@ where
}
}
impl<Keys, ReturnTy, Fetchable, Defaultable, Iterable> AddressT
for Address<Keys, ReturnTy, Fetchable, Defaultable, Iterable>
impl<Keys, ReturnTy, Fetchable, Defaultable, Iterable> Address
for DefaultAddress<Keys, ReturnTy, Fetchable, Defaultable, Iterable>
where
Keys: StorageKey,
ReturnTy: DecodeWithMetadata,
+13 -13
View File
@@ -47,7 +47,7 @@ mod utils;
pub mod address;
use crate::{error::MetadataError, metadata::DecodeWithMetadata, Error, Metadata};
use address::AddressT;
use address::Address;
use alloc::vec::Vec;
// This isn't a part of the public API, but expose here because it's useful in Subxt.
@@ -59,7 +59,7 @@ pub use utils::lookup_storage_entry_details;
///
/// When the provided `address` is dynamic (and thus does not come with any expectation of the
/// shape of the constant value), this just returns `Ok(())`
pub fn validate<Address: AddressT>(address: &Address, metadata: &Metadata) -> Result<(), Error> {
pub fn validate<Addr: Address>(address: &Addr, metadata: &Metadata) -> Result<(), Error> {
let Some(hash) = address.validation_hash() else {
return Ok(());
};
@@ -80,8 +80,8 @@ pub fn validate<Address: AddressT>(address: &Address, metadata: &Metadata) -> Re
/// Given a storage address and some metadata, this encodes the address into bytes which can be
/// handed to a node to retrieve the corresponding value.
pub fn get_address_bytes<Address: AddressT>(
address: &Address,
pub fn get_address_bytes<Addr: Address>(
address: &Addr,
metadata: &Metadata,
) -> Result<Vec<u8>, Error> {
let mut bytes = Vec::new();
@@ -93,7 +93,7 @@ pub fn get_address_bytes<Address: AddressT>(
/// Given a storage address and some metadata, this encodes the root of the address (ie the pallet
/// and storage entry part) into bytes. If the entry being addressed is inside a map, this returns
/// the bytes needed to iterate over all of the entries within it.
pub fn get_address_root_bytes<Address: AddressT>(address: &Address) -> Vec<u8> {
pub fn get_address_root_bytes<Addr: Address>(address: &Addr) -> Vec<u8> {
let mut bytes = Vec::new();
utils::write_storage_address_root_bytes(address, &mut bytes);
bytes
@@ -102,11 +102,11 @@ pub fn get_address_root_bytes<Address: AddressT>(address: &Address) -> Vec<u8> {
/// Given some storage value that we've retrieved from a node, the address used to retrieve it, and
/// metadata from the node, this function attempts to decode the bytes into the target value specified
/// by the address.
pub fn decode_value<Address: AddressT>(
pub fn decode_value<Addr: Address>(
bytes: &mut &[u8],
address: &Address,
address: &Addr,
metadata: &Metadata,
) -> Result<Address::Target, Error> {
) -> Result<Addr::Target, Error> {
let pallet_name = address.pallet_name();
let entry_name = address.entry_name();
@@ -117,15 +117,15 @@ pub fn decode_value<Address: AddressT>(
subxt_metadata::StorageEntryType::Map { value_ty, .. } => *value_ty,
};
let val = Address::Target::decode_with_metadata(bytes, value_ty_id, metadata)?;
let val = Addr::Target::decode_with_metadata(bytes, value_ty_id, metadata)?;
Ok(val)
}
/// Return the default value at a given storage address if one is available, or an error otherwise.
pub fn default_value<Address: AddressT>(
address: &Address,
pub fn default_value<Addr: Address>(
address: &Addr,
metadata: &Metadata,
) -> Result<Address::Target, Error> {
) -> Result<Addr::Target, Error> {
let pallet_name = address.pallet_name();
let entry_name = address.entry_name();
@@ -137,6 +137,6 @@ pub fn default_value<Address: AddressT>(
};
let default_bytes = entry_metadata.default_bytes();
let val = Address::Target::decode_with_metadata(&mut &*default_bytes, value_ty_id, metadata)?;
let val = Addr::Target::decode_with_metadata(&mut &*default_bytes, value_ty_id, metadata)?;
Ok(val)
}
+4 -4
View File
@@ -2,20 +2,20 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
//! these utility methods complement the [`AddressT`] trait, but
//! these utility methods complement the [`Address`] trait, but
//! aren't things that should ever be overridden, and so don't exist on
//! the trait itself.
use super::address::AddressT;
use super::address::Address;
use crate::error::{Error, MetadataError};
use crate::metadata::Metadata;
use alloc::borrow::ToOwned;
use alloc::vec::Vec;
use subxt_metadata::{PalletMetadata, StorageEntryMetadata, StorageHasher};
/// Return the root of a given [`AddressT`]: hash the pallet name and entry name
/// Return the root of a given [`Address`]: hash the pallet name and entry name
/// and append those bytes to the output.
pub fn write_storage_address_root_bytes<Address: AddressT>(addr: &Address, out: &mut Vec<u8>) {
pub fn write_storage_address_root_bytes<Addr: Address>(addr: &Addr, out: &mut Vec<u8>) {
out.extend(sp_crypto_hashing::twox_128(addr.pallet_name().as_bytes()));
out.extend(sp_crypto_hashing::twox_128(addr.entry_name().as_bytes()));
}
+6 -6
View File
@@ -64,7 +64,7 @@ use crate::utils::Encoded;
use alloc::borrow::{Cow, ToOwned};
use alloc::vec::Vec;
use codec::{Compact, Encode};
use payload::PayloadT;
use payload::Payload;
use signer::Signer as SignerT;
use sp_crypto_hashing::blake2_256;
@@ -75,7 +75,7 @@ pub use crate::client::{ClientState, RuntimeVersion};
/// if the call is valid (or if it's not possible to check since the call has no validation hash).
/// Return an error if the call was not valid or something went wrong trying to validate it (ie
/// the pallet or call in question do not exist at all).
pub fn validate<Call: PayloadT>(call: &Call, metadata: &Metadata) -> Result<(), Error> {
pub fn validate<Call: Payload>(call: &Call, metadata: &Metadata) -> Result<(), Error> {
if let Some(details) = call.validation_details() {
let expected_hash = metadata
.pallet_by_name_err(details.pallet_name)?
@@ -90,14 +90,14 @@ pub fn validate<Call: PayloadT>(call: &Call, metadata: &Metadata) -> Result<(),
}
/// Return the SCALE encoded bytes representing the call data of the transaction.
pub fn call_data<Call: PayloadT>(call: &Call, metadata: &Metadata) -> Result<Vec<u8>, Error> {
pub fn call_data<Call: Payload>(call: &Call, metadata: &Metadata) -> Result<Vec<u8>, Error> {
let mut bytes = Vec::new();
call.encode_call_data_to(metadata, &mut bytes)?;
Ok(bytes)
}
/// Creates an unsigned extrinsic without submitting it.
pub fn create_unsigned<T: Config, Call: PayloadT>(
pub fn create_unsigned<T: Config, Call: Payload>(
call: &Call,
metadata: &Metadata,
) -> Result<Transaction<T>, Error> {
@@ -130,7 +130,7 @@ pub fn create_unsigned<T: Config, Call: PayloadT>(
///
/// Note: if not provided, the default account nonce will be set to 0 and the default mortality will be _immortal_.
/// This is because this method runs offline, and so is unable to fetch the data needed for more appropriate values.
pub fn create_partial_signed<T: Config, Call: PayloadT>(
pub fn create_partial_signed<T: Config, Call: Payload>(
call: &Call,
client_state: &ClientState<T>,
params: <T::ExtrinsicParams as ExtrinsicParams<T>>::Params,
@@ -165,7 +165,7 @@ pub fn create_signed<T, Call, Signer>(
) -> Result<Transaction<T>, Error>
where
T: Config,
Call: PayloadT,
Call: Payload,
Signer: SignerT<T>,
{
// 1. Validate this call against the current node metadata if the call comes
+15 -13
View File
@@ -18,12 +18,12 @@ use scale_value::{Composite, Value, ValueDef, Variant};
/// This represents a transaction payload that can be submitted
/// to a node.
pub trait PayloadT {
pub trait Payload {
/// Encode call data to the provided output.
fn encode_call_data_to(&self, metadata: &Metadata, out: &mut Vec<u8>) -> Result<(), Error>;
/// Encode call data and return the output. This is a convenience
/// wrapper around [`PayloadT::encode_call_data_to`].
/// wrapper around [`Payload::encode_call_data_to`].
fn encode_call_data(&self, metadata: &Metadata) -> Result<Vec<u8>, Error> {
let mut v = Vec::new();
self.encode_call_data_to(metadata, &mut v)?;
@@ -51,24 +51,26 @@ pub struct ValidationDetails<'a> {
/// A transaction payload containing some generic `CallData`.
#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct Payload<CallData> {
pub struct DefaultPayload<CallData> {
pallet_name: Cow<'static, str>,
call_name: Cow<'static, str>,
call_data: CallData,
validation_hash: Option<[u8; 32]>,
}
/// The payload type used by static codegen.
pub type StaticPayload<Calldata> = DefaultPayload<Calldata>;
/// The type of a payload typically used for dynamic transaction payloads.
pub type DynamicPayload = Payload<Composite<()>>;
pub type DynamicPayload = DefaultPayload<Composite<()>>;
impl<CallData> Payload<CallData> {
/// Create a new [`Payload`].
impl<CallData> DefaultPayload<CallData> {
/// Create a new [`DefaultPayload`].
pub fn new(
pallet_name: impl Into<String>,
call_name: impl Into<String>,
call_data: CallData,
) -> Self {
Payload {
DefaultPayload {
pallet_name: Cow::Owned(pallet_name.into()),
call_name: Cow::Owned(call_name.into()),
call_data,
@@ -76,7 +78,7 @@ impl<CallData> Payload<CallData> {
}
}
/// Create a new [`Payload`] using static strings for the pallet and call name.
/// Create a new [`DefaultPayload`] using static strings for the pallet and call name.
/// This is only expected to be used from codegen.
#[doc(hidden)]
pub fn new_static(
@@ -85,7 +87,7 @@ impl<CallData> Payload<CallData> {
call_data: CallData,
validation_hash: [u8; 32],
) -> Self {
Payload {
DefaultPayload {
pallet_name: Cow::Borrowed(pallet_name),
call_name: Cow::Borrowed(call_name),
call_data,
@@ -117,7 +119,7 @@ impl<CallData> Payload<CallData> {
}
}
impl Payload<Composite<()>> {
impl DefaultPayload<Composite<()>> {
/// Convert the dynamic `Composite` payload into a [`Value`].
/// This is useful if you want to use this as an argument for a
/// larger dynamic call that wants to use this as a nested call.
@@ -134,7 +136,7 @@ impl Payload<Composite<()>> {
}
}
impl<CallData: EncodeAsFields> PayloadT for Payload<CallData> {
impl<CallData: EncodeAsFields> Payload for DefaultPayload<CallData> {
fn encode_call_data_to(&self, metadata: &Metadata, out: &mut Vec<u8>) -> Result<(), Error> {
let pallet = metadata.pallet_by_name_err(&self.pallet_name)?;
let call = pallet
@@ -167,12 +169,12 @@ impl<CallData: EncodeAsFields> PayloadT for Payload<CallData> {
}
}
/// Construct a transaction at runtime; essentially an alias to [`Payload::new()`]
/// Construct a transaction at runtime; essentially an alias to [`DefaultPayload::new()`]
/// which provides a [`Composite`] value for the call data.
pub fn dynamic(
pallet_name: impl Into<String>,
call_name: impl Into<String>,
call_data: impl Into<Composite<()>>,
) -> DynamicPayload {
Payload::new(pallet_name, call_name, call_data.into())
DefaultPayload::new(pallet_name, call_name, call_data.into())
}
+1 -1
View File
@@ -5,7 +5,7 @@ use subxt::{OnlineClient, PolkadotConfig};
use subxt::config::DefaultExtrinsicParamsBuilder;
use subxt::ext::codec::{Decode, Encode};
use subxt::tx::PayloadT as _;
use subxt::tx::Payload as _;
use subxt::tx::SubmittableExtrinsic;
use subxt::utils::{AccountId32, MultiSignature};
+1 -1
View File
@@ -40,7 +40,7 @@
//! );
//! ```
//!
//! All valid runtime calls implement [`crate::runtime_api::PayloadT`], a trait which
//! All valid runtime calls implement [`crate::runtime_api::Payload`], a trait which
//! describes how to encode the runtime call arguments and what return type to decode from the
//! response.
//!
+2 -2
View File
@@ -66,7 +66,7 @@
//! - `runtime::storage().foo().bar_iter3(u8, bool, u16)`: iterate over all of the entries in the "bar" map under
//! a given `u8`, `bool` and `u16` value.
//!
//! All valid storage queries implement [`crate::storage::AddressT`]. As well as describing
//! All valid storage queries implement [`crate::storage::Address`]. As well as describing
//! how to build a valid storage query, this trait also has some associated types that determine the
//! shape of the result you'll get back, and determine what you can do with it (ie, can you iterate
//! over storage entries using it).
@@ -124,7 +124,7 @@
//!
//! For more advanced use cases, have a look at [`crate::storage::Storage::fetch_raw`] and
//! [`crate::storage::Storage::fetch_raw_keys`]. Both of these take raw bytes as arguments, which can be
//! obtained from a [`crate::storage::AddressT`] by using
//! obtained from a [`crate::storage::Address`] by using
//! [`crate::storage::StorageClient::address_bytes()`] or
//! [`crate::storage::StorageClient::address_root_bytes()`].
//!
+1 -1
View File
@@ -53,7 +53,7 @@
//! represents any type of data that can be SCALE encoded or decoded. It can be serialized,
//! deserialized and parsed from/to strings.
//!
//! A valid transaction payload is just something that implements the [`crate::tx::PayloadT`] trait;
//! A valid transaction payload is just something that implements the [`crate::tx::Payload`] trait;
//! you can implement this trait on your own custom types if the built-in ones are not suitable for
//! your needs.
//!
+3 -3
View File
@@ -4,7 +4,7 @@
use crate::{client::OfflineClientT, error::Error, Config};
use derive_where::derive_where;
use subxt_core::constants::address::AddressT;
use subxt_core::constants::address::Address;
/// A client for accessing constants.
#[derive_where(Clone; Client)]
@@ -28,7 +28,7 @@ impl<T: Config, Client: OfflineClientT<T>> ConstantsClient<T, Client> {
/// if the address is valid (or if it's not possible to check since the address has no validation hash).
/// Return an error if the address was not valid or something went wrong trying to validate it (ie
/// the pallet or constant in question do not exist at all).
pub fn validate<Address: AddressT>(&self, address: &Address) -> Result<(), Error> {
pub fn validate<Addr: Address>(&self, address: &Addr) -> Result<(), Error> {
let metadata = self.client.metadata();
subxt_core::constants::validate(address, &metadata).map_err(Error::from)
}
@@ -36,7 +36,7 @@ impl<T: Config, Client: OfflineClientT<T>> ConstantsClient<T, Client> {
/// Access the constant at the address given, returning the type defined by this address.
/// This is probably used with addresses given from static codegen, although you can manually
/// construct your own, too.
pub fn at<Address: AddressT>(&self, address: &Address) -> Result<Address::Target, Error> {
pub fn at<Addr: Address>(&self, address: &Addr) -> Result<Addr::Target, Error> {
let metadata = self.client.metadata();
subxt_core::constants::get(address, &metadata).map_err(Error::from)
}
+3 -1
View File
@@ -7,4 +7,6 @@
mod constants_client;
pub use constants_client::ConstantsClient;
pub use subxt_core::constants::address::{dynamic, Address, AddressT, DynamicAddress};
pub use subxt_core::constants::address::{
dynamic, Address, DefaultAddress, DynamicAddress, StaticAddress,
};
@@ -2,7 +2,7 @@ use crate::client::OfflineClientT;
use crate::{Config, Error};
use derive_where::derive_where;
use subxt_core::custom_values::address::{AddressT, Yes};
use subxt_core::custom_values::address::{Address, Yes};
/// A client for accessing custom values stored in the metadata.
#[derive_where(Clone; Client)]
@@ -24,25 +24,22 @@ impl<T, Client> CustomValuesClient<T, Client> {
impl<T: Config, Client: OfflineClientT<T>> CustomValuesClient<T, Client> {
/// Access a custom value by the address it is registered under. This can be just a [str] to get back a dynamic value,
/// or a static address from the generated static interface to get a value of a static type returned.
pub fn at<Address: AddressT<IsDecodable = Yes> + ?Sized>(
pub fn at<Addr: Address<IsDecodable = Yes> + ?Sized>(
&self,
address: &Address,
) -> Result<Address::Target, Error> {
address: &Addr,
) -> Result<Addr::Target, Error> {
subxt_core::custom_values::get(address, &self.client.metadata()).map_err(Into::into)
}
/// Access the bytes of a custom value by the address it is registered under.
pub fn bytes_at<Address: AddressT + ?Sized>(
&self,
address: &Address,
) -> Result<Vec<u8>, Error> {
pub fn bytes_at<Addr: Address + ?Sized>(&self, address: &Addr) -> Result<Vec<u8>, Error> {
subxt_core::custom_values::get_bytes(address, &self.client.metadata()).map_err(Into::into)
}
/// Run the validation logic against some custom value address you'd like to access. Returns `Ok(())`
/// if the address is valid (or if it's not possible to check since the address has no validation hash).
/// Returns an error if the address was not valid (wrong name, type or raw bytes)
pub fn validate<Address: AddressT + ?Sized>(&self, address: &Address) -> Result<(), Error> {
pub fn validate<Addr: Address + ?Sized>(&self, address: &Addr) -> Result<(), Error> {
subxt_core::custom_values::validate(address, &self.client.metadata()).map_err(Into::into)
}
}
+1 -1
View File
@@ -7,4 +7,4 @@
mod custom_values_client;
pub use custom_values_client::CustomValuesClient;
pub use subxt_core::custom_values::address::{AddressT, StaticAddress, Yes};
pub use subxt_core::custom_values::address::{Address, StaticAddress, Yes};
+3 -1
View File
@@ -9,4 +9,6 @@ mod runtime_types;
pub use runtime_client::RuntimeApiClient;
pub use runtime_types::RuntimeApi;
pub use subxt_core::runtime_api::payload::{dynamic, DynamicPayload, Payload, PayloadT};
pub use subxt_core::runtime_api::payload::{
dynamic, DefaultPayload, DynamicPayload, Payload, StaticPayload,
};
+3 -3
View File
@@ -2,7 +2,7 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use super::PayloadT;
use super::Payload;
use crate::{
backend::{BackendExt, BlockRef},
client::OnlineClientT,
@@ -41,7 +41,7 @@ where
/// if the payload is valid (or if it's not possible to check since the payload has no validation hash).
/// Return an error if the payload was not valid or something went wrong trying to validate it (ie
/// the runtime API in question do not exist at all)
pub fn validate<Call: PayloadT>(&self, payload: &Call) -> Result<(), Error> {
pub fn validate<Call: Payload>(&self, payload: &Call) -> Result<(), Error> {
subxt_core::runtime_api::validate(payload, &self.client.metadata()).map_err(Into::into)
}
@@ -65,7 +65,7 @@ where
}
/// Execute a runtime API call.
pub fn call<Call: PayloadT>(
pub fn call<Call: Payload>(
&self,
payload: Call,
) -> impl Future<Output = Result<Call::ReturnType, Error>> {
+1 -1
View File
@@ -10,5 +10,5 @@ mod storage_type;
pub use storage_client::StorageClient;
pub use storage_type::{Storage, StorageKeyValuePair};
pub use subxt_core::storage::address::{
dynamic, Address, AddressT, DynamicAddress, StaticStorageKey, StorageKey,
dynamic, Address, DefaultAddress, DynamicAddress, StaticAddress, StaticStorageKey, StorageKey,
};
+5 -5
View File
@@ -11,7 +11,7 @@ use crate::{
};
use derive_where::derive_where;
use std::{future::Future, marker::PhantomData};
use subxt_core::storage::address::AddressT;
use subxt_core::storage::address::Address;
/// Query the runtime storage.
#[derive_where(Clone; Client)]
@@ -39,22 +39,22 @@ where
/// if the address is valid (or if it's not possible to check since the address has no validation hash).
/// Return an error if the address was not valid or something went wrong trying to validate it (ie
/// the pallet or storage entry in question do not exist at all).
pub fn validate<Address: AddressT>(&self, address: &Address) -> Result<(), Error> {
pub fn validate<Addr: Address>(&self, address: &Addr) -> Result<(), Error> {
subxt_core::storage::validate(address, &self.client.metadata()).map_err(Into::into)
}
/// Convert some storage address into the raw bytes that would be submitted to the node in order
/// to retrieve the entries at the root of the associated address.
pub fn address_root_bytes<Address: AddressT>(&self, address: &Address) -> Vec<u8> {
pub fn address_root_bytes<Addr: Address>(&self, address: &Addr) -> Vec<u8> {
subxt_core::storage::get_address_root_bytes(address)
}
/// Convert some storage address into the raw bytes that would be submitted to the node in order
/// to retrieve an entry. This fails if [`AddressT::append_entry_bytes`] does; in the built-in
/// to retrieve an entry. This fails if [`Address::append_entry_bytes`] does; in the built-in
/// implementation this would be if the pallet and storage entry being asked for is not available on the
/// node you're communicating with, or if the metadata is missing some type information (which should not
/// happen).
pub fn address_bytes<Address: AddressT>(&self, address: &Address) -> Result<Vec<u8>, Error> {
pub fn address_bytes<Addr: Address>(&self, address: &Addr) -> Result<Vec<u8>, Error> {
subxt_core::storage::get_address_bytes(address, &self.client.metadata()).map_err(Into::into)
}
}
+18 -18
View File
@@ -13,7 +13,7 @@ use codec::Decode;
use derive_where::derive_where;
use futures::StreamExt;
use std::{future::Future, marker::PhantomData};
use subxt_core::storage::address::{AddressT, StorageHashers, StorageKey};
use subxt_core::storage::address::{Address, StorageHashers, StorageKey};
use subxt_core::utils::Yes;
/// This is returned from a couple of storage functions.
@@ -110,12 +110,12 @@ where
/// println!("Value: {:?}", value);
/// # }
/// ```
pub fn fetch<'address, Address>(
pub fn fetch<'address, Addr>(
&self,
address: &'address Address,
) -> impl Future<Output = Result<Option<Address::Target>, Error>> + 'address
address: &'address Addr,
) -> impl Future<Output = Result<Option<Addr::Target>, Error>> + 'address
where
Address: AddressT<IsFetchable = Yes> + 'address,
Addr: Address<IsFetchable = Yes> + 'address,
{
let client = self.clone();
async move {
@@ -139,12 +139,12 @@ where
}
/// Fetch a StorageKey that has a default value with an optional block hash.
pub fn fetch_or_default<'address, Address>(
pub fn fetch_or_default<'address, Addr>(
&self,
address: &'address Address,
) -> impl Future<Output = Result<Address::Target, Error>> + 'address
address: &'address Addr,
) -> impl Future<Output = Result<Addr::Target, Error>> + 'address
where
Address: AddressT<IsFetchable = Yes, IsDefaultable = Yes> + 'address,
Addr: Address<IsFetchable = Yes, IsDefaultable = Yes> + 'address,
{
let client = self.clone();
async move {
@@ -190,13 +190,13 @@ where
/// }
/// # }
/// ```
pub fn iter<Address>(
pub fn iter<Addr>(
&self,
address: Address,
) -> impl Future<Output = Result<StreamOfResults<StorageKeyValuePair<Address>>, Error>> + 'static
address: Addr,
) -> impl Future<Output = Result<StreamOfResults<StorageKeyValuePair<Addr>>, Error>> + 'static
where
Address: AddressT<IsIterable = Yes> + 'static,
Address::Keys: 'static + Sized,
Addr: Address<IsIterable = Yes> + 'static,
Addr::Keys: 'static + Sized,
{
let client = self.client.clone();
let block_ref = self.block_ref.clone();
@@ -233,7 +233,7 @@ where
Ok(kv) => kv,
Err(e) => return Err(e),
};
let value = Address::Target::decode_with_metadata(
let value = Addr::Target::decode_with_metadata(
&mut &*kv.value,
return_type_id,
&metadata,
@@ -243,13 +243,13 @@ where
let cursor = &mut &key_bytes[..];
strip_storage_address_root_bytes(cursor)?;
let keys = <Address::Keys as StorageKey>::decode_storage_key(
let keys = <Addr::Keys as StorageKey>::decode_storage_key(
cursor,
&mut hashers.iter(),
metadata.types(),
)?;
Ok(StorageKeyValuePair::<Address> {
Ok(StorageKeyValuePair::<Addr> {
keys,
key_bytes,
value,
@@ -313,7 +313,7 @@ fn strip_storage_address_root_bytes(address_bytes: &mut &[u8]) -> Result<(), Sto
/// A pair of keys and values together with all the bytes that make up the storage address.
/// `keys` is `None` if non-concat hashers are used. In this case the keys could not be extracted back from the key_bytes.
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
pub struct StorageKeyValuePair<T: AddressT> {
pub struct StorageKeyValuePair<T: Address> {
/// The bytes that make up the address of the storage entry.
pub key_bytes: Vec<u8>,
/// The keys that can be used to construct the address of this storage entry.
+1 -1
View File
@@ -20,7 +20,7 @@ cfg_substrate_compat! {
pub use subxt_core::tx::signer::PairSigner;
}
pub use subxt_core::tx::payload::{dynamic, DynamicPayload, Payload, PayloadT};
pub use subxt_core::tx::payload::{dynamic, DefaultPayload, DynamicPayload, Payload};
pub use subxt_core::tx::signer::{self, Signer};
pub use tx_client::{
PartialExtrinsic, SubmittableExtrinsic, TransactionInvalid, TransactionUnknown, TxClient,
+12 -12
View File
@@ -7,7 +7,7 @@ use crate::{
client::{OfflineClientT, OnlineClientT},
config::{Config, ExtrinsicParams, Header, RefineParams, RefineParamsData},
error::{BlockError, Error},
tx::{PayloadT, Signer as SignerT, TxProgress},
tx::{Payload, Signer as SignerT, TxProgress},
utils::PhantomDataSendSync,
};
use codec::{Compact, Decode, Encode};
@@ -37,7 +37,7 @@ impl<T: Config, C: OfflineClientT<T>> TxClient<T, C> {
/// the pallet or call in question do not exist at all).
pub fn validate<Call>(&self, call: &Call) -> Result<(), Error>
where
Call: PayloadT,
Call: Payload,
{
subxt_core::tx::validate(call, &self.client.metadata()).map_err(Into::into)
}
@@ -45,7 +45,7 @@ impl<T: Config, C: OfflineClientT<T>> TxClient<T, C> {
/// Return the SCALE encoded bytes representing the call data of the transaction.
pub fn call_data<Call>(&self, call: &Call) -> Result<Vec<u8>, Error>
where
Call: PayloadT,
Call: Payload,
{
subxt_core::tx::call_data(call, &self.client.metadata()).map_err(Into::into)
}
@@ -53,7 +53,7 @@ impl<T: Config, C: OfflineClientT<T>> TxClient<T, C> {
/// Creates an unsigned extrinsic without submitting it.
pub fn create_unsigned<Call>(&self, call: &Call) -> Result<SubmittableExtrinsic<T, C>, Error>
where
Call: PayloadT,
Call: Payload,
{
subxt_core::tx::create_unsigned(call, &self.client.metadata())
.map(|tx| SubmittableExtrinsic {
@@ -73,7 +73,7 @@ impl<T: Config, C: OfflineClientT<T>> TxClient<T, C> {
params: <T::ExtrinsicParams as ExtrinsicParams<T>>::Params,
) -> Result<PartialExtrinsic<T, C>, Error>
where
Call: PayloadT,
Call: Payload,
{
subxt_core::tx::create_partial_signed(call, &self.client.client_state(), params)
.map(|tx| PartialExtrinsic {
@@ -94,7 +94,7 @@ impl<T: Config, C: OfflineClientT<T>> TxClient<T, C> {
params: <T::ExtrinsicParams as ExtrinsicParams<T>>::Params,
) -> Result<SubmittableExtrinsic<T, C>, Error>
where
Call: PayloadT,
Call: Payload,
Signer: SignerT<T>,
{
subxt_core::tx::create_signed(call, &self.client.client_state(), signer, params)
@@ -149,7 +149,7 @@ where
mut params: <T::ExtrinsicParams as ExtrinsicParams<T>>::Params,
) -> Result<PartialExtrinsic<T, C>, Error>
where
Call: PayloadT,
Call: Payload,
{
// Refine the params by adding account nonce and latest block information:
self.refine_params(account_id, &mut params).await?;
@@ -165,7 +165,7 @@ where
params: <T::ExtrinsicParams as ExtrinsicParams<T>>::Params,
) -> Result<SubmittableExtrinsic<T, C>, Error>
where
Call: PayloadT,
Call: Payload,
Signer: SignerT<T>,
{
// 1. Validate this call against the current node metadata if the call comes
@@ -193,7 +193,7 @@ where
signer: &Signer,
) -> Result<TxProgress<T, C>, Error>
where
Call: PayloadT,
Call: Payload,
Signer: SignerT<T>,
<T::ExtrinsicParams as ExtrinsicParams<T>>::Params: Default,
{
@@ -212,7 +212,7 @@ where
params: <T::ExtrinsicParams as ExtrinsicParams<T>>::Params,
) -> Result<TxProgress<T, C>, Error>
where
Call: PayloadT,
Call: Payload,
Signer: SignerT<T>,
{
self.create_signed(call, signer, params)
@@ -237,7 +237,7 @@ where
signer: &Signer,
) -> Result<T::Hash, Error>
where
Call: PayloadT,
Call: Payload,
Signer: SignerT<T>,
<T::ExtrinsicParams as ExtrinsicParams<T>>::Params: Default,
{
@@ -259,7 +259,7 @@ where
params: <T::ExtrinsicParams as ExtrinsicParams<T>>::Params,
) -> Result<T::Hash, Error>
where
Call: PayloadT,
Call: Payload,
Signer: SignerT<T>,
{
self.create_signed(call, signer, params)
File diff suppressed because it is too large Load Diff