network

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Valid   = driver.Valid   // Transaction is valid and committed
	Invalid = driver.Invalid // Transaction is invalid and has been discarded
	Busy    = driver.Busy    // Transaction does not yet have a validity state
	Unknown = driver.Unknown // Transaction is unknown
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

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

func (*Envelope) Bytes

func (e *Envelope) Bytes() ([]byte, error)

func (*Envelope) FromBytes

func (e *Envelope) FromBytes(raw []byte) error

func (*Envelope) MarshalJSON

func (e *Envelope) MarshalJSON() ([]byte, error)

func (*Envelope) String

func (e *Envelope) String() string

func (*Envelope) TxID

func (e *Envelope) TxID() string

func (*Envelope) UnmarshalJSON

func (e *Envelope) UnmarshalJSON(raw []byte) error

type FinalityListener added in v0.4.0

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)
}

FinalityListener is the interface that must be implemented to receive transaction status change notifications

type GetFunc

type GetFunc func() (view.Identity, []byte, error)

type Ledger

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

func (*Ledger) Status

func (l *Ledger) Status(id string) (ValidationCode, string, error)

type LocalMembership

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

func (*LocalMembership) AnonymousIdentity

func (l *LocalMembership) AnonymousIdentity() (view.Identity, error)

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 token.ServiceProvider, network, channel string) *Network

GetInstance returns a network instance for the given network and channel

func (*Network) AddFinalityListener added in v0.4.0

func (n *Network) AddFinalityListener(namespace string, txID string, listener FinalityListener) error

AddFinalityListener registers a listener for transaction status for the passed transaction id. If the status is already valid or invalid, the listener is called immediately. When the listener is invoked, then it is also removed. If the transaction id is empty, the listener will be called on status changes of any transaction. In this case, the listener is not removed

func (*Network) AnonymousIdentity

func (n *Network) AnonymousIdentity() (view.Identity, error)

AnonymousIdentity returns a fresh anonymous identity

func (*Network) AreTokensSpent

func (n *Network) AreTokensSpent(ctx context.Context, namespace string, tokenIDs []*token2.ID, meta []string) ([]bool, error)

AreTokensSpent retrieves the spent flag for the passed ids

func (*Network) Broadcast

func (n *Network) Broadcast(ctx context.Context, blob interface{}) error

Broadcast sends the given blob to the network

func (*Network) Channel

func (n *Network) Channel() string

Channel returns the channel name

func (*Network) ComputeTxID

func (n *Network) ComputeTxID(id *TxID) string

ComputeTxID computes the transaction ID in the target network format for the given tx id

func (*Network) Connect added in v0.4.0

func (n *Network) Connect(ns string) ([]token.ServiceOption, error)

func (*Network) FetchPublicParameters

func (n *Network) FetchPublicParameters(namespace string) ([]byte, error)

FetchPublicParameters returns the public parameters for the given namespace

func (*Network) Ledger

func (n *Network) Ledger() (*Ledger, error)

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, stopOnLastTx bool, 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 or, if stopOnLastTx is true, when the last transaction in the vault is reached.

func (*Network) Name

func (n *Network) Name() string

Name returns the name of the network

func (*Network) NewEnvelope

func (n *Network) NewEnvelope() *Envelope

NewEnvelope creates a new envelope

func (*Network) Normalize added in v0.4.0

func (n *Network) Normalize(opt *token.ServiceOptions) (*token.ServiceOptions, error)

func (*Network) QueryTokens

func (n *Network) QueryTokens(ctx context.Context, namespace string, IDs []*token2.ID) ([][]byte, error)

QueryTokens returns the tokens corresponding to the given token ids int the given namespace

func (*Network) RemoveFinalityListener added in v0.4.0

func (n *Network) RemoveFinalityListener(id string, listener FinalityListener) error

RemoveFinalityListener unregisters the passed listener.

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

type Provider

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

Provider returns an instance of network provider

func GetProvider added in v0.4.0

func GetProvider(sp token.ServiceProvider) *Provider

func NewProvider

func NewProvider() *Provider

NewProvider returns a new instance of network provider

func (*Provider) GetNetwork

func (np *Provider) GetNetwork(network string, channel string) (*Network, error)

GetNetwork returns a network instance for the given network and channel

func (*Provider) Normalize added in v0.4.0

func (np *Provider) Normalize(opt *token.ServiceOptions) (*token.ServiceOptions, error)

func (*Provider) RegisterDriver added in v0.4.0

func (np *Provider) RegisterDriver(driver driver.Driver)

type TransientMap

type TransientMap map[string][]byte

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) Set

func (m TransientMap) Set(key string, raw []byte) error

func (TransientMap) SetState

func (m TransientMap) SetState(key string, state interface{}) error

type TxID

type TxID struct {
	Nonce   []byte
	Creator []byte
}

func (TxID) String

func (t TxID) String() string

type ValidationCode

type ValidationCode = driver.ValidationCode

Directories

Path Synopsis
rws/translator/mock
Code generated by counterfeiter.
Code generated by counterfeiter.
tcc
tcc/main command
tcc/mock
Code generated by counterfeiter.
Code generated by counterfeiter.
tcc/fabricv25 module

Jump to

Keyboard shortcuts

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