eth

package
v0.0.0-...-3da4c06 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPublicEthService

func NewPublicEthService(astra *astra.Astra, namespace string) rpc.API

NewPublicEthService creates a new API for the RPC interface

func NewReceipt

func NewReceipt(tx *types.EthTransaction, blockHash common.Hash, blockNumber, blockIndex uint64, receipt *types.Receipt) (map[string]interface{}, error)

NewReceipt returns the RPC data for a new receipt

Types

type Block

type Block struct {
	Number           *hexutil.Big          `json:"number"`
	Hash             common.Hash           `json:"hash"`
	ParentHash       common.Hash           `json:"parentHash"`
	Nonce            astratypes.BlockNonce `json:"nonce"`
	MixHash          common.Hash           `json:"mixHash"`
	UncleHash        common.Hash           `json:"sha3Uncles"`
	LogsBloom        ethtypes.Bloom        `json:"logsBloom"`
	StateRoot        common.Hash           `json:"stateRoot"`
	Miner            common.Address        `json:"miner"`
	Difficulty       *hexutil.Big          `json:"difficulty"`
	ExtraData        hexutil.Bytes         `json:"extraData"`
	Size             hexutil.Uint64        `json:"size"`
	GasLimit         hexutil.Uint64        `json:"gasLimit"`
	GasUsed          hexutil.Uint64        `json:"gasUsed"`
	VRF              common.Hash           `json:"vrf"`
	VRFProof         hexutil.Bytes         `json:"vrfProof"`
	Timestamp        hexutil.Uint64        `json:"timestamp"`
	TransactionsRoot common.Hash           `json:"transactionsRoot"`
	ReceiptsRoot     common.Hash           `json:"receiptsRoot"`
	Uncles           []common.Hash         `json:"uncles"`
}

Block represents a basic block which is further amended by BlockWithTxHash or BlockWithFullTx

type BlockFactory

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

BlockFactory is the factory for v1 rpc block

func NewBlockFactory

func NewBlockFactory(provider rpc_common.BlockDataProvider) *BlockFactory

NewBlockFactory return the block factory with the given provider

func (*BlockFactory) NewBlock

func (fac *BlockFactory) NewBlock(b *types.Block, args *rpc_common.BlockArgs) (interface{}, error)

NewBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.

type BlockWithFullTx

type BlockWithFullTx struct {
	*Block
	Transactions []*Transaction `json:"transactions"`
	Signers      []string       `json:"signers,omitempty"`
}

BlockWithFullTx represents a block that will serialize to the RPC representation of a block having FULL transactions in the Transaction fields.

type BlockWithTxHash

type BlockWithTxHash struct {
	*Block
	Transactions []common.Hash `json:"transactions"`
	Signers      []string      `json:"signers,omitempty"`
}

BlockWithTxHash represents a block that will serialize to the RPC representation of a block having ONLY transaction hashes in the Transaction fields.

type PublicEthService

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

PublicEthService provides an API to access to the Eth endpoints for the Astra blockchain.

func (*PublicEthService) GetBalance

func (s *PublicEthService) GetBalance(
	ctx context.Context, address string, blockNrOrHash rpc.BlockNumberOrHash,
) (*hexutil.Big, error)

GetBalance returns the amount of Atto for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

type Transaction

type Transaction struct {
	BlockHash        *common.Hash    `json:"blockHash"`
	BlockNumber      *hexutil.Big    `json:"blockNumber"`
	From             common.Address  `json:"from"`
	Timestamp        hexutil.Uint64  `json:"timestamp"` // Not exposed by Ethereum anymore
	Gas              hexutil.Uint64  `json:"gas"`
	GasPrice         *hexutil.Big    `json:"gasPrice"`
	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"`
	V                *hexutil.Big    `json:"v"`
	R                *hexutil.Big    `json:"r"`
	S                *hexutil.Big    `json:"s"`
}

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

func NewTransaction

func NewTransaction(
	tx *types.EthTransaction, blockHash common.Hash,
	blockNumber uint64, timestamp uint64, index uint64,
) (*Transaction, error)

NewTransaction returns a transaction that will serialize to the RPC representation, with the given location metadata set (if available). Note that all txs on Astra are replay protected (post EIP155 epoch).

func NewTransactionFromBlockIndex

func NewTransactionFromBlockIndex(b *types.Block, index uint64) (*Transaction, error)

NewTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.

Jump to

Keyboard shortcuts

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