Documentation
¶
Index ¶
- Constants
- type Envelope
- type FinalityListener
- type GetFunc
- type Ledger
- type LocalMembership
- type Network
- func (n *Network) AddFinalityListener(namespace string, txID string, listener FinalityListener) error
- func (n *Network) AnonymousIdentity() (view.Identity, error)
- func (n *Network) AreTokensSpent(ctx context.Context, namespace string, tokenIDs []*token2.ID, meta []string) ([]bool, error)
- func (n *Network) Broadcast(ctx context.Context, blob any) error
- func (n *Network) Channel() string
- func (n *Network) ComputeTxID(id *TxID) string
- func (n *Network) Connect(ns string) ([]token.ServiceOption, error)
- func (n *Network) FetchPublicParameters(namespace string) ([]byte, error)
- func (n *Network) GetTransactionStatus(ctx context.Context, namespace, txID string) (status int, tokenRequestHash []byte, message string, err error)
- func (n *Network) Ledger() (*Ledger, error)
- func (n *Network) LocalMembership() *LocalMembership
- func (n *Network) LookupTransferMetadataKey(namespace, key string, timeout time.Duration, opts ...token.ServiceOption) ([]byte, error)
- func (n *Network) Name() string
- func (n *Network) NewEnvelope() *Envelope
- func (n *Network) Normalize(opt *token.ServiceOptions) (*token.ServiceOptions, error)
- func (n *Network) QueryTokens(ctx context.Context, namespace string, IDs []*token2.ID) ([][]byte, error)
- func (n *Network) RequestApproval(context view.Context, tms *token.ManagementService, requestRaw []byte, ...) (*Envelope, error)
- type Provider
- type TransientMap
- func (m TransientMap) Exists(key string) bool
- func (m TransientMap) Get(id string) []byte
- func (m TransientMap) GetState(key string, state any) error
- func (m TransientMap) IsEmpty() bool
- func (m TransientMap) Set(key string, raw []byte) error
- func (m TransientMap) SetState(key string, state any) error
- type TxID
- type ValidationCode
Constants ¶
const ( Valid = driver.Valid // Valid indicates the transaction is valid and committed. Invalid = driver.Invalid // Invalid indicates the transaction is invalid and has been discarded. Busy = driver.Busy // Busy indicates the transaction is still being processed. Unknown = driver.Unknown // Unknown indicates the transaction state is not known. )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope struct {
// contains filtered or unexported fields
}
Envelope wraps a ledger-specific transaction envelope.
func (*Envelope) MarshalJSON ¶
MarshalJSON provides custom JSON marshaling for the envelope.
func (*Envelope) UnmarshalJSON ¶
UnmarshalJSON provides custom JSON unmarshaling for the envelope.
type FinalityListener ¶
type FinalityListener interface {
// OnStatus is called when the status of a transaction changes.
OnStatus(ctx context.Context, txID string, status int, message string, tokenRequestHash []byte)
// OnError is called when the finality event cannot be delivered after all retries are exhausted
OnError(ctx context.Context, txID string, err error)
}
FinalityListener defines the interface for receiving notifications when a transaction's status changes on the ledger.
type Ledger ¶
type Ledger struct {
// contains filtered or unexported fields
}
Ledger provides high-level access to the distributed ledger for status checks and state queries.
func (*Ledger) GetStates ¶
GetStates returns the raw byte values for the given keys in a specific namespace.
type LocalMembership ¶
type LocalMembership struct {
// contains filtered or unexported fields
}
LocalMembership provides access to identities managed by the local node.
func NewLocalMembership ¶
func NewLocalMembership(lm driver.LocalMembership) *LocalMembership
NewLocalMembership creates a new LocalMembership wrapper.
func (*LocalMembership) AnonymousIdentity ¶
func (l *LocalMembership) AnonymousIdentity() (view.Identity, error)
AnonymousIdentity returns a fresh anonymous identity for privacy-preserving operations.
func (*LocalMembership) DefaultIdentity ¶
func (l *LocalMembership) DefaultIdentity() view.Identity
DefaultIdentity returns the default identity of the local node.
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network serves as the primary bridge to a specific blockchain network (e.g., Fabric or FabricX). it provides methods for broadcasting transactions, requesting approvals, and monitoring finality.
func GetInstance ¶
func GetInstance(sp token.ServiceProvider, network, channel string) *Network
GetInstance returns a network instance for the given network and channel
func NewNetwork ¶
func NewNetwork(n driver.Network, localMembership *LocalMembership) *Network
NewNetwork creates a new Network instance.
func (*Network) AddFinalityListener ¶
func (n *Network) AddFinalityListener(namespace string, txID string, listener FinalityListener) error
AddFinalityListener registers a listener to be notified when a transaction reaches a final state on the ledger.
func (*Network) AnonymousIdentity ¶
AnonymousIdentity returns a fresh anonymous identity from the local membership.
func (*Network) AreTokensSpent ¶
func (n *Network) AreTokensSpent(ctx context.Context, namespace string, tokenIDs []*token2.ID, meta []string) ([]bool, error)
AreTokensSpent checks the spent status of multiple tokens on the ledger.
func (*Network) Broadcast ¶
Broadcast submits a transaction envelope or generic blob to the network's ordering service.
func (*Network) ComputeTxID ¶
ComputeTxID calculates the transaction identifier in the network's native format.
func (*Network) Connect ¶
func (n *Network) Connect(ns string) ([]token.ServiceOption, error)
Connect establishes a connection to the network for a specific namespace.
func (*Network) FetchPublicParameters ¶
FetchPublicParameters retrieves the public parameters for a specific namespace from the network.
func (*Network) GetTransactionStatus ¶
func (n *Network) GetTransactionStatus(ctx context.Context, namespace, txID string) (status int, tokenRequestHash []byte, message string, err error)
GetTransactionStatus retrieves the current status and token request hash for a transaction.
func (*Network) LocalMembership ¶
func (n *Network) LocalMembership() *LocalMembership
LocalMembership returns the local membership service associated with this network.
func (*Network) LookupTransferMetadataKey ¶
func (n *Network) LookupTransferMetadataKey(namespace, key string, timeout time.Duration, opts ...token.ServiceOption) ([]byte, error)
LookupTransferMetadataKey performs a ledger scan to find a metadata key matching the provided sub-key.
func (*Network) NewEnvelope ¶
NewEnvelope creates a new, empty ledger-specific transaction envelope.
func (*Network) Normalize ¶
func (n *Network) Normalize(opt *token.ServiceOptions) (*token.ServiceOptions, error)
Normalize fills in default values for network, channel, and namespace in the service options.
func (*Network) QueryTokens ¶
func (n *Network) QueryTokens(ctx context.Context, namespace string, IDs []*token2.ID) ([][]byte, error)
QueryTokens retrieves the raw byte representation of tokens from the ledger.
func (*Network) RequestApproval ¶
func (n *Network) RequestApproval(context view.Context, tms *token.ManagementService, requestRaw []byte, signer view.Identity, txID TxID, metadata driver.TransientMap) (*Envelope, error)
RequestApproval sends a token request to an endorsement service and returns the resulting endorsed envelope. metadata carries optional application-level key-value pairs forwarded to the approver backend.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider manages multiple Network instances, providing lazy initialization and lookup by network/channel ID.
func GetProvider ¶
func GetProvider(sp token.ServiceProvider) *Provider
GetProvider retrieves the network Provider from the service provider.
func NewProvider ¶
NewProvider returns a new network Provider instance.
func (*Provider) Connect ¶
Connect initializes and connects all configured token management systems to their respective networks.
func (*Provider) GetNetwork ¶
GetNetwork returns the Network instance for the specified network and channel identifiers.
func (*Provider) Normalize ¶
func (p *Provider) Normalize(opt *token.ServiceOptions) (*token.ServiceOptions, error)
Normalize ensures that network-related options are fully populated based on the configured environment.
func (*Provider) RegisterDriver ¶
RegisterDriver adds a new network driver to the provider.
type TransientMap ¶
TransientMap models the transient data passed with a transaction proposal, which is not persisted on the ledger.
func (TransientMap) Exists ¶
func (m TransientMap) Exists(key string) bool
Exists checks if a specific key is present in the transient map.
func (TransientMap) Get ¶
func (m TransientMap) Get(id string) []byte
Get retrieves a raw byte slice from the transient map.
func (TransientMap) GetState ¶
func (m TransientMap) GetState(key string, state any) error
GetState unmarshals a JSON-encoded value from the transient map into a Go object.
func (TransientMap) IsEmpty ¶
func (m TransientMap) IsEmpty() bool
IsEmpty returns true if the transient map has no entries.
type TxID ¶
type TxID struct {
// Nonce is a random byte slice used to ensure uniqueness.
Nonce []byte
// Creator is the serialized identity of the transaction creator.
Creator []byte
}
TxID represents a unique transaction identifier composed of a nonce and the creator's identity.
type ValidationCode ¶
type ValidationCode = driver.ValidationCode
ValidationCode represents the status of a transaction on the ledger.
Directories
¶
| Path | Synopsis |
|---|---|
|
rws/translator/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
endorsement/fsc/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
tcc/main
command
|
|
|
tcc/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
finality/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
finality/queue/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
lookup/mock
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |