Documentation
¶
Index ¶
- func StandardABISerializer() *abi.Serializer
- type BlockHeaderJSONRPC
- type BlockInfoJSONRPC
- func (bi *BlockInfoJSONRPC) Equal(bi2 *BlockInfoJSONRPC) bool
- func (bi *BlockInfoJSONRPC) IsParentOf(other *BlockInfoJSONRPC) bool
- func (bi *BlockInfoJSONRPC) MarshalFormat(jss *JSONSerializerSet, opts ...MarshalOption) (_ json.RawMessage, err error)
- func (bi *BlockInfoJSONRPC) ToMinimalBlockInfo() *MinimalBlockInfo
- type EVMBlockWithTransactionsJSONRPC
- type EVMBlockWithTxHashesJSONRPC
- type JSONFormatOptions
- func (jfo JSONFormatOptions) GetABISerializer(ctx context.Context) (serializer *abi.Serializer, err error)
- func (jfo JSONFormatOptions) GetABISerializerIgnoreErrors(ctx context.Context) *abi.Serializer
- func (jfo JSONFormatOptions) GetSerializerSet(ctx context.Context, skipErrors bool) (ss *JSONSerializerSet, err error)
- type JSONSerializerSet
- type LogFilterJSONRPC
- type LogJSONRPC
- type MarshalOption
- type MinimalBlockInfo
- type TxInfoJSONRPC
- type TxReceiptJSONRPC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StandardABISerializer ¶
func StandardABISerializer() *abi.Serializer
The serializer we should use in all places that go from ABI validated data, back down to JSON that might be: 1) Passed to end-users over a JSON/RPC API 2) Passed to domain plugins over a gRPC API
Types ¶
type BlockHeaderJSONRPC ¶
type BlockHeaderJSONRPC struct {
Number ethtypes.HexUint64 `json:"number" ffstruct:"BlockInfoJSONRPC"`
Hash ethtypes.HexBytes0xPrefix `json:"hash" ffstruct:"BlockInfoJSONRPC"`
MixHash ethtypes.HexBytes0xPrefix `json:"mixHash" ffstruct:"BlockInfoJSONRPC"`
ParentHash ethtypes.HexBytes0xPrefix `json:"parentHash" ffstruct:"BlockInfoJSONRPC"`
Nonce ethtypes.HexBytes0xPrefix `json:"nonce" ffstruct:"BlockInfoJSONRPC"`
SHA3Uncles ethtypes.HexBytes0xPrefix `json:"sha3Uncles" ffstruct:"BlockInfoJSONRPC"`
LogsBloom ethtypes.HexBytes0xPrefix `json:"logsBloom" ffstruct:"BlockInfoJSONRPC"`
TransactionsRoot ethtypes.HexBytes0xPrefix `json:"transactionsRoot" ffstruct:"BlockInfoJSONRPC"`
StateRoot ethtypes.HexBytes0xPrefix `json:"stateRoot" ffstruct:"BlockInfoJSONRPC"`
ReceiptsRoot ethtypes.HexBytes0xPrefix `json:"receiptsRoot" ffstruct:"BlockInfoJSONRPC"`
Miner *ethtypes.Address0xHex `json:"miner" ffstruct:"BlockInfoJSONRPC"`
Difficulty *ethtypes.HexInteger `json:"difficulty" ffstruct:"BlockInfoJSONRPC"`
TotalDifficulty *ethtypes.HexInteger `json:"totalDifficulty" ffstruct:"BlockInfoJSONRPC"`
ExtraData ethtypes.HexBytes0xPrefix `json:"extraData" ffstruct:"BlockInfoJSONRPC"`
BaseFeePerGas *ethtypes.HexInteger `json:"baseFeePerGas" ffstruct:"BlockInfoJSONRPC"`
Size *ethtypes.HexInteger `json:"size" ffstruct:"BlockInfoJSONRPC"`
GasLimit *ethtypes.HexInteger `json:"gasLimit" ffstruct:"BlockInfoJSONRPC"`
GasUsed *ethtypes.HexInteger `json:"gasUsed" ffstruct:"BlockInfoJSONRPC"`
Timestamp ethtypes.HexUint64 `json:"timestamp" ffstruct:"BlockInfoJSONRPC"`
Uncles []ethtypes.HexBytes0xPrefix `json:"uncles" ffstruct:"BlockInfoJSONRPC"`
}
func (*BlockHeaderJSONRPC) ToBlockInfo ¶
func (b *BlockHeaderJSONRPC) ToBlockInfo(includeLogsBloom bool) *BlockInfoJSONRPC
type BlockInfoJSONRPC ¶
type BlockInfoJSONRPC struct {
Number ethtypes.HexUint64 `json:"number" ffstruct:"BlockInfoJSONRPC"`
Hash ethtypes.HexBytes0xPrefix `json:"hash" ffstruct:"BlockInfoJSONRPC"`
ParentHash ethtypes.HexBytes0xPrefix `json:"parentHash" ffstruct:"BlockInfoJSONRPC"`
Timestamp ethtypes.HexUint64 `json:"timestamp" ffstruct:"BlockInfoJSONRPC"`
LogsBloom ethtypes.HexBytes0xPrefix `json:"logsBloom" ffstruct:"BlockInfoJSONRPC"`
Transactions []ethtypes.HexBytes0xPrefix `json:"transactions" ffstruct:"BlockInfoJSONRPC"`
}
BlockInfoJSONRPC are the info fields we parse from the JSON/RPC response, and cache
func (*BlockInfoJSONRPC) Equal ¶
func (bi *BlockInfoJSONRPC) Equal(bi2 *BlockInfoJSONRPC) bool
func (*BlockInfoJSONRPC) IsParentOf ¶
func (bi *BlockInfoJSONRPC) IsParentOf(other *BlockInfoJSONRPC) bool
func (*BlockInfoJSONRPC) MarshalFormat ¶
func (bi *BlockInfoJSONRPC) MarshalFormat(jss *JSONSerializerSet, opts ...MarshalOption) (_ json.RawMessage, err error)
func (*BlockInfoJSONRPC) ToMinimalBlockInfo ¶ added in v1.4.3
func (bi *BlockInfoJSONRPC) ToMinimalBlockInfo() *MinimalBlockInfo
type EVMBlockWithTransactionsJSONRPC ¶
type EVMBlockWithTransactionsJSONRPC struct {
BlockHeaderJSONRPC
Transactions []*TxInfoJSONRPC `json:"transactions" ffstruct:"BlockInfoJSONRPC"`
}
EVMBlockWithTransactionsJSONRPC is the full JSON/RPC structure you get with "true" on eth_getBlockByNumber / eth_getBlockByHash
func (*EVMBlockWithTransactionsJSONRPC) MarshalFormat ¶
func (b *EVMBlockWithTransactionsJSONRPC) MarshalFormat(jss *JSONSerializerSet, opts ...MarshalOption) (jb json.RawMessage, err error)
func (*EVMBlockWithTransactionsJSONRPC) ToBlockInfo ¶
func (b *EVMBlockWithTransactionsJSONRPC) ToBlockInfo(includeLogsBloom bool) *BlockInfoJSONRPC
type EVMBlockWithTxHashesJSONRPC ¶
type EVMBlockWithTxHashesJSONRPC struct {
BlockHeaderJSONRPC
Transactions []ethtypes.HexBytes0xPrefix `json:"transactions" ffstruct:"BlockInfoJSONRPC"`
}
EVMBlockWithTxHashesJSONRPC is the full JSON/RPC structure you get with "false" on eth_getBlockByNumber / eth_getBlockByHash
func (*EVMBlockWithTxHashesJSONRPC) MarshalFormat ¶
func (b *EVMBlockWithTxHashesJSONRPC) MarshalFormat(jss *JSONSerializerSet, opts ...MarshalOption) (_ json.RawMessage, err error)
func (*EVMBlockWithTxHashesJSONRPC) ToBlockInfo ¶
func (b *EVMBlockWithTxHashesJSONRPC) ToBlockInfo(includeLogsBloom bool) *BlockInfoJSONRPC
type JSONFormatOptions ¶
type JSONFormatOptions string
const DefaultJSONFormatOptions JSONFormatOptions = ""
func (JSONFormatOptions) GetABISerializer ¶
func (jfo JSONFormatOptions) GetABISerializer(ctx context.Context) (serializer *abi.Serializer, err error)
func (JSONFormatOptions) GetABISerializerIgnoreErrors ¶
func (jfo JSONFormatOptions) GetABISerializerIgnoreErrors(ctx context.Context) *abi.Serializer
func (JSONFormatOptions) GetSerializerSet ¶
func (jfo JSONFormatOptions) GetSerializerSet(ctx context.Context, skipErrors bool) (ss *JSONSerializerSet, err error)
type JSONSerializerSet ¶
type JSONSerializerSet struct {
Mode abi.FormattingMode
Integer abi.IntSerializer
Float abi.FloatSerializer
Bytes abi.ByteSerializer
Address abi.AddressSerializer
Pretty bool
}
func StandardSerializerSet ¶
func StandardSerializerSet() *JSONSerializerSet
func (*JSONSerializerSet) ABISerializer ¶
func (ss *JSONSerializerSet) ABISerializer() *abi.Serializer
func (*JSONSerializerSet) MarshalFormattedMap ¶
func (ss *JSONSerializerSet) MarshalFormattedMap(value map[string]any, opts ...MarshalOption) (data json.RawMessage, err error)
MarshalFormattedMap takes a map that contains certain pre-selected types (see below switch) and does JSON marshalling adhering to the request of the users.
type LogFilterJSONRPC ¶
type LogFilterJSONRPC struct {
FromBlock *ethtypes.HexInteger `json:"fromBlock,omitempty" ffstruct:"LogFilterJSONRPC"`
ToBlock *ethtypes.HexInteger `json:"toBlock,omitempty" ffstruct:"LogFilterJSONRPC"`
Address []*ethtypes.Address0xHex `json:"address,omitempty" ffstruct:"LogFilterJSONRPC"`
Topics [][]ethtypes.HexBytes0xPrefix `json:"topics,omitempty" ffstruct:"LogFilterJSONRPC"`
}
See https://ethereum.org/hr/developers/docs/apis/json-rpc/#eth_newfilter The address, as well as the entries in the topic array, can be DATA|Array. We just use array in all cases.
type LogJSONRPC ¶
type LogJSONRPC struct {
Removed bool `json:"removed" ffstruct:"LogJSONRPC"`
LogIndex ethtypes.HexUint64 `json:"logIndex" ffstruct:"LogJSONRPC"`
TransactionIndex ethtypes.HexUint64 `json:"transactionIndex" ffstruct:"LogJSONRPC"`
BlockNumber ethtypes.HexUint64 `json:"blockNumber" ffstruct:"LogJSONRPC"`
TransactionHash ethtypes.HexBytes0xPrefix `json:"transactionHash" ffstruct:"LogJSONRPC"`
BlockHash ethtypes.HexBytes0xPrefix `json:"blockHash" ffstruct:"LogJSONRPC"`
Address *ethtypes.Address0xHex `json:"address" ffstruct:"LogJSONRPC"`
Data ethtypes.HexBytes0xPrefix `json:"data" ffstruct:"LogJSONRPC"`
Topics []ethtypes.HexBytes0xPrefix `json:"topics" ffstruct:"LogJSONRPC"`
}
func (*LogJSONRPC) MarshalFormat ¶
func (l *LogJSONRPC) MarshalFormat(jss *JSONSerializerSet, opts ...MarshalOption) (_ json.RawMessage, err error)
type MarshalOption ¶
type MarshalOption struct {
RedactFields []string // helpful when you want to trim large fields
OmitNullFields []string // a simplified approach to "omitempty" on JSON struct formatting tags
}
Marshalling options specific to the structure that is being marshalled, rather than JSONFormatOptions which are specific to the way to represent data in JSON
type MinimalBlockInfo ¶ added in v1.4.3
type MinimalBlockInfo struct {
BlockNumber fftypes.FFuint64 `json:"blockNumber"`
BlockHash ethtypes.HexBytes0xPrefix `json:"blockHash"`
ParentHash ethtypes.HexBytes0xPrefix `json:"parentHash"`
}
func (*MinimalBlockInfo) Equal ¶ added in v1.4.3
func (c *MinimalBlockInfo) Equal(other *MinimalBlockInfo) bool
func (*MinimalBlockInfo) IsParentOf ¶ added in v1.4.3
func (c *MinimalBlockInfo) IsParentOf(other *MinimalBlockInfo) bool
type TxInfoJSONRPC ¶
type TxInfoJSONRPC struct {
BlockHash ethtypes.HexBytes0xPrefix `json:"blockHash" ffstruct:"TxInfoJSONRPC"` // null if pending
BlockNumber ethtypes.HexUint64 `json:"blockNumber" ffstruct:"TxInfoJSONRPC"` // null if pending
ChainID *ethtypes.HexInteger `json:"chainId" ffstruct:"TxInfoJSONRPC"`
From *ethtypes.Address0xHex `json:"from" ffstruct:"TxInfoJSONRPC"`
Gas *ethtypes.HexInteger `json:"gas" ffstruct:"TxInfoJSONRPC"`
GasPrice *ethtypes.HexInteger `json:"gasPrice" ffstruct:"TxInfoJSONRPC"`
MaxFeePerGas *ethtypes.HexInteger `json:"maxFeePerGas" ffstruct:"TxInfoJSONRPC"`
MaxPriorityFeePerGas *ethtypes.HexInteger `json:"maxPriorityFeePerGas" ffstruct:"TxInfoJSONRPC"`
Hash ethtypes.HexBytes0xPrefix `json:"hash" ffstruct:"TxInfoJSONRPC"`
Input ethtypes.HexBytes0xPrefix `json:"input" ffstruct:"TxInfoJSONRPC"`
Nonce *ethtypes.HexInteger `json:"nonce" ffstruct:"TxInfoJSONRPC"`
To *ethtypes.Address0xHex `json:"to" ffstruct:"TxInfoJSONRPC"`
TransactionIndex *ethtypes.HexUint64 `json:"transactionIndex" ffstruct:"TxInfoJSONRPC"` // null if pending
Type *ethtypes.HexUint64 `json:"type" ffstruct:"TxInfoJSONRPC"`
Value *ethtypes.HexInteger `json:"value" ffstruct:"TxInfoJSONRPC"`
V *ethtypes.HexInteger `json:"v" ffstruct:"TxInfoJSONRPC"`
R *ethtypes.HexInteger `json:"r" ffstruct:"TxInfoJSONRPC"`
S *ethtypes.HexInteger `json:"s" ffstruct:"TxInfoJSONRPC"`
}
TxInfoJSONRPC is the transaction info obtained over JSON/RPC from the ethereum client, with input data
func (*TxInfoJSONRPC) MarshalFormat ¶
func (txi *TxInfoJSONRPC) MarshalFormat(jss *JSONSerializerSet, opts ...MarshalOption) (_ json.RawMessage, err error)
type TxReceiptJSONRPC ¶
type TxReceiptJSONRPC struct {
TransactionHash ethtypes.HexBytes0xPrefix `json:"transactionHash" ffstruct:"TxReceiptJSONRPC"`
TransactionIndex ethtypes.HexUint64 `json:"transactionIndex" ffstruct:"TxReceiptJSONRPC"`
BlockHash ethtypes.HexBytes0xPrefix `json:"blockHash" ffstruct:"TxReceiptJSONRPC"`
BlockNumber ethtypes.HexUint64 `json:"blockNumber" ffstruct:"TxReceiptJSONRPC"`
From *ethtypes.Address0xHex `json:"from" ffstruct:"TxReceiptJSONRPC"`
To *ethtypes.Address0xHex `json:"to" ffstruct:"TxReceiptJSONRPC"`
CumulativeGasUsed *ethtypes.HexInteger `json:"cumulativeGasUsed" ffstruct:"TxReceiptJSONRPC"`
EffectiveGasPrice *ethtypes.HexInteger `json:"effectiveGasPrice" ffstruct:"TxReceiptJSONRPC"`
GasUsed *ethtypes.HexInteger `json:"gasUsed" ffstruct:"TxReceiptJSONRPC"`
ContractAddress *ethtypes.Address0xHex `json:"contractAddress" ffstruct:"TxReceiptJSONRPC"`
Logs []*LogJSONRPC `json:"logs" ffstruct:"TxReceiptJSONRPC"`
LogsBloom ethtypes.HexBytes0xPrefix `json:"logsBloom" ffstruct:"TxReceiptJSONRPC"`
Type *ethtypes.HexUint64 `json:"type" ffstruct:"TxReceiptJSONRPC"`
Status *ethtypes.HexUint64 `json:"status" ffstruct:"TxReceiptJSONRPC"`
RevertReason ethtypes.HexBytes0xPrefix `json:"revertReason" ffstruct:"TxReceiptJSONRPC"`
}
TxReceiptJSONRPC is the receipt obtained over JSON/RPC from the ethereum client, with gas used, logs and contract address
func (*TxReceiptJSONRPC) MarshalFormat ¶
func (txr *TxReceiptJSONRPC) MarshalFormat(jss *JSONSerializerSet, opts ...MarshalOption) (jb json.RawMessage, err error)