-- | Responses for Cardano asset queries

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

import Blockfrost.Types.Shared
import Data.Text (Text)
import Deriving.Aeson
import Servant.Docs (ToSample (..), samples, singleSample)

-- | 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
showList :: [AssetInfo] -> ShowS
$cshowList :: [AssetInfo] -> ShowS
show :: AssetInfo -> String
$cshow :: AssetInfo -> String
showsPrec :: Int -> AssetInfo -> ShowS
$cshowsPrec :: Int -> AssetInfo -> ShowS
Show, AssetInfo -> AssetInfo -> Bool
(AssetInfo -> AssetInfo -> Bool)
-> (AssetInfo -> AssetInfo -> Bool) -> Eq AssetInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetInfo -> AssetInfo -> Bool
$c/= :: AssetInfo -> AssetInfo -> Bool
== :: AssetInfo -> AssetInfo -> Bool
$c== :: 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
$cto :: forall x. Rep AssetInfo x -> AssetInfo
$cfrom :: forall x. AssetInfo -> Rep AssetInfo x
Generic)
  deriving (Value -> Parser [AssetInfo]
Value -> Parser AssetInfo
(Value -> Parser AssetInfo)
-> (Value -> Parser [AssetInfo]) -> FromJSON AssetInfo
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AssetInfo]
$cparseJSONList :: Value -> Parser [AssetInfo]
parseJSON :: Value -> Parser AssetInfo
$cparseJSON :: Value -> Parser AssetInfo
FromJSON, [AssetInfo] -> Encoding
[AssetInfo] -> Value
AssetInfo -> Encoding
AssetInfo -> Value
(AssetInfo -> Value)
-> (AssetInfo -> Encoding)
-> ([AssetInfo] -> Value)
-> ([AssetInfo] -> Encoding)
-> ToJSON AssetInfo
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AssetInfo] -> Encoding
$ctoEncodingList :: [AssetInfo] -> Encoding
toJSONList :: [AssetInfo] -> Value
$ctoJSONList :: [AssetInfo] -> Value
toEncoding :: AssetInfo -> Encoding
$ctoEncoding :: AssetInfo -> Encoding
toJSON :: AssetInfo -> Value
$ctoJSON :: AssetInfo -> Value
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 (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 :: Text -> Quantity -> AssetInfo
AssetInfo
        { _assetInfoAsset :: Text
_assetInfoAsset = Text
"b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e"
        , _assetInfoQuantity :: Quantity
_assetInfoQuantity = Quantity
1
        }
    , AssetInfo :: Text -> Quantity -> AssetInfo
AssetInfo
        { _assetInfoAsset :: Text
_assetInfoAsset = Text
"b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e75d"
        , _assetInfoQuantity :: Quantity
_assetInfoQuantity = Quantity
100000
        }
    , AssetInfo :: Text -> Quantity -> AssetInfo
AssetInfo
        { _assetInfoAsset :: Text
_assetInfoAsset = Text
"6804edf9712d2b619edb6ac86861fe93a730693183a262b165fcc1ba1bc99cad"
        , _assetInfoQuantity :: Quantity
_assetInfoQuantity = Quantity
18605647
        }
    ]

-- | 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 -> Text
_assetOnChainMetadataName  :: Text -- ^ Name of the asset
  , AssetOnChainMetadata -> Text
_assetOnChainMetadataImage :: Text -- ^ URI of the associated asset
  -- TODO: in schema has `additionalProperties: true`
  -- so it can carry more arbitrary properties, keep as Value?
  }
  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
showList :: [AssetOnChainMetadata] -> ShowS
$cshowList :: [AssetOnChainMetadata] -> ShowS
show :: AssetOnChainMetadata -> String
$cshow :: AssetOnChainMetadata -> String
showsPrec :: Int -> AssetOnChainMetadata -> ShowS
$cshowsPrec :: Int -> AssetOnChainMetadata -> ShowS
Show, AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
(AssetOnChainMetadata -> AssetOnChainMetadata -> Bool)
-> (AssetOnChainMetadata -> AssetOnChainMetadata -> Bool)
-> Eq AssetOnChainMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
$c/= :: AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
== :: AssetOnChainMetadata -> AssetOnChainMetadata -> Bool
$c== :: 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
$cto :: forall x. Rep AssetOnChainMetadata x -> AssetOnChainMetadata
$cfrom :: forall x. AssetOnChainMetadata -> Rep AssetOnChainMetadata x
Generic)
  deriving (Value -> Parser [AssetOnChainMetadata]
Value -> Parser AssetOnChainMetadata
(Value -> Parser AssetOnChainMetadata)
-> (Value -> Parser [AssetOnChainMetadata])
-> FromJSON AssetOnChainMetadata
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AssetOnChainMetadata]
$cparseJSONList :: Value -> Parser [AssetOnChainMetadata]
parseJSON :: Value -> Parser AssetOnChainMetadata
$cparseJSON :: Value -> Parser AssetOnChainMetadata
FromJSON, [AssetOnChainMetadata] -> Encoding
[AssetOnChainMetadata] -> Value
AssetOnChainMetadata -> Encoding
AssetOnChainMetadata -> Value
(AssetOnChainMetadata -> Value)
-> (AssetOnChainMetadata -> Encoding)
-> ([AssetOnChainMetadata] -> Value)
-> ([AssetOnChainMetadata] -> Encoding)
-> ToJSON AssetOnChainMetadata
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AssetOnChainMetadata] -> Encoding
$ctoEncodingList :: [AssetOnChainMetadata] -> Encoding
toJSONList :: [AssetOnChainMetadata] -> Value
$ctoJSONList :: [AssetOnChainMetadata] -> Value
toEncoding :: AssetOnChainMetadata -> Encoding
$ctoEncoding :: AssetOnChainMetadata -> Encoding
toJSON :: AssetOnChainMetadata -> Value
$ctoJSON :: AssetOnChainMetadata -> Value
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_assetOnChainMetadata", CamelToSnake]] AssetOnChainMetadata

instance ToSample AssetOnChainMetadata where
  toSamples :: Proxy AssetOnChainMetadata -> [(Text, AssetOnChainMetadata)]
toSamples = [(Text, AssetOnChainMetadata)]
-> Proxy AssetOnChainMetadata -> [(Text, AssetOnChainMetadata)]
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 -> Text -> AssetOnChainMetadata
AssetOnChainMetadata
      { _assetOnChainMetadataName :: Text
_assetOnChainMetadataName = Text
"My NFT token"
      , _assetOnChainMetadataImage :: Text
_assetOnChainMetadataImage = Text
"ipfs://ipfs/QmfKyJ4tuvHowwKQCbCHj4L5T3fSj8cjs7Aau8V7BWv226"
      }

-- | 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
showList :: [AssetMetadata] -> ShowS
$cshowList :: [AssetMetadata] -> ShowS
show :: AssetMetadata -> String
$cshow :: AssetMetadata -> String
showsPrec :: Int -> AssetMetadata -> ShowS
$cshowsPrec :: Int -> AssetMetadata -> ShowS
Show, AssetMetadata -> AssetMetadata -> Bool
(AssetMetadata -> AssetMetadata -> Bool)
-> (AssetMetadata -> AssetMetadata -> Bool) -> Eq AssetMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetMetadata -> AssetMetadata -> Bool
$c/= :: AssetMetadata -> AssetMetadata -> Bool
== :: AssetMetadata -> AssetMetadata -> Bool
$c== :: 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
$cto :: forall x. Rep AssetMetadata x -> AssetMetadata
$cfrom :: forall x. AssetMetadata -> Rep AssetMetadata x
Generic)
  deriving (Value -> Parser [AssetMetadata]
Value -> Parser AssetMetadata
(Value -> Parser AssetMetadata)
-> (Value -> Parser [AssetMetadata]) -> FromJSON AssetMetadata
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AssetMetadata]
$cparseJSONList :: Value -> Parser [AssetMetadata]
parseJSON :: Value -> Parser AssetMetadata
$cparseJSON :: Value -> Parser AssetMetadata
FromJSON, [AssetMetadata] -> Encoding
[AssetMetadata] -> Value
AssetMetadata -> Encoding
AssetMetadata -> Value
(AssetMetadata -> Value)
-> (AssetMetadata -> Encoding)
-> ([AssetMetadata] -> Value)
-> ([AssetMetadata] -> Encoding)
-> ToJSON AssetMetadata
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AssetMetadata] -> Encoding
$ctoEncodingList :: [AssetMetadata] -> Encoding
toJSONList :: [AssetMetadata] -> Value
$ctoJSONList :: [AssetMetadata] -> Value
toEncoding :: AssetMetadata -> Encoding
$ctoEncoding :: AssetMetadata -> Encoding
toJSON :: AssetMetadata -> Value
$ctoJSON :: AssetMetadata -> Value
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 (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 :: Text
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> AssetMetadata
AssetMetadata
      { _assetMetadataName :: Text
_assetMetadataName = Text
"nutcoin"
      , _assetMetadataDescription :: Text
_assetMetadataDescription = Text
"The Nut Coin"
      , _assetMetadataTicker :: Maybe Text
_assetMetadataTicker = Text -> Maybe Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"nutc"
      , _assetMetadataUrl :: Maybe Text
_assetMetadataUrl = Text -> Maybe Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"https://www.stakenuts.com/"
      , _assetMetadataLogo :: Maybe Text
_assetMetadataLogo =  Text -> Maybe Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"iVBORw0KGgoAAAANSUhEUgAAADAAAAAoCAYAAAC4h3lxAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH5QITCDUPjqwFHwAAB9xJREFUWMPVWXtsU9cZ/8499/r6dZ3E9rUdO7ZDEgglFWO8KaOsJW0pCLRKrN1AqqYVkqoqrYo0ja7bpElru1WairStFKY9WzaE1E1tx+jokKqwtqFNyhKahEJJyJNgJ37E9r1+3HvO/sFR4vhx7SBtfH/F3/l93/f7ne/4PBxEKYU72dj/ZfH772v1TU+HtqbTaX8wOO01GPQpRVH7JEm+vGHDuq6z7/8jUSoHKtaBKkEUFUXdajDy1hUrmrs6zn/wWS7m7pZVjMUirKGUTnzc+e9xLcTrPPVfZzDz06Sc2lyQGEIyAPzT7Xa+dvE/3e+XLaCxoflHsVj8MAAYs74aa/WHoenwvpkZKeFy2Z5NJlOPUkqXZccFwSSrKjlyffjLH+TL6XTUGTGL/6hklD3ldIrj2M5MRmkLBMcvaRLQ1Nj88sxM/HCBfMP+eu/OYGDqe6l0WmpoqJ/88upgrU7HrQNA/cFg6MlkKiLlBtVUO40cx54BgHvLIT/HJLvdeqh/4NKxogKWN7fsCoUi7xTLxLJ4vLq6ak//wKVOrdXtttrTDMPsqJA8AAAwDErdu3VL3alTf5ma9eWCpoKhn5dKpCiqJxicPucQPVu0FHaInn35yHMcKwPAa4SQ3QCwFgDWUko3qSr5vqqSgTypuEg4Mo/zvA74/Y0rZSnZU8akSHV17k2fXfy0txjI5224kEym1s/1EUI7LBbztweHrkzkizn49LP6U6feepFSeggAQK/n04SQZ8bGrxdeQjZrbRvGzLH5hcibRqOhPplMfS1fIY5jz4xPDBdcGggho2h3z9sOLRazdG3wqp9SMgUl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5djYe+niBU0CcmYA2W21/Qih5ZqDcoxlMZ24MaJJAABA87IVJ8Lh6N65Pr1B/+LIyLUfAhRZQvnM6ah7ZDHkAQB0vK6/HHxNTc2ruT5Zkldn/y5LACFk+2LIAwAwCGl6yGSt88KHXbmrBCHkqEgAz+vWLFZALJb4qNwYhFDhCSknkSwnQ4sVgDFeWg7+gQe2r1tAmkGTFQlACHWVg89nhJA9ot3dphV/eeCLp/Pw6K5IQP0S39uLFXCLwDG7zf1cKZxD9LSlUunHc/12u/2t2Vzl/rzu8zb8PZlM7bwdQgDgPK/nX2nddt+53//ht3LW2dS0fF0iLj2vquojuQFmwXRucPBKa8UCmpe1iOFwpAsAfLdJBFBKwVIlXJ2JxqKCxbwyHkvoCkAlv9/71U+7Oq+UJWDZ0hViJBL1cRynbNq0sSeeiPl6ei4NqIqq6TSmlB7X6bjuTEY5pgWfzwxGPZhMpt39/b3vzvWXFGCzulZjjM/DrauDwcAr8bjcgzGjZUuVBMH8k2uDX7wCAFDr8n2LEPI7SqmhTP6SzVbz6MDlz0/nDpT8EmOM22HOvUeWU2wp8iyLgRL6hk7Hrc2SBwC4MTlykmXZRozxn00mbVcphNA5jJmV+chr6oDd5l6jN/A/TqfSuwEAGITGMIsvGo3GTwTB3Dc2NjGSxdZYq4VIOOoNBANnKE0XPXE3brjHOTQ08k2MmVZOxzVJCbkFIQSCYEphzPaFQuGzTpfjb319PZ8UFXin/5OvrHPg/9HueAH/BSUqOuNZm4fyAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTAyLTE5VDA4OjUyOjI1KzAwOjAwCmFGlgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wMi0xOVQwODo1MjoyMyswMDowMBjsyxAAAAAASUVORK5CYII="
      , _assetMetadataDecimals :: Maybe Int
_assetMetadataDecimals = Int -> Maybe Int
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 AssetOnChainMetadata
_assetDetailsOnchainMetadata   :: Maybe AssetOnChainMetadata
  -- ^ 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
  , AssetDetails -> Maybe AssetMetadata
_assetDetailsMetadata          :: Maybe AssetMetadata
  }
  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
showList :: [AssetDetails] -> ShowS
$cshowList :: [AssetDetails] -> ShowS
show :: AssetDetails -> String
$cshow :: AssetDetails -> String
showsPrec :: Int -> AssetDetails -> ShowS
$cshowsPrec :: Int -> AssetDetails -> ShowS
Show, AssetDetails -> AssetDetails -> Bool
(AssetDetails -> AssetDetails -> Bool)
-> (AssetDetails -> AssetDetails -> Bool) -> Eq AssetDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetDetails -> AssetDetails -> Bool
$c/= :: AssetDetails -> AssetDetails -> Bool
== :: AssetDetails -> AssetDetails -> Bool
$c== :: 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
$cto :: forall x. Rep AssetDetails x -> AssetDetails
$cfrom :: forall x. AssetDetails -> Rep AssetDetails x
Generic)
  deriving (Value -> Parser [AssetDetails]
Value -> Parser AssetDetails
(Value -> Parser AssetDetails)
-> (Value -> Parser [AssetDetails]) -> FromJSON AssetDetails
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AssetDetails]
$cparseJSONList :: Value -> Parser [AssetDetails]
parseJSON :: Value -> Parser AssetDetails
$cparseJSON :: Value -> Parser AssetDetails
FromJSON, [AssetDetails] -> Encoding
[AssetDetails] -> Value
AssetDetails -> Encoding
AssetDetails -> Value
(AssetDetails -> Value)
-> (AssetDetails -> Encoding)
-> ([AssetDetails] -> Value)
-> ([AssetDetails] -> Encoding)
-> ToJSON AssetDetails
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AssetDetails] -> Encoding
$ctoEncodingList :: [AssetDetails] -> Encoding
toJSONList :: [AssetDetails] -> Value
$ctoJSONList :: [AssetDetails] -> Value
toEncoding :: AssetDetails -> Encoding
$ctoEncoding :: AssetDetails -> Encoding
toJSON :: AssetDetails -> Value
$ctoJSON :: AssetDetails -> Value
ToJSON)
  via CustomJSON '[FieldLabelModifier '[StripPrefix "_assetDetails", CamelToSnake]] AssetDetails

instance ToSample AssetDetails where
  toSamples :: Proxy AssetDetails -> [(Text, AssetDetails)]
toSamples = [(Text, AssetDetails)]
-> Proxy AssetDetails -> [(Text, AssetDetails)]
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 :: Text
-> PolicyId
-> Maybe Text
-> Text
-> Quantity
-> TxHash
-> Integer
-> Maybe AssetOnChainMetadata
-> Maybe AssetMetadata
-> AssetDetails
AssetDetails
      { _assetDetailsAsset :: Text
_assetDetailsAsset = Text
"b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e"
      , _assetDetailsPolicyId :: PolicyId
_assetDetailsPolicyId = PolicyId
"b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a7"
      , _assetDetailsAssetName :: Maybe Text
_assetDetailsAssetName = Text -> Maybe Text
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
      , _assetDetailsOnchainMetadata :: Maybe AssetOnChainMetadata
_assetDetailsOnchainMetadata = AssetOnChainMetadata -> Maybe AssetOnChainMetadata
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AssetOnChainMetadata -> Maybe AssetOnChainMetadata)
-> AssetOnChainMetadata -> Maybe AssetOnChainMetadata
forall a b. (a -> b) -> a -> b
$
          AssetOnChainMetadata :: Text -> Text -> AssetOnChainMetadata
AssetOnChainMetadata
            { _assetOnChainMetadataName :: Text
_assetOnChainMetadataName = Text
"My NFT token"
            , _assetOnChainMetadataImage :: Text
_assetOnChainMetadataImage = Text
"ipfs://ipfs/QmfKyJ4tuvHowwKQCbCHj4L5T3fSj8cjs7Aau8V7BWv226"
            }
      , _assetDetailsMetadata :: Maybe AssetMetadata
_assetDetailsMetadata = AssetMetadata -> Maybe AssetMetadata
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AssetMetadata -> Maybe AssetMetadata)
-> AssetMetadata -> Maybe AssetMetadata
forall a b. (a -> b) -> a -> b
$
          AssetMetadata :: Text
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> AssetMetadata
AssetMetadata
            { _assetMetadataName :: Text
_assetMetadataName = Text
"nutcoin"
            , _assetMetadataDescription :: Text
_assetMetadataDescription = Text
"The Nut Coin"
            , _assetMetadataTicker :: Maybe Text
_assetMetadataTicker = Text -> Maybe Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"nutc"
            , _assetMetadataUrl :: Maybe Text
_assetMetadataUrl = Text -> Maybe Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"https://www.stakenuts.com/"
            , _assetMetadataLogo :: Maybe Text
_assetMetadataLogo =  Text -> Maybe Text
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"iVBORw0KGgoAAAANSUhEUgAAADAAAAAoCAYAAAC4h3lxAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH5QITCDUPjqwFHwAAB9xJREFUWMPVWXtsU9cZ/8499/r6dZ3E9rUdO7ZDEgglFWO8KaOsJW0pCLRKrN1AqqYVkqoqrYo0ja7bpElru1WairStFKY9WzaE1E1tx+jokKqwtqFNyhKahEJJyJNgJ37E9r1+3HvO/sFR4vhx7SBtfH/F3/l93/f7ne/4PBxEKYU72dj/ZfH772v1TU+HtqbTaX8wOO01GPQpRVH7JEm+vGHDuq6z7/8jUSoHKtaBKkEUFUXdajDy1hUrmrs6zn/wWS7m7pZVjMUirKGUTnzc+e9xLcTrPPVfZzDz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PI7SqmhTP6SzVbz6MDlz0/nDpT8EmOM22HOvUeWU2wp8iyLgRL6hk7Hrc2SBwC4MTlykmXZRozxn00mbVcphNA5jJmV+chr6oDd5l6jN/A/TqfSuwEAGITGMIsvGo3GTwTB3Dc2NjGSxdZYq4VIOOoNBANnKE0XPXE3brjHOTQ08k2MmVZOxzVJCbkFIQSCYEphzPaFQuGzTpfjb319PZ8UFXin/5OvrHPg/9HueAH/BSUqOuNZm4fyAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTAyLTE5VDA4OjUyOjI1KzAwOjAwCmFGlgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wMi0xOVQwODo1MjoyMyswMDowMBjsyxAAAAAASUVORK5CYII="
            , _assetMetadataDecimals :: Maybe Int
_assetMetadataDecimals = Int -> Maybe Int
forall (f :: * -> *) a. Applicative f => a -> f a
pure Int
6
            }
      }

-- | 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
showList :: [AssetAction] -> ShowS
$cshowList :: [AssetAction] -> ShowS
show :: AssetAction -> String
$cshow :: AssetAction -> String
showsPrec :: Int -> AssetAction -> ShowS
$cshowsPrec :: Int -> AssetAction -> ShowS
Show, AssetAction -> AssetAction -> Bool
(AssetAction -> AssetAction -> Bool)
-> (AssetAction -> AssetAction -> Bool) -> Eq AssetAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetAction -> AssetAction -> Bool
$c/= :: AssetAction -> AssetAction -> Bool
== :: AssetAction -> AssetAction -> Bool
$c== :: 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
$cto :: forall x. Rep AssetAction x -> AssetAction
$cfrom :: forall x. AssetAction -> Rep AssetAction x
Generic)
  deriving (Value -> Parser [AssetAction]
Value -> Parser AssetAction
(Value -> Parser AssetAction)
-> (Value -> Parser [AssetAction]) -> FromJSON AssetAction
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AssetAction]
$cparseJSONList :: Value -> Parser [AssetAction]
parseJSON :: Value -> Parser AssetAction
$cparseJSON :: Value -> Parser AssetAction
FromJSON, [AssetAction] -> Encoding
[AssetAction] -> Value
AssetAction -> Encoding
AssetAction -> Value
(AssetAction -> Value)
-> (AssetAction -> Encoding)
-> ([AssetAction] -> Value)
-> ([AssetAction] -> Encoding)
-> ToJSON AssetAction
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AssetAction] -> Encoding
$ctoEncodingList :: [AssetAction] -> Encoding
toJSONList :: [AssetAction] -> Value
$ctoJSONList :: [AssetAction] -> Value
toEncoding :: AssetAction -> Encoding
$ctoEncoding :: AssetAction -> Encoding
toJSON :: AssetAction -> Value
$ctoJSON :: AssetAction -> Value
ToJSON)
  via CustomJSON '[ConstructorTagModifier '[ToLower]] AssetAction

instance ToSample AssetAction where
  toSamples :: Proxy AssetAction -> [(Text, AssetAction)]
toSamples = [(Text, AssetAction)] -> Proxy AssetAction -> [(Text, AssetAction)]
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
showList :: [AssetHistory] -> ShowS
$cshowList :: [AssetHistory] -> ShowS
show :: AssetHistory -> String
$cshow :: AssetHistory -> String
showsPrec :: Int -> AssetHistory -> ShowS
$cshowsPrec :: Int -> AssetHistory -> ShowS
Show, AssetHistory -> AssetHistory -> Bool
(AssetHistory -> AssetHistory -> Bool)
-> (AssetHistory -> AssetHistory -> Bool) -> Eq AssetHistory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetHistory -> AssetHistory -> Bool
$c/= :: AssetHistory -> AssetHistory -> Bool
== :: AssetHistory -> AssetHistory -> Bool
$c== :: 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
$cto :: forall x. Rep AssetHistory x -> AssetHistory
$cfrom :: forall x. AssetHistory -> Rep AssetHistory x
Generic)
  deriving (Value -> Parser [AssetHistory]
Value -> Parser AssetHistory
(Value -> Parser AssetHistory)
-> (Value -> Parser [AssetHistory]) -> FromJSON AssetHistory
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AssetHistory]
$cparseJSONList :: Value -> Parser [AssetHistory]
parseJSON :: Value -> Parser AssetHistory
$cparseJSON :: Value -> Parser AssetHistory
FromJSON, [AssetHistory] -> Encoding
[AssetHistory] -> Value
AssetHistory -> Encoding
AssetHistory -> Value
(AssetHistory -> Value)
-> (AssetHistory -> Encoding)
-> ([AssetHistory] -> Value)
-> ([AssetHistory] -> Encoding)
-> ToJSON AssetHistory
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AssetHistory] -> Encoding
$ctoEncodingList :: [AssetHistory] -> Encoding
toJSONList :: [AssetHistory] -> Value
$ctoJSONList :: [AssetHistory] -> Value
toEncoding :: AssetHistory -> Encoding
$ctoEncoding :: AssetHistory -> Encoding
toJSON :: AssetHistory -> Value
$ctoJSON :: AssetHistory -> Value
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 (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 :: TxHash -> Quantity -> AssetAction -> AssetHistory
AssetHistory
        { _assetHistoryTxHash :: TxHash
_assetHistoryTxHash = TxHash
"2dd15e0ef6e6a17841cb9541c27724072ce4d4b79b91e58432fbaa32d9572531"
        , _assetHistoryAmount :: Quantity
_assetHistoryAmount = Quantity
10
        , _assetHistoryAction :: AssetAction
_assetHistoryAction = AssetAction
Minted
        }
    , AssetHistory :: TxHash -> Quantity -> AssetAction -> AssetHistory
AssetHistory
        { _assetHistoryTxHash :: TxHash
_assetHistoryTxHash = TxHash
"9c190bc1ac88b2ab0c05a82d7de8b71b67a9316377e865748a89d4426c0d3005"
        , _assetHistoryAmount :: Quantity
_assetHistoryAmount = Quantity
5
        , _assetHistoryAction :: AssetAction
_assetHistoryAction = AssetAction
Burned
        }
    , AssetHistory :: TxHash -> Quantity -> AssetAction -> AssetHistory
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
  }
  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
showList :: [AssetTransaction] -> ShowS
$cshowList :: [AssetTransaction] -> ShowS
show :: AssetTransaction -> String
$cshow :: AssetTransaction -> String
showsPrec :: Int -> AssetTransaction -> ShowS
$cshowsPrec :: Int -> AssetTransaction -> ShowS
Show, AssetTransaction -> AssetTransaction -> Bool
(AssetTransaction -> AssetTransaction -> Bool)
-> (AssetTransaction -> AssetTransaction -> Bool)
-> Eq AssetTransaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetTransaction -> AssetTransaction -> Bool
$c/= :: AssetTransaction -> AssetTransaction -> Bool
== :: AssetTransaction -> AssetTransaction -> Bool
$c== :: 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
$cto :: forall x. Rep AssetTransaction x -> AssetTransaction
$cfrom :: forall x. AssetTransaction -> Rep AssetTransaction x
Generic)
  deriving (Value -> Parser [AssetTransaction]
Value -> Parser AssetTransaction
(Value -> Parser AssetTransaction)
-> (Value -> Parser [AssetTransaction])
-> FromJSON AssetTransaction
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AssetTransaction]
$cparseJSONList :: Value -> Parser [AssetTransaction]
parseJSON :: Value -> Parser AssetTransaction
$cparseJSON :: Value -> Parser AssetTransaction
FromJSON, [AssetTransaction] -> Encoding
[AssetTransaction] -> Value
AssetTransaction -> Encoding
AssetTransaction -> Value
(AssetTransaction -> Value)
-> (AssetTransaction -> Encoding)
-> ([AssetTransaction] -> Value)
-> ([AssetTransaction] -> Encoding)
-> ToJSON AssetTransaction
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AssetTransaction] -> Encoding
$ctoEncodingList :: [AssetTransaction] -> Encoding
toJSONList :: [AssetTransaction] -> Value
$ctoJSONList :: [AssetTransaction] -> Value
toEncoding :: AssetTransaction -> Encoding
$ctoEncoding :: AssetTransaction -> Encoding
toJSON :: AssetTransaction -> Value
$ctoJSON :: AssetTransaction -> Value
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 (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 :: TxHash -> Integer -> Integer -> AssetTransaction
AssetTransaction
        { _assetTransactionTxHash :: TxHash
_assetTransactionTxHash = TxHash
"8788591983aa73981fc92d6cddbbe643959f5a784e84b8bee0db15823f575a5b"
        , _assetTransactionTxIndex :: Integer
_assetTransactionTxIndex = Integer
6
        , _assetTransactionBlockHeight :: Integer
_assetTransactionBlockHeight = Integer
69
        }
    , AssetTransaction :: TxHash -> Integer -> Integer -> AssetTransaction
AssetTransaction
        { _assetTransactionTxHash :: TxHash
_assetTransactionTxHash = TxHash
"52e748c4dec58b687b90b0b40d383b9fe1f24c1a833b7395cdf07dd67859f46f"
        , _assetTransactionTxIndex :: Integer
_assetTransactionTxIndex = Integer
9
        , _assetTransactionBlockHeight :: Integer
_assetTransactionBlockHeight = Integer
4547
        }
     , AssetTransaction :: TxHash -> Integer -> Integer -> AssetTransaction
AssetTransaction
        { _assetTransactionTxHash :: TxHash
_assetTransactionTxHash = TxHash
"e8073fd5318ff43eca18a852527166aa8008bee9ee9e891f585612b7e4ba700b"
        , _assetTransactionTxIndex :: Integer
_assetTransactionTxIndex = Integer
0
        , _assetTransactionBlockHeight :: Integer
_assetTransactionBlockHeight = Integer
564654
        }
    ]

-- | 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
showList :: [AssetAddress] -> ShowS
$cshowList :: [AssetAddress] -> ShowS
show :: AssetAddress -> String
$cshow :: AssetAddress -> String
showsPrec :: Int -> AssetAddress -> ShowS
$cshowsPrec :: Int -> AssetAddress -> ShowS
Show, AssetAddress -> AssetAddress -> Bool
(AssetAddress -> AssetAddress -> Bool)
-> (AssetAddress -> AssetAddress -> Bool) -> Eq AssetAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssetAddress -> AssetAddress -> Bool
$c/= :: AssetAddress -> AssetAddress -> Bool
== :: AssetAddress -> AssetAddress -> Bool
$c== :: 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
$cto :: forall x. Rep AssetAddress x -> AssetAddress
$cfrom :: forall x. AssetAddress -> Rep AssetAddress x
Generic)
  deriving (Value -> Parser [AssetAddress]
Value -> Parser AssetAddress
(Value -> Parser AssetAddress)
-> (Value -> Parser [AssetAddress]) -> FromJSON AssetAddress
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [AssetAddress]
$cparseJSONList :: Value -> Parser [AssetAddress]
parseJSON :: Value -> Parser AssetAddress
$cparseJSON :: Value -> Parser AssetAddress
FromJSON, [AssetAddress] -> Encoding
[AssetAddress] -> Value
AssetAddress -> Encoding
AssetAddress -> Value
(AssetAddress -> Value)
-> (AssetAddress -> Encoding)
-> ([AssetAddress] -> Value)
-> ([AssetAddress] -> Encoding)
-> ToJSON AssetAddress
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [AssetAddress] -> Encoding
$ctoEncodingList :: [AssetAddress] -> Encoding
toJSONList :: [AssetAddress] -> Value
$ctoJSONList :: [AssetAddress] -> Value
toEncoding :: AssetAddress -> Encoding
$ctoEncoding :: AssetAddress -> Encoding
toJSON :: AssetAddress -> Value
$ctoJSON :: AssetAddress -> Value
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 (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 :: Address -> Quantity -> AssetAddress
AssetAddress
        { _assetAddressAddress :: Address
_assetAddressAddress = Address
"addr1qxqs59lphg8g6qndelq8xwqn60ag3aeyfcp33c2kdp46a09re5df3pzwwmyq946axfcejy5n4x0y99wqpgtp2gd0k09qsgy6pz"
        , _assetAddressQuantity :: Quantity
_assetAddressQuantity = Quantity
1
        }
    , AssetAddress :: Address -> Quantity -> AssetAddress
AssetAddress
        { _assetAddressAddress :: Address
_assetAddressAddress = Address
"addr1qyhr4exrgavdcn3qhfcc9f939fzsch2re5ry9cwvcdyh4x4re5df3pzwwmyq946axfcejy5n4x0y99wqpgtp2gd0k09qdpvhza"
        , _assetAddressQuantity :: Quantity
_assetAddressQuantity = Quantity
100000
        }
     , AssetAddress :: Address -> Quantity -> AssetAddress
AssetAddress
        { _assetAddressAddress :: Address
_assetAddressAddress = Address
"addr1q8zup8m9ue3p98kxlxl9q8rnyan8hw3ul282tsl9s326dfj088lvedv4zckcj24arcpasr0gua4c5gq4zw2rpcpjk2lq8cmd9l"
        , _assetAddressQuantity :: Quantity
_assetAddressQuantity = Quantity
18605647
        }
    ]