Documentation
¶
Index ¶
- Constants
- func BytesToEthHex(b []byte) string
- func FromReceiptDBType(receipt ReceiptDB) (*ethtypes.Receipt, error)
- func FromTransactionDBType(transaction TransactionDB) (*ethtypes.Transaction, error)
- type AccountResp
- type DynamicTicker
- type InboundEvent
- type LastBlockSQLType
- type LastTransactionSQLType
- type ReceiptDB
- type ReceiptSQLType
- type Status
- type TransactionDB
- type TransactionSQLType
Constants ¶
const ( // LastBlockNumID is the identifier to access the last block number in the database // Using a specific hex value as a unique identifier LastBlockNumID uint = 0xBEEF // LastTxHashID is the identifier to access the last transaction hash in the database // Using a specific hex value as a unique identifier LastTxHashID uint = 0xBEF0 )
const (
EnvVarLatest = "latest"
)
Variables ¶
This section is empty.
Functions ¶
func BytesToEthHex ¶
BytesToEthHex converts a byte slice to a ethereum hex string with a leading "0x" prefix.
func FromTransactionDBType ¶
func FromTransactionDBType(transaction TransactionDB) (*ethtypes.Transaction, error)
Types ¶
type AccountResp ¶
type AccountResp struct {
Height string `json:"height"`
Result struct {
Value struct {
AccountNumber uint64 `json:"account_number,string"`
Sequence uint64 `json:"sequence,string"`
} `json:"value"`
} `json:"result"`
}
AccountResp the response from thorclient
type DynamicTicker ¶
type DynamicTicker struct {
// contains filtered or unexported fields
}
func NewDynamicTicker ¶
func NewDynamicTicker(name string, interval uint64) (*DynamicTicker, error)
func (*DynamicTicker) C ¶
func (t *DynamicTicker) C() <-chan time.Time
func (*DynamicTicker) Stop ¶
func (t *DynamicTicker) Stop()
func (*DynamicTicker) UpdateInterval ¶
func (t *DynamicTicker) UpdateInterval(newInterval uint64, logger zerolog.Logger)
type InboundEvent ¶
type InboundEvent struct {
// SenderChainID is the chain ID of the sender
SenderChainID int64
// Sender is the sender address
Sender string
// Receiver is the receiver address
Receiver string
// TxOrigin is the origin of the transaction
TxOrigin string
// Value is the amount of token
Amount uint64
// Memo is the memo attached to the inbound
Memo []byte
// BlockNumber is the block number of the inbound
BlockNumber uint64
// TxHash is the hash of the inbound
TxHash string
// Index is the index of the event
Index uint32
// CoinType is the coin type of the inbound
CoinType coin.CoinType
// Asset is the asset of the inbound
Asset string
}
InboundEvent represents an inbound event TODO: we should consider using this generic struct when it applies (e.g. for Bitcoin, Solana, etc.)
type LastBlockSQLType ¶
LastBlockSQLType is a model for storing the last block number
func ToLastBlockSQLType ¶
func ToLastBlockSQLType(lastBlock uint64, blockIndex uint64) *LastBlockSQLType
ToLastBlockSQLType converts a last block number to a LastBlockSQLType
type LastTransactionSQLType ¶
LastTransactionSQLType is a model for storing the last transaction hash
func ToLastTxHashSQLType ¶
func ToLastTxHashSQLType(lastTx string) *LastTransactionSQLType
ToLastTxHashSQLType converts a last transaction hash to a LastTransactionSQLType
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
type ReceiptSQLType ¶
func ToReceiptSQLType ¶
func ToReceiptSQLType(receipt *ethtypes.Receipt, index string) (*ReceiptSQLType, error)
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)
type TransactionSQLType ¶
type TransactionSQLType struct {
gorm.Model
Identifier string
Transaction TransactionDB `gorm:"embedded"`
}
func ToTransactionSQLType ¶
func ToTransactionSQLType(transaction *ethtypes.Transaction, index string) (*TransactionSQLType, error)