github.com/ethereum-optimism/optimism/l2geth@v0.0.0-20230612200230-50b04ade19e3/ethclient/gen_rpc_tx_meta_json.go (about) 1 // Code generated by github.com/fjl/gencodec. DO NOT EDIT. 2 3 package ethclient 4 5 import ( 6 "encoding/json" 7 "math/big" 8 9 "github.com/ethereum-optimism/optimism/l2geth/common" 10 "github.com/ethereum-optimism/optimism/l2geth/common/hexutil" 11 "github.com/ethereum-optimism/optimism/l2geth/core/types" 12 ) 13 14 var _ = (*rpcTransactionMetaMarshaling)(nil) 15 16 // MarshalJSON marshals as JSON. 17 func (r rpcTransactionMeta) MarshalJSON() ([]byte, error) { 18 type rpcTransactionMeta struct { 19 L1BlockNumber *hexutil.Big `json:"l1BlockNumber"` 20 L1Timestamp hexutil.Uint64 `json:"l1Timestamp"` 21 L1MessageSender *common.Address `json:"l1MessageSender"` 22 QueueOrigin types.QueueOrigin `json:"queueOrigin"` 23 Index *hexutil.Uint64 `json:"index"` 24 QueueIndex *hexutil.Uint64 `json:"queueIndex"` 25 RawTransaction hexutil.Bytes `json:"rawTransaction"` 26 } 27 var enc rpcTransactionMeta 28 enc.L1BlockNumber = (*hexutil.Big)(r.L1BlockNumber) 29 enc.L1Timestamp = hexutil.Uint64(r.L1Timestamp) 30 enc.L1MessageSender = r.L1MessageSender 31 enc.QueueOrigin = r.QueueOrigin 32 enc.Index = (*hexutil.Uint64)(r.Index) 33 enc.QueueIndex = (*hexutil.Uint64)(r.QueueIndex) 34 enc.RawTransaction = r.RawTransaction 35 return json.Marshal(&enc) 36 } 37 38 // UnmarshalJSON unmarshals from JSON. 39 func (r *rpcTransactionMeta) UnmarshalJSON(input []byte) error { 40 type rpcTransactionMeta struct { 41 L1BlockNumber *hexutil.Big `json:"l1BlockNumber"` 42 L1Timestamp *hexutil.Uint64 `json:"l1Timestamp"` 43 L1MessageSender *common.Address `json:"l1MessageSender"` 44 QueueOrigin *types.QueueOrigin `json:"queueOrigin"` 45 Index *hexutil.Uint64 `json:"index"` 46 QueueIndex *hexutil.Uint64 `json:"queueIndex"` 47 RawTransaction *hexutil.Bytes `json:"rawTransaction"` 48 } 49 var dec rpcTransactionMeta 50 if err := json.Unmarshal(input, &dec); err != nil { 51 return err 52 } 53 if dec.L1BlockNumber != nil { 54 r.L1BlockNumber = (*big.Int)(dec.L1BlockNumber) 55 } 56 if dec.L1Timestamp != nil { 57 r.L1Timestamp = uint64(*dec.L1Timestamp) 58 } 59 if dec.L1MessageSender != nil { 60 r.L1MessageSender = dec.L1MessageSender 61 } 62 if dec.QueueOrigin != nil { 63 r.QueueOrigin = *dec.QueueOrigin 64 } 65 if dec.Index != nil { 66 r.Index = (*uint64)(dec.Index) 67 } 68 if dec.QueueIndex != nil { 69 r.QueueIndex = (*uint64)(dec.QueueIndex) 70 } 71 if dec.RawTransaction != nil { 72 r.RawTransaction = *dec.RawTransaction 73 } 74 return nil 75 }