fix(traverse): add missing tx field getters for Conway (#392)
This commit is contained in:
parent
83728a085d
commit
7c287296ee
1 changed files with 9 additions and 3 deletions
|
|
@ -266,7 +266,8 @@ impl<'b> MultiEraTx<'b> {
|
||||||
|
|
||||||
pub fn mints(&self) -> Vec<MultiEraPolicyAssets> {
|
pub fn mints(&self) -> Vec<MultiEraPolicyAssets> {
|
||||||
match self {
|
match self {
|
||||||
MultiEraTx::AlonzoCompatible(x, _) => x
|
MultiEraTx::Byron(_) => vec![],
|
||||||
|
MultiEraTx::AlonzoCompatible(x, _) => x
|
||||||
.transaction_body
|
.transaction_body
|
||||||
.mint
|
.mint
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -280,7 +281,6 @@ impl<'b> MultiEraTx<'b> {
|
||||||
.flat_map(|x| x.iter())
|
.flat_map(|x| x.iter())
|
||||||
.map(|(k, v)| MultiEraPolicyAssets::AlonzoCompatibleMint(k, v))
|
.map(|(k, v)| MultiEraPolicyAssets::AlonzoCompatibleMint(k, v))
|
||||||
.collect(),
|
.collect(),
|
||||||
MultiEraTx::Byron(_) => vec![],
|
|
||||||
// TODO: Is this still AlonzoCompatible? Zero vals not allowed or something
|
// TODO: Is this still AlonzoCompatible? Zero vals not allowed or something
|
||||||
MultiEraTx::Conway(x) => x
|
MultiEraTx::Conway(x) => x
|
||||||
.transaction_body
|
.transaction_body
|
||||||
|
|
@ -298,6 +298,7 @@ impl<'b> MultiEraTx<'b> {
|
||||||
/// https://github.com/input-output-hk/cardano-ledger/commit/a342b74f5db3d3a75eae3e2abe358a169701b1e7
|
/// https://github.com/input-output-hk/cardano-ledger/commit/a342b74f5db3d3a75eae3e2abe358a169701b1e7
|
||||||
pub fn collateral(&self) -> Vec<MultiEraInput> {
|
pub fn collateral(&self) -> Vec<MultiEraInput> {
|
||||||
match self {
|
match self {
|
||||||
|
MultiEraTx::Byron(_) => vec![],
|
||||||
MultiEraTx::AlonzoCompatible(x, _) => x
|
MultiEraTx::AlonzoCompatible(x, _) => x
|
||||||
.transaction_body
|
.transaction_body
|
||||||
.collateral
|
.collateral
|
||||||
|
|
@ -312,7 +313,6 @@ impl<'b> MultiEraTx<'b> {
|
||||||
.flat_map(|x| x.iter())
|
.flat_map(|x| x.iter())
|
||||||
.map(MultiEraInput::from_alonzo_compatible)
|
.map(MultiEraInput::from_alonzo_compatible)
|
||||||
.collect(),
|
.collect(),
|
||||||
MultiEraTx::Byron(_) => vec![],
|
|
||||||
MultiEraTx::Conway(x) => x
|
MultiEraTx::Conway(x) => x
|
||||||
.transaction_body
|
.transaction_body
|
||||||
.collateral
|
.collateral
|
||||||
|
|
@ -330,6 +330,11 @@ impl<'b> MultiEraTx<'b> {
|
||||||
.collateral_return
|
.collateral_return
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(MultiEraOutput::from_babbage),
|
.map(MultiEraOutput::from_babbage),
|
||||||
|
MultiEraTx::Conway(x) => x
|
||||||
|
.transaction_body
|
||||||
|
.collateral_return
|
||||||
|
.as_ref()
|
||||||
|
.map(MultiEraOutput::from_babbage),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -337,6 +342,7 @@ impl<'b> MultiEraTx<'b> {
|
||||||
pub fn total_collateral(&self) -> Option<u64> {
|
pub fn total_collateral(&self) -> Option<u64> {
|
||||||
match self {
|
match self {
|
||||||
MultiEraTx::Babbage(x) => x.transaction_body.total_collateral,
|
MultiEraTx::Babbage(x) => x.transaction_body.total_collateral,
|
||||||
|
MultiEraTx::Conway(x) => x.transaction_body.total_collateral,
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue