@@ -19,7 +19,6 @@ package gethclient
1919
2020import (
2121 "context"
22- "encoding/json"
2322 "fmt"
2423 "math/big"
2524 "runtime"
@@ -30,6 +29,7 @@ import (
3029 "github.com/ethereum/go-ethereum/common/hexutil"
3130 "github.com/ethereum/go-ethereum/core/types"
3231 "github.com/ethereum/go-ethereum/eth/tracers"
32+ clienttypes "github.com/ethereum/go-ethereum/ethclient/types"
3333 "github.com/ethereum/go-ethereum/p2p"
3434 "github.com/ethereum/go-ethereum/rpc"
3535)
@@ -280,97 +280,10 @@ func toCallArg(msg ethereum.CallMsg) interface{} {
280280 return arg
281281}
282282
283- // OverrideAccount specifies the state of an account to be overridden.
284- type OverrideAccount struct {
285- // Nonce sets nonce of the account. Note: the nonce override will only
286- // be applied when it is set to a non-zero value.
287- Nonce uint64
283+ // OverrideAccount is an alias for ethclient/types.OverrideAccount.
284+ // Deprecated: Use ethclienttypes.OverrideAccount instead.
285+ type OverrideAccount = clienttypes.OverrideAccount
288286
289- // Code sets the contract code. The override will be applied
290- // when the code is non-nil, i.e. setting empty code is possible
291- // using an empty slice.
292- Code []byte
293-
294- // Balance sets the account balance.
295- Balance * big.Int
296-
297- // State sets the complete storage. The override will be applied
298- // when the given map is non-nil. Using an empty map wipes the
299- // entire contract storage during the call.
300- State map [common.Hash ]common.Hash
301-
302- // StateDiff allows overriding individual storage slots.
303- StateDiff map [common.Hash ]common.Hash
304- }
305-
306- func (a OverrideAccount ) MarshalJSON () ([]byte , error ) {
307- type acc struct {
308- Nonce hexutil.Uint64 `json:"nonce,omitempty"`
309- Code string `json:"code,omitempty"`
310- Balance * hexutil.Big `json:"balance,omitempty"`
311- State interface {} `json:"state,omitempty"`
312- StateDiff map [common.Hash ]common.Hash `json:"stateDiff,omitempty"`
313- }
314-
315- output := acc {
316- Nonce : hexutil .Uint64 (a .Nonce ),
317- Balance : (* hexutil .Big )(a .Balance ),
318- StateDiff : a .StateDiff ,
319- }
320- if a .Code != nil {
321- output .Code = hexutil .Encode (a .Code )
322- }
323- if a .State != nil {
324- output .State = a .State
325- }
326- return json .Marshal (output )
327- }
328-
329- // BlockOverrides specifies the set of header fields to override.
330- type BlockOverrides struct {
331- // Number overrides the block number.
332- Number * big.Int
333- // Difficulty overrides the block difficulty.
334- Difficulty * big.Int
335- // Time overrides the block timestamp. Time is applied only when
336- // it is non-zero.
337- Time uint64
338- // GasLimit overrides the block gas limit. GasLimit is applied only when
339- // it is non-zero.
340- GasLimit uint64
341- // Coinbase overrides the block coinbase. Coinbase is applied only when
342- // it is different from the zero address.
343- Coinbase common.Address
344- // Random overrides the block extra data which feeds into the RANDOM opcode.
345- // Random is applied only when it is a non-zero hash.
346- Random common.Hash
347- // BaseFee overrides the block base fee.
348- BaseFee * big.Int
349- }
350-
351- func (o BlockOverrides ) MarshalJSON () ([]byte , error ) {
352- type override struct {
353- Number * hexutil.Big `json:"number,omitempty"`
354- Difficulty * hexutil.Big `json:"difficulty,omitempty"`
355- Time hexutil.Uint64 `json:"time,omitempty"`
356- GasLimit hexutil.Uint64 `json:"gasLimit,omitempty"`
357- Coinbase * common.Address `json:"feeRecipient,omitempty"`
358- Random * common.Hash `json:"prevRandao,omitempty"`
359- BaseFee * hexutil.Big `json:"baseFeePerGas,omitempty"`
360- }
361-
362- output := override {
363- Number : (* hexutil .Big )(o .Number ),
364- Difficulty : (* hexutil .Big )(o .Difficulty ),
365- Time : hexutil .Uint64 (o .Time ),
366- GasLimit : hexutil .Uint64 (o .GasLimit ),
367- BaseFee : (* hexutil .Big )(o .BaseFee ),
368- }
369- if o .Coinbase != (common.Address {}) {
370- output .Coinbase = & o .Coinbase
371- }
372- if o .Random != (common.Hash {}) {
373- output .Random = & o .Random
374- }
375- return json .Marshal (output )
376- }
287+ // BlockOverrides is an alias for ethclient/types.BlockOverrides.
288+ // Deprecated: Use ethclienttypes.BlockOverrides instead.
289+ type BlockOverrides = clienttypes.BlockOverrides
0 commit comments