nfttx

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoResults is returned when no results are found
	ErrNoResults = errors.New("no results found")
)

Functions

func GenerateBytesUUID

func GenerateBytesUUID() []byte

GenerateBytesUUID returns a UUID based on RFC 4122 returning the generated bytes The function panics in case of an error

func GenerateUUID

func GenerateUUID() string

GenerateUUID returns a UUID based on RFC 4122

func GetIssuerWallet

func GetIssuerWallet(sp view2.ServiceProvider, id string, opts ...token.ServiceOption) *token.IssuerWallet

GetIssuerWallet returns the issuer wallet whose id is the passed id. If the passed id is empty, GetIssuerWallet has the same behaviour of MyIssuerWallet. It returns nil, if no wallet is found.

func GetIssuerWalletForChannel

func GetIssuerWalletForChannel(sp view2.ServiceProvider, channel, id string, opts ...token.ServiceOption) *token.IssuerWallet

GetIssuerWalletForChannel returns the issuer wallet whose id is the passed id for the passed channel. If the passed id is empty, GetIssuerWalletForChannel has the same behaviour of MyIssuerWallet. It returns nil, if no wallet is found.

func MyAuditorWallet

func MyAuditorWallet(sp view2.ServiceProvider, opts ...token.ServiceOption) *token.AuditorWallet

MyAuditorWallet returns the default auditor wallet, nil if not found.

func MyIssuerWallet

func MyIssuerWallet(context view.Context, opts ...token.ServiceOption) *token.IssuerWallet

MyIssuerWallet returns the default issuer wallet, nil if not found

func NewAcceptView

func NewAcceptView(tx *Transaction) view.View

func NewCollectEndorsementsView

func NewCollectEndorsementsView(tx *Transaction) view.View

func NewFilter

func NewFilter(wallet string, service QueryService, precision uint64, tracer Tracer) *filter

func NewFinalityView

func NewFinalityView(tx *Transaction) view.View

func NewFinalityWithTimeoutView

func NewFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) view.View

func NewOrderingAndFinalityView

func NewOrderingAndFinalityView(tx *Transaction) view.View

func NewOrderingAndFinalityWithTimeoutView

func NewOrderingAndFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) view.View

func RequestRecipientIdentity

func RequestRecipientIdentity(context view.Context, recipient view.Identity, opts ...token.ServiceOption) (view.Identity, error)

func RespondRequestRecipientIdentity

func RespondRequestRecipientIdentity(context view.Context) (view.Identity, error)

func WithType

func WithType(tokenType string) token.ListTokensOption

WithType returns a list token option that filter by the passed token type. If the passed token type is the empty string, all token types are selected.

func WithUniqueID

func WithUniqueID(uniqueID string) token.IssueOption

WithUniqueID sets the unique ID of the NFT

Types

type AutoLinearState

type AutoLinearState interface {
	GetLinearID() (string, error)
}

type Filter

type Filter interface {
	// ContainsToken returns true if the passed token is recognized, false otherwise.
	ContainsToken(token *token2.UnspentToken) bool
}

Filter is a filter for NFTCC

type LinearState

type LinearState interface {
	// SetLinearID assigns the passed id to the state
	SetLinearID(id string) string
}

LinearState models a state with a unique identifier that does not change through the evolution of the state.

type OutputStream

type OutputStream struct {
	*token.OutputStream
}

func (*OutputStream) ByEnrollmentID

func (o *OutputStream) ByEnrollmentID(id string) *OutputStream

func (*OutputStream) ByRecipient

func (o *OutputStream) ByRecipient(id view.Identity) *OutputStream

func (*OutputStream) ByType

func (o *OutputStream) ByType(typ string) *OutputStream

func (*OutputStream) Filter

func (o *OutputStream) Filter(f func(t *token.Output) bool) *OutputStream

Filter returns a stream of output filtered applying the passed filter

func (*OutputStream) StateAt

func (o *OutputStream) StateAt(index int, state interface{}) error

func (*OutputStream) Validate

func (o *OutputStream) Validate() error

type OwnerWallet

type OwnerWallet struct {
	view2.ServiceProvider
	*token.OwnerWallet
	Precision uint64
}

func GetWallet

func GetWallet(sp view2.ServiceProvider, id string, opts ...token.ServiceOption) *OwnerWallet

GetWallet returns the wallet whose id is the passed id. If the passed id is empty, GetWallet has the same behaviour of MyWallet. It returns nil, if no wallet is found.

func GetWalletForChannel

func GetWalletForChannel(sp view2.ServiceProvider, channel, id string, opts ...token.ServiceOption) *OwnerWallet

GetWalletForChannel returns the wallet whose id is the passed id for the passed channel. If the passed id is empty, GetWalletForChannel has the same behaviour of MyWalletFromTx. It returns nil, if no wallet is found.

func MyWallet

func MyWallet(sp view2.ServiceProvider, opts ...token.ServiceOption) *OwnerWallet

MyWallet returns the default wallet, nil if not found.

func MyWalletFromTx

func MyWalletFromTx(sp view2.ServiceProvider, tx *Transaction) *OwnerWallet

MyWalletFromTx returns the default wallet for the tuple (network, channel, namespace) as identified by the passed transaction. Returns nil if no wallet is found.

func (*OwnerWallet) QueryByKey

func (o *OwnerWallet) QueryByKey(state interface{}, key string, value string) error

type QueryExecutor

type QueryExecutor struct {
	// contains filtered or unexported fields
}

func NewQueryExecutor

func NewQueryExecutor(sp view.ServiceProvider, wallet string, precision uint64, opts ...token.ServiceOption) (*QueryExecutor, error)

func (*QueryExecutor) QueryByKey

func (s *QueryExecutor) QueryByKey(state interface{}, key string, value string) error

type QueryService

type QueryService interface {
	UnspentTokensIterator() (*token.UnspentTokensIterator, error)
	UnspentTokensIteratorBy(id, typ string) (*token.UnspentTokensIterator, error)
	GetTokens(inputs ...*token2.ID) ([]*token2.Token, error)
}

type Tracer added in v0.3.0

type Tracer tracing.Tracer

type Transaction

type Transaction struct {
	*ttx.Transaction
}

func NewAnonymousTransaction

func NewAnonymousTransaction(sp view.Context, opts ...TxOption) (*Transaction, error)

func ReceiveTransaction

func ReceiveTransaction(context view.Context) (*Transaction, error)

func Wrap

func Wrap(tx *ttx.Transaction) *Transaction

func (*Transaction) Issue

func (t *Transaction) Issue(wallet *token.IssuerWallet, state interface{}, recipient view.Identity, opts ...token.IssueOption) error

func (*Transaction) Outputs

func (t *Transaction) Outputs() (*OutputStream, error)

func (*Transaction) Transfer

func (t *Transaction) Transfer(wallet *OwnerWallet, state interface{}, recipient view.Identity, opts ...token.TransferOption) error

type TxOption

type TxOption ttx.TxOption

func WithAuditor

func WithAuditor(auditor view.Identity) TxOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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