Documentation
¶
Index ¶
- Variables
- type AccountTransaction
- type AccountTransactionCursor
- type AccountTransactionsPage
- type CompatibleRange
- type EventProvider
- type HeightVersionMapper
- type NetworkParameters
- type NodeVersionInfo
- type StaticHeightVersionMapper
- type SystemCollectionBuilder
- type TransactionResult
- type TransactionRole
- type Version
- type Versioned
Constants ¶
This section is empty.
Variables ¶
var LatestBoundary = map[uint64]Version{0: VersionLatest}
Functions ¶
This section is empty.
Types ¶
type AccountTransaction ¶ added in v0.47.0
type AccountTransaction struct {
Address flow.Address // Account address
BlockHeight uint64 // Block height where transaction was included
BlockTimestamp uint64 // Block timestamp where transaction was included, in Unix milliseconds
TransactionID flow.Identifier // Transaction identifier
TransactionIndex uint32 // Index of transaction within the block
Roles []TransactionRole // Roles of the account in the transaction
Transaction *flow.TransactionBody // Transaction body
Result *TransactionResult // Transaction result
}
AccountTransaction represents a transaction entry from the account transaction index. It contains the essential fields needed to identify and locate a transaction, plus metadata about the account's participation.
type AccountTransactionCursor ¶
type AccountTransactionCursor struct {
BlockHeight uint64 // Block height of the last returned entry
TransactionIndex uint32 // Transaction index within the block of the last returned entry
}
AccountTransactionCursor identifies a position in the account transaction index for cursor-based pagination. It corresponds to the last entry returned in a previous page.
type AccountTransactionsPage ¶
type AccountTransactionsPage struct {
Transactions []AccountTransaction // Transactions in this page (descending order by height)
NextCursor *AccountTransactionCursor // Cursor to fetch the next page, nil when no more results
}
AccountTransactionsPage represents a single page of account transaction results.
type CompatibleRange ¶
type CompatibleRange struct {
// StartHeight is the first block that the version supports.
StartHeight uint64
// EndHeight is the last block that the version supports.
EndHeight uint64
}
CompatibleRange contains the first and the last height that the node's version supports.
type EventProvider ¶ added in v0.44.0
type EventProvider func() (flow.EventsList, error)
EventProvider is a callback function that returns a list of events required to construct the system collection.
func StaticEventProvider ¶ added in v0.44.0
func StaticEventProvider(events flow.EventsList) EventProvider
StaticEventProvider returns an event provider that returns the given events.
type HeightVersionMapper ¶ added in v0.44.0
type HeightVersionMapper interface {
// GetVersion returns the version corresponding to the given height.
GetVersion(height uint64) Version
// All versions defined in the mapper.
AllVersions() []Version
}
HeightVersionMapper defines the interface for mapping heights to protocol versions.
type NetworkParameters ¶
NetworkParameters contains the network-wide parameters for the Flow blockchain.
type NodeVersionInfo ¶
type NodeVersionInfo struct {
Semver string
Commit string
SporkId flow.Identifier
// ProtocolVersion is the deprecated protocol version number.
// Deprecated: Previously this referred to the major software version as of the most recent spork.
// Replaced by protocol_state_version.
ProtocolVersion uint64
// ProtocolStateVersion is the Protocol State version as of the latest finalized block.
// This tracks the schema version of the Protocol State and is used to coordinate breaking changes in the Protocol.
// Version numbers are monotonically increasing.
ProtocolStateVersion uint64
SporkRootBlockHeight uint64
NodeRootBlockHeight uint64
CompatibleRange *CompatibleRange
}
NodeVersionInfo contains information about node, such as semver, commit, sporkID, protocolVersion, etc
type StaticHeightVersionMapper ¶ added in v0.44.0
type StaticHeightVersionMapper struct {
// contains filtered or unexported fields
}
StaticHeightVersionMapper is an implementation that allows hardcoding the height boundaries for each protocol version.
func NewStaticHeightVersionMapper ¶ added in v0.44.0
func NewStaticHeightVersionMapper(heightVersionBoundaries map[uint64]Version) *StaticHeightVersionMapper
func (*StaticHeightVersionMapper) AllVersions ¶ added in v0.44.0
func (s *StaticHeightVersionMapper) AllVersions() []Version
func (*StaticHeightVersionMapper) GetVersion ¶ added in v0.44.0
func (s *StaticHeightVersionMapper) GetVersion(height uint64) Version
type SystemCollectionBuilder ¶ added in v0.44.0
type SystemCollectionBuilder interface {
// ProcessCallbacksTransaction constructs a transaction for processing callbacks, for the given callback.
//
// No error returns are expected during normal operation.
ProcessCallbacksTransaction(chain flow.Chain) (*flow.TransactionBody, error)
// ExecuteCallbacksTransactions constructs a list of transaction to execute callbacks, for the given chain.
//
// No error returns are expected during normal operation.
ExecuteCallbacksTransactions(chain flow.Chain, processEvents flow.EventsList) ([]*flow.TransactionBody, error)
// SystemChunkTransaction creates and returns the transaction corresponding to the
// system chunk for the given chain.
//
// No error returns are expected during normal operation.
SystemChunkTransaction(chain flow.Chain) (*flow.TransactionBody, error)
// SystemCollection constructs a system collection for the given chain.
// Uses the provided event provider to get events required to construct the system collection.
// A nil event provider behaves the same as an event provider that returns an empty EventsList.
//
// No error returns are expected during normal operation.
SystemCollection(chain flow.Chain, providerFn EventProvider) (*flow.Collection, error)
}
SystemCollectionBuilder defines the builders for the system collections and their transactions.
type TransactionResult ¶
type TransactionResult struct {
Status flow.TransactionStatus
StatusCode uint
Events []flow.Event
ErrorMessage string
BlockID flow.Identifier
TransactionID flow.Identifier
CollectionID flow.Identifier
BlockHeight uint64
ComputationUsed uint64
}
TransactionResult represents a flow.TransactionResult with additional fields required for the Access API
func (*TransactionResult) IsExecuted ¶
func (r *TransactionResult) IsExecuted() bool
func (*TransactionResult) IsFinal ¶
func (r *TransactionResult) IsFinal() bool
type TransactionRole ¶ added in v0.47.0
type TransactionRole int
const ( // CAUTION: these values are stored in the database. Do not change the values. TransactionRoleAuthorizer TransactionRole = 0 // Account is an authorizer for the transaction TransactionRolePayer TransactionRole = 1 // Account is the payer for the transaction TransactionRoleProposer TransactionRole = 2 // Account is the proposer for the transaction TransactionRoleInteracted TransactionRole = 3 // Account is referenced by an event in the transaction )
func ParseTransactionRole ¶
func ParseTransactionRole(s string) (TransactionRole, error)
ParseTransactionRole parses a string into a TransactionRole. Accepted values match the OpenAPI spec enum: "authorizer", "payer", "proposer", "interacted".
Returns an error when the input string does not match any known role name.
func (TransactionRole) String ¶
func (r TransactionRole) String() string
String returns the string representation of a TransactionRole matching the OpenAPI spec enum values: "authorizer", "payer", "proposer", "interacted".
Panics on unknown values since roles are stored in the database and unknown values indicate data corruption.
type Versioned ¶ added in v0.44.0
type Versioned[T any] struct { // contains filtered or unexported fields }
Versioned is a generic container that associates different versions of type T with their corresponding protocol versions, as determined by the HeightVersionMapper. This allows retaining and retrieving historical implementations of a type, ensuring correct behavior when the protocol evolves and previous versions must remain accessible for older data.
func NewVersioned ¶ added in v0.44.0
func NewVersioned[T any](versionedTypes map[Version]T, versionMapper HeightVersionMapper) *Versioned[T]