chain_spec/lib.rs
1// This file is part of Tetcore.
2
3// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! Types and traits related to chain specifications.
19
20/// The type of a chain.
21///
22/// This can be used by tools to determine the type of a chain for displaying
23/// additional information or enabling additional features.
24#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Clone)]
25pub enum ChainType {
26 /// A development chain that runs mainly on one node.
27 Development,
28 /// A local chain that runs locally on multiple nodes for testing purposes.
29 Local,
30 /// A live chain.
31 Live,
32 /// Some custom chain type.
33 Custom(String),
34}
35
36impl Default for ChainType {
37 fn default() -> Self {
38 Self::Live
39 }
40}
41
42/// Arbitrary properties defined in chain spec as a JSON object
43pub type Properties = serde_json::map::Map<String, serde_json::Value>;