nft

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package nft is a generated protocol buffer package.

It is generated from these files:

x/nft/codec.proto

It has these top-level messages:

NonFungibleToken
ActionApprovals
Approval
ApprovalOptions
AddApprovalMsg
RemoveApprovalMsg

Index

Constants

View Source
const (
	CodeUnsupportedTokenType uint32 = 500
	CodeInvalidID            uint32 = 501
	CodeDuplicateEntry       uint32 = 502
	CodeMissingEntry         uint32 = 503
	CodeInvalidEntry         uint32 = 504
	CodeUnknownID            uint32 = 505
	CodeInvalidLength        uint32 = 506
	CodeInvalidHost          uint32 = 507
	CodeInvalidPort          uint32 = 508
	CodeInvalidProtocol      uint32 = 509
	CodeInvalidCodec         uint32 = 510
	CodeInvalidJson          uint32 = 511
)

nft and subpackages reserves 500~600

View Source
const (
	PathAddApprovalMsg    = "nft/approval/add"
	PathRemoveApprovalMsg = "nft/approval/remove"
)
View Source
const OwnerIndexName = "owner"

OwnerIndexName is the index to query nft by owner

View Source
const UnlimitedCount = -1

Variables

View Source
var (
	ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCodec   = fmt.Errorf("proto: integer overflow")
)
View Source
var Action_name = map[int32]string{
	0: "ActionUpdateDetails",
	1: "ActionTransfer",
	2: "ActionUpdateApprovals",
}
View Source
var Action_value = map[string]int32{
	"ActionUpdateDetails":   0,
	"ActionTransfer":        1,
	"ActionUpdateApprovals": 2,
}

Functions

func ErrDuplicateEntry

func ErrDuplicateEntry(id []byte) error

func ErrInvalidCodec

func ErrInvalidCodec(codec string) error

func ErrInvalidEntry

func ErrInvalidEntry(id []byte) error

func ErrInvalidHost

func ErrInvalidHost() error

func ErrInvalidID

func ErrInvalidID(id []byte) error

func ErrInvalidJson

func ErrInvalidJson() error

func ErrInvalidLength

func ErrInvalidLength() error

func ErrInvalidPort

func ErrInvalidPort() error

func ErrInvalidProtocol

func ErrInvalidProtocol() error

func ErrMissingEntry

func ErrMissingEntry() error

func ErrUnknownID

func ErrUnknownID(id []byte) error

func ErrUnsupportedTokenType

func ErrUnsupportedTokenType() error

ErrUnsupportedTokenType is when the type passed does not match the expected token type.

func FindActor

func FindActor(auth x.Authenticator, ctx weave.Context, t BaseNFT, action string) weave.Address

func WithOwnerIndex

func WithOwnerIndex(bucket orm.Bucket) orm.Bucket

Types

type Action

type Action int32
const (
	Action_ActionUpdateDetails   Action = 0
	Action_ActionTransfer        Action = 1
	Action_ActionUpdateApprovals Action = 2
)

func (Action) EnumDescriptor

func (Action) EnumDescriptor() ([]byte, []int)

func (Action) String

func (x Action) String() string

type ActionApprovals

type ActionApprovals struct {
	Action    string     `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
	Approvals []Approval `protobuf:"bytes,2,rep,name=approvals" json:"approvals"`
}

func (ActionApprovals) Clone

func (m ActionApprovals) Clone() ActionApprovals

func (*ActionApprovals) Descriptor

func (*ActionApprovals) Descriptor() ([]byte, []int)

func (*ActionApprovals) GetAction

func (m *ActionApprovals) GetAction() string

func (*ActionApprovals) GetApprovals

func (m *ActionApprovals) GetApprovals() []Approval

func (*ActionApprovals) Marshal

func (m *ActionApprovals) Marshal() (dAtA []byte, err error)

func (*ActionApprovals) MarshalTo

func (m *ActionApprovals) MarshalTo(dAtA []byte) (int, error)

func (*ActionApprovals) ProtoMessage

func (*ActionApprovals) ProtoMessage()

func (*ActionApprovals) Reset

func (m *ActionApprovals) Reset()

func (*ActionApprovals) Size

func (m *ActionApprovals) Size() (n int)

func (*ActionApprovals) String

func (m *ActionApprovals) String() string

func (*ActionApprovals) Unmarshal

func (m *ActionApprovals) Unmarshal(dAtA []byte) error

type AddApprovalMsg

type AddApprovalMsg struct {
	ID      []byte          `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Address []byte          `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	Action  string          `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"`
	Options ApprovalOptions `protobuf:"bytes,4,opt,name=options" json:"options"`
	T       string          `protobuf:"bytes,5,opt,name=t,proto3" json:"t,omitempty"`
}

func (*AddApprovalMsg) Descriptor

func (*AddApprovalMsg) Descriptor() ([]byte, []int)

func (*AddApprovalMsg) GetAction

func (m *AddApprovalMsg) GetAction() string

func (*AddApprovalMsg) GetAddress

func (m *AddApprovalMsg) GetAddress() []byte

func (*AddApprovalMsg) GetID added in v0.10.0

func (m *AddApprovalMsg) GetID() []byte

func (*AddApprovalMsg) GetOptions

func (m *AddApprovalMsg) GetOptions() ApprovalOptions

func (*AddApprovalMsg) GetT

func (m *AddApprovalMsg) GetT() string

func (*AddApprovalMsg) Marshal

func (m *AddApprovalMsg) Marshal() (dAtA []byte, err error)

func (*AddApprovalMsg) MarshalTo

func (m *AddApprovalMsg) MarshalTo(dAtA []byte) (int, error)

func (*AddApprovalMsg) Path

func (*AddApprovalMsg) Path() string

func (*AddApprovalMsg) ProtoMessage

func (*AddApprovalMsg) ProtoMessage()

func (*AddApprovalMsg) Reset

func (m *AddApprovalMsg) Reset()

func (*AddApprovalMsg) Size

func (m *AddApprovalMsg) Size() (n int)

func (*AddApprovalMsg) String

func (m *AddApprovalMsg) String() string

func (*AddApprovalMsg) Unmarshal

func (m *AddApprovalMsg) Unmarshal(dAtA []byte) error

func (AddApprovalMsg) Validate

func (m AddApprovalMsg) Validate() error

type Approval

type Approval struct {
	Address []byte          `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Options ApprovalOptions `protobuf:"bytes,2,opt,name=options" json:"options"`
}

func (Approval) AsAddress

func (a Approval) AsAddress() weave.Address

func (Approval) Clone

func (m Approval) Clone() Approval

func (*Approval) Descriptor

func (*Approval) Descriptor() ([]byte, []int)

func (Approval) Equals

func (a Approval) Equals(o Approval) bool

func (*Approval) GetAddress

func (m *Approval) GetAddress() []byte

func (*Approval) GetOptions

func (m *Approval) GetOptions() ApprovalOptions

func (*Approval) Marshal

func (m *Approval) Marshal() (dAtA []byte, err error)

func (*Approval) MarshalTo

func (m *Approval) MarshalTo(dAtA []byte) (int, error)

func (*Approval) ProtoMessage

func (*Approval) ProtoMessage()

func (*Approval) Reset

func (m *Approval) Reset()

func (*Approval) Size

func (m *Approval) Size() (n int)

func (*Approval) String

func (m *Approval) String() string

func (*Approval) Unmarshal

func (m *Approval) Unmarshal(dAtA []byte) error

func (Approval) Validate

func (m Approval) Validate() error

type ApprovalMeta

type ApprovalMeta []Approval

func (ApprovalMeta) Clone

func (m ApprovalMeta) Clone() ApprovalMeta

func (ApprovalMeta) Validate

func (m ApprovalMeta) Validate() error

type ApprovalMsg

type ApprovalMsg interface {
	GetT() string
	Identified
}

type ApprovalOps

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

func NewApprovalOps

func NewApprovalOps(owner weave.Address, approvals *[]ActionApprovals) *ApprovalOps

TODO: Sort errors and their codes TODO: Figure out what we need to do with counts for the next iteration

func (*ApprovalOps) Grant

func (o *ApprovalOps) Grant(action string, to weave.Address, op ApprovalOptions, blockHeight int64, actionMaps ...map[string]int32) error

TODO: Figure out whether we need wildcard approvals, might be wise to add an ApprovalOptions flag

func (*ApprovalOps) List

func (o *ApprovalOps) List() Approvals

func (*ApprovalOps) Revoke

func (o *ApprovalOps) Revoke(action string, from weave.Address) error

type ApprovalOptions

type ApprovalOptions struct {
	UntilBlockHeight int64 `protobuf:"varint,1,opt,name=until_block_height,json=untilBlockHeight,proto3" json:"until_block_height,omitempty"`
	Count            int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
	Immutable        bool  `protobuf:"varint,3,opt,name=immutable,proto3" json:"immutable,omitempty"`
}

func (*ApprovalOptions) Descriptor

func (*ApprovalOptions) Descriptor() ([]byte, []int)

func (ApprovalOptions) Equals

func (a ApprovalOptions) Equals(o ApprovalOptions) bool

func (ApprovalOptions) EqualsAfterUse added in v0.9.1

func (a ApprovalOptions) EqualsAfterUse(used ApprovalOptions) bool

func (*ApprovalOptions) GetCount

func (m *ApprovalOptions) GetCount() int64

func (*ApprovalOptions) GetImmutable

func (m *ApprovalOptions) GetImmutable() bool

func (*ApprovalOptions) GetUntilBlockHeight

func (m *ApprovalOptions) GetUntilBlockHeight() int64

func (*ApprovalOptions) Marshal

func (m *ApprovalOptions) Marshal() (dAtA []byte, err error)

func (*ApprovalOptions) MarshalTo

func (m *ApprovalOptions) MarshalTo(dAtA []byte) (int, error)

func (*ApprovalOptions) ProtoMessage

func (*ApprovalOptions) ProtoMessage()

func (*ApprovalOptions) Reset

func (m *ApprovalOptions) Reset()

func (*ApprovalOptions) Size

func (m *ApprovalOptions) Size() (n int)

func (*ApprovalOptions) String

func (m *ApprovalOptions) String() string

func (*ApprovalOptions) Unmarshal

func (m *ApprovalOptions) Unmarshal(dAtA []byte) error

func (ApprovalOptions) Validate

func (a ApprovalOptions) Validate() error

type Approvals

type Approvals map[string]ApprovalMeta

func (Approvals) Add

func (m Approvals) Add(action string, approval Approval) Approvals

func (Approvals) AsPersistable

func (m Approvals) AsPersistable() []ActionApprovals

func (Approvals) Filter

func (m Approvals) Filter(obsolete Approvals) Approvals

func (Approvals) FilterExpired

func (m Approvals) FilterExpired(blockHeight int64) Approvals

func (Approvals) ForAction

func (m Approvals) ForAction(action string) Approvals

func (Approvals) ForAddress

func (m Approvals) ForAddress(addr weave.Address) Approvals

func (Approvals) Intersect added in v0.9.1

func (m Approvals) Intersect(others Approvals) Approvals

func (Approvals) IsEmpty

func (m Approvals) IsEmpty() bool

func (Approvals) MergeUsed added in v0.9.1

func (m Approvals) MergeUsed(used Approvals) Approvals

func (Approvals) MetaByAction

func (m Approvals) MetaByAction(action string) ApprovalMeta

func (Approvals) UseCount added in v0.9.1

func (m Approvals) UseCount() Approvals

func (Approvals) Validate

func (m Approvals) Validate(actionMaps ...map[string]int32) error

This requires all the model-specific actions to be passed here TODO: Not sure I'm a fan of array of maps, but it makes sense given we validate using protobuf enum value maps

type BaseNFT

type BaseNFT interface {
	Owned
	//GetId() []byte
	Approvals() *ApprovalOps
	//Set new approvals
	SetApprovals(Approvals)
}

type BucketAccess

type BucketAccess interface {
	Get(db weave.ReadOnlyKVStore, key []byte) (orm.Object, error)
	Save(db weave.KVStore, model orm.Object) error
}

TODO: Better name?

type BucketDispatcher

type BucketDispatcher interface {
	Register(t string, bucket BucketAccess) error
	AssertRegistered(types ...string)
	Get(t string) (BucketAccess, error)
}

func GetBucketDispatcher

func GetBucketDispatcher() BucketDispatcher

TODO: if we ever want to support concurrency here then we might be better of with a separate Init() method or similar

type Identified

type Identified interface {
	GetID() []byte
}

TODO: Better name

type NonFungibleToken

type NonFungibleToken struct {
	ID              []byte            `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Owner           []byte            `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"`
	ActionApprovals []ActionApprovals `protobuf:"bytes,3,rep,name=actionApprovals" json:"actionApprovals"`
}

func NewNonFungibleToken

func NewNonFungibleToken(key []byte, owner weave.Address, approvals []ActionApprovals) *NonFungibleToken

func (*NonFungibleToken) Approvals

func (m *NonFungibleToken) Approvals() *ApprovalOps

func (*NonFungibleToken) Clone

func (m *NonFungibleToken) Clone() *NonFungibleToken

func (*NonFungibleToken) Copy

func (*NonFungibleToken) Descriptor

func (*NonFungibleToken) Descriptor() ([]byte, []int)

func (*NonFungibleToken) GetActionApprovals

func (m *NonFungibleToken) GetActionApprovals() []ActionApprovals

func (*NonFungibleToken) GetID added in v0.10.0

func (m *NonFungibleToken) GetID() []byte

func (*NonFungibleToken) GetOwner

func (m *NonFungibleToken) GetOwner() []byte

func (*NonFungibleToken) HasApproval

func (m *NonFungibleToken) HasApproval(actor weave.Address, action string) bool

func (*NonFungibleToken) Marshal

func (m *NonFungibleToken) Marshal() (dAtA []byte, err error)

func (*NonFungibleToken) MarshalTo

func (m *NonFungibleToken) MarshalTo(dAtA []byte) (int, error)

func (*NonFungibleToken) OwnerAddress

func (u *NonFungibleToken) OwnerAddress() weave.Address

func (*NonFungibleToken) ProtoMessage

func (*NonFungibleToken) ProtoMessage()

func (*NonFungibleToken) Reset

func (m *NonFungibleToken) Reset()

func (*NonFungibleToken) SetApprovals added in v0.9.1

func (m *NonFungibleToken) SetApprovals(a Approvals)

func (*NonFungibleToken) Size

func (m *NonFungibleToken) Size() (n int)

func (*NonFungibleToken) String

func (m *NonFungibleToken) String() string

func (*NonFungibleToken) Unmarshal

func (m *NonFungibleToken) Unmarshal(dAtA []byte) error

func (*NonFungibleToken) Validate

func (m *NonFungibleToken) Validate() error

type Owned

type Owned interface {
	OwnerAddress() weave.Address
}

type RemoveApprovalMsg

type RemoveApprovalMsg struct {
	ID      []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Address []byte `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
	Action  string `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"`
	T       string `protobuf:"bytes,4,opt,name=t,proto3" json:"t,omitempty"`
}

func (*RemoveApprovalMsg) Descriptor

func (*RemoveApprovalMsg) Descriptor() ([]byte, []int)

func (*RemoveApprovalMsg) GetAction

func (m *RemoveApprovalMsg) GetAction() string

func (*RemoveApprovalMsg) GetAddress

func (m *RemoveApprovalMsg) GetAddress() []byte

func (*RemoveApprovalMsg) GetID added in v0.10.0

func (m *RemoveApprovalMsg) GetID() []byte

func (*RemoveApprovalMsg) GetT

func (m *RemoveApprovalMsg) GetT() string

func (*RemoveApprovalMsg) Marshal

func (m *RemoveApprovalMsg) Marshal() (dAtA []byte, err error)

func (*RemoveApprovalMsg) MarshalTo

func (m *RemoveApprovalMsg) MarshalTo(dAtA []byte) (int, error)

func (*RemoveApprovalMsg) Path

func (*RemoveApprovalMsg) Path() string

func (*RemoveApprovalMsg) ProtoMessage

func (*RemoveApprovalMsg) ProtoMessage()

func (*RemoveApprovalMsg) Reset

func (m *RemoveApprovalMsg) Reset()

func (*RemoveApprovalMsg) Size

func (m *RemoveApprovalMsg) Size() (n int)

func (*RemoveApprovalMsg) String

func (m *RemoveApprovalMsg) String() string

func (*RemoveApprovalMsg) Unmarshal

func (m *RemoveApprovalMsg) Unmarshal(dAtA []byte) error

func (RemoveApprovalMsg) Validate

func (m RemoveApprovalMsg) Validate() error

type Validation

type Validation struct {
}

func (*Validation) IsValidAction

func (*Validation) IsValidAction(action string) bool

func (*Validation) IsValidTokenID

func (*Validation) IsValidTokenID(id []byte) bool

Directories

Path Synopsis
Package blockchain is a generated protocol buffer package.
Package blockchain is a generated protocol buffer package.
Package bootstrap_node is a generated protocol buffer package.
Package bootstrap_node is a generated protocol buffer package.
Package ticker is a generated protocol buffer package.
Package ticker is a generated protocol buffer package.
Package username is a generated protocol buffer package.
Package username is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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