feat(traverse): introduce MultiEraValue (#516)

This commit is contained in:
Santiago Carmuega 2024-10-01 09:46:58 -03:00 committed by GitHub
parent 80d121d13a
commit de88df1986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 110 additions and 36 deletions

View file

@ -147,12 +147,13 @@ impl<C: LedgerContext> Mapper<C> {
pub fn map_tx_output(&self, x: &trv::MultiEraOutput) -> u5c::TxOutput {
u5c::TxOutput {
address: x.address().map(|a| a.to_vec()).unwrap_or_default().into(),
coin: x.lovelace_amount(),
coin: x.value().coin(),
// TODO: this is wrong, we're crating a new item for each asset even if they share
// the same policy id. We need to adjust Pallas' interface to make this mapping more
// ergonomic.
assets: x
.non_ada_assets()
.value()
.assets()
.iter()
.map(|x| self.map_policy_assets(x))
.collect(),