mlabs-haskell / purescript-cardano-serialization-lib

Pursecript library for cardano frontend types for emurgo/cardano-serialisation-lib
4 stars 3 forks source link

Work around MintAssets / MintsAssets difference in the codegen #11

Open klntsky opened 2 weeks ago

klntsky commented 2 weeks ago

The methods for Mint are:

  insert(key: ScriptHash, value: MintAssets): MintAssets | void;
  get(key: ScriptHash): MintsAssets | void;

MintAssets value is being inserted, but get returns MintsAssets. This breaks our codegen assumption for map-like types, that thinks that the exact same type that was put in can be extracted.

We work around this downstream in a very hacky way: https://github.com/mlabs-haskell/purescript-cardano-types/blob/8f9e5d0e0a465990024fac7c8e8db36fcd56ab8c/src/Cardano/Types/Mint.purs#L176

klntsky commented 2 weeks ago

UPD: refactored the hack to make it more obvious

https://github.com/mlabs-haskell/purescript-cardano-types/blob/b084f05e1cc8c4e99fce2c42cf988590555c0ca7/src/Cardano/Types/Mint.purs#L136