execdb

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance added in v0.3.6

type Balance struct {
	Address  types.Address
	Currency string
	Amount   decimal.Decimal
	From     time.Time
}

Balance holds information about a balance.

type BalanceFilter added in v0.3.6

type BalanceFilter struct {
	// Limit is the maximum number of balances to return.
	// If 0 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

	// Currency is the currency to fetch.
	// If nil then there is no currency filter
	Currency string

	// From is the timestamp of the earliest balance to fetch.
	// If nil then there is no earliest balance.
	From *time.Time

	// To is the timestamp of the latest balance to fetch.
	// If nil then there is no latest balance.
	To *time.Time

	// Holders are the holders of the balance.
	// If nil then no filter is applied.
	Holders [][]byte
}

BalanceFilter defines a filter for fetching balances. Filter elements are ANDed together. Results are always returned in ascending holder/timestamp/currency order.

type BalancesProvider added in v0.3.6

type BalancesProvider interface {
	// Balances returns balances matching the supplied filter.
	Balances(ctx context.Context, filter *BalanceFilter) ([]*Balance, error)
}

BalancesProvider defines functions to provide balance information.

type BalancesSetter added in v0.3.6

type BalancesSetter interface {
	Service
	// SetBalance sets a balance.
	SetBalance(ctx context.Context, balance *Balance) error

	// SetBalances sets multiple balances efficiently.
	SetBalances(ctx context.Context, balances []*Balance) error
}

BalancesSetter defines functions to create and update balances.

type Block

type Block struct {
	Height                uint32
	Hash                  []byte
	BaseFee               uint64
	Difficulty            uint64
	ExtraData             []byte
	GasLimit              uint32
	GasUsed               uint32
	FeeRecipient          []byte
	ParentBeaconBlockRoot []byte
	ParentHash            []byte
	Size                  uint32
	StateRoot             []byte
	WithdrawalsRoot       []byte
	Timestamp             time.Time
	TotalDifficulty       *big.Int
	Issuance              *big.Int
	BlobGasUsed           *uint64
	ExcessBlobGas         *uint64
}

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 0 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

	// TimestampTo is the height of the latest block to fetch.
	// If nil then there is no latest block.
	To *uint32

	// From is the timestamp of the earliest block to fetch.
	// If nil then there is no earliest block.
	TimestampFrom *time.Time

	// TimestampTo is the timestamp of the latest block to fetch.
	// If nil then there is no latest block.
	TimestampTo *time.Time

	// FeeRecipients are the fee recipients of the blocks.
	// If nil then there is no fee recipients filter.
	FeeRecipients *[][]byte
}

BlockFilter defines a filter for fetching blocks. Filter elements are ANDed together. Results are always returned in ascending block height order.

type BlockReward added in v0.4.1

type BlockReward struct {
	BlockHash   []byte
	BlockHeight uint32
	Fees        *uint256.Int
	Payments    *uint256.Int
}

BlockReward holds information about the reward paid to the fee recipient in a block.

type BlockRewardFilter added in v0.5.1

type BlockRewardFilter struct {
	// Limit is the maximum number of block rewards to return.
	// If 0 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 reward to fetch.
	// If nil then there is no earliest block.
	From *uint32

	// TimestampTo is the height of the latest block reward to fetch.
	// If nil then there is no latest block.
	To *uint32

	// From is the timestamp of the earliest block reward to fetch.
	// If nil then there is no earliest block.
	TimestampFrom *time.Time

	// TimestampTo is the timestamp of the latest block reward to fetch.
	// If nil then there is no latest block.
	TimestampTo *time.Time
}

BlockRewardFilter defines a filter for fetching block rewards. Filter elements are ANDed together. Results are always returned in ascending block height order.

type BlockRewardsProvider added in v0.5.1

type BlockRewardsProvider interface {
	// BlockRewards returns block rewards matching the supplied filter.
	BlockRewards(ctx context.Context, filter *BlockRewardFilter) ([]*BlockReward, error)
}

BlockRewardsProvider defines functions to provide block reward information.

type BlockRewardsSetter added in v0.4.1

type BlockRewardsSetter interface {
	Service

	// SetBlockRewards sets multiple block rewards efficiently.
	SetBlockRewards(ctx context.Context, rewards []*BlockReward) error
}

BlockRewardsSetter defines functions to create and update block rewards.

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 zero 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).

const (
	// OrderEarliest fetches earliest transactions first.
	OrderEarliest Order = iota
	// OrderLatest fetches latest transactions first.
	OrderLatest
)

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
	MaxFeePerBlobGas     *uint64
	BlobGasPrice         *big.Int
	BlobGasUsed          *uint32
	BlobVersionedHashes  *[][]byte
	Nonce                uint64
	R                    *big.Int
	S                    *big.Int
	Status               uint32
	To                   *[]byte
	V                    *big.Int
	Value                *big.Int
	YParity              *bool
}

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 TransactionBalanceChangeFilter added in v0.4.9

type TransactionBalanceChangeFilter struct {
	// Limit is the maximum number of transactions to return.
	// If zero 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

	// TxHashes are the transaction hashes for which to obtain balance changes.
	// If empty then no filter is applied
	TxHashes [][]byte

	// Addresses are the address for which to obtain balance changes.
	// If empty then no filter is applied
	Addresses [][]byte
}

TransactionBalanceChangeFilter defines a filter for fetching transaction balance changes. Filter elements are ANDed together. Results are always returned in ascending (block height, transaction index) order.

type TransactionBalanceChangesProvider added in v0.4.9

type TransactionBalanceChangesProvider interface {
	// TransactionBalanceChanges returns transaction balance changes matching the supplied filter.
	TransactionBalanceChanges(ctx context.Context, filter *TransactionBalanceChangeFilter) ([]*TransactionBalanceChange, error)
}

TransactionBalanceChangesProvider defines function to provide transaction balance changes.

type TransactionFilter

type TransactionFilter struct {
	// Limit is the maximum number of transactions to return.
	// If 0 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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