flow

package module
v0.0.0-...-a05b099 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func UFix64ToFloat64

func UFix64ToFloat64(u cadence.UFix64) float64

Types

type Block

type Block struct {
	Ts                   *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=ts,proto3" json:"ts,omitempty"`
	Id                   []byte                 `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	ParentID             []byte                 `protobuf:"bytes,3,opt,name=parentID,proto3" json:"parentID,omitempty"`
	Height               uint64                 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
	CollectionGuarantees []*CollectionGuarantee `protobuf:"bytes,5,rep,name=collectionGuarantees,proto3" json:"collectionGuarantees,omitempty"`
	Seals                []*BlockSeal           `protobuf:"bytes,6,rep,name=seals,proto3" json:"seals,omitempty"`
	// contains filtered or unexported fields
}

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetCollectionGuarantees

func (x *Block) GetCollectionGuarantees() []*CollectionGuarantee

func (*Block) GetHeight

func (x *Block) GetHeight() uint64

func (*Block) GetId

func (x *Block) GetId() []byte

func (*Block) GetParentID

func (x *Block) GetParentID() []byte

func (*Block) GetSeals

func (x *Block) GetSeals() []*BlockSeal

func (*Block) GetTs

func (x *Block) GetTs() *timestamppb.Timestamp

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

type BlockSeal

type BlockSeal struct {
	BlockID            []byte `protobuf:"bytes,1,opt,name=blockID,proto3" json:"blockID,omitempty"`
	ExecutionReceiptID []byte `protobuf:"bytes,2,opt,name=executionReceiptID,proto3" json:"executionReceiptID,omitempty"`
	// contains filtered or unexported fields
}

func (*BlockSeal) Descriptor deprecated

func (*BlockSeal) Descriptor() ([]byte, []int)

Deprecated: Use BlockSeal.ProtoReflect.Descriptor instead.

func (*BlockSeal) GetBlockID

func (x *BlockSeal) GetBlockID() []byte

func (*BlockSeal) GetExecutionReceiptID

func (x *BlockSeal) GetExecutionReceiptID() []byte

func (*BlockSeal) ProtoMessage

func (*BlockSeal) ProtoMessage()

func (*BlockSeal) ProtoReflect

func (x *BlockSeal) ProtoReflect() protoreflect.Message

func (*BlockSeal) Reset

func (x *BlockSeal) Reset()

func (*BlockSeal) String

func (x *BlockSeal) String() string

type CollectionGuarantee

type CollectionGuarantee struct {
	CollectionID []byte `protobuf:"bytes,1,opt,name=collectionID,proto3" json:"collectionID,omitempty"`
	// contains filtered or unexported fields
}

func (*CollectionGuarantee) Descriptor deprecated

func (*CollectionGuarantee) Descriptor() ([]byte, []int)

Deprecated: Use CollectionGuarantee.ProtoReflect.Descriptor instead.

func (*CollectionGuarantee) GetCollectionID

func (x *CollectionGuarantee) GetCollectionID() []byte

func (*CollectionGuarantee) ProtoMessage

func (*CollectionGuarantee) ProtoMessage()

func (*CollectionGuarantee) ProtoReflect

func (x *CollectionGuarantee) ProtoReflect() protoreflect.Message

func (*CollectionGuarantee) Reset

func (x *CollectionGuarantee) Reset()

func (*CollectionGuarantee) String

func (x *CollectionGuarantee) String() string

type Config

type Config struct {
	Host              string
	FromBlock         uint64
	NumBlocks         uint64
	MaxGrpcMsgSize    int
	MaxApiUsage       int // Limit GetEventsForHeightRange API usage rate.
	MaxWorkerPoolSize int
	CacheSize         int
	ChannelSize       int
	Timeout           time.Duration
	ReportInterval    time.Duration
}

type Connector

type Connector struct {
	*connector.Connector
	*Config
	// contains filtered or unexported fields
}

func New

func New(c *connector.Connector, config *Config) *Connector

func (*Connector) AddContract

func (c *Connector) AddContract(sc ISmartContract)

func (*Connector) GetContract

func (c *Connector) GetContract(addr string, name string) ISmartContract

func (*Connector) Start

func (c *Connector) Start()

type ContractID

type ContractID struct {
	Addr string
	Name string
}

type EventType

type EventType struct {
	ContractAddr string
	ContractName string
	EventName    string
}

func (EventType) String

func (t EventType) String() string

type ISmartContract

type ISmartContract interface {
	Address() string
	Name() string
	Events() []string
	Message(*Log) proto.Message
}

type Log

type Log struct {
	BlockID   flow.Identifier
	Height    uint64
	Timestamp time.Time
	// Type is the qualified event type.
	Type EventType
	// TransactionID is the ID of the transaction this event was emitted from.
	TransactionID flow.Identifier
	// TransactionIndex is the index of the transaction this event was emitted from, within its containing block.
	TransactionIndex int
	// EventIndex is the index of the event within the transaction it was emitted from.
	EventIndex int
	// Value contains the event data.
	Value cadence.Event
	// Bytes representing event data.
	Payload []byte
}

type ProposalKey

type ProposalKey struct {
	Address        []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	KeyIndex       int64  `protobuf:"varint,2,opt,name=keyIndex,proto3" json:"keyIndex,omitempty"`
	SequenceNumber uint64 `protobuf:"varint,3,opt,name=sequenceNumber,proto3" json:"sequenceNumber,omitempty"`
	// contains filtered or unexported fields
}

func (*ProposalKey) Descriptor deprecated

func (*ProposalKey) Descriptor() ([]byte, []int)

Deprecated: Use ProposalKey.ProtoReflect.Descriptor instead.

func (*ProposalKey) GetAddress

func (x *ProposalKey) GetAddress() []byte

func (*ProposalKey) GetKeyIndex

func (x *ProposalKey) GetKeyIndex() int64

func (*ProposalKey) GetSequenceNumber

func (x *ProposalKey) GetSequenceNumber() uint64

func (*ProposalKey) ProtoMessage

func (*ProposalKey) ProtoMessage()

func (*ProposalKey) ProtoReflect

func (x *ProposalKey) ProtoReflect() protoreflect.Message

func (*ProposalKey) Reset

func (x *ProposalKey) Reset()

func (*ProposalKey) String

func (x *ProposalKey) String() string

type Repository

type Repository interface {
	GetLatestBlock(ctx context.Context, isSealed bool) (*flow.Block, error)
	GetBlockByHeight(ctx context.Context, height uint64) (*flow.Block, error)
	GetCollection(ctx context.Context, colID flow.Identifier) (*flow.Collection, error)
	GetTransaction(ctx context.Context, txID flow.Identifier) (*flow.Transaction, error)
	GetEventsForBlockIDs(ctx context.Context, eventType string, blockIDs []flow.Identifier) ([]flow.BlockEvents, error)
	GetEventsForHeightRange(ctx context.Context, eventType string, startHeight uint64, endHeight uint64) ([]flow.BlockEvents, error)
}

func NewRepository

func NewRepository(ctx context.Context, config *Config) (Repository, error)

type Subscription

type Subscription struct {
	*Config
	// contains filtered or unexported fields
}

func NewSubscription

func NewSubscription(ctx context.Context, config *Config, events []string) (*Subscription, error)

func (*Subscription) Blocks

func (s *Subscription) Blocks() <-chan *Block

func (*Subscription) Done

func (s *Subscription) Done() <-chan struct{}

func (*Subscription) Err

func (s *Subscription) Err() <-chan error

func (*Subscription) HistoricalBlocks

func (s *Subscription) HistoricalBlocks() <-chan *Block

func (*Subscription) HistoricalLogs

func (s *Subscription) HistoricalLogs() <-chan *Log

func (*Subscription) HistoricalTransactions

func (s *Subscription) HistoricalTransactions() <-chan *Transaction

func (*Subscription) Logs

func (s *Subscription) Logs() <-chan *Log

func (*Subscription) Transactions

func (s *Subscription) Transactions() <-chan *Transaction

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe()

type Transaction

type Transaction struct {
	Ts                 *timestamppb.Timestamp  `protobuf:"bytes,1,opt,name=ts,proto3" json:"ts,omitempty"`
	Id                 []byte                  `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
	BlockID            []byte                  `protobuf:"bytes,3,opt,name=blockID,proto3" json:"blockID,omitempty"`
	CollectionID       []byte                  `protobuf:"bytes,4,opt,name=collectionID,proto3" json:"collectionID,omitempty"`
	Script             []byte                  `protobuf:"bytes,5,opt,name=script,proto3" json:"script,omitempty"`
	Arguments          [][]byte                `protobuf:"bytes,6,rep,name=arguments,proto3" json:"arguments,omitempty"`
	ReferenceBlockID   []byte                  `protobuf:"bytes,7,opt,name=referenceBlockID,proto3" json:"referenceBlockID,omitempty"`
	GasLimit           uint64                  `protobuf:"varint,8,opt,name=gasLimit,proto3" json:"gasLimit,omitempty"`
	ProposalKey        *ProposalKey            `protobuf:"bytes,9,opt,name=proposalKey,proto3" json:"proposalKey,omitempty"`
	Payer              []byte                  `protobuf:"bytes,10,opt,name=payer,proto3" json:"payer,omitempty"`
	Authorizers        [][]byte                `protobuf:"bytes,11,rep,name=authorizers,proto3" json:"authorizers,omitempty"`
	PayloadSignatures  []*TransactionSignature `protobuf:"bytes,12,rep,name=payloadSignatures,proto3" json:"payloadSignatures,omitempty"`
	EnvelopeSignatures []*TransactionSignature `protobuf:"bytes,13,rep,name=envelopeSignatures,proto3" json:"envelopeSignatures,omitempty"`
	BlockNumber        uint64                  `protobuf:"varint,14,opt,name=blockNumber,proto3" json:"blockNumber,omitempty"`
	// contains filtered or unexported fields
}

func (*Transaction) Descriptor deprecated

func (*Transaction) Descriptor() ([]byte, []int)

Deprecated: Use Transaction.ProtoReflect.Descriptor instead.

func (*Transaction) GetArguments

func (x *Transaction) GetArguments() [][]byte

func (*Transaction) GetAuthorizers

func (x *Transaction) GetAuthorizers() [][]byte

func (*Transaction) GetBlockID

func (x *Transaction) GetBlockID() []byte

func (*Transaction) GetBlockNumber

func (x *Transaction) GetBlockNumber() uint64

func (*Transaction) GetCollectionID

func (x *Transaction) GetCollectionID() []byte

func (*Transaction) GetEnvelopeSignatures

func (x *Transaction) GetEnvelopeSignatures() []*TransactionSignature

func (*Transaction) GetGasLimit

func (x *Transaction) GetGasLimit() uint64

func (*Transaction) GetId

func (x *Transaction) GetId() []byte

func (*Transaction) GetPayer

func (x *Transaction) GetPayer() []byte

func (*Transaction) GetPayloadSignatures

func (x *Transaction) GetPayloadSignatures() []*TransactionSignature

func (*Transaction) GetProposalKey

func (x *Transaction) GetProposalKey() *ProposalKey

func (*Transaction) GetReferenceBlockID

func (x *Transaction) GetReferenceBlockID() []byte

func (*Transaction) GetScript

func (x *Transaction) GetScript() []byte

func (*Transaction) GetTs

func (x *Transaction) GetTs() *timestamppb.Timestamp

func (*Transaction) ProtoMessage

func (*Transaction) ProtoMessage()

func (*Transaction) ProtoReflect

func (x *Transaction) ProtoReflect() protoreflect.Message

func (*Transaction) Reset

func (x *Transaction) Reset()

func (*Transaction) String

func (x *Transaction) String() string

type TransactionSignature

type TransactionSignature struct {
	Address     []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	SignerIndex int64  `protobuf:"varint,2,opt,name=signerIndex,proto3" json:"signerIndex,omitempty"`
	KeyIndex    int64  `protobuf:"varint,3,opt,name=keyIndex,proto3" json:"keyIndex,omitempty"`
	Signature   []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

func (*TransactionSignature) Descriptor deprecated

func (*TransactionSignature) Descriptor() ([]byte, []int)

Deprecated: Use TransactionSignature.ProtoReflect.Descriptor instead.

func (*TransactionSignature) GetAddress

func (x *TransactionSignature) GetAddress() []byte

func (*TransactionSignature) GetKeyIndex

func (x *TransactionSignature) GetKeyIndex() int64

func (*TransactionSignature) GetSignature

func (x *TransactionSignature) GetSignature() []byte

func (*TransactionSignature) GetSignerIndex

func (x *TransactionSignature) GetSignerIndex() int64

func (*TransactionSignature) ProtoMessage

func (*TransactionSignature) ProtoMessage()

func (*TransactionSignature) ProtoReflect

func (x *TransactionSignature) ProtoReflect() protoreflect.Message

func (*TransactionSignature) Reset

func (x *TransactionSignature) Reset()

func (*TransactionSignature) String

func (x *TransactionSignature) String() string

type WorkerPool

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

func NewWorkerPool

func NewWorkerPool(size int) *WorkerPool

func (*WorkerPool) Run

func (p *WorkerPool) Run(task func())

func (*WorkerPool) Wait

func (p *WorkerPool) Wait()

Jump to

Keyboard shortcuts

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