plain

package
v0.0.0-...-c90c782 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TokenInputSpentMarker = []byte{1}

Functions

func GenerateKeyForTest

func GenerateKeyForTest(txID string, index int) (string, error)

GenerateKeyForTest is here only for testing purposes, to be removed later.

Types

type HistoryIterator

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

HistoryIterator is an iterator for iterating through the transaction history.

func (*HistoryIterator) Next

Next gets the next transaction from the history, or io.EOF if there are no more transactions.

type Issuer

type Issuer struct{}

An Issuer that can import new tokens

func (*Issuer) RequestExpectation

func (i *Issuer) RequestExpectation(request *token.ExpectationRequest) (*token.TokenTransaction, error)

RequestExpectation allows indirect import based on the expectation. It creates a token transaction with the outputs as specified in the expectation.

func (*Issuer) RequestImport

func (i *Issuer) RequestImport(tokensToIssue []*token.TokenToIssue) (*token.TokenTransaction, error)

RequestImport creates an import request with the token owners, types, and quantities specified in tokensToIssue.

type Manager

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

Manager is used to access TMS components.

func (*Manager) GetTxProcessor

func (m *Manager) GetTxProcessor(channel string) (transaction.TMSTxProcessor, error)

GetTxProcessor returns a TMSTxProcessor that is used to process token transactions.

func (*Manager) SetPolicyValidator

func (m *Manager) SetPolicyValidator(channel string, validator identity.IssuingValidator)

SetPolicyValidator sets the policy validator for the specified channel

type MemoryLedger

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

A MemoryLedger is an in-memory ledger of transactions and unspent outputs. This implementation is only meant for testing.

func NewMemoryLedger

func NewMemoryLedger() *MemoryLedger

NewMemoryLedger creates a new MemoryLedger

func (*MemoryLedger) Done

func (p *MemoryLedger) Done()

Done releases resources occupied by the MemoryLedger

func (*MemoryLedger) GetState

func (p *MemoryLedger) GetState(namespace string, key string) ([]byte, error)

GetState gets the value for given namespace and Key. For a chaincode, the namespace corresponds to the chaincodeID

func (*MemoryLedger) GetStateRangeScanIterator

func (p *MemoryLedger) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (ledger.ResultsIterator, error)

GetStateRangeScanIterator gets the values for a given namespace that lie in an interval determined by startKey and endKey. this is a mock function.

func (*MemoryLedger) SetState

func (p *MemoryLedger) SetState(namespace string, key string, value []byte) error

SetState sets the given value for the given namespace and Key. For a chaincode, the namespace corresponds to the chaincodeID

type MemoryPool

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

A MemoryPool is an in-memory ledger of transactions and unspent outputs. This implementation is only meant for testing.

func NewMemoryPool

func NewMemoryPool() *MemoryPool

NewMemoryPool creates a new MemoryPool

func (*MemoryPool) CommitUpdate

func (p *MemoryPool) CommitUpdate(transactionData []tms.TransactionData) error

CommitUpdate commits transaction data into the pool.

func (*MemoryPool) HistoryIterator

func (p *MemoryPool) HistoryIterator() *HistoryIterator

HistoryIterator creates a new HistoryIterator for iterating through the transaction history.

func (*MemoryPool) Iterator

func (p *MemoryPool) Iterator() *PoolIterator

Iterator returns an iterator of the unspent outputs based on a copy of the pool.

func (*MemoryPool) OutputByID

func (p *MemoryPool) OutputByID(id string) (*token.PlainOutput, error)

OutputByID gets an output by its ID.

func (*MemoryPool) TxByID

func (p *MemoryPool) TxByID(txID string) (*token.TokenTransaction, error)

TxByID gets a transaction by its transaction ID. If no transaction exists with the given ID, a TxNotFoundError is returned.

type OutputNotFoundError

type OutputNotFoundError struct {
	ID string
}

OutputNotFoundError is returned when an entry was not found in the pool.

func (*OutputNotFoundError) Error

func (o *OutputNotFoundError) Error() string

type PoolIterator

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

PoolIterator is an iterator for iterating through the items in the pool.

func (*PoolIterator) Next

func (it *PoolIterator) Next() (string, *token.PlainOutput, error)

Next gets the next output from the pool, or io.EOF if there are no more outputs.

type Transactor

type Transactor struct {
	PublicCredential []byte
	Ledger           ledger.LedgerReader
}

A Transactor that can transfer tokens.

func (*Transactor) Done

func (t *Transactor) Done()

Done releases any resources held by this transactor

func (*Transactor) ListTokens

func (t *Transactor) ListTokens() (*token.UnspentTokens, error)

ListTokens creates a TokenTransaction that lists the unspent tokens owned by owner.

func (*Transactor) RequestApprove

func (t *Transactor) RequestApprove(request *token.ApproveRequest) (*token.TokenTransaction, error)

func (*Transactor) RequestExpectation

func (t *Transactor) RequestExpectation(request *token.ExpectationRequest) (*token.TokenTransaction, error)

RequestExpectation allows indirect transfer based on the expectation. It creates a token transaction based on the outputs as specified in the expectation.

func (*Transactor) RequestRedeem

func (t *Transactor) RequestRedeem(request *token.RedeemRequest) (*token.TokenTransaction, error)

RequestRedeem creates a TokenTransaction of type redeem request

func (*Transactor) RequestTransfer

func (t *Transactor) RequestTransfer(request *token.TransferRequest) (*token.TokenTransaction, error)

RequestTransfer creates a TokenTransaction of type transfer request func (t *Transactor) RequestTransfer(inTokens []*token.InputId, tokensToTransfer []*token.RecipientTransferShare) (*token.TokenTransaction, error) {

func (*Transactor) RequestTransferFrom

func (t *Transactor) RequestTransferFrom(request *token.TransferRequest) (*token.TokenTransaction, error)

type TxNotFoundError

type TxNotFoundError struct {
	TxID string
}

TxNotFoundError is returned when a transaction was not found in the pool.

func (*TxNotFoundError) Error

func (p *TxNotFoundError) Error() string

type Verifier

type Verifier struct {
	IssuingValidator identity.IssuingValidator
}

A Verifier validates and commits token transactions.

func (*Verifier) ProcessTx

func (v *Verifier) ProcessTx(txID string, creator identity.PublicInfo, ttx *token.TokenTransaction, simulator ledger.LedgerWriter) error

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

Jump to

Keyboard shortcuts

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