translator

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IssueAction

type IssueAction interface {
	Serialize() ([]byte, error)
	NumOutputs() int
	GetSerializedOutputs() ([][]byte, error)
	IsAnonymous() bool
	GetIssuer() []byte
	GetMetadata() map[string][]byte
}

type IssuingValidator

type IssuingValidator interface {
	// Validate returns no error if the passed creator can issue tokens of the passed type,, an error otherwise.
	Validate(creator view.Identity, tokenType string) error
}

IssuingValidator is used to establish if the creator can issue tokens of the passed type.

type RWSet

type RWSet interface {
	driver.RWSet
}

RWSet interface, used to read from, and write to, a rwset.

type SetupAction

type SetupAction interface {
	GetSetupParameters() ([]byte, error)
}

type TransferAction

type TransferAction interface {
	// Serialize returns the serialized version of the action
	Serialize() ([]byte, error)
	// NumOutputs returns the number of outputs of the action
	NumOutputs() int
	// GetSerializedOutputs returns the serialized outputs of the action
	GetSerializedOutputs() ([][]byte, error)
	// IsRedeemAt returns true if the output is a redeem output at the passed index
	IsRedeemAt(index int) bool
	// SerializeOutputAt returns the serialized output at the passed index
	SerializeOutputAt(index int) ([]byte, error)
	// GetInputs returns the identifiers of the inputs in the action.
	GetInputs() ([]string, error)
	// IsGraphHiding returns true if the action is graph hiding
	IsGraphHiding() bool
	// GetMetadata returns the action's metadata
	GetMetadata() map[string][]byte
}

TransferAction is the action used to transfer tokens

type Translator

type Translator struct {
	RWSet RWSet
	TxID  string
	// SpentIDs the spent IDs added so far
	SpentIDs []string
	// contains filtered or unexported fields
}

Translator validates token requests and generates the corresponding RWSets

func New

func New(txID string, rwSet RWSet, namespace string) *Translator

func (*Translator) AreTokensSpent

func (w *Translator) AreTokensSpent(id []string, graphHiding bool) ([]bool, error)

func (*Translator) CommitTokenRequest

func (w *Translator) CommitTokenRequest(raw []byte, storeHash bool) error

func (*Translator) GetTransferMetadataSubKey

func (w *Translator) GetTransferMetadataSubKey(k string) (string, error)

func (*Translator) QueryTokens

func (w *Translator) QueryTokens(ids []*token.ID) ([][]byte, error)

func (*Translator) ReadSetupParameters

func (w *Translator) ReadSetupParameters() ([]byte, error)

func (*Translator) ReadTokenRequest

func (w *Translator) ReadTokenRequest() ([]byte, error)

func (*Translator) Write

func (w *Translator) Write(action interface{}) error

Write checks that transactions are correct wrt. the most recent rwset state. Write checks are ones that shall be done sequentially, since transactions within a block may introduce dependencies.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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