subxt_core/client.rs
1// Copyright 2019-2024 Parity Technologies (UK) Ltd.
2// This file is dual-licensed as Apache-2.0 or GPL-3.0.
3// see LICENSE for license details.
4
5//! A couple of client types that we use elsewhere.
6
7use crate::{config::Config, metadata::Metadata};
8use derive_where::derive_where;
9
10/// This provides access to some relevant client state in transaction extensions,
11/// and is just a combination of some of the available properties.
12#[derive_where(Clone, Debug)]
13pub struct ClientState<C: Config> {
14 /// Genesis hash.
15 pub genesis_hash: C::Hash,
16 /// Runtime version.
17 pub runtime_version: RuntimeVersion,
18 /// Metadata.
19 pub metadata: Metadata,
20}
21
22/// Runtime version information needed to submit transactions.
23#[derive(Debug, Clone, Copy, PartialEq, Eq)]
24pub struct RuntimeVersion {
25 /// Version of the runtime specification. A full-node will not attempt to use its native
26 /// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
27 /// `spec_version` and `authoring_version` are the same between Wasm and native.
28 pub spec_version: u32,
29 /// All existing dispatches are fully compatible when this number doesn't change. If this
30 /// number changes, then `spec_version` must change, also.
31 ///
32 /// This number must change when an existing dispatchable (module ID, dispatch ID) is changed,
33 /// either through an alteration in its user-level semantics, a parameter
34 /// added/removed/changed, a dispatchable being removed, a module being removed, or a
35 /// dispatchable/module changing its index.
36 ///
37 /// It need *not* change when a new module is added or when a dispatchable is added.
38 pub transaction_version: u32,
39}