ethereum

package
v0.0.0-...-73b05ea Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EthToWei

func EthToWei(eth string) (*big.Int, error)

Types

type AddressGenerator

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

func NewAddressGenerator

func NewAddressGenerator(masterPublicKeyString string) (*AddressGenerator, error)

NewAddressGenerator : generate new address from master key : cfg.Ethereum.MasterPublicKey

func (*AddressGenerator) Generate

func (g *AddressGenerator) Generate(index uint64) (common.Address, error)

common.Address is pointer already, it is slice

type Client

type Client interface {
	NetworkID(ctx context.Context) (*big.Int, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
}

type Listener

type Listener struct {
	Enabled              bool
	Client               Client          `inject:""`
	Storage              storage.Storage `inject:""`
	NetworkID            string
	ConfirmedBlockNumber uint64
	TransactionHandler   TransactionHandler
}

Listener listens for transactions using geth RPC. It calls TransactionHandler for each new transactions. It will reprocess the block if TransactionHandler returns error. It will start from the block number returned from Storage.GetBlockToProcess("ethereum") or the latest block if it returned 0. Transactions can be processed more than once, it's TransactionHandler responsibility to ignore duplicates. You can run multiple Listeners if Storage is implemented correctly. Listener ignores contract creation transactions. Listener requires geth 1.7.0.

func (*Listener) Start

func (l *Listener) Start() error

func (*Listener) Stop

func (l *Listener) Stop() error

type Transaction

type Transaction struct {
	Hash string
	// Value in Wei
	ValueWei *big.Int
	To       string
}

func (*Transaction) ValueToTomo

func (t *Transaction) ValueToTomo() string

convert string value from txEnvelope to Native Token

func (*Transaction) ValueToWei

func (t *Transaction) ValueToWei() string

type TransactionHandler

type TransactionHandler func(transaction Transaction) error

Jump to

Keyboard shortcuts

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