-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.rs
More file actions
124 lines (105 loc) · 4.38 KB
/
cli.rs
File metadata and controls
124 lines (105 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
use game::GameCommand;
use gpc_wallet::cli::WalletCommand;
use griffin_partner_chains_runtime::opaque::SessionKeys;
use partner_chains_cli::{KeyDefinition, AURA, GRANDPA};
use partner_chains_node_commands::{PartnerChainRuntime, PartnerChainsSubcommand};
#[derive(Debug, Clone)]
pub struct WizardBindings;
impl PartnerChainRuntime for WizardBindings {
type Keys = SessionKeys;
fn key_definitions() -> Vec<KeyDefinition<'static>> {
vec![AURA, GRANDPA]
}
// This function is required by the PartnerChainsRuntime trait
// Leaving it empty won't work as it parses for the ChainSpec structure whichever it might be
// We give an implementation using the default genesis
fn create_chain_spec(
_config: &partner_chains_cli::CreateChainSpecConfig<SessionKeys>,
) -> serde_json::Value {
let genesis_default: &str = r#"
{
"zero_time": 1747081100000,
"zero_slot": 0,
"outputs": [
{
"address": "6101e6301758a6badfab05035cffc8e3438b3aff2a4edc6544b47329c4",
"coin": 314000000,
"value": [
{
"policy": "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005",
"assets": [ ["tokenA", 271000000], ["tokenB", 1123581321] ]
}
],
"datum": "820080"
},
{
"address": "61547932e40a24e2b7deb41f31af21ed57acd125f4ed8a72b626b3d7f6",
"coin": 314150000,
"value": [
{
"policy": "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005",
"assets": [ ["tokenA", 300000000], ["tokenB", 2000000000] ]
}
],
"datum": "820080"
},
{
"address": "0000000000000000000000000000000000000000000000000000000000",
"coin": 314150000,
"value": [
{
"policy": "0298aa99f95e2fe0a0132a6bb794261fb7e7b0d988215da2f2de2005",
"assets": [ ["Authorities", 300000000]]
}
],
"datum": "9FD879809F9F5821022A009DD29E31A1573BF90EBE5979D496B3C45CC898F0E39BF16563F4435F5BAC5820D43593C715FDD31C61141ABD04A99FD6822C8558854CCDE39A5684E7A56DA27D582088DC3417D5058EC4B4503E0C12EA1A0A89BE200FE98922423D4334014FA6B0EEFFFF00FF"
}
]
}
"#;
serde_json::from_str(genesis_default).unwrap()
}
}
#[derive(Debug, clap::Parser)]
pub struct Cli {
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
#[clap(flatten)]
pub run: sc_cli::RunCmd,
}
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Key management cli utilities
#[command(subcommand)]
Key(sc_cli::KeySubcommand),
#[clap(flatten)]
Wallet(WalletCommand),
/// Commands to play the Asteria game
#[clap(flatten)]
Game(GameCommand),
#[clap(flatten)]
PartnerChains(PartnerChainsSubcommand<WizardBindings>),
/// Build a chain specification.
/// DEPRECATED: `build-spec` command will be removed after 1/04/2026. Use `export-chain-spec`
/// command instead.
#[deprecated(
note = "build-spec command will be removed after 1/04/2026. Use export-chain-spec command instead"
)]
BuildSpec(sc_cli::BuildSpecCmd),
/// Export the chain specification.
ExportChainSpec(sc_cli::ExportChainSpecCmd),
/// Validate blocks.
CheckBlock(sc_cli::CheckBlockCmd),
/// Export blocks.
ExportBlocks(sc_cli::ExportBlocksCmd),
/// Export the state of a given block into a chain spec.
ExportState(sc_cli::ExportStateCmd),
/// Import blocks.
ImportBlocks(sc_cli::ImportBlocksCmd),
/// Remove the whole chain.
PurgeChain(sc_cli::PurgeChainCmd),
/// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd),
/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
}