ethereum

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package ethereum implements interface for ethereum networks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ethereum

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

Ethereum implements a connection to an ethereum-type chain.

func Init

func Init(node, secret string, maxBlocks int) (*Ethereum, error)

Init returns a connection to an ethereum node, using secret if necessary for authentication. maxBlocks is required to indicate how many blocks will be taken into account for uncle management.

func (*Ethereum) AvgBlock

func (e *Ethereum) AvgBlock() int

AvgBlock returns the average time to mine a block in seconds.

func (*Ethereum) Balance

func (e *Ethereum) Balance(address, token string) (ethBal, tokBal *big.Int, err error)

Balance loads the ether balance, and the token balance if specified, onto the provided big.Int pointers, or error otherwise.

func (*Ethereum) Close

func (e *Ethereum) Close()

Close ends a connection.

func (*Ethereum) DecodeBlock

func (e *Ethereum) DecodeBlock(t interface{}) (types.Block, error)

DecodeBlock returns a struct with the values from the block data. It is used after a call to GetBlock.

func (*Ethereum) DecodeTxs

func (e *Ethereum) DecodeTxs(t interface{}) (txs []types.Trans, err error)

DecodeTxs returns a slice of transactions from the block data. It is used after a call to GetBlock.

func (*Ethereum) Get

func (e *Ethereum) Get(hash string) (*types.Trans, error)

Get returns the details of the transaction for the given hash.

func (*Ethereum) GetBlock

func (e *Ethereum) GetBlock(block uint64, full bool, response interface{}) (err error)

GetBlock returns in response the block number requested. If full, it provides all the details of the transactions.

func (*Ethereum) GetToken

func (e *Ethereum) GetToken(token string) (t types.Token, err error)

GetToken returns the name, symbol and decimals of a valid ERC20 token.

func (*Ethereum) MaxBlocks

func (e *Ethereum) MaxBlocks() int

MaxBlocks returns how many blocks will be taken into account for uncle management.

func (*Ethereum) Send

func (e *Ethereum) Send(fromAddress, toAddress, token, amount string, data []byte, key string, priceIn uint64,
	dryRun bool) (fee *big.Int, hash []byte, err error)

Send executes a transaction in the blockchain with the given parameters returning the expected fee, the transaction hash or an error otherwise. If 'dryRun' is true, the transaction will not be sent to the blockchain but still a valid hash will be returned.

Jump to

Keyboard shortcuts

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