var TokenInputSpentMarker = []byte{1}
func GenerateKeyForTest(txID string, index int) (string, error)
GenerateKeyForTest is here only for testing purposes, to be removed later.
HistoryIterator is an iterator for iterating through the transaction history.
type HistoryIterator struct {
// contains filtered or unexported fields
}
func (it *HistoryIterator) Next() (string, *token.TokenTransaction, error)
Next gets the next transaction from the history, or io.EOF if there are no more transactions.
An Issuer that can import new tokens
type Issuer struct{}
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 (i *Issuer) RequestImport(tokensToIssue []*token.TokenToIssue) (*token.TokenTransaction, error)
RequestImport creates an import request with the token owners, types, and quantities specified in tokensToIssue.
Manager is used to access TMS components.
type Manager struct {
// contains filtered or unexported fields
}
func (m *Manager) GetTxProcessor(channel string) (transaction.TMSTxProcessor, error)
GetTxProcessor returns a TMSTxProcessor that is used to process token transactions.
func (m *Manager) SetPolicyValidator(channel string, validator identity.IssuingValidator)
SetPolicyValidator sets the policy validator for the specified channel
A MemoryLedger is an in-memory ledger of transactions and unspent outputs. This implementation is only meant for testing.
type MemoryLedger struct {
// contains filtered or unexported fields
}
func NewMemoryLedger() *MemoryLedger
NewMemoryLedger creates a new MemoryLedger
func (p *MemoryLedger) Done()
Done releases resources occupied by the MemoryLedger
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 (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 (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
A MemoryPool is an in-memory ledger of transactions and unspent outputs. This implementation is only meant for testing.
type MemoryPool struct {
// contains filtered or unexported fields
}
func NewMemoryPool() *MemoryPool
NewMemoryPool creates a new MemoryPool
func (p *MemoryPool) CommitUpdate(transactionData []tms.TransactionData) error
CommitUpdate commits transaction data into the pool.
func (p *MemoryPool) HistoryIterator() *HistoryIterator
HistoryIterator creates a new HistoryIterator for iterating through the transaction history.
func (p *MemoryPool) Iterator() *PoolIterator
Iterator returns an iterator of the unspent outputs based on a copy of the pool.
func (p *MemoryPool) OutputByID(id string) (*token.PlainOutput, error)
OutputByID gets an output by its ID.
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.
OutputNotFoundError is returned when an entry was not found in the pool.
type OutputNotFoundError struct { ID string }
func (o *OutputNotFoundError) Error() string
PoolIterator is an iterator for iterating through the items in the pool.
type PoolIterator struct {
// contains filtered or unexported fields
}
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.
A Transactor that can transfer tokens.
type Transactor struct { PublicCredential []byte Ledger ledger.LedgerReader }
func (t *Transactor) Done()
Done releases any resources held by this transactor
func (t *Transactor) ListTokens() (*token.UnspentTokens, error)
ListTokens creates a TokenTransaction that lists the unspent tokens owned by owner.
func (t *Transactor) RequestApprove(request *token.ApproveRequest) (*token.TokenTransaction, error)
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 (t *Transactor) RequestRedeem(request *token.RedeemRequest) (*token.TokenTransaction, error)
RequestRedeem creates a TokenTransaction of type redeem request
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 (t *Transactor) RequestTransferFrom(request *token.TransferRequest) (*token.TokenTransaction, error)
TxNotFoundError is returned when a transaction was not found in the pool.
type TxNotFoundError struct { TxID string }
func (p *TxNotFoundError) Error() string
A Verifier validates and commits token transactions.
type Verifier struct { IssuingValidator identity.IssuingValidator }
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.