fix(interop): map missing u5c redeemers (#490)
This commit is contained in:
parent
8f74238dc5
commit
60e07e2f00
6 changed files with 95 additions and 14 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use std::{borrow::Cow, collections::HashSet, ops::Deref};
|
||||
|
||||
use itertools::Itertools;
|
||||
use pallas_codec::{minicbor, utils::KeepRaw};
|
||||
use pallas_crypto::hash::Hash;
|
||||
use pallas_primitives::{
|
||||
|
|
@ -209,6 +210,27 @@ impl<'b> MultiEraTx<'b> {
|
|||
raw
|
||||
}
|
||||
|
||||
pub fn mints_sorted_set(&self) -> Vec<MultiEraPolicyAssets> {
|
||||
let mut raw = self.mints();
|
||||
|
||||
raw.sort_by_key(|m| *m.policy());
|
||||
|
||||
raw
|
||||
}
|
||||
|
||||
pub fn withdrawals_sorted_set(&self) -> Vec<(&[u8], u64)> {
|
||||
match self.withdrawals() {
|
||||
MultiEraWithdrawals::NotApplicable | MultiEraWithdrawals::Empty => {
|
||||
std::iter::empty().collect()
|
||||
}
|
||||
MultiEraWithdrawals::AlonzoCompatible(x) => x
|
||||
.iter()
|
||||
.map(|(k, v)| (k.as_slice(), *v))
|
||||
.sorted_by_key(|(k, _)| *k)
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the transaction reference inputs
|
||||
///
|
||||
/// NOTE: It is possible for this to return duplicates. See
|
||||
|
|
|
|||
|
|
@ -161,6 +161,26 @@ impl<'b> MultiEraTx<'b> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn find_mint_redeemer(&self, mint_order: u32) -> Option<MultiEraRedeemer> {
|
||||
self.redeemers().into_iter().find(|r| {
|
||||
r.tag() == pallas_primitives::conway::RedeemerTag::Mint && r.index() == mint_order
|
||||
})
|
||||
}
|
||||
|
||||
pub fn find_withdrawal_redeemer(&self, withdrawal_order: u32) -> Option<MultiEraRedeemer> {
|
||||
self.redeemers().into_iter().find(|r| {
|
||||
r.tag() == pallas_primitives::conway::RedeemerTag::Reward
|
||||
&& r.index() == withdrawal_order
|
||||
})
|
||||
}
|
||||
|
||||
pub fn find_certificate_redeemer(&self, certificate_order: u32) -> Option<MultiEraRedeemer> {
|
||||
self.redeemers().into_iter().find(|r| {
|
||||
r.tag() == pallas_primitives::conway::RedeemerTag::Cert
|
||||
&& r.index() == certificate_order
|
||||
})
|
||||
}
|
||||
|
||||
pub fn plutus_v2_scripts(&self) -> &[PlutusV2Script] {
|
||||
match self {
|
||||
Self::Byron(_) => &[],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue