cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2018-2021 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Wallet.TokenMetadata

Description

A client used to query asset metadata from the Cardano metadata-server.

The OpenAPI specification is here: https://github.com/input-output-hk/metadata-server/blob/master/specifications/api/openapi.yaml

An important consideration is that cardano-wallet should not trust the metadata-server operator to produce correct, valid, authentic, or even non-malicious data.

In future, signatures of property values will be checked to determine authenticity. The exact details are not yet specified.

In any case, we should not rely on the validation that the metadata-server may or may not have applied to the user-supplied metadata.

Synopsis

Associating metadata with assets

Token Metadata Client

data TokenMetadataClient m Source #

Represents a client for the metadata server.

data TokenMetadataError Source #

The possible errors which can occur when fetching metadata.

Instances

Instances details
Eq TokenMetadataError Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Show TokenMetadataError Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Generic TokenMetadataError Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

NFData TokenMetadataError Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

ToText TokenMetadataError Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep TokenMetadataError Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Logging

Generic metadata server client

data BatchRequest Source #

Models a request to the POST metadata query endpoint of the metadata server -- the only one that we need.

Instances

Instances details
Eq BatchRequest Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Show BatchRequest Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Generic BatchRequest Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

ToJSON BatchRequest Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

FromJSON BatchRequest Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata.MockServer

type Rep BatchRequest Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep BatchRequest = D1 (' MetaData "BatchRequest" "Cardano.Wallet.TokenMetadata" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "BatchRequest" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "subjects") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ Subject ]) :*: S1 (' MetaSel (' Just "properties") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ PropertyName ])))

newtype BatchResponse Source #

Models the response from the POST metadata query endpoint of the metadata server. This should contain properties each subject in the BatchRequest .

Instances

Instances details
Eq BatchResponse Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Show BatchResponse Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Generic BatchResponse Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

ToJSON BatchResponse Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata.MockServer

FromJSON BatchResponse Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep BatchResponse Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep BatchResponse = D1 (' MetaData "BatchResponse" "Cardano.Wallet.TokenMetadata" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "BatchResponse" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getBatchResponse") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ SubjectProperties ])))

data SubjectProperties Source #

Property values and signatures for a given subject.

Instances

Instances details
Eq SubjectProperties Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Show SubjectProperties Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Generic SubjectProperties Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

ToJSON SubjectProperties Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata.MockServer

FromJSON SubjectProperties Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep SubjectProperties Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

data Property name Source #

A property value and its signatures.

Constructors

Property

Fields

Instances

Instances details
Eq ( PropertyValue name) => Eq ( Property name) Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Show ( PropertyValue name) => Show ( Property name) Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Generic ( Property name) Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Associated Types

type Rep ( Property name) :: Type -> Type Source #

ToJSON ( PropertyValue name) => ToJSON ( Property name) Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata.MockServer

(HasValidator name, FromJSON ( PropertyValue name)) => FromJSON ( Property name) Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep ( Property name) Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

newtype PropertyName Source #

Metadata property identifier.

Instances

Instances details
Eq PropertyName Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Show PropertyName Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

IsString PropertyName Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Generic PropertyName Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Hashable PropertyName Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

ToJSON PropertyName Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

FromJSON PropertyName Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep PropertyName Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep PropertyName = D1 (' MetaData "PropertyName" "Cardano.Wallet.TokenMetadata" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "PropertyName" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unPropertyName") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Text )))

type family PropertyValue (name :: Symbol ) :: Type Source #

The type of a given property name.

Instances

Instances details
type PropertyValue "decimals" Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type PropertyValue "description" Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type PropertyValue "description" = Text
type PropertyValue "logo" Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type PropertyValue "name" Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type PropertyValue "ticker" Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type PropertyValue "ticker" = Text
type PropertyValue "url" Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

newtype Subject Source #

A metadata server subject, which can be any string.

Constructors

Subject

Instances

Instances details
Eq Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Ord Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Show Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

IsString Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Generic Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Hashable Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

ToJSON Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

FromJSON Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep Subject Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep Subject = D1 (' MetaData "Subject" "Cardano.Wallet.TokenMetadata" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "Subject" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unSubject") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Text )))

data Signature Source #

Will be used in future for checking integrity and authenticity of metadata.

Instances

Instances details
Eq Signature Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Show Signature Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

Generic Signature Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

ToJSON Signature Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata.MockServer

FromJSON Signature Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep Signature Source #
Instance details

Defined in Cardano.Wallet.TokenMetadata

type Rep Signature = D1 (' MetaData "Signature" "Cardano.Wallet.TokenMetadata" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "Signature" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "signature") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ByteString ) :*: S1 (' MetaSel (' Just "publicKey") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ByteString )))

Parsing

metadataFromProperties :: SubjectProperties -> Maybe AssetMetadata Source #

Convert metadata server properties response into an AssetMetadata record. Only the values are taken. Signatures are ignored (for now).

Orphan instances