consts

package
v0.1.42 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryInterval        = 3 * time.Second
	DefaultMsgBuffer     = 1000
	DefaultBlocksPerScan = uint64(100)
	MaxBlocksPerScan     = uint64(10000000)
)

Variables

View Source
var (
	ErrNoAnyKeyStores       = errors.New("No any keystores")
	ErrMessagePrivateKeyNil = errors.New("PrivateKey is nil")
)

Functions

func DecodeJsonRpcError added in v0.1.1

func DecodeJsonRpcError(err error, evmABI abi.ABI) error

Decode json rpc errors and provide additional information using abi.

Types

type JsonRpcError

type JsonRpcError struct {
	Code    JsonRpcErrorCode `json:"code"`
	Message string           `json:"message"`
	Data    interface{}      `json:"data,omitempty"`

	// Provides additional information for json rpc error.
	// It's not standard for JSON RPC spec.
	DecodedData interface{} `json:"decoded_data,omitempty"`
	RawError    string      `json:"raw_error"`
	Abi         abi.ABI     `json:"-"`

	// RevertReason stores the raw revert reason string extracted from Error(string) format
	// This is useful when the revert reason contains binary data (e.g., address bytes)
	RevertReason string `json:"revert_reason,omitempty"`
	// IsRevertError indicates whether this error is a revert error (Error(string) format)
	IsRevertError bool `json:"is_revert_error,omitempty"`
}

func (*JsonRpcError) Error

func (e *JsonRpcError) Error() string

func (*JsonRpcError) ErrorCode

func (err *JsonRpcError) ErrorCode() JsonRpcErrorCode

func (*JsonRpcError) ErrorData

func (err *JsonRpcError) ErrorData() interface{}

func (*JsonRpcError) GetRevertReason added in v0.1.36

func (err *JsonRpcError) GetRevertReason() string

GetRevertReason returns the raw revert reason string extracted from Error(string) format. This can be used to extract binary data (e.g., address bytes) from revert errors.

type JsonRpcErrorCode added in v0.1.1

type JsonRpcErrorCode int
const (
	// Standard errors
	JsonRpcErrorCodeParseError      JsonRpcErrorCode = -32700 // The JSON request is invalid, this can be due to syntax errors.
	JsonRpcErrorCodeInvalidRequest  JsonRpcErrorCode = -32600 // The JSON request is possibly malformed.
	JsonRpcErrorCodeMethodNotFound  JsonRpcErrorCode = -32601 // The method does not exist, often due to a typo in the method name or the method not being supported.
	JsonRpcErrorCodeInvalidArgument JsonRpcErrorCode = -32602 // Invalid method parameters. For example, "error":{"code":-32602,"message":"invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go value of type common.Hash"} indicates the 0x prefix is missing from the hexadecimal address.
	JsonRpcErrorCodeInternalError   JsonRpcErrorCode = -32603 // An internal JSON-RPC error, often caused by a bad or invalid payload.

	// Non-standard errors for infura
	JsonRpcErrorCodeInvalidInput               JsonRpcErrorCode = -32000 // Missing or invalid parameters, possibly due to server issues or a block not being processed yet.
	JsonRpcErrorCodeResourceNotFound           JsonRpcErrorCode = -32001 // The requested resource cannot be found, possibly when calling an unsupported method.
	JsonRpcErrorCodeResourceUnavailable        JsonRpcErrorCode = -32002 // The requested resource is not available.
	JsonRpcErrorCodeTransactionRejected        JsonRpcErrorCode = -32003 // The transaction could not be created.
	JsonRpcErrorCodeMethodNotSupported         JsonRpcErrorCode = -32004 // The requested method is not implemented.
	JsonRpcErrorCodeLimitExceeded              JsonRpcErrorCode = -32005 // The request exceeds your request limit. For more information, refer to Avoid rate limiting.
	JsonRpcErrorCodeJsonRpcVersionNotSupported JsonRpcErrorCode = -32006 // The version of the JSON-RPC protocol is not supported.
)

type RevertError

type RevertError struct {
	Id            string
	FuncSignature string
	Params        []interface{}
}

func (RevertError) Error

func (e RevertError) Error() string

Jump to

Keyboard shortcuts

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