Documentation ¶
Index ¶
- type Block
- type BlocksSetter
- type Event
- type EventFilter
- type EventsProvider
- type EventsSetter
- type Order
- type Service
- type Transaction
- type TransactionBalanceChange
- type TransactionFilter
- type TransactionStateDiff
- 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 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. 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 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. 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 TransactionStateDiffsSetter ¶
type TransactionStateDiffsSetter interface { Service // SetTransactionStateDiff sets a transaction's state differences. SetTransactionStateDiff(ctx context.Context, stateDiff *TransactionStateDiff) error // SetTransactionStateDiff 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) }
TransactionsProvider defines functions to provide transaction information.
type TransactionsSetter ¶
type TransactionsSetter interface { Service // SetTransaction sets a transaction. SetTransaction(ctx context.Context, transaction *Transaction) error // SetTransaction sets multiple transactions efficiently. SetTransactions(ctx context.Context, transactions []*Transaction) error }
TransactionsSetter defines functions to create and update transactions.