2017-07-11 13:49:14 +02:00
|
|
|
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
|
|
|
|
|
|
|
|
package tests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"math/big"
|
|
|
|
|
2023-07-15 23:27:36 +02:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
2017-07-11 13:49:14 +02:00
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
|
|
"github.com/ethereum/go-ethereum/common/math"
|
2021-03-03 15:50:07 +01:00
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
2017-07-11 13:49:14 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ = (*stTransactionMarshaling)(nil)
|
|
|
|
|
2021-03-03 15:50:07 +01:00
|
|
|
// MarshalJSON marshals as JSON.
|
2017-07-11 13:49:14 +02:00
|
|
|
func (s stTransaction) MarshalJSON() ([]byte, error) {
|
|
|
|
type stTransaction struct {
|
2021-06-07 14:37:56 +02:00
|
|
|
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
|
|
|
|
MaxFeePerGas *math.HexOrDecimal256 `json:"maxFeePerGas"`
|
|
|
|
MaxPriorityFeePerGas *math.HexOrDecimal256 `json:"maxPriorityFeePerGas"`
|
|
|
|
Nonce math.HexOrDecimal64 `json:"nonce"`
|
|
|
|
To string `json:"to"`
|
|
|
|
Data []string `json:"data"`
|
|
|
|
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
|
|
|
|
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
|
|
|
|
Value []string `json:"value"`
|
|
|
|
PrivateKey hexutil.Bytes `json:"secretKey"`
|
2023-07-15 23:27:36 +02:00
|
|
|
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
2023-07-27 16:53:28 +03:00
|
|
|
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
|
2017-07-11 13:49:14 +02:00
|
|
|
}
|
|
|
|
var enc stTransaction
|
|
|
|
enc.GasPrice = (*math.HexOrDecimal256)(s.GasPrice)
|
2021-06-07 14:37:56 +02:00
|
|
|
enc.MaxFeePerGas = (*math.HexOrDecimal256)(s.MaxFeePerGas)
|
|
|
|
enc.MaxPriorityFeePerGas = (*math.HexOrDecimal256)(s.MaxPriorityFeePerGas)
|
2017-07-11 13:49:14 +02:00
|
|
|
enc.Nonce = math.HexOrDecimal64(s.Nonce)
|
|
|
|
enc.To = s.To
|
|
|
|
enc.Data = s.Data
|
2021-03-03 15:50:07 +01:00
|
|
|
enc.AccessLists = s.AccessLists
|
2017-07-11 13:49:14 +02:00
|
|
|
if s.GasLimit != nil {
|
|
|
|
enc.GasLimit = make([]math.HexOrDecimal64, len(s.GasLimit))
|
|
|
|
for k, v := range s.GasLimit {
|
|
|
|
enc.GasLimit[k] = math.HexOrDecimal64(v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
enc.Value = s.Value
|
|
|
|
enc.PrivateKey = s.PrivateKey
|
2023-07-15 23:27:36 +02:00
|
|
|
enc.BlobVersionedHashes = s.BlobVersionedHashes
|
|
|
|
enc.BlobGasFeeCap = (*math.HexOrDecimal256)(s.BlobGasFeeCap)
|
2017-07-11 13:49:14 +02:00
|
|
|
return json.Marshal(&enc)
|
|
|
|
}
|
|
|
|
|
2021-03-03 15:50:07 +01:00
|
|
|
// UnmarshalJSON unmarshals from JSON.
|
2017-07-11 13:49:14 +02:00
|
|
|
func (s *stTransaction) UnmarshalJSON(input []byte) error {
|
|
|
|
type stTransaction struct {
|
2021-06-07 14:37:56 +02:00
|
|
|
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
|
|
|
|
MaxFeePerGas *math.HexOrDecimal256 `json:"maxFeePerGas"`
|
|
|
|
MaxPriorityFeePerGas *math.HexOrDecimal256 `json:"maxPriorityFeePerGas"`
|
|
|
|
Nonce *math.HexOrDecimal64 `json:"nonce"`
|
|
|
|
To *string `json:"to"`
|
|
|
|
Data []string `json:"data"`
|
|
|
|
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
|
|
|
|
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
|
|
|
|
Value []string `json:"value"`
|
|
|
|
PrivateKey *hexutil.Bytes `json:"secretKey"`
|
2023-07-15 23:27:36 +02:00
|
|
|
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
|
2023-07-27 16:53:28 +03:00
|
|
|
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
|
2017-07-11 13:49:14 +02:00
|
|
|
}
|
|
|
|
var dec stTransaction
|
|
|
|
if err := json.Unmarshal(input, &dec); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dec.GasPrice != nil {
|
|
|
|
s.GasPrice = (*big.Int)(dec.GasPrice)
|
|
|
|
}
|
2021-06-07 14:37:56 +02:00
|
|
|
if dec.MaxFeePerGas != nil {
|
|
|
|
s.MaxFeePerGas = (*big.Int)(dec.MaxFeePerGas)
|
|
|
|
}
|
|
|
|
if dec.MaxPriorityFeePerGas != nil {
|
|
|
|
s.MaxPriorityFeePerGas = (*big.Int)(dec.MaxPriorityFeePerGas)
|
|
|
|
}
|
2017-07-11 13:49:14 +02:00
|
|
|
if dec.Nonce != nil {
|
|
|
|
s.Nonce = uint64(*dec.Nonce)
|
|
|
|
}
|
|
|
|
if dec.To != nil {
|
|
|
|
s.To = *dec.To
|
|
|
|
}
|
|
|
|
if dec.Data != nil {
|
|
|
|
s.Data = dec.Data
|
|
|
|
}
|
2021-03-03 15:50:07 +01:00
|
|
|
if dec.AccessLists != nil {
|
|
|
|
s.AccessLists = dec.AccessLists
|
|
|
|
}
|
2017-07-11 13:49:14 +02:00
|
|
|
if dec.GasLimit != nil {
|
|
|
|
s.GasLimit = make([]uint64, len(dec.GasLimit))
|
|
|
|
for k, v := range dec.GasLimit {
|
|
|
|
s.GasLimit[k] = uint64(v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if dec.Value != nil {
|
|
|
|
s.Value = dec.Value
|
|
|
|
}
|
|
|
|
if dec.PrivateKey != nil {
|
2018-01-08 14:13:22 +01:00
|
|
|
s.PrivateKey = *dec.PrivateKey
|
2017-07-11 13:49:14 +02:00
|
|
|
}
|
2023-07-15 23:27:36 +02:00
|
|
|
if dec.BlobVersionedHashes != nil {
|
|
|
|
s.BlobVersionedHashes = dec.BlobVersionedHashes
|
|
|
|
}
|
|
|
|
if dec.BlobGasFeeCap != nil {
|
|
|
|
s.BlobGasFeeCap = (*big.Int)(dec.BlobGasFeeCap)
|
|
|
|
}
|
2017-07-11 13:49:14 +02:00
|
|
|
return nil
|
|
|
|
}
|