api

package
v0.0.0-...-a968a3f Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PendingBlockNumber  = BlockNumber(-2)
	LatestBlockNumber   = BlockNumber(-1)
	EarliestBlockNumber = BlockNumber(0)
)

Variables

This section is empty.

Functions

func RPCMarshalHeader

func RPCMarshalHeader(block *models.BlockEMessage) map[string]interface{}

Types

type AccountResult

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

type BlockNumber

type BlockNumber int64

func (BlockNumber) Int64

func (bn BlockNumber) Int64() int64

func (BlockNumber) MarshalText

func (bn BlockNumber) MarshalText() ([]byte, error)

func (*BlockNumber) UnmarshalJSON

func (bn *BlockNumber) UnmarshalJSON(data []byte) error

type BlockNumberOrHash

type BlockNumberOrHash struct {
	BlockNumber      *BlockNumber `json:"blockNumber,omitempty"`
	BlockHash        *common.Hash `json:"blockHash,omitempty"`
	RequireCanonical bool         `json:"requireCanonical,omitempty"`
}

func (*BlockNumberOrHash) UnmarshalJSON

func (bnh *BlockNumberOrHash) UnmarshalJSON(data []byte) error

type FilterQuery

type FilterQuery struct {
	BlockHash *common.Hash     // used by eth_getLogs, return logs only from block with this hash
	FromBlock *big.Int         // beginning of the queried range, nil means genesis block
	ToBlock   *big.Int         // end of the range, nil means latest block
	Addresses []common.Address // restricts matches to events created by specific contracts
	Topics    [][]common.Hash
}

FilterQuery contains options for contract log filtering.

func (*FilterQuery) UnmarshalJSON

func (args *FilterQuery) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *args fields with given data.

type OverrideAccount

type OverrideAccount struct {
	Nonce     *hexutil.Uint64              `json:"nonce"`
	Code      *hexutil.Bytes               `json:"code"`
	Balance   **hexutil.Big                `json:"balance"`
	State     *map[common.Hash]common.Hash `json:"state"`
	StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
}

OverrideAccount indicates the overriding fields of account during the execution of a message call. Note, state and stateDiff can't be specified at the same time. If state is set, message execution will only use the data in the given state. Otherwise if statDiff is set, all diff will be applied first and then execute the call message.

type PublicBlockChainAPI

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

PublicBlockChainAPI provides an API to access the Ethereum blockchain. It offers only methods that operate on public data that is freely available to anyone.

func NewPublicBlockChainAPI

func NewPublicBlockChainAPI(nmanager models.NetworkManager, dmanager models.DataManager,
	engine models.Engine, eventer models.Eventer) *PublicBlockChainAPI

func (*PublicBlockChainAPI) Accounts

func (api *PublicBlockChainAPI) Accounts() []common.Address

func (*PublicBlockChainAPI) BlockNumber

func (api *PublicBlockChainAPI) BlockNumber(context.Context) hexutil.Uint64

func (*PublicBlockChainAPI) Call

func (api *PublicBlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) ChainId

func (api *PublicBlockChainAPI) ChainId() (*hexutil.Big, error)

func (*PublicBlockChainAPI) Coinbase

func (api *PublicBlockChainAPI) Coinbase() string

func (*PublicBlockChainAPI) EstimateGas

func (api *PublicBlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *BlockNumberOrHash) (hexutil.Uint64, error)

func (*PublicBlockChainAPI) GasPrice

func (api *PublicBlockChainAPI) GasPrice() (*hexutil.Big, error)

func (*PublicBlockChainAPI) GetBalance

func (api *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash BlockNumberOrHash) (*hexutil.Big, error)

func (*PublicBlockChainAPI) GetBlockByHash

func (api *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetBlockByNumber

func (api *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number BlockNumber, fulltx bool) (map[string]interface{}, error)

func (*PublicBlockChainAPI) GetBlockTransactionCountByHash

func (api *PublicBlockChainAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint

func (*PublicBlockChainAPI) GetBlockTransactionCountByNumber

func (api *PublicBlockChainAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr BlockNumber) *hexutil.Uint

func (*PublicBlockChainAPI) GetCode

func (api *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash BlockNumberOrHash) (hexutil.Bytes, error)

func (*PublicBlockChainAPI) GetLogs

func (api *PublicBlockChainAPI) GetLogs(ctx context.Context, query FilterQuery) ([]*models.Log, error)

func (*PublicBlockChainAPI) GetProof

func (api *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash BlockNumberOrHash) (*AccountResult, error)

func (*PublicBlockChainAPI) GetTransactionByBlockHashAndIndex

func (api *PublicBlockChainAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction

func (*PublicBlockChainAPI) GetTransactionByBlockNumberAndIndex

func (api *PublicBlockChainAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr BlockNumber, index hexutil.Uint) *RPCTransaction

func (*PublicBlockChainAPI) GetTransactionByHash

func (api *PublicBlockChainAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)

func (*PublicBlockChainAPI) GetTransactionCount

func (api *PublicBlockChainAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash BlockNumberOrHash) (*hexutil.Uint64, error)

func (*PublicBlockChainAPI) GetTransactionReceipt

func (api *PublicBlockChainAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)

func (*PublicBlockChainAPI) SendRawTransaction

func (api *PublicBlockChainAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error)

type PublicNetAPI

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

func NewPublicNetAPI

func NewPublicNetAPI(dmanager models.DataManager) *PublicNetAPI

func (*PublicNetAPI) Listening

func (s *PublicNetAPI) Listening() bool

func (*PublicNetAPI) Version

func (s *PublicNetAPI) Version() string

type PublicWeb3API

type PublicWeb3API struct{}

PublicWeb3API offers helper utils

func (*PublicWeb3API) ClientVersion

func (api *PublicWeb3API) ClientVersion() string

ClientVersion returns the node name

type RPCTransaction

type RPCTransaction struct {
	BlockHash        *common.Hash       `json:"blockHash"`
	BlockNumber      *hexutil.Big       `json:"blockNumber"`
	From             common.Address     `json:"from"`
	Gas              hexutil.Uint64     `json:"gas"`
	GasPrice         *hexutil.Big       `json:"gasPrice"`
	GasFeeCap        *hexutil.Big       `json:"maxFeePerGas,omitempty"`
	GasTipCap        *hexutil.Big       `json:"maxPriorityFeePerGas,omitempty"`
	Hash             common.Hash        `json:"hash"`
	Input            hexutil.Bytes      `json:"input"`
	Nonce            hexutil.Uint64     `json:"nonce"`
	To               *common.Address    `json:"to"`
	TransactionIndex *hexutil.Uint64    `json:"transactionIndex"`
	Value            *hexutil.Big       `json:"value"`
	Type             hexutil.Uint64     `json:"type"`
	Accesses         *models.AccessList `json:"accessList,omitempty"`
	ChainID          *hexutil.Big       `json:"chainId,omitempty"`
	V                *hexutil.Big       `json:"v"`
	R                *hexutil.Big       `json:"r"`
	S                *hexutil.Big       `json:"s"`
}

RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction

func GenRpcTxRes

func GenRpcTxRes(tx *models.Transaction, txI *models.TXIndex, recepit *models.Receipt) (*RPCTransaction, error)

type StateOverride

type StateOverride map[common.Address]OverrideAccount

StateOverride is the collection of overridden accounts.

type StorageResult

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

type TransactionArgs

type TransactionArgs struct {
	From                 *common.Address    `json:"from"`
	To                   *common.Address    `json:"to"`
	Gas                  *hexutil.Uint64    `json:"gas"`
	GasPrice             *hexutil.Big       `json:"gasPrice"`
	MaxFeePerGas         *hexutil.Big       `json:"maxFeePerGas"`
	MaxPriorityFeePerGas *hexutil.Big       `json:"maxPriorityFeePerGas"`
	Value                *hexutil.Big       `json:"value"`
	Nonce                *hexutil.Uint64    `json:"nonce"`
	Data                 *hexutil.Bytes     `json:"data"` // data include R, S, V and orther filed
	Input                *hexutil.Bytes     `json:"input"`
	AccessList           *models.AccessList `json:"accessList,omitempty"`
	ChainID              *hexutil.Big       `json:"chainId,omitempty"`
}

TransactionArgs represents the arguments to construct a new transaction or a message call.

Jump to

Keyboard shortcuts

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