Documentation
¶
Index ¶
- Variables
- func ByteSlice(v interface{}) []byte
- func GenericAccountID(index int) identifier.Account
- func GenericAddress(index int) flow.Address
- func GenericAddresses(number int) []flow.Address
- func GenericAmount(delta int) cadence.Value
- func GenericCadenceEvent(index int) cadence.Event
- func GenericCadenceEventType(index int) *cadence.EventType
- func GenericCadenceEventTypes(number int) []*cadence.EventType
- func GenericCadenceEvents(number int) []cadence.Event
- func GenericCollection(index int) *flow.LightCollection
- func GenericCollections(number int) []*flow.LightCollection
- func GenericCommit(index int) flow.StateCommitment
- func GenericCommits(number int) []flow.StateCommitment
- func GenericEventType(index int) flow.EventType
- func GenericEventTypes(number int) []flow.EventType
- func GenericEvents(number int) []flow.Event
- func GenericIdentifier(index int) flow.Identifier
- func GenericIdentifiers(number int) []flow.Identifier
- func GenericLedgerPath(index int) ledger.Path
- func GenericLedgerPaths(number int) []ledger.Path
- func GenericLedgerPayload(index int) *ledger.Payload
- func GenericLedgerPayloads(number int) []*ledger.Payload
- func GenericLedgerValue(index int) ledger.Value
- func GenericLedgerValues(number int) []ledger.Value
- func GenericOperation(index int) object.Operation
- func GenericOperations(number int) []object.Operation
- func GenericResult(index int) *flow.TransactionResult
- func GenericResults(number int) []*flow.TransactionResult
- func GenericTransaction(index int) *flow.TransactionBody
- func GenericTransactionQualifier(index int) identifier.Transaction
- func GenericTransactions(number int) []*flow.TransactionBody
- type Chain
- func (c *Chain) Collections(height uint64) ([]*flow.LightCollection, error)
- func (c *Chain) Commit(height uint64) (flow.StateCommitment, error)
- func (c *Chain) Events(height uint64) ([]flow.Event, error)
- func (c *Chain) Header(height uint64) (*flow.Header, error)
- func (c *Chain) Root() (uint64, error)
- func (c *Chain) Transactions(height uint64) ([]*flow.TransactionBody, error)
- type Codec
- func (c *Codec) Compress(data []byte) ([]byte, error)
- func (c *Codec) Decode(data []byte, value interface{}) error
- func (c *Codec) Decompress(data []byte) ([]byte, error)
- func (c *Codec) Encode(value interface{}) ([]byte, error)
- func (c *Codec) Marshal(v interface{}) ([]byte, error)
- func (c *Codec) Unmarshal(b []byte, v interface{}) error
- type Converter
- type Feeder
- type Forest
- func (f *Forest) Has(commit flow.StateCommitment) bool
- func (f *Forest) Parent(commit flow.StateCommitment) (flow.StateCommitment, bool)
- func (f *Forest) Paths(commit flow.StateCommitment) ([]ledger.Path, bool)
- func (f *Forest) Reset(finalized flow.StateCommitment)
- func (f *Forest) Save(tree *trie.MTrie, paths []ledger.Path, parent flow.StateCommitment)
- func (f *Forest) Size() uint
- func (f *Forest) Tree(commit flow.StateCommitment) (*trie.MTrie, bool)
- type Generator
- type Invoker
- type Loader
- type Reader
- func (r *Reader) Commit(height uint64) (flow.StateCommitment, error)
- func (r *Reader) Events(height uint64, types ...flow.EventType) ([]flow.Event, error)
- func (r *Reader) First() (uint64, error)
- func (r *Reader) Header(height uint64) (*flow.Header, error)
- func (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)
- func (r *Reader) Last() (uint64, error)
- func (r *Reader) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)
- func (r *Reader) TransactionsByHeight(height uint64) ([]flow.Identifier, error)
- func (r *Reader) Values(height uint64, paths []ledger.Path) ([]ledger.Value, error)
- type Validator
- type Writer
- func (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error
- func (w *Writer) Commit(height uint64, commit flow.StateCommitment) error
- func (w *Writer) Events(height uint64, events []flow.Event) error
- func (w *Writer) First(height uint64) error
- func (w *Writer) Header(height uint64, header *flow.Header) error
- func (w *Writer) Height(blockID flow.Identifier, height uint64) error
- func (w *Writer) Last(height uint64) error
- func (w *Writer) Payloads(height uint64, paths []ledger.Path, values []*ledger.Payload) error
- func (w *Writer) Transactions(height uint64, transactions []*flow.TransactionBody) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoopLogger = zerolog.New(io.Discard) GenericError = errors.New("dummy error") GenericHeight = uint64(42) GenericBytes = []byte(`test`) GenericHeader = &flow.Header{ ChainID: dps.FlowTestnet, Height: GenericHeight, Timestamp: time.Date(1972, 11, 12, 13, 14, 15, 16, time.UTC), } GenericLedgerKey = ledger.NewKey([]ledger.KeyPart{ ledger.NewKeyPart(0, []byte(`owner`)), ledger.NewKeyPart(1, []byte(`controller`)), ledger.NewKeyPart(2, []byte(`key`)), }) GenericTrieUpdate = &ledger.TrieUpdate{ RootHash: ledger.RootHash{ 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, }, Paths: GenericLedgerPaths(6), Payloads: GenericLedgerPayloads(6), } // GenericRootNode Visual Representation: // 6 (root) // / \ // 3 5 // / \ \ // 1 2 4 GenericRootNode = node.NewNode( 256, node.NewNode( 256, node.NewLeaf(GenericLedgerPath(0), GenericLedgerPayload(0), 42), node.NewLeaf(GenericLedgerPath(1), GenericLedgerPayload(1), 42), GenericLedgerPath(2), GenericLedgerPayload(2), hash.DummyHash, 64, 64, ), node.NewNode( 256, node.NewLeaf(GenericLedgerPath(3), GenericLedgerPayload(3), 42), nil, GenericLedgerPath(4), GenericLedgerPayload(4), hash.DummyHash, 64, 64, ), GenericLedgerPath(5), GenericLedgerPayload(5), hash.DummyHash, 64, 64, ) GenericTrie, _ = trie.NewMTrie(GenericRootNode) GenericCurrency = identifier.Currency{ Symbol: dps.FlowSymbol, Decimals: dps.FlowDecimals, } GenericAccount = flow.Account{ Address: GenericAddress(0), } GenericBlockQualifier = identifier.Block{ Index: &GenericHeight, Hash: GenericHeader.ID().String(), } )
Global variables that can be used for testing. They are non-nil valid values for the types commonly needed test DPS components.
Functions ¶
func GenericAccountID ¶
func GenericAccountID(index int) identifier.Account
func GenericAddress ¶
func GenericAddresses ¶
func GenericAmount ¶
func GenericCadenceEvent ¶
func GenericCadenceEventType ¶
func GenericCadenceEvents ¶
func GenericCollection ¶
func GenericCollection(index int) *flow.LightCollection
func GenericCollections ¶
func GenericCollections(number int) []*flow.LightCollection
func GenericCommit ¶
func GenericCommit(index int) flow.StateCommitment
func GenericCommits ¶
func GenericCommits(number int) []flow.StateCommitment
func GenericEventType ¶
func GenericEventTypes ¶
func GenericEvents ¶
func GenericIdentifier ¶
func GenericIdentifier(index int) flow.Identifier
func GenericIdentifiers ¶
func GenericIdentifiers(number int) []flow.Identifier
func GenericLedgerPath ¶
func GenericLedgerPaths ¶
func GenericLedgerPayload ¶
func GenericLedgerPayloads ¶
func GenericLedgerValue ¶
func GenericLedgerValues ¶
func GenericOperation ¶
func GenericOperations ¶
func GenericResult ¶
func GenericResult(index int) *flow.TransactionResult
func GenericResults ¶
func GenericResults(number int) []*flow.TransactionResult
func GenericTransaction ¶
func GenericTransaction(index int) *flow.TransactionBody
func GenericTransactionQualifier ¶
func GenericTransactionQualifier(index int) identifier.Transaction
func GenericTransactions ¶
func GenericTransactions(number int) []*flow.TransactionBody
Types ¶
type Chain ¶
type Chain struct {
RootFunc func() (uint64, error)
HeaderFunc func(height uint64) (*flow.Header, error)
CommitFunc func(height uint64) (flow.StateCommitment, error)
CollectionsFunc func(height uint64) ([]*flow.LightCollection, error)
TransactionsFunc func(height uint64) ([]*flow.TransactionBody, error)
EventsFunc func(height uint64) ([]flow.Event, error)
}
func BaselineChain ¶
func (*Chain) Collections ¶
func (c *Chain) Collections(height uint64) ([]*flow.LightCollection, error)
func (*Chain) Transactions ¶
func (c *Chain) Transactions(height uint64) ([]*flow.TransactionBody, error)
type Codec ¶
type Codec struct {
EncodeFunc func(value interface{}) ([]byte, error)
DecodeFunc func(data []byte, value interface{}) error
CompressFunc func(data []byte) ([]byte, error)
DecompressFunc func(compressed []byte) ([]byte, error)
MarshalFunc func(value interface{}) ([]byte, error)
UnmarshalFunc func(compressed []byte, value interface{}) error
}
func BaselineCodec ¶
type Converter ¶
func BaselineConverter ¶
type Feeder ¶
type Feeder struct {
UpdateFunc func() (*ledger.TrieUpdate, error)
}
func BaselineFeeder ¶
type Forest ¶
type Forest struct {
SaveFunc func(tree *trie.MTrie, paths []ledger.Path, parent flow.StateCommitment)
HasFunc func(commit flow.StateCommitment) bool
TreeFunc func(commit flow.StateCommitment) (*trie.MTrie, bool)
PathsFunc func(commit flow.StateCommitment) ([]ledger.Path, bool)
ParentFunc func(commit flow.StateCommitment) (flow.StateCommitment, bool)
ResetFunc func(finalized flow.StateCommitment)
SizeFunc func() uint
}
func (*Forest) Parent ¶
func (f *Forest) Parent(commit flow.StateCommitment) (flow.StateCommitment, bool)
func (*Forest) Reset ¶
func (f *Forest) Reset(finalized flow.StateCommitment)
type Generator ¶
type Generator struct {
GetBalanceFunc func(symbol string) ([]byte, error)
TokensDepositedFunc func(symbol string) (string, error)
TokensWithdrawnFunc func(symbol string) (string, error)
}
func BaselineGenerator ¶
func (*Generator) TokensDeposited ¶
type Invoker ¶
type Invoker struct {
ScriptFunc func(height uint64, script []byte, parameters []cadence.Value) (cadence.Value, error)
}
func BaselineInvoker ¶
type Loader ¶
func BaselineLoader ¶
type Reader ¶
type Reader struct {
FirstFunc func() (uint64, error)
LastFunc func() (uint64, error)
HeightForBlockFunc func(blockID flow.Identifier) (uint64, error)
CommitFunc func(height uint64) (flow.StateCommitment, error)
HeaderFunc func(height uint64) (*flow.Header, error)
EventsFunc func(height uint64, types ...flow.EventType) ([]flow.Event, error)
ValuesFunc func(height uint64, paths []ledger.Path) ([]ledger.Value, error)
TransactionFunc func(txID flow.Identifier) (*flow.TransactionBody, error)
TransactionsByHeightFunc func(height uint64) ([]flow.Identifier, error)
}
func BaselineReader ¶
func (*Reader) HeightForBlock ¶
func (r *Reader) HeightForBlock(blockID flow.Identifier) (uint64, error)
func (*Reader) Transaction ¶
func (r *Reader) Transaction(txID flow.Identifier) (*flow.TransactionBody, error)
func (*Reader) TransactionsByHeight ¶
func (r *Reader) TransactionsByHeight(height uint64) ([]flow.Identifier, error)
type Validator ¶
type Validator struct {
AccountFunc func(address identifier.Account) error
BlockFunc func(block identifier.Block) (identifier.Block, error)
TransactionFunc func(transaction identifier.Transaction) error
CurrencyFunc func(currency identifier.Currency) (identifier.Currency, error)
}
func BaselineValidator ¶
func (*Validator) Block ¶
func (v *Validator) Block(block identifier.Block) (identifier.Block, error)
func (*Validator) Currency ¶
func (v *Validator) Currency(currency identifier.Currency) (identifier.Currency, error)
func (*Validator) Transaction ¶
func (v *Validator) Transaction(transaction identifier.Transaction) error
type Writer ¶
type Writer struct {
FirstFunc func(height uint64) error
LastFunc func(height uint64) error
HeaderFunc func(height uint64, header *flow.Header) error
CommitFunc func(height uint64, commit flow.StateCommitment) error
PayloadsFunc func(height uint64, paths []ledger.Path, value []*ledger.Payload) error
HeightFunc func(blockID flow.Identifier, height uint64) error
CollectionsFunc func(height uint64, collections []*flow.LightCollection) error
TransactionsFunc func(height uint64, transactions []*flow.TransactionBody) error
EventsFunc func(height uint64, events []flow.Event) error
}
func BaselineWriter ¶
func (*Writer) Collections ¶
func (w *Writer) Collections(height uint64, collections []*flow.LightCollection) error
func (*Writer) Transactions ¶
func (w *Writer) Transactions(height uint64, transactions []*flow.TransactionBody) error
Click to show internal directories.
Click to hide internal directories.