ethereum

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: AGPL-3.0 Imports: 6 Imported by: 0

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

View Source
const AddressLength = common.AddressLength

AddressLength is the expected length of the address

Deprecated: Use ethereumv2 package instead.

View Source
const SignatureLength = 65

SignatureLength is the expected length of the Signature.

Deprecated.

Variables

View Source
var HexToAddress = common.HexToAddress

HexToAddress returns Address from hex representation.

Deprecated: Use ethereumv2 package instead.

View Source
var HexToBytes = common.FromHex

HexToBytes returns bytes from hex string.

Deprecated: Use ethereumv2 package instead.

View Source
var HexToHash = common.HexToHash

HexToHash returns Hash from hex string.

Deprecated: Use ethereumv2 package instead.

View Source
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

func BlockNumberFromContext(ctx context.Context) *big.Int

BlockNumberFromContext returns the block number from the context.

Deprecated.

func SHA3Hash

func SHA3Hash(b []byte) []byte

SHA3Hash calculates SHA3 hash.

Deprecated.

func WithBlockNumber added in v0.5.0

func WithBlockNumber(ctx context.Context, block *big.Int) context.Context

WithBlockNumber sets the block number in the context.

Deprecated.

Types

type Address

type Address = common.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)
	// 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 Hash

type Hash = common.Hash

type Signature

type Signature [SignatureLength]byte

Signature represents the 65 byte signature.

Deprecated.

func SignatureFromBytes

func SignatureFromBytes(b []byte) Signature

SignatureFromBytes returns Signature from bytes.

Deprecated.

func SignatureFromVRS

func SignatureFromVRS(v uint8, r [32]byte, s [32]byte) Signature

SignatureFromVRS returns Signature from VRS values.

Deprecated.

func (Signature) Bytes

func (s Signature) Bytes() []byte

Bytes returns the byte representation of the signature.

Deprecated.

func (Signature) VRS

func (s Signature) VRS() (sv uint8, sr [32]byte, ss [32]byte)

VRS returns the V, R, S values of the 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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