Documentation ¶
Index ¶
- Constants
- Variables
- func Byte2String(data []byte) string
- func DecimalDiv(v *big.Int, decimals int64) *big.Int
- func DecimalMul(v *big.Int, decimals int64) *big.Int
- func Ether(i uint64) *big.Int
- func Gwei(i uint64) *big.Int
- func InEther(i *big.Int) *big.Int
- func InGwei(i *big.Int) *big.Int
- func Keccak256(v ...[]byte) []byte
- func String2Byte32(s string) [32]byte
- func ToEther(i *big.Int) *big.Int
- func ToFloatEther(i *big.Int) *big.Float
- func ToGwei(i *big.Int) *big.Int
- type AccessEntry
- type AccessList
- type Address
- type ArgBig
- type ArgBytes
- type ArgUint64
- type Block
- type BlockNumber
- type BlockNumberOrHash
- type CallMsg
- type Hash
- type Key
- type Log
- type LogFilter
- type Network
- type Receipt
- type Transaction
- func (t *Transaction) Copy() *Transaction
- func (t *Transaction) GetHash() (hash Hash, err error)
- func (t *Transaction) MarshalJSON() ([]byte, error)
- func (t *Transaction) MarshalRLPTo(dst []byte) ([]byte, error)
- func (t *Transaction) MarshalRLPWith(arena *fastrlp.Arena) (*fastrlp.Value, error)
- func (t *Transaction) UnmarshalJSON(buf []byte) error
- func (t *Transaction) UnmarshalRLP(buf []byte) error
- func (t *Transaction) UnmarshalRLPWith(v *fastrlp.Value) error
- type TransactionType
- type Wei
Constants ¶
Variables ¶
var ( // ZeroAddress is an address of all zeros ZeroAddress = Address{} // ZeroHash is a hash of all zeros ZeroHash = Hash{} )
Functions ¶
func Byte2String ¶
func String2Byte32 ¶
String2Byte32 Convert a string to a fixed length 32 byte.
Types ¶
type AccessEntry ¶
type AccessList ¶
type AccessList []AccessEntry
func (*AccessList) Copy ¶
func (a *AccessList) Copy() AccessList
func (*AccessList) MarshalRLPTo ¶
func (a *AccessList) MarshalRLPTo(dst []byte) ([]byte, error)
func (*AccessList) MarshalRLPWith ¶
func (*AccessList) UnmarshalRLP ¶
func (a *AccessList) UnmarshalRLP(buf []byte) error
func (*AccessList) UnmarshalRLPWith ¶
func (a *AccessList) UnmarshalRLPWith(v *fastrlp.Value) error
type Address ¶
type Address [20]byte
Address is an Ethereum address
func BytesToAddress ¶
BytesToAddress converts bytes to an address object
func HexToAddress ¶
HexToAddress converts an hex string value to an address object
func (Address) MarshalText ¶
MarshalText implements the marshal interface
func (*Address) UnmarshalText ¶
UnmarshalText implements the unmarshal interface
type ArgUint64 ¶
type ArgUint64 uint64
func (ArgUint64) MarshalText ¶
func (*ArgUint64) UnmarshalText ¶
type Block ¶
type Block struct { Number uint64 Hash Hash ParentHash Hash Sha3Uncles Hash TransactionsRoot Hash StateRoot Hash ReceiptsRoot Hash Miner Address Difficulty *big.Int ExtraData []byte GasLimit uint64 GasUsed uint64 Timestamp uint64 MixHash Hash Nonce [8]byte Transactions []*Transaction TransactionsHashes []Hash Uncles []Hash }
func (*Block) MarshalJSON ¶
MarshalJSON implements the marshal interface
func (*Block) UnmarshalJSON ¶
UnmarshalJSON implements the unmarshal interface
type BlockNumber ¶
type BlockNumber int
const ( Latest BlockNumber = -1 Earliest BlockNumber = -2 Pending BlockNumber = -3 )
func EncodeBlock ¶
func EncodeBlock(block ...BlockNumber) BlockNumber
func (BlockNumber) Location ¶
func (b BlockNumber) Location() string
func (BlockNumber) String ¶
func (b BlockNumber) String() string
type BlockNumberOrHash ¶
type BlockNumberOrHash interface {
Location() string
}
type CallMsg ¶
type CallMsg struct { From Address To *Address Data []byte GasPrice uint64 Gas *big.Int Value *big.Int }
func (*CallMsg) MarshalJSON ¶
MarshalJSON implements the Marshal interface.
type Hash ¶
type Hash [32]byte
Hash is an Ethereum hash
func (Hash) MarshalText ¶
MarshalText implements the marshal interface
func (*Hash) UnmarshalText ¶
UnmarshalText implements the unmarshal interface
type Log ¶
type Log struct { Removed bool LogIndex uint64 TransactionIndex uint64 TransactionHash Hash BlockHash Hash BlockNumber uint64 Address Address Topics []Hash Data []byte }
func (*Log) MarshalJSON ¶
MarshalJSON implements the marshal interface
func (*Log) UnmarshalJSON ¶
UnmarshalJSON implements the unmarshal interface
type LogFilter ¶
type LogFilter struct { Address []Address Topics [][]*Hash BlockHash *Hash From *BlockNumber To *BlockNumber }
func (*LogFilter) MarshalJSON ¶
MarshalJSON implements the Marshal interface.
func (*LogFilter) SetFromUint64 ¶
func (*LogFilter) SetTo ¶
func (l *LogFilter) SetTo(b BlockNumber)
func (*LogFilter) SetToUint64 ¶
func (*LogFilter) UnmarshalJSON ¶
type Receipt ¶
type Receipt struct { TransactionHash Hash TransactionIndex uint64 ContractAddress Address BlockHash Hash From Address BlockNumber uint64 GasUsed uint64 CumulativeGasUsed uint64 LogsBloom []byte Logs []*Log Status uint64 To *Address }
func (*Receipt) UnmarshalJSON ¶
UnmarshalJSON implements the unmarshal interface
type Transaction ¶
type Transaction struct { Type TransactionType // legacy values Hash Hash From Address To *Address Input []byte GasPrice uint64 Gas uint64 Value *big.Int Nonce uint64 V []byte R []byte S []byte // jsonrpc values BlockHash Hash BlockNumber uint64 TxnIndex uint64 // eip-2930 values ChainID *big.Int AccessList AccessList // eip-1559 values MaxPriorityFeePerGas *big.Int MaxFeePerGas *big.Int }
func (*Transaction) Copy ¶
func (t *Transaction) Copy() *Transaction
func (*Transaction) GetHash ¶
func (t *Transaction) GetHash() (hash Hash, err error)
GetHash returns the Hash of the transaction
func (*Transaction) MarshalJSON ¶
func (t *Transaction) MarshalJSON() ([]byte, error)
MarshalJSON implements the Marshal interface.
func (*Transaction) MarshalRLPTo ¶
func (t *Transaction) MarshalRLPTo(dst []byte) ([]byte, error)
MarshalRLPTo marshals the transaction to a []byte destination
func (*Transaction) MarshalRLPWith ¶
MarshalRLPWith marshals the transaction to RLP with a specific fastrlp.Arena
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(buf []byte) error
UnmarshalJSON implements the unmarshal interface
func (*Transaction) UnmarshalRLP ¶
func (t *Transaction) UnmarshalRLP(buf []byte) error
func (*Transaction) UnmarshalRLPWith ¶
func (t *Transaction) UnmarshalRLPWith(v *fastrlp.Value) error
type TransactionType ¶
type TransactionType int
const ( TransactionLegacy TransactionType = 0 // eip-2930 TransactionAccessList TransactionType = 1 // eip-1559 TransactionDynamicFee TransactionType = 2 )