rpctypes

package
v0.1.65 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RPCSchemaAccountList string
View Source
var RPCSchemaBadBlocks string
View Source
var RPCSchemaDebugTrace string
View Source
var RPCSchemaDebugTraceBlock string
View Source
var RPCSchemaEthAccessList string
View Source
var RPCSchemaEthBlock string
View Source
var RPCSchemaEthFeeHistory string
View Source
var RPCSchemaEthFilter string
View Source
var RPCSchemaEthProof string
View Source
var RPCSchemaEthReceipt string
View Source
var RPCSchemaEthSyncing string
View Source
var RPCSchemaEthTransaction string
View Source
var RPCSchemaHexArray string
View Source
var RPCSchemaSignTxResponse string

Functions

func ConvHexToBigInt

func ConvHexToBigInt(raw any) (bi *big.Int, err error)

HexToBigInt assumes that it's input is a hex encoded string and will try to convert it to a big int

func ConvHexToUint64

func ConvHexToUint64(raw any) (uint64, error)

HexToUint64 assumes that its input is a hex encoded string and it will attempt to convert this into a uint64

func MustConvHexToUint64

func MustConvHexToUint64(raw any) uint64

Types

type PolyBlock

type PolyBlock interface {
	Number() *big.Int
	Time() uint64
	Transactions() PolyTransactions
	Uncles() []RawData32Response
	Size() uint64
	GasUsed() uint64
	Miner() ethcommon.Address
	Hash() ethcommon.Hash
	Difficulty() *big.Int
	GasLimit() uint64
	BaseFee() *big.Int
	Extra() []byte
	ParentHash() ethcommon.Hash
	UncleHash() ethcommon.Hash
	Root() ethcommon.Hash
	TxRoot() ethcommon.Hash
	Nonce() uint64
	String() string
	MarshalJSON() ([]byte, error)
	ReceiptsRoot() ethcommon.Hash
	LogsBloom() []byte
	Coinbase() ethcommon.Address
	MixHash() ethcommon.Hash
}

func NewPolyBlock

func NewPolyBlock(r *RawBlockResponse) PolyBlock

type PolyReceipt

type PolyReceipt interface {
	TransactionHash() ethcommon.Hash
	TransactionIndex() uint64
	BlockHash() ethcommon.Hash
	BlockNumber() *big.Int
	From() ethcommon.Address
	To() ethcommon.Address
	CumulativeGasUsed() *big.Int
	EffectiveGasPrice() *big.Int
	GasUsed() *big.Int
	ContractAddress() ethcommon.Address
	Logs() []RawTxLogs
	LogsBloom() []byte
	Root() ethcommon.Hash
	Status() uint64
	BlobGasPrice() *big.Int
	BlobGasUsed() *big.Int
}

func NewPolyReceipt

func NewPolyReceipt(r *RawTxReceipt) PolyReceipt

type PolyReceipts

type PolyReceipts []PolyReceipt

type PolyTransaction

type PolyTransaction interface {
	GasPrice() *big.Int
	Hash() ethcommon.Hash
	To() ethcommon.Address
	From() ethcommon.Address
	Data() []byte
	Value() *big.Int
	Gas() uint64
	Nonce() uint64
	String() string
	MarshalJSON() ([]byte, error)
	Type() uint64
	MaxPriorityFeePerGas() uint64
	MaxFeePerGas() uint64
	ChainID() uint64
	BlockNumber() *big.Int
	V() *big.Int
	R() *big.Int
	S() *big.Int
}

func NewPolyTransaction

func NewPolyTransaction(r *RawTransactionResponse) PolyTransaction

type PolyTransactions

type PolyTransactions []PolyTransaction

type RawBlockResponse

type RawBlockResponse struct {
	// number: QUANTITY - the block number. null when its pending block.
	Number RawQuantityResponse `json:"number"`

	// hash: DATA, 32 Bytes - hash of the block. null when its pending block.
	Hash RawData32Response `json:"hash"`

	// parentHash: DATA, 32 Bytes - hash of the parent block.
	ParentHash RawData32Response `json:"parentHash"`

	// nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.
	Nonce RawData8Response `json:"nonce"`

	// sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.
	SHA3Uncles RawData32Response `json:"sha3Uncles"`

	// logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.
	LogsBloom RawData256Response `json:"logsBloom"`

	// transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.
	TransactionsRoot RawData32Response `json:"transactionsRoot"`

	// stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.
	StateRoot RawData32Response `json:"stateRoot"`

	// receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.
	ReceiptsRoot RawData32Response `json:"receiptsRoot"`

	// miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
	Miner RawData20Response `json:"miner"`

	// difficulty: QUANTITY - integer of the difficulty for this block.
	Difficulty RawQuantityResponse `json:"difficulty"`

	// totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.
	TotalDifficulty RawQuantityResponse `json:"totalDifficulty"`

	// extraData: DATA - the "extra data" field of this block.
	ExtraData RawDataResponse `json:"extraData"`

	// size: QUANTITY - integer the size of this block in bytes.
	Size RawQuantityResponse `json:"size"`

	// gasLimit: QUANTITY - the maximum gas allowed in this block.
	GasLimit RawQuantityResponse `json:"gasLimit"`

	// gasUsed: QUANTITY - the total used gas by all transactions in this block.
	GasUsed RawQuantityResponse `json:"gasUsed"`

	// timestamp: QUANTITY - the unix timestamp for when the block was collated.
	Timestamp RawQuantityResponse `json:"timestamp"`

	// transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
	Transactions []RawTransactionResponse `json:"transactions"`

	// uncles: Array - Array of uncle hashes.
	Uncles []RawData32Response `json:"uncles"`

	// baseFeePerGas: QUANTITY - fixed per block fee
	BaseFeePerGas RawQuantityResponse `json:"baseFeePerGas"`

	// receiptsRoot: DATA, 32 Bytes - a 256-bit hash encoded as a hexadecimal
	MixHash RawData32Response `json:"mixHash"`
}

func NewRawBlockResponseFromAny

func NewRawBlockResponseFromAny(raw any) (*RawBlockResponse, error)

type RawData20Response

type RawData20Response string

func (*RawData20Response) ToAddress

func (r *RawData20Response) ToAddress() ethcommon.Address

type RawData256Response

type RawData256Response string

func (*RawData256Response) ToBytes

func (r *RawData256Response) ToBytes() []byte

type RawData32Response

type RawData32Response string

func (*RawData32Response) ToHash

func (r *RawData32Response) ToHash() ethcommon.Hash

type RawData8Response

type RawData8Response string

func (RawData8Response) ToUint64

func (r RawData8Response) ToUint64() uint64

type RawDataResponse

type RawDataResponse string

func (*RawDataResponse) ToBytes

func (r *RawDataResponse) ToBytes() []byte

type RawQuantityResponse

type RawQuantityResponse string

func (*RawQuantityResponse) String

func (r *RawQuantityResponse) String() string

func (*RawQuantityResponse) ToBigInt

func (r *RawQuantityResponse) ToBigInt() *big.Int

func (RawQuantityResponse) ToFloat64

func (r RawQuantityResponse) ToFloat64() float64

func (RawQuantityResponse) ToInt64

func (r RawQuantityResponse) ToInt64() int64

func (RawQuantityResponse) ToUint64

func (r RawQuantityResponse) ToUint64() uint64

type RawTransactionResponse

type RawTransactionResponse struct {
	// blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.
	BlockHash RawData32Response `json:"blockHash"`

	// blockNumber: QUANTITY - block number where this transaction was in. null when its pending.
	BlockNumber RawQuantityResponse `json:"blockNumber"`

	// from: DATA, 20 Bytes - address of the sender.
	From RawData20Response `json:"from"`

	// gas: QUANTITY - gas provided by the sender.
	Gas RawQuantityResponse `json:"gas"`

	// gasPrice: QUANTITY - gas price provided by the sender in Wei.
	GasPrice RawQuantityResponse `json:"gasPrice"`

	// gas: QUANTITY - gas provided by the sender.
	MaxPriorityFeePerGas RawQuantityResponse `json:"maxPriorityFeePerGas"`

	// gas: QUANTITY - gas provided by the sender.
	MaxFeePerGas RawQuantityResponse `json:"maxFeePerGas"`

	// hash: DATA, 32 Bytes - hash of the transaction.
	Hash RawData32Response `json:"hash"`

	// input: DATA - the data send along with the transaction.
	Input RawDataResponse `json:"input"`

	// nonce: QUANTITY - the number of transactions made by the sender prior to this one.
	Nonce RawQuantityResponse `json:"nonce"`

	// to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.
	To RawData20Response `json:"to"`

	// transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending.
	TransactionIndex RawQuantityResponse `json:"transactionIndex"`

	// value: QUANTITY - value transferred in Wei.
	Value RawQuantityResponse `json:"value"`

	// v: QUANTITY - ECDSA recovery id
	V RawQuantityResponse `json:"v"`

	// r: QUANTITY - ECDSA signature r
	R RawQuantityResponse `json:"r"`

	// s: QUANTITY - ECDSA signature s
	S RawQuantityResponse `json:"s"`

	// EIP 2718 Type field?
	Type RawQuantityResponse `json:"type"`

	ChainID RawQuantityResponse `json:"chainId"`

	AccessList []any `json:"accessList"`
}

type RawTxLogs

type RawTxLogs struct {
	// blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.
	BlockHash RawData32Response `json:"blockHash"`

	// blockNumber: QUANTITY - block number where this transaction was in.
	BlockNumber RawQuantityResponse `json:"blockNumber"`

	// transactionIndex: QUANTITY - integer of the transactions index position in the block.
	TransactionIndex RawQuantityResponse `json:"transactionIndex"`

	// address: DATA, 20 Bytes - address from which this log originated.
	Address RawData20Response `json:"address"`

	// logIndex: QUANTITY - integer of the log index position in the block. null when its pending log.
	LogIndex RawQuantityResponse `json:"logIndex"`

	// data: DATA - contains one or more 32 Bytes non-indexed arguments of the log.
	Data RawDataResponse `json:"data"`

	// removed: boolean - true when the log was removed, due to a chain reorganization. false if its a valid log.
	Removed bool `json:"removed"`

	// topics: Array, 32 Bytes - array of zero to four 32 Bytes DATA of indexed log arguments. In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declare the event with the anonymous specifier.
	Topics []RawData32Response `json:"topics"`

	// transactionHash: DATA, 32 Bytes - hash of the transaction.
	TransactionHash RawData32Response `json:"transactionHash"`
}

type RawTxReceipt

type RawTxReceipt struct {
	// transactionHash: DATA, 32 Bytes - hash of the transaction.
	TransactionHash RawData32Response `json:"transactionHash"`

	// transactionIndex: QUANTITY - integer of the transactions index position in the block.
	TransactionIndex RawQuantityResponse `json:"transactionIndex"`

	// blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.
	BlockHash RawData32Response `json:"blockHash"`

	// blockNumber: QUANTITY - block number where this transaction was in.
	BlockNumber RawQuantityResponse `json:"blockNumber"`

	// from: DATA, 20 Bytes - address of the sender.
	From RawData20Response `json:"from"`

	// to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.
	To RawData20Response `json:"to"`

	// cumulativeGasUsed : QUANTITY - The total amount of gas used when this transaction was executed in the block.
	CumulativeGasUsed RawQuantityResponse `json:"cumulativeGasUsed"`

	// effectiveGasPrice : QUANTITY - The total base charge plus tip paid for each unit of gas.
	EffectiveGasPrice RawQuantityResponse `json:"effectiveGasPrice"`

	// gasUsed : QUANTITY - The amount of gas used by this specific transaction alone.
	GasUsed RawQuantityResponse `json:"gasUsed"`

	// contractAddress : DATA, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.
	ContractAddress RawData20Response `json:"contractAddress"`

	// logs: Array - Array of log objects, which this transaction generated.
	Logs []RawTxLogs `json:"logs"`

	// logsBloom: DATA, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs. It also returns either :
	LogsBloom RawData256Response `json:"logsBloom"`

	// root : DATA 32 bytes of post-transaction stateroot (pre Byzantium)
	Root RawData32Response `json:"root"`

	// status: QUANTITY either 1 (success) or 0 (failure)
	Status RawQuantityResponse `json:"status"`

	// blobGasPrice: QUANTITY - blob gas price provided by the sender in Wei.
	BlobGasPrice RawQuantityResponse `json:"blobGasPrice"`

	// blobGasUsed: QUANTITY - blob gas used by this specific transaction alone.
	BlobGasUsed RawQuantityResponse `json:"blobGasUsed"`
}

type SortableBlocks

type SortableBlocks []PolyBlock

func (SortableBlocks) Len

func (a SortableBlocks) Len() int

func (SortableBlocks) Less

func (a SortableBlocks) Less(i, j int) bool

func (SortableBlocks) Swap

func (a SortableBlocks) Swap(i, j int)

Jump to

Keyboard shortcuts

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