Skip to content

Commit

Permalink
Clean after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
echevrier committed Apr 18, 2023
1 parent 789425e commit 7544159
Show file tree
Hide file tree
Showing 23 changed files with 27 additions and 42 deletions.
2 changes: 1 addition & 1 deletion examples/examples/benchmark_bulk_xt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/compose_extrinsic_offline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/contract_instantiate_with_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/custom_nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/event_error_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/get_account_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type BalanceOf<T> = <<T as pallet_identity::Config>::Currency as Currency<
type MaxRegistrarsOf<T> = <T as pallet_identity::Config>::MaxRegistrars;
type MaxAdditionalFieldsOf<T> = <T as pallet_identity::Config>::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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/get_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/get_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions examples/examples/print_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<<kitchensink_runtime::Runtime as GetRuntimeBlockType>::RuntimeBlock>;
SubstrateConfig<<kitchensink_runtime::Runtime as GetRuntimeBlockType>::RuntimeBlock>;

#[tokio::main]
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/staking_batch_payout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/sudo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/transfer_with_tungstenite_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/transfer_with_ws_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions primitives/src/config/substrate_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Block> {
_marker: PhantomData<Block>,
Expand All @@ -36,7 +34,7 @@ where
type Hash = H256;
type AccountId = AccountId32;
type Address = MultiAddress<Self::AccountId, u32>;
type Signature = MultiSignature; //sr25519::Signature
type Signature = MultiSignature;
type Hasher = BlakeTwo256;
type Header = SubstrateHeader<u32, BlakeTwo256>;
type AccountData = AccountData<Self::Balance>;
Expand Down
21 changes: 4 additions & 17 deletions primitives/src/extrinsics/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AccountId: Clone + Encode> {
type Signature: Encode;
Expand Down Expand Up @@ -84,7 +85,7 @@ where
&self.account_id
}

fn extrinsic_address(&self) -> T::Address {
fn extrinsic_address(&self) -> Self::ExtrinsicAddress {
self.extrinsic_address.clone()
}
}
Expand All @@ -99,8 +100,7 @@ where
ExtrinsicSigner::<T, Signer>::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.
Expand Down Expand Up @@ -149,7 +149,6 @@ where
self.extrinsic_address.clone()
}
}
*/

#[cfg(test)]
mod tests {
Expand All @@ -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() {
Expand All @@ -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();
}
*/
}
2 changes: 1 addition & 1 deletion src/api/rpc_api/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ where
Client: Request,
<T::Header as ac_primitives::config::Header>::Number: Serialize,
{
type BlockNumber = <T::Header as crate::config::Header>::Number;
type BlockNumber = <T::Header as ac_primitives::config::Header>::Number;
type Hash = T::Hash;
type Block = T::Block;

Expand Down
2 changes: 1 addition & 1 deletion testing/examples/author_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion testing/examples/chain_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion testing/examples/events_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion testing/examples/frame_system_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion testing/examples/pallet_balances_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion testing/examples/pallet_transaction_payment_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion testing/examples/state_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7544159

Please sign in to comment.