nft

package
v0.0.0-...-1b3d248 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DesignType   = hint.Type("mitum-nft-design")
	DesignHint   = hint.NewHint(DesignType, "v0.0.1")
	DesignHinter = Design{BaseHinter: hint.NewBaseHinter(DesignHint)}
)
View Source
var (
	NFTType   = hint.Type("mitum-nft-nft")
	NFTHint   = hint.NewHint(NFTType, "v0.0.1")
	NFTHinter = NFT{BaseHinter: hint.NewBaseHinter(NFTHint)}
)
View Source
var (
	NFTIDType   = hint.Type("mitum-nft-nft-id")
	NFTIDHint   = hint.NewHint(NFTIDType, "v0.0.1")
	NFTIDHinter = NFTID{BaseHinter: hint.NewBaseHinter(NFTIDHint)}
)
View Source
var (
	SignerType   = hint.Type("mitum-nft-signer")
	SignerHint   = hint.NewHint(SignerType, "v0.0.1")
	SignerHinter = Signer{BaseHinter: hint.NewBaseHinter(SignerHint)}
)
View Source
var (
	MaxTotalShare uint = 100
	MaxSigners         = 10
)
View Source
var (
	SignersType   = hint.Type("mitum-nft-signers")
	SignersHint   = hint.NewHint(SignersType, "v0.0.1")
	SignersHinter = Signers{BaseHinter: hint.NewBaseHinter(SignersHint)}
)
View Source
var (
	TestPolicyType   = hint.Type("mitum-nft-test-policy")
	TestPolicyHint   = hint.NewHint(TestPolicyType, "v0.0.1")
	TestPolicyHinter = TestPolicy{BaseHinter: hint.NewBaseHinter(TestPolicyHint)}
)
View Source
var MaxCopyrighters = 10
View Source
var MaxCreators = 10
View Source
var MaxNFTHashLength = 1024
View Source
var MaxNFTIdx uint64 = 10000
View Source
var MaxPaymentParameter uint = 99
View Source
var MaxSignerShare uint = 100
View Source
var MaxURILength = 1000

Functions

func NewTestAddress

func NewTestAddress() base.Address

Types

type BasePolicy

type BasePolicy interface {
	isvalid.IsValider
	Bytes() []byte
	Addresses() ([]base.Address, error)
	Equal(c BasePolicy) bool
	Rebuild() BasePolicy
}

type Design

type Design struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func MustNewDesign

func MustNewDesign(parent base.Address, creator base.Address, symbol extensioncurrency.ContractID, active bool, policy BasePolicy) Design

func NewDesign

func NewDesign(parent base.Address, creator base.Address, symbol extensioncurrency.ContractID, active bool, policy BasePolicy) Design

func (Design) Active

func (d Design) Active() bool

func (Design) Addresses

func (d Design) Addresses() ([]base.Address, error)

func (Design) Bytes

func (d Design) Bytes() []byte

func (Design) Creator

func (d Design) Creator() base.Address

func (Design) Equal

func (d Design) Equal(cd Design) bool

func (Design) GenerateHash

func (d Design) GenerateHash() valuehash.Hash

func (Design) Hash

func (d Design) Hash() valuehash.Hash

func (Design) Hint

func (d Design) Hint() hint.Hint

func (Design) IsValid

func (d Design) IsValid([]byte) error

func (Design) MarshalBSON

func (d Design) MarshalBSON() ([]byte, error)

func (Design) MarshalJSON

func (d Design) MarshalJSON() ([]byte, error)

func (Design) Parent

func (d Design) Parent() base.Address

func (Design) Policy

func (d Design) Policy() BasePolicy

func (Design) Rebuild

func (d Design) Rebuild() Design

func (Design) Symbol

func (d Design) Symbol() extensioncurrency.ContractID

func (*Design) UnpackBSON

func (d *Design) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*Design) UnpackJSON

func (d *Design) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type DesignBSONUnpacker

type DesignBSONUnpacker struct {
	PR base.AddressDecoder `bson:"parent"`
	CR base.AddressDecoder `bson:"creator"`
	SB string              `bson:"symbol"`
	AC bool                `bson:"active"`
	PO bson.Raw            `bson:"policy"`
}

type DesignJSONPacker

type DesignJSONPacker struct {
	jsonenc.HintedHead
	PR base.Address                 `json:"parent"`
	CR base.Address                 `json:"creator"`
	SB extensioncurrency.ContractID `json:"symbol"`
	AC bool                         `json:"active"`
	PO BasePolicy                   `json:"policy"`
}

type DesignJSONUnpacker

type DesignJSONUnpacker struct {
	PR base.AddressDecoder `json:"parent"`
	CR base.AddressDecoder `json:"creator"`
	SB string              `json:"symbol"`
	AC bool                `json:"active"`
	PO json.RawMessage     `json:"policy"`
}

type NFT

type NFT struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func MustNewNFT

func MustNewNFT(id NFTID, active bool, owner base.Address, hash NFTHash, uri URI, approved base.Address, creators Signers, copyrighters Signers) NFT

func NewNFT

func NewNFT(id NFTID, active bool, owner base.Address, hash NFTHash, uri URI, approved base.Address, creators Signers, copyrighters Signers) NFT

func (NFT) Active

func (n NFT) Active() bool

func (NFT) Approved

func (n NFT) Approved() base.Address

func (NFT) Bytes

func (n NFT) Bytes() []byte

func (NFT) Copyrighters

func (n NFT) Copyrighters() Signers

func (NFT) Creators

func (n NFT) Creators() Signers

func (NFT) Equal

func (n NFT) Equal(cn NFT) bool

func (NFT) ExistsApproved

func (n NFT) ExistsApproved() bool

func (NFT) GenerateHash

func (n NFT) GenerateHash() valuehash.Hash

func (NFT) Hash

func (n NFT) Hash() valuehash.Hash

func (NFT) Hint

func (NFT) Hint() hint.Hint

func (NFT) ID

func (n NFT) ID() NFTID

func (NFT) IsValid

func (n NFT) IsValid([]byte) error

func (NFT) MarshalBSON

func (n NFT) MarshalBSON() ([]byte, error)

func (NFT) MarshalJSON

func (n NFT) MarshalJSON() ([]byte, error)

func (NFT) NftHash

func (n NFT) NftHash() NFTHash

func (NFT) Owner

func (n NFT) Owner() base.Address

func (*NFT) UnpackBSON

func (n *NFT) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*NFT) UnpackJSON

func (n *NFT) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

func (NFT) Uri

func (n NFT) Uri() URI

type NFTBSONUnpacker

type NFTBSONUnpacker struct {
	ID bson.Raw            `bson:"id"`
	AC bool                `bson:"active"`
	ON base.AddressDecoder `bson:"owner"`
	HS string              `bson:"hash"`
	UR string              `bson:"uri"`
	AP base.AddressDecoder `bson:"approved"`
	CR bson.Raw            `bson:"creators"`
	CP bson.Raw            `bson:"copyrighters"`
}

type NFTHash

type NFTHash string

func (NFTHash) Bytes

func (hs NFTHash) Bytes() []byte

func (NFTHash) IsValid

func (hs NFTHash) IsValid([]byte) error

func (NFTHash) String

func (hs NFTHash) String() string

type NFTID

type NFTID struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func MustNewNFTID

func MustNewNFTID(symbol extensioncurrency.ContractID, idx uint64) NFTID

func NewNFTID

func NewNFTID(symbol extensioncurrency.ContractID, idx uint64) NFTID

func NewTestNFTID

func NewTestNFTID(idx uint64) NFTID

func (NFTID) Bytes

func (nid NFTID) Bytes() []byte

func (NFTID) Collection

func (nid NFTID) Collection() extensioncurrency.ContractID

func (NFTID) Equal

func (nid NFTID) Equal(cnid NFTID) bool

func (NFTID) GenerateHash

func (nid NFTID) GenerateHash() valuehash.Hash

func (NFTID) Hash

func (nid NFTID) Hash() valuehash.Hash

func (NFTID) Hint

func (nid NFTID) Hint() hint.Hint

func (NFTID) Idx

func (nid NFTID) Idx() uint64

func (NFTID) IsValid

func (nid NFTID) IsValid([]byte) error

func (NFTID) MarshalBSON

func (nid NFTID) MarshalBSON() ([]byte, error)

func (NFTID) MarshalJSON

func (nid NFTID) MarshalJSON() ([]byte, error)

func (NFTID) String

func (nid NFTID) String() string

func (*NFTID) UnpackBSON

func (nid *NFTID) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*NFTID) UnpackJSON

func (nid *NFTID) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type NFTIDBSONUnpacker

type NFTIDBSONUnpacker struct {
	CL string `bson:"collection"`
	ID uint64 `bson:"idx"`
}

type NFTIDJSONPacker

type NFTIDJSONPacker struct {
	jsonenc.HintedHead
	CL extensioncurrency.ContractID `json:"collection"`
	ID uint64                       `json:"idx"`
}

type NFTIDJSONUnpacker

type NFTIDJSONUnpacker struct {
	CL string `json:"collection"`
	ID uint64 `json:"idx"`
}

type NFTJSONPacker

type NFTJSONPacker struct {
	jsonenc.HintedHead
	ID NFTID        `json:"id"`
	AC bool         `json:"active"`
	ON base.Address `json:"owner"`
	HS NFTHash      `json:"hash"`
	UR URI          `json:"uri"`
	AP base.Address `json:"approved"`
	CR Signers      `json:"creators"`
	CP Signers      `json:"copyrighters"`
}

type NFTJSONUnpacker

type NFTJSONUnpacker struct {
	ID json.RawMessage     `json:"id"`
	AC bool                `json:"active"`
	ON base.AddressDecoder `json:"owner"`
	HS string              `json:"hash"`
	UR string              `json:"uri"`
	AP base.AddressDecoder `json:"approved"`
	CR json.RawMessage     `json:"creators"`
	CP json.RawMessage     `json:"copyrighters"`
}

type PaymentParameter

type PaymentParameter uint

func (PaymentParameter) Bytes

func (pp PaymentParameter) Bytes() []byte

func (PaymentParameter) IsValid

func (pp PaymentParameter) IsValid([]byte) error

func (PaymentParameter) Uint

func (pp PaymentParameter) Uint() uint

type Signer

type Signer struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func MustNewSigner

func MustNewSigner(account base.Address, share uint, signed bool) Signer

func NewSigner

func NewSigner(account base.Address, share uint, signed bool) Signer

func (Signer) Account

func (signer Signer) Account() base.Address

func (Signer) Bytes

func (signer Signer) Bytes() []byte

func (Signer) Equal

func (signer Signer) Equal(csigner Signer) bool

func (Signer) IsValid

func (signer Signer) IsValid([]byte) error

func (Signer) MarshalBSON

func (signer Signer) MarshalBSON() ([]byte, error)

func (Signer) MarshalJSON

func (signer Signer) MarshalJSON() ([]byte, error)

func (Signer) Share

func (signer Signer) Share() uint

func (Signer) Signed

func (signer Signer) Signed() bool

func (*Signer) UnpackBSON

func (signer *Signer) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*Signer) UnpackJSON

func (signer *Signer) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type SignerBSONUnpacker

type SignerBSONUnpacker struct {
	AC base.AddressDecoder `bson:"account"`
	SH uint                `bson:"share"`
	SG bool                `bson:"signed"`
}

type SignerJSONPacker

type SignerJSONPacker struct {
	jsonenc.HintedHead
	AC base.Address `json:"account"`
	SH uint         `json:"share"`
	SG bool         `json:"signed"`
}

type SignerJSONUnpacker

type SignerJSONUnpacker struct {
	AC base.AddressDecoder `json:"account"`
	SH uint                `json:"share"`
	SG bool                `json:"signed"`
}

type Signers

type Signers struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func MustNewSigners

func MustNewSigners(total uint, signers []Signer) Signers

func NewSigners

func NewSigners(total uint, signers []Signer) Signers

func NewTestSigners

func NewTestSigners() Signers

func (Signers) Addresses

func (signers Signers) Addresses() []base.Address

func (Signers) Bytes

func (signers Signers) Bytes() []byte

func (Signers) Equal

func (signers Signers) Equal(csigners Signers) bool

func (Signers) Exists

func (signers Signers) Exists(signer Signer) bool

func (Signers) Index

func (signers Signers) Index(signer Signer) int

func (Signers) IndexByAddress

func (signers Signers) IndexByAddress(address base.Address) int

func (Signers) IsSigned

func (signers Signers) IsSigned(signer Signer) bool

func (Signers) IsSignedByAddress

func (signers Signers) IsSignedByAddress(address base.Address) bool

func (Signers) IsValid

func (signers Signers) IsValid([]byte) error

func (Signers) MarshalBSON

func (signers Signers) MarshalBSON() ([]byte, error)

func (Signers) MarshalJSON

func (signers Signers) MarshalJSON() ([]byte, error)

func (*Signers) SetSigner

func (signers *Signers) SetSigner(signer Signer) error

func (Signers) Signers

func (signers Signers) Signers() []Signer

func (Signers) Total

func (signers Signers) Total() uint

func (*Signers) UnpackBSON

func (signers *Signers) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*Signers) UnpackJSON

func (signers *Signers) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type SignersBSONUnpacker

type SignersBSONUnpacker struct {
	TT uint     `bson:"total"`
	SG bson.Raw `bson:"signers"`
}

type SignersJSONPacker

type SignersJSONPacker struct {
	jsonenc.HintedHead
	TT uint     `json:"total"`
	SG []Signer `json:"signers"`
}

type SignersJSONUnpacker

type SignersJSONUnpacker struct {
	TT uint            `json:"total"`
	SG json.RawMessage `json:"signers"`
}

type TestPolicy

type TestPolicy struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewTestPolicy

func NewTestPolicy(value int) TestPolicy

func (TestPolicy) Addresses

func (tp TestPolicy) Addresses() ([]base.Address, error)

func (TestPolicy) Bytes

func (tp TestPolicy) Bytes() []byte

func (TestPolicy) Equal

func (tp TestPolicy) Equal(c BasePolicy) bool

func (TestPolicy) IsValid

func (tp TestPolicy) IsValid([]byte) error

func (TestPolicy) MarshalBSON

func (tp TestPolicy) MarshalBSON() ([]byte, error)

func (TestPolicy) MarshalJSON

func (tp TestPolicy) MarshalJSON() ([]byte, error)

func (TestPolicy) Rebuild

func (tp TestPolicy) Rebuild() BasePolicy

func (*TestPolicy) UnpackBSON

func (tp *TestPolicy) UnpackBSON(b []byte, enc *bsonenc.Encoder) error

func (*TestPolicy) UnpackJSON

func (tp *TestPolicy) UnpackJSON(b []byte, enc *jsonenc.Encoder) error

type TestPolicyBSONUnpacker

type TestPolicyBSONUnpacker struct {
	VL int `bson:"value"`
}

type TestPolicyJSONPacker

type TestPolicyJSONPacker struct {
	jsonenc.HintedHead
	VL int `json:"value"`
}

type TestPolicyJSONUnpacker

type TestPolicyJSONUnpacker struct {
	VL int `json:"value"`
}

type URI

type URI string

func (URI) Bytes

func (uri URI) Bytes() []byte

func (URI) IsValid

func (uri URI) IsValid([]byte) error

func (URI) String

func (uri URI) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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