You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
type MyDatum {
sales: Dict<Int, Int>,
asset: Value
}
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!
The text was updated successfully, but these errors were encountered:
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.
constsales=newMap<bigint,bigint>();constvalue=newMap<string,Map<string,bigint>>();constassetMap=newMap<string,bigint>();// This would be the map that goes inside the value mapconstdatum=newConstr(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!
The text was updated successfully, but these errors were encountered: