blockchain

package
v0.11.2 Latest Latest
Warning

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

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

Documentation

Overview

Package blockchain is a generated protocol buffer package.

It is generated from these files:
	cmd/bnsd/x/nft/blockchain/codec.proto

It has these top-level messages:
	BlockchainToken
	TokenDetails
	Chain
	IOV
	Config
	IssueTokenMsg

Package blockchain provides an NFT implementation for registering blochchains together with their configuration.

Index

Constants

View Source
const (
	BucketName = "bchnft"
)

Variables

View Source
var (
	ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCodec   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	//todo: revisit pattern
	IsValidCodec = regexp.MustCompile(`^[a-zA-Z0-9_.]{3,20}$`).MatchString
)
View Source
var (
	//todo: revisit pattern
	IsValidID = regexp.MustCompile(`^[a-zA-Z0-9_.-]{4,128}$`).MatchString
)

Functions

func NewBlockchainToken

func NewBlockchainToken(key []byte, owner weave.Address, approvals []nft.ActionApprovals) *orm.SimpleObj

func RegisterQuery

func RegisterQuery(qr weave.QueryRouter)

RegisterQuery will register this bucket as "/nft/blockchain"

func RegisterRoutes

func RegisterRoutes(r weave.Registry, auth x.Authenticator, issuer weave.Address, tickerBucket orm.Reader)

RegisterRoutes will instantiate and register all handlers in this package

Types

type BlockchainToken

type BlockchainToken struct {
	Base    *nft.NonFungibleToken `protobuf:"bytes,1,opt,name=base" json:"base,omitempty"`
	Details *TokenDetails         `protobuf:"bytes,2,opt,name=details" json:"details,omitempty"`
}

func (*BlockchainToken) Approvals

func (m *BlockchainToken) Approvals() *nft.ApprovalOps

func (*BlockchainToken) Copy

func (m *BlockchainToken) Copy() orm.CloneableData

func (*BlockchainToken) Descriptor

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

func (*BlockchainToken) GetBase

func (m *BlockchainToken) GetBase() *nft.NonFungibleToken

func (*BlockchainToken) GetChain

func (m *BlockchainToken) GetChain() Chain

func (*BlockchainToken) GetDetails

func (m *BlockchainToken) GetDetails() *TokenDetails

func (*BlockchainToken) GetIov

func (m *BlockchainToken) GetIov() IOV

func (*BlockchainToken) Marshal

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

func (*BlockchainToken) MarshalTo

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

func (*BlockchainToken) OwnerAddress

func (m *BlockchainToken) OwnerAddress() weave.Address

func (*BlockchainToken) ProtoMessage

func (*BlockchainToken) ProtoMessage()

func (*BlockchainToken) Reset

func (m *BlockchainToken) Reset()

func (*BlockchainToken) SetApprovals

func (m *BlockchainToken) SetApprovals(a nft.Approvals)

func (*BlockchainToken) SetChain

func (m *BlockchainToken) SetChain(actor weave.Address, chain Chain) error

func (*BlockchainToken) SetIov

func (m *BlockchainToken) SetIov(actor weave.Address, iov IOV) error

func (*BlockchainToken) Size

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

func (*BlockchainToken) String

func (m *BlockchainToken) String() string

func (*BlockchainToken) Transfer

func (m *BlockchainToken) Transfer(newOwner weave.Address) error

func (*BlockchainToken) Unmarshal

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

func (*BlockchainToken) Validate

func (m *BlockchainToken) Validate() error

type Bucket

type Bucket struct {
	orm.Bucket
}

func NewBucket

func NewBucket() Bucket

func (Bucket) Create

func (b Bucket) Create(db weave.KVStore, owner weave.Address, id []byte, approvals []nft.ActionApprovals, chain Chain, iov IOV) (orm.Object, error)

type Chain

type Chain struct {
	// Chain ID is the blockchain ID as referred in our system.
	ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	// Network ID can be used by a blockchain implementation to distinguish
	// between different instances of the same implementation. This value might
	// be called chain ID in other places.
	//
	// https://ethereum.stackexchange.com/questions/17051/how-to-select-a-network-id-or-is-there-a-list-of-network-ids
	NetworkID string `protobuf:"bytes,2,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"`
	// Name holds human redable name of the blockchain.
	Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	// Enabled is a flag used for soft delete.
	Enabled    bool `protobuf:"varint,4,opt,name=enabled,proto3" json:"enabled,omitempty"`
	Production bool `protobuf:"varint,5,opt,name=production,proto3" json:"production,omitempty"`
	// Main ticker ID links to the ticker (see ticker module) that is
	// considered the main ticker for given blockchain. A blockchain can have
	// any number of tickers registered.
	MainTickerID []byte `protobuf:"bytes,6,opt,name=main_ticker_id,json=mainTickerId,proto3" json:"main_ticker_id,omitempty"`
}

Chain represents a blockchain information.

Name chain is used instead of blockchain to not repeat the same word everywhere.

func (*Chain) Descriptor

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

func (*Chain) GetChainID

func (m *Chain) GetChainID() string

func (*Chain) GetEnabled

func (m *Chain) GetEnabled() bool

func (*Chain) GetMainTickerID

func (m *Chain) GetMainTickerID() []byte

func (*Chain) GetName

func (m *Chain) GetName() string

func (*Chain) GetNetworkID

func (m *Chain) GetNetworkID() string

func (*Chain) GetProduction

func (m *Chain) GetProduction() bool

func (*Chain) Marshal

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

func (*Chain) MarshalTo

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

func (*Chain) ProtoMessage

func (*Chain) ProtoMessage()

func (*Chain) Reset

func (m *Chain) Reset()

func (*Chain) Size

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

func (*Chain) String

func (m *Chain) String() string

func (*Chain) Unmarshal

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

func (Chain) Validate

func (m Chain) Validate() error

type Config

type Config struct {
	Chain       *Chain `protobuf:"bytes,1,opt,name=chain" json:"chain,omitempty"`
	CodecConfig string `protobuf:"bytes,3,opt,name=codec_config,json=codecConfig,proto3" json:"codec_config,omitempty"`
}

func (*Config) Descriptor

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

func (*Config) GetChain

func (m *Config) GetChain() *Chain

func (*Config) GetCodecConfig

func (m *Config) GetCodecConfig() string

func (*Config) Marshal

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

func (*Config) MarshalTo

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

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (m *Config) Reset()

func (*Config) Size

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

func (*Config) String

func (m *Config) String() string

func (*Config) Unmarshal

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

type IOV

type IOV struct {
	Codec       string `protobuf:"bytes,1,opt,name=codec,proto3" json:"codec,omitempty"`
	CodecConfig string `protobuf:"bytes,2,opt,name=codec_config,json=codecConfig,proto3" json:"codec_config,omitempty"`
}

func (*IOV) Descriptor

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

func (*IOV) GetCodec

func (m *IOV) GetCodec() string

func (*IOV) GetCodecConfig

func (m *IOV) GetCodecConfig() string

func (*IOV) Marshal

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

func (*IOV) MarshalTo

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

func (*IOV) ProtoMessage

func (*IOV) ProtoMessage()

func (*IOV) Reset

func (m *IOV) Reset()

func (*IOV) Size

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

func (*IOV) String

func (m *IOV) String() string

func (*IOV) Unmarshal

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

func (IOV) Validate

func (m IOV) Validate() error

type Initializer

type Initializer struct {
}

Initializer fulfils the InitStater interface to load data from the genesis file

func (*Initializer) FromGenesis

func (i *Initializer) FromGenesis(opts weave.Options, db weave.KVStore) error

FromGenesis will parse initial tokens information from the genesis and persist it in the database.

type IssueHandler

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

func NewIssueHandler

func NewIssueHandler(auth x.Authenticator, issuer weave.Address, bucket Bucket, tickerBucket orm.Reader) *IssueHandler

func (IssueHandler) Check

func (h IssueHandler) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.CheckResult, error)

func (IssueHandler) Deliver

func (h IssueHandler) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.DeliverResult, error)

type IssueTokenMsg

type IssueTokenMsg struct {
	Owner     []byte                `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
	ID        []byte                `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	Details   TokenDetails          `protobuf:"bytes,3,opt,name=details" json:"details"`
	Approvals []nft.ActionApprovals `protobuf:"bytes,4,rep,name=approvals" json:"approvals"`
}

func (*IssueTokenMsg) Descriptor

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

func (*IssueTokenMsg) GetApprovals

func (m *IssueTokenMsg) GetApprovals() []nft.ActionApprovals

func (*IssueTokenMsg) GetDetails

func (m *IssueTokenMsg) GetDetails() TokenDetails

func (*IssueTokenMsg) GetID

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

func (*IssueTokenMsg) GetOwner

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

func (*IssueTokenMsg) Marshal

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

func (*IssueTokenMsg) MarshalTo

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

func (*IssueTokenMsg) Path

func (*IssueTokenMsg) Path() string

Path returns the routing path for this message

func (*IssueTokenMsg) ProtoMessage

func (*IssueTokenMsg) ProtoMessage()

func (*IssueTokenMsg) Reset

func (m *IssueTokenMsg) Reset()

func (*IssueTokenMsg) Size

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

func (*IssueTokenMsg) String

func (m *IssueTokenMsg) String() string

func (*IssueTokenMsg) Unmarshal

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

func (*IssueTokenMsg) Validate

func (i *IssueTokenMsg) Validate() error

type Token

type Token interface {
	nft.BaseNFT
	GetChain() Chain
	GetIov() IOV
	SetChain(actor weave.Address, chain Chain) error
	SetIov(actor weave.Address, iov IOV) error
}

func AsBlockchain

func AsBlockchain(obj orm.Object) (Token, error)

AsUsername will safely type-cast any value from Bucket

type TokenDetails

type TokenDetails struct {
	Chain Chain `protobuf:"bytes,1,opt,name=chain" json:"chain"`
	Iov   IOV   `protobuf:"bytes,2,opt,name=iov" json:"iov"`
}

func (*TokenDetails) Clone

func (m *TokenDetails) Clone() *TokenDetails

func (*TokenDetails) Descriptor

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

func (*TokenDetails) GetChain

func (m *TokenDetails) GetChain() Chain

func (*TokenDetails) GetIov

func (m *TokenDetails) GetIov() IOV

func (*TokenDetails) Marshal

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

func (*TokenDetails) MarshalTo

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

func (*TokenDetails) ProtoMessage

func (*TokenDetails) ProtoMessage()

func (*TokenDetails) Reset

func (m *TokenDetails) Reset()

func (*TokenDetails) Size

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

func (*TokenDetails) String

func (m *TokenDetails) String() string

func (*TokenDetails) Unmarshal

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

func (*TokenDetails) Validate

func (m *TokenDetails) Validate() error

Jump to

Keyboard shortcuts

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