diff --git a/examples/examples/benchmark_bulk_xt.rs b/examples/examples/benchmark_bulk_xt.rs index b60b327a9..96152ab34 100644 --- a/examples/examples/benchmark_bulk_xt.rs +++ b/examples/examples/benchmark_bulk_xt.rs @@ -28,7 +28,7 @@ use substrate_api_client::{ Api, SubmitExtrinsic, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/compose_extrinsic_offline.rs b/examples/examples/compose_extrinsic_offline.rs index b3be3963a..5c274d460 100644 --- a/examples/examples/compose_extrinsic_offline.rs +++ b/examples/examples/compose_extrinsic_offline.rs @@ -25,7 +25,7 @@ use substrate_api_client::{ Api, GetHeader, SubmitAndWatch, XtStatus, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/contract_instantiate_with_code.rs b/examples/examples/contract_instantiate_with_code.rs index f4761e96a..46e029b3f 100644 --- a/examples/examples/contract_instantiate_with_code.rs +++ b/examples/examples/contract_instantiate_with_code.rs @@ -25,7 +25,7 @@ use substrate_api_client::{ SubmitAndWatch, SubmitAndWatchUntilSuccess, XtStatus, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/custom_nonce.rs b/examples/examples/custom_nonce.rs index 2b744f20b..e4592b266 100644 --- a/examples/examples/custom_nonce.rs +++ b/examples/examples/custom_nonce.rs @@ -25,7 +25,7 @@ use substrate_api_client::{ Api, Error, GetHeader, SubmitAndWatch, UnexpectedTxStatus, XtStatus, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/event_error_details.rs b/examples/examples/event_error_details.rs index 252eb64df..9c7503c50 100644 --- a/examples/examples/event_error_details.rs +++ b/examples/examples/event_error_details.rs @@ -24,7 +24,7 @@ use substrate_api_client::{ Api, GetAccountInformation, SubmitAndWatchUntilSuccess, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/get_account_identity.rs b/examples/examples/get_account_identity.rs index 71b385ba0..f0407fa18 100644 --- a/examples/examples/get_account_identity.rs +++ b/examples/examples/get_account_identity.rs @@ -34,7 +34,7 @@ type BalanceOf = <::Currency as Currency< type MaxRegistrarsOf = ::MaxRegistrars; type MaxAdditionalFieldsOf = ::MaxAdditionalFields; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/get_blocks.rs b/examples/examples/get_blocks.rs index 9ae21ad21..3e280e781 100644 --- a/examples/examples/get_blocks.rs +++ b/examples/examples/get_blocks.rs @@ -23,7 +23,7 @@ use substrate_api_client::{ Api, GetBlock, GetHeader, SubscribeChain, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/get_storage.rs b/examples/examples/get_storage.rs index 0c4f06b6f..e9c508898 100644 --- a/examples/examples/get_storage.rs +++ b/examples/examples/get_storage.rs @@ -24,7 +24,7 @@ use substrate_api_client::{ Api, GetAccountInformation, GetStorage, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the different related types. diff --git a/examples/examples/print_metadata.rs b/examples/examples/print_metadata.rs index 941a9e378..ec599e653 100644 --- a/examples/examples/print_metadata.rs +++ b/examples/examples/print_metadata.rs @@ -19,12 +19,12 @@ use sp_runtime::traits::GetRuntimeBlockType; use substrate_api_client::{ac_primitives::SubstrateConfig, rpc::JsonrpseeClient, Api}; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. type KitchensinkConfig = -SubstrateConfig<::RuntimeBlock>; + SubstrateConfig<::RuntimeBlock>; #[tokio::main] async fn main() { diff --git a/examples/examples/staking_batch_payout.rs b/examples/examples/staking_batch_payout.rs index 8b66e310e..dc48e8744 100644 --- a/examples/examples/staking_batch_payout.rs +++ b/examples/examples/staking_batch_payout.rs @@ -24,7 +24,7 @@ use substrate_api_client::{ const MAX_BATCHED_TRANSACTION: u32 = 9; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/sudo.rs b/examples/examples/sudo.rs index 492ba9cfe..1c9226e8e 100644 --- a/examples/examples/sudo.rs +++ b/examples/examples/sudo.rs @@ -31,7 +31,7 @@ use substrate_api_client::{ Api, GetAccountInformation, SubmitAndWatch, XtStatus, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/transfer_with_tungstenite_client.rs b/examples/examples/transfer_with_tungstenite_client.rs index be2471e4b..4d8bfe0e8 100755 --- a/examples/examples/transfer_with_tungstenite_client.rs +++ b/examples/examples/transfer_with_tungstenite_client.rs @@ -27,7 +27,7 @@ use substrate_api_client::{ Api, GetAccountInformation, SubmitAndWatch, XtStatus, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/examples/examples/transfer_with_ws_client.rs b/examples/examples/transfer_with_ws_client.rs index 4f9d36d04..b73dcdfcd 100755 --- a/examples/examples/transfer_with_ws_client.rs +++ b/examples/examples/transfer_with_ws_client.rs @@ -27,7 +27,7 @@ use substrate_api_client::{ Api, GetAccountInformation, SubmitAndWatch, XtStatus, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/primitives/src/config/substrate_config.rs b/primitives/src/config/substrate_config.rs index 620b62f16..d00270436 100644 --- a/primitives/src/config/substrate_config.rs +++ b/primitives/src/config/substrate_config.rs @@ -21,8 +21,6 @@ use sp_core::sr25519; use sp_runtime::{traits::Block as BlockTrait, AccountId32, MultiAddress, MultiSignature}; /// Default set of commonly used types by Substrate runtimes. -// Note: We only use this at the type level, so it should be impossible to -// create an instance of it. #[derive(Decode, Encode, Clone, Eq, PartialEq, Debug)] pub struct SubstrateConfig { _marker: PhantomData, @@ -36,7 +34,7 @@ where type Hash = H256; type AccountId = AccountId32; type Address = MultiAddress; - type Signature = MultiSignature; //sr25519::Signature + type Signature = MultiSignature; type Hasher = BlakeTwo256; type Header = SubstrateHeader; type AccountData = AccountData; diff --git a/primitives/src/extrinsics/signer.rs b/primitives/src/extrinsics/signer.rs index f963ed825..9b2a20f7f 100644 --- a/primitives/src/extrinsics/signer.rs +++ b/primitives/src/extrinsics/signer.rs @@ -20,7 +20,8 @@ use crate::config::Config; use codec::{Decode, Encode}; use core::marker::PhantomData; -use sp_core::Pair; +use sp_core::{crypto::AccountId32, Pair}; +use sp_runtime::MultiAddress; pub trait SignExtrinsic { type Signature: Encode; @@ -84,7 +85,7 @@ where &self.account_id } - fn extrinsic_address(&self) -> T::Address { + fn extrinsic_address(&self) -> Self::ExtrinsicAddress { self.extrinsic_address.clone() } } @@ -99,8 +100,7 @@ where ExtrinsicSigner::::new(value) } } -//Todo: check if still needed, because of config -/* + /// Extrinsic Signer implementation, that does not enforce Runtime as input. /// This is especially useful in no-std environments, where the runtime is not /// available. @@ -149,7 +149,6 @@ where self.extrinsic_address.clone() } } - */ #[cfg(test)] mod tests { @@ -172,7 +171,6 @@ mod tests { assert_eq!(es_converted.signer.public(), es_new.signer.public()); } - // This test does not work. See issue #504. #[test] fn test_extrinsic_signer_clone() { @@ -181,15 +179,4 @@ mod tests { let _signer2 = signer.clone(); } - - //Todo: still needed? - /* - #[test] - fn test_static_extrinsic_signer_clone() { - let pair = AccountKeyring::Alice.pair(); - let signer = StaticExtrinsicSigner::<_, Signature>::new(pair); - - let _signer2 = signer.clone(); - } - */ } diff --git a/src/api/rpc_api/chain.rs b/src/api/rpc_api/chain.rs index f38b19a3a..f42f2a8ae 100644 --- a/src/api/rpc_api/chain.rs +++ b/src/api/rpc_api/chain.rs @@ -80,7 +80,7 @@ where Client: Request, ::Number: Serialize, { - type BlockNumber = ::Number; + type BlockNumber = ::Number; type Hash = T::Hash; type Block = T::Block; diff --git a/testing/examples/author_tests.rs b/testing/examples/author_tests.rs index 84dc3ba36..bd845db8e 100644 --- a/testing/examples/author_tests.rs +++ b/testing/examples/author_tests.rs @@ -28,7 +28,7 @@ use substrate_api_client::{ Api, SubmitAndWatch, SubmitAndWatchUntilSuccess, SubmitExtrinsic, TransactionStatus, XtStatus, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/testing/examples/chain_tests.rs b/testing/examples/chain_tests.rs index 080cc4f52..5a07f3717 100644 --- a/testing/examples/chain_tests.rs +++ b/testing/examples/chain_tests.rs @@ -22,7 +22,7 @@ use substrate_api_client::{ Api, GetBlock, GetHeader, SubscribeChain, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/testing/examples/events_tests.rs b/testing/examples/events_tests.rs index 50b965eef..73446413b 100644 --- a/testing/examples/events_tests.rs +++ b/testing/examples/events_tests.rs @@ -39,7 +39,7 @@ impl StaticEvent for ExtrinsicSuccess { const EVENT: &'static str = "ExtrinsicSuccess"; } -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/testing/examples/frame_system_tests.rs b/testing/examples/frame_system_tests.rs index db181eb9c..3be0bd373 100644 --- a/testing/examples/frame_system_tests.rs +++ b/testing/examples/frame_system_tests.rs @@ -26,7 +26,7 @@ use substrate_api_client::{ Api, GetAccountInformation, SystemApi, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/testing/examples/pallet_balances_tests.rs b/testing/examples/pallet_balances_tests.rs index 53cbf0248..576532522 100644 --- a/testing/examples/pallet_balances_tests.rs +++ b/testing/examples/pallet_balances_tests.rs @@ -18,7 +18,7 @@ use sp_runtime::traits::GetRuntimeBlockType; use substrate_api_client::{ac_primitives::SubstrateConfig, rpc::JsonrpseeClient, Api, GetBalance}; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/testing/examples/pallet_transaction_payment_tests.rs b/testing/examples/pallet_transaction_payment_tests.rs index 47c9807ea..163a1f7e2 100644 --- a/testing/examples/pallet_transaction_payment_tests.rs +++ b/testing/examples/pallet_transaction_payment_tests.rs @@ -25,7 +25,7 @@ use substrate_api_client::{ Api, GetBlock, GetTransactionPayment, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the config type. diff --git a/testing/examples/state_tests.rs b/testing/examples/state_tests.rs index 7bcf631f5..c7d251aff 100644 --- a/testing/examples/state_tests.rs +++ b/testing/examples/state_tests.rs @@ -28,7 +28,7 @@ use substrate_api_client::{ Api, GetBlock, GetStorage, }; -// This example run against a specific node. +// This example run against a specific node. // We use the substrate kitchensink runtime: the config is a substrate config with the kitchensink runtime block type. // ! Careful: Most runtimes uses plain as tips, they need a polkadot config. // For better code readability, we define the related types.