How to use NonEmpty within a template
- cohen.avrahamOP
G-d willing
Hello,
I want to use the NonEmpty for a list of Decimals within a template, and I can’t find a way in doing so.
When I am doing it on a regular data type it works okay, as follows:let nums = NE.NonEmpty with hd = 2 tl = []But when I am trying to do the same on a template I am getting an error.
template NonEmptyTest with sideA: Party nums: NE.NonEmpty [Int] where signatory sideA setup : Script () setup = script do alice<- allocatePartyWithHint "Alice" (PartyIdHint "Alice") submit alice do createCmd NonEmptyTest with sideA=alice nums= NE.NonEmpty with hd = 2 tl = []Can you please tell me what am I doing wrong?
- cocreature 3
Your template defines
numsto be a non-empty list of lists of integers. However, you are trying to use it as a non-empty list of integers so without the extra level of lists.Change the type to
nums : NE.NonEmpty Intand it should work.