gear_runtime_primitives/lib.rs
1// Copyright (C) Gear Technologies Inc.
2// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
3
4//! Low-level types used throughout the Substrate code.
5
6#![warn(missing_docs)]
7#![cfg_attr(not(feature = "std"), no_std)]
8
9use sp_runtime::{
10 MultiSignature, OpaqueExtrinsic, generic,
11 traits::{BlakeTwo256, IdentifyAccount, Verify},
12};
13
14/// An index to a block.
15pub type BlockNumber = u32;
16
17/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
18pub type Signature = MultiSignature;
19
20/// Alias to the public key used for this chain.
21pub type AccountPublic = <Signature as Verify>::Signer;
22
23/// Some way of identifying an account on the chain. We intentionally make it equivalent
24/// to the public key of our transaction signing scheme.
25pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId;
26
27/// The type for looking up accounts. We don't expect more than 4 billion of them.
28pub type AccountIndex = u32;
29
30/// Balance of an account.
31pub type Balance = u128;
32
33/// Type used for expressing timestamp.
34pub type Moment = u64;
35
36/// Nonce of a transaction in the chain.
37pub type Nonce = u32;
38
39/// A hash of some data used by the chain.
40pub type Hash = sp_core::H256;
41
42/// A timestamp: milliseconds since the unix epoch.
43/// `u64` is enough to represent a duration of half a billion years, when the
44/// time scale is milliseconds.
45pub type Timestamp = u64;
46
47/// Digest item type.
48pub type DigestItem = generic::DigestItem;
49/// Header type.
50pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
51/// Block type.
52pub type Block = generic::Block<Header, OpaqueExtrinsic>;
53/// Block ID.
54pub type BlockId = generic::BlockId<Block>;
55
56/// SS58 prefix of VARA.
57pub const VARA_SS58_PREFIX: u8 = 137;