Closed rooooooooob closed 1 year ago
I'll add the WASM bindings later once we decide if this is the approach we want. The previous one is #193 but IMO this one gives a much cleaner API for users. It doesn't really even hurt regenerability much either since we had to modify the outer map deserialization code a bunch for permissive parsing anyway. I marked the few additional places we hand-edit here with comments in case we do ever need to regenerate. Other than that I just pasted the v1/v2 table parsing code into the new types and did those few single-line changes to directly use PolicyId
/AssetName
and merge the types into one.
V1 vs V2 from a user perspective are identical but are encoded differently e.g. as text (v1) vs bytes (v2). A user should not need to care about this. We also previously had 3 different types each for asset names and policy ids: cip25 v1, cip25 v2 and the cml-chain ones.
This modifies the outer map part of cip25 to directly use the cml-chain ones and remove the cip25 structs. The serialization for this map had already been hand-edited to allow for permissive parsing so having to move this to utils and hand-edit it shouldn't be much of an issue. Places where hand-editing was done is commented and the other code was taken directly from the auto-generated code from before.
Doing this gives better structural checking too as we didn't do any of that for the v1/v2 policy ids. This is why the noise_metadata test had to be edited.
As a result of this CIP25 has about half the types and should have a much less confusing API.