eth

package
v0.0.0-...-4827941 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

+k8s:deepcopy-gen=package Package eth contains data structures for (de)serializing data from Ethereum JSONRPC requests and responses.

Index

Constants

This section is empty.

Variables

View Source
var (
	TransactionTypeLegacy     = int64(0x0) // TransactionTypeLegacy refers to pre-EIP-2718 transactions.
	TransactionTypeAccessList = int64(0x1) // TransactionTypeAccessList refers to EIP-2930 transactions.
	TransactionTypeDynamicFee = int64(0x2) // TransactionTypeDynamicFee refers to EIP-1559 transactions.
)

Functions

func OptionalString

func OptionalString(s string) *string

OptionalString can be used to generate a string pointer from a static string easily

func ToChecksumAddress

func ToChecksumAddress(address string) string

ToChecksumAddress converts a string to the proper EIP55 casing.

Transliteration of this code from the EIP55 wiki page:

function toChecksumAddress (address) {
  address = address.toLowerCase().replace('0x', '')
  var hash = createKeccakHash('keccak256').update(address).digest('hex')
  var ret = '0x'

  for (var i = 0; i < address.length; i++) {
	if (parseInt(hash[i], 16) >= 8) {
	  ret += address[i].toUpperCase()
	} else {
	  ret += address[i]
	}
  }

  return ret
}

Types

type AccessList

type AccessList []AccessListEntry

func NewAccessListFromRLP

func NewAccessListFromRLP(v rlp.Value) (AccessList, error)

NewAccessListFromRLP decodes an RLP list into an AccessList, or returns an error. The RLP format of AccessLists is defined in EIP-2930, each entry is a tuple of an address and a list of storage slots.

func (AccessList) DeepCopy

func (in AccessList) DeepCopy() AccessList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessList.

func (AccessList) DeepCopyInto

func (in AccessList) DeepCopyInto(out *AccessList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AccessList) RLP

func (a *AccessList) RLP() rlp.Value

RLP returns the AccessList as an RLP-encoded list

type AccessListEntry

type AccessListEntry struct {
	Address     Address  `json:"address"`
	StorageKeys []Data32 `json:"storageKeys"`
}

func (*AccessListEntry) DeepCopy

func (in *AccessListEntry) DeepCopy() *AccessListEntry

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessListEntry.

func (*AccessListEntry) DeepCopyInto

func (in *AccessListEntry) DeepCopyInto(out *AccessListEntry)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Address

type Address Data20

func ECRecover

func ECRecover(h *Hash, r, s, v *Quantity) (*Address, error)

ECRecover returns the sending address, given a message digest and R, S, V values. Primarily used to recover the sender of eth.Transaction objects.

func MustAddress

func MustAddress(value string) *Address

func NewAddress

func NewAddress(value string) (*Address, error)

func (Address) Bytes

func (a Address) Bytes() []byte

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

func (*Address) RLP

func (a *Address) RLP() rlp.Value

RLP returns the Address as an RLP-encoded string, or an empty RLP string for the nil Address.

func (Address) String

func (a Address) String() string

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(data []byte) error

type Block

type Block struct {
	Number           *Quantity  `json:"number"`
	Hash             *Hash      `json:"hash"`
	ParentHash       Hash       `json:"parentHash"`
	SHA3Uncles       Data32     `json:"sha3Uncles"`
	LogsBloom        Data256    `json:"logsBloom"`
	TransactionsRoot Data32     `json:"transactionsRoot"`
	StateRoot        Data32     `json:"stateRoot"`
	ReceiptsRoot     Data32     `json:"receiptsRoot"`
	Miner            Address    `json:"miner"`
	Author           Address    `json:"author,omitempty"` // Parity-specific alias of miner
	Difficulty       Quantity   `json:"difficulty"`
	TotalDifficulty  Quantity   `json:"totalDifficulty"`
	ExtraData        Data       `json:"extraData"`
	Size             Quantity   `json:"size"`
	GasLimit         Quantity   `json:"gasLimit"`
	GasUsed          Quantity   `json:"gasUsed"`
	Timestamp        Quantity   `json:"timestamp"`
	Transactions     []TxOrHash `json:"transactions"`
	Uncles           []Hash     `json:"uncles"`

	// EIP-1559 BaseFeePerGas
	BaseFeePerGas *Quantity `json:"baseFeePerGas,omitempty"`

	// Ethhash POW Fields
	Nonce   *Data8 `json:"nonce"`
	MixHash *Data  `json:"mixHash"`

	// POA Fields (Aura)
	Step      *string `json:"step,omitempty"`
	Signature *string `json:"signature,omitempty"`

	// Parity Specific Fields
	SealFields *[]Data `json:"sealFields,omitempty"`
	// contains filtered or unexported fields
}

func (*Block) DeepCopy

func (in *Block) DeepCopy() *Block

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Block.

func (*Block) DeepCopyInto

func (in *Block) DeepCopyInto(out *Block)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Block) DepopulateTransactions

func (b *Block) DepopulateTransactions()

func (*Block) FromRaw

func (b *Block) FromRaw(input string) error

FromRaw populates Block fields from the RLP-encoded raw block input string.

func (Block) MarshalJSON

func (b Block) MarshalJSON() ([]byte, error)

func (*Block) UnmarshalJSON

func (b *Block) UnmarshalJSON(data []byte) error

type BlockNumberOrTag

type BlockNumberOrTag struct {
	// contains filtered or unexported fields
}

func MustBlockNumberOrTag

func MustBlockNumberOrTag(value string) *BlockNumberOrTag

func NewBlockNumberOrTag

func NewBlockNumberOrTag(value string) (*BlockNumberOrTag, error)

func (*BlockNumberOrTag) DeepCopy

func (in *BlockNumberOrTag) DeepCopy() *BlockNumberOrTag

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockNumberOrTag.

func (*BlockNumberOrTag) DeepCopyInto

func (in *BlockNumberOrTag) DeepCopyInto(out *BlockNumberOrTag)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (BlockNumberOrTag) MarshalJSON

func (b BlockNumberOrTag) MarshalJSON() ([]byte, error)

func (*BlockNumberOrTag) Quantity

func (b *BlockNumberOrTag) Quantity() (Quantity, bool)

func (*BlockNumberOrTag) Tag

func (b *BlockNumberOrTag) Tag() (Tag, bool)

func (*BlockNumberOrTag) UnmarshalJSON

func (b *BlockNumberOrTag) UnmarshalJSON(data []byte) error

type BlockSpecifier

type BlockSpecifier struct {
	Number           *Quantity
	Tag              *Tag
	Hash             *Hash
	RequireCanonical bool
	Raw              bool
}

func MustBlockSpecifier

func MustBlockSpecifier(value interface{}) *BlockSpecifier

func NewBlockSpecifier

func NewBlockSpecifier(value interface{}) (*BlockSpecifier, error)

func NewBlockSpecifierFromMap

func NewBlockSpecifierFromMap(value map[string]interface{}) (*BlockSpecifier, error)

func NewBlockSpecifierFromString

func NewBlockSpecifierFromString(value string) (*BlockSpecifier, error)

func (*BlockSpecifier) DeepCopy

func (in *BlockSpecifier) DeepCopy() *BlockSpecifier

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockSpecifier.

func (*BlockSpecifier) DeepCopyInto

func (in *BlockSpecifier) DeepCopyInto(out *BlockSpecifier)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BlockSpecifier) GetHash

func (b *BlockSpecifier) GetHash() (*Hash, bool)

func (*BlockSpecifier) GetQuantity

func (b *BlockSpecifier) GetQuantity() (*Quantity, bool)

func (*BlockSpecifier) GetTag

func (b *BlockSpecifier) GetTag() (*Tag, bool)

func (BlockSpecifier) MarshalJSON

func (b BlockSpecifier) MarshalJSON() ([]byte, error)

func (*BlockSpecifier) UnmarshalJSON

func (b *BlockSpecifier) UnmarshalJSON(data []byte) error

type Bloom

type Bloom struct {
	// contains filtered or unexported fields
}

+k8s:deepcopy-gen=false

func (*Bloom) AddAddress

func (b *Bloom) AddAddress(addr Address)

func (*Bloom) AddBytes

func (b *Bloom) AddBytes(_bytes []byte)

func (*Bloom) AddData32

func (b *Bloom) AddData32(data Data32)

func (*Bloom) AddLog

func (b *Bloom) AddLog(log Log)

func (*Bloom) MatchesAddress

func (b *Bloom) MatchesAddress(addr Address) bool

func (*Bloom) MatchesBytes

func (b *Bloom) MatchesBytes(_bytes []byte) bool

func (*Bloom) MatchesData32

func (b *Bloom) MatchesData32(data Data32) bool

func (*Bloom) MatchesLog

func (b *Bloom) MatchesLog(log Log) bool

func (*Bloom) Value

func (b *Bloom) Value() Data256

type Condition

type Condition json.RawMessage

func (Condition) DeepCopy

func (in Condition) DeepCopy() Condition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.

func (Condition) DeepCopyInto

func (in Condition) DeepCopyInto(out *Condition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Data

type Data string

func MustData

func MustData(value string) *Data

func NewData

func NewData(value string) (*Data, error)

func (Data) Bytes

func (d Data) Bytes() []byte

func (Data) Hash

func (d Data) Hash() Hash

Hash returns the keccak256 hash of the Data.

func (Data) MarshalJSON

func (d Data) MarshalJSON() ([]byte, error)

func (*Data) RLP

func (d *Data) RLP() rlp.Value

RLP returns the Data as an RLP-encoded string.

func (Data) String

func (d Data) String() string

func (*Data) UnmarshalJSON

func (d *Data) UnmarshalJSON(data []byte) error

type Data20

type Data20 Data

func MustData20

func MustData20(value string) *Data20

func NewData20

func NewData20(value string) (*Data20, error)

func (Data20) Bytes

func (d Data20) Bytes() []byte

func (Data20) Hash

func (d Data20) Hash() Hash

Hash returns the keccak256 hash of the Data20.

func (Data20) String

func (d Data20) String() string

func (*Data20) UnmarshalJSON

func (d *Data20) UnmarshalJSON(data []byte) error

type Data256

type Data256 Data

func MustData256

func MustData256(value string) *Data256

func NewData256

func NewData256(value string) (*Data256, error)

func (Data256) Bytes

func (d Data256) Bytes() []byte

func (Data256) Hash

func (d Data256) Hash() Hash

Hash returns the keccak256 hash of the Data256.

func (Data256) String

func (d Data256) String() string

func (*Data256) UnmarshalJSON

func (d *Data256) UnmarshalJSON(data []byte) error

type Data32

type Data32 Data

func MustData32

func MustData32(value string) *Data32

func NewData32

func NewData32(value string) (*Data32, error)

func (Data32) Bytes

func (d Data32) Bytes() []byte

func (Data32) Hash

func (d Data32) Hash() Hash

Hash returns the keccak256 hash of the Data32.

func (*Data32) RLP

func (d *Data32) RLP() rlp.Value

RLP returns the Data32 as an RLP-encoded string.

func (Data32) String

func (d Data32) String() string

func (*Data32) UnmarshalJSON

func (d *Data32) UnmarshalJSON(data []byte) error

type Data8

type Data8 Data

func MustData8

func MustData8(value string) *Data8

func NewData8

func NewData8(value string) (*Data8, error)

func (Data8) Bytes

func (d Data8) Bytes() []byte

func (Data8) Hash

func (d Data8) Hash() Hash

Hash returns the keccak256 hash of the Data8.

func (Data8) String

func (d Data8) String() string

func (*Data8) UnmarshalJSON

func (d *Data8) UnmarshalJSON(data []byte) error

type Hash

type Hash = Data32

Aliases

func MustHash

func MustHash(value string) *Hash

func MustTopic

func MustTopic(value string) *Hash

func NewHash

func NewHash(value string) (*Hash, error)

func NewTopic

func NewTopic(value string) (*Hash, error)

type Log

type Log struct {
	Removed     bool      `json:"removed"`
	LogIndex    *Quantity `json:"logIndex"`
	TxIndex     *Quantity `json:"transactionIndex"`
	TxHash      *Hash     `json:"transactionHash"`
	BlockHash   *Hash     `json:"blockHash"`
	BlockNumber *Quantity `json:"blockNumber"`
	Address     Address   `json:"address"`
	Data        Data      `json:"data"`
	Topics      []Topic   `json:"topics"`

	// Parity-specific fields
	TxLogIndex *Quantity `json:"transactionLogIndex,omitempty"`
	Type       *string   `json:"type,omitempty"`
}

func (*Log) DeepCopy

func (in *Log) DeepCopy() *Log

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Log.

func (*Log) DeepCopyInto

func (in *Log) DeepCopyInto(out *Log)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LogFilter

type LogFilter struct {
	FromBlock *BlockNumberOrTag `json:"fromBlock,omitempty"`
	ToBlock   *BlockNumberOrTag `json:"toBlock,omitempty"`
	BlockHash *Hash             `json:"blockHash,omitempty"`
	Address   []Address         `json:"address,omitempty"`
	Topics    [][]Topic         `json:"topics,omitempty"`
}

func (*LogFilter) DeepCopy

func (in *LogFilter) DeepCopy() *LogFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogFilter.

func (*LogFilter) DeepCopyInto

func (in *LogFilter) DeepCopyInto(out *LogFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*LogFilter) Matches

func (f *LogFilter) Matches(l Log) bool

Matches returns true if this filter matches the passed in log. It follows the rules expressed at: https://eth.wiki/json-rpc/API#a-note-on-specifying-topic-filters

However, note that "tags" for FromBlock and ToBlock are implicitly ignored and treated the same as if the parameter was nil. Callers should replace tags with concrete quantities for block numbers before calling this function.

func (*LogFilter) UnmarshalJSON

func (f *LogFilter) UnmarshalJSON(data []byte) error

type NewHeadsNotificationParams

type NewHeadsNotificationParams struct {
	Subscription string         `json:"subscription"`
	Result       NewHeadsResult `json:"result"`
}

func (*NewHeadsNotificationParams) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NewHeadsNotificationParams.

func (*NewHeadsNotificationParams) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NewHeadsResult

type NewHeadsResult struct {
	Number           Quantity `json:"number"`
	Hash             Hash     `json:"hash"`
	ParentHash       Hash     `json:"parentHash"`
	SHA3Uncles       Data32   `json:"sha3Uncles"`
	LogsBloom        Data256  `json:"logsBloom"`
	TransactionsRoot Data32   `json:"transactionsRoot"`
	StateRoot        Data32   `json:"stateRoot"`
	ReceiptsRoot     Data32   `json:"receiptsRoot"`
	Miner            Address  `json:"miner"`
	Author           Address  `json:"author,omitempty"` // Parity-specific alias of miner
	Difficulty       Quantity `json:"difficulty"`
	// TotalDifficulty  Quantity   `json:"totalDifficulty"`
	ExtraData Data      `json:"extraData"`
	Size      *Quantity `json:"size,omitempty"` // parity includes this geth does not
	GasLimit  Quantity  `json:"gasLimit"`
	GasUsed   Quantity  `json:"gasUsed"`
	Timestamp Quantity  `json:"timestamp"`

	// EIP-1559 BaseFeePerGas
	BaseFeePerGas *Quantity `json:"baseFeePerGas,omitempty"`

	// Ethhash POW Fields
	Nonce   *Data8 `json:"nonce"`
	MixHash *Data  `json:"mixHash"`

	// POA Fields (Aura)
	Step      *string `json:"step,omitempty"`
	Signature *string `json:"signature,omitempty"`

	// Parity Specific Fields
	SealFields *[]Data `json:"sealFields,omitempty"`
	// contains filtered or unexported fields
}

NewHeadsResult is the "result" payload in a newHeads notification. It looks a lot like a Block but is missing important fields, namely .TotalDifficulty and .Uncles

func (*NewHeadsResult) DeepCopy

func (in *NewHeadsResult) DeepCopy() *NewHeadsResult

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NewHeadsResult.

func (*NewHeadsResult) DeepCopyInto

func (in *NewHeadsResult) DeepCopyInto(out *NewHeadsResult)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NewHeadsResult) FromBlock

func (nh *NewHeadsResult) FromBlock(block *Block)

FromBlock can be used to populate a NewHeadsResult with the contents of a Block. It does a best effort to emulate a NewHeadsResult with the same flavor as the Block.

func (NewHeadsResult) MarshalJSON

func (nh NewHeadsResult) MarshalJSON() ([]byte, error)

func (*NewHeadsResult) UnmarshalJSON

func (nh *NewHeadsResult) UnmarshalJSON(data []byte) error

type NewPendingTxBodyNotificationParams

type NewPendingTxBodyNotificationParams struct {
	Subscription string      `json:"subscription"`
	Result       Transaction `json:"result"`
}

func (*NewPendingTxBodyNotificationParams) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NewPendingTxBodyNotificationParams.

func (*NewPendingTxBodyNotificationParams) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NewPendingTxNotificationParams

type NewPendingTxNotificationParams struct {
	Subscription string `json:"subscription"`
	Result       Hash   `json:"result"`
}

func (*NewPendingTxNotificationParams) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NewPendingTxNotificationParams.

func (*NewPendingTxNotificationParams) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Quantity

type Quantity struct {
	// contains filtered or unexported fields
}

func MustQuantity

func MustQuantity(value string) *Quantity

func NewQuantity

func NewQuantity(value string) (*Quantity, error)

func NewQuantityFromRLP

func NewQuantityFromRLP(v rlp.Value) (*Quantity, error)

func OptionalQuantityFromInt

func OptionalQuantityFromInt(value int) *Quantity

func QuantityFromBigInt

func QuantityFromBigInt(value *big.Int) Quantity

func QuantityFromInt64

func QuantityFromInt64(value int64) Quantity

func QuantityFromUInt64

func QuantityFromUInt64(value uint64) Quantity

func (Quantity) Big

func (q Quantity) Big() *big.Int

func (*Quantity) DeepCopy

func (in *Quantity) DeepCopy() *Quantity

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Quantity.

func (*Quantity) DeepCopyInto

func (q *Quantity) DeepCopyInto(out *Quantity)

DeepCopyInto copies Quantity values into out

func (Quantity) Int64

func (q Quantity) Int64() int64

func (Quantity) MarshalJSON

func (q Quantity) MarshalJSON() ([]byte, error)

func (Quantity) RLP

func (q Quantity) RLP() rlp.Value

func (Quantity) String

func (q Quantity) String() string

func (Quantity) UInt64

func (q Quantity) UInt64() uint64

func (*Quantity) UnmarshalJSON

func (q *Quantity) UnmarshalJSON(data []byte) error

type Signature

type Signature struct {
	// contains filtered or unexported fields
}

func ECSign

func ECSign(h *Hash, privKeyBytes []byte, chainId Quantity) (*Signature, error)

ECSign returns the signature values for a given message hash for the given chainId using the bytes of given private key. Primarily used to sign transactions before submitting them with eth_sendRawTransaction.

TODO: Currently there's no clean way to do this in with the Go runtime Looks like there have been multiple attempts to get the Koblitz curve (secp256k1) supported in golang

https://github.com/golang/go/pull/26873 <-- rejected https://github.com/golang/go/issues/26776 <-- rejected

For the meantime, we will use btcd's eliptic curve implementation.

func NewEIP155Signature

func NewEIP155Signature(r Quantity, s Quantity, v Quantity) (*Signature, error)

NewEIP155Signature creates a new Signature from EIP-155 packed R,S,V values

func NewEIP2718Signature

func NewEIP2718Signature(chainId Quantity, r Quantity, s Quantity, v Quantity) (*Signature, error)

NewEIP2718Signature creates a new Signature from discrete chainId, R, S, and V values.

func (*Signature) ChainId

func (s *Signature) ChainId() (*Quantity, error)

ChainId returns the chain id included in the signature, or an error if signature was created with unprotected pre-EIP-155 R, S, and V values.

func (*Signature) DeepCopy

func (in *Signature) DeepCopy() *Signature

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Signature.

func (*Signature) DeepCopyInto

func (in *Signature) DeepCopyInto(out *Signature)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Signature) EIP155Values

func (s *Signature) EIP155Values() (R Quantity, S Quantity, V Quantity)

EIP155Values returns the expected R,S, and V values for an EIP-155 Signature. Namely, the V value includes the EIP-155 encoded chain id.

func (*Signature) EIP2718Values

func (s *Signature) EIP2718Values() (R Quantity, S Quantity, V Quantity)

EIP2718Values returns the expected R, S, and V values for EIP-2718 signatures. Namely, the V value is simply the 0x0 or 0x1 parity bit.

func (*Signature) Recover

func (s *Signature) Recover(hash *Hash) (*Address, error)

Recover performs ECRecover on the supplied hash using the signatures R, S, and V values, returning the sender Address or an error.

type Tag

type Tag string
const (
	TagLatest   Tag = "latest"
	TagEarliest Tag = "earliest"
	TagPending  Tag = "pending"
)

func MustTag

func MustTag(s string) *Tag

func NewTag

func NewTag(s string) (*Tag, error)

func (Tag) String

func (t Tag) String() string

type Topic

type Topic = Data32

type Transaction

type Transaction struct {
	Type        *Quantity `json:"type,omitempty"`
	BlockHash   *Hash     `json:"blockHash"`
	BlockNumber *Quantity `json:"blockNumber"`
	From        Address   `json:"from"`
	Gas         Quantity  `json:"gas"`
	Hash        Hash      `json:"hash"`
	Input       Data      `json:"input"`
	Nonce       Quantity  `json:"nonce"`
	To          *Address  `json:"to"`
	Index       *Quantity `json:"transactionIndex"`
	Value       Quantity  `json:"value"`
	V           Quantity  `json:"v"`
	R           Quantity  `json:"r"`
	S           Quantity  `json:"s"`

	// Gas Price (optional since not included in EIP-1559)
	GasPrice *Quantity `json:"gasPrice,omitempty"`

	// EIP-1559 MaxFeePerGas/MaxPriorityFeePerGas (optional since only included in EIP-1559 transactions)
	MaxFeePerGas         *Quantity `json:"maxFeePerGas,omitempty"`
	MaxPriorityFeePerGas *Quantity `json:"maxPriorityFeePerGas,omitempty"`

	// Parity Fields
	StandardV *Quantity  `json:"standardV,omitempty"`
	Raw       *Data      `json:"raw,omitempty"`
	PublicKey *Data      `json:"publicKey,omitempty"`
	ChainId   *Quantity  `json:"chainId,omitempty"`
	Creates   *Address   `json:"creates,omitempty"` // Parity wiki claims this is a Hash
	Condition *Condition `json:"condition,omitempty"`

	// EIP-2930 accessList
	AccessList *AccessList `json:"accessList,omitempty"`
	// contains filtered or unexported fields
}

func (*Transaction) DeepCopy

func (in *Transaction) DeepCopy() *Transaction

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Transaction.

func (*Transaction) DeepCopyInto

func (in *Transaction) DeepCopyInto(out *Transaction)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Transaction) FromRaw

func (t *Transaction) FromRaw(input string) error

FromRaw populates a Transaction's fields from the raw transaction data supplied as a hexadecimal encoded string. For pre-EIP-2718 legacy transactions the input string is an RLP-encoded list, for transaction types defined after EIP-2718 the payload format depends on the transaction type included as the first byte. Unsigned transactions where R, S, and V are zero are not currently supported.

func (*Transaction) IsProtected

func (t *Transaction) IsProtected() bool

IsProtected returns true if a transaction is replay protected, either via EIP-155 or newer transaction formats. This method returns false for transactions with invalid signatures.

func (Transaction) MarshalJSON

func (t Transaction) MarshalJSON() ([]byte, error)

func (*Transaction) RawRepresentation

func (t *Transaction) RawRepresentation() (*Data, error)

RawRepresentation returns the transaction encoded as a raw hexadecimal data string, or an error

func (*Transaction) RequiredFields

func (t *Transaction) RequiredFields() error

RequiredFields inspects the Transaction Type and returns an error if any required fields are missing

func (*Transaction) Sign

func (t *Transaction) Sign(privateKey string, chainId Quantity) (*Data, error)

Sign uses the hex-encoded private key and chainId to update the R, S, and V values for a Transaction, and returns the raw signed transaction or an error.

func (*Transaction) Signature

func (t *Transaction) Signature() (*Signature, error)

Signature returns the R, S, V values for a transaction, and the ChainId if available

func (*Transaction) SigningHash

func (t *Transaction) SigningHash(chainId Quantity) (*Hash, error)

SigningHash returns the Keccak-256 hash of the transaction fields required for transaction signing or an error.

func (*Transaction) SigningPreimage

func (t *Transaction) SigningPreimage(chainId Quantity) (*Data, error)

SigningPreimage returns the opaque data preimage that is required for signing a given transaction type

func (*Transaction) TransactionType

func (t *Transaction) TransactionType() int64

TransactionType returns the transactions EIP-2718 type, or TransactionTypeLegacy for pre-EIP-2718 transactions.

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(data []byte) error

type TransactionReceipt

type TransactionReceipt struct {
	Type              *Quantity `json:"type,omitempty"`
	TransactionHash   Hash      `json:"transactionHash"`
	TransactionIndex  Quantity  `json:"transactionIndex"`
	BlockHash         Hash      `json:"blockHash"`
	BlockNumber       Quantity  `json:"blockNumber"`
	From              Address   `json:"from"`
	To                *Address  `json:"to"`
	CumulativeGasUsed Quantity  `json:"cumulativeGasUsed"`
	GasUsed           Quantity  `json:"gasUsed"`
	ContractAddress   *Address  `json:"contractAddress"`
	Logs              []Log     `json:"logs"`
	LogsBloom         Data256   `json:"logsBloom"`
	Root              *Data32   `json:"root,omitempty"`
	Status            *Quantity `json:"status,omitempty"`
	EffectiveGasPrice *Quantity `json:"effectiveGasPrice,omitempty"`
}

func (*TransactionReceipt) DeepCopy

func (in *TransactionReceipt) DeepCopy() *TransactionReceipt

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransactionReceipt.

func (*TransactionReceipt) DeepCopyInto

func (in *TransactionReceipt) DeepCopyInto(out *TransactionReceipt)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*TransactionReceipt) TransactionType

func (t *TransactionReceipt) TransactionType() int64

TransactionType returns the transactions EIP-2718 type, or TransactionTypeLegacy for pre-EIP-2718 transactions.

type TxOrHash

type TxOrHash struct {
	Transaction
	Populated bool `json:"-"`
}

func (*TxOrHash) DeepCopy

func (in *TxOrHash) DeepCopy() *TxOrHash

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TxOrHash.

func (*TxOrHash) DeepCopyInto

func (in *TxOrHash) DeepCopyInto(out *TxOrHash)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (TxOrHash) MarshalJSON

func (t TxOrHash) MarshalJSON() ([]byte, error)

func (*TxOrHash) UnmarshalJSON

func (t *TxOrHash) UnmarshalJSON(data []byte) error

type Uncle

type Uncle struct {
	Number           *Quantity  `json:"number"`
	Hash             *Hash      `json:"hash"`
	ParentHash       Hash       `json:"parentHash"`
	SHA3Uncles       Data32     `json:"sha3Uncles"`
	LogsBloom        Data256    `json:"logsBloom"`
	TransactionsRoot Data32     `json:"transactionsRoot"`
	StateRoot        Data32     `json:"stateRoot"`
	ReceiptsRoot     Data32     `json:"receiptsRoot"`
	Miner            Address    `json:"miner"`
	Author           Address    `json:"author,omitempty"` // Parity-specific alias of miner
	Difficulty       Quantity   `json:"difficulty"`
	TotalDifficulty  *Quantity  `json:"totalDifficulty"` // null when using Geth getUncle APIs
	ExtraData        Data       `json:"extraData"`
	Size             *Quantity  `json:"size"` // null when using parity getUncle APIs
	GasLimit         Quantity   `json:"gasLimit"`
	GasUsed          Quantity   `json:"gasUsed"`
	Timestamp        Quantity   `json:"timestamp"`
	Transactions     []TxOrHash `json:"transactions"` // missing from geth, always empty in parity
	Uncles           []Hash     `json:"uncles"`

	// Ethhash POW Fields
	Nonce   *Data8 `json:"nonce"`
	MixHash *Data  `json:"mixHash"`

	// POA Fields (Aura)
	Step      *string `json:"step,omitempty"`
	Signature *string `json:"signature,omitempty"`

	// Parity Specific Fields
	SealFields *[]Data `json:"sealFields,omitempty"`
	// contains filtered or unexported fields
}

func (*Uncle) DeepCopy

func (in *Uncle) DeepCopy() *Uncle

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Uncle.

func (*Uncle) DeepCopyInto

func (in *Uncle) DeepCopyInto(out *Uncle)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Uncle) MarshalJSON

func (u Uncle) MarshalJSON() ([]byte, error)

func (*Uncle) UnmarshalJSON

func (u *Uncle) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL