fat1

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

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

Variables

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

Functions

This section is empty.

Types

type AddressNFTokensMap

type AddressNFTokensMap map[factom.FAAddress]NFTokens

AddressTokenMap relates the RCDHash of an address to its NFTokenIDs.

func (AddressNFTokensMap) AllNFTokens added in v0.5.0

func (m AddressNFTokensMap) AllNFTokens() NFTokens

func (AddressNFTokensMap) MarshalJSON

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

func (AddressNFTokensMap) NFTokenIDsConserved

func (m AddressNFTokensMap) NFTokenIDsConserved(n AddressNFTokensMap) error

func (AddressNFTokensMap) NoAddressIntersection

func (m AddressNFTokensMap) NoAddressIntersection(n AddressNFTokensMap) error

func (AddressNFTokensMap) NoInternalNFTokensIntersection

func (m AddressNFTokensMap) NoInternalNFTokensIntersection() error

func (AddressNFTokensMap) NoNFTokensIntersection

func (m AddressNFTokensMap) NoNFTokensIntersection(newTkns NFTokens) error

func (AddressNFTokensMap) NumNFTokenIDs

func (m AddressNFTokensMap) NumNFTokenIDs() int

func (AddressNFTokensMap) Owner

func (*AddressNFTokensMap) UnmarshalJSON

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

type ErrorMissingNFTokenID added in v0.5.0

type ErrorMissingNFTokenID NFTokenID

func (ErrorMissingNFTokenID) Error added in v0.5.0

func (id ErrorMissingNFTokenID) Error() string

type ErrorNFTokenIDIntersection added in v0.5.0

type ErrorNFTokenIDIntersection NFTokenID

func (ErrorNFTokenIDIntersection) Error added in v0.5.0

type NFTokenID

type NFTokenID uint64

NFTokenID is a Non-Fungible Token ID.

func (NFTokenID) Len

func (id NFTokenID) Len() int

Len returns 1.

func (NFTokenID) Set

func (id NFTokenID) Set(tkns NFTokens) error

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

type NFTokenIDMetadataMap

type NFTokenIDMetadataMap map[NFTokenID]json.RawMessage

func (NFTokenIDMetadataMap) IsSubsetOf

func (m NFTokenIDMetadataMap) IsSubsetOf(tkns NFTokens) error

func (NFTokenIDMetadataMap) MarshalJSON

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

func (NFTokenIDMetadataMap) Set

func (*NFTokenIDMetadataMap) UnmarshalJSON

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

type NFTokenIDRange

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

NFTokenIDRange represents a contiguous range of NFTokenIDs.

func NewNFTokenIDRange

func NewNFTokenIDRange(minMax ...NFTokenID) NFTokenIDRange

func (NFTokenIDRange) IsJSONEfficient added in v0.5.0

func (idRange NFTokenIDRange) IsJSONEfficient() bool

func (NFTokenIDRange) IsStringEfficient added in v0.5.0

func (idRange NFTokenIDRange) IsStringEfficient() bool

func (NFTokenIDRange) Len

func (idRange NFTokenIDRange) Len() int

func (NFTokenIDRange) MarshalJSON

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

func (NFTokenIDRange) Set

func (idRange NFTokenIDRange) Set(tkns NFTokens) error

func (NFTokenIDRange) Slice added in v0.5.0

func (idRange NFTokenIDRange) Slice() []NFTokenID

Slice returns a sorted slice of tkns' NFTokenIDs.

func (NFTokenIDRange) String added in v0.5.0

func (idRange NFTokenIDRange) String() string

func (*NFTokenIDRange) UnmarshalJSON

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

func (NFTokenIDRange) Valid

func (idRange NFTokenIDRange) Valid() error

type NFTokenMetadata

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

type NFTokens

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

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

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

func (NFTokens) Append

func (tkns NFTokens) Append(newTkns NFTokens) error

func (NFTokens) ContainsAll added in v0.5.0

func (tkns NFTokens) ContainsAll(tknsSub NFTokens) error

func (NFTokens) MarshalJSON

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

func (tkns NFTokens) NoIntersection(tknsCmp NFTokens) error

func (NFTokens) Set

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

func (tkns NFTokens) Slice() []NFTokenID

Slice returns a sorted slice of tkns' NFTokenIDs.

func (NFTokens) String added in v0.5.0

func (tkns NFTokens) String() string

func (*NFTokens) UnmarshalJSON

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

type NFTokensSetter

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

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

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

func NewTransaction(entry factom.Entry) Transaction

NewTransaction returns a Transaction initialized with the given entry.

func (Transaction) IsCoinbase

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

func (t *Transaction) MarshalEntry() error

MarshalEntry marshals the Transaction into the Entry content.

func (Transaction) MarshalJSON

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

func (Transaction) String added in v0.5.0

func (t Transaction) String() string

func (*Transaction) UnmarshalEntry

func (t *Transaction) UnmarshalEntry() error

UnmarshalEntry unmarshals the entry content as a Transaction.

func (*Transaction) UnmarshalJSON

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

func (*Transaction) Valid

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

func (Transaction) ValidData

func (t Transaction) ValidData() error

func (Transaction) ValidExtIDs

func (t Transaction) ValidExtIDs() error

func (Transaction) ValidRCDs

func (t Transaction) ValidRCDs() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL