chainlib

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 35 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultTimeout           = 5 * time.Second
	TimePerCU                = uint64(100 * time.Millisecond)
	MinimumTimePerRelayDelay = time.Second
	AverageWorldLatency      = 200 * time.Millisecond
)
View Source
const (
	ContextUserValueKeyDappID = "dappID"
)
View Source
const (
	TendermintStatusQuery = "status"
)

Variables

This section is empty.

Functions

func LocalNodeTimePerCu added in v0.5.0

func LocalNodeTimePerCu(cu uint64) time.Duration

Types

type ChainFetcher

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

func NewChainFetcher

func NewChainFetcher(ctx context.Context, chainProxy ChainProxy) *ChainFetcher

func (*ChainFetcher) FetchBlockHashByNum

func (cf *ChainFetcher) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)

func (*ChainFetcher) FetchLatestBlockNum

func (cf *ChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)

type ChainListener

type ChainListener interface {
	Serve(ctx context.Context)
}

func NewChainListener

func NewChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *common.RPCConsumerLogs) (ChainListener, error)

type ChainMessage

type ChainMessage interface {
	GetServiceApi() *spectypes.ServiceApi
	GetInterface() *spectypes.ApiInterface
	RequestedBlock() int64
	GetRPCMessage() parser.RPCInput
}

type ChainParser

type ChainParser interface {
	ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)
	SetSpec(spec spectypes.Spec)
	DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
	ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)
}

func NewChainParser

func NewChainParser(apiInterface string) (chainParser ChainParser, err error)

type ChainProxy

type ChainProxy interface {
	SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessage) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error) // has to be thread safe, reuse code within ParseMsg as common functionality
}

func GetChainProxy added in v0.5.0

func GetChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint) (ChainProxy, error)

func NewGrpcChainProxy

func NewGrpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint) (ChainProxy, error)

func NewJrpcChainProxy

func NewJrpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint) (ChainProxy, error)

func NewRestChainProxy

func NewRestChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint) (ChainProxy, error)

func NewtendermintRpcChainProxy

func NewtendermintRpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint) (ChainProxy, error)

type GrpcChainListener

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

func NewGrpcChainListener

func NewGrpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *common.RPCConsumerLogs) (chainListener *GrpcChainListener)

func (*GrpcChainListener) Serve

func (apil *GrpcChainListener) Serve(ctx context.Context)

Serve http server for GrpcChainListener

type GrpcChainParser

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

func NewGrpcChainParser

func NewGrpcChainParser() (chainParser *GrpcChainParser, err error)

NewGrpcChainParser creates a new instance of GrpcChainParser

func (*GrpcChainParser) ChainBlockStats

func (apip *GrpcChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)

ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)

func (*GrpcChainParser) DataReliabilityParams

func (apip *GrpcChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)

DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)

func (*GrpcChainParser) ParseMsg

func (apip *GrpcChainParser) ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)

ParseMsg parses message data into chain message object

func (*GrpcChainParser) SetSpec

func (apip *GrpcChainParser) SetSpec(spec spectypes.Spec)

SetSpec sets the spec for the GrpcChainParser

type GrpcChainProxy

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

func (*GrpcChainProxy) SendNodeMsg

func (cp *GrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessage) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)

type JrpcChainProxy

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

func (*JrpcChainProxy) SendNodeMsg

func (cp *JrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessage) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)

type JsonRPCChainListener

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

func NewJrpcChainListener

func NewJrpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *common.RPCConsumerLogs) (chainListener *JsonRPCChainListener)

NewJrpcChainListener creates a new instance of JsonRPCChainListener

func (*JsonRPCChainListener) Serve

func (apil *JsonRPCChainListener) Serve(ctx context.Context)

Serve http server for JsonRPCChainListener

type JsonRPCChainParser

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

func NewJrpcChainParser

func NewJrpcChainParser() (chainParser *JsonRPCChainParser, err error)

NewJrpcChainParser creates a new instance of JsonRPCChainParser

func (*JsonRPCChainParser) ChainBlockStats

func (apip *JsonRPCChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)

ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)

func (*JsonRPCChainParser) DataReliabilityParams

func (apip *JsonRPCChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)

DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)

func (*JsonRPCChainParser) ParseMsg

func (apip *JsonRPCChainParser) ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)

ParseMsg parses message data into chain message object

func (*JsonRPCChainParser) SetSpec

func (apip *JsonRPCChainParser) SetSpec(spec spectypes.Spec)

SetSpec sets the spec for the JsonRPCChainParser

type LavaChainFetcher

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

func NewLavaChainFetcher

func NewLavaChainFetcher(ctx context.Context, clientCtx client.Context) *LavaChainFetcher

func (*LavaChainFetcher) FetchBlockHashByNum

func (lcf *LavaChainFetcher) FetchBlockHashByNum(ctx context.Context, blockNum int64) (string, error)

func (*LavaChainFetcher) FetchLatestBlockNum

func (lcf *LavaChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)

type RelaySender

type RelaySender interface {
	SendRelay(
		ctx context.Context,
		url string,
		req string,
		connectionType string,
		dappID string,
		analytics *metrics.RelayMetrics,
	) (*pairingtypes.RelayReply, *pairingtypes.Relayer_RelaySubscribeClient, error)
}

type RestChainListener

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

func NewRestChainListener

func NewRestChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *common.RPCConsumerLogs) (chainListener *RestChainListener)

NewRestChainListener creates a new instance of RestChainListener

func (*RestChainListener) Serve

func (apil *RestChainListener) Serve(ctx context.Context)

Serve http server for RestChainListener

type RestChainParser

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

func NewRestChainParser

func NewRestChainParser() (chainParser *RestChainParser, err error)

NewRestChainParser creates a new instance of RestChainParser

func (*RestChainParser) ChainBlockStats

func (apip *RestChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)

ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)

func (*RestChainParser) DataReliabilityParams

func (apip *RestChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)

DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)

func (*RestChainParser) ParseMsg

func (apip *RestChainParser) ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)

ParseMsg parses message data into chain message object

func (*RestChainParser) SetSpec

func (apip *RestChainParser) SetSpec(spec spectypes.Spec)

SetSpec sets the spec for the RestChainParser

type RestChainProxy

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

func (*RestChainProxy) SendNodeMsg

func (rcp *RestChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessage) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)

type TendermintChainParser

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

func NewTendermintRpcChainParser

func NewTendermintRpcChainParser() (chainParser *TendermintChainParser, err error)

NewTendermintRpcChainParser creates a new instance of TendermintChainParser

func (*TendermintChainParser) ChainBlockStats

func (apip *TendermintChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)

ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData, spec.BlocksInFinalizationProof)

func (*TendermintChainParser) DataReliabilityParams

func (apip *TendermintChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)

DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)

func (*TendermintChainParser) ParseMsg

func (apip *TendermintChainParser) ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)

ParseMsg parses message data into chain message object

func (*TendermintChainParser) SetSpec

func (apip *TendermintChainParser) SetSpec(spec spectypes.Spec)

SetSpec sets the spec for the TendermintChainParser

type TendermintRpcChainListener

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

func NewTendermintRpcChainListener

func NewTendermintRpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *common.RPCConsumerLogs) (chainListener *TendermintRpcChainListener)

NewTendermintRpcChainListener creates a new instance of TendermintRpcChainListener

func (*TendermintRpcChainListener) Serve

func (apil *TendermintRpcChainListener) Serve(ctx context.Context)

Serve http server for TendermintRpcChainListener

Directories

Path Synopsis
rpcclient
package rpcclient implements bi-directional JSON-RPC 2.0 on multiple transports.
package rpcclient implements bi-directional JSON-RPC 2.0 on multiple transports.
thirdparty/thirdparty_utils/cosmos/tx/config/v1
Code generated by protoc-gen-go-pulsar.
Code generated by protoc-gen-go-pulsar.
thirdparty/thirdparty_utils/cosmos/tx/signing/v1beta1
Code generated by protoc-gen-go-pulsar.
Code generated by protoc-gen-go-pulsar.
thirdparty/thirdparty_utils/cosmos/tx/v1beta1
Code generated by protoc-gen-go-pulsar.
Code generated by protoc-gen-go-pulsar.
thirdparty/thirdparty_utils/cosmwasm_types
Package types is a reverse proxy.
Package types is a reverse proxy.
thirdparty/thirdparty_utils/ibc/apps/29-fee/types
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
thirdparty/thirdparty_utils/ibc/apps/transfer/types
Package types is a reverse proxy.
Package types is a reverse proxy.
thirdparty/thirdparty_utils/ibc/core/channel/types
Package types is a reverse proxy.
Package types is a reverse proxy.
thirdparty/thirdparty_utils/ibc/core/client/types
Package types is a reverse proxy.
Package types is a reverse proxy.
thirdparty/thirdparty_utils/ibc/core/connection/types
Package types is a reverse proxy.
Package types is a reverse proxy.
thirdparty/thirdparty_utils/juno/mint/types
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
Package types is a reverse proxy.
thirdparty/thirdparty_utils/osmosis_protobufs/twap/types
Package queryproto is a reverse proxy.
Package queryproto is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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