ethereum

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

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

Block defines wrappers for a block retrieved by the client.

func (*Block) NonceFromPrivateKey

func (b *Block) NonceFromPrivateKey(hexKey string) (uint64, error)

NonceFromPrivateKey returns the account nonce of the account given from the secp256k1 hexkey. The block number can be nil, in which case the nonce is taken from the latest known block.

func (*Block) Number

func (b *Block) Number() (*big.Int, error)

Number returns the uint64 value of the block number

func (*Block) Transaction

func (b *Block) Transaction(hash []byte) (*Transaction, error)

Transaction returns transaction from block with the given transaction hash.

Transaction hash is 32 bytes, if inputted hash is longer than 32 bytes hash will be trimmed.

func (*Block) Transactions

func (b *Block) Transactions() ([]*Transaction, error)

Transactions returns all transactions from the given block.

type Client

type Client uint32

Client defines typed wrappers for the Ethereum RPC API.

func New

func New(url string) (Client, error)

New connects a client to the given rpc URL.

func (Client) BlockByNumber

func (c Client) BlockByNumber(blockNumber *big.Int) (*Block, error)

BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.

func (Client) Close added in v0.1.22

func (c Client) Close()

func (Client) CurrentBlockNumber

func (c Client) CurrentBlockNumber() (number uint64, err error)

CurrentBlockNumber returns the most recent block number.

func (Client) CurrentChainId

func (c Client) CurrentChainId() (*big.Int, error)

CurrentChainID retrieves the current chain ID for transaction replay protection.

func (Client) NewBoundContract

func (c Client) NewBoundContract(abi io.Reader, address string) (*Contract, error)

NewBoundContract creates a low level contract interface through which calls and transactions may be made through.

type Contract

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

Contract defines typed wrappers for a contract with given abi.

func (*Contract) Method

func (c *Contract) Method(name string) (*ContractMethod, error)

Method returns the contract method with the corresponding inputted name.

func (*Contract) Methods

func (c *Contract) Methods() []*ContractMethod

Methods lists the available methods for within the given contract

type ContractMethod

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

func (*ContractMethod) Call

func (c *ContractMethod) Call(inputParameters ...interface{}) ([]interface{}, error)

Call invokes the (constant) contract method with params as input values

func (*ContractMethod) Name

func (c *ContractMethod) Name() string

func (*ContractMethod) Transact

func (c *ContractMethod) Transact(chainId *big.Int, privateKey string, inputParameters ...interface{}) (*Transaction, error)

Transact invokes the (paid) contract method with params as input values.

type Transaction

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

Transaction defines wrappers for a transaction retrieved by the client.

func (*Transaction) Chain

func (t *Transaction) Chain() (*big.Int, error)

Chain returns the EIP155 chain ID of the transaction. The return value will always be non-nil. For legacy transactions which are not replay-protected, the return value is zero.

func (*Transaction) Data

func (t *Transaction) Data() ([]byte, error)

Data returns the input data of the transaction.

func (*Transaction) Gas

func (t *Transaction) Gas() (uint64, error)

Gas returns the gas limit of the transaction.

func (*Transaction) GasFeeCap

func (t *Transaction) GasFeeCap() (*big.Int, error)

GasFeeCap returns the fee cap per gas of the transaction.

func (*Transaction) GasPrice

func (t *Transaction) GasPrice() (*big.Int, error)

GasPrice returns the gas price of the transaction

func (*Transaction) GasTipCap

func (t *Transaction) GasTipCap() (*big.Int, error)

GasTipCap returns the gasTipCap per gas of the transaction.

func (*Transaction) Hash

func (t *Transaction) Hash() ([]byte, error)

Hash returns the transaction hash.

func (*Transaction) Nonce

func (t *Transaction) Nonce() (uint64, error)

Nonce returns the sender account nonce of the transaction.

func (*Transaction) RawSignatures

func (t *Transaction) RawSignatures() (rawSignatures, error)

RawSignatureValues returns the V, R, S signature values of the transaction. The return values should not be modified by the caller.

func (*Transaction) Send

func (t *Transaction) Send() (err error)

SendTransaction injects a signed transaction into the pending pool for execution.

func (*Transaction) ToAddress

func (t *Transaction) ToAddress() ([]byte, error)

ToAddress returns the recipient address of the transaction.

func (*Transaction) Value

func (t *Transaction) Value() (*big.Int, error)

Value returns the ether amount of the transaction.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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