asset

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2017 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const PinName = "asset"

PinName is used to identify the pin associated with the asset block processor.

Variables

View Source
var (
	ErrDuplicateAlias = errors.New("duplicate asset alias")
	ErrBadIdentifier  = errors.New("either ID or alias must be specified, and not both")
)

Functions

func Annotated

func Annotated(a *Asset) (*query.AnnotatedAsset, error)

Types

type Asset

type Asset struct {
	AssetID          bc.AssetID
	Alias            *string
	VMVersion        uint64
	IssuanceProgram  []byte
	InitialBlockHash bc.Hash
	*signers.Signer
	Tags           map[string]interface{}
	RawDefinition1 []byte
	// contains filtered or unexported fields
}

func (*Asset) Definition

func (asset *Asset) Definition() (map[string]interface{}, error)

func (*Asset) RawDefinition

func (asset *Asset) RawDefinition() []byte

func (*Asset) SetDefinition

func (asset *Asset) SetDefinition(def map[string]interface{}) error

type Registry

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

Registry tracks and stores all known assets on a blockchain.

func NewRegistry

func NewRegistry(db dbm.DB, chain *protocol.Chain) *Registry

func (*Registry) AnnotateTxs

func (reg *Registry) AnnotateTxs(ctx context.Context, txs []*query.AnnotatedTx) error

func (*Registry) DecodeIssueAction

func (reg *Registry) DecodeIssueAction(data []byte) (txbuilder.Action, error)

func (*Registry) Define

func (reg *Registry) Define(ctx context.Context, xpubs []chainkd.XPub, quorum int, definition map[string]interface{}, alias string, tags map[string]interface{}, clientToken string) (*Asset, error)

Define defines a new Asset.

func (*Registry) FindByAlias

func (reg *Registry) FindByAlias(ctx context.Context, alias string) (*Asset, error)

func (*Registry) IndexAssets

func (reg *Registry) IndexAssets(indexer Saver)

func (*Registry) NewIssueAction

func (reg *Registry) NewIssueAction(assetAmount bc.AssetAmount, referenceData chainjson.Map) txbuilder.Action

func (*Registry) QueryAll

func (reg *Registry) QueryAll(ctx context.Context) (interface{}, error)

func (*Registry) UpdateTags

func (reg *Registry) UpdateTags(ctx context.Context, id, alias *string, tags map[string]interface{}) error

type Saver

type Saver interface {
	SaveAnnotatedAsset(context.Context, *query.AnnotatedAsset, string) error
}

A Saver is responsible for saving an annotated asset object for indexing and retrieval. If the Core is configured not to provide search services, SaveAnnotatedAsset can be a no-op.

Jump to

Keyboard shortcuts

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