fatd: github.com/Factom-Asset-Tokens/fatd/fat/fat1 Index | Files

package fat1

import "github.com/Factom-Asset-Tokens/fatd/fat/fat1"


Package Files

addressnftokensmap.go fat1.go nftokenid.go nftokenidrange.go nftokenmetadata.go nftokens.go transaction.go


const MaxCapacity = 4e5
const Type = fat.Type(1)


var ErrorCapacity = fmt.Errorf("NFTokenID max capacity (%v) exceeded", maxCapacity)

type AddressNFTokensMap Uses

type AddressNFTokensMap map[factom.FAAddress]NFTokens

AddressTokenMap relates the RCDHash of an address to its NFTokenIDs.

func (AddressNFTokensMap) AllNFTokens Uses

func (m AddressNFTokensMap) AllNFTokens() NFTokens

func (AddressNFTokensMap) MarshalJSON Uses

func (m AddressNFTokensMap) MarshalJSON() ([]byte, error)

func (AddressNFTokensMap) NFTokenIDsConserved Uses

func (m AddressNFTokensMap) NFTokenIDsConserved(n AddressNFTokensMap) error

func (AddressNFTokensMap) NoAddressIntersection Uses

func (m AddressNFTokensMap) NoAddressIntersection(n AddressNFTokensMap) error

func (AddressNFTokensMap) NoInternalNFTokensIntersection Uses

func (m AddressNFTokensMap) NoInternalNFTokensIntersection() error

func (AddressNFTokensMap) NoNFTokensIntersection Uses

func (m AddressNFTokensMap) NoNFTokensIntersection(newTkns NFTokens) error

func (AddressNFTokensMap) NumNFTokenIDs Uses

func (m AddressNFTokensMap) NumNFTokenIDs() int

func (AddressNFTokensMap) Owner Uses

func (m AddressNFTokensMap) Owner(tknID NFTokenID) factom.FAAddress

func (*AddressNFTokensMap) UnmarshalJSON Uses

func (m *AddressNFTokensMap) UnmarshalJSON(data []byte) error

type ErrorMissingNFTokenID Uses

type ErrorMissingNFTokenID NFTokenID

func (ErrorMissingNFTokenID) Error Uses

func (id ErrorMissingNFTokenID) Error() string

type ErrorNFTokenIDIntersection Uses

type ErrorNFTokenIDIntersection NFTokenID

func (ErrorNFTokenIDIntersection) Error Uses

func (id ErrorNFTokenIDIntersection) Error() string

type NFTokenID Uses

type NFTokenID uint64

NFTokenID is a Non-Fungible Token ID.

func (NFTokenID) Len Uses

func (id NFTokenID) Len() int

Len returns 1.

func (NFTokenID) Set Uses

func (id NFTokenID) Set(tkns NFTokens) error

Set id in nfTkns and return an error if it is already set.

type NFTokenIDMetadataMap Uses

type NFTokenIDMetadataMap map[NFTokenID]json.RawMessage

func (NFTokenIDMetadataMap) IsSubsetOf Uses

func (m NFTokenIDMetadataMap) IsSubsetOf(tkns NFTokens) error

func (NFTokenIDMetadataMap) MarshalJSON Uses

func (m NFTokenIDMetadataMap) MarshalJSON() ([]byte, error)

func (NFTokenIDMetadataMap) Set Uses

func (m NFTokenIDMetadataMap) Set(md NFTokenMetadata)

func (*NFTokenIDMetadataMap) UnmarshalJSON Uses

func (m *NFTokenIDMetadataMap) UnmarshalJSON(data []byte) error

type NFTokenIDRange Uses

type NFTokenIDRange struct {
    Min NFTokenID `json:"min"`
    Max NFTokenID `json:"max"`

NFTokenIDRange represents a contiguous range of NFTokenIDs.

func NewNFTokenIDRange Uses

func NewNFTokenIDRange(minMax ...NFTokenID) NFTokenIDRange

func (NFTokenIDRange) IsJSONEfficient Uses

func (idRange NFTokenIDRange) IsJSONEfficient() bool

func (NFTokenIDRange) IsStringEfficient Uses

func (idRange NFTokenIDRange) IsStringEfficient() bool

func (NFTokenIDRange) Len Uses

func (idRange NFTokenIDRange) Len() int

func (NFTokenIDRange) MarshalJSON Uses

func (idRange NFTokenIDRange) MarshalJSON() ([]byte, error)

func (NFTokenIDRange) Set Uses

func (idRange NFTokenIDRange) Set(tkns NFTokens) error

func (NFTokenIDRange) Slice Uses

func (idRange NFTokenIDRange) Slice() []NFTokenID

Slice returns a sorted slice of tkns' NFTokenIDs.

func (NFTokenIDRange) String Uses

func (idRange NFTokenIDRange) String() string

func (*NFTokenIDRange) UnmarshalJSON Uses

func (idRange *NFTokenIDRange) UnmarshalJSON(data []byte) error

func (NFTokenIDRange) Valid Uses

func (idRange NFTokenIDRange) Valid() error

type NFTokenMetadata Uses

type NFTokenMetadata struct {
    Tokens   NFTokens        `json:"ids"`
    Metadata json.RawMessage `json:"metadata,omitempty"`

type NFTokens Uses

type NFTokens map[NFTokenID]struct{}

NFTokens are a set of unique NFTokenIDs. A map[NFTokenID]struct{} is used to guarantee uniqueness of NFTokenIDs.

func NewNFTokens Uses

func NewNFTokens(ids ...NFTokensSetter) (NFTokens, error)

NewNFTokens returns an NFTokens initialized with ids. If ids contains any duplicate NFTokenIDs.

func (NFTokens) Append Uses

func (tkns NFTokens) Append(newTkns NFTokens) error

func (NFTokens) ContainsAll Uses

func (tkns NFTokens) ContainsAll(tknsSub NFTokens) error

func (NFTokens) MarshalJSON Uses

func (tkns NFTokens) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. MarshalJSON will always produce the most efficient representation of tkns using NFTokenIDRanges over individual NFTokenIDs where appropriate. MarshalJSON will return an error if tkns is empty.

func (NFTokens) NoIntersection Uses

func (tkns NFTokens) NoIntersection(tknsCmp NFTokens) error

func (NFTokens) Set Uses

func (tkns NFTokens) Set(ids ...NFTokensSetter) error

Set all ids in tkns. Return an error if ids contains any duplicate or previously set NFTokenIDs.

func (NFTokens) Slice Uses

func (tkns NFTokens) Slice() []NFTokenID

Slice returns a sorted slice of tkns' NFTokenIDs.

func (NFTokens) String Uses

func (tkns NFTokens) String() string

func (*NFTokens) UnmarshalJSON Uses

func (tkns *NFTokens) UnmarshalJSON(data []byte) error

type NFTokensSetter Uses

type NFTokensSetter interface {
    // Set the NFTokenIDs in tkns. Return an error if tkns already
    // contains one of the NFTokenIDs.
    Set(tkns NFTokens) error
    // Len returns number of NFTokenIDs that will be set.
    Len() int

NFTokensSetter is an interface implemented by types that can set the NFTokenIDs they represent in a given NFTokens.

type Transaction Uses

type Transaction struct {
    Inputs        AddressNFTokensMap   `json:"inputs"`
    Outputs       AddressNFTokensMap   `json:"outputs"`
    TokenMetadata NFTokenIDMetadataMap `json:"tokenmetadata,omitempty"`

Transaction represents a fat1 transaction, which can be a normal account transaction or a coinbase transaction depending on the Inputs and the RCD/signature pair.

func NewTransaction Uses

func NewTransaction(entry factom.Entry) Transaction

NewTransaction returns a Transaction initialized with the given entry.

func (Transaction) IsCoinbase Uses

func (t Transaction) IsCoinbase() bool

IsCoinbase returns true if the coinbase address is in t.Input. This does not necessarily mean that t is a valid coinbase transaction.

func (*Transaction) MarshalEntry Uses

func (t *Transaction) MarshalEntry() error

MarshalEntry marshals the Transaction into the Entry content.

func (Transaction) MarshalJSON Uses

func (t Transaction) MarshalJSON() ([]byte, error)

func (Transaction) String Uses

func (t Transaction) String() string

func (*Transaction) UnmarshalEntry Uses

func (t *Transaction) UnmarshalEntry() error

UnmarshalEntry unmarshals the entry content as a Transaction.

func (*Transaction) UnmarshalJSON Uses

func (t *Transaction) UnmarshalJSON(data []byte) error

func (*Transaction) Valid Uses

func (t *Transaction) Valid(idKey factom.IDKey) error

func (Transaction) ValidData Uses

func (t Transaction) ValidData() error

func (Transaction) ValidExtIDs Uses

func (t Transaction) ValidExtIDs() error

func (Transaction) ValidRCDs Uses

func (t Transaction) ValidRCDs() bool

Package fat1 imports 6 packages (graph) and is imported by 4 packages. Updated 2019-06-20. Refresh now. Tools for package owners.