Documentation ¶
Index ¶
- func Drivers() []string
- func Register(name string, driver driver.Driver)
- type Envelope
- func (e *Envelope) Bytes() ([]byte, error)
- func (e *Envelope) Creator() []byte
- func (e *Envelope) FromBytes(raw []byte) error
- func (e *Envelope) MarshalJSON() ([]byte, error)
- func (e *Envelope) Nonce() []byte
- func (e *Envelope) Results() []byte
- func (e *Envelope) String() string
- func (e *Envelope) TxID() string
- func (e *Envelope) UnmarshalJSON(raw []byte) error
- type GetFunc
- type Ledger
- type LocalMembership
- type Network
- func (n *Network) AnonymousIdentity() view.Identity
- func (n *Network) AreTokensSpent(context view.Context, namespace string, IDs []string) ([]bool, error)
- func (n *Network) Broadcast(blob interface{}) error
- func (n *Network) Channel() string
- func (n *Network) ComputeTxID(id *TxID) string
- func (n *Network) ExistEnvelope(id string) bool
- func (n *Network) ExistTransient(id string) bool
- func (n *Network) FetchPublicParameters(namespace string) ([]byte, error)
- func (n *Network) GetEnrollmentID(raw []byte) (string, error)
- func (n *Network) GetRWSet(id string, results []byte) (*RWSet, error)
- func (n *Network) GetTransient(id string) (TransientMap, error)
- func (n *Network) IsFinal(ctx context.Context, id string) error
- func (n *Network) IsFinalForParties(id string, endpoints ...view.Identity) error
- func (n *Network) Ledger(namespace string) (*Ledger, error)
- func (n *Network) LocalMembership() *LocalMembership
- func (n *Network) LookupTransferMetadataKey(namespace, startingTxID, key string, timeout time.Duration, ...) ([]byte, error)
- func (n *Network) Name() string
- func (n *Network) NewEnvelope() *Envelope
- func (n *Network) QueryTokens(context view.Context, namespace string, IDs []*token2.ID) ([][]byte, error)
- func (n *Network) RequestApproval(context view.Context, tms *token.ManagementService, requestRaw []byte, ...) (*Envelope, error)
- func (n *Network) StoreEnvelope(id string, env []byte) error
- func (n *Network) StoreTransient(id string, transient TransientMap) error
- func (n *Network) SubscribeTxStatusChanges(txID string, listener TxStatusChangeListener) error
- func (n *Network) UnsubscribeTxStatusChanges(id string, listener TxStatusChangeListener) error
- func (n *Network) Vault(namespace string) (*Vault, error)
- type Provider
- type RWSet
- type TransientMap
- func (m TransientMap) Exists(key string) bool
- func (m TransientMap) Get(id string) []byte
- func (m TransientMap) GetState(key string, state interface{}) error
- func (m TransientMap) IsEmpty() bool
- func (m TransientMap) Set(key string, raw []byte) error
- func (m TransientMap) SetState(key string, state interface{}) error
- type TxID
- type TxStatusChangeListener
- type UnspentTokensIterator
- type ValidationCode
- type Vault
- func (v *Vault) DiscardTx(id string) error
- func (v *Vault) Exists(id *token2.ID) bool
- func (v *Vault) GetLastTxID() (string, error)
- func (v *Vault) ListUnspentTokens() (*token2.UnspentTokens, error)
- func (v *Vault) PruneInvalidUnspentTokens(context view.Context) ([]*token2.ID, error)
- func (v *Vault) Status(id string) (ValidationCode, error)
- func (v *Vault) Store(certifications map[*token2.ID][]byte) error
- func (v *Vault) TokenVault() *vault.Vault
- func (v *Vault) UnspentTokensIterator() (UnspentTokensIterator, error)
- func (v *Vault) UnspentTokensIteratorBy(id, typ string) (UnspentTokensIterator, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Envelope ¶
type Envelope struct {
// contains filtered or unexported fields
}
func (*Envelope) MarshalJSON ¶
func (*Envelope) UnmarshalJSON ¶
type LocalMembership ¶
type LocalMembership struct {
// contains filtered or unexported fields
}
func (*LocalMembership) AnonymousIdentity ¶
func (l *LocalMembership) AnonymousIdentity() view.Identity
func (*LocalMembership) DefaultIdentity ¶
func (l *LocalMembership) DefaultIdentity() view.Identity
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network provides access to the remote network
func GetInstance ¶
func GetInstance(sp view2.ServiceProvider, network, channel string) *Network
GetInstance returns a network instance for the given network and channel
func (*Network) AnonymousIdentity ¶
AnonymousIdentity returns a fresh anonymous identity
func (*Network) AreTokensSpent ¶
func (n *Network) AreTokensSpent(context view.Context, namespace string, IDs []string) ([]bool, error)
AreTokensSpent retrieves the spent flag for the passed ids
func (*Network) ComputeTxID ¶
ComputeTxID computes the transaction ID in the target network format for the given tx id
func (*Network) ExistEnvelope ¶
func (*Network) ExistTransient ¶
func (*Network) FetchPublicParameters ¶
FetchPublicParameters returns the public parameters for the given namespace
func (*Network) GetEnrollmentID ¶
GetEnrollmentID returns the enrollment ID bound to the passed marshalled audit info
func (*Network) GetRWSet ¶
GetRWSet returns the read-write set unmarshalled from the given bytes and bound to the given id
func (*Network) GetTransient ¶
func (n *Network) GetTransient(id string) (TransientMap, error)
GetTransient retrieves the transient map bound to the passed id
func (*Network) IsFinalForParties ¶
IsFinalForParties returns true if the given transaction is final for the given parties
func (*Network) LocalMembership ¶
func (n *Network) LocalMembership() *LocalMembership
LocalMembership returns the local membership for this network
func (*Network) LookupTransferMetadataKey ¶
func (n *Network) LookupTransferMetadataKey(namespace, startingTxID, key string, timeout time.Duration, opts ...token.ServiceOption) ([]byte, error)
LookupTransferMetadataKey searches for a transfer metadata key containing the passed sub-key starting from the passed transaction id in the given namespace. The operation gets canceled if the passed timeout gets reached.
func (*Network) NewEnvelope ¶
NewEnvelope creates a new envelope
func (*Network) QueryTokens ¶
func (n *Network) QueryTokens(context view.Context, namespace string, IDs []*token2.ID) ([][]byte, error)
QueryTokens returns the tokens corresponding to the given token ids int the given namespace
func (*Network) RequestApproval ¶
func (n *Network) RequestApproval(context view.Context, tms *token.ManagementService, requestRaw []byte, signer view.Identity, txID TxID) (*Envelope, error)
RequestApproval requests approval for the given token request
func (*Network) StoreEnvelope ¶
StoreEnvelope stores locally the given transaction envelope and associated it with the given id
func (*Network) StoreTransient ¶
func (n *Network) StoreTransient(id string, transient TransientMap) error
StoreTransient stores locally the given transient data and associated it with the given id
func (*Network) SubscribeTxStatusChanges ¶
func (n *Network) SubscribeTxStatusChanges(txID string, listener TxStatusChangeListener) error
SubscribeTxStatusChanges register a listener for transaction status updates for the given id.
func (*Network) UnsubscribeTxStatusChanges ¶
func (n *Network) UnsubscribeTxStatusChanges(id string, listener TxStatusChangeListener) error
UnsubscribeTxStatusChanges unregisters a listener for transaction status changes for the passed id
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider returns an instance of network provider
func NewProvider ¶
func NewProvider(sp view2.ServiceProvider) *Provider
NewProvider returns a new instance of network provider
type TransientMap ¶
func (TransientMap) Exists ¶
func (m TransientMap) Exists(key string) bool
func (TransientMap) Get ¶
func (m TransientMap) Get(id string) []byte
func (TransientMap) GetState ¶
func (m TransientMap) GetState(key string, state interface{}) error
func (TransientMap) IsEmpty ¶
func (m TransientMap) IsEmpty() bool
func (TransientMap) SetState ¶
func (m TransientMap) SetState(key string, state interface{}) error
type TxStatusChangeListener ¶
type TxStatusChangeListener interface { // OnStatusChange is called when the status of a transaction changes OnStatusChange(txID string, status int) error }
TxStatusChangeListener is the interface that must be implemented to receive transaction status change notifications
type UnspentTokensIterator ¶
type UnspentTokensIterator = driver.UnspentTokensIterator
type ValidationCode ¶
type ValidationCode int
const ( Valid ValidationCode // Transaction is valid and committed Invalid // Transaction is invalid and has been discarded Busy // Transaction does not yet have a validity state Unknown // Transaction is unknown HasDependencies // Transaction is unknown but has known dependencies )
type Vault ¶
type Vault struct {
// contains filtered or unexported fields
}
func (*Vault) GetLastTxID ¶
func (*Vault) ListUnspentTokens ¶
func (v *Vault) ListUnspentTokens() (*token2.UnspentTokens, error)
func (*Vault) PruneInvalidUnspentTokens ¶
PruneInvalidUnspentTokens checks that each unspent token is actually available on the ledger. Those that are not available are deleted. The function returns the list of deleted token ids
func (*Vault) TokenVault ¶
func (*Vault) UnspentTokensIterator ¶
func (v *Vault) UnspentTokensIterator() (UnspentTokensIterator, error)
func (*Vault) UnspentTokensIteratorBy ¶
func (v *Vault) UnspentTokensIteratorBy(id, typ string) (UnspentTokensIterator, error)