tokens

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: AGPL-3.0 Imports: 21 Imported by: 5

Documentation

Index

Constants

View Source
const (
	PayloadTypeCreateNFTType           = "createNType"
	PayloadTypeMintNFT                 = "createNToken"
	PayloadTypeTransferNFT             = "transNToken"
	PayloadTypeUpdateNFT               = "updateNToken"
	PayloadTypeCreateFungibleTokenType = "createFType"
	PayloadTypeMintFungibleToken       = "createFToken"
	PayloadTypeTransferFungibleToken   = "transFToken"
	PayloadTypeSplitFungibleToken      = "splitFToken"
	PayloadTypeBurnFungibleToken       = "burnFToken"
	PayloadTypeJoinFungibleToken       = "joinFToken"
	PayloadTypeLockToken               = "lockToken"
	PayloadTypeUnlockToken             = "unlockToken"
)
View Source
const (
	ErrStrInvalidUnitID         = "invalid unit ID"
	ErrStrInvalidTypeID         = "invalid type ID"
	ErrStrInvalidParentTypeID   = "invalid parent type ID"
	ErrStrInvalidSystemID       = "system identifier is not assigned"
	ErrStrStateIsNil            = "state is nil"
	ErrStrInvalidSymbolLength   = "symbol length exceeds the allowed maximum of 16 bytes"
	ErrStrInvalidNameLength     = "name length exceeds the allowed maximum of 256 bytes"
	ErrStrInvalidIconTypeLength = "icon type length exceeds the allowed maximum of 64 bytes"
	ErrStrInvalidIconDataLength = "icon data length exceeds the allowed maximum of 64 KiB"
)
View Source
const (
	UnitIDLength   = UnitPartLength + TypePartLength
	UnitPartLength = 32
	TypePartLength = 1
)
View Source
const DefaultSystemIdentifier types.SystemID = 0x00000002

Variables

View Source
var (
	FungibleTokenTypeUnitType    = []byte{0x20}
	FungibleTokenUnitType        = []byte{0x21}
	NonFungibleTokenTypeUnitType = []byte{0x22}
	NonFungibleTokenUnitType     = []byte{0x23}
	FeeCreditRecordUnitType      = []byte{0x2f}
)
View Source
var (
	DustCollectorPredicate = templates.NewP2pkh256BytesFromKeyHash(hash.Sum256([]byte("dust collector")))
)

Functions

func HashForIDCalculation

func HashForIDCalculation(tx *types.TransactionOrder, hashFunc crypto.Hash) []byte

func NewFeeCreditRecordID

func NewFeeCreditRecordID(shardPart []byte, unitPart []byte) types.UnitID

func NewFungibleTokenID

func NewFungibleTokenID(shardPart []byte, unitPart []byte) types.UnitID

func NewFungibleTokenTypeID

func NewFungibleTokenTypeID(shardPart []byte, unitPart []byte) types.UnitID

func NewNonFungibleTokenID

func NewNonFungibleTokenID(shardPart []byte, unitPart []byte) types.UnitID

func NewNonFungibleTokenTypeID

func NewNonFungibleTokenTypeID(shardPart []byte, unitPart []byte) types.UnitID

func NewRandomFungibleTokenID

func NewRandomFungibleTokenID(shardPart []byte) (types.UnitID, error)

func NewRandomFungibleTokenTypeID

func NewRandomFungibleTokenTypeID(shardPart []byte) (types.UnitID, error)

func NewRandomNonFungibleTokenID

func NewRandomNonFungibleTokenID(shardPart []byte) (types.UnitID, error)

func NewRandomNonFungibleTokenTypeID

func NewRandomNonFungibleTokenTypeID(shardPart []byte) (types.UnitID, error)

func NewTxSystem

func NewTxSystem(observe txsystem.Observability, opts ...Option) (*txsystem.GenericTxSystem, error)

func NewUnitData

func NewUnitData(unitID types.UnitID) (state.UnitData, error)

func PredicateRunner added in v0.4.0

func PredicateRunner(
	executor PredicateExecutor,
	state *state.State,
) func(predicate, args []byte, txo *types.TransactionOrder) error

PredicateRunner returns token tx system specific predicate runner wrapper

Types

type BurnFungibleTokenAttributes

type BurnFungibleTokenAttributes struct {
	TypeID                       types.UnitID // identifies the type of the token to burn;
	Value                        uint64       // the value to burn
	TargetTokenID                types.UnitID // the target token identifier in join step
	TargetTokenBacklink          []byte       // the current state hash of the target token
	Backlink                     []byte       // the backlink to the previous transaction with this token
	InvariantPredicateSignatures [][]byte     // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}
func (b *BurnFungibleTokenAttributes) GetBacklink() []byte

func (*BurnFungibleTokenAttributes) GetInvariantPredicateSignatures

func (b *BurnFungibleTokenAttributes) GetInvariantPredicateSignatures() [][]byte
func (b *BurnFungibleTokenAttributes) GetTargetTokenBacklink() []byte

func (*BurnFungibleTokenAttributes) GetTargetTokenID

func (b *BurnFungibleTokenAttributes) GetTargetTokenID() []byte

func (*BurnFungibleTokenAttributes) GetTypeID

func (b *BurnFungibleTokenAttributes) GetTypeID() types.UnitID

func (*BurnFungibleTokenAttributes) GetValue

func (b *BurnFungibleTokenAttributes) GetValue() uint64
func (b *BurnFungibleTokenAttributes) SetBacklink(backlink []byte)

func (*BurnFungibleTokenAttributes) SetInvariantPredicateSignatures

func (b *BurnFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)
func (b *BurnFungibleTokenAttributes) SetTargetTokenBacklink(targetTokenBacklink []byte)

func (*BurnFungibleTokenAttributes) SetTargetTokenID

func (b *BurnFungibleTokenAttributes) SetTargetTokenID(targetTokenID []byte)

func (*BurnFungibleTokenAttributes) SetTypeID

func (b *BurnFungibleTokenAttributes) SetTypeID(typeID types.UnitID)

func (*BurnFungibleTokenAttributes) SetValue

func (b *BurnFungibleTokenAttributes) SetValue(value uint64)

func (*BurnFungibleTokenAttributes) SigBytes

func (b *BurnFungibleTokenAttributes) SigBytes() ([]byte, error)

type CreateFungibleTokenTypeAttributes

type CreateFungibleTokenTypeAttributes struct {
	Symbol                             string       // the symbol (short name) of this token type; note that the symbols are not guaranteed to be unique;
	Name                               string       // the long name of this token type;
	Icon                               *Icon        // the icon of this token type;
	ParentTypeID                       types.UnitID // identifies the parent type that this type derives from; 0 indicates there is no parent type;
	DecimalPlaces                      uint32       // the number of decimal places to display for values of tokens of the new type;
	SubTypeCreationPredicate           []byte       // the predicate clause that controls defining new sub-types of this type;
	TokenCreationPredicate             []byte       // the predicate clause that controls creating new tokens of this type
	InvariantPredicate                 []byte       // the invariant predicate clause that all tokens of this type (and of sub- types of this type) inherit into their bearer predicates;
	SubTypeCreationPredicateSignatures [][]byte     // inputs to satisfy the sub-type creation predicates of all parents.
	// contains filtered or unexported fields
}

func (*CreateFungibleTokenTypeAttributes) GetDecimalPlaces

func (c *CreateFungibleTokenTypeAttributes) GetDecimalPlaces() uint32

func (*CreateFungibleTokenTypeAttributes) GetIcon

func (*CreateFungibleTokenTypeAttributes) GetInvariantPredicate

func (c *CreateFungibleTokenTypeAttributes) GetInvariantPredicate() []byte

func (*CreateFungibleTokenTypeAttributes) GetName

func (*CreateFungibleTokenTypeAttributes) GetParentTypeID

func (c *CreateFungibleTokenTypeAttributes) GetParentTypeID() types.UnitID

func (*CreateFungibleTokenTypeAttributes) GetSubTypeCreationPredicate

func (c *CreateFungibleTokenTypeAttributes) GetSubTypeCreationPredicate() []byte

func (*CreateFungibleTokenTypeAttributes) GetSubTypeCreationPredicateSignatures

func (c *CreateFungibleTokenTypeAttributes) GetSubTypeCreationPredicateSignatures() [][]byte

func (*CreateFungibleTokenTypeAttributes) GetSymbol

func (*CreateFungibleTokenTypeAttributes) GetTokenCreationPredicate

func (c *CreateFungibleTokenTypeAttributes) GetTokenCreationPredicate() []byte

func (*CreateFungibleTokenTypeAttributes) SetDecimalPlaces

func (c *CreateFungibleTokenTypeAttributes) SetDecimalPlaces(decimalPlaces uint32)

func (*CreateFungibleTokenTypeAttributes) SetIcon

func (c *CreateFungibleTokenTypeAttributes) SetIcon(icon *Icon)

func (*CreateFungibleTokenTypeAttributes) SetInvariantPredicate

func (c *CreateFungibleTokenTypeAttributes) SetInvariantPredicate(predicate []byte)

func (*CreateFungibleTokenTypeAttributes) SetName

func (c *CreateFungibleTokenTypeAttributes) SetName(name string)

func (*CreateFungibleTokenTypeAttributes) SetParentTypeID

func (c *CreateFungibleTokenTypeAttributes) SetParentTypeID(parentTypeID types.UnitID)

func (*CreateFungibleTokenTypeAttributes) SetSubTypeCreationPredicate

func (c *CreateFungibleTokenTypeAttributes) SetSubTypeCreationPredicate(predicate []byte)

func (*CreateFungibleTokenTypeAttributes) SetSubTypeCreationPredicateSignatures

func (c *CreateFungibleTokenTypeAttributes) SetSubTypeCreationPredicateSignatures(signatures [][]byte)

func (*CreateFungibleTokenTypeAttributes) SetSymbol

func (c *CreateFungibleTokenTypeAttributes) SetSymbol(symbol string)

func (*CreateFungibleTokenTypeAttributes) SetTokenCreationPredicate

func (c *CreateFungibleTokenTypeAttributes) SetTokenCreationPredicate(predicate []byte)

func (*CreateFungibleTokenTypeAttributes) SigBytes

func (c *CreateFungibleTokenTypeAttributes) SigBytes() ([]byte, error)

type CreateNonFungibleTokenTypeAttributes

type CreateNonFungibleTokenTypeAttributes struct {
	Symbol                             string       // the symbol (short name) of this token type; note that the symbols are not guaranteed to be unique;
	Name                               string       // the long name of this token type;
	Icon                               *Icon        // the icon of this token type;
	ParentTypeID                       types.UnitID // identifies the parent type that this type derives from; 0 indicates there is no parent type;
	SubTypeCreationPredicate           []byte       // the predicate clause that controls defining new sub-types of this type;
	TokenCreationPredicate             []byte       // the predicate clause that controls creating new tokens of this type
	InvariantPredicate                 []byte       // the invariant predicate clause that all tokens of this type (and of sub- types of this type) inherit into their bearer predicates;
	DataUpdatePredicate                []byte       // the clause that all tokens of this type (and of sub-types of this type) inherit into their data update predicates
	SubTypeCreationPredicateSignatures [][]byte     // inputs to satisfy the sub-type creation predicates of all parents.
	// contains filtered or unexported fields
}

func (*CreateNonFungibleTokenTypeAttributes) GetDataUpdatePredicate

func (c *CreateNonFungibleTokenTypeAttributes) GetDataUpdatePredicate() []byte

func (*CreateNonFungibleTokenTypeAttributes) GetIcon

func (*CreateNonFungibleTokenTypeAttributes) GetInvariantPredicate

func (c *CreateNonFungibleTokenTypeAttributes) GetInvariantPredicate() []byte

func (*CreateNonFungibleTokenTypeAttributes) GetName

func (*CreateNonFungibleTokenTypeAttributes) GetParentTypeID

func (c *CreateNonFungibleTokenTypeAttributes) GetParentTypeID() types.UnitID

func (*CreateNonFungibleTokenTypeAttributes) GetSubTypeCreationPredicate

func (c *CreateNonFungibleTokenTypeAttributes) GetSubTypeCreationPredicate() []byte

func (*CreateNonFungibleTokenTypeAttributes) GetSubTypeCreationPredicateSignatures

func (c *CreateNonFungibleTokenTypeAttributes) GetSubTypeCreationPredicateSignatures() [][]byte

func (*CreateNonFungibleTokenTypeAttributes) GetSymbol

func (*CreateNonFungibleTokenTypeAttributes) GetTokenCreationPredicate

func (c *CreateNonFungibleTokenTypeAttributes) GetTokenCreationPredicate() []byte

func (*CreateNonFungibleTokenTypeAttributes) SetDataUpdatePredicate

func (c *CreateNonFungibleTokenTypeAttributes) SetDataUpdatePredicate(predicate []byte)

func (*CreateNonFungibleTokenTypeAttributes) SetIcon

func (c *CreateNonFungibleTokenTypeAttributes) SetIcon(icon *Icon)

func (*CreateNonFungibleTokenTypeAttributes) SetInvariantPredicate

func (c *CreateNonFungibleTokenTypeAttributes) SetInvariantPredicate(predicate []byte)

func (*CreateNonFungibleTokenTypeAttributes) SetName

func (*CreateNonFungibleTokenTypeAttributes) SetParentTypeID

func (c *CreateNonFungibleTokenTypeAttributes) SetParentTypeID(parentTypeID types.UnitID)

func (*CreateNonFungibleTokenTypeAttributes) SetSubTypeCreationPredicate

func (c *CreateNonFungibleTokenTypeAttributes) SetSubTypeCreationPredicate(predicate []byte)

func (*CreateNonFungibleTokenTypeAttributes) SetSubTypeCreationPredicateSignatures

func (c *CreateNonFungibleTokenTypeAttributes) SetSubTypeCreationPredicateSignatures(signatures [][]byte)

func (*CreateNonFungibleTokenTypeAttributes) SetSymbol

func (c *CreateNonFungibleTokenTypeAttributes) SetSymbol(symbol string)

func (*CreateNonFungibleTokenTypeAttributes) SetTokenCreationPredicate

func (c *CreateNonFungibleTokenTypeAttributes) SetTokenCreationPredicate(predicate []byte)

func (*CreateNonFungibleTokenTypeAttributes) SigBytes

func (c *CreateNonFungibleTokenTypeAttributes) SigBytes() ([]byte, error)

type FungibleTokenData

type FungibleTokenData struct {
	TokenType types.UnitID // the type of the token;
	Value     uint64       // the value of the token;
	T         uint64       // the round number of the last transaction with this token;
	Backlink  []byte       // the hash of the last transaction order for this token
	Locked    uint64       // locked status of the bill, non-zero value means locked
	// contains filtered or unexported fields
}

func (*FungibleTokenData) Copy

func (f *FungibleTokenData) Copy() state.UnitData
func (f *FungibleTokenData) GetBacklink() []byte

func (*FungibleTokenData) IsLocked

func (f *FungibleTokenData) IsLocked() uint64

func (*FungibleTokenData) SummaryValueInput

func (f *FungibleTokenData) SummaryValueInput() uint64

func (*FungibleTokenData) Write

func (f *FungibleTokenData) Write(hasher hash.Hash) error

type FungibleTokenTypeData

type FungibleTokenTypeData struct {
	Symbol                   string
	Name                     string
	Icon                     *Icon
	ParentTypeId             types.UnitID // identifies the parent type that this type derives from; 0 indicates there is no parent type;
	DecimalPlaces            uint32       // is the number of decimal places to display for values of tokens of this type;
	SubTypeCreationPredicate []byte       // the predicate clause that controls defining new sub-types of this type;
	TokenCreationPredicate   []byte       // the predicate clause that controls creating new tokens of this type
	InvariantPredicate       []byte       // the invariant predicate clause that all tokens of this type (and of sub-types of this type) inherit into their bearer predicates;
	// contains filtered or unexported fields
}

func (*FungibleTokenTypeData) Copy

func (*FungibleTokenTypeData) SummaryValueInput

func (f *FungibleTokenTypeData) SummaryValueInput() uint64

func (*FungibleTokenTypeData) Write

func (f *FungibleTokenTypeData) Write(hasher hash.Hash) error

type FungibleTokensModule

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

func NewFungibleTokensModule

func NewFungibleTokensModule(options *Options) (*FungibleTokensModule, error)

func (*FungibleTokensModule) TxExecutors

func (n *FungibleTokensModule) TxExecutors() map[string]txsystem.ExecuteFunc

type Icon

type Icon struct {
	Type string `json:"type"` // the MIME content type identifying an image format;
	Data []byte `json:"data"` // the image in the format specified by type;
	// contains filtered or unexported fields
}

func (*Icon) Copy

func (i *Icon) Copy() *Icon

type JoinFungibleTokenAttributes

type JoinFungibleTokenAttributes struct {
	BurnTransactions             []*types.TransactionRecord // the transactions that burned the source tokens;
	Proofs                       []*types.TxProof           // block proofs for burn transactions
	Backlink                     []byte                     // the backlink to the previous transaction with this token
	InvariantPredicateSignatures [][]byte                   // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}
func (j *JoinFungibleTokenAttributes) GetBacklink() []byte

func (*JoinFungibleTokenAttributes) GetBurnTransactions

func (j *JoinFungibleTokenAttributes) GetBurnTransactions() []*types.TransactionRecord

func (*JoinFungibleTokenAttributes) GetInvariantPredicateSignatures

func (j *JoinFungibleTokenAttributes) GetInvariantPredicateSignatures() [][]byte

func (*JoinFungibleTokenAttributes) GetProofs

func (j *JoinFungibleTokenAttributes) GetProofs() []*types.TxProof
func (j *JoinFungibleTokenAttributes) SetBacklink(backlink []byte)

func (*JoinFungibleTokenAttributes) SetBurnTransactions

func (j *JoinFungibleTokenAttributes) SetBurnTransactions(burnTransactions []*types.TransactionRecord)

func (*JoinFungibleTokenAttributes) SetInvariantPredicateSignatures

func (j *JoinFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*JoinFungibleTokenAttributes) SetProofs

func (j *JoinFungibleTokenAttributes) SetProofs(proofs []*types.TxProof)

func (*JoinFungibleTokenAttributes) SigBytes

func (j *JoinFungibleTokenAttributes) SigBytes() ([]byte, error)

type LockTokenAttributes

type LockTokenAttributes struct {
	LockStatus                   uint64   // status of the lock, non-zero value means locked
	Backlink                     []byte   // the backlink to the previous transaction with this token
	InvariantPredicateSignatures [][]byte // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*LockTokenAttributes) SigBytes

func (l *LockTokenAttributes) SigBytes() ([]byte, error)

type LockTokensModule

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

func NewLockTokensModule

func NewLockTokensModule(options *Options) (*LockTokensModule, error)

func (*LockTokensModule) TxExecutors

func (n *LockTokensModule) TxExecutors() map[string]txsystem.ExecuteFunc

type MintFungibleTokenAttributes

type MintFungibleTokenAttributes struct {
	Bearer                           []byte       // the initial bearer predicate of the new token
	TypeID                           types.UnitID // identifies the type of the new token;
	Value                            uint64       // the value of the new token;
	TokenCreationPredicateSignatures [][]byte     // inputs to satisfy the token creation predicates of all parent types.
	// contains filtered or unexported fields
}

func (*MintFungibleTokenAttributes) GetBearer

func (m *MintFungibleTokenAttributes) GetBearer() []byte

func (*MintFungibleTokenAttributes) GetTokenCreationPredicateSignatures

func (m *MintFungibleTokenAttributes) GetTokenCreationPredicateSignatures() [][]byte

func (*MintFungibleTokenAttributes) GetTypeID

func (m *MintFungibleTokenAttributes) GetTypeID() types.UnitID

func (*MintFungibleTokenAttributes) GetValue

func (m *MintFungibleTokenAttributes) GetValue() uint64

func (*MintFungibleTokenAttributes) SetBearer

func (m *MintFungibleTokenAttributes) SetBearer(bearer []byte)

func (*MintFungibleTokenAttributes) SetTokenCreationPredicateSignatures

func (m *MintFungibleTokenAttributes) SetTokenCreationPredicateSignatures(signatures [][]byte)

func (*MintFungibleTokenAttributes) SetTypeID

func (m *MintFungibleTokenAttributes) SetTypeID(typeID types.UnitID)

func (*MintFungibleTokenAttributes) SetValue

func (m *MintFungibleTokenAttributes) SetValue(value uint64)

func (*MintFungibleTokenAttributes) SigBytes

func (m *MintFungibleTokenAttributes) SigBytes() ([]byte, error)

type MintNonFungibleTokenAttributes

type MintNonFungibleTokenAttributes struct {
	Bearer                           []byte       // the initial bearer predicate of the new token
	NFTTypeID                        types.UnitID // identifies the type of the new token;
	Name                             string       // the name of the new token
	URI                              string       // the optional URI of an external resource associated with the new token
	Data                             []byte       // the optional data associated with the new token
	DataUpdatePredicate              []byte       // the data update predicate of the new token;
	TokenCreationPredicateSignatures [][]byte     // inputs to satisfy the token creation predicates of all parent types.
	// contains filtered or unexported fields
}

func (*MintNonFungibleTokenAttributes) GetBearer

func (m *MintNonFungibleTokenAttributes) GetBearer() []byte

func (*MintNonFungibleTokenAttributes) GetData

func (m *MintNonFungibleTokenAttributes) GetData() []byte

func (*MintNonFungibleTokenAttributes) GetDataUpdatePredicate

func (m *MintNonFungibleTokenAttributes) GetDataUpdatePredicate() []byte

func (*MintNonFungibleTokenAttributes) GetNFTTypeID

func (m *MintNonFungibleTokenAttributes) GetNFTTypeID() types.UnitID

func (*MintNonFungibleTokenAttributes) GetName

func (*MintNonFungibleTokenAttributes) GetTokenCreationPredicateSignatures

func (m *MintNonFungibleTokenAttributes) GetTokenCreationPredicateSignatures() [][]byte

func (*MintNonFungibleTokenAttributes) GetURI

func (*MintNonFungibleTokenAttributes) SetBearer

func (m *MintNonFungibleTokenAttributes) SetBearer(bearer []byte)

func (*MintNonFungibleTokenAttributes) SetData

func (m *MintNonFungibleTokenAttributes) SetData(data []byte)

func (*MintNonFungibleTokenAttributes) SetDataUpdatePredicate

func (m *MintNonFungibleTokenAttributes) SetDataUpdatePredicate(predicate []byte)

func (*MintNonFungibleTokenAttributes) SetNFTTypeID

func (m *MintNonFungibleTokenAttributes) SetNFTTypeID(nftTypeID types.UnitID)

func (*MintNonFungibleTokenAttributes) SetName

func (m *MintNonFungibleTokenAttributes) SetName(name string)

func (*MintNonFungibleTokenAttributes) SetTokenCreationPredicateSignatures

func (m *MintNonFungibleTokenAttributes) SetTokenCreationPredicateSignatures(signatures [][]byte)

func (*MintNonFungibleTokenAttributes) SetURI

func (m *MintNonFungibleTokenAttributes) SetURI(uri string)

func (*MintNonFungibleTokenAttributes) SigBytes

func (m *MintNonFungibleTokenAttributes) SigBytes() ([]byte, error)

type NonFungibleTokenData

type NonFungibleTokenData struct {
	NftType             types.UnitID
	Name                string // the optional long name of the token
	URI                 string // uri is the optional URI of an external resource associated with the token
	Data                []byte // data is the optional data associated with the token.
	DataUpdatePredicate []byte // the data update predicate;
	T                   uint64 // the round number of the last transaction with this token;
	Backlink            []byte // the hash of the last transaction order for this token
	Locked              uint64 // locked status of the bill, non-zero value means locked
	// contains filtered or unexported fields
}

func (*NonFungibleTokenData) Copy

func (n *NonFungibleTokenData) GetBacklink() []byte

func (*NonFungibleTokenData) IsLocked

func (n *NonFungibleTokenData) IsLocked() uint64

func (*NonFungibleTokenData) SummaryValueInput

func (n *NonFungibleTokenData) SummaryValueInput() uint64

func (*NonFungibleTokenData) Write

func (n *NonFungibleTokenData) Write(hasher hash.Hash) error

type NonFungibleTokenTypeData

type NonFungibleTokenTypeData struct {
	Symbol                   string
	Name                     string
	Icon                     *Icon
	ParentTypeId             types.UnitID // identifies the parent type that this type derives from; 0 indicates there is no parent type;
	SubTypeCreationPredicate []byte       // the predicate clause that controls defining new sub-types of this type;
	TokenCreationPredicate   []byte       // the predicate clause that controls creating new tokens of this type
	InvariantPredicate       []byte       // the invariant predicate clause that all tokens of this type (and of sub-types of this type) inherit into their bearer predicates;
	DataUpdatePredicate      []byte       // the clause that all tokens of this type (and of sub-types of this type) inherit into their data update predicates
	// contains filtered or unexported fields
}

func (*NonFungibleTokenTypeData) Copy

func (*NonFungibleTokenTypeData) SummaryValueInput

func (n *NonFungibleTokenTypeData) SummaryValueInput() uint64

func (*NonFungibleTokenTypeData) Write

func (n *NonFungibleTokenTypeData) Write(hasher hash.Hash) error

type NonFungibleTokensModule

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

func NewNonFungibleTokensModule

func NewNonFungibleTokensModule(options *Options) (*NonFungibleTokensModule, error)

func (*NonFungibleTokensModule) TxExecutors

func (n *NonFungibleTokensModule) TxExecutors() map[string]txsystem.ExecuteFunc

type Option

type Option func(*Options)

func WithFeeCalculator

func WithFeeCalculator(calc fc.FeeCalculator) Option

func WithHashAlgorithm

func WithHashAlgorithm(algorithm gocrypto.Hash) Option

func WithMoneyTXSystemIdentifier

func WithMoneyTXSystemIdentifier(moneySystemIdentifier types.SystemID) Option

func WithState

func WithState(s *state.State) Option

func WithSystemIdentifier

func WithSystemIdentifier(systemIdentifier types.SystemID) Option

func WithTrustBase

func WithTrustBase(trustBase map[string]crypto.Verifier) Option

type Options

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

type PredicateExecutor added in v0.4.0

type PredicateExecutor func(ctx context.Context, p types.PredicateBytes, args []byte, txo *types.TransactionOrder, env predicates.TxContext) (bool, error)

type SplitFungibleTokenAttributes

type SplitFungibleTokenAttributes struct {
	NewBearer                    []byte // the bearer predicate of the new token;
	TargetValue                  uint64 // the value of the new token
	Nonce                        []byte
	Backlink                     []byte       // the backlink to the previous transaction with this token
	TypeID                       types.UnitID // identifies the type of the token;
	RemainingValue               uint64       // new value of the source token
	InvariantPredicateSignatures [][]byte     // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}
func (s *SplitFungibleTokenAttributes) GetBacklink() []byte

func (*SplitFungibleTokenAttributes) GetInvariantPredicateSignatures

func (s *SplitFungibleTokenAttributes) GetInvariantPredicateSignatures() [][]byte

func (*SplitFungibleTokenAttributes) GetNewBearer

func (s *SplitFungibleTokenAttributes) GetNewBearer() []byte

func (*SplitFungibleTokenAttributes) GetNonce

func (s *SplitFungibleTokenAttributes) GetNonce() []byte

func (*SplitFungibleTokenAttributes) GetRemainingValue

func (s *SplitFungibleTokenAttributes) GetRemainingValue() uint64

func (*SplitFungibleTokenAttributes) GetTargetValue

func (s *SplitFungibleTokenAttributes) GetTargetValue() uint64

func (*SplitFungibleTokenAttributes) GetTypeID

func (s *SplitFungibleTokenAttributes) GetTypeID() types.UnitID
func (s *SplitFungibleTokenAttributes) SetBacklink(backlink []byte)

func (*SplitFungibleTokenAttributes) SetInvariantPredicateSignatures

func (s *SplitFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*SplitFungibleTokenAttributes) SetNewBearer

func (s *SplitFungibleTokenAttributes) SetNewBearer(newBearer []byte)

func (*SplitFungibleTokenAttributes) SetNonce

func (s *SplitFungibleTokenAttributes) SetNonce(nonce []byte)

func (*SplitFungibleTokenAttributes) SetRemainingValue

func (s *SplitFungibleTokenAttributes) SetRemainingValue(remainingValue uint64)

func (*SplitFungibleTokenAttributes) SetTargetValue

func (s *SplitFungibleTokenAttributes) SetTargetValue(targetValue uint64)

func (*SplitFungibleTokenAttributes) SetTypeID

func (s *SplitFungibleTokenAttributes) SetTypeID(typeID types.UnitID)

func (*SplitFungibleTokenAttributes) SigBytes

func (s *SplitFungibleTokenAttributes) SigBytes() ([]byte, error)

type TransferFungibleTokenAttributes

type TransferFungibleTokenAttributes struct {
	NewBearer                    []byte // the initial bearer predicate of the new token
	Value                        uint64 // the value to transfer
	Nonce                        []byte
	Backlink                     []byte       // the backlink to the previous transaction with this token
	TypeID                       types.UnitID // identifies the type of the token;
	InvariantPredicateSignatures [][]byte     // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}
func (t *TransferFungibleTokenAttributes) GetBacklink() []byte

func (*TransferFungibleTokenAttributes) GetInvariantPredicateSignatures

func (t *TransferFungibleTokenAttributes) GetInvariantPredicateSignatures() [][]byte

func (*TransferFungibleTokenAttributes) GetNewBearer

func (t *TransferFungibleTokenAttributes) GetNewBearer() []byte

func (*TransferFungibleTokenAttributes) GetNonce

func (t *TransferFungibleTokenAttributes) GetNonce() []byte

func (*TransferFungibleTokenAttributes) GetTypeID

func (*TransferFungibleTokenAttributes) GetValue

func (t *TransferFungibleTokenAttributes) SetBacklink(backlink []byte)

func (*TransferFungibleTokenAttributes) SetInvariantPredicateSignatures

func (t *TransferFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*TransferFungibleTokenAttributes) SetNewBearer

func (t *TransferFungibleTokenAttributes) SetNewBearer(newBearer []byte)

func (*TransferFungibleTokenAttributes) SetNonce

func (t *TransferFungibleTokenAttributes) SetNonce(nonce []byte)

func (*TransferFungibleTokenAttributes) SetTypeID

func (t *TransferFungibleTokenAttributes) SetTypeID(typeID types.UnitID)

func (*TransferFungibleTokenAttributes) SetValue

func (t *TransferFungibleTokenAttributes) SetValue(value uint64)

func (*TransferFungibleTokenAttributes) SigBytes

func (t *TransferFungibleTokenAttributes) SigBytes() ([]byte, error)

type TransferNonFungibleTokenAttributes

type TransferNonFungibleTokenAttributes struct {
	NewBearer                    []byte       // the new bearer predicate of the token
	Nonce                        []byte       // optional nonce
	Backlink                     []byte       // the backlink to the previous transaction with the token
	NFTTypeID                    types.UnitID // identifies the type of the token;
	InvariantPredicateSignatures [][]byte     // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}
func (t *TransferNonFungibleTokenAttributes) GetBacklink() []byte

func (*TransferNonFungibleTokenAttributes) GetInvariantPredicateSignatures

func (t *TransferNonFungibleTokenAttributes) GetInvariantPredicateSignatures() [][]byte

func (*TransferNonFungibleTokenAttributes) GetNFTTypeID

func (*TransferNonFungibleTokenAttributes) GetNewBearer

func (t *TransferNonFungibleTokenAttributes) GetNewBearer() []byte

func (*TransferNonFungibleTokenAttributes) GetNonce

func (t *TransferNonFungibleTokenAttributes) GetNonce() []byte
func (t *TransferNonFungibleTokenAttributes) SetBacklink(backlink []byte)

func (*TransferNonFungibleTokenAttributes) SetInvariantPredicateSignatures

func (t *TransferNonFungibleTokenAttributes) SetInvariantPredicateSignatures(signatures [][]byte)

func (*TransferNonFungibleTokenAttributes) SetNFTTypeID

func (t *TransferNonFungibleTokenAttributes) SetNFTTypeID(nftTypeID types.UnitID)

func (*TransferNonFungibleTokenAttributes) SetNewBearer

func (t *TransferNonFungibleTokenAttributes) SetNewBearer(newBearer []byte)

func (*TransferNonFungibleTokenAttributes) SetNonce

func (t *TransferNonFungibleTokenAttributes) SetNonce(nonce []byte)

func (*TransferNonFungibleTokenAttributes) SigBytes

func (t *TransferNonFungibleTokenAttributes) SigBytes() ([]byte, error)

type UnlockTokenAttributes

type UnlockTokenAttributes struct {
	Backlink                     []byte   // the backlink to the previous transaction with this token
	InvariantPredicateSignatures [][]byte // inputs to satisfy the token type invariant predicates down the inheritance chain
	// contains filtered or unexported fields
}

func (*UnlockTokenAttributes) SigBytes

func (l *UnlockTokenAttributes) SigBytes() ([]byte, error)

type UpdateNonFungibleTokenAttributes

type UpdateNonFungibleTokenAttributes struct {
	Data                 []byte   // the new data to replace the data currently associated with the token
	Backlink             []byte   // the backlink to the previous transaction with the token
	DataUpdateSignatures [][]byte // inputs to satisfy the token data update predicates down the inheritance chain
	// contains filtered or unexported fields
}
func (u *UpdateNonFungibleTokenAttributes) GetBacklink() []byte

func (*UpdateNonFungibleTokenAttributes) GetData

func (u *UpdateNonFungibleTokenAttributes) GetData() []byte

func (*UpdateNonFungibleTokenAttributes) GetDataUpdateSignatures

func (u *UpdateNonFungibleTokenAttributes) GetDataUpdateSignatures() [][]byte
func (u *UpdateNonFungibleTokenAttributes) SetBacklink(backlink []byte)

func (*UpdateNonFungibleTokenAttributes) SetData

func (u *UpdateNonFungibleTokenAttributes) SetData(data []byte)

func (*UpdateNonFungibleTokenAttributes) SetDataUpdateSignatures

func (u *UpdateNonFungibleTokenAttributes) SetDataUpdateSignatures(signatures [][]byte)

func (*UpdateNonFungibleTokenAttributes) SigBytes

func (u *UpdateNonFungibleTokenAttributes) SigBytes() ([]byte, error)

Jump to

Keyboard shortcuts

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