I feel like this should be pretty easy, but I'm stumped. How can I use a slot number as a token name?
I'm currently trying to encode
the slot integer
as a ByteString
:
slotNumberTokenName :: TokenName
slotNumberTokenName = TokenName { unTokenName = encode $ getSlot slot }
but I get the error
• Couldn't match expected type ‘ByteString’
with actual type ‘bytestring-0.10.12.0:Data.ByteString.Lazy.Internal.ByteString’
NB: ‘bytestring-0.10.12.0:Data.ByteString.Lazy.Internal.ByteString’
is defined in ‘Data.ByteString.Lazy.Internal’
‘ByteString’ is defined in ‘Data.ByteString.Internal’
• In the ‘unTokenName’ field of a record
In the expression: TokenName {unTokenName = encode $ getSlot slot}
In an equation for ‘slotNumberTokenName’:
slotNumberTokenName
= TokenName {unTokenName = encode $ getSlot slot}
|
153 | slotNumberTokenName = TokenName { unTokenName = encode $ getSlot slot }
|
I am using Data.Aeson.encode
, so maybe there is a different function to do that conversion.
Anyhow, any help would be appreciated. Been looking at this for longer than I'd like to admit.