-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add upsert-d-parameter command (#297)
- Loading branch information
Showing
11 changed files
with
213 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use jsonrpsee::http_client::HttpClient; | ||
use partner_chains_cardano_offchain::d_param::upsert_d_param; | ||
use sidechain_domain::DParameter; | ||
use sidechain_domain::UtxoId; | ||
|
||
use crate::read_private_key_from_file; | ||
|
||
#[derive(Clone, Debug, clap::Parser)] | ||
pub struct UpsertDParameterCmd { | ||
#[clap(flatten)] | ||
common_arguments: crate::CommonArguments, | ||
#[arg(long)] | ||
permissioned_candidates_count: u16, | ||
#[arg(long)] | ||
registered_candidates_count: u16, | ||
#[arg(long, short('k'))] | ||
payment_key_file: String, | ||
#[arg(long, short('c'))] | ||
genesis_utxo: UtxoId, | ||
} | ||
|
||
impl UpsertDParameterCmd { | ||
pub async fn execute(self) -> crate::CmdResult<()> { | ||
let payment_key = read_private_key_from_file(&self.payment_key_file)?; | ||
let d_param = DParameter { | ||
num_permissioned_candidates: self.permissioned_candidates_count, | ||
num_registered_candidates: self.registered_candidates_count, | ||
}; | ||
let client = HttpClient::builder().build(self.common_arguments.ogmios_host)?; | ||
|
||
upsert_d_param(self.genesis_utxo, &d_param, payment_key.0, &client).await?; | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.