Help us shape the future of Go! Take the 2026 Go Developer Survey

dps

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: Apache-2.0 Imports: 6 Imported by: 10

Documentation

Index

Constants

View Source
const (
	FlowBlockchain = "flow"
	FlowMainnet    = flow.Mainnet
	FlowTestnet    = flow.Testnet
	FlowSymbol     = "FLOW"
	FlowDecimals   = 8

	StatusCompleted = "COMPLETED"

	OperationTransfer = "TRANSFER"
)

Variables

View Source
var (
	ErrFinished    = errors.New("finished")
	ErrTimeout     = errors.New("timeout")
	ErrUnavailable = errors.New("unavailable")
)
View Source
var FlowParams = make(map[flow.ChainID]Params)

Functions

func DefaultOptions

func DefaultOptions(dir string) badger.Options

Types

type Chain

type Chain interface {
	Root() (uint64, error)
	Header(height uint64) (*flow.Header, error)
	Commit(height uint64) (flow.StateCommitment, error)
	Events(height uint64) ([]flow.Event, error)
	Collections(height uint64) ([]*flow.LightCollection, error)
	Guarantees(height uint64) ([]*flow.CollectionGuarantee, error)
	Transactions(height uint64) ([]*flow.TransactionBody, error)
	Results(height uint64) ([]*flow.TransactionResult, error)
	Seals(height uint64) ([]*flow.Seal, error)
}

type Codec

type Codec interface {
	Encode(value interface{}) ([]byte, error)
	Compress(data []byte) ([]byte, error)

	Decode(data []byte, value interface{}) error
	Decompress(compressed []byte) ([]byte, error)

	Marshal(value interface{}) ([]byte, error)
	Unmarshal(compressed []byte, value interface{}) error
}

type Library

type Library interface {
	ReadLibrary
	WriteLibrary
}

type Params

type Params struct {
	ChainID          flow.ChainID
	FungibleToken    flow.Address
	FlowFees         flow.Address
	StakingTable     flow.Address
	LockedTokens     flow.Address
	StakingProxy     flow.Address
	NonFungibleToken flow.Address
	Tokens           map[string]Token
}

func (Params) Symbols

func (p Params) Symbols() []string

type ReadLibrary

type ReadLibrary interface {
	RetrieveFirst(height *uint64) func(*badger.Txn) error
	RetrieveLast(height *uint64) func(*badger.Txn) error

	LookupHeightForBlock(blockID flow.Identifier, height *uint64) func(*badger.Txn) error
	LookupHeightForTransaction(txID flow.Identifier, height *uint64) func(*badger.Txn) error

	RetrieveCommit(height uint64, commit *flow.StateCommitment) func(*badger.Txn) error
	RetrieveHeader(height uint64, header *flow.Header) func(*badger.Txn) error
	RetrieveEvents(height uint64, types []flow.EventType, events *[]flow.Event) func(*badger.Txn) error
	RetrievePayload(height uint64, path ledger.Path, payload *ledger.Payload) func(*badger.Txn) error

	LookupTransactionsForHeight(height uint64, txIDs *[]flow.Identifier) func(*badger.Txn) error
	LookupTransactionsForCollection(collID flow.Identifier, txIDs *[]flow.Identifier) func(*badger.Txn) error
	LookupCollectionsForHeight(height uint64, collIDs *[]flow.Identifier) func(*badger.Txn) error
	LookupSealsForHeight(height uint64, sealIDs *[]flow.Identifier) func(*badger.Txn) error

	RetrieveCollection(collID flow.Identifier, collection *flow.LightCollection) func(*badger.Txn) error
	RetrieveGuarantee(collID flow.Identifier, collection *flow.CollectionGuarantee) func(*badger.Txn) error
	RetrieveTransaction(txID flow.Identifier, transaction *flow.TransactionBody) func(*badger.Txn) error
	RetrieveResult(txID flow.Identifier, result *flow.TransactionResult) func(*badger.Txn) error
	RetrieveSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error
}

type Reader

type Reader interface {
	First() (uint64, error)
	Last() (uint64, error)

	HeightForBlock(blockID flow.Identifier) (uint64, error)
	HeightForTransaction(txID flow.Identifier) (uint64, error)

	Commit(height uint64) (flow.StateCommitment, error)
	Header(height uint64) (*flow.Header, error)
	Events(height uint64, types ...flow.EventType) ([]flow.Event, error)
	Values(height uint64, paths []ledger.Path) ([]ledger.Value, error)

	Collection(collID flow.Identifier) (*flow.LightCollection, error)
	Guarantee(collID flow.Identifier) (*flow.CollectionGuarantee, error)
	Transaction(txID flow.Identifier) (*flow.TransactionBody, error)
	Seal(sealID flow.Identifier) (*flow.Seal, error)
	Result(txID flow.Identifier) (*flow.TransactionResult, error)

	CollectionsByHeight(height uint64) ([]flow.Identifier, error)
	TransactionsByHeight(height uint64) ([]flow.Identifier, error)
	SealsByHeight(height uint64) ([]flow.Identifier, error)
}

type Token

type Token struct {
	Symbol   string
	Address  flow.Address
	Type     string
	Vault    string
	Receiver string
	Balance  string
}

type WriteLibrary

type WriteLibrary interface {
	SaveFirst(height uint64) func(*badger.Txn) error
	SaveLast(height uint64) func(*badger.Txn) error

	IndexHeightForBlock(blockID flow.Identifier, height uint64) func(*badger.Txn) error
	IndexHeightForTransaction(txID flow.Identifier, height uint64) func(*badger.Txn) error

	SaveCommit(height uint64, commit flow.StateCommitment) func(*badger.Txn) error
	SaveHeader(height uint64, header *flow.Header) func(*badger.Txn) error
	SaveEvents(height uint64, typ flow.EventType, events []flow.Event) func(*badger.Txn) error
	SavePayload(height uint64, path ledger.Path, payload *ledger.Payload) func(*badger.Txn) error

	IndexTransactionsForHeight(height uint64, txIDs []flow.Identifier) func(*badger.Txn) error
	IndexTransactionsForCollection(collID flow.Identifier, txIDs []flow.Identifier) func(*badger.Txn) error
	IndexCollectionsForHeight(height uint64, collIDs []flow.Identifier) func(*badger.Txn) error
	IndexSealsForHeight(height uint64, sealIDs []flow.Identifier) func(*badger.Txn) error

	SaveCollection(collection *flow.LightCollection) func(*badger.Txn) error
	SaveGuarantee(guarantee *flow.CollectionGuarantee) func(*badger.Txn) error
	SaveTransaction(transaction *flow.TransactionBody) func(*badger.Txn) error
	SaveResult(results *flow.TransactionResult) func(*badger.Txn) error
	SaveSeal(seal *flow.Seal) func(*badger.Txn) error
}

type Writer

type Writer interface {
	First(height uint64) error
	Last(height uint64) error

	Height(blockID flow.Identifier, height uint64) error

	Commit(height uint64, commit flow.StateCommitment) error
	Header(height uint64, header *flow.Header) error
	Events(height uint64, events []flow.Event) error
	Payloads(height uint64, paths []ledger.Path, values []*ledger.Payload) error

	Collections(height uint64, collections []*flow.LightCollection) error
	Guarantees(height uint64, guarantees []*flow.CollectionGuarantee) error
	Transactions(height uint64, transactions []*flow.TransactionBody) error
	Results(results []*flow.TransactionResult) error
	Seals(height uint64, seals []*flow.Seal) error
}

Jump to

Keyboard shortcuts

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