eth

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupportApiError = errors.New("unsupported interface")
)

Functions

func DoCall

func DoCall(ctx context.Context, blockNrOrHash *rpctypes.BlockNumberOrHash, evmCfg repo.EVM, api api.CoreAPI, args types.CallArgs, timeout time.Duration, globalGasCap uint64, logger logrus.FieldLogger) (*vm.ExecutionResult, error)

DoCall todo call with historical ledger

func NewRPCTransaction

func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64) *rpctypes.RPCTransaction

NewRPCTransaction returns a transaction that will serialize to the RPC representation

Types

type AccountResult

type AccountResult struct {
	Address      common.Address    `json:"address"`
	AccountProof []string          `json:"accountProof"`
	Balance      *ethhexutil.Big   `json:"balance"`
	CodeHash     common.Hash       `json:"codeHash"`
	Nonce        ethhexutil.Uint64 `json:"nonce"`
	StorageHash  common.Hash       `json:"storageHash"`
	StorageProof []StorageResult   `json:"storageProof"`
}

type AxiomAPI

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

AxiomAPI provides an API to get related info

func NewAxiomAPI

func NewAxiomAPI(rep *repo.Repo, api api.CoreAPI, logger logrus.FieldLogger) *AxiomAPI

func (*AxiomAPI) Accounts

func (api *AxiomAPI) Accounts() (ret []common.Address, err error)

func (*AxiomAPI) FeeHistory

func (api *AxiomAPI) FeeHistory(blockCount rpctypes.DecimalOrHex, lastBlock rpctypes.BlockNumber, rewardPercentiles []float64) (ret *feeHistoryResult, err error)

FeeHistory return feeHistory todo Supplementary feeHsitory

func (*AxiomAPI) GasPrice

func (api *AxiomAPI) GasPrice() *hexutil.Big

GasPrice returns the current gas price based on dynamic adjustment strategy.

func (*AxiomAPI) MaxPriorityFeePerGas

func (api *AxiomAPI) MaxPriorityFeePerGas(ctx context.Context) (ret *hexutil.Big, err error)

MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic transactions. todo Supplementary gas fee

func (*AxiomAPI) Syncing

func (api *AxiomAPI) Syncing() (ret any, err error)

Syncing returns whether or not the current node is syncing with other peers. Returns false if not, or a struct outlining the state of the sync if it is.

type BlockChainAPI

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

BlockChain API provides an API for accessing blockchain data

func NewBlockChainAPI

func NewBlockChainAPI(rep *repo.Repo, api api.CoreAPI, logger logrus.FieldLogger) *BlockChainAPI

func (*BlockChainAPI) BlockNumber

func (api *BlockChainAPI) BlockNumber() (ret ethhexutil.Uint64, err error)

BlockNumber returns the current block number.

func (*BlockChainAPI) Call

func (api *BlockChainAPI) Call(args types.CallArgs, blockNrOrHash *rpctypes.BlockNumberOrHash, _ *map[common.Address]rpctypes.Account) (ret ethhexutil.Bytes, err error)

Call performs a raw contract call.

func (*BlockChainAPI) ChainId

func (api *BlockChainAPI) ChainId() (ret ethhexutil.Uint, err error)

ChainId returns the chain's identifier in hex format

func (*BlockChainAPI) CreateAccessList

func (s *BlockChainAPI) CreateAccessList(args types.CallArgs, blockNrOrHash *rpctypes.BlockNumberOrHash) (*accessListResult, error)

func (*BlockChainAPI) EstimateGas

func (api *BlockChainAPI) EstimateGas(args types.CallArgs, blockNrOrHash *rpctypes.BlockNumberOrHash) (ret ethhexutil.Uint64, err error)

EstimateGas returns an estimate of gas usage for the given smart contract call. It adds 2,000 gas to the returned value instead of using the gas adjustment param from the SDK.

func (*BlockChainAPI) GetBalance

func (api *BlockChainAPI) GetBalance(address common.Address, blockNrOrHash *rpctypes.BlockNumberOrHash) (ret *ethhexutil.Big, err error)

GetBalance returns the provided account's balance, blockNum is ignored.

func (*BlockChainAPI) GetBlockByHash

func (api *BlockChainAPI) GetBlockByHash(hash common.Hash, fullTx bool) (ret map[string]any, err error)

GetBlockByHash returns the block identified by hash.

func (*BlockChainAPI) GetBlockByNumber

func (api *BlockChainAPI) GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (ret map[string]any, err error)

GetBlockByNumber returns the block identified by number.

func (*BlockChainAPI) GetCode

func (api *BlockChainAPI) GetCode(address common.Address, blockNrOrHash *rpctypes.BlockNumberOrHash) (ret ethhexutil.Bytes, err error)

GetCode returns the contract code at the given address, blockNum is ignored.

func (*BlockChainAPI) GetProof

func (api *BlockChainAPI) GetProof(address common.Address, storageKeys []string, blockNrOrHash *rpctypes.BlockNumberOrHash) (ret *AccountResult, err error)

todo GetProof returns the Merkle-proof for a given account and optionally some storage keys.

func (*BlockChainAPI) GetStorageAt

func (api *BlockChainAPI) GetStorageAt(address common.Address, key string, blockNrOrHash *rpctypes.BlockNumberOrHash) (ret ethhexutil.Bytes, err error)

GetStorageAt returns the contract storage at the given address and key, blockNum is ignored.

type StorageResult

type StorageResult struct {
	Key   string          `json:"key"`
	Value *ethhexutil.Big `json:"value"`
	Proof []string        `json:"proof"`
}

type TransactionAPI

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

TransactionAPI provide apis to get and create transaction

func NewTransactionAPI

func NewTransactionAPI(rep *repo.Repo, api api.CoreAPI, logger logrus.FieldLogger) *TransactionAPI

func (*TransactionAPI) GetBlockTransactionCountByHash

func (api *TransactionAPI) GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint

GetBlockTransactionCountByHash returns the number of transactions in the block identified by hash.

func (*TransactionAPI) GetBlockTransactionCountByNumber

func (api *TransactionAPI) GetBlockTransactionCountByNumber(blockNum rpctypes.BlockNumber) *hexutil.Uint

GetBlockTransactionCountByNumber returns the number of transactions in the block identified by its height.

func (*TransactionAPI) GetTransactionByBlockHashAndIndex

func (api *TransactionAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (ret *rpctypes.RPCTransaction, err error)

GetTransactionByBlockHashAndIndex returns the transaction identified by hash and index.

func (*TransactionAPI) GetTransactionByBlockNumberAndIndex

func (api *TransactionAPI) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNumber, idx hexutil.Uint) (ret *rpctypes.RPCTransaction, err error)

GetTransactionByBlockNumberAndIndex returns the transaction identified by number and index.

func (*TransactionAPI) GetTransactionByHash

func (api *TransactionAPI) GetTransactionByHash(hash common.Hash) (ret *rpctypes.RPCTransaction, err error)

GetTransactionByHash returns the transaction identified by hash.

func (*TransactionAPI) GetTransactionCount

func (api *TransactionAPI) GetTransactionCount(address common.Address, blockNrOrHash *rpctypes.BlockNumberOrHash) (ret *hexutil.Uint64, err error)

GetTransactionCount returns the number of transactions at the given address, blockNum is ignored.

func (*TransactionAPI) GetTransactionReceipt

func (api *TransactionAPI) GetTransactionReceipt(hash common.Hash) (ret map[string]any, err error)

GetTransactionReceipt returns the transaction receipt identified by hash.

func (*TransactionAPI) SendRawTransaction

func (api *TransactionAPI) SendRawTransaction(data hexutil.Bytes) (ret common.Hash, err error)

SendRawTransaction send a raw Ethereum transaction.

Directories

Path Synopsis
Package filters implements an ethereum filtering system for block, transactions and log events.
Package filters implements an ethereum filtering system for block, transactions and log events.
Package tracers is a manager for transaction tracing engines.
Package tracers is a manager for transaction tracing engines.

Jump to

Keyboard shortcuts

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