feat(primitives): Enable serde of ledger structs (#169)
This commit is contained in:
parent
1f0eb3bfc0
commit
9845fc4040
22 changed files with 584 additions and 270 deletions
|
|
@ -62,17 +62,17 @@ impl<'b> MultiEraOutput<'b> {
|
|||
MultiEraOutput::Byron(x) => x.amount,
|
||||
MultiEraOutput::Babbage(x) => match x.deref().deref() {
|
||||
babbage::TransactionOutput::Legacy(x) => match x.amount {
|
||||
babbage::Value::Coin(c) => u64::from(c),
|
||||
babbage::Value::Multiasset(c, _) => u64::from(c),
|
||||
babbage::Value::Coin(c) => c,
|
||||
babbage::Value::Multiasset(c, _) => c,
|
||||
},
|
||||
babbage::TransactionOutput::PostAlonzo(x) => match x.value {
|
||||
babbage::Value::Coin(c) => u64::from(c),
|
||||
babbage::Value::Multiasset(c, _) => u64::from(c),
|
||||
babbage::Value::Coin(c) => c,
|
||||
babbage::Value::Multiasset(c, _) => c,
|
||||
},
|
||||
},
|
||||
MultiEraOutput::AlonzoCompatible(x) => match x.amount {
|
||||
alonzo::Value::Coin(c) => u64::from(c),
|
||||
alonzo::Value::Multiasset(c, _) => u64::from(c),
|
||||
alonzo::Value::Coin(c) => c,
|
||||
alonzo::Value::Multiasset(c, _) => c,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ impl<'b> MultiEraWithdrawals<'b> {
|
|||
MultiEraWithdrawals::NotApplicable => std::iter::empty().collect(),
|
||||
MultiEraWithdrawals::Empty => std::iter::empty().collect(),
|
||||
MultiEraWithdrawals::AlonzoCompatible(x) => {
|
||||
x.iter().map(|(k, v)| (k.as_slice(), v.into())).collect()
|
||||
x.iter().map(|(k, v)| (k.as_slice(), *v)).collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue