Skip to content

Commit

Permalink
New substrate crate renames (paritytech#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascjones authored Dec 2, 2019
1 parent 5108bce commit 625621e
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ serde = { version = "1.0", features = ["derive"] }
url = "1.7"
parity-scale-codec = { version = "1.1", default-features = false, features = ["derive", "full"] }

runtime_metadata = { git = "https://github.com/paritytech/substrate/", package = "frame-metadata" }
runtime_support = { git = "https://github.com/paritytech/substrate/", package = "frame-support" }
runtime_primitives = { git = "https://github.com/paritytech/substrate/", package = "sr-primitives" }
sr-version = { git = "https://github.com/paritytech/substrate/", package = "sr-version" }
frame-metadata = { git = "https://github.com/paritytech/substrate/", package = "frame-metadata" }
frame-support = { git = "https://github.com/paritytech/substrate/", package = "frame-support" }
sp-runtime = { git = "https://github.com/paritytech/substrate/", package = "sp-runtime" }
sp-version = { git = "https://github.com/paritytech/substrate/", package = "sp-version" }
frame-system = { git = "https://github.com/paritytech/substrate/", package = "frame-system" }
pallet-balances = { git = "https://github.com/paritytech/substrate/", package = "pallet-balances" }
pallet-contracts = { git = "https://github.com/paritytech/substrate/", package = "pallet-contracts" }
pallet-indices = { git = "https://github.com/paritytech/substrate/", package = "pallet-indices" }
substrate-rpc-api = { git = "https://github.com/paritytech/substrate/", package = "sc-rpc-api" }
substrate-rpc-primitives = { git = "https://github.com/paritytech/substrate/", package = "substrate-rpc-primitives" }
substrate-primitives = { git = "https://github.com/paritytech/substrate/", package = "substrate-primitives" }
sp-rpc = { git = "https://github.com/paritytech/substrate/", package = "sp-rpc" }
sp-core = { git = "https://github.com/paritytech/substrate/", package = "sp-core" }
txpool-api = { git = "https://github.com/paritytech/substrate/", package = "sp-transaction-pool-api" }

[dev-dependencies]
env_logger = "0.7"
tokio = "0.1"
wabt = "0.9"
node-runtime = { git = "https://github.com/paritytech/substrate/", package = "node-runtime" }
substrate-keyring = { git = "https://github.com/paritytech/substrate/", package = "substrate-keyring" }
sp-keyring = { git = "https://github.com/paritytech/substrate/", package = "sp-keyring" }
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.

use jsonrpc_core_client::RpcError;
use runtime_primitives::transaction_validity::TransactionValidityError;
use substrate_primitives::crypto::SecretStringError;
use sp_runtime::transaction_validity::TransactionValidityError;
use sp_core::crypto::SecretStringError;

use crate::{
events::EventsError,
Expand Down
4 changes: 2 additions & 2 deletions src/extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use parity_scale_codec::{
Encode,
};

use runtime_primitives::{
use sp_runtime::{
generic::{
Era,
SignedPayload,
Expand All @@ -35,7 +35,7 @@ use runtime_primitives::{
},
transaction_validity::TransactionValidityError,
};
use substrate_primitives::Pair;
use sp_core::Pair;

use crate::frame::{
balances::Balances,
Expand Down
4 changes: 2 additions & 2 deletions src/frame/balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ use parity_scale_codec::{
Encode,
};

use runtime_primitives::traits::{
use sp_runtime::traits::{
MaybeSerialize,
Member,
SimpleArithmetic,
};
use runtime_support::Parameter;
use frame_support::Parameter;

use crate::{
error::Error,
Expand Down
8 changes: 4 additions & 4 deletions src/frame/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use futures::future::{
use parity_scale_codec::Codec;
use serde::de::DeserializeOwned;

use runtime_primitives::traits::{
use sp_runtime::traits::{
Bounded,
CheckEqual,
Hash,
Expand All @@ -38,7 +38,7 @@ use runtime_primitives::traits::{
SimpleBitOps,
StaticLookup,
};
use runtime_support::Parameter;
use frame_support::Parameter;

use crate::{
error::Error,
Expand Down Expand Up @@ -173,7 +173,7 @@ pub fn set_code(code: Vec<u8>) -> Call<SetCode> {
#[derive(Clone, Debug, parity_scale_codec::Decode)]
pub enum SystemEvent {
/// An extrinsic completed successfully.
ExtrinsicSuccess(runtime_support::weights::DispatchInfo),
ExtrinsicSuccess(frame_support::weights::DispatchInfo),
/// An extrinsic failed.
ExtrinsicFailed(runtime_primitives::DispatchError),
ExtrinsicFailed(sp_runtime::DispatchError),
}
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ use parity_scale_codec::{
Decode,
Encode,
};
use runtime_primitives::{
use sp_runtime::{
generic::UncheckedExtrinsic,
traits::{
IdentifyAccount,
Verify,
},
MultiSignature,
};
use sr_version::RuntimeVersion;
use substrate_primitives::{
use sp_version::RuntimeVersion;
use sp_core::{
storage::{
StorageChangeSet,
StorageKey,
Expand Down Expand Up @@ -394,9 +394,9 @@ where
mod tests {
use futures::stream::Stream;
use parity_scale_codec::Encode;
use runtime_support::StorageMap;
use substrate_keyring::AccountKeyring;
use substrate_primitives::storage::StorageKey;
use frame_support::StorageMap;
use sp_keyring::AccountKeyring;
use sp_core::storage::StorageKey;

use super::*;
use crate::{
Expand Down Expand Up @@ -528,7 +528,7 @@ mod tests {
let (_, client) = test_setup();

let balances = client.metadata().module_with_calls("Balances").unwrap();
let dest = substrate_keyring::AccountKeyring::Bob.to_account_id();
let dest = sp_keyring::AccountKeyring::Bob.to_account_id();
let address: Address = dest.clone().into();
let amount: Balance = 10_000;

Expand Down
22 changes: 11 additions & 11 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use parity_scale_codec::{
Encode,
};

use runtime_metadata::{
use frame_metadata::{
DecodeDifferent,
RuntimeMetadata,
RuntimeMetadataPrefixed,
Expand All @@ -35,7 +35,7 @@ use runtime_metadata::{
StorageHasher,
META_RESERVED,
};
use substrate_primitives::storage::StorageKey;
use sp_core::storage::StorageKey;

use crate::codec::Encoded;

Expand Down Expand Up @@ -232,19 +232,19 @@ pub struct StorageMap<K, V> {

impl<K: Encode, V: Decode + Clone> StorageMap<K, V> {
pub fn key(&self, key: K) -> StorageKey {
let mut bytes = substrate_primitives::twox_128(&self.module_prefix).to_vec();
bytes.extend(&substrate_primitives::twox_128(&self.storage_prefix)[..]);
let mut bytes = sp_core::twox_128(&self.module_prefix).to_vec();
bytes.extend(&sp_core::twox_128(&self.storage_prefix)[..]);
let encoded_key = key.encode();
let hash = match self.hasher {
StorageHasher::Blake2_128 => {
substrate_primitives::blake2_128(&encoded_key).to_vec()
sp_core::blake2_128(&encoded_key).to_vec()
}
StorageHasher::Blake2_256 => {
substrate_primitives::blake2_256(&encoded_key).to_vec()
sp_core::blake2_256(&encoded_key).to_vec()
}
StorageHasher::Twox128 => substrate_primitives::twox_128(&encoded_key).to_vec(),
StorageHasher::Twox256 => substrate_primitives::twox_256(&encoded_key).to_vec(),
StorageHasher::Twox64Concat => substrate_primitives::twox_64(&encoded_key).to_vec(),
StorageHasher::Twox128 => sp_core::twox_128(&encoded_key).to_vec(),
StorageHasher::Twox256 => sp_core::twox_256(&encoded_key).to_vec(),
StorageHasher::Twox64Concat => sp_core::twox_64(&encoded_key).to_vec(),
};
bytes.extend(hash);
StorageKey(bytes)
Expand Down Expand Up @@ -417,7 +417,7 @@ fn convert<B: 'static, O: 'static>(dd: DecodeDifferent<B, O>) -> Result<O, Error
}

fn convert_event(
event: runtime_metadata::EventMetadata,
event: frame_metadata::EventMetadata,
) -> Result<ModuleEventMetadata, Error> {
let name = convert(event.name)?;
let mut arguments = Vec::new();
Expand All @@ -431,7 +431,7 @@ fn convert_event(
fn convert_entry(
module_prefix: String,
storage_prefix: String,
entry: runtime_metadata::StorageEntryMetadata,
entry: frame_metadata::StorageEntryMetadata,
) -> Result<StorageMetadata, Error> {
let default = convert(entry.default)?;
Ok(StorageMetadata {
Expand Down
10 changes: 5 additions & 5 deletions src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ use parity_scale_codec::{
};

use frame_system::Phase;
use runtime_metadata::RuntimeMetadataPrefixed;
use runtime_primitives::{
use frame_metadata::RuntimeMetadataPrefixed;
use sp_runtime::{
generic::{
Block,
SignedBlock,
},
traits::Hash,
OpaqueExtrinsic,
};
use sr_version::RuntimeVersion;
use substrate_primitives::{
use sp_version::RuntimeVersion;
use sp_core::{
storage::{
StorageChangeSet,
StorageKey,
Expand All @@ -61,7 +61,7 @@ use substrate_rpc_api::{
chain::ChainClient,
state::StateClient,
};
use substrate_rpc_primitives::{
use sp_rpc::{
list::ListOrValue,
number::NumberOrHex,
};
Expand Down
4 changes: 2 additions & 2 deletions src/runtimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.

use runtime_primitives::{
use sp_runtime::{
generic::Header,
traits::{
BlakeTwo256,
Expand Down Expand Up @@ -42,7 +42,7 @@ pub struct DefaultNodeRuntime;
impl System for DefaultNodeRuntime {
type Index = u32;
type BlockNumber = u32;
type Hash = substrate_primitives::H256;
type Hash = sp_core::H256;
type Hashing = BlakeTwo256;
type AccountId = <<MultiSignature as Verify>::Signer as IdentifyAccount>::AccountId;
type Address = pallet_indices::address::Address<Self::AccountId, u32>;
Expand Down

0 comments on commit 625621e

Please sign in to comment.