Open ThomasHawel opened 1 year ago
Seems like a little old thread so I guess you already fixed it. But leaving this for anyone else with doubts.
Dict will be mapped to a Map in plutus data, so when mapping to lucid you should use a Map.
Value is just a dict with the following shape Dict<PolicyId, Dict<AssetName, Int>>
so we should also use a JS Map.
I haven't tested but If I'm not wrong your jS code should look something like this.
const sales = new Map<bigint, bigint>();
const value = new Map<string, Map<string, bigint>>();
const assetMap = new Map<string, bigint>(); // This would be the map that goes inside the value map
const datum = new Constr(0, [
sales,
value
])
hi!
I am struggling for a while now finding the proper off chain implementations of a given smart contract. In my implementation I have an Value and Dict<Int, Int> type in the aiken smart contract:
I tried multiple options, e.g. Data.Map(...) but always got some deserialising error.
So in general, how can I find out what data types I should use in lucid, given some on chain types? Did I miss something in the docs? Specifically, how do I represent and encode a Dict and Value aiken types in lucid? Thanks a lot!