Documentation
¶
Index ¶
- Constants
- Variables
- type Address
- type Addresses
- type Block
- type BlockNumber
- func (t *BlockNumber) Big() *big.Int
- func (t *BlockNumber) IsEarliest() bool
- func (t *BlockNumber) IsLatest() bool
- func (t *BlockNumber) IsPending() bool
- func (t *BlockNumber) IsTag() bool
- func (t BlockNumber) MarshalJSON() ([]byte, error)
- func (t BlockNumber) MarshalText() ([]byte, error)
- func (t *BlockNumber) String() string
- func (t *BlockNumber) UnmarshalJSON(input []byte) error
- func (t *BlockNumber) UnmarshalText(input []byte) error
- type BlockTxHashes
- type BlockTxObjects
- type Bloom
- type Bytes
- type FeeHistory
- type FilterLogsQuery
- type Hash
- type Hashes
- type Log
- type Nonce
- type Number
- type Transaction
- type TransactionReceiptType
Constants ¶
const AddressLength = 20
const BloomLength = 256
const HashLength = 32
const NonceLength = 8
Variables ¶
var ( EarliestBlockNumber = BlockNumber{/* contains filtered or unexported fields */} LatestBlockNumber = BlockNumber{/* contains filtered or unexported fields */} PendingBlockNumber = BlockNumber{/* contains filtered or unexported fields */} )
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [AddressLength]byte
Address represents the 20 byte address of an Ethereum account.
func BytesToAddress ¶
BytesToAddress returns an Address from a byte slice.
func HexToAddress ¶
HexToAddress parses a hex string into an Address.
func (Address) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Address) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Address) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Address) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Addresses ¶
type Addresses []Address
Addresses is a slice of Address.
func HexToAddresses ¶
HexToAddresses parses a list of hex strings into Addresses.
func (Addresses) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Addresses) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Block ¶
type Block struct {
Number Number `json:"number"`
Hash Hash `json:"hash"`
ParentHash Hash `json:"parentHash"`
Nonce Nonce `json:"nonce"`
Sha3Uncles Hash `json:"sha3Uncles"`
LogsBloom Bloom `json:"logsBloom"`
TransactionsRoot Hash `json:"transactionsRoot"`
StateRoot Hash `json:"stateRoot"`
ReceiptsRoot Hash `json:"receiptsRoot"`
Miner Address `json:"miner"`
MixHash Hash `json:"mixHash"`
Difficulty Number `json:"difficulty"`
TotalDifficulty Number `json:"totalDifficulty"`
ExtraData Bytes `json:"extraData"`
Size Number `json:"size"`
GasLimit Number `json:"gasLimit"`
GasUsed Number `json:"gasUsed"`
Timestamp Number `json:"timestamp"`
Uncles []Hash `json:"uncles"`
}
Block represents an Ethereum block.
type BlockNumber ¶
type BlockNumber struct {
// contains filtered or unexported fields
}
BlockNumber is a type that can hold a block number or a tag.
func BigToBlockNumber ¶
func BigToBlockNumber(x *big.Int) BlockNumber
BigToBlockNumber converts a big.Int to a BlockNumber.
func StringToBlockNumber ¶
func StringToBlockNumber(str string) BlockNumber
StringToBlockNumber converts a string to a BlockNumber. A string can be a hex number, "earliest", "latest" or "pending".
func Uint64ToBlockNumber ¶
func Uint64ToBlockNumber(x uint64) BlockNumber
Uint64ToBlockNumber converts a uint64 to a BlockNumber.
func (*BlockNumber) Big ¶
func (t *BlockNumber) Big() *big.Int
func (*BlockNumber) IsEarliest ¶
func (t *BlockNumber) IsEarliest() bool
func (*BlockNumber) IsLatest ¶
func (t *BlockNumber) IsLatest() bool
func (*BlockNumber) IsPending ¶
func (t *BlockNumber) IsPending() bool
func (*BlockNumber) IsTag ¶
func (t *BlockNumber) IsTag() bool
func (BlockNumber) MarshalJSON ¶
func (t BlockNumber) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (BlockNumber) MarshalText ¶
func (t BlockNumber) MarshalText() ([]byte, error)
func (*BlockNumber) String ¶
func (t *BlockNumber) String() string
func (*BlockNumber) UnmarshalJSON ¶
func (t *BlockNumber) UnmarshalJSON(input []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*BlockNumber) UnmarshalText ¶
func (t *BlockNumber) UnmarshalText(input []byte) error
type BlockTxHashes ¶
BlockTxHashes represents Ethereum block with transaction hashes.
type BlockTxObjects ¶
type BlockTxObjects struct {
Block
Transactions []Transaction `json:"transactions"`
}
BlockTxObjects represents Ethereum block with full transactions.
type Bloom ¶
type Bloom [BloomLength]byte
Bloom represents a 2048 bit bloom filter.
func BytesToBloom ¶
BytesToBloom converts a byte slice to a Bloom.
func (Bloom) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Bloom) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Bloom) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Bloom) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Bytes ¶
type Bytes []byte
Bytes represents a byte slice.
func (Bytes) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Bytes) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Bytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type FeeHistory ¶
type FeeHistory struct {
OldestBlock Number `json:"oldestBlock"`
Reward [][]Number `json:"reward"`
BaseFeePerGas []Number `json:"baseFeePerGas"`
GasUsedRatio []float64 `json:"gasUsedRatio"`
}
FeeHistory represents the result of the feeHistory RPC call.
type FilterLogsQuery ¶
type FilterLogsQuery struct {
Address Addresses `json:"address"`
FromBlock *BlockNumber `json:"fromBlock,omitempty"`
ToBlock *BlockNumber `json:"toBlock,omitempty"`
Topics []Hashes `json:"topics"`
BlockHash *Hash `json:"blockhash,omitempty"`
}
FilterLogsQuery represents a query to filter logs.
type Hash ¶
type Hash [HashLength]byte
Hash represents the 32 byte Keccak256 hash of arbitrary data.
func BytesToHash ¶
BytesToHash returns the hash corresponding to the byte slice.
func (Hash) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Hash) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Hash) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Hash) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Hashes ¶
type Hashes []Hash
Hashes marshals/unmarshals as hash.
func HexToHashes ¶
HexToHashes returns the hashes corresponding to the hexadecimal strings.
func (Hashes) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Hashes) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Log ¶
type Log struct {
Address Address `json:"address"`
Topics []Hash `json:"topics"`
Data Bytes `json:"data"`
BlockHash Hash `json:"blockHash"`
BlockNumber Number `json:"blockNumber"`
TxHash Hash `json:"transactionHash"`
TxIndex Number `json:"transactionIndex"`
LogIndex Number `json:"logIndex"`
Removed bool `json:"removed"`
}
Log represents a contract log event.
type Nonce ¶
type Nonce [NonceLength]byte
Nonce represents a 64 bit nonce.
func BytesToNonce ¶
BytesToNonce converts a byte slice to a Nonce.
func HexToNonce ¶
func (Nonce) MarshalJSON ¶
func (Nonce) MarshalText ¶
func (*Nonce) UnmarshalJSON ¶
func (*Nonce) UnmarshalText ¶
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
Number represents an integer up to 256 bits.
func HexToNumber ¶
func Uint64ToNumber ¶
Uint64ToNumber converts an uint64 to a Number.
func (Number) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Number) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Number) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Number) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Transaction ¶
type Transaction struct {
Hash Hash `json:"hash"`
BlockHash Hash `json:"blockHash"`
BlockNumber Number `json:"blockNumber"`
TransactionIndex Number `json:"transactionIndex"`
From Address `json:"from"`
To Address `json:"to"`
Gas Number `json:"gas"`
GasPrice Number `json:"gasPrice"`
Input Bytes `json:"input"`
Nonce Number `json:"nonce"`
Value Number `json:"value"`
V Number `json:"v"`
R Number `json:"r"`
S Number `json:"s"`
}
Transaction represents a transaction.
type TransactionReceiptType ¶
type TransactionReceiptType struct {
TransactionHash Hash `json:"transactionHash"`
TransactionIndex Number `json:"transactionIndex"`
BlockHash Hash `json:"blockHash"`
BlockNumber Number `json:"blockNumber"`
From Address `json:"from"`
To Address `json:"to"`
CumulativeGasUsed Number `json:"cumulativeGasUsed"`
GasUsed Number `json:"gasUsed"`
ContractAddress *Address `json:"contractAddress"`
Logs []Log `json:"logs"`
LogsBloom Bytes `json:"logsBloom"`
Root *Hash `json:"root"`
Status *Number `json:"status"`
}
TransactionReceiptType represents transaction receipt.