Go generate

This commit is contained in:
Sina Mahmoodi 2025-05-23 17:19:07 +02:00
parent edce3ac7c9
commit 4d7d1c2cf5

View file

@ -22,6 +22,7 @@ func (l Log) MarshalJSON() ([]byte, error) {
TxHash common.Hash `json:"transactionHash" gencodec:"required" rlp:"-"`
TxIndex hexutil.Uint `json:"transactionIndex" rlp:"-"`
BlockHash common.Hash `json:"blockHash" rlp:"-"`
BlockTimestamp uint64 `json:"blockTimestamp" rlp:"-"`
Index hexutil.Uint `json:"logIndex" rlp:"-"`
Removed bool `json:"removed" rlp:"-"`
}
@ -33,6 +34,7 @@ func (l Log) MarshalJSON() ([]byte, error) {
enc.TxHash = l.TxHash
enc.TxIndex = hexutil.Uint(l.TxIndex)
enc.BlockHash = l.BlockHash
enc.BlockTimestamp = l.BlockTimestamp
enc.Index = hexutil.Uint(l.Index)
enc.Removed = l.Removed
return json.Marshal(&enc)
@ -48,6 +50,7 @@ func (l *Log) UnmarshalJSON(input []byte) error {
TxHash *common.Hash `json:"transactionHash" gencodec:"required" rlp:"-"`
TxIndex *hexutil.Uint `json:"transactionIndex" rlp:"-"`
BlockHash *common.Hash `json:"blockHash" rlp:"-"`
BlockTimestamp *uint64 `json:"blockTimestamp" rlp:"-"`
Index *hexutil.Uint `json:"logIndex" rlp:"-"`
Removed *bool `json:"removed" rlp:"-"`
}
@ -80,6 +83,9 @@ func (l *Log) UnmarshalJSON(input []byte) error {
if dec.BlockHash != nil {
l.BlockHash = *dec.BlockHash
}
if dec.BlockTimestamp != nil {
l.BlockTimestamp = *dec.BlockTimestamp
}
if dec.Index != nil {
l.Index = uint(*dec.Index)
}