evmcaller

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnexpectedError = iota

	GetEVMHeaderByHashError
	GetEVMHeaderByHeightError
	GetEVMBlockHeightError
	GetEVMHeaderResultFromDBError
)
View Source
const CacheLiveTime = 5 * time.Minute

Variables

View Source
var ErrCodeMessage = map[int]struct {
	Code    int
	Message string
}{
	UnexpectedError: {-16000, "Unexpected error"},

	GetEVMHeaderByHashError:       {-16001, "Get evm header by block hash error"},
	GetEVMHeaderByHeightError:     {-16002, "Get evm header by block height error"},
	GetEVMBlockHeightError:        {-16003, "Get latest evm block height error"},
	GetEVMHeaderResultFromDBError: {-16004, "Get evm header result from DB error"},
}
View Source
var Logger = EVMCallerLogger{}

Global instant to use

Functions

func CheckBlockFinality

func CheckBlockFinality(
	evmHeader types.Header,
	evmBlockHash rCommon.Hash,
	hosts []string,
	minConfirmationBlocks int,
) (bool, bool, error)

func GetEVMHeaderByHash

func GetEVMHeaderByHash(
	evmBlockHash rCommon.Hash,
	host string,
) (*types.Header, error)

func GetEVMHeaderByNumber

func GetEVMHeaderByNumber(blockNumber *big.Int, host string) (*types.Header, error)

func GetMostRecentEVMBlockHeight

func GetMostRecentEVMBlockHeight(host string) (*big.Int, error)

GetMostRecentEVMBlockHeight get most recent block height on Ethereum/BSC/PLG

func InitCacher

func InitCacher()

Types

type EVMCallerError

type EVMCallerError struct {
	Code    int    // The code to send with reject messages
	Message string // Human readable message of the issue
	Err     error
}

func NewEVMCallerError

func NewEVMCallerError(key int, err error, params ...interface{}) *EVMCallerError

func (EVMCallerError) Error

func (e EVMCallerError) Error() string

Error satisfies the error interface and prints human-readable errors.

type EVMCallerLogger

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

func (*EVMCallerLogger) Init

func (metricLogger *EVMCallerLogger) Init(inst common.Logger)

type EVMHeaderResult

type EVMHeaderResult struct {
	Header      types.Header
	IsForked    bool
	IsFinalized bool
}

func GetEVMHeaderResult

func GetEVMHeaderResult(
	evmBlockHash rCommon.Hash,
	hosts []string,
	minConfirmationBlocks int,
	networkPrefix string,
) (*EVMHeaderResult, error)

func GetEVMHeaderResultMultipleHosts

func GetEVMHeaderResultMultipleHosts(
	evmBlockHash rCommon.Hash,
	hosts []string,
	minConfirmationBlocks int,
) (*EVMHeaderResult, error)

func NewEVMHeaderResult

func NewEVMHeaderResult() *EVMHeaderResult

type GetEVMBlockNumRes

type GetEVMBlockNumRes struct {
	rpccaller.RPCBaseRes
	Result string `json:"result"`
}

type GetEVMHeaderByHashRes

type GetEVMHeaderByHashRes struct {
	rpccaller.RPCBaseRes
	Result *types.Header `json:"result"`
}

type GetEVMHeaderByNumberRes

type GetEVMHeaderByNumberRes struct {
	rpccaller.RPCBaseRes
	Result *types.Header `json:"result"`
}

Jump to

Keyboard shortcuts

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