Documentation
¶
Index ¶
- Constants
- func RPCMarshalHeader(block *models.BlockEMessage) map[string]interface{}
- type AccountResult
- type BlockNumber
- type BlockNumberOrHash
- type FilterQuery
- type OverrideAccount
- type PublicBlockChainAPI
- func (api *PublicBlockChainAPI) Accounts() []common.Address
- func (api *PublicBlockChainAPI) BlockNumber(context.Context) hexutil.Uint64
- func (api *PublicBlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash BlockNumberOrHash, ...) (hexutil.Bytes, error)
- func (api *PublicBlockChainAPI) ChainId() (*hexutil.Big, error)
- func (api *PublicBlockChainAPI) Coinbase() string
- func (api *PublicBlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *BlockNumberOrHash) (hexutil.Uint64, error)
- func (api *PublicBlockChainAPI) GasPrice() (*hexutil.Big, error)
- func (api *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash BlockNumberOrHash) (*hexutil.Big, error)
- func (api *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (api *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number BlockNumber, fulltx bool) (map[string]interface{}, error)
- func (api *PublicBlockChainAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (api *PublicBlockChainAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr BlockNumber) *hexutil.Uint
- func (api *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash BlockNumberOrHash) (hexutil.Bytes, error)
- func (api *PublicBlockChainAPI) GetLogs(ctx context.Context, query FilterQuery) ([]*models.Log, error)
- func (api *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, ...) (*AccountResult, error)
- func (api *PublicBlockChainAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
- func (api *PublicBlockChainAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr BlockNumber, index hexutil.Uint) *RPCTransaction
- func (api *PublicBlockChainAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
- func (api *PublicBlockChainAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash BlockNumberOrHash) (*hexutil.Uint64, error)
- func (api *PublicBlockChainAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (api *PublicBlockChainAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error)
- type PublicNetAPI
- type PublicWeb3API
- type RPCTransaction
- type StateOverride
- type StorageResult
- type TransactionArgs
Constants ¶
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 (*PublicBlockChainAPI) GetBlockByNumber ¶
func (api *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number BlockNumber, fulltx bool) (map[string]interface{}, error)
func (*PublicBlockChainAPI) GetBlockTransactionCountByHash ¶
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 (*PublicBlockChainAPI) SendRawTransaction ¶
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 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.