In Hyperledger Fabric, can I determine the Asset Class in the transaction?

177 Views Asked by At

quick question regarding hyperledger fabric transactions in JS.

Say, I have an abstract asset called HotBeverage:

 abstract asset HotBeverage identified by assetId {
  o String assetId
  o Double price
}

And from that abstract class, I create two more assets:

asset HotTea extends HotBeverage {
 o String teaType
}

and

asset HotCoffee extends HotBeverage {
 o String coffeeType
}

OK, fairly straight forward so far. Now say I want to create a transaction that adds 0.50 to the price of all HotBeverages. Transactions currently cannot accept abstract assets, so it means I need to create two separate transactions :'(

transaction changeTeaPrice {
  --> HotTea Tea
  o Double newPrice
}

And

transaction changeCoffeePrice {
  --> HotCoffee coffee
  o Double newPrice
}

I really want to create just one transaction that would work on all HotBeverages instead of implementing them individually. Can this be done?

Thanks!!

0

There are 0 best solutions below