-- | Responses for Cardano asset queries

module Blockfrost.Types.Cardano.Assets
  ( AssetInfo (..)
  , AssetDetails (..)
  , AssetOnChainMetadata (..)
  , MetadataMediaFile (..)
  , parseStandardMetadata
  , parseStandardMetadataInDetails
  , AssetMetadata (..)
  , AssetHistory (..)
  , AssetAction (..)
  , AssetTransaction (..)
  , AssetAddress (..)
  ) where

import Blockfrost.Types.Shared
import Data.Aeson (Value (..), FromJSON(parseJSON))
import Data.Aeson.Types (parseMaybe)
import Data.Aeson.KeyMap (fromList)
import Data.Char (toLower)
import Data.Text (Text)
import qualified Data.Vector as V (singleton)
import Deriving.Aeson
import Servant.Docs (ToSample (..), samples, singleSample)
import Prelude hiding (String)

-- | Asset information, result of listing assets
data AssetInfo = AssetInfo
  { AssetInfo -> Text
_assetInfoAsset    :: Text
  , AssetInfo -> Quantity
_assetInfoQuantity :: Quantity
  }
  deriving stock (Int -> AssetInfo -> ShowS
[AssetInfo] -> ShowS
AssetInfo -> String
(Int -> AssetInfo -> ShowS)
-> (AssetInfo -> String)
-> ([AssetInfo] -> ShowS)
-> Show AssetInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetInfo -> ShowS
showsPrec :: Int -> AssetInfo -> ShowS
$cshow :: AssetInfo -> String
show :: AssetInfo -> String
$cshowList :: [AssetInfo] -> ShowS
showList :: [AssetInfo] -> ShowS
Show, AssetInfo -> AssetInfo -> Bool
(AssetInfo -> AssetInfo -> Bool)
-> (AssetInfo -> AssetInfo -> Bool) -> Eq AssetInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetInfo -> AssetInfo -> Bool
== :: AssetInfo -> AssetInfo -> Bool
$c/= :: AssetInfo -> AssetInfo -> Bool
/= :: AssetInfo -> AssetInfo -> Bool
Eq, (forall x. AssetInfo -> Rep AssetInfo x)
-> (forall x. Rep AssetInfo x -> AssetInfo) -> Generic AssetInfo
forall x. Rep AssetInfo x -> AssetInfo
forall x. AssetInfo -> Rep AssetInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetInfo -> Rep AssetInfo x
from :: forall x. AssetInfo -> Rep AssetInfo x
$cto :: forall x. Rep AssetInfo x -> AssetInfo
to :: forall x. Rep AssetInfo x -> AssetInfo
Generic)
  deriving (Maybe AssetInfo
Value -> Parser [AssetInfo]
Value -> Parser AssetInfo
(Value -> Parser AssetInfo)
-> (Value -> Parser [AssetInfo])
-> Maybe AssetInfo
-> FromJSON AssetInfo
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AssetInfo
parseJSON :: Value -> Parser AssetInfo
$cparseJSONList :: Value -> Parser [AssetInfo]
parseJSONList :: Value -> Parser [AssetInfo]
$comittedField :: Maybe AssetInfo
omittedField :: Maybe AssetInfo
FromJSON, [AssetInfo] -> Value
[AssetInfo] -> Encoding
AssetInfo -> Bool
AssetInfo -> Value
AssetInfo -> Encoding
(AssetInfo -> Value)
-> (AssetInfo -> Encoding)
-> ([AssetInfo] -> Value)
-> ([AssetInfo] -> Encoding)
-> (AssetInfo -> Bool)
-> ToJSON AssetInfo
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AssetInfo -> Value
toJSON :: AssetInfo -> Value
$ctoEncoding :: AssetInfo -> Encoding
toEncoding :: AssetInfo -> Encoding
$ctoJSONList :: [AssetInfo] -> Value
toJSONList :: [AssetInfo] -> Value
$ctoEncodingList :: [AssetInfo] -> Encoding
toEncodingList :: [AssetInfo] -> Encoding
$comitField :: AssetInfo -> Bool
omitField :: AssetInfo -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_assetInfo", CamelToSnake]] AssetInfo

instance ToSample AssetInfo where
  toSamples :: Proxy AssetInfo -> [(Text, AssetInfo)]
toSamples = [(Text, AssetInfo)] -> Proxy AssetInfo -> [(Text, AssetInfo)]
forall a. a -> Proxy AssetInfo -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, AssetInfo)] -> Proxy AssetInfo -> [(Text, AssetInfo)])
-> [(Text, AssetInfo)] -> Proxy AssetInfo -> [(Text, AssetInfo)]
forall a b. (a -> b) -> a -> b
$ [AssetInfo] -> [(Text, AssetInfo)]
forall a. [a] -> [(Text, a)]
samples
    [ AssetInfo
        { _assetInfoAsset :: Text
_assetInfoAsset = Text
"b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e"
        , _assetInfoQuantity :: Quantity
_assetInfoQuantity = Quantity
1
        }
    , AssetInfo
        { _assetInfoAsset :: Text
_assetInfoAsset = Text
"b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e75d"
        , _assetInfoQuantity :: Quantity
_assetInfoQuantity = Quantity
100000
        }
    , AssetInfo
        { _assetInfoAsset :: Text
_assetInfoAsset = Text
"6804edf9712d2b619edb6ac86861fe93a730693183a262b165fcc1ba1bc99cad"
        , _assetInfoQuantity :: Quantity
_assetInfoQuantity = Quantity
18605647
        }
    ]

-- CIP25 uses camelCase, so we need this to derive appropriate instances
data LowerHead

instance StringModifier LowerHead where
  getStringModifier :: ShowS
getStringModifier (Char
f:String
rest) = Char -> Char
toLower Char
f Char -> ShowS
forall a. a -> [a] -> [a]
: String
rest
  getStringModifier [] = ShowS
forall a. HasCallStack => String -> a
error String
"Empty field name"

-- | Additional media files (accordingly to CIP25 and CIP68)
data MetadataMediaFile = MetadataMediaFile
  { MetadataMediaFile -> Maybe Text
_metadataMediaFileName      :: Maybe Text -- ^ file name
  , MetadataMediaFile -> Maybe Text
_metadataMediaFileMediaType :: Maybe Text -- ^ file MIME content-type
  , MetadataMediaFile -> Maybe Text
_metadataMediaFileSrc       :: Maybe Text -- ^ URI of the media file
  }
  deriving stock (Int -> MetadataMediaFile -> ShowS
[MetadataMediaFile] -> ShowS
MetadataMediaFile -> String
(Int -> MetadataMediaFile -> ShowS)
-> (MetadataMediaFile -> String)
-> ([MetadataMediaFile] -> ShowS)
-> Show MetadataMediaFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MetadataMediaFile -> ShowS
showsPrec :: Int -> MetadataMediaFile -> ShowS
$cshow :: MetadataMediaFile -> String
show :: MetadataMediaFile -> String
$cshowList :: [MetadataMediaFile] -> ShowS
showList :: [MetadataMediaFile] -> ShowS
Show, MetadataMediaFile -> MetadataMediaFile -> Bool
(MetadataMediaFile -> MetadataMediaFile -> Bool)
-> (MetadataMediaFile -> MetadataMediaFile -> Bool)
-> Eq MetadataMediaFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MetadataMediaFile -> MetadataMediaFile -> Bool
== :: MetadataMediaFile -> MetadataMediaFile -> Bool
$c/= :: MetadataMediaFile -> MetadataMediaFile -> Bool
/= :: MetadataMediaFile -> MetadataMediaFile -> Bool
Eq, (forall x. MetadataMediaFile -> Rep MetadataMediaFile x)
-> (forall x. Rep MetadataMediaFile x -> MetadataMediaFile)
-> Generic MetadataMediaFile
forall x. Rep MetadataMediaFile x -> MetadataMediaFile
forall x. MetadataMediaFile -> Rep MetadataMediaFile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MetadataMediaFile -> Rep MetadataMediaFile x
from :: forall x. MetadataMediaFile -> Rep MetadataMediaFile x
$cto :: forall x. Rep MetadataMediaFile x -> MetadataMediaFile
to :: forall x. Rep MetadataMediaFile x -> MetadataMediaFile
Generic)
  deriving (Maybe MetadataMediaFile
Value -> Parser [MetadataMediaFile]
Value -> Parser MetadataMediaFile
(Value -> Parser MetadataMediaFile)
-> (Value -> Parser [MetadataMediaFile])
-> Maybe MetadataMediaFile
-> FromJSON MetadataMediaFile
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser MetadataMediaFile
parseJSON :: Value -> Parser MetadataMediaFile
$cparseJSONList :: Value -> Parser [MetadataMediaFile]
parseJSONList :: Value -> Parser [MetadataMediaFile]
$comittedField :: Maybe MetadataMediaFile
omittedField :: Maybe MetadataMediaFile
FromJSON, [MetadataMediaFile] -> Value
[MetadataMediaFile] -> Encoding
MetadataMediaFile -> Bool
MetadataMediaFile -> Value
MetadataMediaFile -> Encoding
(MetadataMediaFile -> Value)
-> (MetadataMediaFile -> Encoding)
-> ([MetadataMediaFile] -> Value)
-> ([MetadataMediaFile] -> Encoding)
-> (MetadataMediaFile -> Bool)
-> ToJSON MetadataMediaFile
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: MetadataMediaFile -> Value
toJSON :: MetadataMediaFile -> Value
$ctoEncoding :: MetadataMediaFile -> Encoding
toEncoding :: MetadataMediaFile -> Encoding
$ctoJSONList :: [MetadataMediaFile] -> Value
toJSONList :: [MetadataMediaFile] -> Value
$ctoEncodingList :: [MetadataMediaFile] -> Encoding
toEncodingList :: [MetadataMediaFile] -> Encoding
$comitField :: MetadataMediaFile -> Bool
omitField :: MetadataMediaFile -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_metadataMediaFile", LowerHead]] MetadataMediaFile

instance ToSample MetadataMediaFile where
  toSamples :: Proxy MetadataMediaFile -> [(Text, MetadataMediaFile)]
toSamples = [(Text, MetadataMediaFile)]
-> Proxy MetadataMediaFile -> [(Text, MetadataMediaFile)]
forall a. a -> Proxy MetadataMediaFile -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, MetadataMediaFile)]
 -> Proxy MetadataMediaFile -> [(Text, MetadataMediaFile)])
-> [(Text, MetadataMediaFile)]
-> Proxy MetadataMediaFile
-> [(Text, MetadataMediaFile)]
forall a b. (a -> b) -> a -> b
$ MetadataMediaFile -> [(Text, MetadataMediaFile)]
forall a. a -> [(Text, a)]
singleSample MetadataMediaFile
sampleAssetOnChainMetadataFile

sampleAssetOnChainMetadataFile :: MetadataMediaFile
sampleAssetOnChainMetadataFile :: MetadataMediaFile
sampleAssetOnChainMetadataFile =
    MetadataMediaFile
      { _metadataMediaFileName :: Maybe Text
_metadataMediaFileName = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"Detailed image"
      , _metadataMediaFileMediaType :: Maybe Text
_metadataMediaFileMediaType = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"image/png"
      , _metadataMediaFileSrc :: Maybe Text
_metadataMediaFileSrc = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"ipfs://ipfs/QmfKyJ4tuvHowwKQCbCHj4L5T3fSj8cjs7Aau8V7BWv226"
      }

-- | On-chain metadata stored in the minting transaction under label 721,
-- community discussion around the standard ongoing at https://github.com/cardano-foundation/CIPs/pull/85
data AssetOnChainMetadata = AssetOnChainMetadata
  { AssetOnChainMetadata -> Maybe Text
_assetOnChainMetadataName        :: Maybe Text                -- ^ Name of the asset
  , AssetOnChainMetadata -> Maybe Text
_assetOnChainMetadataDescription :: Maybe Text                -- ^ Description of the asset
  , AssetOnChainMetadata -> Maybe Text
_assetOnChainMetadataImage       :: Maybe Text                -- ^ URI of the image, usually IPFS-based
  , AssetOnChainMetadata -> Maybe Text
_assetOnChainMetadataMediaType   :: Maybe Text                -- ^ image MIME content-type
  , AssetOnChainMetadata -> Maybe [MetadataMediaFile]
_assetOnChainMetadataFiles       :: Maybe [MetadataMediaFile] -- ^ Additional media files
  }
  deriving stock (Int -> AssetOnChainMetadata -> ShowS
[AssetOnChainMetadata] -> ShowS
AssetOnChainMetadata -> String
(Int -> AssetOnChainMetadata -> ShowS)
-> (AssetOnChainMetadata -> String)
-> ([AssetOnChainMetadata] -> ShowS)
-> Show AssetOnChainMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetOnChainMetadata -> ShowS
showsPrec :: Int -> AssetOnChainMetadata -> ShowS
$cshow :: AssetOnChainMetadata -> String
show :: AssetOnChainMetadata -> String
$cshowList :: [AssetOnChainMetadata] -> ShowS
showList :: [AssetOnChainMetadata] -> ShowS
Show, AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
(AssetOnChainMetadata -> AssetOnChainMetadata -> Bool)
-> (AssetOnChainMetadata -> AssetOnChainMetadata -> Bool)
-> Eq AssetOnChainMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
== :: AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
$c/= :: AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
/= :: AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
Eq, (forall x. AssetOnChainMetadata -> Rep AssetOnChainMetadata x)
-> (forall x. Rep AssetOnChainMetadata x -> AssetOnChainMetadata)
-> Generic AssetOnChainMetadata
forall x. Rep AssetOnChainMetadata x -> AssetOnChainMetadata
forall x. AssetOnChainMetadata -> Rep AssetOnChainMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetOnChainMetadata -> Rep AssetOnChainMetadata x
from :: forall x. AssetOnChainMetadata -> Rep AssetOnChainMetadata x
$cto :: forall x. Rep AssetOnChainMetadata x -> AssetOnChainMetadata
to :: forall x. Rep AssetOnChainMetadata x -> AssetOnChainMetadata
Generic)
  deriving (Maybe AssetOnChainMetadata
Value -> Parser [AssetOnChainMetadata]
Value -> Parser AssetOnChainMetadata
(Value -> Parser AssetOnChainMetadata)
-> (Value -> Parser [AssetOnChainMetadata])
-> Maybe AssetOnChainMetadata
-> FromJSON AssetOnChainMetadata
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AssetOnChainMetadata
parseJSON :: Value -> Parser AssetOnChainMetadata
$cparseJSONList :: Value -> Parser [AssetOnChainMetadata]
parseJSONList :: Value -> Parser [AssetOnChainMetadata]
$comittedField :: Maybe AssetOnChainMetadata
omittedField :: Maybe AssetOnChainMetadata
FromJSON, [AssetOnChainMetadata] -> Value
[AssetOnChainMetadata] -> Encoding
AssetOnChainMetadata -> Bool
AssetOnChainMetadata -> Value
AssetOnChainMetadata -> Encoding
(AssetOnChainMetadata -> Value)
-> (AssetOnChainMetadata -> Encoding)
-> ([AssetOnChainMetadata] -> Value)
-> ([AssetOnChainMetadata] -> Encoding)
-> (AssetOnChainMetadata -> Bool)
-> ToJSON AssetOnChainMetadata
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AssetOnChainMetadata -> Value
toJSON :: AssetOnChainMetadata -> Value
$ctoEncoding :: AssetOnChainMetadata -> Encoding
toEncoding :: AssetOnChainMetadata -> Encoding
$ctoJSONList :: [AssetOnChainMetadata] -> Value
toJSONList :: [AssetOnChainMetadata] -> Value
$ctoEncodingList :: [AssetOnChainMetadata] -> Encoding
toEncodingList :: [AssetOnChainMetadata] -> Encoding
$comitField :: AssetOnChainMetadata -> Bool
omitField :: AssetOnChainMetadata -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_assetOnChainMetadata", LowerHead]] AssetOnChainMetadata

instance ToSample AssetOnChainMetadata where
  toSamples :: Proxy AssetOnChainMetadata -> [(Text, AssetOnChainMetadata)]
toSamples = [(Text, AssetOnChainMetadata)]
-> Proxy AssetOnChainMetadata -> [(Text, AssetOnChainMetadata)]
forall a. a -> Proxy AssetOnChainMetadata -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, AssetOnChainMetadata)]
 -> Proxy AssetOnChainMetadata -> [(Text, AssetOnChainMetadata)])
-> [(Text, AssetOnChainMetadata)]
-> Proxy AssetOnChainMetadata
-> [(Text, AssetOnChainMetadata)]
forall a b. (a -> b) -> a -> b
$ AssetOnChainMetadata -> [(Text, AssetOnChainMetadata)]
forall a. a -> [(Text, a)]
singleSample (AssetOnChainMetadata -> [(Text, AssetOnChainMetadata)])
-> AssetOnChainMetadata -> [(Text, AssetOnChainMetadata)]
forall a b. (a -> b) -> a -> b
$ AssetOnChainMetadata
sampleAssetOnChainMetadata

sampleAssetOnChainMetadata :: AssetOnChainMetadata
sampleAssetOnChainMetadata :: AssetOnChainMetadata
sampleAssetOnChainMetadata = AssetOnChainMetadata
      { _assetOnChainMetadataName :: Maybe Text
_assetOnChainMetadataName = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"My NFT token"
      , _assetOnChainMetadataDescription :: Maybe Text
_assetOnChainMetadataDescription = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"A cool token for joy and fun."
      , _assetOnChainMetadataImage :: Maybe Text
_assetOnChainMetadataImage = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"ipfs://ipfs/QmfKyJ4tuvHowwKQCbCHj4L5T3fSj8cjs7Aau8V7BWv226"
      , _assetOnChainMetadataMediaType :: Maybe Text
_assetOnChainMetadataMediaType = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"image/png"
      , _assetOnChainMetadataFiles :: Maybe [MetadataMediaFile]
_assetOnChainMetadataFiles = [MetadataMediaFile] -> Maybe [MetadataMediaFile]
forall a. a -> Maybe a
Just [ MetadataMediaFile
sampleAssetOnChainMetadataFile ]
      }

-- | Asset metadata obtained from Cardano token registry
-- https://github.com/cardano-foundation/cardano-token-registry
data AssetMetadata = AssetMetadata
  { AssetMetadata -> Text
_assetMetadataName        :: Text -- ^ Asset name
  , AssetMetadata -> Text
_assetMetadataDescription :: Text -- ^ Asset description
  , AssetMetadata -> Maybe Text
_assetMetadataTicker      :: Maybe Text
  , AssetMetadata -> Maybe Text
_assetMetadataUrl         :: Maybe Text -- ^ Asset website
  ,         :: Maybe Text -- ^ Base64 encoded logo of the asset
  , AssetMetadata -> Maybe Int
_assetMetadataDecimals    :: Maybe Int -- ^ Number of decimal places of the asset unit
  }
  deriving stock (Int -> AssetMetadata -> ShowS
[AssetMetadata] -> ShowS
AssetMetadata -> String
(Int -> AssetMetadata -> ShowS)
-> (AssetMetadata -> String)
-> ([AssetMetadata] -> ShowS)
-> Show AssetMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetMetadata -> ShowS
showsPrec :: Int -> AssetMetadata -> ShowS
$cshow :: AssetMetadata -> String
show :: AssetMetadata -> String
$cshowList :: [AssetMetadata] -> ShowS
showList :: [AssetMetadata] -> ShowS
Show, AssetMetadata -> AssetMetadata -> Bool
(AssetMetadata -> AssetMetadata -> Bool)
-> (AssetMetadata -> AssetMetadata -> Bool) -> Eq AssetMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetMetadata -> AssetMetadata -> Bool
== :: AssetMetadata -> AssetMetadata -> Bool
$c/= :: AssetMetadata -> AssetMetadata -> Bool
/= :: AssetMetadata -> AssetMetadata -> Bool
Eq, (forall x. AssetMetadata -> Rep AssetMetadata x)
-> (forall x. Rep AssetMetadata x -> AssetMetadata)
-> Generic AssetMetadata
forall x. Rep AssetMetadata x -> AssetMetadata
forall x. AssetMetadata -> Rep AssetMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetMetadata -> Rep AssetMetadata x
from :: forall x. AssetMetadata -> Rep AssetMetadata x
$cto :: forall x. Rep AssetMetadata x -> AssetMetadata
to :: forall x. Rep AssetMetadata x -> AssetMetadata
Generic)
  deriving (Maybe AssetMetadata
Value -> Parser [AssetMetadata]
Value -> Parser AssetMetadata
(Value -> Parser AssetMetadata)
-> (Value -> Parser [AssetMetadata])
-> Maybe AssetMetadata
-> FromJSON AssetMetadata
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AssetMetadata
parseJSON :: Value -> Parser AssetMetadata
$cparseJSONList :: Value -> Parser [AssetMetadata]
parseJSONList :: Value -> Parser [AssetMetadata]
$comittedField :: Maybe AssetMetadata
omittedField :: Maybe AssetMetadata
FromJSON, [AssetMetadata] -> Value
[AssetMetadata] -> Encoding
AssetMetadata -> Bool
AssetMetadata -> Value
AssetMetadata -> Encoding
(AssetMetadata -> Value)
-> (AssetMetadata -> Encoding)
-> ([AssetMetadata] -> Value)
-> ([AssetMetadata] -> Encoding)
-> (AssetMetadata -> Bool)
-> ToJSON AssetMetadata
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AssetMetadata -> Value
toJSON :: AssetMetadata -> Value
$ctoEncoding :: AssetMetadata -> Encoding
toEncoding :: AssetMetadata -> Encoding
$ctoJSONList :: [AssetMetadata] -> Value
toJSONList :: [AssetMetadata] -> Value
$ctoEncodingList :: [AssetMetadata] -> Encoding
toEncodingList :: [AssetMetadata] -> Encoding
$comitField :: AssetMetadata -> Bool
omitField :: AssetMetadata -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_assetMetadata", CamelToSnake]] AssetMetadata

instance ToSample AssetMetadata where
  toSamples :: Proxy AssetMetadata -> [(Text, AssetMetadata)]
toSamples = [(Text, AssetMetadata)]
-> Proxy AssetMetadata -> [(Text, AssetMetadata)]
forall a. a -> Proxy AssetMetadata -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, AssetMetadata)]
 -> Proxy AssetMetadata -> [(Text, AssetMetadata)])
-> [(Text, AssetMetadata)]
-> Proxy AssetMetadata
-> [(Text, AssetMetadata)]
forall a b. (a -> b) -> a -> b
$ AssetMetadata -> [(Text, AssetMetadata)]
forall a. a -> [(Text, a)]
singleSample
    AssetMetadata
      { _assetMetadataName :: Text
_assetMetadataName = Text
"nutcoin"
      , _assetMetadataDescription :: Text
_assetMetadataDescription = Text
"The Nut Coin"
      , _assetMetadataTicker :: Maybe Text
_assetMetadataTicker = Text -> Maybe Text
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"nutc"
      , _assetMetadataUrl :: Maybe Text
_assetMetadataUrl = Text -> Maybe Text
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"https://www.stakenuts.com/"
      , _assetMetadataLogo :: Maybe Text
_assetMetadataLogo =  Text -> Maybe Text
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"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"
      , _assetMetadataDecimals :: Maybe Int
_assetMetadataDecimals = Int -> Maybe Int
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Int
6
      }

-- | Details of an asset
data AssetDetails = AssetDetails
  { AssetDetails -> Text
_assetDetailsAsset                :: Text -- ^ Hex-encoded asset full name
  , AssetDetails -> PolicyId
_assetDetailsPolicyId             :: PolicyId -- ^ Policy ID of the asset
  , AssetDetails -> Maybe Text
_assetDetailsAssetName            :: Maybe Text -- ^ Hex-encoded asset name of the asset
  , AssetDetails -> Text
_assetDetailsFingerprint          :: Text -- ^ CIP14 based user-facing fingerprint
  , AssetDetails -> Quantity
_assetDetailsQuantity             :: Quantity -- ^ Current asset quantity
  , AssetDetails -> TxHash
_assetDetailsInitialMintTxHash    :: TxHash -- ^ ID of the initial minting transaction
  , AssetDetails -> Integer
_assetDetailsMintOrBurnCount      :: Integer -- ^ Count of mint and burn transactions
  , AssetDetails -> Maybe Value
_assetDetailsOnchainMetadataValue :: Maybe Value
  -- ^ On-chain metadata stored in the minting transaction under label 721 for CIP25
  -- standard or in the first element in the specific constructor in a reference token's
  -- datum for CIP68 standard. In both cases this part is represenatable as JSON
  -- and might be arbitrary, so we keep it as @Value@
  , AssetDetails -> Maybe AssetOnChainMetadata
_assetDetailsOnchainStandardMetadata :: Maybe AssetOnChainMetadata
  -- ^ Some bits of on-chain metadata are considered being "standard" (like name, image and so on).
  -- If they are found in the metadata JSON bundle, this field will contain them.
  , AssetDetails -> Maybe AssetMetadata
_assetDetailsMetadata             :: Maybe AssetMetadata
  , AssetDetails -> Maybe Text
_assetDetailsOnchainMetadataExtra :: Maybe Text
  -- ^ CIP68 extra metadata plutus data (CBOR-encoded)
  }
  deriving stock (Int -> AssetDetails -> ShowS
[AssetDetails] -> ShowS
AssetDetails -> String
(Int -> AssetDetails -> ShowS)
-> (AssetDetails -> String)
-> ([AssetDetails] -> ShowS)
-> Show AssetDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetDetails -> ShowS
showsPrec :: Int -> AssetDetails -> ShowS
$cshow :: AssetDetails -> String
show :: AssetDetails -> String
$cshowList :: [AssetDetails] -> ShowS
showList :: [AssetDetails] -> ShowS
Show, AssetDetails -> AssetDetails -> Bool
(AssetDetails -> AssetDetails -> Bool)
-> (AssetDetails -> AssetDetails -> Bool) -> Eq AssetDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetDetails -> AssetDetails -> Bool
== :: AssetDetails -> AssetDetails -> Bool
$c/= :: AssetDetails -> AssetDetails -> Bool
/= :: AssetDetails -> AssetDetails -> Bool
Eq, (forall x. AssetDetails -> Rep AssetDetails x)
-> (forall x. Rep AssetDetails x -> AssetDetails)
-> Generic AssetDetails
forall x. Rep AssetDetails x -> AssetDetails
forall x. AssetDetails -> Rep AssetDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetDetails -> Rep AssetDetails x
from :: forall x. AssetDetails -> Rep AssetDetails x
$cto :: forall x. Rep AssetDetails x -> AssetDetails
to :: forall x. Rep AssetDetails x -> AssetDetails
Generic)
  deriving (Maybe AssetDetails
Value -> Parser [AssetDetails]
Value -> Parser AssetDetails
(Value -> Parser AssetDetails)
-> (Value -> Parser [AssetDetails])
-> Maybe AssetDetails
-> FromJSON AssetDetails
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AssetDetails
parseJSON :: Value -> Parser AssetDetails
$cparseJSONList :: Value -> Parser [AssetDetails]
parseJSONList :: Value -> Parser [AssetDetails]
$comittedField :: Maybe AssetDetails
omittedField :: Maybe AssetDetails
FromJSON, [AssetDetails] -> Value
[AssetDetails] -> Encoding
AssetDetails -> Bool
AssetDetails -> Value
AssetDetails -> Encoding
(AssetDetails -> Value)
-> (AssetDetails -> Encoding)
-> ([AssetDetails] -> Value)
-> ([AssetDetails] -> Encoding)
-> (AssetDetails -> Bool)
-> ToJSON AssetDetails
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AssetDetails -> Value
toJSON :: AssetDetails -> Value
$ctoEncoding :: AssetDetails -> Encoding
toEncoding :: AssetDetails -> Encoding
$ctoJSONList :: [AssetDetails] -> Value
toJSONList :: [AssetDetails] -> Value
$ctoEncodingList :: [AssetDetails] -> Encoding
toEncodingList :: [AssetDetails] -> Encoding
$comitField :: AssetDetails -> Bool
omitField :: AssetDetails -> Bool
ToJSON)
  via CustomJSON '[ FieldLabelModifier
                    '[ StripPrefix "_assetDetails"
                     , CamelToSnake
                     , Rename "onchain_metadata_value" "onchain_metadata"
                     ]
                  ] AssetDetails

parseStandardMetadata :: Maybe Value -> Maybe AssetOnChainMetadata
parseStandardMetadata :: Maybe Value -> Maybe AssetOnChainMetadata
parseStandardMetadata Maybe Value
mbValue = Maybe Value
mbValue Maybe Value
-> (Value -> Maybe AssetOnChainMetadata)
-> Maybe AssetOnChainMetadata
forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Value -> Parser AssetOnChainMetadata)
-> Value -> Maybe AssetOnChainMetadata
forall a b. (a -> Parser b) -> a -> Maybe b
parseMaybe Value -> Parser AssetOnChainMetadata
forall a. FromJSON a => Value -> Parser a
parseJSON

parseStandardMetadataInDetails :: AssetDetails -> AssetDetails
parseStandardMetadataInDetails :: AssetDetails -> AssetDetails
parseStandardMetadataInDetails
  details :: AssetDetails
details@AssetDetails{_assetDetailsOnchainMetadataValue :: AssetDetails -> Maybe Value
_assetDetailsOnchainMetadataValue = Maybe Value
mbValue} =
  AssetDetails
details { _assetDetailsOnchainStandardMetadata = parseStandardMetadata mbValue}


instance ToSample AssetDetails where
  toSamples :: Proxy AssetDetails -> [(Text, AssetDetails)]
toSamples = [(Text, AssetDetails)]
-> Proxy AssetDetails -> [(Text, AssetDetails)]
forall a. a -> Proxy AssetDetails -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, AssetDetails)]
 -> Proxy AssetDetails -> [(Text, AssetDetails)])
-> [(Text, AssetDetails)]
-> Proxy AssetDetails
-> [(Text, AssetDetails)]
forall a b. (a -> b) -> a -> b
$ AssetDetails -> [(Text, AssetDetails)]
forall a. a -> [(Text, a)]
singleSample
    AssetDetails
      { _assetDetailsAsset :: Text
_assetDetailsAsset = Text
"b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e"
      , _assetDetailsPolicyId :: PolicyId
_assetDetailsPolicyId = PolicyId
"b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a7"
      , _assetDetailsAssetName :: Maybe Text
_assetDetailsAssetName = Text -> Maybe Text
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"6e7574636f696e"
      , _assetDetailsFingerprint :: Text
_assetDetailsFingerprint = Text
"asset1pkpwyknlvul7az0xx8czhl60pyel45rpje4z8w"
      , _assetDetailsQuantity :: Quantity
_assetDetailsQuantity = Quantity
12000
      , _assetDetailsInitialMintTxHash :: TxHash
_assetDetailsInitialMintTxHash = TxHash
"6804edf9712d2b619edb6ac86861fe93a730693183a262b165fcc1ba1bc99cad"
      , _assetDetailsMintOrBurnCount :: Integer
_assetDetailsMintOrBurnCount = Integer
1
      , _assetDetailsOnchainMetadataValue :: Maybe Value
_assetDetailsOnchainMetadataValue = Value -> Maybe Value
forall a. a -> Maybe a
Just (Value -> Maybe Value) -> Value -> Maybe Value
forall a b. (a -> b) -> a -> b
$
          (
            Object -> Value
Object
             ([Pair] -> Object
forall v. [(Key, v)] -> KeyMap v
fromList
               [ (Key
"id",Scientific -> Value
Number Scientific
630.0)
               , (Key
"image",Text -> Value
String Text
"ipfs://ipfs/QmfKyJ4tuvHowwKQCbCHj4L5T3fSj8cjs7Aau8V7BWv226")
               , (Key
"mediaType",Text -> Value
String Text
"image/png")
               , (Key
"name",Text -> Value
String Text
"My NFT token")
               , (Key
"files", Array -> Value
Array
                   ( Value -> Array
forall a. a -> Vector a
V.singleton
                     (Object -> Value
Object
                       ([Pair] -> Object
forall v. [(Key, v)] -> KeyMap v
fromList
                         [ (Key
"name", Text -> Value
String Text
"Detailed image")
                         , (Key
"mediaType", Text -> Value
String Text
"image/png")
                         , (Key
"src", Text -> Value
String Text
"ipfs://ipfs/QmfKyJ4tuvHowwKQCbCHj4L5T3fSj8cjs7Aau8V7BWv226")
                         ]
                       )
                     )
                   )
                 )
               ]
             )
          )
      , _assetDetailsOnchainStandardMetadata :: Maybe AssetOnChainMetadata
_assetDetailsOnchainStandardMetadata = AssetOnChainMetadata -> Maybe AssetOnChainMetadata
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure AssetOnChainMetadata
sampleAssetOnChainMetadata
      , _assetDetailsMetadata :: Maybe AssetMetadata
_assetDetailsMetadata = AssetMetadata -> Maybe AssetMetadata
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AssetMetadata -> Maybe AssetMetadata)
-> AssetMetadata -> Maybe AssetMetadata
forall a b. (a -> b) -> a -> b
$
          AssetMetadata
            { _assetMetadataName :: Text
_assetMetadataName = Text
"nutcoin"
            , _assetMetadataDescription :: Text
_assetMetadataDescription = Text
"The Nut Coin"
            , _assetMetadataTicker :: Maybe Text
_assetMetadataTicker = Text -> Maybe Text
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"nutc"
            , _assetMetadataUrl :: Maybe Text
_assetMetadataUrl = Text -> Maybe Text
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"https://www.stakenuts.com/"
            , _assetMetadataLogo :: Maybe Text
_assetMetadataLogo =  Text -> Maybe Text
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"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"
            , _assetMetadataDecimals :: Maybe Int
_assetMetadataDecimals = Int -> Maybe Int
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Int
6
            }
      , _assetDetailsOnchainMetadataExtra :: Maybe Text
_assetDetailsOnchainMetadataExtra = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
"9f01582430303030303030302d303030302d303030302d303030302d3030303030303030303132334d47616d65585f4578616d706c65020203454c6576656c413145506f7765724231304553706565644131ff"
      }

-- | Action of the asset.
-- Created (`Minted`) or destroyed (`Burned`).
data AssetAction = Minted | Burned
  deriving stock (Int -> AssetAction -> ShowS
[AssetAction] -> ShowS
AssetAction -> String
(Int -> AssetAction -> ShowS)
-> (AssetAction -> String)
-> ([AssetAction] -> ShowS)
-> Show AssetAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetAction -> ShowS
showsPrec :: Int -> AssetAction -> ShowS
$cshow :: AssetAction -> String
show :: AssetAction -> String
$cshowList :: [AssetAction] -> ShowS
showList :: [AssetAction] -> ShowS
Show, AssetAction -> AssetAction -> Bool
(AssetAction -> AssetAction -> Bool)
-> (AssetAction -> AssetAction -> Bool) -> Eq AssetAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetAction -> AssetAction -> Bool
== :: AssetAction -> AssetAction -> Bool
$c/= :: AssetAction -> AssetAction -> Bool
/= :: AssetAction -> AssetAction -> Bool
Eq, (forall x. AssetAction -> Rep AssetAction x)
-> (forall x. Rep AssetAction x -> AssetAction)
-> Generic AssetAction
forall x. Rep AssetAction x -> AssetAction
forall x. AssetAction -> Rep AssetAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetAction -> Rep AssetAction x
from :: forall x. AssetAction -> Rep AssetAction x
$cto :: forall x. Rep AssetAction x -> AssetAction
to :: forall x. Rep AssetAction x -> AssetAction
Generic)
  deriving (Maybe AssetAction
Value -> Parser [AssetAction]
Value -> Parser AssetAction
(Value -> Parser AssetAction)
-> (Value -> Parser [AssetAction])
-> Maybe AssetAction
-> FromJSON AssetAction
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AssetAction
parseJSON :: Value -> Parser AssetAction
$cparseJSONList :: Value -> Parser [AssetAction]
parseJSONList :: Value -> Parser [AssetAction]
$comittedField :: Maybe AssetAction
omittedField :: Maybe AssetAction
FromJSON, [AssetAction] -> Value
[AssetAction] -> Encoding
AssetAction -> Bool
AssetAction -> Value
AssetAction -> Encoding
(AssetAction -> Value)
-> (AssetAction -> Encoding)
-> ([AssetAction] -> Value)
-> ([AssetAction] -> Encoding)
-> (AssetAction -> Bool)
-> ToJSON AssetAction
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AssetAction -> Value
toJSON :: AssetAction -> Value
$ctoEncoding :: AssetAction -> Encoding
toEncoding :: AssetAction -> Encoding
$ctoJSONList :: [AssetAction] -> Value
toJSONList :: [AssetAction] -> Value
$ctoEncodingList :: [AssetAction] -> Encoding
toEncodingList :: [AssetAction] -> Encoding
$comitField :: AssetAction -> Bool
omitField :: AssetAction -> Bool
ToJSON)
  via CustomJSON '[ConstructorTagModifier '[ToLower]] AssetAction

instance ToSample AssetAction where
  toSamples :: Proxy AssetAction -> [(Text, AssetAction)]
toSamples = [(Text, AssetAction)] -> Proxy AssetAction -> [(Text, AssetAction)]
forall a. a -> Proxy AssetAction -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, AssetAction)]
 -> Proxy AssetAction -> [(Text, AssetAction)])
-> [(Text, AssetAction)]
-> Proxy AssetAction
-> [(Text, AssetAction)]
forall a b. (a -> b) -> a -> b
$ [AssetAction] -> [(Text, AssetAction)]
forall a. [a] -> [(Text, a)]
samples [ AssetAction
Minted, AssetAction
Burned ]

-- | History of an asset
data AssetHistory = AssetHistory
  { AssetHistory -> TxHash
_assetHistoryTxHash :: TxHash -- ^ Hash of the transaction containing the asset action
  , AssetHistory -> Quantity
_assetHistoryAmount :: Quantity -- ^ Asset amount of the specific action
  , AssetHistory -> AssetAction
_assetHistoryAction :: AssetAction -- ^ Action executed upon the asset policy
  } deriving stock (Int -> AssetHistory -> ShowS
[AssetHistory] -> ShowS
AssetHistory -> String
(Int -> AssetHistory -> ShowS)
-> (AssetHistory -> String)
-> ([AssetHistory] -> ShowS)
-> Show AssetHistory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetHistory -> ShowS
showsPrec :: Int -> AssetHistory -> ShowS
$cshow :: AssetHistory -> String
show :: AssetHistory -> String
$cshowList :: [AssetHistory] -> ShowS
showList :: [AssetHistory] -> ShowS
Show, AssetHistory -> AssetHistory -> Bool
(AssetHistory -> AssetHistory -> Bool)
-> (AssetHistory -> AssetHistory -> Bool) -> Eq AssetHistory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetHistory -> AssetHistory -> Bool
== :: AssetHistory -> AssetHistory -> Bool
$c/= :: AssetHistory -> AssetHistory -> Bool
/= :: AssetHistory -> AssetHistory -> Bool
Eq, (forall x. AssetHistory -> Rep AssetHistory x)
-> (forall x. Rep AssetHistory x -> AssetHistory)
-> Generic AssetHistory
forall x. Rep AssetHistory x -> AssetHistory
forall x. AssetHistory -> Rep AssetHistory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetHistory -> Rep AssetHistory x
from :: forall x. AssetHistory -> Rep AssetHistory x
$cto :: forall x. Rep AssetHistory x -> AssetHistory
to :: forall x. Rep AssetHistory x -> AssetHistory
Generic)
  deriving (Maybe AssetHistory
Value -> Parser [AssetHistory]
Value -> Parser AssetHistory
(Value -> Parser AssetHistory)
-> (Value -> Parser [AssetHistory])
-> Maybe AssetHistory
-> FromJSON AssetHistory
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AssetHistory
parseJSON :: Value -> Parser AssetHistory
$cparseJSONList :: Value -> Parser [AssetHistory]
parseJSONList :: Value -> Parser [AssetHistory]
$comittedField :: Maybe AssetHistory
omittedField :: Maybe AssetHistory
FromJSON, [AssetHistory] -> Value
[AssetHistory] -> Encoding
AssetHistory -> Bool
AssetHistory -> Value
AssetHistory -> Encoding
(AssetHistory -> Value)
-> (AssetHistory -> Encoding)
-> ([AssetHistory] -> Value)
-> ([AssetHistory] -> Encoding)
-> (AssetHistory -> Bool)
-> ToJSON AssetHistory
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AssetHistory -> Value
toJSON :: AssetHistory -> Value
$ctoEncoding :: AssetHistory -> Encoding
toEncoding :: AssetHistory -> Encoding
$ctoJSONList :: [AssetHistory] -> Value
toJSONList :: [AssetHistory] -> Value
$ctoEncodingList :: [AssetHistory] -> Encoding
toEncodingList :: [AssetHistory] -> Encoding
$comitField :: AssetHistory -> Bool
omitField :: AssetHistory -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_assetHistory", CamelToSnake]] AssetHistory

instance ToSample AssetHistory where
  toSamples :: Proxy AssetHistory -> [(Text, AssetHistory)]
toSamples = [(Text, AssetHistory)]
-> Proxy AssetHistory -> [(Text, AssetHistory)]
forall a. a -> Proxy AssetHistory -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, AssetHistory)]
 -> Proxy AssetHistory -> [(Text, AssetHistory)])
-> [(Text, AssetHistory)]
-> Proxy AssetHistory
-> [(Text, AssetHistory)]
forall a b. (a -> b) -> a -> b
$ [AssetHistory] -> [(Text, AssetHistory)]
forall a. [a] -> [(Text, a)]
samples
    [ AssetHistory
        { _assetHistoryTxHash :: TxHash
_assetHistoryTxHash = TxHash
"2dd15e0ef6e6a17841cb9541c27724072ce4d4b79b91e58432fbaa32d9572531"
        , _assetHistoryAmount :: Quantity
_assetHistoryAmount = Quantity
10
        , _assetHistoryAction :: AssetAction
_assetHistoryAction = AssetAction
Minted
        }
    , AssetHistory
        { _assetHistoryTxHash :: TxHash
_assetHistoryTxHash = TxHash
"9c190bc1ac88b2ab0c05a82d7de8b71b67a9316377e865748a89d4426c0d3005"
        , _assetHistoryAmount :: Quantity
_assetHistoryAmount = Quantity
5
        , _assetHistoryAction :: AssetAction
_assetHistoryAction = AssetAction
Burned
        }
    , AssetHistory
        { _assetHistoryTxHash :: TxHash
_assetHistoryTxHash = TxHash
"1a0570af966fb355a7160e4f82d5a80b8681b7955f5d44bec0dde628516157f0"
        , _assetHistoryAmount :: Quantity
_assetHistoryAmount = Quantity
5
        , _assetHistoryAction :: AssetAction
_assetHistoryAction = AssetAction
Burned
        }
    ]

-- | Transaction of an asset
data AssetTransaction = AssetTransaction
  { AssetTransaction -> TxHash
_assetTransactionTxHash      :: TxHash -- ^ Hash of the transaction
  , AssetTransaction -> Integer
_assetTransactionTxIndex     :: Integer -- ^ Transaction index within the block
  , AssetTransaction -> Integer
_assetTransactionBlockHeight :: Integer -- ^ Block height
  , AssetTransaction -> POSIXTime
_assetTransactionBlockTime   :: POSIXTime -- ^ Block creation time in UNIX time
  }
  deriving stock (Int -> AssetTransaction -> ShowS
[AssetTransaction] -> ShowS
AssetTransaction -> String
(Int -> AssetTransaction -> ShowS)
-> (AssetTransaction -> String)
-> ([AssetTransaction] -> ShowS)
-> Show AssetTransaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetTransaction -> ShowS
showsPrec :: Int -> AssetTransaction -> ShowS
$cshow :: AssetTransaction -> String
show :: AssetTransaction -> String
$cshowList :: [AssetTransaction] -> ShowS
showList :: [AssetTransaction] -> ShowS
Show, AssetTransaction -> AssetTransaction -> Bool
(AssetTransaction -> AssetTransaction -> Bool)
-> (AssetTransaction -> AssetTransaction -> Bool)
-> Eq AssetTransaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetTransaction -> AssetTransaction -> Bool
== :: AssetTransaction -> AssetTransaction -> Bool
$c/= :: AssetTransaction -> AssetTransaction -> Bool
/= :: AssetTransaction -> AssetTransaction -> Bool
Eq, (forall x. AssetTransaction -> Rep AssetTransaction x)
-> (forall x. Rep AssetTransaction x -> AssetTransaction)
-> Generic AssetTransaction
forall x. Rep AssetTransaction x -> AssetTransaction
forall x. AssetTransaction -> Rep AssetTransaction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetTransaction -> Rep AssetTransaction x
from :: forall x. AssetTransaction -> Rep AssetTransaction x
$cto :: forall x. Rep AssetTransaction x -> AssetTransaction
to :: forall x. Rep AssetTransaction x -> AssetTransaction
Generic)
  deriving (Maybe AssetTransaction
Value -> Parser [AssetTransaction]
Value -> Parser AssetTransaction
(Value -> Parser AssetTransaction)
-> (Value -> Parser [AssetTransaction])
-> Maybe AssetTransaction
-> FromJSON AssetTransaction
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AssetTransaction
parseJSON :: Value -> Parser AssetTransaction
$cparseJSONList :: Value -> Parser [AssetTransaction]
parseJSONList :: Value -> Parser [AssetTransaction]
$comittedField :: Maybe AssetTransaction
omittedField :: Maybe AssetTransaction
FromJSON, [AssetTransaction] -> Value
[AssetTransaction] -> Encoding
AssetTransaction -> Bool
AssetTransaction -> Value
AssetTransaction -> Encoding
(AssetTransaction -> Value)
-> (AssetTransaction -> Encoding)
-> ([AssetTransaction] -> Value)
-> ([AssetTransaction] -> Encoding)
-> (AssetTransaction -> Bool)
-> ToJSON AssetTransaction
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AssetTransaction -> Value
toJSON :: AssetTransaction -> Value
$ctoEncoding :: AssetTransaction -> Encoding
toEncoding :: AssetTransaction -> Encoding
$ctoJSONList :: [AssetTransaction] -> Value
toJSONList :: [AssetTransaction] -> Value
$ctoEncodingList :: [AssetTransaction] -> Encoding
toEncodingList :: [AssetTransaction] -> Encoding
$comitField :: AssetTransaction -> Bool
omitField :: AssetTransaction -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_assetTransaction", CamelToSnake]] AssetTransaction

instance ToSample AssetTransaction where
  toSamples :: Proxy AssetTransaction -> [(Text, AssetTransaction)]
toSamples = [(Text, AssetTransaction)]
-> Proxy AssetTransaction -> [(Text, AssetTransaction)]
forall a. a -> Proxy AssetTransaction -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, AssetTransaction)]
 -> Proxy AssetTransaction -> [(Text, AssetTransaction)])
-> [(Text, AssetTransaction)]
-> Proxy AssetTransaction
-> [(Text, AssetTransaction)]
forall a b. (a -> b) -> a -> b
$ [AssetTransaction] -> [(Text, AssetTransaction)]
forall a. [a] -> [(Text, a)]
samples
    [ AssetTransaction
        { _assetTransactionTxHash :: TxHash
_assetTransactionTxHash = TxHash
"8788591983aa73981fc92d6cddbbe643959f5a784e84b8bee0db15823f575a5b"
        , _assetTransactionTxIndex :: Integer
_assetTransactionTxIndex = Integer
6
        , _assetTransactionBlockHeight :: Integer
_assetTransactionBlockHeight = Integer
69
        , _assetTransactionBlockTime :: POSIXTime
_assetTransactionBlockTime = POSIXTime
1635505891
        }
    , AssetTransaction
        { _assetTransactionTxHash :: TxHash
_assetTransactionTxHash = TxHash
"52e748c4dec58b687b90b0b40d383b9fe1f24c1a833b7395cdf07dd67859f46f"
        , _assetTransactionTxIndex :: Integer
_assetTransactionTxIndex = Integer
9
        , _assetTransactionBlockHeight :: Integer
_assetTransactionBlockHeight = Integer
4547
        , _assetTransactionBlockTime :: POSIXTime
_assetTransactionBlockTime = POSIXTime
1635505987
        }
     , AssetTransaction
        { _assetTransactionTxHash :: TxHash
_assetTransactionTxHash = TxHash
"e8073fd5318ff43eca18a852527166aa8008bee9ee9e891f585612b7e4ba700b"
        , _assetTransactionTxIndex :: Integer
_assetTransactionTxIndex = Integer
0
        , _assetTransactionBlockHeight :: Integer
_assetTransactionBlockHeight = Integer
564654
        , _assetTransactionBlockTime :: POSIXTime
_assetTransactionBlockTime = POSIXTime
1834505492
        }
    ]

-- | An address containing specific asset
data AssetAddress = AssetAddress
  { AssetAddress -> Address
_assetAddressAddress  :: Address -- ^ Address containing the specific asset
  , AssetAddress -> Quantity
_assetAddressQuantity :: Quantity -- ^ Asset quantity on the specific address
  } deriving stock (Int -> AssetAddress -> ShowS
[AssetAddress] -> ShowS
AssetAddress -> String
(Int -> AssetAddress -> ShowS)
-> (AssetAddress -> String)
-> ([AssetAddress] -> ShowS)
-> Show AssetAddress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetAddress -> ShowS
showsPrec :: Int -> AssetAddress -> ShowS
$cshow :: AssetAddress -> String
show :: AssetAddress -> String
$cshowList :: [AssetAddress] -> ShowS
showList :: [AssetAddress] -> ShowS
Show, AssetAddress -> AssetAddress -> Bool
(AssetAddress -> AssetAddress -> Bool)
-> (AssetAddress -> AssetAddress -> Bool) -> Eq AssetAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetAddress -> AssetAddress -> Bool
== :: AssetAddress -> AssetAddress -> Bool
$c/= :: AssetAddress -> AssetAddress -> Bool
/= :: AssetAddress -> AssetAddress -> Bool
Eq, (forall x. AssetAddress -> Rep AssetAddress x)
-> (forall x. Rep AssetAddress x -> AssetAddress)
-> Generic AssetAddress
forall x. Rep AssetAddress x -> AssetAddress
forall x. AssetAddress -> Rep AssetAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetAddress -> Rep AssetAddress x
from :: forall x. AssetAddress -> Rep AssetAddress x
$cto :: forall x. Rep AssetAddress x -> AssetAddress
to :: forall x. Rep AssetAddress x -> AssetAddress
Generic)
  deriving (Maybe AssetAddress
Value -> Parser [AssetAddress]
Value -> Parser AssetAddress
(Value -> Parser AssetAddress)
-> (Value -> Parser [AssetAddress])
-> Maybe AssetAddress
-> FromJSON AssetAddress
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser AssetAddress
parseJSON :: Value -> Parser AssetAddress
$cparseJSONList :: Value -> Parser [AssetAddress]
parseJSONList :: Value -> Parser [AssetAddress]
$comittedField :: Maybe AssetAddress
omittedField :: Maybe AssetAddress
FromJSON, [AssetAddress] -> Value
[AssetAddress] -> Encoding
AssetAddress -> Bool
AssetAddress -> Value
AssetAddress -> Encoding
(AssetAddress -> Value)
-> (AssetAddress -> Encoding)
-> ([AssetAddress] -> Value)
-> ([AssetAddress] -> Encoding)
-> (AssetAddress -> Bool)
-> ToJSON AssetAddress
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: AssetAddress -> Value
toJSON :: AssetAddress -> Value
$ctoEncoding :: AssetAddress -> Encoding
toEncoding :: AssetAddress -> Encoding
$ctoJSONList :: [AssetAddress] -> Value
toJSONList :: [AssetAddress] -> Value
$ctoEncodingList :: [AssetAddress] -> Encoding
toEncodingList :: [AssetAddress] -> Encoding
$comitField :: AssetAddress -> Bool
omitField :: AssetAddress -> Bool
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_assetAddress", CamelToSnake]] AssetAddress

instance ToSample AssetAddress where
  toSamples :: Proxy AssetAddress -> [(Text, AssetAddress)]
toSamples = [(Text, AssetAddress)]
-> Proxy AssetAddress -> [(Text, AssetAddress)]
forall a. a -> Proxy AssetAddress -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([(Text, AssetAddress)]
 -> Proxy AssetAddress -> [(Text, AssetAddress)])
-> [(Text, AssetAddress)]
-> Proxy AssetAddress
-> [(Text, AssetAddress)]
forall a b. (a -> b) -> a -> b
$ [AssetAddress] -> [(Text, AssetAddress)]
forall a. [a] -> [(Text, a)]
samples
    [ AssetAddress
        { _assetAddressAddress :: Address
_assetAddressAddress = Address
"addr1qxqs59lphg8g6qndelq8xwqn60ag3aeyfcp33c2kdp46a09re5df3pzwwmyq946axfcejy5n4x0y99wqpgtp2gd0k09qsgy6pz"
        , _assetAddressQuantity :: Quantity
_assetAddressQuantity = Quantity
1
        }
    , AssetAddress
        { _assetAddressAddress :: Address
_assetAddressAddress = Address
"addr1qyhr4exrgavdcn3qhfcc9f939fzsch2re5ry9cwvcdyh4x4re5df3pzwwmyq946axfcejy5n4x0y99wqpgtp2gd0k09qdpvhza"
        , _assetAddressQuantity :: Quantity
_assetAddressQuantity = Quantity
100000
        }
     , AssetAddress
        { _assetAddressAddress :: Address
_assetAddressAddress = Address
"addr1q8zup8m9ue3p98kxlxl9q8rnyan8hw3ul282tsl9s326dfj088lvedv4zckcj24arcpasr0gua4c5gq4zw2rpcpjk2lq8cmd9l"
        , _assetAddressQuantity :: Quantity
_assetAddressQuantity = Quantity
18605647
        }
    ]