Documentation
¶
Overview ¶
Package ethereum provides interfaces to interact with the Ethereum blockchain.
Deprecated: This package is deprecated and will be removed in the future because it's based on go-ethereum which is not compatible with some L2 forks of Ethereum. All functionality provided by this package should be migrated to the new ethereumv2 package.
Index ¶
Constants ¶
const AddressLength = common.AddressLength
AddressLength is the expected length of the address
Deprecated: Use ethereumv2 package instead.
const SignatureLength = 65
SignatureLength is the expected length of the Signature.
Deprecated.
Variables ¶
var HexToAddress = common.HexToAddress
HexToAddress returns Address from hex representation.
Deprecated: Use ethereumv2 package instead.
var HexToBytes = common.FromHex
HexToBytes returns bytes from hex string.
Deprecated: Use ethereumv2 package instead.
var HexToHash = common.HexToHash
HexToHash returns Hash from hex string.
Deprecated: Use ethereumv2 package instead.
var IsHexAddress = common.IsHexAddress
IsHexAddress verifies if given string is a valid Ethereum address.
Deprecated: Use ethereumv2 package instead.
Functions ¶
func BlockNumberFromContext ¶ added in v0.5.0
BlockNumberFromContext returns the block number from the context.
Deprecated.
Types ¶
type Address ¶
var EmptyAddress Address
EmptyAddress contains empty Ethereum address: 0x0000000000000000000000000000000000000000
Deprecated: Use ethereumv2 package instead.
type Call ¶
type Call struct {
// Address is the contract's address.
Address Address
// Data is the raw call data.
Data []byte
}
Call represents a call to a contract.
Deprecated.
type Client ¶
type Client interface {
// BlockNumber returns the current block number.
BlockNumber(ctx context.Context) (*big.Int, error)
// Block returns the block data. The block number can be changed by using
// the WithBlockNumber context.
Block(ctx context.Context) (*types.Block, error)
// Call executes a message call transaction, which is directly
// executed in the VM of the node, but never mined into the blockchain.
Call(ctx context.Context, call Call) ([]byte, error)
// CallBlocks executes the same call on multiple blocks (counting back from the latest)
// and returns multiple results in a slice
CallBlocks(ctx context.Context, call Call, blocks []int64) ([][]byte, error)
// MultiCall works like the Call function but allows to execute multiple
// calls at once.
MultiCall(ctx context.Context, calls []Call) ([][]byte, error)
// Storage returns the value of key in the contract storage of the
// given account.
Storage(ctx context.Context, address Address, key Hash) ([]byte, error)
// Balance returns the wei balance of the given account.
Balance(ctx context.Context, address Address) (*big.Int, error)
// SendTransaction injects a signed transaction into the pending pool
// for execution.
SendTransaction(ctx context.Context, transaction *Transaction) (*Hash, error)
// FilterLogs executes a filter query.
FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
}
Client is an interface for Ethereum blockchain.
Deprecated.
type Signature ¶
type Signature [SignatureLength]byte
Signature represents the 65 byte signature.
Deprecated.
type Signer
deprecated
type Signer interface {
// Address returns account's address used to sign data. May be empty if
// the signer is used only to verify signatures.
Address() Address
// SignTransaction signs transaction. Signed transaction will be set
// to the SignedTx field in the Transaction structure.
SignTransaction(transaction *Transaction) error
// Signature signs the hash of the given data and returns it.
Signature(data []byte) (Signature, error)
// Recover returns the wallet address that created the given signature.
// TODO: Move Recover to a separate interface.
Recover(signature Signature, data []byte) (*Address, error)
}
Signer is an interface for signing messages and transactions.
Deprecated: Use ethereumv2 package instead.
type Transaction ¶
type Transaction struct {
// Address is the contract's address.
Address Address
// Nonce is the transaction nonce. If zero, the nonce will be filled
// automatically.
Nonce uint64
// PriorityFee is the maximum tip value. If nil, the suggested gas tip value
// will be used.
PriorityFee *big.Int
// MaxFee is the maximum fee value. If nil, double value of a suggested
// gas fee will be used.
MaxFee *big.Int
// GasLimit is the maximum gas available to be used for this transaction.
GasLimit *big.Int
// Data is the raw transaction data.
Data []byte
// ChainID is the transaction chain ID. If nil, the chan ID will be filled
// automatically.
ChainID *big.Int
// SignedTx contains signed transaction. The data type stored here may
// be different for various implementations.
SignedTx interface{}
}
Transaction represents Ethereum transaction.
Deprecated.