asset

package
v0.0.0-...-414a959 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2017 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package asset maintains a registry of all assets on a blockchain.

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")

Functions

This section is empty.

Types

type Asset

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

func (*Asset) SerializedDefinition

func (asset *Asset) SerializedDefinition() ([]byte, 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 pg.DB, chain *protocol.Chain, pinStore *pin.Store) *Registry

func (*Registry) AnnotateTxs

func (reg *Registry) AnnotateTxs(ctx context.Context, txs []map[string]interface{}) error

func (*Registry) DecodeIssueAction

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

func (*Registry) Define

func (reg *Registry) Define(ctx context.Context, xpubs []string, 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)

FindByAlias retrieves an Asset record along with its signer, given an asset alias.

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) ProcessBlocks

func (reg *Registry) ProcessBlocks(ctx context.Context)

type Saver

type Saver interface {
	SaveAnnotatedAsset(context.Context, bc.AssetID, map[string]interface{}, 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