Documentation
¶
Index ¶
- Constants
- Variables
- func AddressHex(address common.Address) string
- func BytesTo0xHex(data []byte) string
- func BytesToHex(data []byte) string
- func DuplicateError(err error) bool
- func EthTransferEvent(b *types.Block, log *types.TransferLog) *model.Transfer
- func HashHex(hash common.Hash) string
- func Header(b *types.Block) *model.Header
- func Hex(str string) string
- func HexToBytes(hex string) []byte
- func IsLatestBlock(blockNumber int64) bool
- func NotFoundError(err error) bool
- func ParseTd(ltd *model.TotalDifficulty) (*big.Int, error)
- func Receipt(b *types.Block, receipt *types.Receipt) (*model.Receipt, error)
- func StringToHex(data string) string
- func TotalDifficulty(b *types.Block, td *big.Int) *model.TotalDifficulty
- func Transaction(b *types.Block, tx *types.Transaction) (*model.Transaction, error)
Constants ¶
const (
ErrCodeDuplicateKey = 1062
)
Variables ¶
var ( // ErrWrongSigner is returned if it's a wrong signer ErrWrongSigner = errors.New("wrong signer") // ErrInconsistentRoot is returned if the block and dump states have different root ErrInconsistentRoot = errors.New("inconsistent root") // ErrInconsistentStates is returned if the number of blocks, dumps or receipts are different ErrInconsistentStates = errors.New("inconsistent states") // ErrInvalidTD is returned when a block has invalid TD ErrInvalidTD = errors.New("invalid TD") // ErrInvalidReceiptLog is returned if it's a invalid receipt log ErrInvalidReceiptLog = errors.New("invalid receipt log") // ErrHasPrevBalance is returned if an account has a previous balance when it's a new subscription ErrHasPrevBalance = errors.New("missing previous balance") // ErrMissingPrevBalance is returned if an account is missing previous balance when it's an old subscription ErrMissingPrevBalance = errors.New("missing previous balance") )
Functions ¶
func AddressHex ¶
AddressHex returns an address hex and lower-case string without '0x'
func BytesTo0xHex ¶
BytesTo0xHex returns a hex representation (with '0x') of a byte array
func BytesToHex ¶
BytesToHex returns a hex representation (lower-case string without '0x') of a byte array
func DuplicateError ¶
DuplicateError checks whether it's a duplicate key error
func EthTransferEvent ¶
EthTransferEvent converts eth transfer log to eth tranfer event
func HexToBytes ¶
HexToBytes returns byte array of a hex string (with or without '0x')
func IsLatestBlock ¶
IsLatestBlock returns true if blockNumber < 0 and false otherwise.
func NotFoundError ¶
NotFoundError checks whether it's a not found error
func StringToHex ¶
StringToHex returns a hex representation (lower-case string without '0x') of a string
func TotalDifficulty ¶
TotalDifficulty creates a db struct for an ethereum block
func Transaction ¶
func Transaction(b *types.Block, tx *types.Transaction) (*model.Transaction, error)
Transaction converts ethereum transaction to db transaction
Types ¶
This section is empty.