partner_chains_smart_contracts_commands/
get_scripts.rs

1use crate::GenesisUtxo;
2use partner_chains_cardano_offchain::scripts_data::get_scripts_data_with_ogmios;
3
4#[derive(Clone, Debug, clap::Parser)]
5/// Command for getting the addresses and policy ids of the partner chain smart contracts parametrised with the given genesis utxo
6pub struct GetScripts {
7	#[clap(flatten)]
8	common_arguments: crate::CommonArguments,
9	#[clap(flatten)]
10	/// Genesis UTXO
11	genesis_utxo: GenesisUtxo,
12}
13
14impl GetScripts {
15	/// Gets the addresses and policy ids of the partner chain smart contracts parametrised with the given genesis utxo
16	pub async fn execute(self) -> crate::SubCmdResult {
17		let client = self.common_arguments.get_ogmios_client().await?;
18		let scripts_data = get_scripts_data_with_ogmios(self.genesis_utxo.into(), &client).await?;
19		Ok(serde_json::json!(scripts_data))
20	}
21}