Skip to content

Commit

Permalink
Merge pull request #1023 from solidsnakedev/main
Browse files Browse the repository at this point in the history
Add wrap constructor to V1/V2 StakeCredential
  • Loading branch information
KtorZ authored Sep 20, 2024
2 parents 3fddab4 + 75b5332 commit 7155b4e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crates/uplc/src/tx/to_plutus_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,10 @@ impl<'a> ToPlutusData for WithWrappedTransactionId<'a, ScriptPurpose> {
ScriptPurpose::Spending(out_ref, ()) => {
wrap_with_constr(1, WithWrappedTransactionId(out_ref).to_plutus_data())
}
ScriptPurpose::Rewarding(stake_credential) => {
wrap_with_constr(2, stake_credential.to_plutus_data())
}
ScriptPurpose::Rewarding(stake_credential) => wrap_with_constr(
2,
WithWrappedStakeCredential(stake_credential).to_plutus_data(),
),
ScriptPurpose::Certifying(_, dcert) => {
wrap_with_constr(3, WithPartialCertificates(dcert).to_plutus_data())
}
Expand Down Expand Up @@ -1243,6 +1244,12 @@ impl<'a> ToPlutusData for WithWrappedStakeCredential<'a, KeyValuePairs<Address,
}
}

impl<'a> ToPlutusData for WithWrappedStakeCredential<'a, StakeCredential> {
fn to_plutus_data(&self) -> PlutusData {
wrap_with_constr(0, self.0.to_plutus_data())
}
}

impl ToPlutusData for Voter {
fn to_plutus_data(&self) -> PlutusData {
match self {
Expand Down

0 comments on commit 7155b4e

Please sign in to comment.