Documentation
¶
Index ¶
- type Block
- type BlockFilter
- type BlockMEV
- type BlockMEVsSetter
- type BlocksProvider
- type BlocksSetter
- type Event
- type EventFilter
- type EventsProvider
- type EventsSetter
- type Order
- type Service
- type Transaction
- type TransactionAccessListEntry
- type TransactionBalanceChange
- type TransactionFilter
- type TransactionStateDiff
- type TransactionStateDiffsProvider
- type TransactionStateDiffsSetter
- type TransactionStorageChange
- type TransactionsProvider
- type TransactionsSetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
Height uint32
Hash []byte
BaseFee uint64
Difficulty uint64
ExtraData []byte
GasLimit uint32
GasUsed uint32
FeeRecipient []byte
ParentHash []byte
Size uint32
StateRoot []byte
Timestamp time.Time
TotalDifficulty *big.Int
Issuance *big.Int
}
Block holds information about a block.
type BlockFilter ¶ added in v0.3.1
type BlockFilter struct {
// Limit is the maximum number of blocks to return.
// If nil then there is no limit.
Limit *uint32
// Order is either OrderEarliest, in which case the earliest results
// that match the filter are returned, or OrderLatest, in which case the
// latest results that match the filter are returned.
// The default is OrderEarliest.
Order Order
// From is the height of the earliest block to fetch.
// If nil then there is no earliest block.
From *uint32
// To is the height of the latest block to fetch.
// If nil then there is no latest block.
To *uint32
}
BlockFilter defines a filter for fetching blocks. Filter elements are ANDed together. Results are always returned in ascending block height order.
type BlockMEV ¶ added in v0.3.1
type BlockMEV struct {
BlockHash []byte
BlockHeight uint32
Fees *uint256.Int
Payments *uint256.Int
}
BlockMEV holds information about payments to the fee recipient in a block.
type BlockMEVsSetter ¶ added in v0.3.1
type BlockMEVsSetter interface {
Service
// SetBlockMEVs sets multiple block MEVs efficiently.
SetBlockMEVs(ctx context.Context, blockMEVs []*BlockMEV) error
}
BlockMEVsSetter defines functions to create and update block MEV.
type BlocksProvider ¶ added in v0.3.1
type BlocksProvider interface {
// Blocks returns blocks matching the supplied filter.
Blocks(ctx context.Context, filter *BlockFilter) ([]*Block, error)
}
BlocksProvider defines functions to provide block information.
type BlocksSetter ¶
type BlocksSetter interface {
Service
// SetBlock sets a block.
SetBlock(ctx context.Context, block *Block) error
// SetBlocks sets multiple blocks efficiently.
SetBlocks(ctx context.Context, blocks []*Block) error
}
BlocksSetter defines functions to create and update blocks.
type Event ¶
type Event struct {
TransactionHash []byte
BlockHeight uint32
Index uint32 // aka LogIndex, index of the event in the block.
Address []byte
Topics [][]byte
Data []byte
}
Event holds information about a transaction event.
type EventFilter ¶ added in v0.1.1
type EventFilter struct {
// Limit is the maximum number of events to return.
// If nil then there is no limit.
Limit *uint32
// Order is either OrderEarliest, in which case the earliest results
// that match the filter are returned, or OrderLatest, in which case the
// latest results that match the filter are returned.
// The default is OrderEarliest.
Order Order
// From is the height of the earliest block from which to fetch events.
// If nil then there is no earliest block.
From *uint32
// To is the height of the latest block from which to fetch events.
// If nil then there is no latest block.
To *uint32
// TransactionHash is the hash of the transaction that generated the event.
// If nil then no filter is applied
TransactionHash *[]byte
// Address is the address of the contract that generated the event.
// If nil then no filter is applied
Address *[]byte
}
EventFilter defines a filter for fetching events. Filter elements are ANDed together. Results are always returned in ascending (block height, transaction index, event index) order.
type EventsProvider ¶ added in v0.1.1
type EventsProvider interface {
// Events returns events matching the supplied filter.
Events(ctx context.Context, filter *EventFilter) ([]*Event, error)
}
EventsProvider defines functions to provide event information.
type EventsSetter ¶
type EventsSetter interface {
Service
// SetEvent sets an event.
SetEvent(ctx context.Context, event *Event) error
// SetEvents sets multiple events efficiently.
SetEvents(ctx context.Context, events []*Event) error
}
EventsSetter defines functions to create and update events.
type Order ¶
type Order uint8
Order is the order in which results should be fetched (N.B. fetched, not returned).
type Service ¶
type Service interface {
// BeginTx begins a transaction.
BeginTx(ctx context.Context) (context.Context, context.CancelFunc, error)
// CommitTx commits a transaction.
CommitTx(ctx context.Context) error
// SetMetadata sets a metadata key to a JSON value.
SetMetadata(ctx context.Context, key string, value []byte) error
// Metadata obtains the JSON value from a metadata key.
Metadata(ctx context.Context, key string) ([]byte, error)
}
Service defines a minimal exec database service.
type Transaction ¶
type Transaction struct {
AccessList map[string][][]byte
BlockHeight uint32
BlockHash []byte
ContractAddress *[]byte
Index uint32
Type uint64
From []byte
GasLimit uint32
GasPrice uint64
GasUsed uint32
Hash []byte
Input []byte
MaxFeePerGas *uint64
MaxPriorityFeePerGas *uint64
Nonce uint64
R *big.Int
S *big.Int
Status uint32
To *[]byte
V *big.Int
Value *big.Int
}
Transaction holds information about a transaction.
type TransactionAccessListEntry ¶ added in v0.3.1
type TransactionAccessListEntry struct {
TransactionHash []byte
BlockHeight uint32
Address []byte
StorageKeys [][]byte
}
TransactionAccessListEntry holds information about a transaction access list.
type TransactionBalanceChange ¶
type TransactionBalanceChange struct {
TransactionHash []byte
BlockHeight uint32
Address []byte
Old *big.Int
New *big.Int
}
TransactionBalanceChange holds information about a balance change as a result of a transaction.
type TransactionFilter ¶
type TransactionFilter struct {
// Limit is the maximum number of transactions to return.
// If nil then there is no limit.
Limit *uint32
// Order is either OrderEarliest, in which case the earliest results
// that match the filter are returned, or OrderLatest, in which case the
// latest results that match the filter are returned.
// The default is OrderEarliest.
Order Order
// From is the height of the earliest block from which to fetch transactions.
// If nil then there is no earliest block.
From *uint32
// To is the height of the latest block from which to fetch transactions.
// If nil then there is no latest block.
To *uint32
// Sender is the address of the sender field in the transaction.
// If nil then no filter is applied
Sender *[]byte
// Recipient is the address of the recipient field in the transaction.
// If nil then no filter is applied
Recipient *[]byte
}
TransactionFilter defines a filter for fetching transactions. Filter elements are ANDed together. Results are always returned in ascending (block height, transaction index) order.
type TransactionStateDiff ¶
type TransactionStateDiff struct {
BalanceChanges []*TransactionBalanceChange
StorageChanges []*TransactionStorageChange
}
TransactionStateDiff holds information about state differences as a result of a transaction.
type TransactionStateDiffsProvider ¶ added in v0.3.1
type TransactionStateDiffsProvider interface {
// TransactionStateDiff returns transaction state diffs for the supplied hash.
TransactionStateDiff(ctx context.Context, hash []byte) (*TransactionStateDiff, error)
}
TransactionStateDiffsProvider defines function to provide transaction state diff information.
type TransactionStateDiffsSetter ¶
type TransactionStateDiffsSetter interface {
Service
// SetTransactionStateDiff sets a transaction's state differences.
SetTransactionStateDiff(ctx context.Context, stateDiff *TransactionStateDiff) error
// SetTransactionStateDiffs sets multiple transactions' state differences efficiently.
SetTransactionStateDiffs(ctx context.Context, stateDiffs []*TransactionStateDiff) error
}
TransactionStateDiffsSetter defines functions to create and update state differences.
type TransactionStorageChange ¶
type TransactionStorageChange struct {
TransactionHash []byte
BlockHeight uint32
Address []byte
StorageAddress []byte
Value []byte
}
TransactionStorageChange holds information about a storage change as a result of a transaction.
type TransactionsProvider ¶
type TransactionsProvider interface {
// Transactions returns transactions matching the supplied filter.
Transactions(ctx context.Context, filter *TransactionFilter) ([]*Transaction, error)
// Transaction returns the transaction matching the supplied hash.
Transaction(ctx context.Context, hash []byte) (*Transaction, error)
}
TransactionsProvider defines functions to provide transaction information.
type TransactionsSetter ¶
type TransactionsSetter interface {
Service
// SetTransaction sets a transaction.
SetTransaction(ctx context.Context, transaction *Transaction) error
// SetTransactions sets multiple transactions efficiently.
SetTransactions(ctx context.Context, transactions []*Transaction) error
}
TransactionsSetter defines functions to create and update transactions.