parent
3bc3792aa3
commit
f306f1715a
|
@ -434,9 +434,11 @@ where
|
|||
Network::Testnet
|
||||
};
|
||||
|
||||
Ok(validator
|
||||
.program
|
||||
.address(network, delegation_part.to_owned()))
|
||||
Ok(validator.program.address(
|
||||
network,
|
||||
delegation_part.to_owned(),
|
||||
&self.config.plutus_version.into(),
|
||||
))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -177,10 +177,19 @@ impl<'a> Deserialize<'a> for Program<DeBruijn> {
|
|||
}
|
||||
|
||||
impl Program<DeBruijn> {
|
||||
pub fn address(&self, network: Network, delegation: ShelleyDelegationPart) -> ShelleyAddress {
|
||||
pub fn address(
|
||||
&self,
|
||||
network: Network,
|
||||
delegation: ShelleyDelegationPart,
|
||||
plutus_version: &Language,
|
||||
) -> ShelleyAddress {
|
||||
let cbor = self.to_cbor().unwrap();
|
||||
|
||||
let validator_hash = babbage::PlutusV2Script(cbor.into()).compute_hash();
|
||||
let validator_hash = match plutus_version {
|
||||
Language::PlutusV1 => conway::PlutusV1Script(cbor.into()).compute_hash(),
|
||||
Language::PlutusV2 => conway::PlutusV2Script(cbor.into()).compute_hash(),
|
||||
Language::PlutusV3 => conway::PlutusV3Script(cbor.into()).compute_hash(),
|
||||
};
|
||||
|
||||
ShelleyAddress::new(
|
||||
network,
|
||||
|
|
Loading…
Reference in New Issue