eth

package
v1.31.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0, MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EthSubscribeEventTypeHeads               = "newHeads"
	EthSubscribeEventTypeLogs                = "logs"
	EthSubscribeEventTypePendingTransactions = "newPendingTransactions"
)

Variables

View Source
var (
	ErrChainIndexerDisabled = xerrors.New("chain indexer is disabled; please enable the ChainIndexer to use the ETH RPC API")
	ErrModuleDisabled       = xerrors.New("module disabled, enable with Fevm.EnableEthRPC / LOTUS_FEVM_ENABLEETHRPC")
)

Functions

This section is empty.

Types

type ChainStore

type ChainStore interface {
	// TipSets
	GetHeaviestTipSet() *types.TipSet
	GetTipsetByHeight(ctx context.Context, h abi.ChainEpoch, ts *types.TipSet, prev bool) (*types.TipSet, error)
	GetTipSetFromKey(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
	GetTipSetByCid(ctx context.Context, c cid.Cid) (*types.TipSet, error)
	LoadTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)

	// Messages
	GetSignedMessage(ctx context.Context, c cid.Cid) (*types.SignedMessage, error)
	GetMessage(ctx context.Context, c cid.Cid) (*types.Message, error)
	BlockMsgsForTipset(ctx context.Context, ts *types.TipSet) ([]store.BlockMessages, error)
	MessagesForTipset(ctx context.Context, ts *types.TipSet) ([]types.ChainMsg, error)
	ReadReceipts(ctx context.Context, root cid.Cid) ([]types.MessageReceipt, error)

	// Misc
	ActorStore(ctx context.Context) adt.Store
}

ChainStore is a minimal version of store.ChainStore just for tipsets

type EthBasicAPI

type EthBasicAPI interface {
	Web3ClientVersion(ctx context.Context) (string, error)
	EthChainId(ctx context.Context) (ethtypes.EthUint64, error)
	NetVersion(ctx context.Context) (string, error)
	NetListening(ctx context.Context) (bool, error)
	EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error)
	EthSyncing(ctx context.Context) (ethtypes.EthSyncingResult, error)
	EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error)
}

func NewEthBasicAPI

func NewEthBasicAPI(chainStore ChainStore, syncApi SyncAPI, stateManager StateManager) EthBasicAPI

type EthBasicDisabled

type EthBasicDisabled struct{}

func (EthBasicDisabled) EthAccounts

func (EthBasicDisabled) EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error)

func (EthBasicDisabled) EthChainId

func (EthBasicDisabled) EthProtocolVersion

func (EthBasicDisabled) EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error)

func (EthBasicDisabled) EthSyncing

func (EthBasicDisabled) NetListening

func (EthBasicDisabled) NetListening(ctx context.Context) (bool, error)

func (EthBasicDisabled) NetVersion

func (EthBasicDisabled) NetVersion(ctx context.Context) (string, error)

func (EthBasicDisabled) Web3ClientVersion

func (EthBasicDisabled) Web3ClientVersion(ctx context.Context) (string, error)

type EthEventsAPI

type EthEventsAPI interface {
	EthGetLogs(ctx context.Context, filter *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error)
	EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error)
	EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error)
	EthNewFilter(ctx context.Context, filter *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error)
	EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error)
	EthGetFilterChanges(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error)
	EthGetFilterLogs(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error)
	EthSubscribe(ctx context.Context, params jsonrpc.RawParams) (ethtypes.EthSubscriptionID, error)
	EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error)
}

type EthEventsDisabled

type EthEventsDisabled struct{}

func (EthEventsDisabled) EthGetFilterChanges

func (EthEventsDisabled) EthGetFilterLogs

func (EthEventsDisabled) EthGetLogs

func (EthEventsDisabled) EthNewBlockFilter

func (EthEventsDisabled) EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error)

func (EthEventsDisabled) EthNewFilter

func (EthEventsDisabled) EthNewPendingTransactionFilter

func (EthEventsDisabled) EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error)

func (EthEventsDisabled) EthSubscribe

func (EthEventsDisabled) EthSubscribe(ctx context.Context, params jsonrpc.RawParams) (ethtypes.EthSubscriptionID, error)

func (EthEventsDisabled) EthUninstallFilter

func (EthEventsDisabled) EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error)

func (EthEventsDisabled) EthUnsubscribe

type EthEventsInternal

type EthEventsInternal interface {
	EthEventsAPI

	// GetEthLogsForBlockAndTransaction returns the logs for a block and transaction, it is intended
	// for internal use rather than being exposed via the JSON-RPC API.
	GetEthLogsForBlockAndTransaction(ctx context.Context, blockHash *ethtypes.EthHash, txHash ethtypes.EthHash) ([]ethtypes.EthLog, error)
	// GC runs a garbage collection loop, deleting filters that have not been used within the ttl
	// window, it is intended for internal use rather than being exposed via the JSON-RPC API.
	GC(ctx context.Context, ttl time.Duration)
}

EthEventsInternal extends the EthEvents interface with additional methods that are not exposed on the JSON-RPC API.

func NewEthEventsAPI

func NewEthEventsAPI(
	subscriptionCtx context.Context,
	chainStore ChainStore,
	stateManager StateManager,
	chainIndexer index.Indexer,
	eventFilterManager *filter.EventFilterManager,
	tipSetFilterManager *filter.TipSetFilterManager,
	memPoolFilterManager *filter.MemPoolFilterManager,
	filterStore filter.FilterStore,
	subscriptionManager *EthSubscriptionManager,
	maxFilterHeightRange abi.ChainEpoch,
) EthEventsInternal

type EthFilecoinAPI

type EthFilecoinAPI interface {
	EthAddressToFilecoinAddress(ctx context.Context, ethAddress ethtypes.EthAddress) (address.Address, error)
	FilecoinAddressToEthAddress(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthAddress, error)
}

func NewEthFilecoinAPI

func NewEthFilecoinAPI(chainStore ChainStore, stateManager StateManager) EthFilecoinAPI

type EthGasAPI

type EthGasAPI interface {
	EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error)
	EthFeeHistory(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthFeeHistory, error)
	EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error)
	EthEstimateGas(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthUint64, error)
	EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error)
}

func NewEthGasAPI

func NewEthGasAPI(chainStore ChainStore, stateManager StateManager, messagePool MessagePool, gasApi GasAPI) EthGasAPI

type EthGasDisabled

type EthGasDisabled struct{}

func (EthGasDisabled) EthCall

func (EthGasDisabled) EthEstimateGas

func (EthGasDisabled) EthEstimateGas(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthUint64, error)

func (EthGasDisabled) EthFeeHistory

func (EthGasDisabled) EthFeeHistory(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthFeeHistory, error)

func (EthGasDisabled) EthGasPrice

func (EthGasDisabled) EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error)

func (EthGasDisabled) EthMaxPriorityFeePerGas

func (EthGasDisabled) EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error)

type EthLookupAPI

type EthLookupAPI interface {
	EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error)
	EthGetStorageAt(ctx context.Context, ethAddr ethtypes.EthAddress, position ethtypes.EthBytes, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error)
	EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBigInt, error)
}

func NewEthLookupAPI

func NewEthLookupAPI(
	chainStore ChainStore,
	stateManager StateManager,
	syncApi SyncAPI,
	stateBlockstore dtypes.StateBlockstore,
) EthLookupAPI

type EthLookupDisabled

type EthLookupDisabled struct{}

func (EthLookupDisabled) EthChainId

func (EthLookupDisabled) EthGetBalance

func (EthLookupDisabled) EthGetCode

func (EthLookupDisabled) EthGetStorageAt

type EthSendAPI

type EthSendAPI interface {
	EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error)
	EthSendRawTransactionUntrusted(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error)
}

func NewEthSendAPI

func NewEthSendAPI(mpoolApi MpoolAPI, chainIndexer index.Indexer) EthSendAPI

type EthSendDisabled

type EthSendDisabled struct{}

func (EthSendDisabled) EthSendRawTransaction

func (EthSendDisabled) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error)

func (EthSendDisabled) EthSendRawTransactionUntrusted

func (EthSendDisabled) EthSendRawTransactionUntrusted(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error)

type EthSubscriptionManager

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

func NewEthSubscriptionManager

func NewEthSubscriptionManager(chainStore ChainStore, stateManager StateManager) *EthSubscriptionManager

func (*EthSubscriptionManager) StartSubscription

func (e *EthSubscriptionManager) StartSubscription(ctx context.Context, out ethSubscriptionCallback, dropFilter func(context.Context, filter.Filter) error) (*ethSubscription, error)

func (*EthSubscriptionManager) StopSubscription

type EthTraceAPI

type EthTraceAPI interface {
	EthTraceBlock(ctx context.Context, blkNum string) ([]*ethtypes.EthTraceBlock, error)
	EthTraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error)
	EthTraceTransaction(ctx context.Context, txHash string) ([]*ethtypes.EthTraceTransaction, error)
	EthTraceFilter(ctx context.Context, filter ethtypes.EthTraceFilterCriteria) ([]*ethtypes.EthTraceFilterResult, error)
}

func NewEthTraceAPI

func NewEthTraceAPI(
	chainStore ChainStore,
	stateManager StateManager,
	ethTransactionApi EthTransactionAPI,
	ethTraceFilterMaxResults uint64,
) EthTraceAPI

type EthTraceDisabled

type EthTraceDisabled struct{}

func (EthTraceDisabled) EthTraceBlock

func (EthTraceDisabled) EthTraceBlock(ctx context.Context, block string) ([]*ethtypes.EthTraceBlock, error)

func (EthTraceDisabled) EthTraceFilter

func (EthTraceDisabled) EthTraceReplayBlockTransactions

func (EthTraceDisabled) EthTraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error)

func (EthTraceDisabled) EthTraceTransaction

func (EthTraceDisabled) EthTraceTransaction(ctx context.Context, ethTxHash string) ([]*ethtypes.EthTraceTransaction, error)

type EthTransactionAPI

type EthTransactionAPI interface {
	EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error)

	EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error)
	EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error)
	EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error)
	EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error)

	EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error)
	EthGetTransactionByHashLimited(ctx context.Context, txHash *ethtypes.EthHash, limit abi.ChainEpoch) (*ethtypes.EthTx, error)
	EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (*ethtypes.EthTx, error)
	EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum string, txIndex ethtypes.EthUint64) (*ethtypes.EthTx, error)

	EthGetMessageCidByTransactionHash(ctx context.Context, txHash *ethtypes.EthHash) (*cid.Cid, error)
	EthGetTransactionHashByCid(ctx context.Context, cid cid.Cid) (*ethtypes.EthHash, error)
	EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthUint64, error)

	EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*api.EthTxReceipt, error)
	EthGetTransactionReceiptLimited(ctx context.Context, txHash ethtypes.EthHash, limit abi.ChainEpoch) (*api.EthTxReceipt, error)
	EthGetBlockReceipts(ctx context.Context, blkParam ethtypes.EthBlockNumberOrHash) ([]*api.EthTxReceipt, error)
	EthGetBlockReceiptsLimited(ctx context.Context, blkParam ethtypes.EthBlockNumberOrHash, limit abi.ChainEpoch) ([]*api.EthTxReceipt, error)
}

func NewEthTransactionAPI

func NewEthTransactionAPI(
	chainStore ChainStore,
	stateManager StateManager,
	stateApi StateAPI,
	mpoolApi MpoolAPI,
	chainIndexer index.Indexer,
	ethEvents EthEventsInternal,
	blockCacheSize int,
) (EthTransactionAPI, error)

type EthTransactionDisabled

type EthTransactionDisabled struct{}

func (EthTransactionDisabled) EthBlockNumber

func (EthTransactionDisabled) EthGetBlockByHash

func (EthTransactionDisabled) EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error)

func (EthTransactionDisabled) EthGetBlockByNumber

func (EthTransactionDisabled) EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error)

func (EthTransactionDisabled) EthGetBlockReceipts

func (EthTransactionDisabled) EthGetBlockReceipts(ctx context.Context, blockParam ethtypes.EthBlockNumberOrHash) ([]*api.EthTxReceipt, error)

func (EthTransactionDisabled) EthGetBlockReceiptsLimited

func (EthTransactionDisabled) EthGetBlockReceiptsLimited(ctx context.Context, blockParam ethtypes.EthBlockNumberOrHash, limit abi.ChainEpoch) ([]*api.EthTxReceipt, error)

func (EthTransactionDisabled) EthGetBlockTransactionCountByHash

func (EthTransactionDisabled) EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error)

func (EthTransactionDisabled) EthGetBlockTransactionCountByNumber

func (EthTransactionDisabled) EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error)

func (EthTransactionDisabled) EthGetMessageCidByTransactionHash

func (EthTransactionDisabled) EthGetMessageCidByTransactionHash(ctx context.Context, txHash *ethtypes.EthHash) (*cid.Cid, error)

func (EthTransactionDisabled) EthGetTransactionByBlockHashAndIndex

func (EthTransactionDisabled) EthGetTransactionByBlockHashAndIndex(ctx context.Context, blkHash ethtypes.EthHash, txIndex ethtypes.EthUint64) (*ethtypes.EthTx, error)

func (EthTransactionDisabled) EthGetTransactionByBlockNumberAndIndex

func (EthTransactionDisabled) EthGetTransactionByBlockNumberAndIndex(ctx context.Context, blkNum string, txIndex ethtypes.EthUint64) (*ethtypes.EthTx, error)

func (EthTransactionDisabled) EthGetTransactionByHash

func (EthTransactionDisabled) EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error)

func (EthTransactionDisabled) EthGetTransactionByHashLimited

func (EthTransactionDisabled) EthGetTransactionByHashLimited(ctx context.Context, txHash *ethtypes.EthHash, limit abi.ChainEpoch) (*ethtypes.EthTx, error)

func (EthTransactionDisabled) EthGetTransactionCount

func (EthTransactionDisabled) EthGetTransactionHashByCid

func (EthTransactionDisabled) EthGetTransactionHashByCid(ctx context.Context, cid cid.Cid) (*ethtypes.EthHash, error)

func (EthTransactionDisabled) EthGetTransactionReceipt

func (EthTransactionDisabled) EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*api.EthTxReceipt, error)

func (EthTransactionDisabled) EthGetTransactionReceiptLimited

func (EthTransactionDisabled) EthGetTransactionReceiptLimited(ctx context.Context, txHash ethtypes.EthHash, limit abi.ChainEpoch) (*api.EthTxReceipt, error)

type GasAPI

type GasAPI interface {
	GasEstimateGasPremium(ctx context.Context, nblocksincl uint64, sender address.Address, gaslimit int64, ts types.TipSetKey) (types.BigInt, error)
	GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, ts types.TipSetKey) (*types.Message, error)
}

GasAPI is a minimal version of full.GasAPI

type MessagePool

type MessagePool interface {
	PendingFor(ctx context.Context, a address.Address) ([]*types.SignedMessage, *types.TipSet)
	GetConfig() *types.MpoolConfig
}

MessagePool is a minimal version of messagepool.MessagePool

type MpoolAPI

type MpoolAPI interface {
	MpoolPending(ctx context.Context, tsk types.TipSetKey) ([]*types.SignedMessage, error)
	MpoolGetNonce(ctx context.Context, addr address.Address) (uint64, error)
	MpoolPushUntrusted(ctx context.Context, smsg *types.SignedMessage) (cid.Cid, error)
	MpoolPush(ctx context.Context, smsg *types.SignedMessage) (cid.Cid, error)
}

MpoolAPI is a minimal version of full.MpoolAPI

type StateAPI

type StateAPI interface {
	StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
}

StateAPI is a minimal version of full.StateAPI

type StateManager

type StateManager interface {
	GetNetworkVersion(ctx context.Context, height abi.ChainEpoch) network.Version

	TipSetState(ctx context.Context, ts *types.TipSet) (cid.Cid, cid.Cid, error)
	ParentState(ts *types.TipSet) (*state.StateTree, error)
	StateTree(st cid.Cid) (*state.StateTree, error)

	LookupIDAddress(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error)
	LoadActor(ctx context.Context, addr address.Address, ts *types.TipSet) (*types.Actor, error)
	LoadActorRaw(ctx context.Context, addr address.Address, st cid.Cid) (*types.Actor, error)
	ResolveToDeterministicAddress(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error)

	ExecutionTrace(ctx context.Context, ts *types.TipSet) (cid.Cid, []*api.InvocResult, error)
	Call(ctx context.Context, msg *types.Message, ts *types.TipSet) (*api.InvocResult, error)
	CallWithGas(ctx context.Context, msg *types.Message, priorMsgs []types.ChainMsg, ts *types.TipSet, applyTsMessages bool) (*api.InvocResult, error)
	ApplyOnStateWithGas(ctx context.Context, stateCid cid.Cid, msg *types.Message, ts *types.TipSet) (*api.InvocResult, error)

	HasExpensiveForkBetween(parent, height abi.ChainEpoch) bool
}

StateManager is a minimal version of stmgr.StateManager

type SyncAPI

type SyncAPI interface {
	SyncState(ctx context.Context) (*api.SyncState, error)
}

SyncAPI is a minimal version of full.SyncAPI

Jump to

Keyboard shortcuts

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