parent
50c37c7a14
commit
d18caaeecb
|
@ -359,6 +359,7 @@ where
|
|||
&self,
|
||||
title: Option<&String>,
|
||||
stake_address: Option<&String>,
|
||||
mainnet: bool,
|
||||
) -> Result<ShelleyAddress, Error> {
|
||||
// Parse stake address
|
||||
let stake_address = stake_address
|
||||
|
@ -398,9 +399,15 @@ where
|
|||
if n > 0 {
|
||||
Err(blueprint::error::Error::ParameterizedValidator { n }.into())
|
||||
} else {
|
||||
let network = if mainnet {
|
||||
Network::Mainnet
|
||||
} else {
|
||||
Network::Testnet
|
||||
};
|
||||
|
||||
Ok(validator
|
||||
.program
|
||||
.address(Network::Testnet, delegation_part.to_owned()))
|
||||
.address(network, delegation_part.to_owned()))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -23,6 +23,10 @@ pub struct Args {
|
|||
/// Force the project to be rebuilt, otherwise relies on existing artifacts (i.e. plutus.json)
|
||||
#[clap(long)]
|
||||
rebuild: bool,
|
||||
|
||||
/// Output the address for mainnet (this command defaults to testnet)
|
||||
#[clap(long)]
|
||||
mainnet: bool,
|
||||
}
|
||||
|
||||
pub fn exec(
|
||||
|
@ -32,6 +36,7 @@ pub fn exec(
|
|||
validator,
|
||||
delegated_to,
|
||||
rebuild,
|
||||
mainnet,
|
||||
}: Args,
|
||||
) -> miette::Result<()> {
|
||||
with_project(directory.as_deref(), false, |p| {
|
||||
|
@ -51,7 +56,7 @@ pub fn exec(
|
|||
|
||||
let title = title.as_ref().or(validator.as_ref());
|
||||
|
||||
let address = p.address(title, delegated_to.as_ref())?;
|
||||
let address = p.address(title, delegated_to.as_ref(), mainnet)?;
|
||||
|
||||
println!("{}", address.to_bech32().unwrap());
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ pub fn exec(
|
|||
|
||||
let title = title.as_ref().or(validator.as_ref());
|
||||
|
||||
let address = p.address(title, None)?;
|
||||
let address = p.address(title, None, false)?;
|
||||
|
||||
println!("{}", address.payment().to_hex());
|
||||
|
||||
|
|
|
@ -161,7 +161,9 @@ impl<'a> Deserialize<'a> for Program<DeBruijn> {
|
|||
impl Program<DeBruijn> {
|
||||
pub fn address(&self, network: Network, delegation: ShelleyDelegationPart) -> ShelleyAddress {
|
||||
let cbor = self.to_cbor().unwrap();
|
||||
|
||||
let validator_hash = babbage::PlutusV2Script(cbor.into()).compute_hash();
|
||||
|
||||
ShelleyAddress::new(
|
||||
network,
|
||||
ShelleyPaymentPart::Script(validator_hash),
|
||||
|
|
Loading…
Reference in New Issue