types

package
v0.0.0-...-2da98db Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LastBlockNumID = 0xBEEF

Variables

This section is empty.

Functions

func BytesToEthHex

func BytesToEthHex(b []byte) string

EthHexToBytes converts an Ethereum hex string to bytes

func FromReceiptDBType

func FromReceiptDBType(receipt ReceiptDB) (*ethtypes.Receipt, error)

FromReceiptDBType : Converts a ReceiptDB type to an Ethereum receipt

func FromTransactionDBType

func FromTransactionDBType(transaction TransactionDB) (*ethtypes.Transaction, error)

FromTransactionDBType : Converts a TransactionDB type to an Ethereum transaction

func FromTransactionResultDB

func FromTransactionResultDB(txResult TransactionResultDB) (btcjson.GetTransactionResult, error)

Types

type DynamicTicker

type DynamicTicker struct {
	// contains filtered or unexported fields
}

DynamicTicker is a ticker that can have its interval updated

func NewDynamicTicker

func NewDynamicTicker(name string, interval uint64) (*DynamicTicker, error)

NewDynamicTicker creates a new DynamicTicker

func (*DynamicTicker) C

func (t *DynamicTicker) C() <-chan time.Time

C returns the channel of the ticker

func (*DynamicTicker) Stop

func (t *DynamicTicker) Stop()

Stop stops the ticker

func (*DynamicTicker) UpdateInterval

func (t *DynamicTicker) UpdateInterval(newInterval uint64, logger zerolog.Logger)

UpdateInterval updates the interval of the ticker

type LastBlockSQLType

type LastBlockSQLType struct {
	gorm.Model
	Num uint64
}

func ToLastBlockSQLType

func ToLastBlockSQLType(lastBlock uint64) *LastBlockSQLType

ToLastBlockSQLType : Converts a last block number to a LastBlockSQLType

type OutboundHashSQLType

type OutboundHashSQLType struct {
	gorm.Model
	Key  string
	Hash string
}

func ToOutboundHashSQLType

func ToOutboundHashSQLType(hash string, key string) OutboundHashSQLType

type ReceiptDB

type ReceiptDB struct {
	// Consensus fields: These fields are defined by the Yellow Paper
	Type              uint8
	PostState         []byte
	Status            uint64
	CumulativeGasUsed uint64
	Bloom             []byte
	Logs              []byte

	// Implementation fields: These fields are added by geth when processing a transaction.
	// They are stored in the chain database.
	TxHash          common.Hash
	ContractAddress common.Address
	GasUsed         uint64

	// Inclusion information: These fields provide information about the inclusion of the
	// transaction corresponding to this receipt.
	BlockHash        common.Hash
	BlockNumber      *big.Int `gorm:"embedded"`
	TransactionIndex uint
}

ReceiptDB : A modified receipt struct that the relational mapping can translate

func ToReceiptDBType

func ToReceiptDBType(receipt *ethtypes.Receipt) (ReceiptDB, error)

ToReceiptDBType : Converts an Ethereum receipt to a ReceiptDB type

type ReceiptSQLType

type ReceiptSQLType struct {
	gorm.Model
	Identifier string
	Receipt    ReceiptDB `gorm:"embedded"`
}

func ToReceiptSQLType

func ToReceiptSQLType(receipt *ethtypes.Receipt, index string) (*ReceiptSQLType, error)

ToReceiptSQLType : Converts an Ethereum receipt to a ReceiptSQLType

type Status

type Status struct {
	BTCNumberOfUTXOs int `json:"btc_number_of_utxos"`
}

Status type for telemetry. More fields can be added as needed

type TransactionDB

type TransactionDB struct {
	// Data that can be used for queries
	Type    byte
	ChainID *big.Int `gorm:"embedded"`
	Nonce   uint64
	To      *common.Address
	Hash    common.Hash

	// Serialized go-ethereum transaction
	TransactionData []byte
}

TransactionDB : A modified Transaction struct that the relational mapping can translate. Inner transaction data is defined as an interface from eth types, so it will be serialized and stored as bytes.

func ToTransactionDBType

func ToTransactionDBType(transaction *ethtypes.Transaction) (TransactionDB, error)

ToTransactionDBType : Converts an Ethereum transaction to a TransactionDB type

type TransactionResultDB

type TransactionResultDB struct {
	Amount          float64
	Fee             float64
	Confirmations   int64
	BlockHash       string
	BlockIndex      int64
	BlockTime       int64
	TxID            string
	WalletConflicts []byte
	Time            int64
	TimeReceived    int64
	Details         []byte // btcjson.GetTransactionDetailsResult
	Hex             string
}

func ToTransactionResultDB

func ToTransactionResultDB(txResult btcjson.GetTransactionResult) (TransactionResultDB, error)

type TransactionResultSQLType

type TransactionResultSQLType struct {
	gorm.Model
	Key string
	Tx  TransactionResultDB `gorm:"embedded"`
}

func ToTransactionResultSQLType

func ToTransactionResultSQLType(txResult btcjson.GetTransactionResult, key string) (TransactionResultSQLType, error)

type TransactionSQLType

type TransactionSQLType struct {
	gorm.Model
	Identifier  string
	Transaction TransactionDB `gorm:"embedded"`
}

func ToTransactionSQLType

func ToTransactionSQLType(transaction *ethtypes.Transaction, index string) (*TransactionSQLType, error)

ToTransactionSQLType : Converts an Ethereum transaction to a TransactionSQLType

Jump to

Keyboard shortcuts

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